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) {