Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

any-touch

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

any-touch - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

165

dist/any-touch.umd.js

@@ -384,54 +384,2 @@ (function (global, factory) {

function use(atOrAT, Recognizer, recognizerOptions) {
var e_1, _a;
var name = recognizerOptions === null || recognizerOptions === void 0 ? void 0 : recognizerOptions.name;
if (void 0 !== name && void 0 !== atOrAT._$recognizerMap[name])
return;
var recognizer = new Recognizer(recognizerOptions);
try {
for (var _b = __values(recognizer.computeFunctions), _c = _b.next(); !_c.done; _c = _b.next()) {
var createComputeFunction = _c.value;
var _id = createComputeFunction._id;
if (void 0 === atOrAT._$computeFunctionMap[_id]) {
atOrAT._$computeFunctionMap[_id] = 'version' in atOrAT ? createComputeFunction : createComputeFunction();
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
atOrAT._$recognizerMap[recognizer.name] = recognizer;
atOrAT._$recognizers.push(atOrAT._$recognizerMap[recognizer.name]);
}
function removeUse(atOrAT, recognizerName) {
var e_2, _a;
if (void 0 === recognizerName) {
atOrAT._$recognizers = [];
atOrAT._$recognizerMap = {};
}
else {
try {
for (var _b = __values(atOrAT._$recognizers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), index = _d[0], recognizer = _d[1];
if (recognizerName === recognizer.options.name) {
atOrAT._$recognizers.splice(index, 1);
delete atOrAT._$recognizerMap[recognizerName];
break;
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_2) throw e_2.error; }
}
}
}
var AT_AFTER = 'at:after';

@@ -455,6 +403,7 @@ function emit2 (at, payload) {

};
var AT = "at";
var AnyTouch = (function (_super) {
__extends(AnyTouch, _super);
function AnyTouch(el, options) {
var _a;
var e_1, _a, _b;
var _this = _super.call(this) || this;

@@ -466,18 +415,26 @@ _this._$computeFunctionMap = {};

_this.options = __assign(__assign({}, DEFAULT_OPTIONS), options);
for (var k in AnyTouch._$computeFunctionMap) {
_this._$computeFunctionMap[k] = AnyTouch._$computeFunctionMap[k]();
try {
for (var _c = __values(AnyTouch._$Recognizers), _d = _c.next(); !_d.done; _d = _c.next()) {
var _e = __read(_d.value, 2), Recognizer_1 = _e[0], options_1 = _e[1];
_this.use(Recognizer_1, options_1);
}
}
_this._$recognizerMap = AnyTouch._$recognizerMap;
_this._$recognizers = AnyTouch._$recognizers;
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
}
finally { if (e_1) throw e_1.error; }
}
var createInputFromTouch = touch(_this.el);
var createInputFromMouse = mouse();
_this._$inputCreatorMap = (_a = {},
_a[TOUCH_START] = createInputFromTouch,
_a[TOUCH_MOVE] = createInputFromTouch,
_a[TOUCH_END] = createInputFromTouch,
_a[TOUCH_CANCEL] = createInputFromTouch,
_a[MOUSE_DOWN] = createInputFromMouse,
_a[MOUSE_MOVE] = createInputFromMouse,
_a[MOUSE_UP] = createInputFromMouse,
_a);
_this._$inputCreatorMap = (_b = {},
_b[TOUCH_START] = createInputFromTouch,
_b[TOUCH_MOVE] = createInputFromTouch,
_b[TOUCH_END] = createInputFromTouch,
_b[TOUCH_CANCEL] = createInputFromTouch,
_b[MOUSE_DOWN] = createInputFromMouse,
_b[MOUSE_MOVE] = createInputFromMouse,
_b[MOUSE_UP] = createInputFromMouse,
_b);
if (void 0 !== el) {

@@ -495,3 +452,3 @@ el.style.webkitTapHighlightColor = 'rgba(0,0,0,0)';

}
catch (_b) { }
catch (_f) { }
_this.on('unbind', bindElement(el, _this.catchEvent.bind(_this), !_this.options.preventDefault && supportsPassive_1 ? { passive: true } : false));

@@ -514,3 +471,3 @@ }

AnyTouch.prototype.catchEvent = function (event) {
var e_1, _a;
var e_2, _a;
var _this = this;

@@ -525,3 +482,2 @@ var stopPropagation = function () { return event.stopPropagation(); };

if (void 0 !== input) {
var AT = "at";
var AT_WITH_STATUS = AT + ':' + input.stage;

@@ -566,3 +522,3 @@ this.emit(AT, input);

}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {

@@ -572,11 +528,56 @@ try {

}
finally { if (e_1) throw e_1.error; }
finally { if (e_2) throw e_2.error; }
}
}
};
AnyTouch.prototype.use = function (Recognizer, options) {
use(this, Recognizer, options);
AnyTouch.prototype.use = function (Recognizer, recognizerOptions) {
var e_3, _a;
var name = recognizerOptions === null || recognizerOptions === void 0 ? void 0 : recognizerOptions.name;
if (void 0 !== name && void 0 !== this._$recognizerMap[name])
return;
var recognizer = new Recognizer(recognizerOptions);
try {
for (var _b = __values(recognizer.computeFunctions), _c = _b.next(); !_c.done; _c = _b.next()) {
var createComputeFunction = _c.value;
var _id = createComputeFunction._id;
if (void 0 === this._$computeFunctionMap[_id]) {
this._$computeFunctionMap[_id] = createComputeFunction();
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_3) throw e_3.error; }
}
this._$recognizerMap[recognizer.name] = recognizer;
this._$recognizers.push(this._$recognizerMap[recognizer.name]);
};
AnyTouch.prototype.removeUse = function (name) {
removeUse(this, name);
AnyTouch.prototype.removeUse = function (recognizerName) {
var e_4, _a;
if (void 0 === recognizerName) {
this._$recognizers = [];
this._$recognizerMap = {};
}
else {
try {
for (var _b = __values(this._$recognizers.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), index = _d[0], recognizer = _d[1];
if (recognizerName === recognizer.options.name) {
this._$recognizers.splice(index, 1);
delete this._$recognizerMap[recognizerName];
break;
}
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_4) throw e_4.error; }
}
}
};

@@ -596,12 +597,8 @@ AnyTouch.prototype.beforeEach = function (hook) {

};
AnyTouch.version = '1.0.8';
AnyTouch._$recognizers = [];
AnyTouch._$recognizerMap = {};
AnyTouch.version = '1.0.9';
AnyTouch._$Recognizers = [];
AnyTouch._$computeFunctionMap = {};
AnyTouch.use = function (Recognizer, options) {
use(AnyTouch, Recognizer, options);
AnyTouch.use = function (Recognizer, recognizerOptions) {
AnyTouch._$Recognizers.push([Recognizer, recognizerOptions]);
};
AnyTouch.removeUse = function (recognizerName) {
removeUse(AnyTouch, recognizerName);
};
return AnyTouch;

@@ -611,3 +608,3 @@ }(default_1));

function resetStatus (recognizer) {
if (-1 !== [STATUS_END, STATUS_CANCELLED, STATUS_RECOGNIZED, STATUS_FAILED].indexOf(recognizer.status)) {
if ([STATUS_END, STATUS_CANCELLED, STATUS_RECOGNIZED, STATUS_FAILED].includes(recognizer.status)) {
recognizer.status = STATUS_POSSIBLE;

@@ -614,0 +611,0 @@ }

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).AnyTouch=e()}(this,(function(){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function i(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}var o=function(){function t(){this.listenersMap={}}return t.prototype.on=function(t,e,n){var r,o,a=Array.isArray(t)?t:[t];try{for(var s=i(a),u=s.next();!u.done;u=s.next()){var c=u.value;void 0===this.listenersMap[c]&&(this.listenersMap[c]=[]),e.beforeEmit=n,this.listenersMap[c].push(e)}}catch(t){r={error:t}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return this},t.prototype.emit=function(t,e){var n,r,o=this.listenersMap[t];if(void 0!==o&&0<o.length)try{for(var a=i(o),s=a.next();!s.done;s=a.next()){var u=s.value;(void 0===u.beforeEmit||void 0!==e&&u.beforeEmit(e))&&u(e)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},t.prototype.off=function(t,e){var n=this.listenersMap[t];if(void 0!==n)if(void 0===e)delete this.listenersMap[t];else{var i=n.findIndex((function(t){return t===e}));n.splice(i,1)}},t.prototype.destroy=function(){this.listenersMap={}},t}(),a=Object.prototype.toString;var s="cancel",u="end",c="touch"+u,p="touch"+s,h="start",v="move",l=u,f="r",d="f",m=s;function y(t){return Math.round(100*t)/100}function g(){var t,e,i,r,o=0;return function(a){if(t=e,void 0!==a){var c=function(t,e){var n=t.stage,i=t.points,r=t.changedPoints,o=t.nativeEvent,a=i.length,c="start"===n,p=u===n&&0===a||s===n,h=Date.now(),v=_(i)||_(r),l=v.x,f=v.y,d=o.currentTarget;return Object.assign(t,{id:e,x:l,y:f,timestamp:h,isStart:c,isEnd:p,pointLength:a,currentTarget:d,getOffset:function(t){void 0===t&&(t=d);var e=t.getBoundingClientRect();return{x:l-Math.round(e.left),y:f-Math.round(e.top)}}})}(a,o=Number.MAX_SAFE_INTEGER>o?++o:1);e=c;var p=c.isStart,h=c.pointLength;return p&&(i=c,t=void 0,r=1<h?c:void 0),n(n({},c),{prevInput:t,startMultiInput:r,startInput:i})}}}function _(t){var e=t.length;if(0<e){if(1===e){var n=t[0],i=n.clientX,r=n.clientY;return{x:Math.round(i),y:Math.round(r)}}var o=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(o.x/e),y:Math.round(o.y/e)}}}function $(t,e,n){e.target,e.currentTarget;var i,r=e.type,o=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}(e,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(r,null==n?void 0:n.bubbles,null==n?void 0:n.cancelable):i=new Event(r,n),Object.assign(i,o,{match:function(){return e.targets.every((function(t){return i.currentTarget.contains(t)}))}}),t.dispatchEvent(i)}function T(t,e){if(!e.preventDefault)return!1;var n,i=!0;if(null!==t.target){var r=e.preventDefaultExclude;if(n=r,"[object RegExp]"===a.call(n)){if("tagName"in t.target){var o=t.target.tagName;i=!r.test(o)}}else(function(t){return"[object Function]"===a.call(t)})(r)&&(i=!r(t))}return i}var M=["touchstart","touchmove",c,p];function b(t,e,n){var r,o,a=null==n?void 0:n.name;if(void 0===a||void 0===t._$recognizerMap[a]){var s=new e(n);try{for(var u=i(s.computeFunctions),c=u.next();!c.done;c=u.next()){var p=c.value,h=p._id;void 0===t._$computeFunctionMap[h]&&(t._$computeFunctionMap[h]="version"in t?p:p())}}catch(t){r={error:t}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}t._$recognizerMap[s.name]=s,t._$recognizers.push(t._$recognizerMap[s.name])}}function x(t,e){var n,o;if(void 0===e)t._$recognizers=[],t._$recognizerMap={};else try{for(var a=i(t._$recognizers.entries()),s=a.next();!s.done;s=a.next()){var u=r(s.value,2),c=u[0];if(e===u[1].options.name){t._$recognizers.splice(c,1),delete t._$recognizerMap[e];break}}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}}function E(t,e){var i=e.type,r=e.target;t.emit(i,e),t.emit("at:after",e),t.options.domEvents&&void 0!==t.el&&null!==r&&($(r,e,t.options.domEvents),$(r,n(n({},e),{_type:e.type,type:"at:after"}),t.options.domEvents))}var w={domEvents:{bubbles:!0,cancelable:!0},preventDefault:!0,preventDefaultExclude:/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/},P=function(t){function r(e,i){var o,a=t.call(this)||this;for(var s in a._$computeFunctionMap={},a._$recognizerMap={},a._$recognizers=[],a.el=e,a.options=n(n({},w),i),r._$computeFunctionMap)a._$computeFunctionMap[s]=r._$computeFunctionMap[s]();a._$recognizerMap=r._$recognizerMap,a._$recognizers=r._$recognizers;var h,v,l,f,d=function(t){var e=g();return function(n){var i=[],r=[];Array.from(n.touches).forEach((function(e){var n=e.clientX,o=e.clientY,a=e.target;(null==t?void 0:t.contains(a))&&(i.push(a),r.push({clientX:n,clientY:o,target:a}))}));var o=Array.from(n.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return e({stage:n.type.replace("touch",""),changedPoints:o,points:r,nativeEvent:n,target:n.target,targets:i})}}(a.el),m=(v=!1,l=null,f=g(),function(t){var e,n=t.clientX,i=t.clientY,r=t.type,o=t.button,a=t.target,s=[{clientX:n,clientY:i,target:a}];"mousedown"===r&&0===o?(l=a,v=!0,e="start"):v&&("mousemove"===r?e="move":"mouseup"===r&&(s=[],e=u,v=!1));var c=h||[{clientX:n,clientY:i,target:a}];if(h=[{clientX:n,clientY:i,target:a}],void 0!==e)return f({stage:e,changedPoints:c,points:s,target:l,targets:[l],nativeEvent:t})});if(a._$inputCreatorMap=((o={}).touchstart=d,o.touchmove=d,o[c]=d,o[p]=d,o.mousedown=m,o.mousemove=m,o.mouseup=m,o),void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var y=!1;try{var _={};Object.defineProperty(_,"passive",{get:function(){y=!0}}),window.addEventListener("_",(function(){}),_)}catch(t){}a.on("unbind",function(t,e,n){return M.forEach((function(i){t.addEventListener(i,e,n)})),t.addEventListener("mousedown",e,n),window.addEventListener("mousemove",e,n),window.addEventListener("mouseup",e,n),function(){M.forEach((function(n){t.removeEventListener(n,e)})),t.removeEventListener("mousedown",e,n),window.removeEventListener("mousemove",e,n),window.removeEventListener("mouseup",e,n)}}(e,a.catchEvent.bind(a),!(a.options.preventDefault||!y)&&{passive:!0}))}return a}return e(r,t),r.prototype.target=function(t){var e=this;return{on:function(n,i){e.on(n,i,(function(e){var n=e.targets;return e.target===t&&n.every((function(e){return t.contains(e)}))}))}}},r.prototype.catchEvent=function(t){var e,r,o=this,a=function(){return t.stopPropagation()},s=function(){return t.preventDefault()},u=function(){return t.stopImmediatePropagation()};T(t,this.options)&&s();var c=this._$inputCreatorMap[t.type](t);if(void 0!==c){var p="at:"+c.stage;this.emit("at",c),this.emit(p,c);var h=this.options.domEvents;if(!1!==h){var v=t.target;null!==v&&($(v,n(n({},c),{type:"at"}),h),$(v,n(n({},c),{type:p}),h))}var l=c;for(var f in this._$computeFunctionMap)Object.assign(l,this._$computeFunctionMap[f](l));var d=function(t){if(t.disabled)return"continue";t.recognize(l,(function(e){var i=n(n({},l),{type:e,name:t.name,stopPropagation:a,preventDefault:s,stopImmediatePropagation:u});null==Object||Object.freeze(i),void 0===o.beforeEachHook?E(o,i):o.beforeEachHook(t,o._$recognizerMap,(function(){E(o,i)}))}))};try{for(var m=i(this._$recognizers),y=m.next();!y.done;y=m.next()){d(y.value)}}catch(t){e={error:t}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(e)throw e.error}}}},r.prototype.use=function(t,e){b(this,t,e)},r.prototype.removeUse=function(t){x(this,t)},r.prototype.beforeEach=function(t){this.beforeEachHook=t},r.prototype.get=function(t){return this._$recognizerMap[t]},r.prototype.set=function(t){this.options=n(n({},this.options),t)},r.prototype.destroy=function(){this.emit("unbind"),this.listenersMap={}},r.version="1.0.8",r._$recognizers=[],r._$recognizerMap={},r._$computeFunctionMap={},r.use=function(t,e){b(r,t,e)},r.removeUse=function(t){x(r,t)},r}(o);function L(t){-1!==[l,m,f,d].indexOf(t.status)&&(t.status="p")}function z(t,e,n){var i=t._$test(e);L(t);var r=e.stage;t.status=function(t,e,n){var i,r,o,a,c,p,f,y={1:(i={},i.p=(r={},r.move=h,r[u]=d,r[s]=d,r),i[h]=(o={},o.move=v,o[u]=l,o[s]=m,o),i[v]=(a={},a.move=v,a[u]=l,a[s]=m,a),i),0:(c={},c[h]=(p={},p.move=d,p[u]=l,p[s]=m,p),c[v]=(f={},f.start=d,f.move=d,f[u]=l,f[s]=m,f),c)}[Number(t)][e];return void 0!==y&&y[n]||e}(i,t.status,r),t._$isRecognized=[h,v].includes(t.status);var o=t.name,a=t.status,c=t._$isRecognized;return c&&n(o),(c||[l,m].includes(t.status))&&n(o+a),i}var O=function(){function t(t){this.disabled=!1,this._$isRecognized=!1,this.status="p",this.computeFunctions=[],this.options=t,this.name=this.options.name}return t.prototype.set=function(t){return void 0!==t&&(this.options=n(n({},this.options),t)),this},t.prototype._$isValidPointLength=function(t){return this.options.pointLength===t},t}(),S=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},F=function(t){return t/Math.PI*180},D=function(t,e){var n=function(t,e){var n=S(t)*S(e);if(0===n)return 0;var i=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return i>1&&(i=1),Math.acos(i)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),F(n)},I=function(t,e){return Math.abs(t)>=Math.abs(e)?0<t?"right":"left":0<e?"down":"up"};function X(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function A(t){var e=t.prevInput,n=t.startMultiInput;if(void 0!==n&&void 0!==e&&t.id!==n.id&&1<e.pointLength&&1<t.pointLength)return{startV:X(n),prevV:X(e),activeV:X(t)}}function V(){return function(t){var e=(null==t?void 0:t._vs)||A(t);if(void 0!==e&&e.activeV){var n=e.prevV,i=e.startV,r=e.activeV,o=Math.round(D(r,n));return{angle:Math.round(D(r,i)),deltaAngle:o,_vs:e}}}}function Y(){return function(t){var e=t.prevInput,n=0,i=0,r=0;if(void 0!==e&&(n=t.x-e.x,i=t.y-e.y,0!==n||0!==i)){var o=Math.sqrt(Math.pow(n,2)+Math.pow(i,2));r=Math.round(F(Math.acos(Math.abs(n)/o)))}return{deltaX:n,deltaY:i,deltaXYAngle:r}}}function j(){var t,e=0,n=0,i=0,r=0,o=0;return function(a){var s=a.stage,u=a.startInput;return"start"===s?(e=0,n=0,i=0,r=0,o=0):"move"===s&&(e=Math.round(a.points[0].clientX-u.points[0].clientX),n=Math.round(a.points[0].clientY-u.points[0].clientY),i=Math.abs(e),r=Math.abs(n),o=Math.round(S({x:i,y:r})),t=I(e,n)),{displacementX:e,displacementY:n,distanceX:i,distanceY:r,distance:o,overallDirection:t}}}function C(){var t=0;return function(e){return"start"===e.stage&&(t=e.pointLength),{maxPointLength:t}}}function N(){return function(t){var e=(null==t?void 0:t._vs)||A(t);if(void 0!==e&&e.activeV){var n=e.prevV,i=e.startV,r=e.activeV,o=y(S(r)/S(n));return{scale:y(S(r)/S(i)),deltaScale:o,_vs:e}}}}function R(){var t,e,n=0,i=0,r=0,o=0;return function(a){if(void 0!==a){var s=a.stage;e=e||a.startInput;var u=a.timestamp-e.timestamp;if("move"===s&&16<u){var c=a.x-e.x,p=a.y-e.y;r=Math.round(c/u*100)/100,o=Math.round(p/u*100)/100,n=Math.abs(r),i=Math.abs(o),t=I(c,p)||t,e=a}}return{velocityX:n,velocityY:i,speedX:r,speedY:o,direction:t}}}V._id="a",Y._id="b",j._id="c",C._id="d",N._id="e",R._id="f";var U={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250},k=function(t){function i(e){var i=t.call(this,n(n({},U),e))||this;return i.computeFunctions=[j,C],i._$tapCount=0,i}return e(i,t),i.prototype._isValidDistanceFromPrevTap=function(t){if(void 0!==this._$prevTapPoint){var e=S({x:t.x-this._$prevTapPoint.x,y:t.y-this._$prevTapPoint.y});return this._$prevTapPoint=t,this.options.maxDistanceFromPrevTap>=e}return this._$prevTapPoint=t,!0},i.prototype._isValidInterval=function(){var t=performance.now();if(void 0===this._$prevTapTime)return this._$prevTapTime=t,!0;var e=t-this._$prevTapTime;return this._$prevTapTime=t,e<this.options.waitNextTapTime},i.prototype.recognize=function(t,e){var i=t.stage,r=t.x,o=t.y;u===i&&(this.status="p",this._$test(t)?(clearTimeout(this._$countDownToFailTimer),this._isValidDistanceFromPrevTap({x:r,y:o})&&this._isValidInterval()?this._$tapCount++:this._$tapCount=1,0==this._$tapCount%this.options.tapTimes?(this.status=f,e(this.options.name,n(n({},t),{tapCount:this._$tapCount})),this._$reset()):this._$countDownToFail()):(this._$reset(),this.status=d))},i.prototype._$countDownToFail=function(){var t=this;this._$countDownToFailTimer=setTimeout((function(){t.status=d,t._$reset()}),this.options.waitNextTapTime)},i.prototype._$reset=function(){this._$tapCount=0,this._$prevTapPoint=void 0,this._$prevTapTime=void 0},i.prototype._$test=function(t){var e=t.startInput,n=t.pointLength,i=t.timestamp-e.timestamp,r=t.maxPointLength,o=t.distance;return r===this.options.pointLength&&0===n&&this.options.maxDistance>=o&&this.options.maxPressTime>i},i}(O),H={name:"pan",threshold:10,pointLength:1},B=function(t){function i(e){var i=t.call(this,n(n({},H),e))||this;return i.computeFunctions=[R,j,Y],i}return e(i,t),i.prototype._$test=function(t){var e=t.pointLength,n=t.distance;return(this._$isRecognized||this.options.threshold<=n)&&this._$isValidPointLength(e)},i.prototype.recognize=function(t,e){void 0!==t.direction&&z(this,t,e)&&e(this.options.name+t.direction)},i}(O),q={name:"swipe",threshold:10,velocity:.3,pointLength:1},G=function(t){function i(e){var i=t.call(this,n(n({},q),e))||this;return i.computeFunctions=[j,R,C],i}return e(i,t),i.prototype._$test=function(t){if(u!==t.stage)return!1;var e=t.velocityX,n=t.velocityY,i=t.maxPointLength,r=t.distance;return this.options.pointLength===i&&this.options.threshold<r&&this.options.velocity<Math.max(e,n)},i.prototype.recognize=function(t,e){this._$test(t)&&(e(this.options.name),e(this.options.name+t.direction))},i}(O),Z={name:"press",pointLength:1,maxDistance:9,minPressTime:251},J=function(t){function i(e){var i=t.call(this,n(n({},Z),e))||this;return i.computeFunctions=[j],i}return e(i,t),i.prototype.recognize=function(t,e){var n=this,i=t.stage,r=t.startInput,o=t.pointLength;if("start"===i&&this._$isValidPointLength(o))L(this),this._$cancel(),this._timeoutId=setTimeout((function(){n.status=f,e(n.options.name)}),this.options.minPressTime);else if(u===i&&f===this.status)e(this.options.name+"up");else if(f!==this.status){var a=t.timestamp-r.timestamp;(!this._$test(t)||this.options.minPressTime>a&&[u,s].includes(i))&&(this._$cancel(),this.status=d)}},i.prototype._$test=function(t){var e=t.distance;return this.options.maxDistance>e},i.prototype._$cancel=function(){clearTimeout(this._timeoutId)},i}(O),K={name:"pinch",threshold:0,pointLength:2},Q=function(t){function i(e){var i=t.call(this,n(n({},K),e))||this;return i.computeFunctions=[N],i}return e(i,t),i.prototype._$test=function(t){var e=t.pointLength,n=t.scale;return this._$isValidPointLength(e)&&void 0!==n&&(this.options.threshold<Math.abs(n-1)||this._$isRecognized)},i.prototype.recognize=function(t,e){z(this,t,e)},i}(O),W={name:"rotate",threshold:0,pointLength:2},tt=function(t){function i(e){var i=t.call(this,n(n({},W),e))||this;return i.computeFunctions=[V],i}return e(i,t),i.prototype._$test=function(t){var e=t.pointLength,n=t.angle;return this._$isValidPointLength(e)&&(this.options.threshold<Math.abs(n)||this._$isRecognized)},i.prototype.recognize=function(t,e){z(this,t,e)},i}(O);return P.use(k),P.use(B),P.use(G),P.use(J),P.use(Q),P.use(tt),P.Tap=k,P.Pan=B,P.Swipe=G,P.Press=J,P.Pinch=Q,P.Rotate=tt,P.STATUS_POSSIBLE="p",P.STATUS_START=h,P.STATUS_MOVE=v,P.STATUS_END=l,P.STATUS_CANCELLED=m,P.STATUS_FAILED=d,P.STATUS_RECOGNIZED=f,P}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).AnyTouch=e()}(this,(function(){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function i(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}var o=function(){function t(){this.listenersMap={}}return t.prototype.on=function(t,e,n){var r,o,a=Array.isArray(t)?t:[t];try{for(var s=i(a),u=s.next();!u.done;u=s.next()){var c=u.value;void 0===this.listenersMap[c]&&(this.listenersMap[c]=[]),e.beforeEmit=n,this.listenersMap[c].push(e)}}catch(t){r={error:t}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return this},t.prototype.emit=function(t,e){var n,r,o=this.listenersMap[t];if(void 0!==o&&0<o.length)try{for(var a=i(o),s=a.next();!s.done;s=a.next()){var u=s.value;(void 0===u.beforeEmit||void 0!==e&&u.beforeEmit(e))&&u(e)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}},t.prototype.off=function(t,e){var n=this.listenersMap[t];if(void 0!==n)if(void 0===e)delete this.listenersMap[t];else{var i=n.findIndex((function(t){return t===e}));n.splice(i,1)}},t.prototype.destroy=function(){this.listenersMap={}},t}(),a=Object.prototype.toString;var s="cancel",u="end",c="touch"+u,p="touch"+s,h="start",v="move",l=u,f="r",d="f",m=s;function y(t){return Math.round(100*t)/100}function g(){var t,e,i,r,o=0;return function(a){if(t=e,void 0!==a){var c=function(t,e){var n=t.stage,i=t.points,r=t.changedPoints,o=t.nativeEvent,a=i.length,c="start"===n,p=u===n&&0===a||s===n,h=Date.now(),v=_(i)||_(r),l=v.x,f=v.y,d=o.currentTarget;return Object.assign(t,{id:e,x:l,y:f,timestamp:h,isStart:c,isEnd:p,pointLength:a,currentTarget:d,getOffset:function(t){void 0===t&&(t=d);var e=t.getBoundingClientRect();return{x:l-Math.round(e.left),y:f-Math.round(e.top)}}})}(a,o=Number.MAX_SAFE_INTEGER>o?++o:1);e=c;var p=c.isStart,h=c.pointLength;return p&&(i=c,t=void 0,r=1<h?c:void 0),n(n({},c),{prevInput:t,startMultiInput:r,startInput:i})}}}function _(t){var e=t.length;if(0<e){if(1===e){var n=t[0],i=n.clientX,r=n.clientY;return{x:Math.round(i),y:Math.round(r)}}var o=t.reduce((function(t,e){return t.x+=e.clientX,t.y+=e.clientY,t}),{x:0,y:0});return{x:Math.round(o.x/e),y:Math.round(o.y/e)}}}function T(t,e,n){e.target,e.currentTarget;var i,r=e.type,o=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}(e,["target","currentTarget","type"]);return document.createEvent?(i=document.createEvent("HTMLEvents")).initEvent(r,null==n?void 0:n.bubbles,null==n?void 0:n.cancelable):i=new Event(r,n),Object.assign(i,o,{match:function(){return e.targets.every((function(t){return i.currentTarget.contains(t)}))}}),t.dispatchEvent(i)}function $(t,e){if(!e.preventDefault)return!1;var n,i=!0;if(null!==t.target){var r=e.preventDefaultExclude;if(n=r,"[object RegExp]"===a.call(n)){if("tagName"in t.target){var o=t.target.tagName;i=!r.test(o)}}else(function(t){return"[object Function]"===a.call(t)})(r)&&(i=!r(t))}return i}var b=["touchstart","touchmove",c,p];function x(t,e){var i=e.type,r=e.target;t.emit(i,e),t.emit("at:after",e),t.options.domEvents&&void 0!==t.el&&null!==r&&(T(r,e,t.options.domEvents),T(r,n(n({},e),{_type:e.type,type:"at:after"}),t.options.domEvents))}var M={domEvents:{bubbles:!0,cancelable:!0},preventDefault:!0,preventDefaultExclude:/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/},E=function(t){function o(e,a){var s,h,v,l=t.call(this)||this;l._$computeFunctionMap={},l._$recognizerMap={},l._$recognizers=[],l.el=e,l.options=n(n({},M),a);try{for(var f=i(o._$Recognizers),d=f.next();!d.done;d=f.next()){var m=r(d.value,2),y=m[0],_=m[1];l.use(y,_)}}catch(t){s={error:t}}finally{try{d&&!d.done&&(h=f.return)&&h.call(f)}finally{if(s)throw s.error}}var T,$,x,E,w=function(t){var e=g();return function(n){var i=[],r=[];Array.from(n.touches).forEach((function(e){var n=e.clientX,o=e.clientY,a=e.target;(null==t?void 0:t.contains(a))&&(i.push(a),r.push({clientX:n,clientY:o,target:a}))}));var o=Array.from(n.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return e({stage:n.type.replace("touch",""),changedPoints:o,points:r,nativeEvent:n,target:n.target,targets:i})}}(l.el),P=($=!1,x=null,E=g(),function(t){var e,n=t.clientX,i=t.clientY,r=t.type,o=t.button,a=t.target,s=[{clientX:n,clientY:i,target:a}];"mousedown"===r&&0===o?(x=a,$=!0,e="start"):$&&("mousemove"===r?e="move":"mouseup"===r&&(s=[],e=u,$=!1));var c=T||[{clientX:n,clientY:i,target:a}];if(T=[{clientX:n,clientY:i,target:a}],void 0!==e)return E({stage:e,changedPoints:c,points:s,target:x,targets:[x],nativeEvent:t})});if(l._$inputCreatorMap=((v={}).touchstart=w,v.touchmove=w,v[c]=w,v[p]=w,v.mousedown=P,v.mousemove=P,v.mouseup=P,v),void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var L=!1;try{var z={};Object.defineProperty(z,"passive",{get:function(){L=!0}}),window.addEventListener("_",(function(){}),z)}catch(t){}l.on("unbind",function(t,e,n){return b.forEach((function(i){t.addEventListener(i,e,n)})),t.addEventListener("mousedown",e,n),window.addEventListener("mousemove",e,n),window.addEventListener("mouseup",e,n),function(){b.forEach((function(n){t.removeEventListener(n,e)})),t.removeEventListener("mousedown",e,n),window.removeEventListener("mousemove",e,n),window.removeEventListener("mouseup",e,n)}}(e,l.catchEvent.bind(l),!(l.options.preventDefault||!L)&&{passive:!0}))}return l}return e(o,t),o.prototype.target=function(t){var e=this;return{on:function(n,i){e.on(n,i,(function(e){var n=e.targets;return e.target===t&&n.every((function(e){return t.contains(e)}))}))}}},o.prototype.catchEvent=function(t){var e,r,o=this,a=function(){return t.stopPropagation()},s=function(){return t.preventDefault()},u=function(){return t.stopImmediatePropagation()};$(t,this.options)&&s();var c=this._$inputCreatorMap[t.type](t);if(void 0!==c){var p="at:"+c.stage;this.emit("at",c),this.emit(p,c);var h=this.options.domEvents;if(!1!==h){var v=t.target;null!==v&&(T(v,n(n({},c),{type:"at"}),h),T(v,n(n({},c),{type:p}),h))}var l=c;for(var f in this._$computeFunctionMap)Object.assign(l,this._$computeFunctionMap[f](l));var d=function(t){if(t.disabled)return"continue";t.recognize(l,(function(e){var i=n(n({},l),{type:e,name:t.name,stopPropagation:a,preventDefault:s,stopImmediatePropagation:u});null==Object||Object.freeze(i),void 0===o.beforeEachHook?x(o,i):o.beforeEachHook(t,o._$recognizerMap,(function(){x(o,i)}))}))};try{for(var m=i(this._$recognizers),y=m.next();!y.done;y=m.next()){d(y.value)}}catch(t){e={error:t}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(e)throw e.error}}}},o.prototype.use=function(t,e){var n,r,o=null==e?void 0:e.name;if(void 0===o||void 0===this._$recognizerMap[o]){var a=new t(e);try{for(var s=i(a.computeFunctions),u=s.next();!u.done;u=s.next()){var c=u.value,p=c._id;void 0===this._$computeFunctionMap[p]&&(this._$computeFunctionMap[p]=c())}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}this._$recognizerMap[a.name]=a,this._$recognizers.push(this._$recognizerMap[a.name])}},o.prototype.removeUse=function(t){var e,n;if(void 0===t)this._$recognizers=[],this._$recognizerMap={};else try{for(var o=i(this._$recognizers.entries()),a=o.next();!a.done;a=o.next()){var s=r(a.value,2),u=s[0];if(t===s[1].options.name){this._$recognizers.splice(u,1),delete this._$recognizerMap[t];break}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}},o.prototype.beforeEach=function(t){this.beforeEachHook=t},o.prototype.get=function(t){return this._$recognizerMap[t]},o.prototype.set=function(t){this.options=n(n({},this.options),t)},o.prototype.destroy=function(){this.emit("unbind"),this.listenersMap={}},o.version="1.0.9",o._$Recognizers=[],o._$computeFunctionMap={},o.use=function(t,e){o._$Recognizers.push([t,e])},o}(o);function w(t){[l,m,f,d].includes(t.status)&&(t.status="p")}function P(t,e,n){var i=t._$test(e);w(t);var r=e.stage;t.status=function(t,e,n){var i,r,o,a,c,p,f,y={1:(i={},i.p=(r={},r.move=h,r[u]=d,r[s]=d,r),i[h]=(o={},o.move=v,o[u]=l,o[s]=m,o),i[v]=(a={},a.move=v,a[u]=l,a[s]=m,a),i),0:(c={},c[h]=(p={},p.move=d,p[u]=l,p[s]=m,p),c[v]=(f={},f.start=d,f.move=d,f[u]=l,f[s]=m,f),c)}[Number(t)][e];return void 0!==y&&y[n]||e}(i,t.status,r),t._$isRecognized=[h,v].includes(t.status);var o=t.name,a=t.status,c=t._$isRecognized;return c&&n(o),(c||[l,m].includes(t.status))&&n(o+a),i}var L=function(){function t(t){this.disabled=!1,this._$isRecognized=!1,this.status="p",this.computeFunctions=[],this.options=t,this.name=this.options.name}return t.prototype.set=function(t){return void 0!==t&&(this.options=n(n({},this.options),t)),this},t.prototype._$isValidPointLength=function(t){return this.options.pointLength===t},t}(),z=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},S=function(t){return t/Math.PI*180},O=function(t,e){var n=function(t,e){var n=z(t)*z(e);if(0===n)return 0;var i=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return i>1&&(i=1),Math.acos(i)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),S(n)},D=function(t,e){return Math.abs(t)>=Math.abs(e)?0<t?"right":"left":0<e?"down":"up"};function F(t){return{x:t.points[1].clientX-t.points[0].clientX,y:t.points[1].clientY-t.points[0].clientY}}function I(t){var e=t.prevInput,n=t.startMultiInput;if(void 0!==n&&void 0!==e&&t.id!==n.id&&1<e.pointLength&&1<t.pointLength)return{startV:F(n),prevV:F(e),activeV:F(t)}}function X(){return function(t){var e=(null==t?void 0:t._vs)||I(t);if(void 0!==e&&e.activeV){var n=e.prevV,i=e.startV,r=e.activeV,o=Math.round(O(r,n));return{angle:Math.round(O(r,i)),deltaAngle:o,_vs:e}}}}function A(){return function(t){var e=t.prevInput,n=0,i=0,r=0;if(void 0!==e&&(n=t.x-e.x,i=t.y-e.y,0!==n||0!==i)){var o=Math.sqrt(Math.pow(n,2)+Math.pow(i,2));r=Math.round(S(Math.acos(Math.abs(n)/o)))}return{deltaX:n,deltaY:i,deltaXYAngle:r}}}function V(){var t,e=0,n=0,i=0,r=0,o=0;return function(a){var s=a.stage,u=a.startInput;return"start"===s?(e=0,n=0,i=0,r=0,o=0):"move"===s&&(e=Math.round(a.points[0].clientX-u.points[0].clientX),n=Math.round(a.points[0].clientY-u.points[0].clientY),i=Math.abs(e),r=Math.abs(n),o=Math.round(z({x:i,y:r})),t=D(e,n)),{displacementX:e,displacementY:n,distanceX:i,distanceY:r,distance:o,overallDirection:t}}}function Y(){var t=0;return function(e){return"start"===e.stage&&(t=e.pointLength),{maxPointLength:t}}}function j(){return function(t){var e=(null==t?void 0:t._vs)||I(t);if(void 0!==e&&e.activeV){var n=e.prevV,i=e.startV,r=e.activeV,o=y(z(r)/z(n));return{scale:y(z(r)/z(i)),deltaScale:o,_vs:e}}}}function R(){var t,e,n=0,i=0,r=0,o=0;return function(a){if(void 0!==a){var s=a.stage;e=e||a.startInput;var u=a.timestamp-e.timestamp;if("move"===s&&16<u){var c=a.x-e.x,p=a.y-e.y;r=Math.round(c/u*100)/100,o=Math.round(p/u*100)/100,n=Math.abs(r),i=Math.abs(o),t=D(c,p)||t,e=a}}return{velocityX:n,velocityY:i,speedX:r,speedY:o,direction:t}}}X._id="a",A._id="b",V._id="c",Y._id="d",j._id="e",R._id="f";var C={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250},N=function(t){function i(e){var i=t.call(this,n(n({},C),e))||this;return i.computeFunctions=[V,Y],i._$tapCount=0,i}return e(i,t),i.prototype._isValidDistanceFromPrevTap=function(t){if(void 0!==this._$prevTapPoint){var e=z({x:t.x-this._$prevTapPoint.x,y:t.y-this._$prevTapPoint.y});return this._$prevTapPoint=t,this.options.maxDistanceFromPrevTap>=e}return this._$prevTapPoint=t,!0},i.prototype._isValidInterval=function(){var t=performance.now();if(void 0===this._$prevTapTime)return this._$prevTapTime=t,!0;var e=t-this._$prevTapTime;return this._$prevTapTime=t,e<this.options.waitNextTapTime},i.prototype.recognize=function(t,e){var i=t.stage,r=t.x,o=t.y;u===i&&(this.status="p",this._$test(t)?(clearTimeout(this._$countDownToFailTimer),this._isValidDistanceFromPrevTap({x:r,y:o})&&this._isValidInterval()?this._$tapCount++:this._$tapCount=1,0==this._$tapCount%this.options.tapTimes?(this.status=f,e(this.options.name,n(n({},t),{tapCount:this._$tapCount})),this._$reset()):this._$countDownToFail()):(this._$reset(),this.status=d))},i.prototype._$countDownToFail=function(){var t=this;this._$countDownToFailTimer=setTimeout((function(){t.status=d,t._$reset()}),this.options.waitNextTapTime)},i.prototype._$reset=function(){this._$tapCount=0,this._$prevTapPoint=void 0,this._$prevTapTime=void 0},i.prototype._$test=function(t){var e=t.startInput,n=t.pointLength,i=t.timestamp-e.timestamp,r=t.maxPointLength,o=t.distance;return r===this.options.pointLength&&0===n&&this.options.maxDistance>=o&&this.options.maxPressTime>i},i}(L),U={name:"pan",threshold:10,pointLength:1},k=function(t){function i(e){var i=t.call(this,n(n({},U),e))||this;return i.computeFunctions=[R,V,A],i}return e(i,t),i.prototype._$test=function(t){var e=t.pointLength,n=t.distance;return(this._$isRecognized||this.options.threshold<=n)&&this._$isValidPointLength(e)},i.prototype.recognize=function(t,e){void 0!==t.direction&&P(this,t,e)&&e(this.options.name+t.direction)},i}(L),H={name:"swipe",threshold:10,velocity:.3,pointLength:1},B=function(t){function i(e){var i=t.call(this,n(n({},H),e))||this;return i.computeFunctions=[V,R,Y],i}return e(i,t),i.prototype._$test=function(t){if(u!==t.stage)return!1;var e=t.velocityX,n=t.velocityY,i=t.maxPointLength,r=t.distance;return this.options.pointLength===i&&this.options.threshold<r&&this.options.velocity<Math.max(e,n)},i.prototype.recognize=function(t,e){this._$test(t)&&(e(this.options.name),e(this.options.name+t.direction))},i}(L),q={name:"press",pointLength:1,maxDistance:9,minPressTime:251},G=function(t){function i(e){var i=t.call(this,n(n({},q),e))||this;return i.computeFunctions=[V],i}return e(i,t),i.prototype.recognize=function(t,e){var n=this,i=t.stage,r=t.startInput,o=t.pointLength;if("start"===i&&this._$isValidPointLength(o))w(this),this._$cancel(),this._timeoutId=setTimeout((function(){n.status=f,e(n.options.name)}),this.options.minPressTime);else if(u===i&&f===this.status)e(this.options.name+"up");else if(f!==this.status){var a=t.timestamp-r.timestamp;(!this._$test(t)||this.options.minPressTime>a&&[u,s].includes(i))&&(this._$cancel(),this.status=d)}},i.prototype._$test=function(t){var e=t.distance;return this.options.maxDistance>e},i.prototype._$cancel=function(){clearTimeout(this._timeoutId)},i}(L),Z={name:"pinch",threshold:0,pointLength:2},J=function(t){function i(e){var i=t.call(this,n(n({},Z),e))||this;return i.computeFunctions=[j],i}return e(i,t),i.prototype._$test=function(t){var e=t.pointLength,n=t.scale;return this._$isValidPointLength(e)&&void 0!==n&&(this.options.threshold<Math.abs(n-1)||this._$isRecognized)},i.prototype.recognize=function(t,e){P(this,t,e)},i}(L),K={name:"rotate",threshold:0,pointLength:2},Q=function(t){function i(e){var i=t.call(this,n(n({},K),e))||this;return i.computeFunctions=[X],i}return e(i,t),i.prototype._$test=function(t){var e=t.pointLength,n=t.angle;return this._$isValidPointLength(e)&&(this.options.threshold<Math.abs(n)||this._$isRecognized)},i.prototype.recognize=function(t,e){P(this,t,e)},i}(L);return E.use(N),E.use(k),E.use(B),E.use(G),E.use(J),E.use(Q),E.Tap=N,E.Pan=k,E.Swipe=B,E.Press=G,E.Pinch=J,E.Rotate=Q,E.STATUS_POSSIBLE="p",E.STATUS_START=h,E.STATUS_MOVE=v,E.STATUS_END=l,E.STATUS_CANCELLED=m,E.STATUS_FAILED=d,E.STATUS_RECOGNIZED=f,E}));
{
"name": "any-touch",
"version": "1.0.9",
"version": "1.0.10",
"description": "一个小巧的手势库",

@@ -25,10 +25,10 @@ "unpkg": "dist/any-touch.umd.min.js",

"dependencies": {
"@any-touch/core": "^1.0.9",
"@any-touch/pan": "^1.0.9",
"@any-touch/pinch": "^1.0.9",
"@any-touch/press": "^1.0.9",
"@any-touch/rotate": "^1.0.9",
"@any-touch/swipe": "^1.0.9",
"@any-touch/tap": "^1.0.9",
"any-event": "^1.0.9",
"@any-touch/core": "^1.0.10",
"@any-touch/pan": "^1.0.10",
"@any-touch/pinch": "^1.0.10",
"@any-touch/press": "^1.0.10",
"@any-touch/rotate": "^1.0.10",
"@any-touch/swipe": "^1.0.10",
"@any-touch/tap": "^1.0.10",
"any-event": "^1.0.10",
"tslib": "^1.9.3"

@@ -42,3 +42,3 @@ },

"sideEffects": false,
"gitHead": "a4cb16b16c0a7c22e3769c49d73b73261e28e778"
"gitHead": "bf39da942dc851dc68139893c3d52bf2ce53b9f0"
}
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