Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 32f95da

Browse files
committed
Merge pull request #16 from angular-ui/fix-touch-detection
fix(touch): correct event property Closes #12
2 parents 5777b28 + 849c997 commit 32f95da

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ui-layout.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ angular.module('ui.layout', [])
185185

186186
// FIX :
187187
// - with touch events, when using jQuery, the mouseEvent is in fact a jQueryEvent. So we use originalEvent here.
188-
lastX = mouseEvent[mouseProperty] || mouseEvent.originalEvent[mouseProperty];
188+
// - real touch events comes in the _targetTouches_ array
189+
lastX = mouseEvent[mouseProperty] ||
190+
(mouseEvent.originalEvent && mouseEvent.originalEvent[mouseProperty]) ||
191+
(mouseEvent.targetTouches ? mouseEvent.targetTouches[0][mouseProperty] : 0);
189192

190193
// Cancel previous rAF call
191194
if (animationFrameRequested) {

0 commit comments

Comments
 (0)