Fix DragCanvasState to stop handling events after mouse is released

This commit is contained in:
Paulo Junior
2020-07-20 16:38:58 -03:00
parent 3f86c36c44
commit a8234a1a8d

View File

@@ -46,6 +46,15 @@ export class DragCanvasState extends AbstractDisplacementState {
}
fireMouseMoved(event: AbstractDisplacementStateEvent) {
const isMouseDown = event.event.buttons !== 0;
if (!isMouseDown) {
// If the mouse is not down, it should return to the previous state
// and stop processing the mouse move event
this.engine.getStateMachine().popState();
return;
}
if (this.config.allowDrag) {
this.engine
.getModel()