From 9975fec477a286eaea956b9c6d5304b7c914d9c7 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Fri, 11 Oct 2013 13:45:56 -0700 Subject: [PATCH] Only set primary touch pointer when there are no other touches removePrimaryTouch broken by removing extraneous touch identifier cloning Fixes Polymer/PointerGestures#15 --- src/touch.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/touch.js b/src/touch.js index 012edbbd..389435b8 100644 --- a/src/touch.js +++ b/src/touch.js @@ -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(); @@ -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) {