mirror of
https://github.com/Polymer/polymer.git
synced 2026-08-19 01:14:44 -05:00
make PASSIVE_TOUCH take an argument
This commit is contained in:
@@ -62,9 +62,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
/**
|
||||
* Generate settings for event listeners, dependant on `Polymer.passiveTouchGestures`
|
||||
*
|
||||
* @param {string} eventName Event name to determine if `{passive}` option is needed
|
||||
* @return {{passive: boolean} | undefined} Options to use for addEventListener and removeEventListener
|
||||
*/
|
||||
function PASSIVE_TOUCH() {
|
||||
function PASSIVE_TOUCH(eventName) {
|
||||
if (isMouseEvent(eventName) || eventName === 'touchend') {
|
||||
return;
|
||||
}
|
||||
if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && Polymer.passiveTouchGestures) {
|
||||
return {passive: true};
|
||||
} else {
|
||||
@@ -481,8 +485,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
gobj[dep] = gd = {_count: 0};
|
||||
}
|
||||
if (gd._count === 0) {
|
||||
let 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;
|
||||
@@ -515,8 +518,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
gd[name] = (gd[name] || 1) - 1;
|
||||
gd._count = (gd._count || 1) - 1;
|
||||
if (gd._count === 0) {
|
||||
let options = !isMouseEvent(dep) && dep !== 'touchend' && PASSIVE_TOUCH();
|
||||
node.removeEventListener(dep, this._handleNative, options);
|
||||
node.removeEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user