diff --git a/src/Selection.js b/src/Selection.js index f33c1feec..f3ba6c929 100644 --- a/src/Selection.js +++ b/src/Selection.js @@ -44,6 +44,7 @@ const clickInterval = 250 class Selection { constructor(node, { global = false, longPressThreshold = 250 } = {}) { + this.isDetached = false this.container = node this.globalMouse = !node || global this.longPressThreshold = longPressThreshold @@ -95,6 +96,7 @@ class Selection { } teardown() { + this.isDetached = true this.listeners = Object.create(null) this._onTouchMoveWindowListener && this._onTouchMoveWindowListener.remove() this._onInitialEventListener && this._onInitialEventListener.remove() @@ -206,6 +208,10 @@ class Selection { } _handleInitialEvent(e) { + if (this.isDetached) { + return + } + const { clientX, clientY, pageX, pageY } = getEventCoordinates(e) let node = this.container(), collides, @@ -344,7 +350,7 @@ class Selection { } _handleMoveEvent(e) { - if (this._initialEventData === null) { + if (this._initialEventData === null || this.isDetached) { return }