Skip to content

Commit a202d60

Browse files
committed
fix: Correct the listeners reference
Fix the `Selection.teardown()` method to reference the correct variable jquense#2072
1 parent 7a5f5d6 commit a202d60

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/Selection.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class Selection {
9999

100100
teardown() {
101101
this.isDetached = true
102-
this.listeners = Object.create(null)
102+
this._listeners = Object.create(null)
103103
this._removeTouchMoveWindowListener && this._removeTouchMoveWindowListener()
104104
this._removeInitialEventListener && this._removeInitialEventListener()
105105
this._removeEndListener && this._removeEndListener()
@@ -108,7 +108,8 @@ class Selection {
108108
this._removeKeyUpListener && this._removeKeyUpListener()
109109
this._removeKeyDownListener && this._removeKeyDownListener()
110110
this._removeDropFromOutsideListener && this._removeDropFromOutsideListener()
111-
this._removeDragOverFromOutsideListener && this._removeDragOverFromOutsideListener()
111+
this._removeDragOverFromOutsideListener &&
112+
this._removeDragOverFromOutsideListener()
112113
}
113114

114115
isSelected(node) {
@@ -412,8 +413,8 @@ class Selection {
412413
let { x, y, isTouch } = this._initialEventData
413414
return (
414415
!isTouch &&
415-
(Math.abs(pageX - x) <= clickTolerance &&
416-
Math.abs(pageY - y) <= clickTolerance)
416+
Math.abs(pageX - x) <= clickTolerance &&
417+
Math.abs(pageY - y) <= clickTolerance
417418
)
418419
}
419420
}
@@ -455,15 +456,17 @@ export function objectsCollide(nodeA, nodeB, tolerance = 0) {
455456
bottom: bBottom = bTop,
456457
} = getBoundsForNode(nodeB)
457458

458-
return !// 'a' bottom doesn't touch 'b' top
459-
(
460-
aBottom - tolerance < bTop ||
461-
// 'a' top doesn't touch 'b' bottom
462-
aTop + tolerance > bBottom ||
463-
// 'a' right doesn't touch 'b' left
464-
aRight - tolerance < bLeft ||
465-
// 'a' left doesn't touch 'b' right
466-
aLeft + tolerance > bRight
459+
return !(
460+
// 'a' bottom doesn't touch 'b' top
461+
(
462+
aBottom - tolerance < bTop ||
463+
// 'a' top doesn't touch 'b' bottom
464+
aTop + tolerance > bBottom ||
465+
// 'a' right doesn't touch 'b' left
466+
aRight - tolerance < bLeft ||
467+
// 'a' left doesn't touch 'b' right
468+
aLeft + tolerance > bRight
469+
)
467470
)
468471
}
469472

0 commit comments

Comments
 (0)