mirror of
https://github.com/projectstorm/react-diagrams.git
synced 2026-03-13 09:50:09 +08:00
Merge pull request #681 from paulocfjunior/fix-drag-canvas-state
Fix DragCanvasState to stop handling events after mouse is released
This commit is contained in:
@@ -35,6 +35,15 @@ export abstract class AbstractDisplacementState<E extends CanvasEngine = CanvasE
|
||||
type: InputType.MOUSE_MOVE,
|
||||
fire: (actionEvent: ActionEvent<React.MouseEvent>) => {
|
||||
const { event } = actionEvent;
|
||||
|
||||
if (event.buttons === 0) {
|
||||
// If buttons is 0, it means the mouse is not down, the user may have released it
|
||||
// outside of the canvas, then we eject the state
|
||||
this.eject();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.fireMouseMoved({
|
||||
displacementX: event.clientX - this.initialX,
|
||||
displacementY: event.clientY - this.initialY,
|
||||
|
||||
Reference in New Issue
Block a user