gesture-helper
Advanced tools
Comparing version 0.1.23 to 0.1.24
@@ -8,2 +8,2 @@ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("GestureHelper",[],t):"object"==typeof exports?exports.GestureHelper=t():e.GestureHelper=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=5)}([function(e,t,n){(function(t){(function(){var n,i,r,s,o,a;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:null!=t&&t.hrtime?(e.exports=function(){return(n()-o)/1e6},i=t.hrtime,s=(n=function(){var e;return 1e9*(e=i())[0]+e[1]})(),a=1e9*t.uptime(),o=s-a):Date.now?(e.exports=function(){return Date.now()-r},r=Date.now()):(e.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(this)}).call(this,n(1))},function(e,t){var n,i,r=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,c=[],u=!1,h=-1;function f(){u&&l&&(u=!1,l.length?c=l.concat(c):h=-1,c.length&&p())}function p(){if(!u){var e=a(f);u=!0;for(var t=c.length;t;){for(l=c,c=[];++h<t;)l&&l[h].run();h=-1,t=c.length}l=null,u=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function y(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new v(e,t)),1!==c.length||u||a(p)},v.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=y,r.addListener=y,r.once=y,r.off=y,r.removeListener=y,r.removeAllListeners=y,r.emit=y,r.prependListener=y,r.prependOnceListener=y,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){(function(i){var r; | ||
* Licensed under the MIT license. | ||
*/!function(s){var o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};function a(){this._events={},this._conf&&l.call(this,this._conf)}function l(e){e?(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),this._maxListeners=void 0!==e.maxListeners?e.maxListeners:10,e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),this.wildcard&&(this.listenerTree={})):this._maxListeners=10}function c(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==i&&i.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,i.emitWarning(r)}else console.error(n),console.trace&&console.trace()}function u(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,l.call(this,e)}function h(e,t,n,i){if(!n)return[];var r,s,o,a,l,c,u,f=[],p=t.length,v=t[i],y=t[i+1];if(i===p&&n._listeners){if("function"==typeof n._listeners)return e&&e.push(n._listeners),[n];for(r=0,s=n._listeners.length;r<s;r++)e&&e.push(n._listeners[r]);return[n]}if("*"===v||"**"===v||n[v]){if("*"===v){for(o in n)"_listeners"!==o&&n.hasOwnProperty(o)&&(f=f.concat(h(e,t,n[o],i+1)));return f}if("**"===v){for(o in(u=i+1===p||i+2===p&&"*"===y)&&n._listeners&&(f=f.concat(h(e,t,n,p))),n)"_listeners"!==o&&n.hasOwnProperty(o)&&("*"===o||"**"===o?(n[o]._listeners&&!u&&(f=f.concat(h(e,t,n[o],p))),f=f.concat(h(e,t,n[o],i))):f=o===y?f.concat(h(e,t,n[o],i+2)):f.concat(h(e,t,n[o],i)));return f}f=f.concat(h(e,t,n[v],i+1))}if((a=n["*"])&&h(e,t,a,i+1),l=n["**"])if(i<p)for(o in l._listeners&&h(e,t,l,p),l)"_listeners"!==o&&l.hasOwnProperty(o)&&(o===y?h(e,t,l[o],i+2):o===v?h(e,t,l[o],i+1):((c={})[o]=l[o],h(e,t,{"**":c},i+1)));else l._listeners?h(e,t,l,p):l["*"]&&l["*"]._listeners&&h(e,t,l["*"],p);return f}function f(e,t){for(var n=0,i=(e="string"==typeof e?e.split(this.delimiter):e.slice()).length;n+1<i;n++)if("**"===e[n]&&"**"===e[n+1])return;for(var r=this.listenerTree,s=e.shift();void 0!==s;){if(r[s]||(r[s]={}),r=r[s],0===e.length)return r._listeners?("function"==typeof r._listeners&&(r._listeners=[r._listeners]),r._listeners.push(t),!r._listeners.warned&&this._maxListeners>0&&r._listeners.length>this._maxListeners&&(r._listeners.warned=!0,c.call(this,r._listeners.length,s))):r._listeners=t,!0;s=e.shift()}return!0}u.EventEmitter2=u,u.prototype.delimiter=".",u.prototype.setMaxListeners=function(e){void 0!==e&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},u.prototype.event="",u.prototype.once=function(e,t){return this._once(e,t,!1)},u.prototype.prependOnceListener=function(e,t){return this._once(e,t,!0)},u.prototype._once=function(e,t,n){return this._many(e,1,t,n),this},u.prototype.many=function(e,t,n){return this._many(e,t,n,!1)},u.prototype.prependMany=function(e,t,n){return this._many(e,t,n,!0)},u.prototype._many=function(e,t,n,i){var r=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&r.off(e,s),n.apply(this,arguments)}return s._origin=n,this._on(e,s,i),r},u.prototype.emit=function(){this._events||a.call(this);var e=arguments[0];if("newListener"===e&&!this._newListener&&!this._events.newListener)return!1;var t,n,i,r,s,o=arguments.length;if(this._all&&this._all.length){if(s=this._all.slice(),o>3)for(t=new Array(o),r=0;r<o;r++)t[r]=arguments[r];for(i=0,n=s.length;i<n;i++)switch(this.event=e,o){case 1:s[i].call(this,e);break;case 2:s[i].call(this,e,arguments[1]);break;case 3:s[i].call(this,e,arguments[1],arguments[2]);break;default:s[i].apply(this,t)}}if(this.wildcard){s=[];var l="string"==typeof e?e.split(this.delimiter):e.slice();h.call(this,s,l,this.listenerTree,0)}else{if("function"==typeof(s=this._events[e])){switch(this.event=e,o){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(o-1),r=1;r<o;r++)t[r-1]=arguments[r];s.apply(this,t)}return!0}s&&(s=s.slice())}if(s&&s.length){if(o>3)for(t=new Array(o-1),r=1;r<o;r++)t[r-1]=arguments[r];for(i=0,n=s.length;i<n;i++)switch(this.event=e,o){case 1:s[i].call(this);break;case 2:s[i].call(this,arguments[1]);break;case 3:s[i].call(this,arguments[1],arguments[2]);break;default:s[i].apply(this,t)}return!0}if(!this._all&&"error"===e)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},u.prototype.emitAsync=function(){this._events||a.call(this);var e=arguments[0];if("newListener"===e&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);var t,n,i,r,s,o=[],l=arguments.length;if(this._all){if(l>3)for(t=new Array(l),r=1;r<l;r++)t[r]=arguments[r];for(i=0,n=this._all.length;i<n;i++)switch(this.event=e,l){case 1:o.push(this._all[i].call(this,e));break;case 2:o.push(this._all[i].call(this,e,arguments[1]));break;case 3:o.push(this._all[i].call(this,e,arguments[1],arguments[2]));break;default:o.push(this._all[i].apply(this,t))}}if(this.wildcard){s=[];var c="string"==typeof e?e.split(this.delimiter):e.slice();h.call(this,s,c,this.listenerTree,0)}else s=this._events[e];if("function"==typeof s)switch(this.event=e,l){case 1:o.push(s.call(this));break;case 2:o.push(s.call(this,arguments[1]));break;case 3:o.push(s.call(this,arguments[1],arguments[2]));break;default:for(t=new Array(l-1),r=1;r<l;r++)t[r-1]=arguments[r];o.push(s.apply(this,t))}else if(s&&s.length){if(s=s.slice(),l>3)for(t=new Array(l-1),r=1;r<l;r++)t[r-1]=arguments[r];for(i=0,n=s.length;i<n;i++)switch(this.event=e,l){case 1:o.push(s[i].call(this));break;case 2:o.push(s[i].call(this,arguments[1]));break;case 3:o.push(s[i].call(this,arguments[1],arguments[2]));break;default:o.push(s[i].apply(this,t))}}else if(!this._all&&"error"===e)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(o)},u.prototype.on=function(e,t){return this._on(e,t,!1)},u.prototype.prependListener=function(e,t){return this._on(e,t,!0)},u.prototype.onAny=function(e){return this._onAny(e,!1)},u.prototype.prependAny=function(e){return this._onAny(e,!0)},u.prototype.addListener=u.prototype.on,u.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},u.prototype._on=function(e,t,n){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");return this._events||a.call(this),this._newListener&&this.emit("newListener",e,t),this.wildcard?(f.call(this,e,t),this):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),n?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,c.call(this,this._events[e].length,e))):this._events[e]=t,this)},u.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var r="string"==typeof e?e.split(this.delimiter):e.slice();i=h.call(this,null,r,this.listenerTree,0)}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var s=0;s<i.length;s++){var a=i[s];if(n=a._listeners,o(n)){for(var l=-1,c=0,u=n.length;c<u;c++)if(n[c]===t||n[c].listener&&n[c].listener===t||n[c]._origin&&n[c]._origin===t){l=c;break}if(l<0)continue;return this.wildcard?a._listeners.splice(l,1):this._events[e].splice(l,1),0===n.length&&(this.wildcard?delete a._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete a._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return function e(t){if(void 0!==t){var n=Object.keys(t);for(var i in n){var r=n[i],s=t[r];s instanceof Function||"object"!=typeof s||null===s||(Object.keys(s).length>0&&e(t[r]),0===Object.keys(s).length&&delete t[r])}}}(this.listenerTree),this},u.prototype.offAny=function(e){var t,n=0,i=0;if(e&&this._all&&this._all.length>0){for(n=0,i=(t=this._all).length;n<i;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,i=t.length;n<i;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},u.prototype.removeListener=u.prototype.off,u.prototype.removeAllListeners=function(e){if(void 0===e)return!this._events||a.call(this),this;if(this.wildcard)for(var t="string"==typeof e?e.split(this.delimiter):e.slice(),n=h.call(this,null,t,this.listenerTree,0),i=0;i<n.length;i++){n[i]._listeners=null}else this._events&&(this._events[e]=null);return this},u.prototype.listeners=function(e){if(this.wildcard){var t=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return h.call(this,t,n,this.listenerTree,0),t}return this._events||a.call(this),this._events[e]||(this._events[e]=[]),o(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},u.prototype.eventNames=function(){return Object.keys(this._events)},u.prototype.listenerCount=function(e){return this.listeners(e).length},u.prototype.listenersAny=function(){return this._all?this._all:[]},void 0===(r=function(){return u}.call(t,n,t,e))||(e.exports=r)}()}).call(this,n(1))},function(e,t,n){(function(t){for(var i=n(0),r="undefined"==typeof window?t:window,s=["moz","webkit"],o="AnimationFrame",a=r["request"+o],l=r["cancel"+o]||r["cancelRequest"+o],c=0;!a&&c<s.length;c++)a=r[s[c]+"Request"+o],l=r[s[c]+"Cancel"+o]||r[s[c]+"CancelRequest"+o];if(!a||!l){var u=0,h=0,f=[];a=function(e){if(0===f.length){var t=i(),n=Math.max(0,1e3/60-(t-u));u=n+t,setTimeout((function(){var e=f.slice(0);f.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(u)}catch(e){setTimeout((function(){throw e}),0)}}),Math.round(n))}return f.push({handle:++h,callback:e,cancelled:!1}),h},l=function(e){for(var t=0;t<f.length;t++)f[t].handle===e&&(f[t].cancelled=!0)}}e.exports=function(e){return a.call(r,e)},e.exports.cancel=function(){l.apply(r,arguments)},e.exports.polyfill=function(e){e||(e=r),e.requestAnimationFrame=a,e.cancelAnimationFrame=l}}).call(this,n(4))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t);var i=n(2),r=n.n(i),s=n(0),o=n.n(s),a=n(3),l=n.n(a),c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.velocity,n=void 0===t?{x:0,y:0}:t,i=e.from,r=void 0===i?{x:0,y:0}:i,s=e.power,a=void 0===s?.8:s,c=e.timeConstant,u=void 0===c?350:c,h=e.restDelta,f=void 0===h?.5:h,p=(e.roundDestination,e.emitter),v=0,y=null;Math.abs(n.x)>Math.abs(n.y)?(n.x,r.x,y=n.x<0?"left":"right"):(n.y,r.y,y=n.y<0?"up":"down");var d=o()(),m=a*n.x,_=a*n.y,w=Math.round(r.x+m),b=Math.round(r.y+_),g=w,E=b;function x(){l()((function(){v=o()()-d;var e=-m*Math.exp(-v/u),t=-_*Math.exp(-v/u),n=e>f||e<-f,i=t>f||t<-f,r=n?g+e:g,s=i?E+t:E;switch(p.emit("momentum.all",{deltaX:r,deltaY:s}),y){case"up":case"down":p.emit("momentum.y.".concat(y),{delta:s});break;case"left":case"right":p.emit("momentum.x.".concat(y),{delta:r})}n||i?x():(console.log("stopping!"),p.emit("momentum.end",{}))}))}return p.emit("momentum.start"),{start:x,stop:function(){isMovingX=!1,isMovingY=!1}}};var u=function(e){if(!("InputDeviceCapabilities"in e||"sourceCapabilities"in UIEvent.prototype)){c.prototype={get firesTouchEvents(){return this.__firesTouchEvents}},e.InputDeviceCapabilities=c;var t,n=new c({firesTouchEvents:!0}),i=new c({firesTouchEvents:!1});document.addEventListener("touchstart",u,!0),document.addEventListener("touchmove",u,!0),document.addEventListener("touchend",u,!0),document.addEventListener("touchcancel",u,!0);var r="__inputDeviceCapabilitiesPolyfill_specifiedSourceCapabilities",s=["resize","error","load","unload","abort"];Object.defineProperty(UIEvent.prototype,"sourceCapabilities",{get:function(){if(r in this)return this[r];if(s.indexOf(this.type)>=0)return null;if(!("TouchEvent"in e))return i;if(this instanceof TouchEvent)return n;if("PointerEvent"in e&&this instanceof PointerEvent)return"touch"==this.pointerType?n:i;var o=Date.now()<t+1e3?n:i;return Object.defineProperty(this,r,{value:o,writable:!1}),o},configurable:!0,enumerable:!0});for(var o=["UIEvent","MouseEvent","TouchEvent","InputEvent","CompositionEvent","FocusEvent","KeyboardEvent","WheelEvent","PointerEvent"],a=0;a<o.length;a++)h(o[a]);var l=Document.prototype.createEvent;Document.prototype.createEvent=function(e){var t=l.call(this,e);if(t instanceof UIEvent)return Object.defineProperty(t,r,{value:null,writable:!1}),t}}function c(e){Object.defineProperty(this,"__firesTouchEvents",{value:!!(e&&"firesTouchEvents"in e)&&e.firesTouchEvents,writable:!1,enumerable:!1})}function u(e){t=Date.now()}function h(t){if(t in e&&"length"in e[t]&&!(e[t].length<1)){var n=e[t];e[t]=function(e,t){var i=t&&t.sourceCapabilities?t.sourceCapabilities:null;t&&delete t.sourceCapabilities;var s=new n(e,t);return Object.defineProperty(s,r,{value:i,writable:!1}),s},e[t].prototype=n.prototype}}};function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function v(e,t){return!t||"object"!==h(t)&&"function"!=typeof t?d(e):t}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"default",(function(){return w})),u(window);var w=function(e){function t(){var e;f(this,t),_(d(e=v(this,y(t).call(this,{wildcard:!0}))),"mouseMove",(function(t){e.handleMove({e:t,x:t.clientX,y:t.clientY})})),_(d(e),"touchMove",(function(t){e.handleMove({e:t,x:t.touches[0].clientX,y:t.touches[0].clientY})})),_(d(e),"touchStart",(function(t){e.handleStart({x:t.touches[0].clientX,y:t.touches[0].clientY,e:t}),e.el.addEventListener("touchmove",e.touchMove,e.eventOptions)})),_(d(e),"touchEnd",(function(t){e.handleEnd(t),e.el.removeEventListener("touchmove",e.touchMove,e.eventOptions)})),_(d(e),"mouseDown",(function(t){t.sourceCapabilities.firesTouchEvents||(e.handleStart({x:t.clientX,y:t.clientY,e:t}),e.el.addEventListener("mousemove",e.mouseMove,e.eventOptions))})),_(d(e),"mouseUp",(function(t){t.sourceCapabilities.firesTouchEvents||(e.handleEnd(t),e.el.removeEventListener("mousemove",e.mouseMove,e.eventOptions))})),_(d(e),"handleEnd",(function(t){var n=o()()-e.startTime;if(e.emit("pan.preend",{sourceEvent:t}),console.log("!!!!!!!!!!!!!!!!!!!!",e.velocity,e.velocity.max.x,e.options.swipeVelocity),e.panning){e.panning=!1;var i=!1,r=null;e.velocity.max.x>e.options.swipeVelocity&&"horizontal"===e.startDirection?(i=!0,r=e.velocity.current.x>0?"right":"left"):e.velocity.max.y>e.options.swipeVelocity&&"vertical"===e.startDirection&&(i=!0,r=e.velocity.current.y>0?"down":"up"),e.emit("pan.end",{isSwipe:i,swipeDirection:r,sourceEvent:t}),e.options.useMomentum&&(e.momentum=c({velocity:{x:e.velocity.current.x,y:e.velocity.current.y},from:{x:e.lastDeltaX,y:e.lastDeltaY},emitter:d(e)}),e.momentum.start())}else n<=e.options.maxTapDuration&&e.emit("tap",{srcEvent:t})})),e.el=arguments.length<=0?void 0:arguments[0],e.options=Object.assign({},{sensitivity:5,passive:!1,capture:!1,swipeVelocity:60,maxTapDuration:300,longTapDuration:400,startDirectionLoopCount:2},(arguments.length<=1?void 0:arguments[1])||{}),e.panning=!1,e.startDirection=null,e.directionCount=0,e.clearVelocityStats(),e.eventOptions=!1;try{var n=Object.defineProperty({},"passive",{get:function(){e.eventOptions={passive:!!e.options.passive,capture:!!e.options.capture}}});e.el.addEventListener("test",null,n)}catch(t){console.error(t),e.eventOptions={capture:!!e.options.capture}}return e.setup(),e}var n,i,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(t,e),n=t,(i=[{key:"clearVelocityStats",value:function(){this.velocity={current:{x:0,y:0},max:{x:0,y:0}}}},{key:"isPanning",value:function(){return this.panning}},{key:"setup",value:function(){this.el.addEventListener("mousedown",this.mouseDown,this.eventOptions),this.el.addEventListener("mouseup",this.mouseUp,this.eventOptions),this.el.addEventListener("touchstart",this.touchStart,this.eventOptions),this.el.addEventListener("touchend",this.touchEnd,this.eventOptions),this.el.addEventListener("touchcancel",this.touchEnd,this.eventOptions)}},{key:"destroy",value:function(){this.el.removeEventListener("mousedown",this.mouseDown,this.eventOptions),this.el.removeEventListener("mouseup",this.mouseUp,this.eventOptions),this.el.removeEventListener("mousemove",this.mouseMove,this.eventOptions),this.el.removeEventListener("touchstart",this.touchStart,this.eventOptions),this.el.removeEventListener("touchend",this.touchEnd,this.eventOptions),this.el.removeEventListener("touchcancel",this.touchEnd,this.eventOptions),this.el.removeEventListener("touchmove",this.touchMove,this.eventOptions)}},{key:"getStartDirection",value:function(e){var t=e.x,n=void 0===t?0:t,i=e.y,r=void 0===i?0:i;return this.directionCount<=this.options.startDirectionLoopCount?(this.directionCount++,null):Math.abs(n)>Math.abs(r)?"horizontal":"vertical"}},{key:"handleStart",value:function(e){var t=e.x,n=void 0===t?0:t,i=e.y,r=void 0===i?0:i,s=e.e,a=void 0===s?{}:s;this.startX=n,this.startY=r,this.startDirection=null,this.directionCount=1,this.panning=!1,this.startTime=o()(),this.clearVelocityStats(),this.emit("pan.prestart",{sourceEvent:a})}},{key:"handleMove",value:function(e){var t=e.e,n=void 0===t?{}:t,i=e.x,r=void 0===i?0:i,s=e.y,a=void 0===s?0:s,l=r-this.startX,c=a-this.startY;if(null===this.startDirection?this.startDirection=this.getStartDirection({x:l,y:c}):!this.panning&&(Math.abs(l)>this.options.sensitivity||Math.abs(c)>this.options.sensitivity)&&(this.panning=!0,this.emit("pan.start",{startDirection:this.startDirection,sourceEvent:n})),this.panning){this.emit("pan.all",{startDirection:this.startDirection,deltaX:l,deltaY:c,sourceEvent:n}),"horizontal"===this.startDirection?l<0?this.emit("pan.x.left",{delta:l,sourceEvent:n}):this.emit("pan.x.right",{delta:l,sourceEvent:n}):"vertical"===this.startDirection&&(c<0?this.emit("pan.y.up",{delta:c,sourceEvent:n}):this.emit("pan.y.down",{delta:c,sourceEvent:n}));var u=o()()-this.startTime;this.velocity.current.x=l/u*100,this.velocity.current.y=c/u*100,this.velocity.max.x=Math.max(this.velocity.max.x,Math.abs(this.velocity.current.x)),this.velocity.max.y=Math.max(this.velocity.max.y,Math.abs(this.velocity.current.y)),this.lastDeltaX=l,this.lastDeltaY=c}}}])&&p(n.prototype,i),r&&p(n,r),t}(r.a)}]).default})); | ||
*/!function(s){var o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};function a(){this._events={},this._conf&&l.call(this,this._conf)}function l(e){e?(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),this._maxListeners=void 0!==e.maxListeners?e.maxListeners:10,e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),this.wildcard&&(this.listenerTree={})):this._maxListeners=10}function c(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),void 0!==i&&i.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,i.emitWarning(r)}else console.error(n),console.trace&&console.trace()}function u(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,l.call(this,e)}function h(e,t,n,i){if(!n)return[];var r,s,o,a,l,c,u,f=[],p=t.length,v=t[i],y=t[i+1];if(i===p&&n._listeners){if("function"==typeof n._listeners)return e&&e.push(n._listeners),[n];for(r=0,s=n._listeners.length;r<s;r++)e&&e.push(n._listeners[r]);return[n]}if("*"===v||"**"===v||n[v]){if("*"===v){for(o in n)"_listeners"!==o&&n.hasOwnProperty(o)&&(f=f.concat(h(e,t,n[o],i+1)));return f}if("**"===v){for(o in(u=i+1===p||i+2===p&&"*"===y)&&n._listeners&&(f=f.concat(h(e,t,n,p))),n)"_listeners"!==o&&n.hasOwnProperty(o)&&("*"===o||"**"===o?(n[o]._listeners&&!u&&(f=f.concat(h(e,t,n[o],p))),f=f.concat(h(e,t,n[o],i))):f=o===y?f.concat(h(e,t,n[o],i+2)):f.concat(h(e,t,n[o],i)));return f}f=f.concat(h(e,t,n[v],i+1))}if((a=n["*"])&&h(e,t,a,i+1),l=n["**"])if(i<p)for(o in l._listeners&&h(e,t,l,p),l)"_listeners"!==o&&l.hasOwnProperty(o)&&(o===y?h(e,t,l[o],i+2):o===v?h(e,t,l[o],i+1):((c={})[o]=l[o],h(e,t,{"**":c},i+1)));else l._listeners?h(e,t,l,p):l["*"]&&l["*"]._listeners&&h(e,t,l["*"],p);return f}function f(e,t){for(var n=0,i=(e="string"==typeof e?e.split(this.delimiter):e.slice()).length;n+1<i;n++)if("**"===e[n]&&"**"===e[n+1])return;for(var r=this.listenerTree,s=e.shift();void 0!==s;){if(r[s]||(r[s]={}),r=r[s],0===e.length)return r._listeners?("function"==typeof r._listeners&&(r._listeners=[r._listeners]),r._listeners.push(t),!r._listeners.warned&&this._maxListeners>0&&r._listeners.length>this._maxListeners&&(r._listeners.warned=!0,c.call(this,r._listeners.length,s))):r._listeners=t,!0;s=e.shift()}return!0}u.EventEmitter2=u,u.prototype.delimiter=".",u.prototype.setMaxListeners=function(e){void 0!==e&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},u.prototype.event="",u.prototype.once=function(e,t){return this._once(e,t,!1)},u.prototype.prependOnceListener=function(e,t){return this._once(e,t,!0)},u.prototype._once=function(e,t,n){return this._many(e,1,t,n),this},u.prototype.many=function(e,t,n){return this._many(e,t,n,!1)},u.prototype.prependMany=function(e,t,n){return this._many(e,t,n,!0)},u.prototype._many=function(e,t,n,i){var r=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function s(){return 0==--t&&r.off(e,s),n.apply(this,arguments)}return s._origin=n,this._on(e,s,i),r},u.prototype.emit=function(){this._events||a.call(this);var e=arguments[0];if("newListener"===e&&!this._newListener&&!this._events.newListener)return!1;var t,n,i,r,s,o=arguments.length;if(this._all&&this._all.length){if(s=this._all.slice(),o>3)for(t=new Array(o),r=0;r<o;r++)t[r]=arguments[r];for(i=0,n=s.length;i<n;i++)switch(this.event=e,o){case 1:s[i].call(this,e);break;case 2:s[i].call(this,e,arguments[1]);break;case 3:s[i].call(this,e,arguments[1],arguments[2]);break;default:s[i].apply(this,t)}}if(this.wildcard){s=[];var l="string"==typeof e?e.split(this.delimiter):e.slice();h.call(this,s,l,this.listenerTree,0)}else{if("function"==typeof(s=this._events[e])){switch(this.event=e,o){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(o-1),r=1;r<o;r++)t[r-1]=arguments[r];s.apply(this,t)}return!0}s&&(s=s.slice())}if(s&&s.length){if(o>3)for(t=new Array(o-1),r=1;r<o;r++)t[r-1]=arguments[r];for(i=0,n=s.length;i<n;i++)switch(this.event=e,o){case 1:s[i].call(this);break;case 2:s[i].call(this,arguments[1]);break;case 3:s[i].call(this,arguments[1],arguments[2]);break;default:s[i].apply(this,t)}return!0}if(!this._all&&"error"===e)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},u.prototype.emitAsync=function(){this._events||a.call(this);var e=arguments[0];if("newListener"===e&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);var t,n,i,r,s,o=[],l=arguments.length;if(this._all){if(l>3)for(t=new Array(l),r=1;r<l;r++)t[r]=arguments[r];for(i=0,n=this._all.length;i<n;i++)switch(this.event=e,l){case 1:o.push(this._all[i].call(this,e));break;case 2:o.push(this._all[i].call(this,e,arguments[1]));break;case 3:o.push(this._all[i].call(this,e,arguments[1],arguments[2]));break;default:o.push(this._all[i].apply(this,t))}}if(this.wildcard){s=[];var c="string"==typeof e?e.split(this.delimiter):e.slice();h.call(this,s,c,this.listenerTree,0)}else s=this._events[e];if("function"==typeof s)switch(this.event=e,l){case 1:o.push(s.call(this));break;case 2:o.push(s.call(this,arguments[1]));break;case 3:o.push(s.call(this,arguments[1],arguments[2]));break;default:for(t=new Array(l-1),r=1;r<l;r++)t[r-1]=arguments[r];o.push(s.apply(this,t))}else if(s&&s.length){if(s=s.slice(),l>3)for(t=new Array(l-1),r=1;r<l;r++)t[r-1]=arguments[r];for(i=0,n=s.length;i<n;i++)switch(this.event=e,l){case 1:o.push(s[i].call(this));break;case 2:o.push(s[i].call(this,arguments[1]));break;case 3:o.push(s[i].call(this,arguments[1],arguments[2]));break;default:o.push(s[i].apply(this,t))}}else if(!this._all&&"error"===e)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(o)},u.prototype.on=function(e,t){return this._on(e,t,!1)},u.prototype.prependListener=function(e,t){return this._on(e,t,!0)},u.prototype.onAny=function(e){return this._onAny(e,!1)},u.prototype.prependAny=function(e){return this._onAny(e,!0)},u.prototype.addListener=u.prototype.on,u.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},u.prototype._on=function(e,t,n){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");return this._events||a.call(this),this._newListener&&this.emit("newListener",e,t),this.wildcard?(f.call(this,e,t),this):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),n?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,c.call(this,this._events[e].length,e))):this._events[e]=t,this)},u.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,i=[];if(this.wildcard){var r="string"==typeof e?e.split(this.delimiter):e.slice();i=h.call(this,null,r,this.listenerTree,0)}else{if(!this._events[e])return this;n=this._events[e],i.push({_listeners:n})}for(var s=0;s<i.length;s++){var a=i[s];if(n=a._listeners,o(n)){for(var l=-1,c=0,u=n.length;c<u;c++)if(n[c]===t||n[c].listener&&n[c].listener===t||n[c]._origin&&n[c]._origin===t){l=c;break}if(l<0)continue;return this.wildcard?a._listeners.splice(l,1):this._events[e].splice(l,1),0===n.length&&(this.wildcard?delete a._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete a._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return function e(t){if(void 0!==t){var n=Object.keys(t);for(var i in n){var r=n[i],s=t[r];s instanceof Function||"object"!=typeof s||null===s||(Object.keys(s).length>0&&e(t[r]),0===Object.keys(s).length&&delete t[r])}}}(this.listenerTree),this},u.prototype.offAny=function(e){var t,n=0,i=0;if(e&&this._all&&this._all.length>0){for(n=0,i=(t=this._all).length;n<i;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,i=t.length;n<i;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},u.prototype.removeListener=u.prototype.off,u.prototype.removeAllListeners=function(e){if(void 0===e)return!this._events||a.call(this),this;if(this.wildcard)for(var t="string"==typeof e?e.split(this.delimiter):e.slice(),n=h.call(this,null,t,this.listenerTree,0),i=0;i<n.length;i++){n[i]._listeners=null}else this._events&&(this._events[e]=null);return this},u.prototype.listeners=function(e){if(this.wildcard){var t=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return h.call(this,t,n,this.listenerTree,0),t}return this._events||a.call(this),this._events[e]||(this._events[e]=[]),o(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},u.prototype.eventNames=function(){return Object.keys(this._events)},u.prototype.listenerCount=function(e){return this.listeners(e).length},u.prototype.listenersAny=function(){return this._all?this._all:[]},void 0===(r=function(){return u}.call(t,n,t,e))||(e.exports=r)}()}).call(this,n(1))},function(e,t,n){(function(t){for(var i=n(0),r="undefined"==typeof window?t:window,s=["moz","webkit"],o="AnimationFrame",a=r["request"+o],l=r["cancel"+o]||r["cancelRequest"+o],c=0;!a&&c<s.length;c++)a=r[s[c]+"Request"+o],l=r[s[c]+"Cancel"+o]||r[s[c]+"CancelRequest"+o];if(!a||!l){var u=0,h=0,f=[];a=function(e){if(0===f.length){var t=i(),n=Math.max(0,1e3/60-(t-u));u=n+t,setTimeout((function(){var e=f.slice(0);f.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(u)}catch(e){setTimeout((function(){throw e}),0)}}),Math.round(n))}return f.push({handle:++h,callback:e,cancelled:!1}),h},l=function(e){for(var t=0;t<f.length;t++)f[t].handle===e&&(f[t].cancelled=!0)}}e.exports=function(e){return a.call(r,e)},e.exports.cancel=function(){l.apply(r,arguments)},e.exports.polyfill=function(e){e||(e=r),e.requestAnimationFrame=a,e.cancelAnimationFrame=l}}).call(this,n(4))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t);var i=n(2),r=n.n(i),s=n(0),o=n.n(s),a=n(3),l=n.n(a),c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.velocity,n=void 0===t?{x:0,y:0}:t,i=e.from,r=void 0===i?{x:0,y:0}:i,s=e.power,a=void 0===s?.8:s,c=e.timeConstant,u=void 0===c?350:c,h=e.restDelta,f=void 0===h?.5:h,p=(e.roundDestination,e.emitter),v=0,y=null;Math.abs(n.x)>Math.abs(n.y)?(n.x,r.x,y=n.x<0?"left":"right"):(n.y,r.y,y=n.y<0?"up":"down");var d=o()(),m=a*n.x,_=a*n.y,w=Math.round(r.x+m),b=Math.round(r.y+_),g=w,E=b;function x(){l()((function(){v=o()()-d;var e=-m*Math.exp(-v/u),t=-_*Math.exp(-v/u),n=e>f||e<-f,i=t>f||t<-f,r=n?g+e:g,s=i?E+t:E;switch(p.emit("momentum.all",{deltaX:r,deltaY:s}),y){case"up":case"down":p.emit("momentum.y.".concat(y),{delta:s});break;case"left":case"right":p.emit("momentum.x.".concat(y),{delta:r})}n||i?x():(console.log("stopping!"),p.emit("momentum.end",{}))}))}return p.emit("momentum.start"),{start:x,stop:function(){isMovingX=!1,isMovingY=!1}}};var u=function(e){if(!("InputDeviceCapabilities"in e||"sourceCapabilities"in UIEvent.prototype)){c.prototype={get firesTouchEvents(){return this.__firesTouchEvents}},e.InputDeviceCapabilities=c;var t,n=new c({firesTouchEvents:!0}),i=new c({firesTouchEvents:!1});document.addEventListener("touchstart",u,!0),document.addEventListener("touchmove",u,!0),document.addEventListener("touchend",u,!0),document.addEventListener("touchcancel",u,!0);var r="__inputDeviceCapabilitiesPolyfill_specifiedSourceCapabilities",s=["resize","error","load","unload","abort"];Object.defineProperty(UIEvent.prototype,"sourceCapabilities",{get:function(){if(r in this)return this[r];if(s.indexOf(this.type)>=0)return null;if(!("TouchEvent"in e))return i;if(this instanceof TouchEvent)return n;if("PointerEvent"in e&&this instanceof PointerEvent)return"touch"==this.pointerType?n:i;var o=Date.now()<t+1e3?n:i;return Object.defineProperty(this,r,{value:o,writable:!1}),o},configurable:!0,enumerable:!0});for(var o=["UIEvent","MouseEvent","TouchEvent","InputEvent","CompositionEvent","FocusEvent","KeyboardEvent","WheelEvent","PointerEvent"],a=0;a<o.length;a++)h(o[a]);var l=Document.prototype.createEvent;Document.prototype.createEvent=function(e){var t=l.call(this,e);if(t instanceof UIEvent)return Object.defineProperty(t,r,{value:null,writable:!1}),t}}function c(e){Object.defineProperty(this,"__firesTouchEvents",{value:!!(e&&"firesTouchEvents"in e)&&e.firesTouchEvents,writable:!1,enumerable:!1})}function u(e){t=Date.now()}function h(t){if(t in e&&"length"in e[t]&&!(e[t].length<1)){var n=e[t];e[t]=function(e,t){var i=t&&t.sourceCapabilities?t.sourceCapabilities:null;t&&delete t.sourceCapabilities;var s=new n(e,t);return Object.defineProperty(s,r,{value:i,writable:!1}),s},e[t].prototype=n.prototype}}};function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function v(e,t){return!t||"object"!==h(t)&&"function"!=typeof t?d(e):t}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"default",(function(){return w})),u(window);var w=function(e){function t(){var e;f(this,t),_(d(e=v(this,y(t).call(this,{wildcard:!0}))),"mouseMove",(function(t){e.handleMove({e:t,x:t.clientX,y:t.clientY})})),_(d(e),"touchMove",(function(t){e.handleMove({e:t,x:t.touches[0].clientX,y:t.touches[0].clientY})})),_(d(e),"touchStart",(function(t){e.handleStart({x:t.touches[0].clientX,y:t.touches[0].clientY,e:t}),e.el.addEventListener("touchmove",e.touchMove,e.eventOptions)})),_(d(e),"touchEnd",(function(t){e.handleEnd(t),e.el.removeEventListener("touchmove",e.touchMove,e.eventOptions)})),_(d(e),"mouseDown",(function(t){t.sourceCapabilities.firesTouchEvents||(e.handleStart({x:t.clientX,y:t.clientY,e:t}),e.el.addEventListener("mousemove",e.mouseMove,e.eventOptions))})),_(d(e),"mouseUp",(function(t){t.sourceCapabilities.firesTouchEvents||(e.handleEnd(t),e.el.removeEventListener("mousemove",e.mouseMove,e.eventOptions))})),_(d(e),"handleEnd",(function(t){var n=o()()-e.startTime;if(e.emit("pan.preend",{sourceEvent:t}),e.panning){e.panning=!1;var i=!1,r=null;e.velocity.max.x>e.options.swipeVelocity&&"horizontal"===e.startDirection?(i=!0,r=e.velocity.current.x>0?"right":"left"):e.velocity.max.y>e.options.swipeVelocity&&"vertical"===e.startDirection&&(i=!0,r=e.velocity.current.y>0?"down":"up"),e.emit("pan.end",{isSwipe:i,swipeDirection:r,sourceEvent:t}),e.options.useMomentum&&(e.momentum=c({velocity:{x:e.velocity.current.x,y:e.velocity.current.y},from:{x:e.lastDeltaX,y:e.lastDeltaY},emitter:d(e)}),e.momentum.start())}else n<=e.options.maxTapDuration&&e.emit("tap",{srcEvent:t})})),e.el=arguments.length<=0?void 0:arguments[0],e.options=Object.assign({},{sensitivity:5,passive:!1,capture:!1,swipeVelocity:60,maxTapDuration:300,longTapDuration:400,startDirectionLoopCount:2},(arguments.length<=1?void 0:arguments[1])||{}),e.panning=!1,e.startDirection=null,e.directionCount=0,e.clearVelocityStats(),e.eventOptions=!1;try{var n=Object.defineProperty({},"passive",{get:function(){e.eventOptions={passive:!!e.options.passive,capture:!!e.options.capture}}});e.el.addEventListener("test",null,n)}catch(t){console.error(t),e.eventOptions={capture:!!e.options.capture}}return e.setup(),e}var n,i,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(t,e),n=t,(i=[{key:"clearVelocityStats",value:function(){this.velocity={current:{x:0,y:0},max:{x:0,y:0}}}},{key:"isPanning",value:function(){return this.panning}},{key:"setup",value:function(){this.el.addEventListener("mousedown",this.mouseDown,this.eventOptions),this.el.addEventListener("mouseup",this.mouseUp,this.eventOptions),this.el.addEventListener("touchstart",this.touchStart,this.eventOptions),this.el.addEventListener("touchend",this.touchEnd,this.eventOptions),this.el.addEventListener("touchcancel",this.touchEnd,this.eventOptions)}},{key:"destroy",value:function(){this.el.removeEventListener("mousedown",this.mouseDown,this.eventOptions),this.el.removeEventListener("mouseup",this.mouseUp,this.eventOptions),this.el.removeEventListener("mousemove",this.mouseMove,this.eventOptions),this.el.removeEventListener("touchstart",this.touchStart,this.eventOptions),this.el.removeEventListener("touchend",this.touchEnd,this.eventOptions),this.el.removeEventListener("touchcancel",this.touchEnd,this.eventOptions),this.el.removeEventListener("touchmove",this.touchMove,this.eventOptions)}},{key:"getStartDirection",value:function(e){var t=e.x,n=void 0===t?0:t,i=e.y,r=void 0===i?0:i;return this.directionCount<=this.options.startDirectionLoopCount?(this.directionCount++,null):Math.abs(n)>Math.abs(r)?"horizontal":"vertical"}},{key:"handleStart",value:function(e){var t=e.x,n=void 0===t?0:t,i=e.y,r=void 0===i?0:i,s=e.e,a=void 0===s?{}:s;this.startX=n,this.startY=r,this.startDirection=null,this.directionCount=1,this.panning=!1,this.startTime=o()(),this.clearVelocityStats(),this.emit("pan.prestart",{sourceEvent:a})}},{key:"handleMove",value:function(e){var t=e.e,n=void 0===t?{}:t,i=e.x,r=void 0===i?0:i,s=e.y,a=void 0===s?0:s,l=r-this.startX,c=a-this.startY;if(null===this.startDirection?this.startDirection=this.getStartDirection({x:l,y:c}):!this.panning&&(Math.abs(l)>this.options.sensitivity||Math.abs(c)>this.options.sensitivity)&&(this.panning=!0,this.emit("pan.start",{startDirection:this.startDirection,sourceEvent:n})),this.panning){this.emit("pan.all",{startDirection:this.startDirection,deltaX:l,deltaY:c,sourceEvent:n}),"horizontal"===this.startDirection?l<0?this.emit("pan.x.left",{delta:l,sourceEvent:n}):this.emit("pan.x.right",{delta:l,sourceEvent:n}):"vertical"===this.startDirection&&(c<0?this.emit("pan.y.up",{delta:c,sourceEvent:n}):this.emit("pan.y.down",{delta:c,sourceEvent:n}));var u=o()()-this.startTime;this.velocity.current.x=l/u*100,this.velocity.current.y=c/u*100,this.velocity.max.x=Math.max(this.velocity.max.x,Math.abs(this.velocity.current.x)),this.velocity.max.y=Math.max(this.velocity.max.y,Math.abs(this.velocity.current.y)),this.lastDeltaX=l,this.lastDeltaY=c}}}])&&p(n.prototype,i),r&&p(n,r),t}(r.a)}]).default})); |
{ | ||
"name": "gesture-helper", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"description": "a *tiny* touch & mouse library to help make tracking touch interactions more simple.", | ||
@@ -5,0 +5,0 @@ "unpkg": "dist/index.min.js", |
@@ -13,2 +13,3 @@ # gesture-helper | ||
pan.start // (the beginning of a discernable drag event) | ||
pan.preend // (fires just before gesture-helper's final pan-end logic) | ||
pan.end // (the end of a detected drag event) | ||
@@ -15,0 +16,0 @@ pan.all // (a progress event for any and all directions of finger movement) |
@@ -207,9 +207,2 @@ "use strict"; | ||
this.emit("pan.preend", { sourceEvent: e }); | ||
console.log( | ||
"!!!!!!!!!!!!!!!!!!!!", | ||
this.velocity, | ||
this.velocity.max.x, | ||
this.options.swipeVelocity | ||
); | ||
if (this.panning) { | ||
@@ -216,0 +209,0 @@ this.panning = false; |
81
51173
576