Skip to content

Commit

Permalink
make PASSIVE_TOUCH take an argument
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Nov 30, 2017
1 parent f62f9f7 commit f038522
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/standard/gestures.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@
})();

// decide whether to use {passive: true} for gestures listening for touch events
function PASSIVE_TOUCH() {
function PASSIVE_TOUCH(eventName) {
if (isMouseEvent(eventName) || eventName === 'touchend') {
return;
}
if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && Polymer.Settings.passiveTouchGestures) {
return {passive: true};
}
Expand Down Expand Up @@ -349,8 +352,7 @@
gobj[dep] = gd = {_count: 0};
}
if (gd._count === 0) {
var options = !isMouseEvent(dep) && dep !== 'touchend' && PASSIVE_TOUCH();
node.addEventListener(dep, this.handleNative, options);
node.addEventListener(dep, this.handleNative, PASSIVE_TOUCH(dep));
}
gd[name] = (gd[name] || 0) + 1;
gd._count = (gd._count || 0) + 1;
Expand All @@ -377,8 +379,7 @@
gd[name] = (gd[name] || 1) - 1;
gd._count = (gd._count || 1) - 1;
if (gd._count === 0) {
var options = !isMouseEvent(dep) && dep !== 'touchend' && PASSIVE_TOUCH();
node.removeEventListener(dep, this.handleNative, options);
node.removeEventListener(dep, this.handleNative, PASSIVE_TOUCH(dep));
}
}
}
Expand Down

0 comments on commit f038522

Please sign in to comment.