Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 78ead47

Browse files
author
Dzmitry Khadorkin
committed
1 parent 24386c2 commit 78ead47

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

jquery.ui.touch-punch.dk.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
// Set the flag to prevent other widgets from inheriting the touch event
8989
touchHandled = true;
9090
// Track movement to determine if interaction was a click
91-
this._touchMoved = false;
91+
this._touchMoved = 0;
9292
// Simulate the mouseover event
9393
simulateMouseEvent(event, 'mouseover');
9494
// Simulate the mousemove event
@@ -103,8 +103,8 @@
103103
mouseProto._touchMove = function(event) {
104104
// Ignore event if not handled
105105
if (!touchHandled) return;
106-
// Interaction was not a click
107-
this._touchMoved = true;
106+
// Interaction was less likely to be a click
107+
this._touchMoved +=1;
108108
// Simulate the mousemove event
109109
simulateMouseEvent(event, 'mousemove');
110110
};
@@ -119,8 +119,8 @@
119119
simulateMouseEvent(event, 'mouseup');
120120
// Simulate the mouseout event
121121
simulateMouseEvent(event, 'mouseout');
122-
// If the touch interaction did not move, it should trigger a click
123-
if (!this._touchMoved) simulateMouseEvent(event, 'click');
122+
// If the touch interaction did not move (much), it should trigger a click
123+
if (this._touchMoved <= 5) simulateMouseEvent(event, 'click');
124124
// Unset the flag to allow other widgets to inherit the touch event
125125
touchHandled = false;
126126
};

0 commit comments

Comments
 (0)