@egjs/axes
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -0,0 +0,0 @@ import { Axis, AxisManager } from "./AxisManager"; |
@@ -0,0 +0,0 @@ import Component from "@egjs/component"; |
@@ -0,0 +0,0 @@ import { ObjectInterface } from "./types"; |
declare let win: any; | ||
export { win as window }; |
@@ -0,0 +0,0 @@ export declare const DIRECTION_NONE = 1; |
@@ -0,0 +0,0 @@ export declare const getInsidePosition: (destPos: number, range: number[], circular: boolean[], bounce?: number[]) => number; |
@@ -0,0 +0,0 @@ import { ExtendedEvent, InputEventType } from "../types"; |
@@ -0,0 +0,0 @@ import { InputEventType, ExtendedEvent } from "../types"; |
@@ -0,0 +0,0 @@ import { InputEventType, ExtendedEvent } from "../types"; |
@@ -0,0 +0,0 @@ import { InputEventType, ExtendedEvent } from "../types"; |
@@ -0,0 +0,0 @@ import { InputEventType, ExtendedEvent } from "../types"; |
@@ -0,0 +0,0 @@ import { InputType } from "./inputType/InputType"; |
@@ -0,0 +0,0 @@ import Axes from "./Axes"; |
import Axes from "./Axes"; | ||
export default Axes; |
@@ -0,0 +0,0 @@ import { InterruptManager } from "./InterruptManager"; |
@@ -0,0 +0,0 @@ import { Axis } from "../AxisManager"; |
@@ -0,0 +0,0 @@ import { InputType, InputTypeObserver } from "./InputType"; |
@@ -0,0 +0,0 @@ import { ActiveInput, InputEventType } from "../types"; |
@@ -0,0 +0,0 @@ import { InputType, InputTypeObserver } from "./InputType"; |
@@ -0,0 +0,0 @@ import { PanInput, PanInputOption } from "./PanInput"; |
@@ -0,0 +0,0 @@ import { InputType, InputTypeObserver } from "./InputType"; |
@@ -0,0 +0,0 @@ import { AxesOption } from "./Axes"; |
@@ -0,0 +0,0 @@ import { Axis } from "./AxisManager"; |
@@ -0,0 +0,0 @@ import { ObjectInterface } from "./types"; |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-axes | ||
version: 3.0.0 | ||
version: 3.0.1 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/agent"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["@egjs/agent","@egjs/component"],e):(t.eg=t.eg||{},t.eg.Axes=e(t.eg.agent,t.eg.Component))}(this,function(t,p){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function _(t,e,n,i){var r=t,s=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],r=Math.max(s[0],r);return Math.min(s[1],r)}function u(t,e){return t<e[0]||t>e[1]}function h(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function v(t,e,n){var i=t,r=e[0],s=e[1],a=s-r;return n[1]&&s<t&&(i=(i-s)%a+r),n[0]&&t<r&&(i=(i-r)%a+s),i}function r(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var a,o,d=function(){return(d=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)},c="undefined"==typeof window?{navigator:{userAgent:""}}:window,l="ontouchstart"in c&&"safari"===t().browser.name,n=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=e.length;n<i;n++)if(e[n]in t)return e[n];return""}(),g={"touch-action":"none","user-select":"none","-webkit-user-drag":"none"},f=function(t,e){var n,i;return void 0===e&&(e=!1),"string"==typeof t?(i=t.match(/^<([a-z]+)\s*([^>]*)>/)?((n=document.createElement("div")).innerHTML=t,r(n.childNodes)):r(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==c&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in c&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return f(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},m=c.requestAnimationFrame||c.webkitRequestAnimationFrame,E=c.cancelAnimationFrame||c.webkitCancelAnimationFrame;m&&!E?(a={},o=m,m=function(e){var n=o(function(t){a[n]&&e(t)});return a[n]=!0,n},E=function(t){delete a[t]}):m&&E||(m=function(t){return c.setTimeout(function(){t(c.performance&&c.performance.now&&c.performance.now()||(new Date).getTime())},16)},E=c.clearTimeout);function x(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function M(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function b(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function P(t,n){return b(t,function(t,e){return t===n[e]})}function y(t,e){return R[e]||(R[e]=F(e)),R[e](t)}function I(t,n){return t&&n?x(t,function(t,e){return y(t,"number"==typeof n?n:n[e])}):t}function T(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function O(t,e){return 180*Math.atan2(e,t)/Math.PI}function w(e,t){var n,i={};return e.style&&(n=t||g,Object.keys(n).forEach(function(t){i[t]=e.style[t],e.style[t]=n[t]})),i}function D(t,e,n){return Math.max(Math.min(t,n),e)}function A(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function C(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=j;break;case"pointer":i=K}}),i?new W:e&&n?new Q:e?new B:n?new q:null}function S(t,e,n){return n?!!(30===e||e&t&&n&t):!!(e&t)}var R={},F=function(e){var n=e<1?Math.pow(10,T(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},L=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager;this._options=e,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,i,a=this;return i=void 0!==e?e:(n=x(t,function(t,e){return n=Math.abs(t-s[e]),i=a._options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r}),Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)),D(i,this._options.minimumDuration,this._options.maximumDuration)},e.getDisplacement=function(t){var e=Math.pow(t.reduce(function(t,e){return t+e*e},0),1/t.length),n=Math.abs(e/-this._options.deceleration);return t.map(function(t){return t/2*n})},e.interpolate=function(t,e){var n=this.easing(1e-5)/1e-5;return this.easing(t/(e*n))*e},e.stopAnimation=function(t,e){var n,i,r;this._animateParam&&t.length&&(n=this.axisManager.get(t),i=this.axisManager.map(n,function(t,e){return v(t,e.range,e.circular)}),b(i,function(t,e){return n[e]===t})||this.eventManager.triggerChange(i,!1,n,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,E(r)),this._raf=null,this.eventManager.triggerAnimationEnd(!(null==e||!e.event)))},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axisManager.get(),n=this.axisManager.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.stopAnimation(Object.keys(this.axisManager.get())),this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axisManager.filter(this.axisManager.get(),function(t,e){return h(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axisManager.map(e,function(t,e){return v(t,e.range,e.circular)})),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!t),this.axisManager.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(t)},e.getUserControl=function(t){var e=t.setTo();return e.destPos=this.axisManager.get(e.destPos),e.duration=D(e.duration,this._options.minimumDuration,this._options.maximumDuration),e},e.animateTo=function(t,e,n){var i,r=this,s=this._createAnimationParam(t,e,n),a=d({},s.depaPos),o=this.eventManager.triggerAnimationStart(s),u=this.getUserControl(s);!o&&this.axisManager.every(u.destPos,function(t,e){return h(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!P(u.destPos,a)&&(i=(null==n?void 0:n.event)||null,this._animateLoop({depaPos:a,destPos:u.destPos,duration:u.duration,delta:this.axisManager.getDelta(a,u.destPos),isTrusted:!!i,inputEvent:i,input:(null==n?void 0:n.input)||null},function(){return r.animationEnd()}))},e.easing=function(t){return 1<t?1:this._options.easing(t)},e.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t);this.stopAnimation(n);var i=this.axisManager.get(n);if(P(t,i))return this;this.interruptManager.setInterrupt(!0);var r=M(t,function(t,e){return i[e]!==t});return Object.keys(r).length?(r=this.axisManager.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:_(t,n,i)}),P(r,i)||(0<e?this.animateTo(r,e):(this.eventManager.triggerChange(r),this.finish(!1))),this):this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(x(this.axisManager.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},e.updateAnimation=function(t){var e,n,i,r,s,a=this._animateParam;a&&(e=(new Date).getTime()-a.startTime,n=(null==t?void 0:t.destPos)||a.destPos,i=(null==t?void 0:t.duration)||a.duration,null!=t&&t.restart||i<=e?this.setTo(n,i-e):(null!=t&&t.destPos&&(r=this.axisManager.get(),this._initialEasingPer=this._prevEasingPer,a.delta=this.axisManager.getDelta(r,n),a.destPos=n),null!=t&&t.duration&&(s=(e+this._durationOffset)/a.duration,this._durationOffset=s*i-e,a.duration=i)))},e._createAnimationParam=function(t,e,n){var i=this.axisManager.get(),r=t,s=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:r,duration:D(e,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:s,input:(null==n?void 0:n.input)||null,isTrusted:!!s,done:this.animationEnd}},e._animateLoop=function(n,i){var h,c,r,s,l=this;n.duration?(h=n.depaPos,this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,this._animateParam=d(d({},n),{startTime:(new Date).getTime()}),c=x(h,function(t,e){return t<=n.destPos[e]?1:-1}),r=x(n.destPos,function(t){return t}),(s=function(){var a=l._animateParam,o=((new Date).getTime()-a.startTime+l._durationOffset)/a.duration,u=l.easing(o);l._raf=null;var t=l.axisManager.map(h,function(t,e,n){var i,r=1<=o?a.destPos[n]:t+a.delta[n]*(u-l._prevEasingPer)/(1-l._initialEasingPer),s=v(r,e.range,e.circular);return r!==s&&(i=c[n]*(e.range[1]-e.range[0]),a.destPos[n]-=i,h[n]-=i),s}),e=!l.eventManager.triggerChange(t,!1,h);if(h=t,1<=(l._prevEasingPer=u))return a.destPos=l._getFinalPos(a.destPos,r),P(a.destPos,l.axisManager.get(Object.keys(a.destPos)))||l.eventManager.triggerChange(a.destPos,!0,h),void i();e?l.finish(!1):l._raf=m(s)})()):(this.eventManager.triggerChange(n.destPos,!0),i())},e._getFinalPos=function(t,i){var r=this;return x(t,function(t,e){if(t>=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=r._getRoundUnit(t,e);return y(t,n)})},e._getRoundUnit=function(t,e){var n,i,r=this._options.round,s=null;return r||(n=this.axisManager.getAxisOptions(e),i=Math.max(T(n.range[0]),T(n.range[1]),T(t)),s=1/Math.pow(10,i)),s||r},t}(),k=function(){function t(t){this._axes=t}var e=t.prototype;return e.hold=function(t,e){var n=this._getRoundPos(t).roundPos;this._axes.trigger(new p.ComponentEvent("hold",{pos:n,input:e.input||null,inputEvent:e.event||null,isTrusted:!0}))},e.triggerRelease=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new p.ComponentEvent("release",d(d({},t),{bounceRatio:this._getBounceRatio(n)})))},e.triggerChange=function(t,e,n,i,r){void 0===r&&(r=!1);var s=this.animationManager,a=s.axisManager,o=s.getEventInfo(),u=this._getRoundPos(t,n),h=u.roundPos,c=u.roundDepa,l=a.moveTo(h,c),v=(null==i?void 0:i.event)||(null==o?void 0:o.event)||null,_={pos:l.pos,delta:l.delta,bounceRatio:this._getBounceRatio(l.pos),holding:r,inputEvent:v,isTrusted:!!v,input:(null==i?void 0:i.input)||(null==o?void 0:o.input)||null,set:v?this._createUserControll(l.pos):function(){}},d=this._axes.trigger(new p.ComponentEvent("change",_));return v&&a.set(_.set().destPos),d},e.triggerAnimationStart=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;return t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new p.ComponentEvent("animationStart",t))},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this._axes.trigger(new p.ComponentEvent("animationEnd",{isTrusted:t}))},e.triggerFinish=function(t){void 0===t&&(t=!1),this._axes.trigger(new p.ComponentEvent("finish",{isTrusted:t}))},e.setAnimationManager=function(t){this.animationManager=t},e.destroy=function(){this._axes.off()},e._createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:d({},t),duration:e};return function(t,e){return t&&(n.destPos=d({},t)),void 0!==e&&(n.duration=e),n}},e._getRoundPos=function(t,e){var n=this._axes.options.round;return{roundPos:I(t,n),roundDepa:I(e,n)}},e._getBounceRatio=function(t){return this._axes.axisManager.map(t,function(t,e){return t<e.range[0]&&0!==e.bounce[0]?(e.range[0]-t)/e.bounce[0]:t>e.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),Y=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),X=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return x(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):d(d({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=x(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?v(t,e.range,e.circular):0})),{pos:d({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return b(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return M(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return x(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!u(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var r=this;Object.keys(this._axis).forEach(function(i){r._axis[i]=d({range:[0,100],bounce:[0,0],circular:[!1,!1]},r._axis[i]),["bounce","circular"].forEach(function(t){var e=r._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),j="ontouchstart"in c,N="PointerEvent"in c,e="MSPointerEvent"in c,K=N||e,U=function(){function t(){}var e=t.prototype;return e.extendEvent=function(t){var e=this.prevEvent,n=this._getCenter(t),i=e?this._getMovement(t):{x:0,y:0},r=e?this._getScale(t):1,s=e?O(n.x-e.center.x,n.y-e.center.y):0,a=e?e.deltaX+i.x:i.x,o=e?e.deltaY+i.y:i.y,u=e?a-e.deltaX:0,h=e?o-e.deltaY:0,c=e?t.timeStamp-e.srcEvent.timeStamp:0;return{srcEvent:t,scale:r,angle:s,center:n,deltaX:a,deltaY:o,offsetX:u,offsetY:h,velocityX:e&&0!=c?u/c:0,velocityY:e&&0!=c?h/c:0,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},t}(),q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(){return 0},n._getScale=function(){return 1},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},t}(U),B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._firstTouch=t,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(t){return t.touches.length},n._getScale=function(t){return 2!==t.touches.length?null:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._firstTouch.touches[0],this._firstTouch.touches[1])},n._getCenter=function(t){return{x:t.touches[0].clientX,y:t.touches[0].clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.touches[0].identifier!==e.touches[0].identifier?{x:0,y:0}:{x:t.touches[0].pageX-e.touches[0].pageX,y:t.touches[0].pageY-e.touches[0].pageY}},t}(U),W=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=N?["pointerdown"]:["MSPointerDown"],t.move=N?["pointermove"]:["MSPointerMove"],t.end=N?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._updatePointerEvent(t),this.extendEvent(t)},n.onEventMove=function(t){return this._updatePointerEvent(t),this.extendEvent(t)},n.onEventEnd=function(t){this._removePointerEvent(t)},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.pointerId!==e.pointerId?{x:0,y:0}:{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},n._updatePointerEvent=function(n){var i=this,r=!1;this._recentInputs.forEach(function(t,e){t.pointerId===n.pointerId&&(r=!0,i._recentInputs[e]=n)}),r||(this._firstInputs.push(n),this._recentInputs.push(n))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(U),Q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._firstTouch=t.hasOwnProperty("touches")?t:null,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(t){return this._isTouchEvent(t)?t.touches.length:0},n._getScale=function(t){return!this._firstTouch||this._isTouchEvent(t)&&2!==t.touches.length?1:this._isTouchEvent(t)?this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._firstTouch.touches[0],this._firstTouch.touches[1]):this.prevEvent.scale},n._getCenter=function(t){return this._isTouchEvent(t)?{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}},n._getMovement=function(e){var n=this,t=this.prevEvent.srcEvent,i=[e,t].map(function(t){return n._isTouchEvent(e)?{id:t.touches[0].identifier,x:t.touches[0].pageX,y:t.touches[0].pageY}:{id:null,x:t.pageX,y:t.pageY}}),r=i[0],s=i[1];return r.id===s.id?{x:r.x-s.x,y:r.y-s.y}:{x:0,y:0}},n._isTouchEvent=function(t){return t.hasOwnProperty("touches")},t}(U),V=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager,s=t.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=e,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=s}var e=t.prototype;return e.get=function(t){return this._axisManager.get(t.axes)},e.hold=function(t,e){var n;!this._interruptManager.isInterrupted()&&t.axes.length&&(n={input:t,event:e},this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(t.axes,n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(t.axes),this._moveDistance=this._axisManager.get(t.axes))},e.change=function(t,e,n,i){var r,s,a,o;this._isStopped||!this._interruptManager.isInterrupting()||this._axisManager.every(n,function(t){return 0===t})||(r=this._moveDistance||this._axisManager.get(t.axes),s=x(r,function(t,e){return t+(n[e]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(s,function(t,e){var n=e.circular,i=e.range;return n&&(n[0]||n[1])?v(t,i,n):t})),this._isOutside&&this._axisManager.every(r,function(t,e){return!u(t,e.range)})&&(this._isOutside=!1),r=this._atOutside(r),s=this._atOutside(s),a={input:t,event:e},i?(o=this._animationManager.getDuration(s,r),this._animationManager.stopAnimation(t.axes,a),this._animationManager.animateTo(s,o,a)):this._eventManager.triggerChange(s,!1,r,a,!0)||(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1)))},e.release=function(t,e,n,i){var r,s,a,o,u,h,c,l,v;!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance&&(r=this._axisManager.get(t.axes),s=this._axisManager.get(),a=this._animationManager.getDisplacement(n),o=A(t.axes,a),h={depaPos:s,destPos:u=this._axisManager.get(this._axisManager.map(o,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?r[n]+t:_(r[n]+t,e.range,e.circular,e.bounce)})),duration:this._animationManager.getDuration(u,r,i),delta:this._axisManager.getDelta(s,u),inputEvent:e,input:t,isTrusted:!0},this._eventManager.triggerRelease(h),this._moveDistance=null,c=this._animationManager.getUserControl(h),v={input:t,event:e},(l=P(c.destPos,s))||0===c.duration?(l||this._eventManager.triggerChange(c.destPos,!1,s,v,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(v):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(c.destPos,c.duration,v))},e._atOutside=function(t){var a=this;return this._isOutside?this._axisManager.map(t,function(t,e){var n=e.range[0]-e.bounce[0],i=e.range[1]+e.bounce[1];return i<t?i:t<n?n:t}):this._axisManager.map(t,function(t,e){var n=e.range[0],i=e.range[1],r=e.bounce,s=e.circular;return s&&(s[0]||s[1])?t:t<n?n-a._animationManager.interpolate(n-t,r[0]):i<t?i+a._animationManager.interpolate(t-i,r[1]):t})},t}(),z=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=d({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null},e),i.interruptManager=new Y(i.options),i.axisManager=new X(i.axis),i.eventManager=new k(i),i.animationManager=new L(i),i.inputObserver=new V(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}s(t,r);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(Object.keys(this.axisManager.get())),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.0.0",t.TRANSFORM=n,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=24,t.DIRECTION_ALL=30,t}(p),H=function(){function t(t,e){this.axes=[],this.element=null,this._panFlag=!1,this._enabled=!1,this._activeInput=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this.element=f(t),this.options=d({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?24:1,this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=w(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==g&&w(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n;this._activeInput.onEventStart(t),!this._enabled||1<this._activeInput.getTouches(t)||(e=this._activeInput.extendEvent(t),(this._panFlag=!1)!==e.srcEvent.cancelable&&(n=this.options.iOSEdgeSwipeThreshold,this._observer.hold(this,e),this._atRightEdge=l&&e.center.x>window.innerWidth-n,this._panFlag=!0,this._activeInput.prevEvent=e))},e._onPanmove=function(t){var e=this;if(this._activeInput.onEventMove(t),this._panFlag&&this._enabled&&!(1<this._activeInput.getTouches(t))){var n=this._activeInput.extendEvent(t),i=this.options,r=i.iOSEdgeSwipeThreshold,s=i.releaseOnScroll,a=function(t,e){if(e<0||90<e)return 1;var n=Math.abs(t);return e<n&&n<180-e?24:6}(n.angle,this.options.thresholdAngle);if(!s||n.srcEvent.cancelable){if(this._activeInput.prevEvent&&l){if(n.center.x<0)return void this._observer.release(this,this._activeInput.prevEvent,[0,0]);this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),n.deltaX<-r?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout(function(){e._observer.release(e,e._activeInput.prevEvent,[0,0])},100))}var o=this._getOffset([n.offsetX,n.offsetY],[S(6,this._direction,a),S(24,this._direction,a)]),u=o.some(function(t){return 0!==t});u&&(!1!==n.srcEvent.cancelable&&n.srcEvent.preventDefault(),n.srcEvent.stopPropagation()),(n.preventSystemEvent=u)&&this._observer.change(this,n,A(this.axes,o)),this._activeInput.prevEvent=n}else this._onPanend(t)}},e._onPanend=function(t){var e,n;this._activeInput.onEventEnd(t),this._panFlag&&this._enabled&&0===this._activeInput.getTouches(t)&&(this._panFlag=!1,clearTimeout(this._rightEdgeTimer),e=this._activeInput.prevEvent,n=this._getOffset([Math.abs(e.velocityX)*(e.offsetX<0?-1:1),Math.abs(e.velocityY)*(e.offsetY<0?-1:1)],[S(6,this._direction),S(24,this._direction)]),this._observer.release(this,e,n))},e._attachEvent=function(t){var e=this,n=C(this.options.inputType);this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPanstart,!1)}),null!=n&&n.move.forEach(function(t){window.addEventListener(t,e._onPanmove,!1)}),null!=n&&n.end.forEach(function(t){window.addEventListener(t,e._onPanend,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPanstart,!1)}),null!=t&&t.move.forEach(function(t){window.removeEventListener(t,e._onPanmove,!1)}),null!=t&&t.end.forEach(function(t){window.removeEventListener(t,e._onPanend,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){var n=[0,0],i=this.options.scale;return e[0]&&(n[0]=t[0]*i[0]),e[1]&&(n[1]=t[1]*i[1]),n},t}(),G=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n._prevQuadrant=null,n._lastDiff=0,n}s(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=z.DIRECTION_ALL,this.axes=t},e._onPanstart=function(t){var e,n;this._activeInput.onEventStart(t),this.isEnabled&&(e=this.element.getBoundingClientRect(),n=this._activeInput.extendEvent(t),this._observer.hold(this,n),this._panFlag=!0,this._coefficientForDistanceToAngle=360/(e.width*Math.PI),this._rotateOrigin=[e.left+(e.width-1)/2,e.top+(e.height-1)/2],this._prevAngle=null,this._triggerChange(n),this._activeInput.prevEvent=n)},e._onPanmove=function(t){var e;this._activeInput.onEventMove(t),this._panFlag&&this.isEnabled&&(!1!==(e=this._activeInput.extendEvent(t)).srcEvent.cancelable&&e.srcEvent.preventDefault(),e.srcEvent.stopPropagation(),this._triggerChange(e),this._activeInput.prevEvent=e)},e._onPanend=function(t){var e,n,i,r;this._activeInput.onEventEnd(t),this._panFlag&&this.isEnabled&&(e=this._activeInput.prevEvent,this._triggerChange(e),n=e.velocityX,i=e.velocityY,r=Math.sqrt(n*n+i*i)*(0<this._lastDiff?-1:1),this._observer.release(this,e,[r*this._coefficientForDistanceToAngle]),this._panFlag=!1)},e._triggerChange=function(t){var e=this._getPosFromOrigin(t.center.x,t.center.y),n=e.x,i=e.y,r=O(n,i),s=r<0?360+r:r,a=this._getQuadrant(t.center.x,t.center.y),o=this._getDifference(this._prevAngle,s,this._prevQuadrant,a);this._prevAngle=s,this._prevQuadrant=a,0!==o&&(this._lastDiff=o,this._observer.change(this,t,A(this.axes,[-o])))},e._getDifference=function(t,e,n,i){var r=null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t;return r},e._getPosFromOrigin=function(t,e){return{x:t-this._rotateOrigin[0],y:this._rotateOrigin[1]-e}},e._getQuadrant=function(t,e){var n=this._getPosFromOrigin(t,e),i=n.x,r=n.y,s=0;return 0<=i&&0<=r?s=1:i<0&&0<=r?s=2:i<0&&r<0?s=3:0<=i&&r<0&&(s=4),s},t}(H),Z=function(){function t(t,e){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeInput=null,this.element=f(t),this.options=d({scale:1,threshold:0,inputType:["touch","pointer"]},e),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=w(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==g&&w(this.element,this._originalCssProps),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPinchStart=function(t){var e;this._activeInput.onEventStart(t),this._enabled&&2===this._activeInput.getTouches(t)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,t),this._pinchFlag=!0,e=this._activeInput.extendEvent(t),this._activeInput.prevEvent=e)},e._onPinchMove=function(t){var e,n;this._activeInput.onEventMove(t),this._pinchFlag&&this._enabled&&2===this._activeInput.getTouches(t)&&(e=this._activeInput.extendEvent(t),n=this._getOffset(e.scale,this._activeInput.prevEvent.scale),this._observer.change(this,t,A(this.axes,[n])),this._activeInput.prevEvent=e)},e._onPinchEnd=function(t){this._activeInput.onEventEnd(t),!this._pinchFlag||!this._enabled||2<this._activeInput.getTouches(t)||(this._observer.release(this,t,[0],0),this._baseValue=null,this._pinchFlag=!1,this._activeInput.prevEvent=null)},e._attachEvent=function(t){var e=this,n=C(this.options.inputType);this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPinchStart,!1)}),null!=n&&n.move.forEach(function(t){e.element.addEventListener(t,e._onPinchMove,!1)}),null!=n&&n.end.forEach(function(t){e.element.addEventListener(t,e._onPinchEnd,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPinchStart,!1)}),null!=t&&t.move.forEach(function(t){e.element.removeEventListener(t,e._onPinchMove,!1)}),null!=t&&t.end.forEach(function(t){e.element.removeEventListener(t,e._onPinchEnd,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){return void 0===e&&(e=1),this._baseValue*(t-e)*this.options.scale},t}(),J=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=f(t),this.options=d({scale:1,releaseDelay:300,useNormalized:!0},e),this._onWheel=this._onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onWheel=function(t){var e,n=this;this._enabled&&(t.preventDefault(),0!==t.deltaY&&(this._holding||(this._observer.hold(this,t),this._holding=!0),e=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY)),this._observer.change(this,t,A(this.axes,[e]),!0),clearTimeout(this._timer),this._timer=setTimeout(function(){n._holding&&(n._holding=!1,n._observer.release(n,t,[0]))},this.options.releaseDelay)))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("wheel",this._onWheel),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},t}(),$=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=f(t),this.options=d({scale:[1,1]},e),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onKeydown=function(t){if(this._enabled){var e,n=!0,i=1,r=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,r=1;break;case 38:case 87:r=1;break;default:n=!1}(-1===r&&!this.axes[0]||1===r&&!this.axes[1])&&(n=!1),n&&(t.preventDefault(),e=-1===r?[this.options.scale[0]*i,0]:[0,this.options.scale[1]*i],this._holding||(this._observer.hold(this,t),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,t,A(this.axes,e)))}},e._onKeyup=function(t){var e=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e._observer.release(e,t,[0,0]),e._holding=!1},80))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("keydown",this._onKeydown,!1),this.element.addEventListener("keypress",this._onKeydown,!1),this.element.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("keydown",this._onKeydown,!1),this.element.removeEventListener("keypress",this._onKeydown,!1),this.element.removeEventListener("keyup",this._onKeyup,!1),this._enabled=!1,this._observer=null},t}();return z.PanInput=H,z.RotatePanInput=G,z.PinchInput=Z,z.WheelInput=J,z.MoveKeyInput=$,z}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/agent"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["@egjs/agent","@egjs/component"],e):(t.eg=t.eg||{},t.eg.Axes=e(t.eg.agent,t.eg.Component))}(this,function(t,p){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function _(t,e,n,i){var r=t,s=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],r=Math.max(s[0],r);return Math.min(s[1],r)}function u(t,e){return t<e[0]||t>e[1]}function h(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function v(t,e,n){var i=t,r=e[0],s=e[1],a=s-r;return n[1]&&s<t&&(i=(i-s)%a+r),n[0]&&t<r&&(i=(i-r)%a+s),i}function r(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var a,o,d=function(){return(d=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)},c="undefined"==typeof window?{navigator:{userAgent:""}}:window,l="ontouchstart"in c&&"safari"===t().browser.name,n=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=e.length;n<i;n++)if(e[n]in t)return e[n];return""}(),g={"touch-action":"none","user-select":"none","-webkit-user-drag":"none"},f=function(t,e){var n,i;return void 0===e&&(e=!1),"string"==typeof t?(i=t.match(/^<([a-z]+)\s*([^>]*)>/)?((n=document.createElement("div")).innerHTML=t,r(n.childNodes)):r(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==c&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in c&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return f(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},m=c.requestAnimationFrame||c.webkitRequestAnimationFrame,E=c.cancelAnimationFrame||c.webkitCancelAnimationFrame;m&&!E?(a={},o=m,m=function(e){var n=o(function(t){a[n]&&e(t)});return a[n]=!0,n},E=function(t){delete a[t]}):m&&E||(m=function(t){return c.setTimeout(function(){t(c.performance&&c.performance.now&&c.performance.now()||(new Date).getTime())},16)},E=c.clearTimeout);function x(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function M(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function b(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function P(t,n){return b(t,function(t,e){return t===n[e]})}function y(t,e){return R[e]||(R[e]=F(e)),R[e](t)}function I(t,n){return t&&n?x(t,function(t,e){return y(t,"number"==typeof n?n:n[e])}):t}function T(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function O(t,e){return 180*Math.atan2(e,t)/Math.PI}function w(e,t){var n,i={};return e.style&&(n=t||g,Object.keys(n).forEach(function(t){i[t]=e.style[t],e.style[t]=n[t]})),i}function D(t,e,n){return Math.max(Math.min(t,n),e)}function A(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function C(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=j;break;case"pointer":i=K}}),i?new W:e&&n?new Q:e?new B:n?new q:null}function S(t,e,n){return n?!!(30===e||e&t&&n&t):!!(e&t)}var R={},F=function(e){var n=e<1?Math.pow(10,T(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},L=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager;this._options=e,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,i,a=this;return i=void 0!==e?e:(n=x(t,function(t,e){return n=Math.abs(t-s[e]),i=a._options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r}),Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)),D(i,this._options.minimumDuration,this._options.maximumDuration)},e.getDisplacement=function(t){var e=Math.pow(t.reduce(function(t,e){return t+e*e},0),1/t.length),n=Math.abs(e/-this._options.deceleration);return t.map(function(t){return t/2*n})},e.interpolate=function(t,e){var n=this.easing(1e-5)/1e-5;return this.easing(t/(e*n))*e},e.stopAnimation=function(t,e){var n,i,r;this._animateParam&&t.length&&(n=this.axisManager.get(t),i=this.axisManager.map(n,function(t,e){return v(t,e.range,e.circular)}),b(i,function(t,e){return n[e]===t})||this.eventManager.triggerChange(i,!1,n,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,E(r)),this._raf=null,this.eventManager.triggerAnimationEnd(!(null==e||!e.event)))},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axisManager.get(),n=this.axisManager.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.stopAnimation(Object.keys(this.axisManager.get())),this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axisManager.filter(this.axisManager.get(),function(t,e){return h(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axisManager.map(e,function(t,e){return v(t,e.range,e.circular)})),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!t),this.axisManager.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(t)},e.getUserControl=function(t){var e=t.setTo();return e.destPos=this.axisManager.get(e.destPos),e.duration=D(e.duration,this._options.minimumDuration,this._options.maximumDuration),e},e.animateTo=function(t,e,n){var i,r=this,s=this._createAnimationParam(t,e,n),a=d({},s.depaPos),o=this.eventManager.triggerAnimationStart(s),u=this.getUserControl(s);!o&&this.axisManager.every(u.destPos,function(t,e){return h(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!P(u.destPos,a)&&(i=(null==n?void 0:n.event)||null,this._animateLoop({depaPos:a,destPos:u.destPos,duration:u.duration,delta:this.axisManager.getDelta(a,u.destPos),isTrusted:!!i,inputEvent:i,input:(null==n?void 0:n.input)||null},function(){return r.animationEnd()}))},e.easing=function(t){return 1<t?1:this._options.easing(t)},e.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t);this.stopAnimation(n);var i=this.axisManager.get(n);if(P(t,i))return this;this.interruptManager.setInterrupt(!0);var r=M(t,function(t,e){return i[e]!==t});return Object.keys(r).length?(r=this.axisManager.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:_(t,n,i)}),P(r,i)||(0<e?this.animateTo(r,e):(this.eventManager.triggerChange(r),this.finish(!1))),this):this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(x(this.axisManager.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},e.updateAnimation=function(t){var e,n,i,r,s,a=this._animateParam;a&&(e=(new Date).getTime()-a.startTime,n=(null==t?void 0:t.destPos)||a.destPos,i=(null==t?void 0:t.duration)||a.duration,null!=t&&t.restart||i<=e?this.setTo(n,i-e):(null!=t&&t.destPos&&(r=this.axisManager.get(),this._initialEasingPer=this._prevEasingPer,a.delta=this.axisManager.getDelta(r,n),a.destPos=n),null!=t&&t.duration&&(s=(e+this._durationOffset)/a.duration,this._durationOffset=s*i-e,a.duration=i)))},e._createAnimationParam=function(t,e,n){var i=this.axisManager.get(),r=t,s=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:r,duration:D(e,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:s,input:(null==n?void 0:n.input)||null,isTrusted:!!s,done:this.animationEnd}},e._animateLoop=function(n,i){var h,c,r,s,l=this;n.duration?(h=n.depaPos,this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,this._animateParam=d(d({},n),{startTime:(new Date).getTime()}),c=x(h,function(t,e){return t<=n.destPos[e]?1:-1}),r=x(n.destPos,function(t){return t}),(s=function(){var a=l._animateParam,o=((new Date).getTime()-a.startTime+l._durationOffset)/a.duration,u=l.easing(o);l._raf=null;var t=l.axisManager.map(h,function(t,e,n){var i,r=1<=o?a.destPos[n]:t+a.delta[n]*(u-l._prevEasingPer)/(1-l._initialEasingPer),s=v(r,e.range,e.circular);return r!==s&&(i=c[n]*(e.range[1]-e.range[0]),a.destPos[n]-=i,h[n]-=i),s}),e=!l.eventManager.triggerChange(t,!1,h);if(h=t,1<=(l._prevEasingPer=u))return a.destPos=l._getFinalPos(a.destPos,r),P(a.destPos,l.axisManager.get(Object.keys(a.destPos)))||l.eventManager.triggerChange(a.destPos,!0,h),void i();e?l.finish(!1):l._raf=m(s)})()):(this.eventManager.triggerChange(n.destPos,!0),i())},e._getFinalPos=function(t,i){var r=this;return x(t,function(t,e){if(t>=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=r._getRoundUnit(t,e);return y(t,n)})},e._getRoundUnit=function(t,e){var n,i,r=this._options.round,s=null;return r||(n=this.axisManager.getAxisOptions(e),i=Math.max(T(n.range[0]),T(n.range[1]),T(t)),s=1/Math.pow(10,i)),s||r},t}(),k=function(){function t(t){this._axes=t}var e=t.prototype;return e.hold=function(t,e){var n=this._getRoundPos(t).roundPos;this._axes.trigger(new p.ComponentEvent("hold",{pos:n,input:e.input||null,inputEvent:e.event||null,isTrusted:!0}))},e.triggerRelease=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new p.ComponentEvent("release",d(d({},t),{bounceRatio:this._getBounceRatio(n)})))},e.triggerChange=function(t,e,n,i,r){void 0===r&&(r=!1);var s=this.animationManager,a=s.axisManager,o=s.getEventInfo(),u=this._getRoundPos(t,n),h=u.roundPos,c=u.roundDepa,l=a.moveTo(h,c),v=(null==i?void 0:i.event)||(null==o?void 0:o.event)||null,_={pos:l.pos,delta:l.delta,bounceRatio:this._getBounceRatio(l.pos),holding:r,inputEvent:v,isTrusted:!!v,input:(null==i?void 0:i.input)||(null==o?void 0:o.input)||null,set:v?this._createUserControll(l.pos):function(){}},d=this._axes.trigger(new p.ComponentEvent("change",_));return v&&a.set(_.set().destPos),d},e.triggerAnimationStart=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;return t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new p.ComponentEvent("animationStart",t))},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this._axes.trigger(new p.ComponentEvent("animationEnd",{isTrusted:t}))},e.triggerFinish=function(t){void 0===t&&(t=!1),this._axes.trigger(new p.ComponentEvent("finish",{isTrusted:t}))},e.setAnimationManager=function(t){this.animationManager=t},e.destroy=function(){this._axes.off()},e._createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:d({},t),duration:e};return function(t,e){return t&&(n.destPos=d({},t)),void 0!==e&&(n.duration=e),n}},e._getRoundPos=function(t,e){var n=this._axes.options.round;return{roundPos:I(t,n),roundDepa:I(e,n)}},e._getBounceRatio=function(t){return this._axes.axisManager.map(t,function(t,e){return t<e.range[0]&&0!==e.bounce[0]?(e.range[0]-t)/e.bounce[0]:t>e.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),Y=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),X=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return x(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):d(d({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=x(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?v(t,e.range,e.circular):0})),{pos:d({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return b(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return M(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return x(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!u(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var r=this;Object.keys(this._axis).forEach(function(i){r._axis[i]=d({range:[0,100],bounce:[0,0],circular:[!1,!1]},r._axis[i]),["bounce","circular"].forEach(function(t){var e=r._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),j="ontouchstart"in c,N="PointerEvent"in c,e="MSPointerEvent"in c,K=N||e,U=function(){function t(){}var e=t.prototype;return e.extendEvent=function(t){var e=this.prevEvent,n=this._getCenter(t),i=e?this._getMovement(t):{x:0,y:0},r=e?this._getScale(t):1,s=e?O(n.x-e.center.x,n.y-e.center.y):0,a=e?e.deltaX+i.x:i.x,o=e?e.deltaY+i.y:i.y,u=e?a-e.deltaX:0,h=e?o-e.deltaY:0,c=e?t.timeStamp-e.srcEvent.timeStamp:0;return{srcEvent:t,scale:r,angle:s,center:n,deltaX:a,deltaY:o,offsetX:u,offsetY:h,velocityX:e&&0!=c?u/c:0,velocityY:e&&0!=c?h/c:0,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},t}(),q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(){return 0},n._getScale=function(){return 1},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},t}(U),B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._firstTouch=t,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(t){return t.touches.length},n._getScale=function(t){return 2!==t.touches.length?null:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._firstTouch.touches[0],this._firstTouch.touches[1])},n._getCenter=function(t){return{x:t.touches[0].clientX,y:t.touches[0].clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.touches[0].identifier!==e.touches[0].identifier?{x:0,y:0}:{x:t.touches[0].pageX-e.touches[0].pageX,y:t.touches[0].pageY-e.touches[0].pageY}},t}(U),W=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=N?["pointerdown"]:["MSPointerDown"],t.move=N?["pointermove"]:["MSPointerMove"],t.end=N?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._updatePointerEvent(t),this.extendEvent(t)},n.onEventMove=function(t){return this._updatePointerEvent(t),this.extendEvent(t)},n.onEventEnd=function(t){this._removePointerEvent(t)},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.pointerId!==e.pointerId?{x:0,y:0}:{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},n._updatePointerEvent=function(n){var i=this,r=!1;this._recentInputs.forEach(function(t,e){t.pointerId===n.pointerId&&(r=!0,i._recentInputs[e]=n)}),r||(this._firstInputs.push(n),this._recentInputs.push(n))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(U),Q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._firstTouch=t.hasOwnProperty("touches")?t:null,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(t){return this._isTouchEvent(t)?t.touches.length:0},n._getScale=function(t){return!this._firstTouch||this._isTouchEvent(t)&&2!==t.touches.length?1:this._isTouchEvent(t)?this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._firstTouch.touches[0],this._firstTouch.touches[1]):this.prevEvent.scale},n._getCenter=function(t){return this._isTouchEvent(t)?{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}},n._getMovement=function(e){var n=this,t=this.prevEvent.srcEvent,i=[e,t].map(function(t){return n._isTouchEvent(e)?{id:t.touches[0].identifier,x:t.touches[0].pageX,y:t.touches[0].pageY}:{id:null,x:t.pageX,y:t.pageY}}),r=i[0],s=i[1];return r.id===s.id?{x:r.x-s.x,y:r.y-s.y}:{x:0,y:0}},n._isTouchEvent=function(t){return t.hasOwnProperty("touches")},t}(U),V=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager,s=t.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=e,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=s}var e=t.prototype;return e.get=function(t){return this._axisManager.get(t.axes)},e.hold=function(t,e){var n;!this._interruptManager.isInterrupted()&&t.axes.length&&(n={input:t,event:e},this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(t.axes,n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(t.axes),this._moveDistance=this._axisManager.get(t.axes))},e.change=function(t,e,n,i){var r,s,a,o;this._isStopped||!this._interruptManager.isInterrupting()||this._axisManager.every(n,function(t){return 0===t})||(r=this._moveDistance||this._axisManager.get(t.axes),s=x(r,function(t,e){return t+(n[e]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(s,function(t,e){var n=e.circular,i=e.range;return n&&(n[0]||n[1])?v(t,i,n):t})),this._isOutside&&this._axisManager.every(r,function(t,e){return!u(t,e.range)})&&(this._isOutside=!1),r=this._atOutside(r),s=this._atOutside(s),a={input:t,event:e},i?(o=this._animationManager.getDuration(s,r),this._animationManager.stopAnimation(t.axes,a),this._animationManager.animateTo(s,o,a)):this._eventManager.triggerChange(s,!1,r,a,!0)||(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1)))},e.release=function(t,e,n,i){var r,s,a,o,u,h,c,l,v;!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance&&(r=this._axisManager.get(t.axes),s=this._axisManager.get(),a=this._animationManager.getDisplacement(n),o=A(t.axes,a),h={depaPos:s,destPos:u=this._axisManager.get(this._axisManager.map(o,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?r[n]+t:_(r[n]+t,e.range,e.circular,e.bounce)})),duration:this._animationManager.getDuration(u,r,i),delta:this._axisManager.getDelta(s,u),inputEvent:e,input:t,isTrusted:!0},this._eventManager.triggerRelease(h),this._moveDistance=null,c=this._animationManager.getUserControl(h),v={input:t,event:e},(l=P(c.destPos,s))||0===c.duration?(l||this._eventManager.triggerChange(c.destPos,!1,s,v,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(v):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(c.destPos,c.duration,v))},e._atOutside=function(t){var a=this;return this._isOutside?this._axisManager.map(t,function(t,e){var n=e.range[0]-e.bounce[0],i=e.range[1]+e.bounce[1];return i<t?i:t<n?n:t}):this._axisManager.map(t,function(t,e){var n=e.range[0],i=e.range[1],r=e.bounce,s=e.circular;return s&&(s[0]||s[1])?t:t<n?n-a._animationManager.interpolate(n-t,r[0]):i<t?i+a._animationManager.interpolate(t-i,r[1]):t})},t}(),z=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=d({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null},e),i.interruptManager=new Y(i.options),i.axisManager=new X(i.axis),i.eventManager=new k(i),i.animationManager=new L(i),i.inputObserver=new V(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}s(t,r);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(Object.keys(this.axisManager.get())),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.0.1",t.TRANSFORM=n,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=24,t.DIRECTION_ALL=30,t}(p),H=function(){function t(t,e){this.axes=[],this.element=null,this._panFlag=!1,this._enabled=!1,this._activeInput=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this.element=f(t),this.options=d({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?24:1,this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=w(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==g&&w(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n;this._activeInput.onEventStart(t),!this._enabled||1<this._activeInput.getTouches(t)||(e=this._activeInput.extendEvent(t),(this._panFlag=!1)!==e.srcEvent.cancelable&&(n=this.options.iOSEdgeSwipeThreshold,this._observer.hold(this,e),this._atRightEdge=l&&e.center.x>window.innerWidth-n,this._panFlag=!0,this._activeInput.prevEvent=e))},e._onPanmove=function(t){var e=this;if(this._activeInput.onEventMove(t),this._panFlag&&this._enabled&&!(1<this._activeInput.getTouches(t))){var n=this._activeInput.extendEvent(t),i=this.options,r=i.iOSEdgeSwipeThreshold,s=i.releaseOnScroll,a=function(t,e){if(e<0||90<e)return 1;var n=Math.abs(t);return e<n&&n<180-e?24:6}(n.angle,this.options.thresholdAngle);if(!s||n.srcEvent.cancelable){if(this._activeInput.prevEvent&&l){if(n.center.x<0)return void this._observer.release(this,this._activeInput.prevEvent,[0,0]);this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),n.deltaX<-r?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout(function(){e._observer.release(e,e._activeInput.prevEvent,[0,0])},100))}var o=this._getOffset([n.offsetX,n.offsetY],[S(6,this._direction,a),S(24,this._direction,a)]),u=o.some(function(t){return 0!==t});u&&(!1!==n.srcEvent.cancelable&&n.srcEvent.preventDefault(),n.srcEvent.stopPropagation()),(n.preventSystemEvent=u)&&this._observer.change(this,n,A(this.axes,o)),this._activeInput.prevEvent=n}else this._onPanend(t)}},e._onPanend=function(t){var e,n;this._activeInput.onEventEnd(t),this._panFlag&&this._enabled&&0===this._activeInput.getTouches(t)&&(this._panFlag=!1,clearTimeout(this._rightEdgeTimer),e=this._activeInput.prevEvent,n=this._getOffset([Math.abs(e.velocityX)*(e.offsetX<0?-1:1),Math.abs(e.velocityY)*(e.offsetY<0?-1:1)],[S(6,this._direction),S(24,this._direction)]),this._observer.release(this,e,n))},e._attachEvent=function(t){var e=this,n=C(this.options.inputType);this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPanstart,!1)}),null!=n&&n.move.forEach(function(t){window.addEventListener(t,e._onPanmove,!1)}),null!=n&&n.end.forEach(function(t){window.addEventListener(t,e._onPanend,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPanstart,!1)}),null!=t&&t.move.forEach(function(t){window.removeEventListener(t,e._onPanmove,!1)}),null!=t&&t.end.forEach(function(t){window.removeEventListener(t,e._onPanend,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){var n=[0,0],i=this.options.scale;return e[0]&&(n[0]=t[0]*i[0]),e[1]&&(n[1]=t[1]*i[1]),n},t}(),G=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n._prevQuadrant=null,n._lastDiff=0,n}s(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=z.DIRECTION_ALL,this.axes=t},e._onPanstart=function(t){var e,n;this._activeInput.onEventStart(t),this.isEnabled&&(e=this.element.getBoundingClientRect(),n=this._activeInput.extendEvent(t),this._observer.hold(this,n),this._panFlag=!0,this._coefficientForDistanceToAngle=360/(e.width*Math.PI),this._rotateOrigin=[e.left+(e.width-1)/2,e.top+(e.height-1)/2],this._prevAngle=null,this._triggerChange(n),this._activeInput.prevEvent=n)},e._onPanmove=function(t){var e;this._activeInput.onEventMove(t),this._panFlag&&this.isEnabled&&(!1!==(e=this._activeInput.extendEvent(t)).srcEvent.cancelable&&e.srcEvent.preventDefault(),e.srcEvent.stopPropagation(),this._triggerChange(e),this._activeInput.prevEvent=e)},e._onPanend=function(t){var e,n,i,r;this._activeInput.onEventEnd(t),this._panFlag&&this.isEnabled&&(e=this._activeInput.prevEvent,this._triggerChange(e),n=e.velocityX,i=e.velocityY,r=Math.sqrt(n*n+i*i)*(0<this._lastDiff?-1:1),this._observer.release(this,e,[r*this._coefficientForDistanceToAngle]),this._panFlag=!1)},e._triggerChange=function(t){var e=this._getPosFromOrigin(t.center.x,t.center.y),n=e.x,i=e.y,r=O(n,i),s=r<0?360+r:r,a=this._getQuadrant(t.center.x,t.center.y),o=this._getDifference(this._prevAngle,s,this._prevQuadrant,a);this._prevAngle=s,this._prevQuadrant=a,0!==o&&(this._lastDiff=o,this._observer.change(this,t,A(this.axes,[-o])))},e._getDifference=function(t,e,n,i){var r=null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t;return r},e._getPosFromOrigin=function(t,e){return{x:t-this._rotateOrigin[0],y:this._rotateOrigin[1]-e}},e._getQuadrant=function(t,e){var n=this._getPosFromOrigin(t,e),i=n.x,r=n.y,s=0;return 0<=i&&0<=r?s=1:i<0&&0<=r?s=2:i<0&&r<0?s=3:0<=i&&r<0&&(s=4),s},t}(H),Z=function(){function t(t,e){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeInput=null,this.element=f(t),this.options=d({scale:1,threshold:0,inputType:["touch","pointer"]},e),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=w(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==g&&w(this.element,this._originalCssProps),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPinchStart=function(t){var e;this._activeInput.onEventStart(t),this._enabled&&2===this._activeInput.getTouches(t)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,t),this._pinchFlag=!0,e=this._activeInput.extendEvent(t),this._activeInput.prevEvent=e)},e._onPinchMove=function(t){var e,n;this._activeInput.onEventMove(t),this._pinchFlag&&this._enabled&&2===this._activeInput.getTouches(t)&&(e=this._activeInput.extendEvent(t),n=this._getOffset(e.scale,this._activeInput.prevEvent.scale),this._observer.change(this,t,A(this.axes,[n])),this._activeInput.prevEvent=e)},e._onPinchEnd=function(t){this._activeInput.onEventEnd(t),!this._pinchFlag||!this._enabled||2<this._activeInput.getTouches(t)||(this._observer.release(this,t,[0],0),this._baseValue=null,this._pinchFlag=!1,this._activeInput.prevEvent=null)},e._attachEvent=function(t){var e=this,n=C(this.options.inputType);this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPinchStart,!1)}),null!=n&&n.move.forEach(function(t){e.element.addEventListener(t,e._onPinchMove,!1)}),null!=n&&n.end.forEach(function(t){e.element.addEventListener(t,e._onPinchEnd,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPinchStart,!1)}),null!=t&&t.move.forEach(function(t){e.element.removeEventListener(t,e._onPinchMove,!1)}),null!=t&&t.end.forEach(function(t){e.element.removeEventListener(t,e._onPinchEnd,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){return void 0===e&&(e=1),this._baseValue*(t-e)*this.options.scale},t}(),J=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=f(t),this.options=d({scale:1,releaseDelay:300,useNormalized:!0},e),this._onWheel=this._onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onWheel=function(t){var e,n=this;this._enabled&&(t.preventDefault(),0!==t.deltaY&&(this._holding||(this._observer.hold(this,t),this._holding=!0),e=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY)),this._observer.change(this,t,A(this.axes,[e]),!0),clearTimeout(this._timer),this._timer=setTimeout(function(){n._holding&&(n._holding=!1,n._observer.release(n,t,[0]))},this.options.releaseDelay)))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("wheel",this._onWheel),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},t}(),$=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=f(t),this.options=d({scale:[1,1]},e),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onKeydown=function(t){if(this._enabled){var e,n=!0,i=1,r=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,r=1;break;case 38:case 87:r=1;break;default:n=!1}(-1===r&&!this.axes[0]||1===r&&!this.axes[1])&&(n=!1),n&&(t.preventDefault(),e=-1===r?[this.options.scale[0]*i,0]:[0,this.options.scale[1]*i],this._holding||(this._observer.hold(this,t),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,t,A(this.axes,e)))}},e._onKeyup=function(t){var e=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e._observer.release(e,t,[0,0]),e._holding=!1},80))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("keydown",this._onKeydown,!1),this.element.addEventListener("keypress",this._onKeydown,!1),this.element.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("keydown",this._onKeydown,!1),this.element.removeEventListener("keypress",this._onKeydown,!1),this.element.removeEventListener("keyup",this._onKeyup,!1),this._enabled=!1,this._observer=null},t}();return z.PanInput=H,z.RotatePanInput=G,z.PinchInput=Z,z.WheelInput=J,z.MoveKeyInput=$,z}); | ||
//# sourceMappingURL=axes.min.js.map |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-axes | ||
version: 3.0.0 | ||
version: 3.0.1 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t.eg=t.eg||{},t.eg.Axes=e())}(this,function(){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var l=function(){return(l=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 c(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 a(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,s=n.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(i=s.next()).done;)a.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return a}(arguments[e]));return t}function v(t){return void 0===t}function d(t,e,n,i){var r=t,s=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],r=Math.max(s[0],r);return Math.min(s[1],r)}function u(t,e){return t<e[0]||t>e[1]}function h(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function f(t,e,n){var i=t,r=e[0],s=e[1],a=s-r;return n[1]&&s<t&&(i=(i-s)%a+r),n[0]&&t<r&&(i=(i-r)%a+s),i}var r,o=function(){function t(t,e){var n,i;if(this._canceled=!1,e)try{for(var r=c(Object.keys(e)),s=r.next();!s.done;s=r.next()){var a=s.value;this[a]=e[a]}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.eventType=t}var e=t.prototype;return e.stop=function(){this._canceled=!0},e.isCanceled=function(){return this._canceled},t}(),t=function(){function t(){this._eventHandler={}}var e=t.prototype;return e.trigger=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=e instanceof o?e.eventType:e,r=a(this._eventHandler[i]||[]);return r.length<=0||(e instanceof o?(e.currentTarget=this,r.forEach(function(t){t(e)})):r.forEach(function(t){t.apply(void 0,a(n))})),this},e.once=function(n,i){var r,s=this;if("object"==typeof n&&v(i)){var t=n;for(var e in t)this.once(e,t[e]);return this}return"string"==typeof n&&"function"==typeof i&&(r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(void 0,a(t)),s.off(n,r)},this.on(n,r)),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&v(e)){var n=t;for(var i in n)this.on(i,n[i]);return this}var r;return"string"==typeof t&&"function"==typeof e&&(r=this._eventHandler[t],v(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)),this},e.off=function(t,e){var n,i;if(v(t))return this._eventHandler={},this;if(v(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var r=t;for(var s in r)this.off(s,r[s]);return this}var a=this._eventHandler[t];if(a){var o=0;try{for(var u=c(a),h=u.next();!h.done;h=u.next()){if(h.value===e){a.splice(o,1),a.length<=0&&delete this._eventHandler[t];break}o++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="3.0.2",t}(),_=o;function e(t,e){for(var n=t.length,i=0;i<n;++i)if(e(t[i],i))return!0;return!1}function p(t,e){for(var n=t.length,i=0;i<n;++i)if(e(t[i],i))return t[i];return null}function g(t,e){try{return new RegExp(t,"g").exec(e)}catch(t){return null}}function m(t){return t.replace(/_/g,".")}function E(t,r){var s=null,a="-1";return e(t,function(t){var e,n,i=g("("+t.test+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",r);return i&&!t.brand&&(s=t,a=i[3]||"-1",t.versionAlias?a=t.versionAlias:t.versionTest&&(e=t.versionTest.toLowerCase(),n=g("("+e+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",r),a=(n?n[3]:"")||a),a=m(a),1)}),{preset:s,version:a}}function n(t,n){return p(t,function(t){var e=t.brand;return g(""+n.test,e.toLowerCase())})}r="undefined"==typeof window?{navigator:{userAgent:""}}:window;var b=[{test:"phantomjs",id:"phantomjs"},{test:"whale",id:"whale"},{test:"edgios|edge|edg",id:"edge"},{test:"msie|trident|windows phone",id:"ie",versionTest:"iemobile|msie|rv"},{test:"miuibrowser",id:"miui browser"},{test:"samsungbrowser",id:"samsung internet"},{test:"samsung",id:"samsung internet",versionTest:"version"},{test:"chrome|crios",id:"chrome"},{test:"firefox|fxios",id:"firefox"},{test:"android",id:"android browser",versionTest:"version"},{test:"safari|iphone|ipad|ipod",id:"safari",versionTest:"version"}],x=[{test:"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",id:"chrome"},{test:"chromium",id:"chrome"},{test:"whale",id:"chrome",brand:!0}],y=[{test:"applewebkit",id:"webkit"}],M=[{test:"(?=(iphone|ipad))(?!(.*version))",id:"webview"},{test:"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",id:"webview"},{test:"webview",id:"webview"}],P=[{test:"windows phone",id:"windows phone"},{test:"windows 2000",id:"window",versionAlias:"5.0"},{test:"windows nt",id:"window"},{test:"iphone|ipad|ipod",id:"ios",versionTest:"iphone os|cpu os"},{test:"mac os x",id:"mac"},{test:"android",id:"android"},{test:"tizen",id:"tizen"},{test:"webos|web0s",id:"webos"}];function w(t){var e=function(t){var e=t;if(void 0===e){if("undefined"==typeof navigator||!navigator)return"";e=navigator.userAgent||""}return e.toLowerCase()}(t),n=!!/mobi/g.exec(e),i={name:"unknown",version:"-1",majorVersion:-1,webview:!!E(M,e).preset,chromium:!!E(x,e).preset,webkit:!1},r={name:"unknown",version:"-1",majorVersion:-1},s=E(b,e),a=s.preset,o=s.version,u=E(P,e),h=u.preset,c=u.version;return i.webkit=!i.chromium&&!!E(y,e).preset,h&&(r.name=h.id,r.version=c,r.majorVersion=parseInt(c,10)),a&&(i.name=a.id,i.version=o,i.webview&&"ios"===r.name&&"safari"!==i.name&&(i.webview=!1)),i.majorVersion=parseInt(i.version,10),{browser:i,os:r,isMobile:n,isHints:!1}}function I(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var T,O,D,A,S,C,k,R,L,j,F,Y,X="ontouchstart"in r&&"safari"===(void 0===T&&function(){if("undefined"!=typeof navigator&&navigator&&navigator.userAgentData){var t=navigator.userAgentData,e=t.brands||t.uaList;return e&&e.length}}()?(S=navigator.userAgentData,C=(S.uaList||S.brands).slice(),k=S.mobile||!1,R=C[0],L={name:R.brand,version:R.version,majorVersion:-1,webkit:!1,webview:e(M,function(t){return n(C,t)}),chromium:e(x,function(t){return n(C,t)})},j={name:"unknown",version:"-1",majorVersion:-1},L.webkit=!L.chromium&&e(y,function(t){return n(C,t)}),O&&(D=O.platform.toLowerCase(),A=p(P,function(t){return new RegExp(""+t.test,"g").exec(D)}),j.name=A?A.id:D,j.version=O.platformVersion),e(b,function(t){var e=n(C,t);return e&&(L.name=t.id,L.version=O?O.uaFullVersion:e.version,1)}),"Linux armv8l"===navigator.platform?j.name="android":L.webkit&&(j.name=k?"ios":"mac"),"ios"===j.name&&L.webview&&(L.version="-1"),j.version=m(j.version),L.version=m(L.version),j.majorVersion=parseInt(j.version,10),L.majorVersion=parseInt(L.version,10),{browser:L,os:j,isMobile:k,isHints:!0}):w(T)).browser.name,N=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=e.length;n<i;n++)if(e[n]in t)return e[n];return""}(),V={"touch-action":"none","user-select":"none","-webkit-user-drag":"none"},H=function(t,e){var n,i;return void 0===e&&(e=!1),"string"==typeof t?(i=t.match(/^<([a-z]+)\s*([^>]*)>/)?((n=document.createElement("div")).innerHTML=t,I(n.childNodes)):I(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==r&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in r&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return H(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},K=r.requestAnimationFrame||r.webkitRequestAnimationFrame,U=r.cancelAnimationFrame||r.webkitCancelAnimationFrame;K&&!U?(F={},Y=K,K=function(e){var n=Y(function(t){F[n]&&e(t)});return F[n]=!0,n},U=function(t){delete F[t]}):K&&U||(K=function(t){return r.setTimeout(function(){t(r.performance&&r.performance.now&&r.performance.now()||(new Date).getTime())},16)},U=r.clearTimeout);function B(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function W(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function q(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function Q(t,n){return q(t,function(t,e){return t===n[e]})}function z(t,e){return rt[e]||(rt[e]=st(e)),rt[e](t)}function G(t,n){return t&&n?B(t,function(t,e){return z(t,"number"==typeof n?n:n[e])}):t}function Z(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function J(t,e){return 180*Math.atan2(e,t)/Math.PI}function $(e,t){var n,i={};return e.style&&(n=t||V,Object.keys(n).forEach(function(t){i[t]=e.style[t],e.style[t]=n[t]})),i}function tt(t,e,n){return Math.max(Math.min(t,n),e)}function et(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function nt(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=ct;break;case"pointer":i=dt}}),i?new gt:e&&n?new mt:e?new pt:n?new _t:null}function it(t,e,n){return n?!!(30===e||e&t&&n&t):!!(e&t)}var rt={},st=function(e){var n=e<1?Math.pow(10,Z(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},at=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager;this._options=e,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,i,a=this;return i=void 0!==e?e:(n=B(t,function(t,e){return n=Math.abs(t-s[e]),i=a._options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r}),Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)),tt(i,this._options.minimumDuration,this._options.maximumDuration)},e.getDisplacement=function(t){var e=Math.pow(t.reduce(function(t,e){return t+e*e},0),1/t.length),n=Math.abs(e/-this._options.deceleration);return t.map(function(t){return t/2*n})},e.interpolate=function(t,e){var n=this.easing(1e-5)/1e-5;return this.easing(t/(e*n))*e},e.stopAnimation=function(t,e){var n,i,r;this._animateParam&&t.length&&(n=this.axisManager.get(t),i=this.axisManager.map(n,function(t,e){return f(t,e.range,e.circular)}),q(i,function(t,e){return n[e]===t})||this.eventManager.triggerChange(i,!1,n,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,U(r)),this._raf=null,this.eventManager.triggerAnimationEnd(!(null==e||!e.event)))},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axisManager.get(),n=this.axisManager.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.stopAnimation(Object.keys(this.axisManager.get())),this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axisManager.filter(this.axisManager.get(),function(t,e){return h(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axisManager.map(e,function(t,e){return f(t,e.range,e.circular)})),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!t),this.axisManager.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(t)},e.getUserControl=function(t){var e=t.setTo();return e.destPos=this.axisManager.get(e.destPos),e.duration=tt(e.duration,this._options.minimumDuration,this._options.maximumDuration),e},e.animateTo=function(t,e,n){var i,r=this,s=this._createAnimationParam(t,e,n),a=l({},s.depaPos),o=this.eventManager.triggerAnimationStart(s),u=this.getUserControl(s);!o&&this.axisManager.every(u.destPos,function(t,e){return h(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!Q(u.destPos,a)&&(i=(null==n?void 0:n.event)||null,this._animateLoop({depaPos:a,destPos:u.destPos,duration:u.duration,delta:this.axisManager.getDelta(a,u.destPos),isTrusted:!!i,inputEvent:i,input:(null==n?void 0:n.input)||null},function(){return r.animationEnd()}))},e.easing=function(t){return 1<t?1:this._options.easing(t)},e.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t);this.stopAnimation(n);var i=this.axisManager.get(n);if(Q(t,i))return this;this.interruptManager.setInterrupt(!0);var r=W(t,function(t,e){return i[e]!==t});return Object.keys(r).length?(r=this.axisManager.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:d(t,n,i)}),Q(r,i)||(0<e?this.animateTo(r,e):(this.eventManager.triggerChange(r),this.finish(!1))),this):this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(B(this.axisManager.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},e.updateAnimation=function(t){var e,n,i,r,s,a=this._animateParam;a&&(e=(new Date).getTime()-a.startTime,n=(null==t?void 0:t.destPos)||a.destPos,i=(null==t?void 0:t.duration)||a.duration,null!=t&&t.restart||i<=e?this.setTo(n,i-e):(null!=t&&t.destPos&&(r=this.axisManager.get(),this._initialEasingPer=this._prevEasingPer,a.delta=this.axisManager.getDelta(r,n),a.destPos=n),null!=t&&t.duration&&(s=(e+this._durationOffset)/a.duration,this._durationOffset=s*i-e,a.duration=i)))},e._createAnimationParam=function(t,e,n){var i=this.axisManager.get(),r=t,s=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:r,duration:tt(e,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:s,input:(null==n?void 0:n.input)||null,isTrusted:!!s,done:this.animationEnd}},e._animateLoop=function(n,i){var h,c,r,s,v=this;n.duration?(h=n.depaPos,this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,this._animateParam=l(l({},n),{startTime:(new Date).getTime()}),c=B(h,function(t,e){return t<=n.destPos[e]?1:-1}),r=B(n.destPos,function(t){return t}),(s=function(){var a=v._animateParam,o=((new Date).getTime()-a.startTime+v._durationOffset)/a.duration,u=v.easing(o);v._raf=null;var t=v.axisManager.map(h,function(t,e,n){var i,r=1<=o?a.destPos[n]:t+a.delta[n]*(u-v._prevEasingPer)/(1-v._initialEasingPer),s=f(r,e.range,e.circular);return r!==s&&(i=c[n]*(e.range[1]-e.range[0]),a.destPos[n]-=i,h[n]-=i),s}),e=!v.eventManager.triggerChange(t,!1,h);if(h=t,1<=(v._prevEasingPer=u))return a.destPos=v._getFinalPos(a.destPos,r),Q(a.destPos,v.axisManager.get(Object.keys(a.destPos)))||v.eventManager.triggerChange(a.destPos,!0,h),void i();e?v.finish(!1):v._raf=K(s)})()):(this.eventManager.triggerChange(n.destPos,!0),i())},e._getFinalPos=function(t,i){var r=this;return B(t,function(t,e){if(t>=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=r._getRoundUnit(t,e);return z(t,n)})},e._getRoundUnit=function(t,e){var n,i,r=this._options.round,s=null;return r||(n=this.axisManager.getAxisOptions(e),i=Math.max(Z(n.range[0]),Z(n.range[1]),Z(t)),s=1/Math.pow(10,i)),s||r},t}(),ot=function(){function t(t){this._axes=t}var e=t.prototype;return e.hold=function(t,e){var n=this._getRoundPos(t).roundPos;this._axes.trigger(new _("hold",{pos:n,input:e.input||null,inputEvent:e.event||null,isTrusted:!0}))},e.triggerRelease=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new _("release",l(l({},t),{bounceRatio:this._getBounceRatio(n)})))},e.triggerChange=function(t,e,n,i,r){void 0===r&&(r=!1);var s=this.animationManager,a=s.axisManager,o=s.getEventInfo(),u=this._getRoundPos(t,n),h=u.roundPos,c=u.roundDepa,v=a.moveTo(h,c),l=(null==i?void 0:i.event)||(null==o?void 0:o.event)||null,d={pos:v.pos,delta:v.delta,bounceRatio:this._getBounceRatio(v.pos),holding:r,inputEvent:l,isTrusted:!!l,input:(null==i?void 0:i.input)||(null==o?void 0:o.input)||null,set:l?this._createUserControll(v.pos):function(){}},f=this._axes.trigger(new _("change",d));return l&&a.set(d.set().destPos),f},e.triggerAnimationStart=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;return t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new _("animationStart",t))},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this._axes.trigger(new _("animationEnd",{isTrusted:t}))},e.triggerFinish=function(t){void 0===t&&(t=!1),this._axes.trigger(new _("finish",{isTrusted:t}))},e.setAnimationManager=function(t){this.animationManager=t},e.destroy=function(){this._axes.off()},e._createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:l({},t),duration:e};return function(t,e){return t&&(n.destPos=l({},t)),void 0!==e&&(n.duration=e),n}},e._getRoundPos=function(t,e){var n=this._axes.options.round;return{roundPos:G(t,n),roundDepa:G(e,n)}},e._getBounceRatio=function(t){return this._axes.axisManager.map(t,function(t,e){return t<e.range[0]&&0!==e.bounce[0]?(e.range[0]-t)/e.bounce[0]:t>e.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),ut=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),ht=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return B(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):l(l({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=B(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?f(t,e.range,e.circular):0})),{pos:l({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return q(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return W(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return B(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!u(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var r=this;Object.keys(this._axis).forEach(function(i){r._axis[i]=l({range:[0,100],bounce:[0,0],circular:[!1,!1]},r._axis[i]),["bounce","circular"].forEach(function(t){var e=r._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),ct="ontouchstart"in r,vt="PointerEvent"in r,lt="MSPointerEvent"in r,dt=vt||lt,ft=function(){function t(){}var e=t.prototype;return e.extendEvent=function(t){var e=this.prevEvent,n=this._getCenter(t),i=e?this._getMovement(t):{x:0,y:0},r=e?this._getScale(t):1,s=e?J(n.x-e.center.x,n.y-e.center.y):0,a=e?e.deltaX+i.x:i.x,o=e?e.deltaY+i.y:i.y,u=e?a-e.deltaX:0,h=e?o-e.deltaY:0,c=e?t.timeStamp-e.srcEvent.timeStamp:0;return{srcEvent:t,scale:r,angle:s,center:n,deltaX:a,deltaY:o,offsetX:u,offsetY:h,velocityX:e&&0!=c?u/c:0,velocityY:e&&0!=c?h/c:0,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},t}(),_t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(){return 0},n._getScale=function(){return 1},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},t}(ft),pt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._firstTouch=t,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(t){return t.touches.length},n._getScale=function(t){return 2!==t.touches.length?null:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._firstTouch.touches[0],this._firstTouch.touches[1])},n._getCenter=function(t){return{x:t.touches[0].clientX,y:t.touches[0].clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.touches[0].identifier!==e.touches[0].identifier?{x:0,y:0}:{x:t.touches[0].pageX-e.touches[0].pageX,y:t.touches[0].pageY-e.touches[0].pageY}},t}(ft),gt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=vt?["pointerdown"]:["MSPointerDown"],t.move=vt?["pointermove"]:["MSPointerMove"],t.end=vt?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._updatePointerEvent(t),this.extendEvent(t)},n.onEventMove=function(t){return this._updatePointerEvent(t),this.extendEvent(t)},n.onEventEnd=function(t){this._removePointerEvent(t)},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.pointerId!==e.pointerId?{x:0,y:0}:{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},n._updatePointerEvent=function(n){var i=this,r=!1;this._recentInputs.forEach(function(t,e){t.pointerId===n.pointerId&&(r=!0,i._recentInputs[e]=n)}),r||(this._firstInputs.push(n),this._recentInputs.push(n))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(ft),mt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._firstTouch=t.hasOwnProperty("touches")?t:null,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(t){return this._isTouchEvent(t)?t.touches.length:0},n._getScale=function(t){return!this._firstTouch||this._isTouchEvent(t)&&2!==t.touches.length?1:this._isTouchEvent(t)?this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._firstTouch.touches[0],this._firstTouch.touches[1]):this.prevEvent.scale},n._getCenter=function(t){return this._isTouchEvent(t)?{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}},n._getMovement=function(e){var n=this,t=this.prevEvent.srcEvent,i=[e,t].map(function(t){return n._isTouchEvent(e)?{id:t.touches[0].identifier,x:t.touches[0].pageX,y:t.touches[0].pageY}:{id:null,x:t.pageX,y:t.pageY}}),r=i[0],s=i[1];return r.id===s.id?{x:r.x-s.x,y:r.y-s.y}:{x:0,y:0}},n._isTouchEvent=function(t){return t.hasOwnProperty("touches")},t}(ft),Et=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager,s=t.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=e,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=s}var e=t.prototype;return e.get=function(t){return this._axisManager.get(t.axes)},e.hold=function(t,e){var n;!this._interruptManager.isInterrupted()&&t.axes.length&&(n={input:t,event:e},this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(t.axes,n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(t.axes),this._moveDistance=this._axisManager.get(t.axes))},e.change=function(t,e,n,i){var r,s,a,o;this._isStopped||!this._interruptManager.isInterrupting()||this._axisManager.every(n,function(t){return 0===t})||(r=this._moveDistance||this._axisManager.get(t.axes),s=B(r,function(t,e){return t+(n[e]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(s,function(t,e){var n=e.circular,i=e.range;return n&&(n[0]||n[1])?f(t,i,n):t})),this._isOutside&&this._axisManager.every(r,function(t,e){return!u(t,e.range)})&&(this._isOutside=!1),r=this._atOutside(r),s=this._atOutside(s),a={input:t,event:e},i?(o=this._animationManager.getDuration(s,r),this._animationManager.stopAnimation(t.axes,a),this._animationManager.animateTo(s,o,a)):this._eventManager.triggerChange(s,!1,r,a,!0)||(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1)))},e.release=function(t,e,n,i){var r,s,a,o,u,h,c,v,l;!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance&&(r=this._axisManager.get(t.axes),s=this._axisManager.get(),a=this._animationManager.getDisplacement(n),o=et(t.axes,a),h={depaPos:s,destPos:u=this._axisManager.get(this._axisManager.map(o,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?r[n]+t:d(r[n]+t,e.range,e.circular,e.bounce)})),duration:this._animationManager.getDuration(u,r,i),delta:this._axisManager.getDelta(s,u),inputEvent:e,input:t,isTrusted:!0},this._eventManager.triggerRelease(h),this._moveDistance=null,c=this._animationManager.getUserControl(h),l={input:t,event:e},(v=Q(c.destPos,s))||0===c.duration?(v||this._eventManager.triggerChange(c.destPos,!1,s,l,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(l):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(c.destPos,c.duration,l))},e._atOutside=function(t){var a=this;return this._isOutside?this._axisManager.map(t,function(t,e){var n=e.range[0]-e.bounce[0],i=e.range[1]+e.bounce[1];return i<t?i:t<n?n:t}):this._axisManager.map(t,function(t,e){var n=e.range[0],i=e.range[1],r=e.bounce,s=e.circular;return s&&(s[0]||s[1])?t:t<n?n-a._animationManager.interpolate(n-t,r[0]):i<t?i+a._animationManager.interpolate(t-i,r[1]):t})},t}(),bt=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=l({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null},e),i.interruptManager=new ut(i.options),i.axisManager=new ht(i.axis),i.eventManager=new ot(i),i.animationManager=new at(i),i.inputObserver=new Et(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}s(t,r);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(Object.keys(this.axisManager.get())),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.0.0",t.TRANSFORM=N,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=24,t.DIRECTION_ALL=30,t}(t),xt=function(){function t(t,e){this.axes=[],this.element=null,this._panFlag=!1,this._enabled=!1,this._activeInput=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this.element=H(t),this.options=l({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?24:1,this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=$(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==V&&$(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n;this._activeInput.onEventStart(t),!this._enabled||1<this._activeInput.getTouches(t)||(e=this._activeInput.extendEvent(t),(this._panFlag=!1)!==e.srcEvent.cancelable&&(n=this.options.iOSEdgeSwipeThreshold,this._observer.hold(this,e),this._atRightEdge=X&&e.center.x>window.innerWidth-n,this._panFlag=!0,this._activeInput.prevEvent=e))},e._onPanmove=function(t){var e=this;if(this._activeInput.onEventMove(t),this._panFlag&&this._enabled&&!(1<this._activeInput.getTouches(t))){var n=this._activeInput.extendEvent(t),i=this.options,r=i.iOSEdgeSwipeThreshold,s=i.releaseOnScroll,a=function(t,e){if(e<0||90<e)return 1;var n=Math.abs(t);return e<n&&n<180-e?24:6}(n.angle,this.options.thresholdAngle);if(!s||n.srcEvent.cancelable){if(this._activeInput.prevEvent&&X){if(n.center.x<0)return void this._observer.release(this,this._activeInput.prevEvent,[0,0]);this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),n.deltaX<-r?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout(function(){e._observer.release(e,e._activeInput.prevEvent,[0,0])},100))}var o=this._getOffset([n.offsetX,n.offsetY],[it(6,this._direction,a),it(24,this._direction,a)]),u=o.some(function(t){return 0!==t});u&&(!1!==n.srcEvent.cancelable&&n.srcEvent.preventDefault(),n.srcEvent.stopPropagation()),(n.preventSystemEvent=u)&&this._observer.change(this,n,et(this.axes,o)),this._activeInput.prevEvent=n}else this._onPanend(t)}},e._onPanend=function(t){var e,n;this._activeInput.onEventEnd(t),this._panFlag&&this._enabled&&0===this._activeInput.getTouches(t)&&(this._panFlag=!1,clearTimeout(this._rightEdgeTimer),e=this._activeInput.prevEvent,n=this._getOffset([Math.abs(e.velocityX)*(e.offsetX<0?-1:1),Math.abs(e.velocityY)*(e.offsetY<0?-1:1)],[it(6,this._direction),it(24,this._direction)]),this._observer.release(this,e,n))},e._attachEvent=function(t){var e=this,n=nt(this.options.inputType);this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPanstart,!1)}),null!=n&&n.move.forEach(function(t){window.addEventListener(t,e._onPanmove,!1)}),null!=n&&n.end.forEach(function(t){window.addEventListener(t,e._onPanend,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPanstart,!1)}),null!=t&&t.move.forEach(function(t){window.removeEventListener(t,e._onPanmove,!1)}),null!=t&&t.end.forEach(function(t){window.removeEventListener(t,e._onPanend,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){var n=[0,0],i=this.options.scale;return e[0]&&(n[0]=t[0]*i[0]),e[1]&&(n[1]=t[1]*i[1]),n},t}(),yt=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n._prevQuadrant=null,n._lastDiff=0,n}s(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=bt.DIRECTION_ALL,this.axes=t},e._onPanstart=function(t){var e,n;this._activeInput.onEventStart(t),this.isEnabled&&(e=this.element.getBoundingClientRect(),n=this._activeInput.extendEvent(t),this._observer.hold(this,n),this._panFlag=!0,this._coefficientForDistanceToAngle=360/(e.width*Math.PI),this._rotateOrigin=[e.left+(e.width-1)/2,e.top+(e.height-1)/2],this._prevAngle=null,this._triggerChange(n),this._activeInput.prevEvent=n)},e._onPanmove=function(t){var e;this._activeInput.onEventMove(t),this._panFlag&&this.isEnabled&&(!1!==(e=this._activeInput.extendEvent(t)).srcEvent.cancelable&&e.srcEvent.preventDefault(),e.srcEvent.stopPropagation(),this._triggerChange(e),this._activeInput.prevEvent=e)},e._onPanend=function(t){var e,n,i,r;this._activeInput.onEventEnd(t),this._panFlag&&this.isEnabled&&(e=this._activeInput.prevEvent,this._triggerChange(e),n=e.velocityX,i=e.velocityY,r=Math.sqrt(n*n+i*i)*(0<this._lastDiff?-1:1),this._observer.release(this,e,[r*this._coefficientForDistanceToAngle]),this._panFlag=!1)},e._triggerChange=function(t){var e=this._getPosFromOrigin(t.center.x,t.center.y),n=e.x,i=e.y,r=J(n,i),s=r<0?360+r:r,a=this._getQuadrant(t.center.x,t.center.y),o=this._getDifference(this._prevAngle,s,this._prevQuadrant,a);this._prevAngle=s,this._prevQuadrant=a,0!==o&&(this._lastDiff=o,this._observer.change(this,t,et(this.axes,[-o])))},e._getDifference=function(t,e,n,i){var r=null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t;return r},e._getPosFromOrigin=function(t,e){return{x:t-this._rotateOrigin[0],y:this._rotateOrigin[1]-e}},e._getQuadrant=function(t,e){var n=this._getPosFromOrigin(t,e),i=n.x,r=n.y,s=0;return 0<=i&&0<=r?s=1:i<0&&0<=r?s=2:i<0&&r<0?s=3:0<=i&&r<0&&(s=4),s},t}(xt),Mt=function(){function t(t,e){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeInput=null,this.element=H(t),this.options=l({scale:1,threshold:0,inputType:["touch","pointer"]},e),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=$(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==V&&$(this.element,this._originalCssProps),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPinchStart=function(t){var e;this._activeInput.onEventStart(t),this._enabled&&2===this._activeInput.getTouches(t)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,t),this._pinchFlag=!0,e=this._activeInput.extendEvent(t),this._activeInput.prevEvent=e)},e._onPinchMove=function(t){var e,n;this._activeInput.onEventMove(t),this._pinchFlag&&this._enabled&&2===this._activeInput.getTouches(t)&&(e=this._activeInput.extendEvent(t),n=this._getOffset(e.scale,this._activeInput.prevEvent.scale),this._observer.change(this,t,et(this.axes,[n])),this._activeInput.prevEvent=e)},e._onPinchEnd=function(t){this._activeInput.onEventEnd(t),!this._pinchFlag||!this._enabled||2<this._activeInput.getTouches(t)||(this._observer.release(this,t,[0],0),this._baseValue=null,this._pinchFlag=!1,this._activeInput.prevEvent=null)},e._attachEvent=function(t){var e=this,n=nt(this.options.inputType);this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPinchStart,!1)}),null!=n&&n.move.forEach(function(t){e.element.addEventListener(t,e._onPinchMove,!1)}),null!=n&&n.end.forEach(function(t){e.element.addEventListener(t,e._onPinchEnd,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPinchStart,!1)}),null!=t&&t.move.forEach(function(t){e.element.removeEventListener(t,e._onPinchMove,!1)}),null!=t&&t.end.forEach(function(t){e.element.removeEventListener(t,e._onPinchEnd,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){return void 0===e&&(e=1),this._baseValue*(t-e)*this.options.scale},t}(),Pt=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=H(t),this.options=l({scale:1,releaseDelay:300,useNormalized:!0},e),this._onWheel=this._onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onWheel=function(t){var e,n=this;this._enabled&&(t.preventDefault(),0!==t.deltaY&&(this._holding||(this._observer.hold(this,t),this._holding=!0),e=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY)),this._observer.change(this,t,et(this.axes,[e]),!0),clearTimeout(this._timer),this._timer=setTimeout(function(){n._holding&&(n._holding=!1,n._observer.release(n,t,[0]))},this.options.releaseDelay)))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("wheel",this._onWheel),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},t}(),wt=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=H(t),this.options=l({scale:[1,1]},e),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onKeydown=function(t){if(this._enabled){var e,n=!0,i=1,r=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,r=1;break;case 38:case 87:r=1;break;default:n=!1}(-1===r&&!this.axes[0]||1===r&&!this.axes[1])&&(n=!1),n&&(t.preventDefault(),e=-1===r?[this.options.scale[0]*i,0]:[0,this.options.scale[1]*i],this._holding||(this._observer.hold(this,t),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,t,et(this.axes,e)))}},e._onKeyup=function(t){var e=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e._observer.release(e,t,[0,0]),e._holding=!1},80))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("keydown",this._onKeydown,!1),this.element.addEventListener("keypress",this._onKeydown,!1),this.element.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("keydown",this._onKeydown,!1),this.element.removeEventListener("keypress",this._onKeydown,!1),this.element.removeEventListener("keyup",this._onKeyup,!1),this._enabled=!1,this._observer=null},t}();return bt.PanInput=xt,bt.RotatePanInput=yt,bt.PinchInput=Mt,bt.WheelInput=Pt,bt.MoveKeyInput=wt,bt}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t.eg=t.eg||{},t.eg.Axes=e())}(this,function(){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var l=function(){return(l=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 c(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 a(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,s=n.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(i=s.next()).done;)a.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return a}(arguments[e]));return t}function v(t){return void 0===t}function d(t,e,n,i){var r=t,s=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],r=Math.max(s[0],r);return Math.min(s[1],r)}function u(t,e){return t<e[0]||t>e[1]}function h(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function f(t,e,n){var i=t,r=e[0],s=e[1],a=s-r;return n[1]&&s<t&&(i=(i-s)%a+r),n[0]&&t<r&&(i=(i-r)%a+s),i}var r,o=function(){function t(t,e){var n,i;if(this._canceled=!1,e)try{for(var r=c(Object.keys(e)),s=r.next();!s.done;s=r.next()){var a=s.value;this[a]=e[a]}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.eventType=t}var e=t.prototype;return e.stop=function(){this._canceled=!0},e.isCanceled=function(){return this._canceled},t}(),t=function(){function t(){this._eventHandler={}}var e=t.prototype;return e.trigger=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=e instanceof o?e.eventType:e,r=a(this._eventHandler[i]||[]);return r.length<=0||(e instanceof o?(e.currentTarget=this,r.forEach(function(t){t(e)})):r.forEach(function(t){t.apply(void 0,a(n))})),this},e.once=function(n,i){var r,s=this;if("object"==typeof n&&v(i)){var t=n;for(var e in t)this.once(e,t[e]);return this}return"string"==typeof n&&"function"==typeof i&&(r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(void 0,a(t)),s.off(n,r)},this.on(n,r)),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&v(e)){var n=t;for(var i in n)this.on(i,n[i]);return this}var r;return"string"==typeof t&&"function"==typeof e&&(r=this._eventHandler[t],v(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)),this},e.off=function(t,e){var n,i;if(v(t))return this._eventHandler={},this;if(v(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var r=t;for(var s in r)this.off(s,r[s]);return this}var a=this._eventHandler[t];if(a){var o=0;try{for(var u=c(a),h=u.next();!h.done;h=u.next()){if(h.value===e){a.splice(o,1),a.length<=0&&delete this._eventHandler[t];break}o++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="3.0.2",t}(),_=o;function e(t,e){for(var n=t.length,i=0;i<n;++i)if(e(t[i],i))return!0;return!1}function p(t,e){for(var n=t.length,i=0;i<n;++i)if(e(t[i],i))return t[i];return null}function g(t,e){try{return new RegExp(t,"g").exec(e)}catch(t){return null}}function m(t){return t.replace(/_/g,".")}function E(t,r){var s=null,a="-1";return e(t,function(t){var e,n,i=g("("+t.test+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",r);return i&&!t.brand&&(s=t,a=i[3]||"-1",t.versionAlias?a=t.versionAlias:t.versionTest&&(e=t.versionTest.toLowerCase(),n=g("("+e+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",r),a=(n?n[3]:"")||a),a=m(a),1)}),{preset:s,version:a}}function n(t,n){return p(t,function(t){var e=t.brand;return g(""+n.test,e.toLowerCase())})}r="undefined"==typeof window?{navigator:{userAgent:""}}:window;var b=[{test:"phantomjs",id:"phantomjs"},{test:"whale",id:"whale"},{test:"edgios|edge|edg",id:"edge"},{test:"msie|trident|windows phone",id:"ie",versionTest:"iemobile|msie|rv"},{test:"miuibrowser",id:"miui browser"},{test:"samsungbrowser",id:"samsung internet"},{test:"samsung",id:"samsung internet",versionTest:"version"},{test:"chrome|crios",id:"chrome"},{test:"firefox|fxios",id:"firefox"},{test:"android",id:"android browser",versionTest:"version"},{test:"safari|iphone|ipad|ipod",id:"safari",versionTest:"version"}],x=[{test:"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",id:"chrome"},{test:"chromium",id:"chrome"},{test:"whale",id:"chrome",brand:!0}],y=[{test:"applewebkit",id:"webkit"}],M=[{test:"(?=(iphone|ipad))(?!(.*version))",id:"webview"},{test:"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",id:"webview"},{test:"webview",id:"webview"}],P=[{test:"windows phone",id:"windows phone"},{test:"windows 2000",id:"window",versionAlias:"5.0"},{test:"windows nt",id:"window"},{test:"iphone|ipad|ipod",id:"ios",versionTest:"iphone os|cpu os"},{test:"mac os x",id:"mac"},{test:"android",id:"android"},{test:"tizen",id:"tizen"},{test:"webos|web0s",id:"webos"}];function w(t){var e=function(t){var e=t;if(void 0===e){if("undefined"==typeof navigator||!navigator)return"";e=navigator.userAgent||""}return e.toLowerCase()}(t),n=!!/mobi/g.exec(e),i={name:"unknown",version:"-1",majorVersion:-1,webview:!!E(M,e).preset,chromium:!!E(x,e).preset,webkit:!1},r={name:"unknown",version:"-1",majorVersion:-1},s=E(b,e),a=s.preset,o=s.version,u=E(P,e),h=u.preset,c=u.version;return i.webkit=!i.chromium&&!!E(y,e).preset,h&&(r.name=h.id,r.version=c,r.majorVersion=parseInt(c,10)),a&&(i.name=a.id,i.version=o,i.webview&&"ios"===r.name&&"safari"!==i.name&&(i.webview=!1)),i.majorVersion=parseInt(i.version,10),{browser:i,os:r,isMobile:n,isHints:!1}}function I(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var T,O,D,A,S,C,k,R,L,j,F,Y,X="ontouchstart"in r&&"safari"===(void 0===T&&function(){if("undefined"!=typeof navigator&&navigator&&navigator.userAgentData){var t=navigator.userAgentData,e=t.brands||t.uaList;return e&&e.length}}()?(S=navigator.userAgentData,C=(S.uaList||S.brands).slice(),k=S.mobile||!1,R=C[0],L={name:R.brand,version:R.version,majorVersion:-1,webkit:!1,webview:e(M,function(t){return n(C,t)}),chromium:e(x,function(t){return n(C,t)})},j={name:"unknown",version:"-1",majorVersion:-1},L.webkit=!L.chromium&&e(y,function(t){return n(C,t)}),O&&(D=O.platform.toLowerCase(),A=p(P,function(t){return new RegExp(""+t.test,"g").exec(D)}),j.name=A?A.id:D,j.version=O.platformVersion),e(b,function(t){var e=n(C,t);return e&&(L.name=t.id,L.version=O?O.uaFullVersion:e.version,1)}),"Linux armv8l"===navigator.platform?j.name="android":L.webkit&&(j.name=k?"ios":"mac"),"ios"===j.name&&L.webview&&(L.version="-1"),j.version=m(j.version),L.version=m(L.version),j.majorVersion=parseInt(j.version,10),L.majorVersion=parseInt(L.version,10),{browser:L,os:j,isMobile:k,isHints:!0}):w(T)).browser.name,N=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=e.length;n<i;n++)if(e[n]in t)return e[n];return""}(),V={"touch-action":"none","user-select":"none","-webkit-user-drag":"none"},H=function(t,e){var n,i;return void 0===e&&(e=!1),"string"==typeof t?(i=t.match(/^<([a-z]+)\s*([^>]*)>/)?((n=document.createElement("div")).innerHTML=t,I(n.childNodes)):I(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==r&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in r&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return H(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},K=r.requestAnimationFrame||r.webkitRequestAnimationFrame,U=r.cancelAnimationFrame||r.webkitCancelAnimationFrame;K&&!U?(F={},Y=K,K=function(e){var n=Y(function(t){F[n]&&e(t)});return F[n]=!0,n},U=function(t){delete F[t]}):K&&U||(K=function(t){return r.setTimeout(function(){t(r.performance&&r.performance.now&&r.performance.now()||(new Date).getTime())},16)},U=r.clearTimeout);function B(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function W(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function q(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function Q(t,n){return q(t,function(t,e){return t===n[e]})}function z(t,e){return rt[e]||(rt[e]=st(e)),rt[e](t)}function G(t,n){return t&&n?B(t,function(t,e){return z(t,"number"==typeof n?n:n[e])}):t}function Z(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function J(t,e){return 180*Math.atan2(e,t)/Math.PI}function $(e,t){var n,i={};return e.style&&(n=t||V,Object.keys(n).forEach(function(t){i[t]=e.style[t],e.style[t]=n[t]})),i}function tt(t,e,n){return Math.max(Math.min(t,n),e)}function et(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function nt(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=ct;break;case"pointer":i=dt}}),i?new gt:e&&n?new mt:e?new pt:n?new _t:null}function it(t,e,n){return n?!!(30===e||e&t&&n&t):!!(e&t)}var rt={},st=function(e){var n=e<1?Math.pow(10,Z(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},at=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager;this._options=e,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,i,a=this;return i=void 0!==e?e:(n=B(t,function(t,e){return n=Math.abs(t-s[e]),i=a._options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r}),Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)),tt(i,this._options.minimumDuration,this._options.maximumDuration)},e.getDisplacement=function(t){var e=Math.pow(t.reduce(function(t,e){return t+e*e},0),1/t.length),n=Math.abs(e/-this._options.deceleration);return t.map(function(t){return t/2*n})},e.interpolate=function(t,e){var n=this.easing(1e-5)/1e-5;return this.easing(t/(e*n))*e},e.stopAnimation=function(t,e){var n,i,r;this._animateParam&&t.length&&(n=this.axisManager.get(t),i=this.axisManager.map(n,function(t,e){return f(t,e.range,e.circular)}),q(i,function(t,e){return n[e]===t})||this.eventManager.triggerChange(i,!1,n,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,U(r)),this._raf=null,this.eventManager.triggerAnimationEnd(!(null==e||!e.event)))},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axisManager.get(),n=this.axisManager.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.stopAnimation(Object.keys(this.axisManager.get())),this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axisManager.filter(this.axisManager.get(),function(t,e){return h(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axisManager.map(e,function(t,e){return f(t,e.range,e.circular)})),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!t),this.axisManager.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(t)},e.getUserControl=function(t){var e=t.setTo();return e.destPos=this.axisManager.get(e.destPos),e.duration=tt(e.duration,this._options.minimumDuration,this._options.maximumDuration),e},e.animateTo=function(t,e,n){var i,r=this,s=this._createAnimationParam(t,e,n),a=l({},s.depaPos),o=this.eventManager.triggerAnimationStart(s),u=this.getUserControl(s);!o&&this.axisManager.every(u.destPos,function(t,e){return h(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!Q(u.destPos,a)&&(i=(null==n?void 0:n.event)||null,this._animateLoop({depaPos:a,destPos:u.destPos,duration:u.duration,delta:this.axisManager.getDelta(a,u.destPos),isTrusted:!!i,inputEvent:i,input:(null==n?void 0:n.input)||null},function(){return r.animationEnd()}))},e.easing=function(t){return 1<t?1:this._options.easing(t)},e.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t);this.stopAnimation(n);var i=this.axisManager.get(n);if(Q(t,i))return this;this.interruptManager.setInterrupt(!0);var r=W(t,function(t,e){return i[e]!==t});return Object.keys(r).length?(r=this.axisManager.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:d(t,n,i)}),Q(r,i)||(0<e?this.animateTo(r,e):(this.eventManager.triggerChange(r),this.finish(!1))),this):this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(B(this.axisManager.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},e.updateAnimation=function(t){var e,n,i,r,s,a=this._animateParam;a&&(e=(new Date).getTime()-a.startTime,n=(null==t?void 0:t.destPos)||a.destPos,i=(null==t?void 0:t.duration)||a.duration,null!=t&&t.restart||i<=e?this.setTo(n,i-e):(null!=t&&t.destPos&&(r=this.axisManager.get(),this._initialEasingPer=this._prevEasingPer,a.delta=this.axisManager.getDelta(r,n),a.destPos=n),null!=t&&t.duration&&(s=(e+this._durationOffset)/a.duration,this._durationOffset=s*i-e,a.duration=i)))},e._createAnimationParam=function(t,e,n){var i=this.axisManager.get(),r=t,s=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:r,duration:tt(e,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:s,input:(null==n?void 0:n.input)||null,isTrusted:!!s,done:this.animationEnd}},e._animateLoop=function(n,i){var h,c,r,s,v=this;n.duration?(h=n.depaPos,this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,this._animateParam=l(l({},n),{startTime:(new Date).getTime()}),c=B(h,function(t,e){return t<=n.destPos[e]?1:-1}),r=B(n.destPos,function(t){return t}),(s=function(){var a=v._animateParam,o=((new Date).getTime()-a.startTime+v._durationOffset)/a.duration,u=v.easing(o);v._raf=null;var t=v.axisManager.map(h,function(t,e,n){var i,r=1<=o?a.destPos[n]:t+a.delta[n]*(u-v._prevEasingPer)/(1-v._initialEasingPer),s=f(r,e.range,e.circular);return r!==s&&(i=c[n]*(e.range[1]-e.range[0]),a.destPos[n]-=i,h[n]-=i),s}),e=!v.eventManager.triggerChange(t,!1,h);if(h=t,1<=(v._prevEasingPer=u))return a.destPos=v._getFinalPos(a.destPos,r),Q(a.destPos,v.axisManager.get(Object.keys(a.destPos)))||v.eventManager.triggerChange(a.destPos,!0,h),void i();e?v.finish(!1):v._raf=K(s)})()):(this.eventManager.triggerChange(n.destPos,!0),i())},e._getFinalPos=function(t,i){var r=this;return B(t,function(t,e){if(t>=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=r._getRoundUnit(t,e);return z(t,n)})},e._getRoundUnit=function(t,e){var n,i,r=this._options.round,s=null;return r||(n=this.axisManager.getAxisOptions(e),i=Math.max(Z(n.range[0]),Z(n.range[1]),Z(t)),s=1/Math.pow(10,i)),s||r},t}(),ot=function(){function t(t){this._axes=t}var e=t.prototype;return e.hold=function(t,e){var n=this._getRoundPos(t).roundPos;this._axes.trigger(new _("hold",{pos:n,input:e.input||null,inputEvent:e.event||null,isTrusted:!0}))},e.triggerRelease=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new _("release",l(l({},t),{bounceRatio:this._getBounceRatio(n)})))},e.triggerChange=function(t,e,n,i,r){void 0===r&&(r=!1);var s=this.animationManager,a=s.axisManager,o=s.getEventInfo(),u=this._getRoundPos(t,n),h=u.roundPos,c=u.roundDepa,v=a.moveTo(h,c),l=(null==i?void 0:i.event)||(null==o?void 0:o.event)||null,d={pos:v.pos,delta:v.delta,bounceRatio:this._getBounceRatio(v.pos),holding:r,inputEvent:l,isTrusted:!!l,input:(null==i?void 0:i.input)||(null==o?void 0:o.input)||null,set:l?this._createUserControll(v.pos):function(){}},f=this._axes.trigger(new _("change",d));return l&&a.set(d.set().destPos),f},e.triggerAnimationStart=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;return t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new _("animationStart",t))},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this._axes.trigger(new _("animationEnd",{isTrusted:t}))},e.triggerFinish=function(t){void 0===t&&(t=!1),this._axes.trigger(new _("finish",{isTrusted:t}))},e.setAnimationManager=function(t){this.animationManager=t},e.destroy=function(){this._axes.off()},e._createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:l({},t),duration:e};return function(t,e){return t&&(n.destPos=l({},t)),void 0!==e&&(n.duration=e),n}},e._getRoundPos=function(t,e){var n=this._axes.options.round;return{roundPos:G(t,n),roundDepa:G(e,n)}},e._getBounceRatio=function(t){return this._axes.axisManager.map(t,function(t,e){return t<e.range[0]&&0!==e.bounce[0]?(e.range[0]-t)/e.bounce[0]:t>e.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),ut=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),ht=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return B(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):l(l({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=B(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?f(t,e.range,e.circular):0})),{pos:l({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return q(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return W(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return B(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!u(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var r=this;Object.keys(this._axis).forEach(function(i){r._axis[i]=l({range:[0,100],bounce:[0,0],circular:[!1,!1]},r._axis[i]),["bounce","circular"].forEach(function(t){var e=r._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),ct="ontouchstart"in r,vt="PointerEvent"in r,lt="MSPointerEvent"in r,dt=vt||lt,ft=function(){function t(){}var e=t.prototype;return e.extendEvent=function(t){var e=this.prevEvent,n=this._getCenter(t),i=e?this._getMovement(t):{x:0,y:0},r=e?this._getScale(t):1,s=e?J(n.x-e.center.x,n.y-e.center.y):0,a=e?e.deltaX+i.x:i.x,o=e?e.deltaY+i.y:i.y,u=e?a-e.deltaX:0,h=e?o-e.deltaY:0,c=e?t.timeStamp-e.srcEvent.timeStamp:0;return{srcEvent:t,scale:r,angle:s,center:n,deltaX:a,deltaY:o,offsetX:u,offsetY:h,velocityX:e&&0!=c?u/c:0,velocityY:e&&0!=c?h/c:0,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},t}(),_t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(){return 0},n._getScale=function(){return 1},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},t}(ft),pt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._firstTouch=t,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(t){return t.touches.length},n._getScale=function(t){return 2!==t.touches.length?null:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._firstTouch.touches[0],this._firstTouch.touches[1])},n._getCenter=function(t){return{x:t.touches[0].clientX,y:t.touches[0].clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.touches[0].identifier!==e.touches[0].identifier?{x:0,y:0}:{x:t.touches[0].pageX-e.touches[0].pageX,y:t.touches[0].pageY-e.touches[0].pageY}},t}(ft),gt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=vt?["pointerdown"]:["MSPointerDown"],t.move=vt?["pointermove"]:["MSPointerMove"],t.end=vt?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._updatePointerEvent(t),this.extendEvent(t)},n.onEventMove=function(t){return this._updatePointerEvent(t),this.extendEvent(t)},n.onEventEnd=function(t){this._removePointerEvent(t)},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.pointerId!==e.pointerId?{x:0,y:0}:{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},n._updatePointerEvent=function(n){var i=this,r=!1;this._recentInputs.forEach(function(t,e){t.pointerId===n.pointerId&&(r=!0,i._recentInputs[e]=n)}),r||(this._firstInputs.push(n),this._recentInputs.push(n))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(ft),mt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._firstTouch=t.hasOwnProperty("touches")?t:null,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(t){return this._isTouchEvent(t)?t.touches.length:0},n._getScale=function(t){return!this._firstTouch||this._isTouchEvent(t)&&2!==t.touches.length?1:this._isTouchEvent(t)?this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._firstTouch.touches[0],this._firstTouch.touches[1]):this.prevEvent.scale},n._getCenter=function(t){return this._isTouchEvent(t)?{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}},n._getMovement=function(e){var n=this,t=this.prevEvent.srcEvent,i=[e,t].map(function(t){return n._isTouchEvent(e)?{id:t.touches[0].identifier,x:t.touches[0].pageX,y:t.touches[0].pageY}:{id:null,x:t.pageX,y:t.pageY}}),r=i[0],s=i[1];return r.id===s.id?{x:r.x-s.x,y:r.y-s.y}:{x:0,y:0}},n._isTouchEvent=function(t){return t.hasOwnProperty("touches")},t}(ft),Et=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager,s=t.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=e,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=s}var e=t.prototype;return e.get=function(t){return this._axisManager.get(t.axes)},e.hold=function(t,e){var n;!this._interruptManager.isInterrupted()&&t.axes.length&&(n={input:t,event:e},this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(t.axes,n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(t.axes),this._moveDistance=this._axisManager.get(t.axes))},e.change=function(t,e,n,i){var r,s,a,o;this._isStopped||!this._interruptManager.isInterrupting()||this._axisManager.every(n,function(t){return 0===t})||(r=this._moveDistance||this._axisManager.get(t.axes),s=B(r,function(t,e){return t+(n[e]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(s,function(t,e){var n=e.circular,i=e.range;return n&&(n[0]||n[1])?f(t,i,n):t})),this._isOutside&&this._axisManager.every(r,function(t,e){return!u(t,e.range)})&&(this._isOutside=!1),r=this._atOutside(r),s=this._atOutside(s),a={input:t,event:e},i?(o=this._animationManager.getDuration(s,r),this._animationManager.stopAnimation(t.axes,a),this._animationManager.animateTo(s,o,a)):this._eventManager.triggerChange(s,!1,r,a,!0)||(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1)))},e.release=function(t,e,n,i){var r,s,a,o,u,h,c,v,l;!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance&&(r=this._axisManager.get(t.axes),s=this._axisManager.get(),a=this._animationManager.getDisplacement(n),o=et(t.axes,a),h={depaPos:s,destPos:u=this._axisManager.get(this._axisManager.map(o,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?r[n]+t:d(r[n]+t,e.range,e.circular,e.bounce)})),duration:this._animationManager.getDuration(u,r,i),delta:this._axisManager.getDelta(s,u),inputEvent:e,input:t,isTrusted:!0},this._eventManager.triggerRelease(h),this._moveDistance=null,c=this._animationManager.getUserControl(h),l={input:t,event:e},(v=Q(c.destPos,s))||0===c.duration?(v||this._eventManager.triggerChange(c.destPos,!1,s,l,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(l):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(c.destPos,c.duration,l))},e._atOutside=function(t){var a=this;return this._isOutside?this._axisManager.map(t,function(t,e){var n=e.range[0]-e.bounce[0],i=e.range[1]+e.bounce[1];return i<t?i:t<n?n:t}):this._axisManager.map(t,function(t,e){var n=e.range[0],i=e.range[1],r=e.bounce,s=e.circular;return s&&(s[0]||s[1])?t:t<n?n-a._animationManager.interpolate(n-t,r[0]):i<t?i+a._animationManager.interpolate(t-i,r[1]):t})},t}(),bt=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=l({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null},e),i.interruptManager=new ut(i.options),i.axisManager=new ht(i.axis),i.eventManager=new ot(i),i.animationManager=new at(i),i.inputObserver=new Et(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}s(t,r);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(Object.keys(this.axisManager.get())),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.0.1",t.TRANSFORM=N,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=24,t.DIRECTION_ALL=30,t}(t),xt=function(){function t(t,e){this.axes=[],this.element=null,this._panFlag=!1,this._enabled=!1,this._activeInput=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this.element=H(t),this.options=l({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?24:1,this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=$(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==V&&$(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n;this._activeInput.onEventStart(t),!this._enabled||1<this._activeInput.getTouches(t)||(e=this._activeInput.extendEvent(t),(this._panFlag=!1)!==e.srcEvent.cancelable&&(n=this.options.iOSEdgeSwipeThreshold,this._observer.hold(this,e),this._atRightEdge=X&&e.center.x>window.innerWidth-n,this._panFlag=!0,this._activeInput.prevEvent=e))},e._onPanmove=function(t){var e=this;if(this._activeInput.onEventMove(t),this._panFlag&&this._enabled&&!(1<this._activeInput.getTouches(t))){var n=this._activeInput.extendEvent(t),i=this.options,r=i.iOSEdgeSwipeThreshold,s=i.releaseOnScroll,a=function(t,e){if(e<0||90<e)return 1;var n=Math.abs(t);return e<n&&n<180-e?24:6}(n.angle,this.options.thresholdAngle);if(!s||n.srcEvent.cancelable){if(this._activeInput.prevEvent&&X){if(n.center.x<0)return void this._observer.release(this,this._activeInput.prevEvent,[0,0]);this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),n.deltaX<-r?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout(function(){e._observer.release(e,e._activeInput.prevEvent,[0,0])},100))}var o=this._getOffset([n.offsetX,n.offsetY],[it(6,this._direction,a),it(24,this._direction,a)]),u=o.some(function(t){return 0!==t});u&&(!1!==n.srcEvent.cancelable&&n.srcEvent.preventDefault(),n.srcEvent.stopPropagation()),(n.preventSystemEvent=u)&&this._observer.change(this,n,et(this.axes,o)),this._activeInput.prevEvent=n}else this._onPanend(t)}},e._onPanend=function(t){var e,n;this._activeInput.onEventEnd(t),this._panFlag&&this._enabled&&0===this._activeInput.getTouches(t)&&(this._panFlag=!1,clearTimeout(this._rightEdgeTimer),e=this._activeInput.prevEvent,n=this._getOffset([Math.abs(e.velocityX)*(e.offsetX<0?-1:1),Math.abs(e.velocityY)*(e.offsetY<0?-1:1)],[it(6,this._direction),it(24,this._direction)]),this._observer.release(this,e,n))},e._attachEvent=function(t){var e=this,n=nt(this.options.inputType);this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPanstart,!1)}),null!=n&&n.move.forEach(function(t){window.addEventListener(t,e._onPanmove,!1)}),null!=n&&n.end.forEach(function(t){window.addEventListener(t,e._onPanend,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPanstart,!1)}),null!=t&&t.move.forEach(function(t){window.removeEventListener(t,e._onPanmove,!1)}),null!=t&&t.end.forEach(function(t){window.removeEventListener(t,e._onPanend,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){var n=[0,0],i=this.options.scale;return e[0]&&(n[0]=t[0]*i[0]),e[1]&&(n[1]=t[1]*i[1]),n},t}(),yt=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n._prevQuadrant=null,n._lastDiff=0,n}s(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=bt.DIRECTION_ALL,this.axes=t},e._onPanstart=function(t){var e,n;this._activeInput.onEventStart(t),this.isEnabled&&(e=this.element.getBoundingClientRect(),n=this._activeInput.extendEvent(t),this._observer.hold(this,n),this._panFlag=!0,this._coefficientForDistanceToAngle=360/(e.width*Math.PI),this._rotateOrigin=[e.left+(e.width-1)/2,e.top+(e.height-1)/2],this._prevAngle=null,this._triggerChange(n),this._activeInput.prevEvent=n)},e._onPanmove=function(t){var e;this._activeInput.onEventMove(t),this._panFlag&&this.isEnabled&&(!1!==(e=this._activeInput.extendEvent(t)).srcEvent.cancelable&&e.srcEvent.preventDefault(),e.srcEvent.stopPropagation(),this._triggerChange(e),this._activeInput.prevEvent=e)},e._onPanend=function(t){var e,n,i,r;this._activeInput.onEventEnd(t),this._panFlag&&this.isEnabled&&(e=this._activeInput.prevEvent,this._triggerChange(e),n=e.velocityX,i=e.velocityY,r=Math.sqrt(n*n+i*i)*(0<this._lastDiff?-1:1),this._observer.release(this,e,[r*this._coefficientForDistanceToAngle]),this._panFlag=!1)},e._triggerChange=function(t){var e=this._getPosFromOrigin(t.center.x,t.center.y),n=e.x,i=e.y,r=J(n,i),s=r<0?360+r:r,a=this._getQuadrant(t.center.x,t.center.y),o=this._getDifference(this._prevAngle,s,this._prevQuadrant,a);this._prevAngle=s,this._prevQuadrant=a,0!==o&&(this._lastDiff=o,this._observer.change(this,t,et(this.axes,[-o])))},e._getDifference=function(t,e,n,i){var r=null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t;return r},e._getPosFromOrigin=function(t,e){return{x:t-this._rotateOrigin[0],y:this._rotateOrigin[1]-e}},e._getQuadrant=function(t,e){var n=this._getPosFromOrigin(t,e),i=n.x,r=n.y,s=0;return 0<=i&&0<=r?s=1:i<0&&0<=r?s=2:i<0&&r<0?s=3:0<=i&&r<0&&(s=4),s},t}(xt),Mt=function(){function t(t,e){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeInput=null,this.element=H(t),this.options=l({scale:1,threshold:0,inputType:["touch","pointer"]},e),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=$(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==V&&$(this.element,this._originalCssProps),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPinchStart=function(t){var e;this._activeInput.onEventStart(t),this._enabled&&2===this._activeInput.getTouches(t)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,t),this._pinchFlag=!0,e=this._activeInput.extendEvent(t),this._activeInput.prevEvent=e)},e._onPinchMove=function(t){var e,n;this._activeInput.onEventMove(t),this._pinchFlag&&this._enabled&&2===this._activeInput.getTouches(t)&&(e=this._activeInput.extendEvent(t),n=this._getOffset(e.scale,this._activeInput.prevEvent.scale),this._observer.change(this,t,et(this.axes,[n])),this._activeInput.prevEvent=e)},e._onPinchEnd=function(t){this._activeInput.onEventEnd(t),!this._pinchFlag||!this._enabled||2<this._activeInput.getTouches(t)||(this._observer.release(this,t,[0],0),this._baseValue=null,this._pinchFlag=!1,this._activeInput.prevEvent=null)},e._attachEvent=function(t){var e=this,n=nt(this.options.inputType);this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPinchStart,!1)}),null!=n&&n.move.forEach(function(t){e.element.addEventListener(t,e._onPinchMove,!1)}),null!=n&&n.end.forEach(function(t){e.element.addEventListener(t,e._onPinchEnd,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPinchStart,!1)}),null!=t&&t.move.forEach(function(t){e.element.removeEventListener(t,e._onPinchMove,!1)}),null!=t&&t.end.forEach(function(t){e.element.removeEventListener(t,e._onPinchEnd,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){return void 0===e&&(e=1),this._baseValue*(t-e)*this.options.scale},t}(),Pt=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=H(t),this.options=l({scale:1,releaseDelay:300,useNormalized:!0},e),this._onWheel=this._onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onWheel=function(t){var e,n=this;this._enabled&&(t.preventDefault(),0!==t.deltaY&&(this._holding||(this._observer.hold(this,t),this._holding=!0),e=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY)),this._observer.change(this,t,et(this.axes,[e]),!0),clearTimeout(this._timer),this._timer=setTimeout(function(){n._holding&&(n._holding=!1,n._observer.release(n,t,[0]))},this.options.releaseDelay)))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("wheel",this._onWheel),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},t}(),wt=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=H(t),this.options=l({scale:[1,1]},e),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onKeydown=function(t){if(this._enabled){var e,n=!0,i=1,r=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,r=1;break;case 38:case 87:r=1;break;default:n=!1}(-1===r&&!this.axes[0]||1===r&&!this.axes[1])&&(n=!1),n&&(t.preventDefault(),e=-1===r?[this.options.scale[0]*i,0]:[0,this.options.scale[1]*i],this._holding||(this._observer.hold(this,t),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,t,et(this.axes,e)))}},e._onKeyup=function(t){var e=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e._observer.release(e,t,[0,0]),e._holding=!1},80))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("keydown",this._onKeydown,!1),this.element.addEventListener("keypress",this._onKeydown,!1),this.element.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("keydown",this._onKeydown,!1),this.element.removeEventListener("keypress",this._onKeydown,!1),this.element.removeEventListener("keyup",this._onKeyup,!1),this._enabled=!1,this._observer=null},t}();return bt.PanInput=xt,bt.RotatePanInput=yt,bt.PinchInput=Mt,bt.WheelInput=Pt,bt.MoveKeyInput=wt,bt}); | ||
//# sourceMappingURL=axes.pkgd.min.js.map |
@@ -0,0 +0,0 @@ var __assign = (this && this.__assign) || function () { |
@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () { |
@@ -0,0 +0,0 @@ var __assign = (this && this.__assign) || function () { |
@@ -0,0 +0,0 @@ var win; |
@@ -0,0 +0,0 @@ export var DIRECTION_NONE = 1; |
@@ -0,0 +0,0 @@ export var getInsidePosition = function (destPos, range, circular, bounce) { |
@@ -0,0 +0,0 @@ import { getAngle } from "../utils"; |
@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () { |
@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () { |
@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () { |
@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () { |
@@ -0,0 +0,0 @@ var __assign = (this && this.__assign) || function () { |
@@ -0,0 +0,0 @@ import Axes from "./Axes"; |
@@ -0,0 +0,0 @@ import Axes from "./Axes"; |
@@ -0,0 +0,0 @@ import { toAxis } from "./inputType/InputType"; |
@@ -0,0 +0,0 @@ import { MouseEventInput } from "../eventInput/MouseEventInput"; |
@@ -0,0 +0,0 @@ var __assign = (this && this.__assign) || function () { |
@@ -0,0 +0,0 @@ var __assign = (this && this.__assign) || function () { |
@@ -0,0 +0,0 @@ var __assign = (this && this.__assign) || function () { |
@@ -0,0 +0,0 @@ var __extends = (this && this.__extends) || (function () { |
@@ -0,0 +0,0 @@ var __assign = (this && this.__assign) || function () { |
@@ -0,0 +0,0 @@ var InterruptManager = (function () { |
@@ -0,0 +0,0 @@ import { window } from "./browser"; |
{ | ||
"name": "@egjs/axes", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
241
README.md
@@ -1,56 +0,48 @@ | ||
# egjs-axes [![npm version](https://badge.fury.io/js/%40egjs%2Faxes.svg)](https://badge.fury.io/js/%40egjs%2Faxes) [![Build Status](https://travis-ci.org/naver/egjs-axes.svg?branch=master)](https://travis-ci.org/naver/egjs-axes) [![Coverage Status](https://coveralls.io/repos/github/naver/egjs-axes/badge.svg?branch=master)](https://coveralls.io/github/naver/egjs-axes?branch=master) | ||
<h1 align="center" style="max-width: 100%;"> | ||
<img width="256" alt="Axes Logo" src="https://raw.githubusercontent.com/naver/egjs-axes/master/demo/static/img/axes.svg" style="max-width: 256px;" /><br/> | ||
<a href="https://naver.github.io/egjs-axes/">@egjs/axes</a> | ||
</h1> | ||
A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. | ||
<p align="center" style="line-height: 2;"> | ||
<a href="https://www.npmjs.com/package/@egjs/axes" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/axes.svg?style=flat-square&color=007acc&label=version&logo=NPM" alt="version" /></a> | ||
<a href="https://www.npmjs.com/package/@egjs/axes" target="_blank"><img alt="npm weekly downloads" src="https://img.shields.io/npm/dw/@egjs/axes?logo=npm&style=flat-square&color=007acc" /></a> | ||
<a href="https://www.npmjs.com/package/@egjs/axes" target="_blank"><img alt="npm bundle size (scoped)" src="https://img.shields.io/bundlephobia/minzip/@egjs/axes.svg?style=flat-square&label=%F0%9F%92%BE%20gzipped&color=007acc" /></a> | ||
<a href="https://travis-ci.org/naver/egjs-axes" target="_blank"><img alt="Build Status" src="https://api.travis-ci.org/naver/egjs-axes.svg?branch=master" /></a> | ||
<a href="https://coveralls.io/github/naver/egjs-axes?branch=master&style=flat-square" target="_blank"><img alt="Coveralls github" src="https://img.shields.io/coveralls/github/naver/egjs-axes.svg?style=flat-square&label=%E2%9C%85%20coverage" /></a> | ||
<a href="https://github.com/naver/egjs-axes/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/static/v1?style=flat-square&label=%F0%9F%93%9C%20license&message=MIT&color=08CE5D" /></a> | ||
<img src="https://img.shields.io/static/v1.svg?label=&message=TypeScript&color=294E80&style=flat-square&logo=typescript" /> | ||
</p> | ||
You can easily create a UI that responds to user actions. | ||
<h3 align="center"> | ||
<a href="https://naver.github.io/egjs-axes/">Demo</a> / <a href="https://naver.github.io/egjs-axes/docs/api/Axes">Documentation</a> / <a href="https://naver.github.io/egjs/"><img height="20" src="https://naver.github.io/egjs/img/logo.svg"/> Other components</a> | ||
</h3> | ||
## Documents | ||
- [Get Started and Demos](https://naver.github.io/egjs-axes/) | ||
- [API documentation](https://naver.github.io/egjs-axes/release/latest/doc/) | ||
- [How to create an ui that responds to user actions using eg.axes](https://medium.com/@sculove/how-to-create-a-ui-that-responds-to-user-actions-using-eg-axes-5037d180d5ab) | ||
- [How to create a custom InputType](https://github.com/naver/egjs-axes/wiki/How-to-create-a-custom-InputType) | ||
<p align="center"> | ||
<b>You can easily create a UI that responds to user actions.</b><br /> | ||
</p> | ||
----- | ||
<img src="https://github.com/naver/egjs-axes/raw/master/demo/static/img/demos/structure.png" style="width:100%"> | ||
## Third party applications | ||
- [@egjs/react-axes](https://github.com/naver/egjs-axes/tree/master/packages/react): A react component that can easily use egjs-axes | ||
## β¨ Features | ||
- Axes translate user action entered by various input devices into the virtual coordinate system. | ||
- You can create an UI that responds to user actions. | ||
- Provides five input types. These can be associated with a user interface. | ||
- [PanInput](https://naver.github.io/egjs-axes/docs/api/PanInput) | ||
- [RotatePanInput](https://naver.github.io/egjs-axes/docs/api/RotatePanInput) | ||
- [PinchInput](https://naver.github.io/egjs-axes/docs/api/PinchInput) | ||
- [WheelInput](https://naver.github.io/egjs-axes/docs/api/WheelInput) | ||
- [MoveKeyInput](https://naver.github.io/egjs-axes/docs/api/MoveKeyInput) | ||
- Provides six types of events generated by InputTypes. | ||
- [hold](https://naver.github.io/egjs-axes/docs/api/Axes#event-hold) | ||
- [change](https://naver.github.io/egjs-axes/docs/api/Axes#event-change) | ||
- [release](https://naver.github.io/egjs-axes/docs/api/Axes#event-release) | ||
- [animationStart](https://naver.github.io/egjs-axes/docs/api/Axes#event-animationStart) | ||
- [animationEnd](https://naver.github.io/egjs-axes/docs/api/Axes#event-animationEnd) | ||
- [finish](https://naver.github.io/egjs-axes/docs/api/Axes#event-finish) | ||
- Moreover, you can create your own custom InputTypes! | ||
## Download and Installation | ||
Download dist files from repo directly or install it via npm. | ||
### For development (Uncompressed) | ||
You can download the uncompressed files for development | ||
- Latest : https://naver.github.io/egjs-axes/release/latest/axes.js | ||
- Specific version : https://naver.github.io/egjs-axes/release/[VERSION]/axes.js | ||
### For production (Compressed) | ||
You can download the compressed files for production | ||
- Latest : https://naver.github.io/egjs-axes/release/latest/axes.min.js | ||
- Specific version : https://naver.github.io/egjs-axes/release/[VERSION]/axes.min.js | ||
### Packaged version (with Dependencies) | ||
> Packaged version is not an official distribution. | ||
> Is just to provide for ease use of 'egjs-axes' with dependency. | ||
- **Latest** | ||
- https://naver.github.io/egjs-axes/release/latest/axes.pkgd.js | ||
- https://naver.github.io/egjs-axes/release/latest/axes.pkgd.min.js | ||
- **Specific version(3.x)** | ||
- https://naver.github.io/egjs-axes/release/[VERSION]/axes.pkgd.js | ||
- https://naver.github.io/egjs-axes/release/[VERSION]/axes.pkgd.min.js | ||
- **Specific version(under 2.x)** | ||
- https://naver.github.io/egjs-axes/release/[VERSION]/dist/axes.pkgd.js | ||
- https://naver.github.io/egjs-axes/release/[VERSION]/dist/axes.pkgd.min.js | ||
### Installation with npm | ||
The following command shows how to install egjs-axes using npm. | ||
## βοΈ Installation | ||
#### npm | ||
```bash | ||
@@ -60,105 +52,100 @@ $ npm install @egjs/axes | ||
#### CDN | ||
- jsDelivr: https://cdn.jsdelivr.net/npm/@egjs/axes/dist/ | ||
- unpkg: https://unpkg.com/@egjs/axes@latest/dist/ | ||
- cdnjs: https://cdnjs.com/libraries/egjs-axes | ||
## Supported Browsers | ||
The following are the supported browsers. | ||
## π Quick Start | ||
#### 1. Set up your HTML | ||
|Internet Explorer|Chrome|Firefox|Safari|iOS|Android| | ||
|---|---|---|---|---|---| | ||
|10+|Latest|Latest|Latest|7+|2.3+(except 3.x)| | ||
## Dependency | ||
egjs-axes has the dependencies for the following libraries: | ||
|[egjs-component](http://github.com/naver/egjs-component)| | ||
|----| | ||
|3.0.1+| | ||
## Edge swipe issue in iOS Safari | ||
When swipe on iOS safari edge, clientX bounces or stops the touch event. | ||
* When swiping from left to right, clientX is minus. | ||
* Swiping from right to left stops the touch event. | ||
In Axes, this was solved by forcing the `release` event in this problem. | ||
* hold -> change -> **release(forced release)** | ||
## How to start developing egjs-axes? | ||
For anyone interested to develop egjs-axes, follow the instructions below. | ||
### Development Environment | ||
#### 1. Clone the repository | ||
Clone the egjs-axes repository and install the dependency modules. | ||
```bash | ||
# Clone the repository. | ||
$ git clone https://github.com/naver/egjs-axes.git | ||
``` html | ||
<div id="area"></div> | ||
``` | ||
#### 2. Install dependencies | ||
`npm` is supported. | ||
#### 2. Load files or import library | ||
##### ES5 | ||
``` html | ||
<script src="https://naver.github.io/egjs-axes/release/latest/axes.pkgd.js"></script> | ||
``` | ||
# Install the dependency modules. | ||
$ npm install | ||
```js | ||
var Axes = eg.Axes; | ||
var PanInput = Axes.PanInput; | ||
var PinchInput = Axes.PinchInput; | ||
var WheelInput = Axes.WheelInput; | ||
var MoveKeyInput = Axes.MoveKeyInput; | ||
``` | ||
#### 3. Build | ||
##### ES6+ | ||
```js | ||
import Axes, {PanInput, PinchInput, WheelInput, MoveKeyInput} from "@egjs/axes"; | ||
``` | ||
Use npm script to build eg.Axes | ||
#### 3. Initialize Axes | ||
```bash | ||
# Run webpack-dev-server for development | ||
$ npm start | ||
```js | ||
// create eg.Axes with option | ||
const axes = new Axes({ | ||
something1: { range: [0, 100] }, | ||
something2: { range: [0, 100] }, | ||
somethingN: { range: [-200, 200] } | ||
}); | ||
``` | ||
# Build | ||
$ npm run build | ||
#### 4. Attach event handlers | ||
```js | ||
axes.on({ | ||
"change": evt => /* ... */ | ||
}); | ||
``` | ||
# Generate jsdoc | ||
$ npm run jsdoc | ||
#### 5. Initialize InputTypes to use | ||
```js | ||
const panInput = new PanInput("#area"); | ||
const wheelInput = new WheelInput("#wArea"); | ||
const pinchInput = new PinchInput("#pArea"); | ||
const movekeyInput = new MoveKeyInput("#mArea"); | ||
``` | ||
Two folders will be created after complete build is completed. | ||
#### 6. Connect eg.Axes and InputTypes | ||
- **dist** folder: Includes the **axes.js** and **axes.min.js** files. | ||
- **doc** folder: Includes API documentation. The home page for the documentation is **doc/index.html**. | ||
### Linting | ||
To keep the same code style, we adopted [TSLint](https://palantir.github.io/tslint/) to maintain our code quality. | ||
```bash | ||
$ npm run lint | ||
```js | ||
axes.connect(["something2", "somethingN"], panInput); | ||
axes.connect(["something1"], wheelInput); | ||
axes.connect(["something2"], pinchInput); | ||
axes.connect(["something1", "something2"], movekeyInput); | ||
``` | ||
### Test | ||
#### 7. Enjoy! | ||
You can change the value of the axis through touch screen, mouse or anything else. | ||
Once you created a branch and done with development, you must perform a test running `npm run test` command before you push code to a remote repository. | ||
## π Supported Browsers | ||
|<img width="20" src="https://simpleicons.org/icons/internetexplorer.svg" alt="IE" />|<img width="20" src="https://simpleicons.org/icons/googlechrome.svg" alt="Chrome" />|<img width="20" src="https://simpleicons.org/icons/firefoxbrowser.svg" alt="Firefox" />|<img width="20" src="https://simpleicons.org/icons/safari.svg" alt="Safari" />|<img width="20" src="https://simpleicons.org/icons/apple.svg" alt="iOS" />|<img width="20" src="https://simpleicons.org/icons/android.svg" alt="Android" />| | ||
|:---:|:---:|:---:|:---:|:---:|:---:| | ||
|10+|Latest|Latest|Latest|7+|2.3+(except 3.x)| | ||
```bash | ||
$ npm run test | ||
``` | ||
Running a `npm run test` command will start [Mocha](https://mochajs.org/) tests via [Karma-runner](https://karma-runner.github.io/). | ||
## π§ Dependency | ||
egjs-axes has the dependencies for the following libraries: | ||
|[eg.Component](http://github.com/naver/egjs-component)|[eg.Agent](http://github.com/naver/egjs-agent)| | ||
|----|----| | ||
|3.0.1+|2.2.1+| | ||
## Bug Report | ||
## πΌ Demos | ||
Check our [Demos](https://naver.github.io/egjs-axes/). | ||
If you find a bug, please report it to us using the [Issues](https://github.com/naver/egjs-axes/issues) page on GitHub. | ||
## π Documentation | ||
See [Documentation](https://naver.github.io/egjs-axes/docs/api/Axes) page. | ||
## π Contributing | ||
See [CONTRIBUTING.md](https://github.com/naver/egjs-axes/blob/master/CONTRIBUTING.md). | ||
## License | ||
egjs-axes is released under the [MIT license](https://github.com/naver/egjs-axes/blob/master/LICENSE). | ||
## π Feedback & Bug Report | ||
Please file an [Issue](https://github.com/naver/egjs-axes/issues). | ||
## π License | ||
@egjs/axes is released under the [MIT license](https://github.com/naver/egjs-axes/blob/master/LICENSE). | ||
``` | ||
Copyright (c) 2017 NAVER Corp. | ||
Copyright (c) 2015 NAVER Corp. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
@@ -170,6 +157,4 @@ of this software and associated documentation files (the "Software"), to deal | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
@@ -183,1 +168,5 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
``` | ||
<p align="center"> | ||
<a href="https://naver.github.io/egjs/"><img height="50" src="https://naver.github.io/egjs/img/logotype1_black.svg" /></a> <a href="https://github.com/naver"><img height="50" src="https://naver.github.io/OpenSourceGuide/book/assets/naver_logo.png" /></a> | ||
</p> |
@@ -102,2 +102,3 @@ import { ComponentEvent } from "@egjs/component"; | ||
* @property {Object.<string, number>} delta The movement variation of coordinate <ko>μ’νμ λ³νλ</ko> | ||
* @property {Object.<string, number>} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value <ko>μμ λμ λμ μ’νκ° bounce μμμ μλ κ²½μ° νμ¬ bounceλ κ°μ μ΅λ bounce κ°μΌλ‘ λλ μμΉ.</ko> | ||
* @property {Object} inputEvent The event object received from inputType <ko>inputTypeμΌλ‘ λΆν° λ°μ μ΄λ²€νΈ κ°μ²΄</ko> | ||
@@ -154,2 +155,3 @@ * @property {Object} input The instance of inputType where the event occurred<ko>μ΄λ²€νΈκ° λ°μν inputType μΈμ€ν΄μ€</ko> | ||
* @property {Object.<string, number>} delta The movement variation of coordinate <ko>μ’νμ λ³νλ</ko> | ||
* @property {Object.<string, number>} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value <ko>νμ¬ μ’νκ° bounce μμμ μλ κ²½μ° νμ¬ bounceλ κ°μ μ΅λ bounce κ°μΌλ‘ λλ μμΉ.</ko> | ||
* @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.<ko>μ¬μ©μκ° κΈ°κΈ°μ νλ©΄μ λλ₯΄κ³ μλμ§ μ¬λΆ</ko> | ||
@@ -156,0 +158,0 @@ * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.<ko>μ΄λ²€νΈκ° λ°μν inputType μΈμ€ν΄μ€. μ λλ©μ΄μ μ μν΄ κ°μ΄ λ³κ²½λ κ²½μ°μλ 'null'μ λ°ννλ€.</ko> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1676542
16364
170
1