From d6f64f113fb99af26cf197d602ed6ae3ab73090b Mon Sep 17 00:00:00 2001 From: Stuart Yamartino Date: Sun, 23 Oct 2016 22:01:01 -0400 Subject: [PATCH 1/2] Cancel the polyfill if at any point force is detected --- dist/jquery.pressure.js | 16 ++++++++++++---- dist/jquery.pressure.min.js | 2 +- dist/pressure.js | 16 ++++++++++++---- dist/pressure.min.js | 2 +- src/adapters/adapter.js | 9 ++++++++- src/adapters/adapter_3d_touch.js | 4 ++-- src/adapters/adapter_force_touch.js | 2 +- 7 files changed, 37 insertions(+), 14 deletions(-) diff --git a/dist/jquery.pressure.js b/dist/jquery.pressure.js index 19665aa..588bf00 100644 --- a/dist/jquery.pressure.js +++ b/dist/jquery.pressure.js @@ -120,6 +120,7 @@ var Adapter = function () { this.options = options; this.pressed = false; this.deepPressed = false; + this.nativeSupport = false; this.runKey = Math.random(); } @@ -192,6 +193,12 @@ var Adapter = function () { this.runClosure('startDeepPress', event); } } + }, { + key: "_changePress", + value: function _changePress(force, event) { + this.nativeSupport = true; + this.runClosure('change', force, event); + } }, { key: "_endDeepPress", value: function _endDeepPress() { @@ -209,6 +216,7 @@ var Adapter = function () { this.runClosure('end'); } this.runKey = Math.random(); + this.nativeSupport = false; } }, { key: "runPolyfill", @@ -221,7 +229,7 @@ var Adapter = function () { }, { key: "loopPolyfillForce", value: function loopPolyfillForce(force, event) { - if (this.isPressed()) { + if (this.isPressed() && this.nativeSupport === false) { this.runClosure('change', force, event); force >= 0.5 ? this._startDeepPress(event) : this._endDeepPress(); force = force + this.increment > 1 ? 1 : force + this.increment; @@ -268,7 +276,7 @@ var AdapterForceTouch = function (_Adapter) { key: "change", value: function change(event) { if (this.isPressed() && event.webkitForce > 0) { - this.runClosure('change', this.normalizeForce(event.webkitForce), event); + this._changePress(this.normalizeForce(event.webkitForce), event); } } @@ -322,7 +330,7 @@ var Adapter3DTouch = function (_Adapter2) { value: function start(event) { if (event.touches.length > 0) { this._startPress(event); - this.runClosure('change', this.selectTouch(event).force, event); + this._changePress(this.selectTouch(event).force, event); } } }, { @@ -369,7 +377,7 @@ var Adapter3DTouch = function (_Adapter2) { if (this.isPressed()) { this.touch = this.selectTouch(event); setTimeout(this.loopForce.bind(this, event), 10); - this.runClosure('change', this.touch.force, event); + this._changePress(this.touch.force, event); } } diff --git a/dist/jquery.pressure.min.js b/dist/jquery.pressure.min.js index 593a4be..eaafec1 100644 --- a/dist/jquery.pressure.min.js +++ b/dist/jquery.pressure.min.js @@ -1,2 +1,2 @@ // Pressure v2.0.0 | Created By Stuart Yamartino | MIT License | 2015 - 2016 -!function(e,t,s){"use strict";function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var s=0;s=.5?this._startDeepPress(t):this._endDeepPress(),e=e+this.increment>1?1:e+this.increment,setTimeout(this.loopPolyfillForce.bind(this,e,t),10))}}]),e}(),a=function(e){function t(e,s,i){return r(this,t),n(this,Object.getPrototypeOf(t).call(this,e,s,i))}return i(t,e),o(t,[{key:"bindEvents",value:function(){this.add("webkitmouseforcewillbegin",this._startPress.bind(this)),this.add("mousedown",this.support.bind(this)),this.add("webkitmouseforcechanged",this.change.bind(this)),this.add("webkitmouseforcedown",this._startDeepPress.bind(this)),this.add("webkitmouseforceup",this._endDeepPress.bind(this)),this.add("mouseleave",this._endPress.bind(this)),this.add("mouseup",this._endPress.bind(this))}},{key:"support",value:function(e){this.isPressed()===!1&&this.fail(e,this.runKey)}},{key:"change",value:function(e){this.isPressed()&&e.webkitForce>0&&this.runClosure("change",this.normalizeForce(e.webkitForce),e)}},{key:"normalizeForce",value:function(e){return this.reachOne(b(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.995?1:e}}]),t}(c),d=function(e){function t(e,s,i){return r(this,t),n(this,Object.getPrototypeOf(t).call(this,e,s,i))}return i(t,e),o(t,[{key:"bindEvents",value:function(){m?(this.add("touchforcechange",this.start.bind(this)),this.add("touchstart",this.supportTest.bind(this,0)),this.add("touchend",this._endPress.bind(this))):(this.add("touchstart",this.startLegacyTest.bind(this)),this.add("touchend",this._endPress.bind(this)))}},{key:"start",value:function(e){e.touches.length>0&&(this._startPress(e),this.runClosure("change",this.selectTouch(e).force,e))}},{key:"supportTest",value:function(e,t){var s=arguments.length<=2||void 0===arguments[2]?this.runKey:arguments[2];this.isPressed()===!1&&(6>=e?(e++,setTimeout(this.supportTest.bind(this,e,t,s),10)):this.fail(t,s))}},{key:"startLegacyTest",value:function(e){this.initialForce=e.touches[0].force,this.supportLegacyTest(0,e,this.runKey,this.initialForce)}},{key:"supportLegacyTest",value:function(e,t,s,n){n!==this.initialForce?(this._startPress(t),this.loopForce(t)):6>=e?(e++,setTimeout(this.supportLegacyTest.bind(this,e,t,s,n),10)):this.fail(t,s)}},{key:"loopForce",value:function(e){this.isPressed()&&(this.touch=this.selectTouch(e),setTimeout(this.loopForce.bind(this,e),10),this.runClosure("change",this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t=.5?this._startDeepPress(t):this._endDeepPress(),e}}]),t}(c),f={polyfill:!0,polyfillSpeed:1e3,preventSelect:!0,only:null,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},p=function(e,s){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof e||e instanceof String)for(var i=t.querySelectorAll(e),r=0;r=.5?this._startDeepPress(t):this._endDeepPress(),e=e+this.increment>1?1:e+this.increment,setTimeout(this.loopPolyfillForce.bind(this,e,t),10))}}]),e}(),a=function(e){function t(e,s,i){return r(this,t),n(this,Object.getPrototypeOf(t).call(this,e,s,i))}return i(t,e),o(t,[{key:"bindEvents",value:function(){this.add("webkitmouseforcewillbegin",this._startPress.bind(this)),this.add("mousedown",this.support.bind(this)),this.add("webkitmouseforcechanged",this.change.bind(this)),this.add("webkitmouseforcedown",this._startDeepPress.bind(this)),this.add("webkitmouseforceup",this._endDeepPress.bind(this)),this.add("mouseleave",this._endPress.bind(this)),this.add("mouseup",this._endPress.bind(this))}},{key:"support",value:function(e){this.isPressed()===!1&&this.fail(e,this.runKey)}},{key:"change",value:function(e){this.isPressed()&&e.webkitForce>0&&this._changePress(this.normalizeForce(e.webkitForce),e)}},{key:"normalizeForce",value:function(e){return this.reachOne(v(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.995?1:e}}]),t}(c),d=function(e){function t(e,s,i){return r(this,t),n(this,Object.getPrototypeOf(t).call(this,e,s,i))}return i(t,e),o(t,[{key:"bindEvents",value:function(){k?(this.add("touchforcechange",this.start.bind(this)),this.add("touchstart",this.supportTest.bind(this,0)),this.add("touchend",this._endPress.bind(this))):(this.add("touchstart",this.startLegacyTest.bind(this)),this.add("touchend",this._endPress.bind(this)))}},{key:"start",value:function(e){e.touches.length>0&&(this._startPress(e),this._changePress(this.selectTouch(e).force,e))}},{key:"supportTest",value:function(e,t){var s=arguments.length<=2||void 0===arguments[2]?this.runKey:arguments[2];this.isPressed()===!1&&(6>=e?(e++,setTimeout(this.supportTest.bind(this,e,t,s),10)):this.fail(t,s))}},{key:"startLegacyTest",value:function(e){this.initialForce=e.touches[0].force,this.supportLegacyTest(0,e,this.runKey,this.initialForce)}},{key:"supportLegacyTest",value:function(e,t,s,n){n!==this.initialForce?(this._startPress(t),this.loopForce(t)):6>=e?(e++,setTimeout(this.supportLegacyTest.bind(this,e,t,s,n),10)):this.fail(t,s)}},{key:"loopForce",value:function(e){this.isPressed()&&(this.touch=this.selectTouch(e),setTimeout(this.loopForce.bind(this,e),10),this._changePress(this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t=.5?this._startDeepPress(t):this._endDeepPress(),e}}]),t}(c),f={polyfill:!0,polyfillSpeed:1e3,preventSelect:!0,only:null,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},p=function(e,s){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof e||e instanceof String)for(var i=t.querySelectorAll(e),r=0;r= 0.5 ? this._startDeepPress(event) : this._endDeepPress(); force = force + this.increment > 1 ? 1 : force + this.increment; @@ -275,7 +283,7 @@ var AdapterForceTouch = function (_Adapter) { key: "change", value: function change(event) { if (this.isPressed() && event.webkitForce > 0) { - this.runClosure('change', this.normalizeForce(event.webkitForce), event); + this._changePress(this.normalizeForce(event.webkitForce), event); } } @@ -329,7 +337,7 @@ var Adapter3DTouch = function (_Adapter2) { value: function start(event) { if (event.touches.length > 0) { this._startPress(event); - this.runClosure('change', this.selectTouch(event).force, event); + this._changePress(this.selectTouch(event).force, event); } } }, { @@ -376,7 +384,7 @@ var Adapter3DTouch = function (_Adapter2) { if (this.isPressed()) { this.touch = this.selectTouch(event); setTimeout(this.loopForce.bind(this, event), 10); - this.runClosure('change', this.touch.force, event); + this._changePress(this.touch.force, event); } } diff --git a/dist/pressure.min.js b/dist/pressure.min.js index 20642f9..b7ec62c 100644 --- a/dist/pressure.min.js +++ b/dist/pressure.min.js @@ -1,2 +1,2 @@ // Pressure v2.0.0 | Created By Stuart Yamartino | MIT License | 2015 - 2016 -!function(e,t){"use strict";function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var s=0;s=.5?this._startDeepPress(t):this._endDeepPress(),e=e+this.increment>1?1:e+this.increment,setTimeout(this.loopPolyfillForce.bind(this,e,t),10))}}]),e}(),a=function(e){function t(e,n,r){return i(this,t),s(this,Object.getPrototypeOf(t).call(this,e,n,r))}return n(t,e),r(t,[{key:"bindEvents",value:function(){this.add("webkitmouseforcewillbegin",this._startPress.bind(this)),this.add("mousedown",this.support.bind(this)),this.add("webkitmouseforcechanged",this.change.bind(this)),this.add("webkitmouseforcedown",this._startDeepPress.bind(this)),this.add("webkitmouseforceup",this._endDeepPress.bind(this)),this.add("mouseleave",this._endPress.bind(this)),this.add("mouseup",this._endPress.bind(this))}},{key:"support",value:function(e){this.isPressed()===!1&&this.fail(e,this.runKey)}},{key:"change",value:function(e){this.isPressed()&&e.webkitForce>0&&this.runClosure("change",this.normalizeForce(e.webkitForce),e)}},{key:"normalizeForce",value:function(e){return this.reachOne(b(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.995?1:e}}]),t}(c),d=function(e){function t(e,n,r){return i(this,t),s(this,Object.getPrototypeOf(t).call(this,e,n,r))}return n(t,e),r(t,[{key:"bindEvents",value:function(){m?(this.add("touchforcechange",this.start.bind(this)),this.add("touchstart",this.supportTest.bind(this,0)),this.add("touchend",this._endPress.bind(this))):(this.add("touchstart",this.startLegacyTest.bind(this)),this.add("touchend",this._endPress.bind(this)))}},{key:"start",value:function(e){e.touches.length>0&&(this._startPress(e),this.runClosure("change",this.selectTouch(e).force,e))}},{key:"supportTest",value:function(e,t){var s=arguments.length<=2||void 0===arguments[2]?this.runKey:arguments[2];this.isPressed()===!1&&(6>=e?(e++,setTimeout(this.supportTest.bind(this,e,t,s),10)):this.fail(t,s))}},{key:"startLegacyTest",value:function(e){this.initialForce=e.touches[0].force,this.supportLegacyTest(0,e,this.runKey,this.initialForce)}},{key:"supportLegacyTest",value:function(e,t,s,n){n!==this.initialForce?(this._startPress(t),this.loopForce(t)):6>=e?(e++,setTimeout(this.supportLegacyTest.bind(this,e,t,s,n),10)):this.fail(t,s)}},{key:"loopForce",value:function(e){this.isPressed()&&(this.touch=this.selectTouch(e),setTimeout(this.loopForce.bind(this,e),10),this.runClosure("change",this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t=.5?this._startDeepPress(t):this._endDeepPress(),e}}]),t}(c),f={polyfill:!0,polyfillSpeed:1e3,preventSelect:!0,only:null,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},p=function(e,s){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof e||e instanceof String)for(var i=t.querySelectorAll(e),r=0;r=.5?this._startDeepPress(t):this._endDeepPress(),e=e+this.increment>1?1:e+this.increment,setTimeout(this.loopPolyfillForce.bind(this,e,t),10))}}]),e}(),a=function(e){function t(e,n,r){return i(this,t),s(this,Object.getPrototypeOf(t).call(this,e,n,r))}return n(t,e),r(t,[{key:"bindEvents",value:function(){this.add("webkitmouseforcewillbegin",this._startPress.bind(this)),this.add("mousedown",this.support.bind(this)),this.add("webkitmouseforcechanged",this.change.bind(this)),this.add("webkitmouseforcedown",this._startDeepPress.bind(this)),this.add("webkitmouseforceup",this._endDeepPress.bind(this)),this.add("mouseleave",this._endPress.bind(this)),this.add("mouseup",this._endPress.bind(this))}},{key:"support",value:function(e){this.isPressed()===!1&&this.fail(e,this.runKey)}},{key:"change",value:function(e){this.isPressed()&&e.webkitForce>0&&this._changePress(this.normalizeForce(e.webkitForce),e)}},{key:"normalizeForce",value:function(e){return this.reachOne(v(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.995?1:e}}]),t}(l),d=function(e){function t(e,n,r){return i(this,t),s(this,Object.getPrototypeOf(t).call(this,e,n,r))}return n(t,e),r(t,[{key:"bindEvents",value:function(){k?(this.add("touchforcechange",this.start.bind(this)),this.add("touchstart",this.supportTest.bind(this,0)),this.add("touchend",this._endPress.bind(this))):(this.add("touchstart",this.startLegacyTest.bind(this)),this.add("touchend",this._endPress.bind(this)))}},{key:"start",value:function(e){e.touches.length>0&&(this._startPress(e),this._changePress(this.selectTouch(e).force,e))}},{key:"supportTest",value:function(e,t){var s=arguments.length<=2||void 0===arguments[2]?this.runKey:arguments[2];this.isPressed()===!1&&(6>=e?(e++,setTimeout(this.supportTest.bind(this,e,t,s),10)):this.fail(t,s))}},{key:"startLegacyTest",value:function(e){this.initialForce=e.touches[0].force,this.supportLegacyTest(0,e,this.runKey,this.initialForce)}},{key:"supportLegacyTest",value:function(e,t,s,n){n!==this.initialForce?(this._startPress(t),this.loopForce(t)):6>=e?(e++,setTimeout(this.supportLegacyTest.bind(this,e,t,s,n),10)):this.fail(t,s)}},{key:"loopForce",value:function(e){this.isPressed()&&(this.touch=this.selectTouch(e),setTimeout(this.loopForce.bind(this,e),10),this._changePress(this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t=.5?this._startDeepPress(t):this._endDeepPress(),e}}]),t}(l),f={polyfill:!0,polyfillSpeed:1e3,preventSelect:!0,only:null,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},p=function(e,s){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof e||e instanceof String)for(var i=t.querySelectorAll(e),r=0;r= 0.5 ? this._startDeepPress(event) : this._endDeepPress(); force = force + this.increment > 1 ? 1 : force + this.increment; diff --git a/src/adapters/adapter_3d_touch.js b/src/adapters/adapter_3d_touch.js index c76a9c0..c58b711 100644 --- a/src/adapters/adapter_3d_touch.js +++ b/src/adapters/adapter_3d_touch.js @@ -22,7 +22,7 @@ class Adapter3DTouch extends Adapter{ start(event){ if(event.touches.length > 0){ this._startPress(event); - this.runClosure('change', this.selectTouch(event).force, event); + this._changePress(this.selectTouch(event).force, event); } } @@ -61,7 +61,7 @@ class Adapter3DTouch extends Adapter{ if(this.isPressed()) { this.touch = this.selectTouch(event); setTimeout(this.loopForce.bind(this, event), 10); - this.runClosure('change', this.touch.force, event); + this._changePress(this.touch.force, event); } } diff --git a/src/adapters/adapter_force_touch.js b/src/adapters/adapter_force_touch.js index 802b5de..4156d2c 100644 --- a/src/adapters/adapter_force_touch.js +++ b/src/adapters/adapter_force_touch.js @@ -26,7 +26,7 @@ class AdapterForceTouch extends Adapter{ change(event){ if(this.isPressed() && event.webkitForce > 0){ - this.runClosure('change', this.normalizeForce(event.webkitForce), event); + this._changePress(this.normalizeForce(event.webkitForce), event); } } From d23aaad87217afd37a0ab0f7bc1859c1b74a9866 Mon Sep 17 00:00:00 2001 From: Stuart Yamartino Date: Sun, 23 Oct 2016 22:11:44 -0400 Subject: [PATCH 2/2] Bumped version numbers --- bower.json | 2 +- dist/jquery.pressure.js | 2 +- dist/jquery.pressure.min.js | 2 +- dist/pressure.js | 2 +- dist/pressure.min.js | 2 +- package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 8df420f..b792f31 100644 --- a/bower.json +++ b/bower.json @@ -29,5 +29,5 @@ "test", "tests" ], - "version": "2.0.0" + "version": "2.0.1" } diff --git a/dist/jquery.pressure.js b/dist/jquery.pressure.js index 588bf00..bdfba81 100644 --- a/dist/jquery.pressure.js +++ b/dist/jquery.pressure.js @@ -1,4 +1,4 @@ -// Pressure v2.0.0 | Created By Stuart Yamartino | MIT License | 2015 - 2016 +// Pressure v2.0.1 | Created By Stuart Yamartino | MIT License | 2015 - 2016 ;(function(window, document, $) { "use strict"; diff --git a/dist/jquery.pressure.min.js b/dist/jquery.pressure.min.js index eaafec1..5035a52 100644 --- a/dist/jquery.pressure.min.js +++ b/dist/jquery.pressure.min.js @@ -1,2 +1,2 @@ -// Pressure v2.0.0 | Created By Stuart Yamartino | MIT License | 2015 - 2016 +// Pressure v2.0.1 | Created By Stuart Yamartino | MIT License | 2015 - 2016 !function(e,t,s){"use strict";function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var s=0;s=.5?this._startDeepPress(t):this._endDeepPress(),e=e+this.increment>1?1:e+this.increment,setTimeout(this.loopPolyfillForce.bind(this,e,t),10))}}]),e}(),a=function(e){function t(e,s,i){return r(this,t),n(this,Object.getPrototypeOf(t).call(this,e,s,i))}return i(t,e),o(t,[{key:"bindEvents",value:function(){this.add("webkitmouseforcewillbegin",this._startPress.bind(this)),this.add("mousedown",this.support.bind(this)),this.add("webkitmouseforcechanged",this.change.bind(this)),this.add("webkitmouseforcedown",this._startDeepPress.bind(this)),this.add("webkitmouseforceup",this._endDeepPress.bind(this)),this.add("mouseleave",this._endPress.bind(this)),this.add("mouseup",this._endPress.bind(this))}},{key:"support",value:function(e){this.isPressed()===!1&&this.fail(e,this.runKey)}},{key:"change",value:function(e){this.isPressed()&&e.webkitForce>0&&this._changePress(this.normalizeForce(e.webkitForce),e)}},{key:"normalizeForce",value:function(e){return this.reachOne(v(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.995?1:e}}]),t}(c),d=function(e){function t(e,s,i){return r(this,t),n(this,Object.getPrototypeOf(t).call(this,e,s,i))}return i(t,e),o(t,[{key:"bindEvents",value:function(){k?(this.add("touchforcechange",this.start.bind(this)),this.add("touchstart",this.supportTest.bind(this,0)),this.add("touchend",this._endPress.bind(this))):(this.add("touchstart",this.startLegacyTest.bind(this)),this.add("touchend",this._endPress.bind(this)))}},{key:"start",value:function(e){e.touches.length>0&&(this._startPress(e),this._changePress(this.selectTouch(e).force,e))}},{key:"supportTest",value:function(e,t){var s=arguments.length<=2||void 0===arguments[2]?this.runKey:arguments[2];this.isPressed()===!1&&(6>=e?(e++,setTimeout(this.supportTest.bind(this,e,t,s),10)):this.fail(t,s))}},{key:"startLegacyTest",value:function(e){this.initialForce=e.touches[0].force,this.supportLegacyTest(0,e,this.runKey,this.initialForce)}},{key:"supportLegacyTest",value:function(e,t,s,n){n!==this.initialForce?(this._startPress(t),this.loopForce(t)):6>=e?(e++,setTimeout(this.supportLegacyTest.bind(this,e,t,s,n),10)):this.fail(t,s)}},{key:"loopForce",value:function(e){this.isPressed()&&(this.touch=this.selectTouch(e),setTimeout(this.loopForce.bind(this,e),10),this._changePress(this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t=.5?this._startDeepPress(t):this._endDeepPress(),e}}]),t}(c),f={polyfill:!0,polyfillSpeed:1e3,preventSelect:!0,only:null,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},p=function(e,s){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof e||e instanceof String)for(var i=t.querySelectorAll(e),r=0;r=.5?this._startDeepPress(t):this._endDeepPress(),e=e+this.increment>1?1:e+this.increment,setTimeout(this.loopPolyfillForce.bind(this,e,t),10))}}]),e}(),a=function(e){function t(e,n,r){return i(this,t),s(this,Object.getPrototypeOf(t).call(this,e,n,r))}return n(t,e),r(t,[{key:"bindEvents",value:function(){this.add("webkitmouseforcewillbegin",this._startPress.bind(this)),this.add("mousedown",this.support.bind(this)),this.add("webkitmouseforcechanged",this.change.bind(this)),this.add("webkitmouseforcedown",this._startDeepPress.bind(this)),this.add("webkitmouseforceup",this._endDeepPress.bind(this)),this.add("mouseleave",this._endPress.bind(this)),this.add("mouseup",this._endPress.bind(this))}},{key:"support",value:function(e){this.isPressed()===!1&&this.fail(e,this.runKey)}},{key:"change",value:function(e){this.isPressed()&&e.webkitForce>0&&this._changePress(this.normalizeForce(e.webkitForce),e)}},{key:"normalizeForce",value:function(e){return this.reachOne(v(e,1,3,0,1))}},{key:"reachOne",value:function(e){return e>.995?1:e}}]),t}(l),d=function(e){function t(e,n,r){return i(this,t),s(this,Object.getPrototypeOf(t).call(this,e,n,r))}return n(t,e),r(t,[{key:"bindEvents",value:function(){k?(this.add("touchforcechange",this.start.bind(this)),this.add("touchstart",this.supportTest.bind(this,0)),this.add("touchend",this._endPress.bind(this))):(this.add("touchstart",this.startLegacyTest.bind(this)),this.add("touchend",this._endPress.bind(this)))}},{key:"start",value:function(e){e.touches.length>0&&(this._startPress(e),this._changePress(this.selectTouch(e).force,e))}},{key:"supportTest",value:function(e,t){var s=arguments.length<=2||void 0===arguments[2]?this.runKey:arguments[2];this.isPressed()===!1&&(6>=e?(e++,setTimeout(this.supportTest.bind(this,e,t,s),10)):this.fail(t,s))}},{key:"startLegacyTest",value:function(e){this.initialForce=e.touches[0].force,this.supportLegacyTest(0,e,this.runKey,this.initialForce)}},{key:"supportLegacyTest",value:function(e,t,s,n){n!==this.initialForce?(this._startPress(t),this.loopForce(t)):6>=e?(e++,setTimeout(this.supportLegacyTest.bind(this,e,t,s,n),10)):this.fail(t,s)}},{key:"loopForce",value:function(e){this.isPressed()&&(this.touch=this.selectTouch(e),setTimeout(this.loopForce.bind(this,e),10),this._changePress(this.touch.force,e))}},{key:"selectTouch",value:function(e){if(1===e.touches.length)return this.returnTouch(e.touches[0],e);for(var t=0;t=.5?this._startDeepPress(t):this._endDeepPress(),e}}]),t}(l),f={polyfill:!0,polyfillSpeed:1e3,preventSelect:!0,only:null,get:function(e,t){return t.hasOwnProperty(e)?t[e]:this[e]},set:function(e){for(var t in e)e.hasOwnProperty(t)&&this.hasOwnProperty(t)&&"get"!=t&&"set"!=t&&(this[t]=e[t])}},p=function(e,s){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof e||e instanceof String)for(var i=t.querySelectorAll(e),r=0;r