Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct listeners reference in the Selections.teardown() method #2075

Merged
merged 15 commits into from
Dec 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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