Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0702a4a

Browse filesBrowse files
committed
Fix incorrect firing of all registered onEnd callbacks
1 parent 2661684 commit 0702a4a
Copy full SHA for 0702a4a

File tree

Expand file treeCollapse file tree

2 files changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-4
lines changed

‎docs/dragmove.js

Copy file name to clipboardExpand all lines: docs/dragmove.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export const dragmove = function(target, handler, onStart, onEnd) {
4444
});
4545

4646
// On leaving click, stop moving.
47-
document.addEventListener(_isTouch ? "touchend" : "mouseup", function() {
47+
document.addEventListener(_isTouch ? "touchend" : "mouseup", function(e) {
4848
isMoving = false;
4949
hasStarted = false;
5050

51-
if (onEnd) {
51+
if (onEnd && e.target === handler) {
5252
onEnd(target, parseInt(target.style.left), parseInt(target.style.top));
5353
}
5454
});

‎dragmove.js

Copy file name to clipboardExpand all lines: dragmove.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ export const dragmove = function(target, handler, onStart, onEnd) {
4646
});
4747

4848
// On leaving click, stop moving.
49-
document.addEventListener(_isTouch ? "touchend" : "mouseup", function() {
49+
document.addEventListener(_isTouch ? "touchend" : "mouseup", function(e) {
5050
isMoving = false;
5151
hasStarted = false;
5252

53-
if (onEnd) {
53+
if (onEnd && e.target === handler) {
5454
onEnd(target, parseInt(target.style.left), parseInt(target.style.top));
5555
}
5656
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.