adds support for touch events, enabling touch dragging the canvas

This commit is contained in:
Renato Böhler
2021-04-11 20:57:27 -03:00
parent e7a606d987
commit ade86f215c
9 changed files with 109 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import { MouseEvent } from 'react';
import { MouseEvent, TouchEvent } from 'react';
import {
SelectingState,
State,
@ -48,5 +48,15 @@ export class DefaultDiagramState extends State<DiagramEngine> {
}
})
);
// touch drags the canvas
this.registerAction(
new Action({
type: InputType.TOUCH_START,
fire: (event: ActionEvent<TouchEvent>) => {
this.transitionWithEvent(this.dragCanvas, event);
}
})
);
}
}