Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Detect missed mouseup events and correct for them
Browse files Browse the repository at this point in the history
This can happen with a context menu opens, or when dragging and releasing over an iframe
  • Loading branch information
dfreedm committed Jul 11, 2014
1 parent e0fbe4c commit 2a3ea64
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,18 @@
},
mousemove: function(inEvent) {
if (!this.isEventSimulatedFromTouch(inEvent)) {
var e = this.prepareEvent(inEvent);
e.target = pointermap.get(this.POINTER_ID);
dispatcher.move(e);
var target = pointermap.get(this.POINTER_ID);
if (target) {
var e = this.prepareEvent(inEvent);
e.target = target;
// handle case where we missed a mouseup
if (e.buttons === 0) {
dispatcher.cancel(e);
this.cleanupMouse();
} else {
dispatcher.move(e);
}
}
}
},
mouseup: function(inEvent) {
Expand Down

0 comments on commit 2a3ea64

Please sign in to comment.