Skip to content

Commit

Permalink
fix: Correct the listeners reference
Browse files Browse the repository at this point in the history
Fix the `Selection.teardown()` method to reference the correct variable

jquense#2072
  • Loading branch information
cutterbl committed Dec 8, 2021
1 parent 7a5f5d6 commit a202d60
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/Selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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) {
Expand Down Expand Up @@ -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
)
}
}
Expand Down Expand Up @@ -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
)
)
}

Expand Down

0 comments on commit a202d60

Please sign in to comment.