Skip to content

Commit

Permalink
fix issue with chrome 55 pointer events
Browse files Browse the repository at this point in the history
Looks like chrome sends two events for every mouse event - at the very least.
  • Loading branch information
stakach authored Jan 15, 2017
1 parent e37c32b commit 0bb3983
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ngGesture/gesture.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@
}
},

lastEventTarget,
lastEventType,
lastEventReset,
startEvent = function (event) {
event = event.originalEvent || event; // in case of jQuery

Expand All @@ -418,6 +421,22 @@
//if (event.isPrimary === true) {
// event.preventDefault();
//}

if (lastEventType == event.type && lastEventTarget == event.currentTarget) {
$timeout.cancel(lastEventReset);
lastEventType = null;
lastEventTarget = null;
lastEventReset = null;
return;
} else {
lastEventType = event.type;
lastEventTarget = event.currentTarget;
lastEventReset = $timeout(function() {
lastEventType = null;
lastEventTarget = null;
lastEventReset = null;
}, 50);
}

var element = angular.element(this),
i,
Expand Down

0 comments on commit 0bb3983

Please sign in to comment.