Skip to content

Commit

Permalink
Merge pull request #1494 from Polymer/0.8-gestures-in-core
Browse files Browse the repository at this point in the history
Fix nits from #1486
  • Loading branch information
Steve Orvell committed May 6, 2015
2 parents b90d586 + 995f5db commit e47de5b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/standard/gestures.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// but this breaks `<input>` focus and link clicks
// disable mouse handlers for MOUSE_TIMEOUT ms after
// a touchend to ignore synthetic mouse events
var MOUSE_CANCELLER = function(mouseEvent) {
var mouseCanceller = function(mouseEvent) {
mouseEvent[HANDLED_OBJ] = {skip: true};
// disable "ghost clicks"
if (mouseEvent.type === 'click') {
Expand All @@ -43,18 +43,18 @@
}
};

function IGNORE_MOUSE(set) {
function ignoreMouse(set) {
for (var i = 0, en; i < MOUSE_EVENTS.length; i++) {
en = MOUSE_EVENTS[i];
if (set) {
document.addEventListener(en, MOUSE_CANCELLER, true);
document.addEventListener(en, mouseCanceller, true);
} else {
document.removeEventListener(en, MOUSE_CANCELLER, true);
document.removeEventListener(en, mouseCanceller, true);
}
}
if (set) {
// disable MOUSE_CANCELLER after MOUSE_TIMEOUT ms
setTimeout(IGNORE_MOUSE, MOUSE_TIMEOUT);
setTimeout(ignoreMouse, MOUSE_TIMEOUT);
} else {
POINTERSTATE.mouse.target = null;
}
Expand Down Expand Up @@ -88,6 +88,7 @@

function deepTargetFind(x, y) {
var node = document.elementFromPoint(x, y);
// this code path is only taken when native ShadowDOM is used
var next = node.shadowRoot;
while(next) {
next = next.elementFromPoint(x, y);
Expand Down Expand Up @@ -149,7 +150,7 @@
// ignore syntethic mouse events after a touch
if (type === 'touchend') {
POINTERSTATE.touch.id = -1;
IGNORE_MOUSE(true);
ignoreMouse(true);
}
},

Expand Down Expand Up @@ -203,8 +204,8 @@
gd[name] = (gd[name] || 0) + 1;
}
node.addEventListener(evType, handler);
if (recognizer.touchaction) {
this.setTouchAction(node, recognizer.touchaction);
if (recognizer.touchAction) {
this.setTouchAction(node, recognizer.touchAction);
}
},

Expand Down Expand Up @@ -266,7 +267,7 @@

Gestures.register({
name: 'track',
touchaction: 'none',
touchAction: 'none',
deps: ['mousedown', 'touchmove', 'touchend'],
emits: ['track'],

Expand Down

0 comments on commit e47de5b

Please sign in to comment.