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

Commit

Permalink
Limit pointerevent move events to when a button is down
Browse files Browse the repository at this point in the history
Fixes #37
  • Loading branch information
dfreedm committed Aug 11, 2014
1 parent 9f8e51b commit 57fb076
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/ms.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
'MSPointerCancel',
],
register: function(target) {
if (target !== document) {
return;
}
dispatcher.listen(target, this.events);
},
unregister: function(target) {
Expand Down Expand Up @@ -53,9 +50,12 @@
dispatcher.down(e);
},
MSPointerMove: function(inEvent) {
var e = this.prepareEvent(inEvent);
e.target = pointermap.get(e.pointerId);
dispatcher.move(e);
var target = pointermap.get(inEvent.pointerId);
if (target) {
var e = this.prepareEvent(inEvent);
e.target = target;
dispatcher.move(e);
}
},
MSPointerUp: function(inEvent) {
var e = this.prepareEvent(inEvent);
Expand Down
12 changes: 6 additions & 6 deletions src/pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
return e;
},
register: function(target) {
if (target !== document) {
return;
}
dispatcher.listen(target, this.events);
},
unregister: function(target) {
Expand All @@ -41,9 +38,12 @@
dispatcher.down(e);
},
pointermove: function(inEvent) {
var e = this.prepareEvent(inEvent);
e.target = pointermap.get(e.pointerId);
dispatcher.move(e);
var target = pointermap.get(inEvent.pointerId);
if (target) {
var e = this.prepareEvent(inEvent);
e.target = target;
dispatcher.move(e);
}
},
pointerup: function(inEvent) {
var e = this.prepareEvent(inEvent);
Expand Down

0 comments on commit 57fb076

Please sign in to comment.