Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Only set primary touch pointer when there are no other touches
Browse files Browse the repository at this point in the history
removePrimaryTouch broken by removing extraneous touch identifier cloning
Fixes googlearchive/PointerGestures#15
  • Loading branch information
dfreedm committed Oct 11, 2013
1 parent 6e9b6d1 commit 9975fec
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,16 @@
return this.firstTouch === inTouch.identifier;
},
setPrimaryTouch: function(inTouch) {
if (this.firstTouch === null) {
// set primary touch if there no pointers, or the only pointer is the mouse
if (pointermap.size == 0 || (pointermap.size == 1 && pointermap.has(1))) {
this.firstTouch = inTouch.identifier;
this.firstXY = {X: inTouch.clientX, Y: inTouch.clientY};
this.scrolling = false;
this.cancelResetClickCount();
}
},
removePrimaryTouch: function(inTouch) {
if (this.isPrimaryTouch(inTouch)) {
removePrimaryPointer: function(inPointer) {
if (inPointer.isPrimary) {
this.firstTouch = null;
this.firstXY = null;
this.resetClickCount();
Expand Down Expand Up @@ -291,7 +292,7 @@
},
cleanUpPointer: function(inPointer) {
pointermap.delete(inPointer.pointerId);
this.removePrimaryTouch(inPointer);
this.removePrimaryPointer(inPointer);
},
// prevent synth mouse events from creating pointer events
dedupSynthMouse: function(inEvent) {
Expand Down

0 comments on commit 9975fec

Please sign in to comment.