New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gesture-helper

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gesture-helper - npm Package Compare versions

Comparing version 0.1.29 to 0.1.30

48

demo/demo.js
import GestureHelper from "../src/gesture-helper.js";
const demoOutput = document.getElementById("output");
const gestureCtrl = new GestureHelper(document.body, {
const gestureCtrl = new GestureHelper(document.getElementById("touchArea"), {
sensitivity: 0,

@@ -9,3 +9,5 @@ passive: false,

startDirectionLoopCount: 2,
// useMomentum: true
terminatePanOutsideBounds: true,
outsideBoundsOffset: 15,
// useMomentum: true, // coming soon
// longTapDuration: 500, // coming soon

@@ -15,3 +17,6 @@ });

gestureCtrl.on("tap", e => {
demoOutput.innerHTML = JSON.stringify(e);
demoOutput.innerHTML = `
tap event:
${JSON.stringify(e)}
`;
clear();

@@ -21,4 +26,8 @@ });

gestureCtrl.on("pan.start", function(ev) {
demoOutput.innerHTML = JSON.stringify(ev);
gestureCtrl.on("pan.start", function (ev) {
demoOutput.innerHTML = `
pan.start event:
${JSON.stringify(ev)}
`;
clearTimeout(timeoutIndex);
});

@@ -29,4 +38,7 @@

gestureCtrl.on("pan.end", function(ev) {
demoOutput.innerHTML = JSON.stringify(ev);
gestureCtrl.on("pan.end", function (ev) {
demoOutput.innerHTML = `
pan.end event:
${JSON.stringify(ev)}
`
clear();

@@ -36,13 +48,19 @@ });

function handleAll(ev) {
demoOutput.innerHTML = JSON.stringify(ev);
demoOutput.innerHTML = `
pan.all event:
${JSON.stringify(ev)}
`;
clearTimeout(timeoutIndex);
}
function handleX(ev) {
demoOutput.innerHTML = JSON.stringify(ev);
console.log('!!!!!!!!', ev);
}
// function handleX(ev) {
// demoOutput.innerHTML = JSON.stringify(ev);
// console.log('!!!!!!!!', ev);
// }
const clear = () =>
setTimeout(() => {
let timeoutIndex;
const clear = () => {
timeoutIndex = setTimeout(() => {
demoOutput.innerHTML = `click & drag horizontally ...`;
}, 5000);
}, 2000);
};

@@ -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=3)}([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(){if(!this._events&&!this._all)return!1;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(){if(!this._events&&!this._all)return!1;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){"use strict";n.r(t);var i=n(2),r=n.n(i),s=n(0),o=n.n(s);var a=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 l(e){return(l="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 c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 h(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?p(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(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 d})),a(window);var d=function(e){function t(){var e;c(this,t),y(p(e=h(this,f(t).call(this,{wildcard:!0}))),"mouseMove",(function(t){e.handleMove({e:t,x:t.clientX,y:t.clientY})})),y(p(e),"touchMove",(function(t){e.handleMove({e:t,x:t.touches[0].clientX,y:t.touches[0].clientY})})),y(p(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)})),y(p(e),"touchEnd",(function(t){e.handleEnd(t),e.el.removeEventListener("touchmove",e.touchMove,e.eventOptions)})),y(p(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))})),y(p(e),"mouseUp",(function(t){t.sourceCapabilities.firesTouchEvents||(e.handleEnd(t),e.el.removeEventListener("mousemove",e.mouseMove,e.eventOptions))})),y(p(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=momentum({velocity:{x:e.velocity.current.x,y:e.velocity.current.y},from:{x:e.lastDeltaX,y:e.lastDeltaY},emitter:p(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&&v(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||Math.abs(n)===Math.abs(r)?(this.directionCount+=1,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}}}])&&u(n.prototype,i),r&&u(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(){if(!this._events&&!this._all)return!1;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(){if(!this._events&&!this._all)return!1;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){"use strict";n.r(t);var i=n(2),r=n.n(i),s=n(0),o=n.n(s);var a=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 l(e){return(l="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 c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(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 h(e,t){return!t||"object"!==l(t)&&"function"!=typeof t?p(e):t}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(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 d})),a(window);var d=function(e){function t(){var e;c(this,t),y(p(e=h(this,f(t).call(this,{wildcard:!0}))),"mouseMove",(function(t){e.handleMove({e:t,x:t.layerX,y:t.layerY})})),y(p(e),"touchMove",(function(t){e.handleMove({e:t,x:t.touches[0].layerX,y:t.touches[0].layerY})})),y(p(e),"touchStart",(function(t){e.handleStart({x:t.touches[0].layerX,y:t.touches[0].layerY,e:t}),e.el.addEventListener("touchmove",e.touchMove,e.eventOptions)})),y(p(e),"touchEnd",(function(t){e.handleEnd(t),e.el.removeEventListener("touchmove",e.touchMove,e.eventOptions)})),y(p(e),"mouseDown",(function(t){t.sourceCapabilities.firesTouchEvents||(e.handleStart({x:t.layerX,y:t.layerY,e:t}),e.el.addEventListener("mousemove",e.mouseMove,e.eventOptions))})),y(p(e),"mouseUp",(function(t){t.sourceCapabilities.firesTouchEvents||(e.handleEnd(t),e.el.removeEventListener("mousemove",e.mouseMove,e.eventOptions))})),y(p(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})}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:100,longTapDuration:400,startDirectionLoopCount:2,terminatePanOutsideBounds:!1,outsideBoundsOffset:10},(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&&v(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||Math.abs(n)===Math.abs(r)?(this.directionCount+=1,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:"checkOutOfBounds",value:function(e){var t=e.x,n=e.y,i=this.options.outsideBoundsOffset,r=this.el.offsetWidth-i,s=this.el.offsetHeight-i;return t>=r||t<=i||n>=s||n<=i}},{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){if(this.checkOutOfBounds({x:l+this.startX,y:c+this.startY})&&this.options.terminatePanOutsideBounds)return this.touchEnd(n),this.mouseUp(n),!1;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}}}])&&u(n.prototype,i),r&&u(n,r),t}(r.a)}]).default}));
{
"name": "gesture-helper",
"version": "0.1.29",
"version": "0.1.30",
"description": "a *tiny* touch & mouse library to help make tracking touch interactions more simple.",

@@ -5,0 +5,0 @@ "unpkg": "dist/index.js",

@@ -75,2 +75,4 @@ # gesture-helper

maxTapDuration: Number(300), // Integer: Milliseconds of finger being on the screen before a tap event is ignored
terminatePanOutsideBounds: false, // This will stop pan events when the cursor approaches the bounds of the hitzone. This helps to eliminate unproperly terminated pan events (zombie events).
outsideBoundsOffset: Number(10) // How close the cursor can get to the edge of the hitzone, before the event is terminated early (prevents zombie events)
```

@@ -13,3 +13,3 @@ "use strict";

super({
wildcard: true
wildcard: true,
});

@@ -25,5 +25,7 @@

swipeVelocity: 60,
maxTapDuration: 300,
maxTapDuration: 100,
longTapDuration: 400,
startDirectionLoopCount: 2
startDirectionLoopCount: 2,
terminatePanOutsideBounds: false,
outsideBoundsOffset: 10,
},

@@ -45,5 +47,5 @@ props[1] || {}

passive: !!this.options.passive,
capture: !!this.options.capture
capture: !!this.options.capture,
};
}
},
});

@@ -54,3 +56,3 @@ this.el.addEventListener("test", null, options);

this.eventOptions = {
capture: !!this.options.capture
capture: !!this.options.capture,
};

@@ -65,3 +67,3 @@ }

current: { x: 0, y: 0 },
max: { x: 0, y: 0 }
max: { x: 0, y: 0 },
};

@@ -82,15 +84,15 @@ }

mouseMove = e => {
this.handleMove({ e: e, x: e.clientX, y: e.clientY });
mouseMove = (e) => {
this.handleMove({ e: e, x: e.layerX, y: e.layerY });
};
touchMove = e => {
this.handleMove({ e: e, x: e.touches[0].clientX, y: e.touches[0].clientY });
touchMove = (e) => {
this.handleMove({ e: e, x: e.touches[0].layerX, y: e.touches[0].layerY });
};
touchStart = e => {
touchStart = (e) => {
this.handleStart({
x: e.touches[0].clientX,
y: e.touches[0].clientY,
e: e
x: e.touches[0].layerX,
y: e.touches[0].layerY,
e: e,
});

@@ -100,3 +102,3 @@ this.el.addEventListener("touchmove", this.touchMove, this.eventOptions);

touchEnd = e => {
touchEnd = (e) => {
this.handleEnd(e);

@@ -106,9 +108,9 @@ this.el.removeEventListener("touchmove", this.touchMove, this.eventOptions);

mouseDown = e => {
mouseDown = (e) => {
if (e.sourceCapabilities.firesTouchEvents) return;
this.handleStart({ x: e.clientX, y: e.clientY, e: e });
this.handleStart({ x: e.layerX, y: e.layerY, e: e });
this.el.addEventListener("mousemove", this.mouseMove, this.eventOptions);
};
mouseUp = e => {
mouseUp = (e) => {
if (e.sourceCapabilities.firesTouchEvents) return;

@@ -167,2 +169,9 @@ this.handleEnd(e);

checkOutOfBounds({ x, y }) {
const tolerance = this.options.outsideBoundsOffset;
const width = this.el.offsetWidth - tolerance;
const height = this.el.offsetHeight - tolerance;
return x >= width || x <= tolerance || y >= height || y <= tolerance;
}
handleMove({ e = {}, x = 0, y = 0 }) {

@@ -182,3 +191,3 @@ const deltaX = x - this.startX;

startDirection: this.startDirection,
sourceEvent: e
sourceEvent: e,
});

@@ -188,2 +197,14 @@ }

if (this.panning) {
if (
this.checkOutOfBounds({
x: deltaX + this.startX,
y: deltaY + this.startY,
}) &&
this.options.terminatePanOutsideBounds
) {
this.touchEnd(e);
this.mouseUp(e);
return false;
}
this.emit("pan.all", {

@@ -193,3 +214,3 @@ startDirection: this.startDirection,

deltaY,
sourceEvent: e
sourceEvent: e,
});

@@ -224,3 +245,3 @@

handleEnd = e => {
handleEnd = (e) => {
const deltaTime = perfNow() - this.startTime;

@@ -246,19 +267,2 @@ this.emit("pan.preend", { sourceEvent: e });

this.emit("pan.end", { isSwipe, swipeDirection, sourceEvent: e });
if (this.options.useMomentum) {
this.momentum = momentum({
velocity: {
x: this.velocity.current.x,
y: this.velocity.current.y
},
from: {
x: this.lastDeltaX,
y: this.lastDeltaY
},
// @TODO, this feels pretty sloppy.
// There must be a nicer way to structure this lib
emitter: this
});
this.momentum.start();
}
} else if (deltaTime <= this.options.maxTapDuration) {

@@ -265,0 +269,0 @@ this.emit("tap", { srcEvent: e });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc