Permalink
Browse files

Touchaction: Fix detection of tap when multi touch gestures are present

Fixes determination of if it is acceptable to prevent the browser default behavior of scrolling/zoom etc when the touch-action property is set to none and the browser does not provide native support for the touch-action property. It fails to differenciate between a tap gesture and a multi-touch gesture which results in click and hover events from not getting recognized when an element has multi-touch gesture associated with it.

Ref #838
Ref #808
Closes #762
  • Loading branch information...
apillai authored and arschmitz committed Feb 10, 2015
1 parent 92f2d76 commit c46cbba1c2cbbf874b59913416858d9dae297e64
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/touchaction.js
View
@@ -83,6 +83,18 @@ TouchAction.prototype = {
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
if (hasNone) {
//do not prevent defaults if this is a tap gesture
var isTapPointer = input.pointers.length === 1;
var isTapMovement = input.distance < 2;
var isTapTouchTime = input.deltaTime < 250;
if (isTapPointer && isTapMovement && isTapTouchTime) {
return;
}
}
if (hasNone ||
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
(hasPanX && direction & DIRECTION_VERTICAL)) {

0 comments on commit c46cbba

Please sign in to comment.