From a202d60264b3a83a6a200dc6e3ee6ed86ec37462 Mon Sep 17 00:00:00 2001 From: "Blades, Stephen" Date: Wed, 8 Dec 2021 15:53:54 -0600 Subject: [PATCH] fix: Correct the listeners reference Fix the `Selection.teardown()` method to reference the correct variable #2072 --- src/Selection.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/Selection.js b/src/Selection.js index 1231747a9..34793bf53 100644 --- a/src/Selection.js +++ b/src/Selection.js @@ -99,7 +99,7 @@ class Selection { teardown() { this.isDetached = true - this.listeners = Object.create(null) + this._listeners = Object.create(null) this._removeTouchMoveWindowListener && this._removeTouchMoveWindowListener() this._removeInitialEventListener && this._removeInitialEventListener() this._removeEndListener && this._removeEndListener() @@ -108,7 +108,8 @@ class Selection { this._removeKeyUpListener && this._removeKeyUpListener() this._removeKeyDownListener && this._removeKeyDownListener() this._removeDropFromOutsideListener && this._removeDropFromOutsideListener() - this._removeDragOverFromOutsideListener && this._removeDragOverFromOutsideListener() + this._removeDragOverFromOutsideListener && + this._removeDragOverFromOutsideListener() } isSelected(node) { @@ -412,8 +413,8 @@ class Selection { let { x, y, isTouch } = this._initialEventData return ( !isTouch && - (Math.abs(pageX - x) <= clickTolerance && - Math.abs(pageY - y) <= clickTolerance) + Math.abs(pageX - x) <= clickTolerance && + Math.abs(pageY - y) <= clickTolerance ) } } @@ -455,15 +456,17 @@ export function objectsCollide(nodeA, nodeB, tolerance = 0) { bottom: bBottom = bTop, } = getBoundsForNode(nodeB) - return !// 'a' bottom doesn't touch 'b' top - ( - aBottom - tolerance < bTop || - // 'a' top doesn't touch 'b' bottom - aTop + tolerance > bBottom || - // 'a' right doesn't touch 'b' left - aRight - tolerance < bLeft || - // 'a' left doesn't touch 'b' right - aLeft + tolerance > bRight + return !( + // 'a' bottom doesn't touch 'b' top + ( + aBottom - tolerance < bTop || + // 'a' top doesn't touch 'b' bottom + aTop + tolerance > bBottom || + // 'a' right doesn't touch 'b' left + aRight - tolerance < bLeft || + // 'a' left doesn't touch 'b' right + aLeft + tolerance > bRight + ) ) }