@egjs/axes
Advanced tools
Comparing version 2.6.1-beta2 to 2.6.1
@@ -8,5 +8,5 @@ /* | ||
@version 2.6.1-beta2 | ||
@version 2.6.1 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/hammerjs"),require("@egjs/agent"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["@egjs/hammerjs","@egjs/agent","@egjs/component"],e):(t.eg=t.eg||{},t.eg.Axes=e(t.Hammer,t.getAgent,t.eg.Component))}(this,function(a,t,e){"use strict";var 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])};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s,g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t};function l(t,e,n,i){var s=t,r=[n[0]?e[0]:i?e[0]-i[0]:e[0],n[1]?e[1]:i?e[1]+i[1]:e[1]];return s=Math.max(r[0],s),s=Math.min(r[1],s)}function r(t,e){return t<e[0]||t>e[1]}function u(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function v(t,e,n){var i=t,s=e[0],r=e[1],o=r-s;return n[1]&&r<t&&(i=(i-r)%o+s),n[0]&&t<s&&(i=(i-s)%o+r),i}function o(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}function h(t,e){var n;if(void 0===e&&(e=!1),"string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=t,n=o(i.childNodes)}else n=o(document.querySelectorAll(t));e||(n=1<=n.length?n[0]:void 0)}else t===s?n=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in s&&t instanceof jQuery||t.constructor.prototype.jquery?n=e?t.toArray():t.get(0):Array.isArray(t)&&(n=t.map(function(t){return h(t)}),e||(n=1<=n.length?n[0]:void 0)):n=t;return n}var E=(s="undefined"==typeof window?{navigator:{userAgent:""}}:window).requestAnimationFrame||s.webkitRequestAnimationFrame,c=s.cancelAnimationFrame||s.webkitCancelAnimationFrame;if(E&&!c){var m={},f=E;E=function(e){var n=f(function(t){m[n]&&e(t)});return m[n]=!0,n},c=function(t){delete m[t]}}else E&&c||(E=function(t){return s.setTimeout(function(){t(s.performance&&s.performance.now&&s.performance.now()||(new Date).getTime())},16)},c=s.clearTimeout);function _(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function d(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function p(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function b(t,n){return p(t,function(t,e){return t===n[e]})}var x={};function P(t,e){var n,i;return x[e]||(x[e]=(i=(n=e)<1?Math.pow(10,I(n)):1,function(t){return 0===n?0:Math.round(Math.round(t/n)*n*i)/i})),x[e](t)}function T(t,n){if(!t||!n)return t;var i="number"==typeof n;return _(t,function(t,e){return P(t,i?n:n[e])})}function I(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 y(t,e,n){return Math.max(Math.min(t,n),e)}var O=function(){function t(t){var e=t.options,n=t.itm,i=t.em,s=t.axm;this.options=e,this.itm=n,this.em=i,this.axm=s,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(r,t,e){var n,o=this;if(void 0!==e)n=e;else{var i=_(t,function(t,e){return n=Math.abs(t-r[e]),i=o.options.deceleration,(s=Math.sqrt(n/i*2))<100?0:s;var n,i,s});n=Object.keys(i).reduce(function(t,e){return Math.max(t,i[e])},-1/0)}return y(n,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,n){var i=this.axm.get(),s=t,r=n&&n.event||null;return{depaPos:i,destPos:s,duration:y(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,s),inputEvent:r,input:n&&n.input||null,isTrusted:!!r,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var n=this.axm.get(t),i=this.axm.map(n,function(t,e){return v(t,e.range,e.circular)});p(i,function(t,e){return n[e]===t})||this.em.triggerChange(i,!1,n,e,!!e),this._animateParam=null,this._raf&&(s=this._raf,c(s)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var s},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.axm.get(),n=this.axm.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e){return u(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axm.map(e,function(t,e){return v(t,e.range,e.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(!!t),this.axm.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.itm.setInterrupt(!1),this.em.triggerFinish(t)},e.animateLoop=function(s,r){if(s.duration){this._animateParam=g({},s);var h=this._animateParam,u=this,c=h.destPos,m=h.depaPos,l=0,f=_(m,function(t,e){return t<=c[e]?1:-1}),d=_(c,function(t){return t}),p=(new Date).getTime();h.startTime=p,function t(){u._raf=null;var e=(new Date).getTime(),o=(e-h.startTime)/s.duration,a=u.easing(o),n=u.axm.map(m,function(t,e,n){var i=1<=o?c[n]:t+h.delta[n]*(a-l),s=v(i,e.range,e.circular);if(i!==s){var r=f[n]*(e.range[1]-e.range[0]);c[n]-=r,m[n]-=r}return s}),i=!u.em.triggerChange(n,!1,m);if(m=n,p=e,1<=(l=a))return b(c=u.getFinalPos(c,d),u.axm.get(Object.keys(c)))||u.em.triggerChange(c,!0,m),void r();i?u.finish(!1):u._raf=E(t)}()}else this.em.triggerChange(s.destPos,!0),r()},e.getFinalPos=function(t,n){var i=this;return _(t,function(t,e){return t>=n[e]-1e-6&&t<=n[e]+1e-6?n[e]:P(t,i.getRoundUnit(t,e))})},e.getRoundUnit=function(t,e){var n,i=this.options.round,s=null;if(!i){var r=this.axm.getAxisOptions(e);n=Math.max(I(r.range[0]),I(r.range[1]),I(t)),s=1/Math.pow(10,n)}return s||i},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=y(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this,s=this.createAnimationParam(t,e,n),r=g({},s.depaPos),o=this.em.triggerAnimationStart(s),a=this.getUserControll(s);if(!o&&this.axm.every(a.destPos,function(t,e){return u(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!b(a.destPos,r)){var h=n&&n.event||null;this.animateLoop({depaPos:r,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(r,a.destPos),isTrusted:!!h,inputEvent:h,input:n&&n.input||null},function(){return i.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.grab(n);var i=this.axm.get(n);if(b(t,i))return this;this.itm.setInterrupt(!0);var s=d(t,function(t,e){return i[e]!==t});return Object.keys(s).length&&(b(s=this.axm.map(s,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:l(t,n,i)}),i)||(0<e?this.animateTo(s,e):(this.em.triggerChange(s),this.finish(!1)))),this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(_(this.axm.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},t}(),R=function(){function t(t){this.axes=t}var e=t.prototype;return e.triggerHold=function(t,e){var n=this.getRoundPos(t).roundPos;this.axes.trigger("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("release",t)},e.triggerChange=function(t,e,n,i,s){void 0===s&&(s=!1);var r=this.am,o=r.axm,a=r.getEventInfo(),h=this.getRoundPos(t,n),u=h.roundPos,c=h.roundDepa,m=o.moveTo(u,c),l=i&&i.event||a&&a.event||null,f={pos:m.pos,delta:m.delta,holding:s,inputEvent:l,isTrusted:!!l,input:i&&i.input||a&&a.input||null,set:l?this.createUserControll(m.pos):function(){}},d=this.axes.trigger("change",f);return l&&o.set(f.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("animationStart",t)},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this.axes.trigger("animationEnd",{isTrusted:t})},e.triggerFinish=function(t){void 0===t&&(t=!1),this.axes.trigger("finish",{isTrusted:t})},e.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:g({},t),duration:e};return function(t,e){return t&&(n.destPos=g({},t)),void 0!==e&&(n.duration=e),n}},e.setAnimationManager=function(t){this.am=t},e.destroy=function(){this.axes.off()},e.getRoundPos=function(t,e){var n=this.axes.options.round;return{roundPos:T(t,n),roundDepa:T(e,n)}},t}(),D=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}(),A=function(){function t(t,e){var n=this;this.axis=t,this.options=e,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._complementOptions=function(){var s=this;Object.keys(this.axis).forEach(function(i){s.axis[i]=g({range:[0,100],bounce:[0,0],circular:[!1,!1]},s.axis[i]),["bounce","circular"].forEach(function(t){var e=s.axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},e.getDelta=function(t,e){var n=this.get(t);return _(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},{}):g({},this._pos,t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=_(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:g({},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 p(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this.axis;return d(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this.axis;return _(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!r(t,e.range)})},e.getAxisOptions=function(t){return this.axis[t]},t}(),C=function(){function t(t){var e=t.options,n=t.itm,i=t.em,s=t.axm,r=t.am;this.isOutside=!1,this.moveDistance=null,this.isStopped=!1,this.options=e,this.itm=n,this.em=i,this.axm=s,this.am=r}var e=t.prototype;return e.atOutside=function(t){var o=this;if(this.isOutside)return this.axm.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});var a=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,e){var n=e.range[0],i=e.range[1],s=e.bounce,r=e.circular;return r&&(r[0]||r[1])?t:t<n?n-o.am.easing((n-t)/(s[0]*a))*s[0]:i<t?i+o.am.easing((t-i)/(s[1]*a))*s[1]:t})},e.get=function(t){return this.axm.get(t.axes)},e.hold=function(t,e){if(!this.itm.isInterrupted()&&t.axes.length){var n={input:t,event:e};this.isStopped=!1,this.itm.setInterrupt(!0),this.am.grab(t.axes,n),!this.moveDistance&&this.em.triggerHold(this.axm.get(),n),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes)}},e.change=function(t,e,n){if(!this.isStopped&&this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,s=this.moveDistance||this.axm.get(t.axes);i=_(s,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),this.isOutside&&this.axm.every(s,function(t,e){return!r(t,e.range)})&&(this.isOutside=!1),s=this.atOutside(s),i=this.atOutside(i),!this.em.triggerChange(i,!1,s,{input:t,event:e},!0)&&(this.isStopped=!0,this.moveDistance=null,this.am.finish(!1))}},e.release=function(t,e,n,i){if(!this.isStopped&&this.itm.isInterrupting()&&this.moveDistance){var s=this.axm.get(t.axes),r=this.axm.get(),o=this.axm.get(this.axm.map(n,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?s[n]+t:l(s[n]+t,e.range,e.circular,e.bounce)})),a=this.am.getDuration(o,s,i);0===a&&(o=g({},r));var h={depaPos:r,destPos:o,duration:a,delta:this.axm.getDelta(r,o),inputEvent:e,input:t,isTrusted:!0};this.em.triggerRelease(h),this.moveDistance=null;var u=this.am.getUserControll(h),c=b(u.destPos,r),m={input:t,event:e};c||0===u.duration?(!c&&this.em.triggerChange(u.destPos,!1,r,m,!0),this.itm.setInterrupt(!1),this.axm.isOutside()?this.am.restore(m):this.em.triggerFinish(!0)):this.am.animateTo(u.destPos,u.duration,m)}},t}(),w="ontouchstart"in s&&-1<t(s.navigator.userAgent).browser.name.indexOf("safari"),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""}(),M=function(s){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={});var i=s.call(this)||this;return i.axis=t,i._inputs=[],i.options=g({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null},e),i.itm=new D(i.options),i.axm=new A(i.axis,i.options),i.em=new R(i),i.am=new O(i),i.io=new C(i),i.em.setAnimationManager(i.am),n&&i.em.triggerChange(n),i}n(t,s);var e=t.prototype;return e.connect=function(t,e){var n;if(n="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e),"hammer"in e){var i=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});i.length&&(e.hammer=i[0].hammer)}return e.mapAxes(n),e.connect(this.io),this._inputs.push(e),this},e.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);0<=e&&(this._inputs[e].disconnect(),this._inputs.splice(e,1))}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},e.get=function(t){return this.axm.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.am.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.am.setBy(t,e),this},e.isBounceArea=function(t){return this.axm.isOutside(t)},e.destroy=function(){this.disconnect(),this.em.destroy()},t.VERSION="2.6.1-beta2",t.TRANSFORM=N,t.DIRECTION_NONE=a.DIRECTION_NONE,t.DIRECTION_LEFT=a.DIRECTION_LEFT,t.DIRECTION_RIGHT=a.DIRECTION_RIGHT,t.DIRECTION_UP=a.DIRECTION_UP,t.DIRECTION_DOWN=a.DIRECTION_DOWN,t.DIRECTION_HORIZONTAL=a.DIRECTION_HORIZONTAL,t.DIRECTION_VERTICAL=a.DIRECTION_VERTICAL,t.DIRECTION_ALL=a.DIRECTION_ALL,t}(e),L="PointerEvent"in s||"MSPointerEvent"in s,H="ontouchstart"in s,j="_EGJS_AXES_INPUTTYPE_";function F(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function z(t,e){try{return new a.Manager(t,g({},e))}catch(t){return null}}function S(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=H;break;case"pointer":i=L}}),i?a.PointerEventInput:e&&n?a.TouchMouseInput:e?a.TouchInput:n?a.MouseInput:null}function k(t,e,n){return n?!!(e===a.DIRECTION_ALL||e&t&&n&t):!!(e&t)}var Y=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this.panRecognizer=null,this.isRightEdge=!1,this.rightEdgeTimer=0,this.panFlag=!1,void 0===a.Manager)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=h(t),this.options=g({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onHammerInput=this.onHammerInput.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?a.DIRECTION_ALL:e?a.DIRECTION_HORIZONTAL:n?a.DIRECTION_VERTICAL:a.DIRECTION_NONE,this.axes=t},e.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[j];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=S(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=z(this.element,g({inputClass:i},this.options.hammerManagerOptions)),this.element[j]=n}return this.panRecognizer=new a.Pan(e),this.hammer.add(this.panRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&this.dettachEvent(),this._direction=a.DIRECTION_NONE,this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[j],this.element=null,this.hammer=null},e.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},e.removeRecognizer=function(){this.hammer&&this.panRecognizer&&(this.hammer.remove(this.panRecognizer),this.panRecognizer=null)},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?(this.panFlag=!1)!==t.srcEvent.cancelable&&(this.observer.hold(this,t),this.isRightEdge=w&&t.center.x>window.innerWidth-30,this.panFlag=!0):t.isFinal&&this.onPanend(t))},e.onPanmove=function(t){var e=this;if(this.panFlag){var n=function(t,e){if(e<0||90<e)return a.DIRECTION_NONE;var n=Math.abs(t);return e<n&&n<180-e?a.DIRECTION_VERTICAL:a.DIRECTION_HORIZONTAL}(t.angle,this.options.thresholdAngle),i=this.hammer.session.prevInput;if(i&&w){if(t.center.x<0)return void this.onPanend(g({},i,{velocityX:0,velocityY:0,offsetX:0,offsetY:0}));this.isRightEdge&&(clearTimeout(this.rightEdgeTimer),t.deltaX<-30?this.isRightEdge=!1:this.rightEdgeTimer=window.setTimeout(function(){e.onPanend(g({},i,{velocityX:0,velocityY:0,offsetX:0,offsetY:0}))},100))}t.offsetY=i?(t.offsetX=t.deltaX-i.deltaX,t.deltaY-i.deltaY):t.offsetX=0;var s=this.getOffset([t.offsetX,t.offsetY],[k(a.DIRECTION_HORIZONTAL,this._direction,n),k(a.DIRECTION_VERTICAL,this._direction,n)]),r=s.some(function(t){return 0!==t});if(r){var o=t.srcEvent;!1!==o.cancelable&&o.preventDefault(),o.stopPropagation()}(t.preventSystemEvent=r)&&this.observer.change(this,t,F(this.axes,s))}},e.onPanend=function(t){if(this.panFlag){clearTimeout(this.rightEdgeTimer),this.panFlag=!1;var e,n,i,s,r=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[k(a.DIRECTION_HORIZONTAL,this._direction),k(a.DIRECTION_VERTICAL,this._direction)]);e=r,n=this.observer.options.deceleration,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),s=Math.abs(i/-n),r=[e[0]/2*s,e[1]/2*s],this.observer.release(this,t,F(this.axes,r))}},e.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},e.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),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}(),X=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n.prevQuadrant=null,n.lastDiff=0,n}n(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=M.DIRECTION_ALL,this.axes=t},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?(this.observer.hold(this,t),this.onPanstart(t)):t.isFinal&&this.onPanend(t))},e.onPanstart=function(t){var e=this.element.getBoundingClientRect();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(t)},e.onPanmove=function(t){this.triggerChange(t)},e.onPanend=function(t){this.triggerChange(t),this.triggerAnimation(t)},e.triggerChange=function(t){var e=this.getAngle(t.center.x,t.center.y),n=this.getQuadrant(t.center.x,t.center.y),i=this.getDifference(this.prevAngle,e,this.prevQuadrant,n);this.prevAngle=e,this.prevQuadrant=n,0!==i&&(this.lastDiff=i,this.observer.change(this,t,F(this.axes,[-i])))},e.triggerAnimation=function(t){var e=t.velocityX,n=t.velocityY,i=Math.sqrt(e*e+n*n)*(0<this.lastDiff?-1:1),s=i/2*Math.abs(i/-this.observer.options.deceleration);this.observer.release(this,t,F(this.axes,[s*this.coefficientForDistanceToAngle]))},e.getDifference=function(t,e,n,i){return null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t},e.getPosFromOrigin=function(t,e){return{x:t-this.rotateOrigin[0],y:this.rotateOrigin[1]-e}},e.getAngle=function(t,e){var n=this.getPosFromOrigin(t,e),i=n.x,s=n.y,r=180*Math.atan2(s,i)/Math.PI;return r<0?360+r:r},e.getQuadrant=function(t,e){var n=this.getPosFromOrigin(t,e),i=n.x,s=n.y,r=0;return 0<=i&&0<=s?r=1:i<0&&0<=s?r=2:i<0&&s<0?r=3:0<=i&&s<0&&(r=4),r},t}(Y),K=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._base=null,this._prev=null,this.pinchRecognizer=null,void 0===a.Manager)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=h(t),this.options=g({scale:1,threshold:0,inputType:["touch","pointer"],hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},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){var e={threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[j];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=S(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=z(this.element,g({inputClass:i},this.options.hammerManagerOptions)),this.element[j]=n}return this.pinchRecognizer=new a.Pinch(e),this.hammer.add(this.pinchRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null,this.dettachEvent()),this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[j],this.element=null,this.hammer=null},e.removeRecognizer=function(){this.hammer&&this.pinchRecognizer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null)},e.onPinchStart=function(t){this._base=this.observer.get(this)[this.axes[0]];var e=this.getOffset(t.scale);this.observer.hold(this,t),this.observer.change(this,t,F(this.axes,[e])),this._prev=t.scale},e.onPinchMove=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,F(this.axes,[e])),this._prev=t.scale},e.onPinchEnd=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,F(this.axes,[e])),this.observer.release(this,t,F(this.axes,[0]),0),this._base=null,this._prev=null},e.getOffset=function(t,e){return void 0===e&&(e=1),this._base*(t-e)*this.options.scale},e.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},e.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},e.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},t}(),U=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=h(t),this.options=g({scale:1,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.dettachEvent(),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onWheel=function(t){var e=this;if(this._isEnabled&&(t.preventDefault(),0!==t.deltaY)){this._isHolded||(this.observer.hold(this,t),this._isHolded=!0);var n=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY));this.observer.change(this,t,F(this.axes,[n])),clearTimeout(this._timer),this._timer=setTimeout(function(){e._isHolded&&(e._isHolded=!1,e.observer.release(e,t,F(e.axes,[0])))},50)}},e.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}(),W=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=h(t),this.options=g({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.dettachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onKeydown=function(t){if(this._isEnabled){var e=!0,n=1,i=-1;switch(t.keyCode){case 37:case 65:n=-1;break;case 39:case 68:break;case 40:case 83:n=-1,i=1;break;case 38:case 87:i=1;break;default:e=!1}if((-1===i&&!this.axes[0]||1===i&&!this.axes[1])&&(e=!1),e){var s=-1===i?[+this.options.scale[0]*n,0]:[0,+this.options.scale[1]*n];this._isHolded||(this.observer.hold(this,event),this._isHolded=!0),clearTimeout(this._timer),this.observer.change(this,event,F(this.axes,s))}}},e.onKeyup=function(t){var e=this;this._isHolded&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.release(e,t,F(e.axes,[0,0])),e._isHolded=!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._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("keydown",this.onKeydown,!1),this.element.removeEventListener("keypress",this.onKeydown,!1),this.element.removeEventListener("keyup",this.onKeyup,!1),this._isEnabled=!1,this.observer=null},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}();return M.PanInput=Y,M.RotatePanInput=X,M.PinchInput=K,M.WheelInput=U,M.MoveKeyInput=W,M}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/hammerjs"),require("@egjs/agent"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["@egjs/hammerjs","@egjs/agent","@egjs/component"],e):(t.eg=t.eg||{},t.eg.Axes=e(t.Hammer,t.getAgent,t.eg.Component))}(this,function(a,t,e){"use strict";var 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])};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var s,g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t};function l(t,e,n,i){var s=t,r=[n[0]?e[0]:i?e[0]-i[0]:e[0],n[1]?e[1]:i?e[1]+i[1]:e[1]];return s=Math.max(r[0],s),s=Math.min(r[1],s)}function r(t,e){return t<e[0]||t>e[1]}function u(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function v(t,e,n){var i=t,s=e[0],r=e[1],o=r-s;return n[1]&&r<t&&(i=(i-r)%o+s),n[0]&&t<s&&(i=(i-s)%o+r),i}function o(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}function h(t,e){var n;if(void 0===e&&(e=!1),"string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=t,n=o(i.childNodes)}else n=o(document.querySelectorAll(t));e||(n=1<=n.length?n[0]:void 0)}else t===s?n=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in s&&t instanceof jQuery||t.constructor.prototype.jquery?n=e?t.toArray():t.get(0):Array.isArray(t)&&(n=t.map(function(t){return h(t)}),e||(n=1<=n.length?n[0]:void 0)):n=t;return n}var E=(s="undefined"==typeof window?{navigator:{userAgent:""}}:window).requestAnimationFrame||s.webkitRequestAnimationFrame,c=s.cancelAnimationFrame||s.webkitCancelAnimationFrame;if(E&&!c){var m={},f=E;E=function(e){var n=f(function(t){m[n]&&e(t)});return m[n]=!0,n},c=function(t){delete m[t]}}else E&&c||(E=function(t){return s.setTimeout(function(){t(s.performance&&s.performance.now&&s.performance.now()||(new Date).getTime())},16)},c=s.clearTimeout);function _(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function d(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function p(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function b(t,n){return p(t,function(t,e){return t===n[e]})}var x={};function P(t,e){var n,i;return x[e]||(x[e]=(i=(n=e)<1?Math.pow(10,I(n)):1,function(t){return 0===n?0:Math.round(Math.round(t/n)*n*i)/i})),x[e](t)}function T(t,n){if(!t||!n)return t;var i="number"==typeof n;return _(t,function(t,e){return P(t,i?n:n[e])})}function I(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 y(t,e,n){return Math.max(Math.min(t,n),e)}var O=function(){function t(t){var e=t.options,n=t.itm,i=t.em,s=t.axm;this.options=e,this.itm=n,this.em=i,this.axm=s,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(r,t,e){var n,o=this;if(void 0!==e)n=e;else{var i=_(t,function(t,e){return n=Math.abs(t-r[e]),i=o.options.deceleration,(s=Math.sqrt(n/i*2))<100?0:s;var n,i,s});n=Object.keys(i).reduce(function(t,e){return Math.max(t,i[e])},-1/0)}return y(n,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,n){var i=this.axm.get(),s=t,r=n&&n.event||null;return{depaPos:i,destPos:s,duration:y(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,s),inputEvent:r,input:n&&n.input||null,isTrusted:!!r,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var n=this.axm.get(t),i=this.axm.map(n,function(t,e){return v(t,e.range,e.circular)});p(i,function(t,e){return n[e]===t})||this.em.triggerChange(i,!1,n,e,!!e),this._animateParam=null,this._raf&&(s=this._raf,c(s)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var s},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.axm.get(),n=this.axm.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e){return u(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axm.map(e,function(t,e){return v(t,e.range,e.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(!!t),this.axm.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.itm.setInterrupt(!1),this.em.triggerFinish(t)},e.animateLoop=function(s,r){if(s.duration){this._animateParam=g({},s);var h=this._animateParam,u=this,c=h.destPos,m=h.depaPos,l=0,f=_(m,function(t,e){return t<=c[e]?1:-1}),d=_(c,function(t){return t}),p=(new Date).getTime();h.startTime=p,function t(){u._raf=null;var e=(new Date).getTime(),o=(e-h.startTime)/s.duration,a=u.easing(o),n=u.axm.map(m,function(t,e,n){var i=1<=o?c[n]:t+h.delta[n]*(a-l),s=v(i,e.range,e.circular);if(i!==s){var r=f[n]*(e.range[1]-e.range[0]);c[n]-=r,m[n]-=r}return s}),i=!u.em.triggerChange(n,!1,m);if(m=n,p=e,1<=(l=a))return b(c=u.getFinalPos(c,d),u.axm.get(Object.keys(c)))||u.em.triggerChange(c,!0,m),void r();i?u.finish(!1):u._raf=E(t)}()}else this.em.triggerChange(s.destPos,!0),r()},e.getFinalPos=function(t,n){var i=this;return _(t,function(t,e){return t>=n[e]-1e-6&&t<=n[e]+1e-6?n[e]:P(t,i.getRoundUnit(t,e))})},e.getRoundUnit=function(t,e){var n,i=this.options.round,s=null;if(!i){var r=this.axm.getAxisOptions(e);n=Math.max(I(r.range[0]),I(r.range[1]),I(t)),s=1/Math.pow(10,n)}return s||i},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=y(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this,s=this.createAnimationParam(t,e,n),r=g({},s.depaPos),o=this.em.triggerAnimationStart(s),a=this.getUserControll(s);if(!o&&this.axm.every(a.destPos,function(t,e){return u(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!b(a.destPos,r)){var h=n&&n.event||null;this.animateLoop({depaPos:r,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(r,a.destPos),isTrusted:!!h,inputEvent:h,input:n&&n.input||null},function(){return i.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.grab(n);var i=this.axm.get(n);if(b(t,i))return this;this.itm.setInterrupt(!0);var s=d(t,function(t,e){return i[e]!==t});return Object.keys(s).length&&(b(s=this.axm.map(s,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:l(t,n,i)}),i)||(0<e?this.animateTo(s,e):(this.em.triggerChange(s),this.finish(!1)))),this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(_(this.axm.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},t}(),R=function(){function t(t){this.axes=t}var e=t.prototype;return e.triggerHold=function(t,e){var n=this.getRoundPos(t).roundPos;this.axes.trigger("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("release",t)},e.triggerChange=function(t,e,n,i,s){void 0===s&&(s=!1);var r=this.am,o=r.axm,a=r.getEventInfo(),h=this.getRoundPos(t,n),u=h.roundPos,c=h.roundDepa,m=o.moveTo(u,c),l=i&&i.event||a&&a.event||null,f={pos:m.pos,delta:m.delta,holding:s,inputEvent:l,isTrusted:!!l,input:i&&i.input||a&&a.input||null,set:l?this.createUserControll(m.pos):function(){}},d=this.axes.trigger("change",f);return l&&o.set(f.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("animationStart",t)},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this.axes.trigger("animationEnd",{isTrusted:t})},e.triggerFinish=function(t){void 0===t&&(t=!1),this.axes.trigger("finish",{isTrusted:t})},e.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:g({},t),duration:e};return function(t,e){return t&&(n.destPos=g({},t)),void 0!==e&&(n.duration=e),n}},e.setAnimationManager=function(t){this.am=t},e.destroy=function(){this.axes.off()},e.getRoundPos=function(t,e){var n=this.axes.options.round;return{roundPos:T(t,n),roundDepa:T(e,n)}},t}(),D=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}(),A=function(){function t(t,e){var n=this;this.axis=t,this.options=e,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._complementOptions=function(){var s=this;Object.keys(this.axis).forEach(function(i){s.axis[i]=g({range:[0,100],bounce:[0,0],circular:[!1,!1]},s.axis[i]),["bounce","circular"].forEach(function(t){var e=s.axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},e.getDelta=function(t,e){var n=this.get(t);return _(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},{}):g({},this._pos,t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=_(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:g({},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 p(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this.axis;return d(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this.axis;return _(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!r(t,e.range)})},e.getAxisOptions=function(t){return this.axis[t]},t}(),C=function(){function t(t){var e=t.options,n=t.itm,i=t.em,s=t.axm,r=t.am;this.isOutside=!1,this.moveDistance=null,this.isStopped=!1,this.options=e,this.itm=n,this.em=i,this.axm=s,this.am=r}var e=t.prototype;return e.atOutside=function(t){var o=this;if(this.isOutside)return this.axm.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});var a=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,e){var n=e.range[0],i=e.range[1],s=e.bounce,r=e.circular;return r&&(r[0]||r[1])?t:t<n?n-o.am.easing((n-t)/(s[0]*a))*s[0]:i<t?i+o.am.easing((t-i)/(s[1]*a))*s[1]:t})},e.get=function(t){return this.axm.get(t.axes)},e.hold=function(t,e){if(!this.itm.isInterrupted()&&t.axes.length){var n={input:t,event:e};this.isStopped=!1,this.itm.setInterrupt(!0),this.am.grab(t.axes,n),!this.moveDistance&&this.em.triggerHold(this.axm.get(),n),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes)}},e.change=function(t,e,n){if(!this.isStopped&&this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,s=this.moveDistance||this.axm.get(t.axes);i=_(s,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),this.isOutside&&this.axm.every(s,function(t,e){return!r(t,e.range)})&&(this.isOutside=!1),s=this.atOutside(s),i=this.atOutside(i),!this.em.triggerChange(i,!1,s,{input:t,event:e},!0)&&(this.isStopped=!0,this.moveDistance=null,this.am.finish(!1))}},e.release=function(t,e,n,i){if(!this.isStopped&&this.itm.isInterrupting()&&this.moveDistance){var s=this.axm.get(t.axes),r=this.axm.get(),o=this.axm.get(this.axm.map(n,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?s[n]+t:l(s[n]+t,e.range,e.circular,e.bounce)})),a=this.am.getDuration(o,s,i);0===a&&(o=g({},r));var h={depaPos:r,destPos:o,duration:a,delta:this.axm.getDelta(r,o),inputEvent:e,input:t,isTrusted:!0};this.em.triggerRelease(h),this.moveDistance=null;var u=this.am.getUserControll(h),c=b(u.destPos,r),m={input:t,event:e};c||0===u.duration?(!c&&this.em.triggerChange(u.destPos,!1,r,m,!0),this.itm.setInterrupt(!1),this.axm.isOutside()?this.am.restore(m):this.em.triggerFinish(!0)):this.am.animateTo(u.destPos,u.duration,m)}},t}(),w="ontouchstart"in s&&-1<t(s.navigator.userAgent).browser.name.indexOf("safari"),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""}(),M=function(s){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={});var i=s.call(this)||this;return i.axis=t,i._inputs=[],i.options=g({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null},e),i.itm=new D(i.options),i.axm=new A(i.axis,i.options),i.em=new R(i),i.am=new O(i),i.io=new C(i),i.em.setAnimationManager(i.am),n&&i.em.triggerChange(n),i}n(t,s);var e=t.prototype;return e.connect=function(t,e){var n;if(n="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e),"hammer"in e){var i=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});i.length&&(e.hammer=i[0].hammer)}return e.mapAxes(n),e.connect(this.io),this._inputs.push(e),this},e.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);0<=e&&(this._inputs[e].disconnect(),this._inputs.splice(e,1))}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},e.get=function(t){return this.axm.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.am.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.am.setBy(t,e),this},e.isBounceArea=function(t){return this.axm.isOutside(t)},e.destroy=function(){this.disconnect(),this.em.destroy()},t.VERSION="2.6.1",t.TRANSFORM=N,t.DIRECTION_NONE=a.DIRECTION_NONE,t.DIRECTION_LEFT=a.DIRECTION_LEFT,t.DIRECTION_RIGHT=a.DIRECTION_RIGHT,t.DIRECTION_UP=a.DIRECTION_UP,t.DIRECTION_DOWN=a.DIRECTION_DOWN,t.DIRECTION_HORIZONTAL=a.DIRECTION_HORIZONTAL,t.DIRECTION_VERTICAL=a.DIRECTION_VERTICAL,t.DIRECTION_ALL=a.DIRECTION_ALL,t}(e),L="PointerEvent"in s||"MSPointerEvent"in s,H="ontouchstart"in s,j="_EGJS_AXES_INPUTTYPE_";function F(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function z(t,e){try{return new a.Manager(t,g({},e))}catch(t){return null}}function S(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=H;break;case"pointer":i=L}}),i?a.PointerEventInput:e&&n?a.TouchMouseInput:e?a.TouchInput:n?a.MouseInput:null}function k(t,e,n){return n?!!(e===a.DIRECTION_ALL||e&t&&n&t):!!(e&t)}var Y=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this.panRecognizer=null,this.isRightEdge=!1,this.rightEdgeTimer=0,this.panFlag=!1,void 0===a.Manager)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=h(t),this.options=g({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onHammerInput=this.onHammerInput.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?a.DIRECTION_ALL:e?a.DIRECTION_HORIZONTAL:n?a.DIRECTION_VERTICAL:a.DIRECTION_NONE,this.axes=t},e.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[j];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=S(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=z(this.element,g({inputClass:i},this.options.hammerManagerOptions)),this.element[j]=n}return this.panRecognizer=new a.Pan(e),this.hammer.add(this.panRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&this.dettachEvent(),this._direction=a.DIRECTION_NONE,this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[j],this.element=null,this.hammer=null},e.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},e.removeRecognizer=function(){this.hammer&&this.panRecognizer&&(this.hammer.remove(this.panRecognizer),this.panRecognizer=null)},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?(this.panFlag=!1)!==t.srcEvent.cancelable&&(this.observer.hold(this,t),this.isRightEdge=w&&t.center.x>window.innerWidth-30,this.panFlag=!0):t.isFinal&&this.onPanend(t))},e.onPanmove=function(t){var e=this;if(this.panFlag){var n=function(t,e){if(e<0||90<e)return a.DIRECTION_NONE;var n=Math.abs(t);return e<n&&n<180-e?a.DIRECTION_VERTICAL:a.DIRECTION_HORIZONTAL}(t.angle,this.options.thresholdAngle),i=this.hammer.session.prevInput;if(i&&w){if(t.center.x<0)return void this.onPanend(g({},i,{velocityX:0,velocityY:0,offsetX:0,offsetY:0}));this.isRightEdge&&(clearTimeout(this.rightEdgeTimer),t.deltaX<-30?this.isRightEdge=!1:this.rightEdgeTimer=window.setTimeout(function(){e.onPanend(g({},i,{velocityX:0,velocityY:0,offsetX:0,offsetY:0}))},100))}t.offsetY=i?(t.offsetX=t.deltaX-i.deltaX,t.deltaY-i.deltaY):t.offsetX=0;var s=this.getOffset([t.offsetX,t.offsetY],[k(a.DIRECTION_HORIZONTAL,this._direction,n),k(a.DIRECTION_VERTICAL,this._direction,n)]),r=s.some(function(t){return 0!==t});if(r){var o=t.srcEvent;!1!==o.cancelable&&o.preventDefault(),o.stopPropagation()}(t.preventSystemEvent=r)&&this.observer.change(this,t,F(this.axes,s))}},e.onPanend=function(t){if(this.panFlag){clearTimeout(this.rightEdgeTimer),this.panFlag=!1;var e,n,i,s,r=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[k(a.DIRECTION_HORIZONTAL,this._direction),k(a.DIRECTION_VERTICAL,this._direction)]);e=r,n=this.observer.options.deceleration,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),s=Math.abs(i/-n),r=[e[0]/2*s,e[1]/2*s],this.observer.release(this,t,F(this.axes,r))}},e.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},e.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),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}(),X=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n.prevQuadrant=null,n.lastDiff=0,n}n(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=M.DIRECTION_ALL,this.axes=t},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?(this.observer.hold(this,t),this.onPanstart(t)):t.isFinal&&this.onPanend(t))},e.onPanstart=function(t){var e=this.element.getBoundingClientRect();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(t)},e.onPanmove=function(t){this.triggerChange(t)},e.onPanend=function(t){this.triggerChange(t),this.triggerAnimation(t)},e.triggerChange=function(t){var e=this.getAngle(t.center.x,t.center.y),n=this.getQuadrant(t.center.x,t.center.y),i=this.getDifference(this.prevAngle,e,this.prevQuadrant,n);this.prevAngle=e,this.prevQuadrant=n,0!==i&&(this.lastDiff=i,this.observer.change(this,t,F(this.axes,[-i])))},e.triggerAnimation=function(t){var e=t.velocityX,n=t.velocityY,i=Math.sqrt(e*e+n*n)*(0<this.lastDiff?-1:1),s=i/2*Math.abs(i/-this.observer.options.deceleration);this.observer.release(this,t,F(this.axes,[s*this.coefficientForDistanceToAngle]))},e.getDifference=function(t,e,n,i){return null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t},e.getPosFromOrigin=function(t,e){return{x:t-this.rotateOrigin[0],y:this.rotateOrigin[1]-e}},e.getAngle=function(t,e){var n=this.getPosFromOrigin(t,e),i=n.x,s=n.y,r=180*Math.atan2(s,i)/Math.PI;return r<0?360+r:r},e.getQuadrant=function(t,e){var n=this.getPosFromOrigin(t,e),i=n.x,s=n.y,r=0;return 0<=i&&0<=s?r=1:i<0&&0<=s?r=2:i<0&&s<0?r=3:0<=i&&s<0&&(r=4),r},t}(Y),K=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._base=null,this._prev=null,this.pinchRecognizer=null,void 0===a.Manager)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=h(t),this.options=g({scale:1,threshold:0,inputType:["touch","pointer"],hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},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){var e={threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[j];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=S(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=z(this.element,g({inputClass:i},this.options.hammerManagerOptions)),this.element[j]=n}return this.pinchRecognizer=new a.Pinch(e),this.hammer.add(this.pinchRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null,this.dettachEvent()),this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[j],this.element=null,this.hammer=null},e.removeRecognizer=function(){this.hammer&&this.pinchRecognizer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null)},e.onPinchStart=function(t){this._base=this.observer.get(this)[this.axes[0]];var e=this.getOffset(t.scale);this.observer.hold(this,t),this.observer.change(this,t,F(this.axes,[e])),this._prev=t.scale},e.onPinchMove=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,F(this.axes,[e])),this._prev=t.scale},e.onPinchEnd=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,F(this.axes,[e])),this.observer.release(this,t,F(this.axes,[0]),0),this._base=null,this._prev=null},e.getOffset=function(t,e){return void 0===e&&(e=1),this._base*(t-e)*this.options.scale},e.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},e.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},e.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},t}(),U=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=h(t),this.options=g({scale:1,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.dettachEvent(),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onWheel=function(t){var e=this;if(this._isEnabled&&(t.preventDefault(),0!==t.deltaY)){this._isHolded||(this.observer.hold(this,t),this._isHolded=!0);var n=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY));this.observer.change(this,t,F(this.axes,[n])),clearTimeout(this._timer),this._timer=setTimeout(function(){e._isHolded&&(e._isHolded=!1,e.observer.release(e,t,F(e.axes,[0])))},50)}},e.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}(),W=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=h(t),this.options=g({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.dettachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onKeydown=function(t){if(this._isEnabled){var e=!0,n=1,i=-1;switch(t.keyCode){case 37:case 65:n=-1;break;case 39:case 68:break;case 40:case 83:n=-1,i=1;break;case 38:case 87:i=1;break;default:e=!1}if((-1===i&&!this.axes[0]||1===i&&!this.axes[1])&&(e=!1),e){var s=-1===i?[+this.options.scale[0]*n,0]:[0,+this.options.scale[1]*n];this._isHolded||(this.observer.hold(this,event),this._isHolded=!0),clearTimeout(this._timer),this.observer.change(this,event,F(this.axes,s))}}},e.onKeyup=function(t){var e=this;this._isHolded&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.release(e,t,F(e.axes,[0,0])),e._isHolded=!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._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("keydown",this.onKeydown,!1),this.element.removeEventListener("keypress",this.onKeydown,!1),this.element.removeEventListener("keyup",this.onKeyup,!1),this._isEnabled=!1,this.observer=null},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}();return M.PanInput=Y,M.RotatePanInput=X,M.PinchInput=K,M.WheelInput=U,M.MoveKeyInput=W,M}); | ||
//# sourceMappingURL=axes.min.js.map |
@@ -8,3 +8,3 @@ /* | ||
@version 2.6.1-beta2 | ||
@version 2.6.1 | ||
@@ -14,3 +14,3 @@ All-in-one packaged file for ease use of '@egjs/axes' with below dependencies. | ||
*/ | ||
!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=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])};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var m=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};function a(t){return void 0===t}var r,t=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var n=this._eventHandler[t]||[];if(!(0<n.length))return!0;n=n.concat(),e.eventType=t;var i=!1,r=[e],s=0;e.stop=function(){i=!0},e.currentTarget=this;for(var o=arguments.length,a=new Array(2<o?o-2:0),h=2;h<o;h++)a[h-2]=arguments[h];for(1<=a.length&&(r=r.concat(a)),s=0;n[s];s++)n[s].apply(this,r);return!i},e.once=function(r,s){if("object"==typeof r&&a(s)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof s){var o=this;this.on(r,function t(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];s.apply(o,n),o.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&a(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(a(t))return this._eventHandler={},this;if(a(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var n,i=t;for(n in i)this.off(n,i[n]);return this}var r,s,o=this._eventHandler[t];if(o)for(r=0;void 0!==(s=o[r]);r++)if(s===e){o=o.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}();function f(t,e,n,i){var r=t,s=[n[0]?e[0]:i?e[0]-i[0]:e[0],n[1]?e[1]:i?e[1]+i[1]:e[1]];return r=Math.max(s[0],r),r=Math.min(s[1],r)}function s(t,e){return t<e[0]||t>e[1]}function u(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function g(t,e,n){var i=t,r=e[0],s=e[1],o=s-r;return n[1]&&s<t&&(i=(i-s)%o+r),n[0]&&t<r&&(i=(i-r)%o+s),i}function o(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}function h(t,e){var n;if(void 0===e&&(e=!1),"string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=t,n=o(i.childNodes)}else n=o(document.querySelectorAll(t));e||(n=1<=n.length?n[0]:void 0)}else t===r?n=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in r&&t instanceof jQuery||t.constructor.prototype.jquery?n=e?t.toArray():t.get(0):Array.isArray(t)&&(n=t.map(function(t){return h(t)}),e||(n=1<=n.length?n[0]:void 0)):n=t;return n}var y=(r="undefined"==typeof window?{navigator:{userAgent:""}}:window).requestAnimationFrame||r.webkitRequestAnimationFrame,c=r.cancelAnimationFrame||r.webkitCancelAnimationFrame;if(y&&!c){var l={},d=y;y=function(e){var n=d(function(t){l[n]&&e(t)});return l[n]=!0,n},c=function(t){delete l[t]}}else y&&c||(y=function(t){return r.setTimeout(function(){t(r.performance&&r.performance.now&&r.performance.now()||(new Date).getTime())},16)},c=r.clearTimeout);function b(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function p(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function v(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function x(t,n){return v(t,function(t,e){return t===n[e]})}var E={};function w(t,e){var n,i;return E[e]||(E[e]=(i=(n=e)<1?Math.pow(10,T(n)):1,function(t){return 0===n?0:Math.round(Math.round(t/n)*n*i)/i})),E[e](t)}function P(t,n){if(!t||!n)return t;var i="number"==typeof n;return b(t,function(t,e){return w(t,i?n:n[e])})}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 _(t,e,n){return Math.max(Math.min(t,n),e)}var O=function(){function t(t){var e=t.options,n=t.itm,i=t.em,r=t.axm;this.options=e,this.itm=n,this.em=i,this.axm=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,o=this;if(void 0!==e)n=e;else{var i=b(t,function(t,e){return n=Math.abs(t-s[e]),i=o.options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r});n=Object.keys(i).reduce(function(t,e){return Math.max(t,i[e])},-1/0)}return _(n,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,n){var i=this.axm.get(),r=t,s=n&&n.event||null;return{depaPos:i,destPos:r,duration:_(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,r),inputEvent:s,input:n&&n.input||null,isTrusted:!!s,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var n=this.axm.get(t),i=this.axm.map(n,function(t,e){return g(t,e.range,e.circular)});v(i,function(t,e){return n[e]===t})||this.em.triggerChange(i,!1,n,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,c(r)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var r},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.axm.get(),n=this.axm.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e){return u(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axm.map(e,function(t,e){return g(t,e.range,e.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(!!t),this.axm.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.itm.setInterrupt(!1),this.em.triggerFinish(t)},e.animateLoop=function(r,s){if(r.duration){this._animateParam=m({},r);var h=this._animateParam,u=this,c=h.destPos,l=h.depaPos,f=0,d=b(l,function(t,e){return t<=c[e]?1:-1}),p=b(c,function(t){return t}),v=(new Date).getTime();h.startTime=v,function t(){u._raf=null;var e=(new Date).getTime(),o=(e-h.startTime)/r.duration,a=u.easing(o),n=u.axm.map(l,function(t,e,n){var i=1<=o?c[n]:t+h.delta[n]*(a-f),r=g(i,e.range,e.circular);if(i!==r){var s=d[n]*(e.range[1]-e.range[0]);c[n]-=s,l[n]-=s}return r}),i=!u.em.triggerChange(n,!1,l);if(l=n,v=e,1<=(f=a))return x(c=u.getFinalPos(c,p),u.axm.get(Object.keys(c)))||u.em.triggerChange(c,!0,l),void s();i?u.finish(!1):u._raf=y(t)}()}else this.em.triggerChange(r.destPos,!0),s()},e.getFinalPos=function(t,n){var i=this;return b(t,function(t,e){return t>=n[e]-1e-6&&t<=n[e]+1e-6?n[e]:w(t,i.getRoundUnit(t,e))})},e.getRoundUnit=function(t,e){var n,i=this.options.round,r=null;if(!i){var s=this.axm.getAxisOptions(e);n=Math.max(T(s.range[0]),T(s.range[1]),T(t)),r=1/Math.pow(10,n)}return r||i},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=_(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this,r=this.createAnimationParam(t,e,n),s=m({},r.depaPos),o=this.em.triggerAnimationStart(r),a=this.getUserControll(r);if(!o&&this.axm.every(a.destPos,function(t,e){return u(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!x(a.destPos,s)){var h=n&&n.event||null;this.animateLoop({depaPos:s,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(s,a.destPos),isTrusted:!!h,inputEvent:h,input:n&&n.input||null},function(){return i.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.grab(n);var i=this.axm.get(n);if(x(t,i))return this;this.itm.setInterrupt(!0);var r=p(t,function(t,e){return i[e]!==t});return Object.keys(r).length&&(x(r=this.axm.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:f(t,n,i)}),i)||(0<e?this.animateTo(r,e):(this.em.triggerChange(r),this.finish(!1)))),this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(b(this.axm.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},t}(),S=function(){function t(t){this.axes=t}var e=t.prototype;return e.triggerHold=function(t,e){var n=this.getRoundPos(t).roundPos;this.axes.trigger("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("release",t)},e.triggerChange=function(t,e,n,i,r){void 0===r&&(r=!1);var s=this.am,o=s.axm,a=s.getEventInfo(),h=this.getRoundPos(t,n),u=h.roundPos,c=h.roundDepa,l=o.moveTo(u,c),f=i&&i.event||a&&a.event||null,d={pos:l.pos,delta:l.delta,holding:r,inputEvent:f,isTrusted:!!f,input:i&&i.input||a&&a.input||null,set:f?this.createUserControll(l.pos):function(){}},p=this.axes.trigger("change",d);return f&&o.set(d.set().destPos),p},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("animationStart",t)},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this.axes.trigger("animationEnd",{isTrusted:t})},e.triggerFinish=function(t){void 0===t&&(t=!1),this.axes.trigger("finish",{isTrusted:t})},e.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:m({},t),duration:e};return function(t,e){return t&&(n.destPos=m({},t)),void 0!==e&&(n.duration=e),n}},e.setAnimationManager=function(t){this.am=t},e.destroy=function(){this.axes.off()},e.getRoundPos=function(t,e){var n=this.axes.options.round;return{roundPos:P(t,n),roundDepa:P(e,n)}},t}(),A=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}(),M=function(){function t(t,e){var n=this;this.axis=t,this.options=e,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._complementOptions=function(){var r=this;Object.keys(this.axis).forEach(function(i){r.axis[i]=m({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])})})},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},{}):m({},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?g(t,e.range,e.circular):0})),{pos:m({},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 v(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this.axis;return p(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!s(t,e.range)})},e.getAxisOptions=function(t){return this.axis[t]},t}(),I=function(){function t(t){var e=t.options,n=t.itm,i=t.em,r=t.axm,s=t.am;this.isOutside=!1,this.moveDistance=null,this.isStopped=!1,this.options=e,this.itm=n,this.em=i,this.axm=r,this.am=s}var e=t.prototype;return e.atOutside=function(t){var o=this;if(this.isOutside)return this.axm.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});var a=this.am.easing(1e-5)/1e-5;return this.axm.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-o.am.easing((n-t)/(r[0]*a))*r[0]:i<t?i+o.am.easing((t-i)/(r[1]*a))*r[1]:t})},e.get=function(t){return this.axm.get(t.axes)},e.hold=function(t,e){if(!this.itm.isInterrupted()&&t.axes.length){var n={input:t,event:e};this.isStopped=!1,this.itm.setInterrupt(!0),this.am.grab(t.axes,n),!this.moveDistance&&this.em.triggerHold(this.axm.get(),n),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes)}},e.change=function(t,e,n){if(!this.isStopped&&this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,r=this.moveDistance||this.axm.get(t.axes);i=b(r,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),this.isOutside&&this.axm.every(r,function(t,e){return!s(t,e.range)})&&(this.isOutside=!1),r=this.atOutside(r),i=this.atOutside(i),!this.em.triggerChange(i,!1,r,{input:t,event:e},!0)&&(this.isStopped=!0,this.moveDistance=null,this.am.finish(!1))}},e.release=function(t,e,n,i){if(!this.isStopped&&this.itm.isInterrupting()&&this.moveDistance){var r=this.axm.get(t.axes),s=this.axm.get(),o=this.axm.get(this.axm.map(n,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?r[n]+t:f(r[n]+t,e.range,e.circular,e.bounce)})),a=this.am.getDuration(o,r,i);0===a&&(o=m({},s));var h={depaPos:s,destPos:o,duration:a,delta:this.axm.getDelta(s,o),inputEvent:e,input:t,isTrusted:!0};this.em.triggerRelease(h),this.moveDistance=null;var u=this.am.getUserControll(h),c=x(u.destPos,s),l={input:t,event:e};c||0===u.duration?(!c&&this.em.triggerChange(u.destPos,!1,s,l,!0),this.itm.setInterrupt(!1),this.axm.isOutside()?this.am.restore(l):this.em.triggerFinish(!0)):this.am.animateTo(u.destPos,u.duration,l)}},t}();function D(){return(D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function R(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function C(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var z,F="function"!=typeof Object.assign?function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign,H=["","webkit","Moz","MS","ms","o"],e="undefined"==typeof document?{style:{}}:document.createElement("div"),Y="function",W=Math.round,X=Math.abs,k=Date.now;function j(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),s=0;s<H.length;){if((i=(n=H[s])?n+r:e)in t)return i;s++}}z="undefined"==typeof window?{}:window;var N=j(e.style,"touchAction"),L=void 0!==N;var q="compute",V="manipulation",U="none",B="pan-x",K="pan-y",Q=function(){if(!L)return!1;var e={},n=z.CSS&&z.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return e[t]=!n||z.CSS.supports("touch-action",t)}),e}(),G="ontouchstart"in z,J=void 0!==j(z,"PointerEvent"),Z=G&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),$="touch",tt="mouse",et=25,nt=1,it=4,rt=8,st=1,ot=2,at=4,ht=8,ut=16,ct=ot|at,lt=ht|ut,ft=ct|lt,dt=["x","y"],pt=["clientX","clientY"];function vt(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(void 0!==t.length)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function mt(t,e){return typeof t===Y?t.apply(e&&e[0]||void 0,e):t}function gt(t,e){return-1<t.indexOf(e)}var yt=function(){function t(t,e){this.manager=t,this.set(e)}var e=t.prototype;return e.set=function(t){t===q&&(t=this.compute()),L&&this.manager.element.style&&Q[t]&&(this.manager.element.style[N]=t),this.actions=t.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var e=[];return vt(this.manager.recognizers,function(t){mt(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(t){if(gt(t,U))return U;var e=gt(t,B),n=gt(t,K);return e&&n?U:e||n?e?B:K:gt(t,V)?V:"auto"}(e.join(" "))},e.preventDefaults=function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,r=gt(i,U)&&!Q[U],s=gt(i,K)&&!Q[K],o=gt(i,B)&&!Q[B];if(r){var a=1===t.pointers.length,h=t.distance<2,u=t.deltaTime<250;if(a&&h&&u)return}if(!o||!s)return r||s&&n&ct||o&&n<?this.preventSrc(e):void 0}},e.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},t}();function bt(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function xt(t){var e=t.length;if(1===e)return{x:W(t[0].clientX),y:W(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:W(n/e),y:W(i/e)}}function Et(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:W(t.pointers[n].clientX),clientY:W(t.pointers[n].clientY)},n++;return{timeStamp:k(),pointers:e,center:xt(e),deltaX:t.deltaX,deltaY:t.deltaY}}function wt(t,e,n){n||(n=dt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function Pt(t,e,n){n||(n=dt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function Tt(t,e){return t===e?st:X(t)>=X(e)?t<0?ot:at:e<0?ht:ut}function _t(t,e,n){return{x:e/t||0,y:n/t||0}}function Ot(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=Et(e)),1<r&&!n.firstMultiple?n.firstMultiple=Et(e):1===r&&(n.firstMultiple=!1);var s,o,a,h,u,c,l=n.firstInput,f=n.firstMultiple,d=f?f.center:l.center,p=e.center=xt(i);e.timeStamp=k(),e.deltaTime=e.timeStamp-l.timeStamp,e.angle=Pt(d,p),e.distance=wt(d,p),s=n,a=(o=e).center,h=s.offsetDelta||{},u=s.prevDelta||{},c=s.prevInput||{},o.eventType!==nt&&c.eventType!==it||(u=s.prevDelta={x:c.deltaX||0,y:c.deltaY||0},h=s.offsetDelta={x:a.x,y:a.y}),o.deltaX=u.x+(a.x-h.x),o.deltaY=u.y+(a.y-h.y),e.offsetDirection=Tt(e.deltaX,e.deltaY);var v,m,g,y,b=_t(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=b.x,e.overallVelocityY=b.y,e.overallVelocity=X(b.x)>X(b.y)?b.x:b.y,e.scale=f?(v=f.pointers,wt((m=i)[0],m[1],pt)/wt(v[0],v[1],pt)):1,e.rotation=f?(g=f.pointers,Pt((y=i)[1],y[0],pt)+Pt(g[1],g[0],pt)):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,s,o=t.lastInterval||e,a=e.timeStamp-o.timeStamp;if(e.eventType!==rt&&(et<a||void 0===o.velocity)){var h=e.deltaX-o.deltaX,u=e.deltaY-o.deltaY,c=_t(a,h,u);i=c.x,r=c.y,n=X(c.x)>X(c.y)?c.x:c.y,s=Tt(h,u),t.lastInterval=e}else n=o.velocity,i=o.velocityX,r=o.velocityY,s=o.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=s}(n,e);var x=t.element;bt(e.srcEvent.target,x)&&(x=e.srcEvent.target),e.target=x}function St(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,s=e&nt&&i-r==0,o=e&(it|rt)&&i-r==0;n.isFirst=!!s,n.isFinal=!!o,s&&(t.session={}),n.eventType=e,Ot(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function At(t){return t.trim().split(/\s+/g)}function Mt(e,t,n){vt(At(t),function(t){e.addEventListener(t,n,!1)})}function It(e,t,n){vt(At(t),function(t){e.removeEventListener(t,n,!1)})}function Dt(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var Rt=function(){function t(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){mt(e.options.enable,[e])&&n.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&Mt(this.element,this.evEl,this.domHandler),this.evTarget&&Mt(this.target,this.evTarget,this.domHandler),this.evWin&&Mt(Dt(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&It(this.element,this.evEl,this.domHandler),this.evTarget&&It(this.target,this.evTarget,this.domHandler),this.evWin&&It(Dt(this.element),this.evWin,this.domHandler)},t}();function Ct(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}var zt={pointerdown:nt,pointermove:2,pointerup:it,pointercancel:rt,pointerout:rt},Ft={2:$,3:"pen",4:tt,5:"kinect"},Ht="pointerdown",Yt="pointermove pointerup pointercancel";z.MSPointerEvent&&!z.PointerEvent&&(Ht="MSPointerDown",Yt="MSPointerMove MSPointerUp MSPointerCancel");var Wt=function(n){function i(){var t,e=i.prototype;return e.evEl=Ht,e.evWin=Yt,(t=n.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return R(i,n),i.prototype.handler=function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=zt[i],s=Ft[t.pointerType]||t.pointerType,o=s===$,a=Ct(e,t.pointerId,"pointerId");r&nt&&(0===t.button||o)?a<0&&(e.push(t),a=e.length-1):r&(it|rt)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:s,srcEvent:t}),n&&e.splice(a,1))},i}(Rt);function Xt(t){return Array.prototype.slice.call(t,0)}function kt(t,n,e){for(var i=[],r=[],s=0;s<t.length;){var o=n?t[s][n]:t[s];Ct(r,o)<0&&i.push(t[s]),r[s]=o,s++}return e&&(i=n?i.sort(function(t,e){return t[n]>e[n]}):i.sort()),i}var jt={touchstart:nt,touchmove:2,touchend:it,touchcancel:rt},Nt=function(e){function n(){var t;return n.prototype.evTarget="touchstart touchmove touchend touchcancel",(t=e.apply(this,arguments)||this).targetIds={},t}return R(n,e),n.prototype.handler=function(t){var e=jt[t.type],n=function(t,e){var n,i,r=Xt(t.touches),s=this.targetIds;if(e&(2|nt)&&1===r.length)return s[r[0].identifier]=!0,[r,r];var o=Xt(t.changedTouches),a=[],h=this.target;if(i=r.filter(function(t){return bt(t.target,h)}),e===nt)for(n=0;n<i.length;)s[i[n].identifier]=!0,n++;n=0;for(;n<o.length;)s[o[n].identifier]&&a.push(o[n]),e&(it|rt)&&delete s[o[n].identifier],n++;return a.length?[kt(i.concat(a),"identifier",!0),a]:void 0}.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:$,srcEvent:t})},n}(Rt);var Lt={mousedown:nt,mousemove:2,mouseup:it},qt=function(n){function i(){var t,e=i.prototype;return e.evEl="mousedown",e.evWin="mousemove mouseup",(t=n.apply(this,arguments)||this).pressed=!1,t}return R(i,n),i.prototype.handler=function(t){var e=Lt[t.type];e&nt&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=it),this.pressed&&(e&it&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:tt,srcEvent:t}))},i}(Rt),Vt=2500,Ut=25;function Bt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY},i=this.lastTouches;this.lastTouches.push(n);setTimeout(function(){var t=i.indexOf(n);-1<t&&i.splice(t,1)},Vt)}}var Kt=function(){return function(n){function t(t,e){var s;return(s=n.call(this,t,e)||this).handler=function(t,e,n){var i=n.pointerType===$,r=n.pointerType===tt;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(t,e){t&nt?(this.primaryTouch=e.changedPointers[0].identifier,Bt.call(this,e)):t&(it|rt)&&Bt.call(this,e)}).call(C(C(s)),e,n);else if(r&&function(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],s=Math.abs(e-r.x),o=Math.abs(n-r.y);if(s<=Ut&&o<=Ut)return!0}return!1}.call(C(C(s)),n))return;s.callback(t,e,n)}},s.touch=new Nt(s.manager,s.handler),s.mouse=new qt(s.manager,s.handler),s.primaryTouch=null,s.lastTouches=[],s}return R(t,n),t.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},t}(Rt)}();function Qt(t,e,n){return!!Array.isArray(t)&&(vt(t,n[e],n),!0)}var Gt=1;function Jt(t,e){var n=e.manager;return n?n.get(t):t}function Zt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}var $t=function(){function t(t){void 0===t&&(t={}),this.options=D({enable:!0},t),this.id=Gt++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var e=t.prototype;return e.set=function(t){return F(this.options,t),this.manager&&this.manager.touchAction.update(),this},e.recognizeWith=function(t){if(Qt(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Jt(t,this)).id]||(e[t.id]=t).recognizeWith(this),this},e.dropRecognizeWith=function(t){return Qt(t,"dropRecognizeWith",this)||(t=Jt(t,this),delete this.simultaneous[t.id]),this},e.requireFailure=function(t){if(Qt(t,"requireFailure",this))return this;var e=this.requireFail;return-1===Ct(e,t=Jt(t,this))&&(e.push(t),t.requireFailure(this)),this},e.dropRequireFailure=function(t){if(Qt(t,"dropRequireFailure",this))return this;t=Jt(t,this);var e=Ct(this.requireFail,t);return-1<e&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return 0<this.requireFail.length},e.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},e.emit=function(e){var n=this,t=this.state;function i(t){n.manager.emit(t,e)}t<8&&i(n.options.event+Zt(t)),i(n.options.event),e.additionalEvent&&i(e.additionalEvent),8<=t&&i(n.options.event+Zt(t))},e.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=32},e.canEmit=function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},e.recognize=function(t){var e=F({},t);if(!mt(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},e.process=function(t){},e.getTouchAction=function(){},e.reset=function(){},t}(),te={domEvents:!1,touchAction:q,enable:!0,inputTarget:null,inputClass:null,preset:[],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function ee(n,i){var r,s=n.element;s.style&&(vt(n.options.cssProps,function(t,e){r=j(s.style,e),s.style[r]=i?(n.oldCssProps[r]=s.style[r],t):n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}var ne=function(){function t(t,e){var n,i=this;this.options=F({},te,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(J?Wt:Z?Nt:G?Kt:qt))(n,St),this.touchAction=new yt(this,this.options.touchAction),ee(this,!0),vt(this.options.recognizers,function(t){var e=i.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return F(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var s=0;s<i.length;)n=i[s],2===e.stopped||r&&n!==r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&14&n.state&&(r=e.curRecognizer=n),s++}},e.get=function(t){if(t instanceof $t)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event===t)return e[n];return null},e.add=function(t){if(Qt(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),(t.manager=this).touchAction.update(),t},e.remove=function(t){if(Qt(t,"remove",this))return this;var e=this.get(t);if(t){var n=this.recognizers,i=Ct(n,e);-1!==i&&(n.splice(i,1),this.touchAction.update())}return this},e.on=function(t,e){if(void 0===t||void 0===e)return this;var n=this.handlers;return vt(At(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this},e.off=function(t,e){if(void 0===t)return this;var n=this.handlers;return vt(At(t),function(t){e?n[t]&&n[t].splice(Ct(n[t],e),1):delete n[t]}),this},e.emit=function(t,e){var n,i,r;this.options.domEvents&&(n=t,i=e,(r=document.createEvent("Event")).initEvent(n,!0,!0),(r.gesture=i).target.dispatchEvent(r));var s=this.handlers[t]&&this.handlers[t].slice();if(s&&s.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var o=0;o<s.length;)s[o](e),o++}},e.destroy=function(){this.element&&ee(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},t}();var ie=function(e){function t(t){return void 0===t&&(t={}),e.call(this,D({pointers:1},t))||this}R(t,e);var n=t.prototype;return n.attrTest=function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},n.process=function(t){var e=this.state,n=t.eventType,i=6&e,r=this.attrTest(t);return i&&(n&rt||!r)?16|e:i||r?n&it?8|e:2&e?4|e:2:32},t}($t);function re(t){return t===ut?"down":t===ht?"up":t===ot?"left":t===at?"right":""}var se=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,D({event:"pan",threshold:10,pointers:1,direction:ft},t))||this).pX=null,e.pY=null,e}R(t,n);var e=t.prototype;return e.getTouchAction=function(){var t=this.options.direction,e=[];return t&ct&&e.push(K),t<&&e.push(B),e},e.directionTest=function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,s=t.deltaX,o=t.deltaY;return r&e.direction||(i=e.direction&ct?(r=0===s?st:s<0?ot:at,n=s!==this.pX,Math.abs(t.deltaX)):(r=0===o?st:o<0?ht:ut,n=o!==this.pY,Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},e.attrTest=function(t){return ie.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=re(t.direction);e&&(t.additionalEvent=this.options.event+e),n.prototype.emit.call(this,t)},t}(ie),oe=function(n){function t(t){return void 0===t&&(t={}),n.call(this,D({event:"pinch",threshold:0,pointers:2},t))||this}R(t,n);var e=t.prototype;return e.getTouchAction=function(){return[U]},e.attrTest=function(t){return n.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},e.emit=function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}n.prototype.emit.call(this,t)},t}(ie),ae="undefined"!=typeof window&&window||{},he=(ae.RegExp,ae.navigator),ue={browser:[{criteria:"PhantomJS",identity:"PhantomJS"},{criteria:/Whale/,identity:"Whale",versionSearch:"Whale"},{criteria:/Edge/,identity:"Edge",versionSearch:"Edge"},{criteria:/MSIE|Trident|Windows Phone/,identity:"IE",versionSearch:"IEMobile|MSIE|rv"},{criteria:/MiuiBrowser/,identity:"MIUI Browser",versionSearch:"MiuiBrowser"},{criteria:/SamsungBrowser/,identity:"Samsung Internet",versionSearch:"SamsungBrowser"},{criteria:/SAMSUNG /,identity:"Samsung Internet",versionSearch:"Version"},{criteria:/Chrome|CriOS/,identity:"Chrome"},{criteria:/Android/,identity:"Android Browser",versionSearch:"Version"},{criteria:/iPhone|iPad/,identity:"Safari",versionSearch:"Version"},{criteria:"Apple",identity:"Safari",versionSearch:"Version"},{criteria:"Firefox",identity:"Firefox"}],os:[{criteria:/Windows Phone/,identity:"Windows Phone",versionSearch:"Windows Phone"},{criteria:"Windows 2000",identity:"Window",versionAlias:"5.0"},{criteria:/Windows NT/,identity:"Window",versionSearch:"Windows NT"},{criteria:/iPhone|iPad/,identity:"iOS",versionSearch:"iPhone OS|CPU OS"},{criteria:"Mac",versionSearch:"OS X",identity:"MAC"},{criteria:/Android/,identity:"Android"},{criteria:/Tizen/,identity:"Tizen"},{criteria:/Web0S/,identity:"WebOS"}],webview:[{criteria:/iPhone|iPad/,browserVersionSearch:"Version",webviewBrowserVersion:/-1/},{criteria:/iPhone|iPad|Android/,webviewToken:/NAVER|DAUM|; wv/}],defaultString:{browser:{version:"-1",name:"unknown"},os:{version:"-1",name:"unknown"}}};function ce(t,e){for(var n=[],i=0;i<t.length;i++)e(t[i])&&n.push(t[i]);return n}var le=void 0;function fe(t,e){return e&&e.test?!!e.test(t):-1<t.indexOf(e)}function de(t,e){var n=ce(t,function(t){return fe(le,t.criteria)})[0];return n&&n.identity||e.name}function pe(t,i){return ce(t,function(t){var e=t.criteria,n=new RegExp(t.identity,"i").test(i);return!!(e?n&&fe(le,e):n)})[0]}function ve(t,e){var n=ue.defaultString.browser.version,i=new RegExp("("+t+")","i").exec(e);if(!i)return n;var r=i.index,s=i[0];if(-1<r){var o=r+s.length+1;n=e.substring(o).split(" ")[0].replace(/_/g,".").replace(/;|\)/g,"")}return n}function me(t){var e,n;if(t)return ve((e=t,(n=pe(ue.browser,e))||(n={criteria:e,versionSearch:e,identity:e}),n).versionSearch||t,le)}function ge(t){var e,n=(e=t,pe(ue.os,e)||{}),i=ue.defaultString.os.version,r=void 0;if(t){if(n.versionAlias)return n.versionAlias;var s=n.versionSearch||t,o=new RegExp("("+s+")\\s([\\d_\\.]+|\\d_0)","i");return o.exec(le)&&(r=o.exec(le)[2].replace(/_/g,".").replace(/;|\)/g,"")),r||i}}function ye(){var t=de(ue.os,ue.defaultString.os);return{name:t,version:ge(t)}}function be(){var t,e,n=de(ue.browser,ue.defaultString.browser);return{name:n,version:me(n),webview:(t=ue.webview,e=void 0,function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!0;return!1}(ce(t,function(t){return fe(le,t.criteria)}),function(t){return e=ve(t.browserVersionSearch,le),!(!fe(le,t.webviewToken)&&!fe(e,t.webviewBrowserVersion))}))}}function xe(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:he.userAgent;le=t;var e={os:ye(),browser:be(),isMobile:-1!==le.indexOf("Mobi")};return e.browser.name=e.browser.name.toLowerCase(),e.os.name=e.os.name.toLowerCase(),e.os.version=e.os.version.toLowerCase(),"ios"===e.os.name&&e.browser.webview&&(e.browser.version="-1"),e}xe.VERSION="2.1.5";var Ee="ontouchstart"in r&&-1<xe(r.navigator.userAgent).browser.name.indexOf("safari"),we=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""}(),Pe=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={});var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=m({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null},e),i.itm=new A(i.options),i.axm=new M(i.axis,i.options),i.em=new S(i),i.am=new O(i),i.io=new I(i),i.em.setAnimationManager(i.am),n&&i.em.triggerChange(n),i}n(t,r);var e=t.prototype;return e.connect=function(t,e){var n;if(n="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e),"hammer"in e){var i=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});i.length&&(e.hammer=i[0].hammer)}return e.mapAxes(n),e.connect(this.io),this._inputs.push(e),this},e.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);0<=e&&(this._inputs[e].disconnect(),this._inputs.splice(e,1))}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},e.get=function(t){return this.axm.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.am.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.am.setBy(t,e),this},e.isBounceArea=function(t){return this.axm.isOutside(t)},e.destroy=function(){this.disconnect(),this.em.destroy()},t.VERSION="2.6.1-beta2",t.TRANSFORM=we,t.DIRECTION_NONE=st,t.DIRECTION_LEFT=ot,t.DIRECTION_RIGHT=at,t.DIRECTION_UP=ht,t.DIRECTION_DOWN=ut,t.DIRECTION_HORIZONTAL=ct,t.DIRECTION_VERTICAL=lt,t.DIRECTION_ALL=ft,t}(t),Te="PointerEvent"in r||"MSPointerEvent"in r,_e="ontouchstart"in r,Oe="_EGJS_AXES_INPUTTYPE_";function Se(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function Ae(t,e){try{return new ne(t,m({},e))}catch(t){return null}}function Me(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=_e;break;case"pointer":i=Te}}),i?Wt:e&&n?Kt:e?Nt:n?qt:null}function Ie(t,e,n){return n?!!(e===ft||e&t&&n&t):!!(e&t)}var De=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this.panRecognizer=null,this.isRightEdge=!1,this.rightEdgeTimer=0,this.panFlag=!1,void 0===ne)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=h(t),this.options=m({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onHammerInput=this.onHammerInput.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?ft:e?ct:n?lt:st,this.axes=t},e.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[Oe];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=Me(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=Ae(this.element,m({inputClass:i},this.options.hammerManagerOptions)),this.element[Oe]=n}return this.panRecognizer=new se(e),this.hammer.add(this.panRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&this.dettachEvent(),this._direction=st,this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[Oe],this.element=null,this.hammer=null},e.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},e.removeRecognizer=function(){this.hammer&&this.panRecognizer&&(this.hammer.remove(this.panRecognizer),this.panRecognizer=null)},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?(this.panFlag=!1)!==t.srcEvent.cancelable&&(this.observer.hold(this,t),this.isRightEdge=Ee&&t.center.x>window.innerWidth-30,this.panFlag=!0):t.isFinal&&this.onPanend(t))},e.onPanmove=function(t){var e=this;if(this.panFlag){var n=function(t,e){if(e<0||90<e)return st;var n=Math.abs(t);return e<n&&n<180-e?lt:ct}(t.angle,this.options.thresholdAngle),i=this.hammer.session.prevInput;if(i&&Ee){if(t.center.x<0)return void this.onPanend(m({},i,{velocityX:0,velocityY:0,offsetX:0,offsetY:0}));this.isRightEdge&&(clearTimeout(this.rightEdgeTimer),t.deltaX<-30?this.isRightEdge=!1:this.rightEdgeTimer=window.setTimeout(function(){e.onPanend(m({},i,{velocityX:0,velocityY:0,offsetX:0,offsetY:0}))},100))}t.offsetY=i?(t.offsetX=t.deltaX-i.deltaX,t.deltaY-i.deltaY):t.offsetX=0;var r=this.getOffset([t.offsetX,t.offsetY],[Ie(ct,this._direction,n),Ie(lt,this._direction,n)]),s=r.some(function(t){return 0!==t});if(s){var o=t.srcEvent;!1!==o.cancelable&&o.preventDefault(),o.stopPropagation()}(t.preventSystemEvent=s)&&this.observer.change(this,t,Se(this.axes,r))}},e.onPanend=function(t){if(this.panFlag){clearTimeout(this.rightEdgeTimer),this.panFlag=!1;var e,n,i,r,s=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[Ie(ct,this._direction),Ie(lt,this._direction)]);e=s,n=this.observer.options.deceleration,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=Math.abs(i/-n),s=[e[0]/2*r,e[1]/2*r],this.observer.release(this,t,Se(this.axes,s))}},e.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},e.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),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}(),Re=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n.prevQuadrant=null,n.lastDiff=0,n}n(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=Pe.DIRECTION_ALL,this.axes=t},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?(this.observer.hold(this,t),this.onPanstart(t)):t.isFinal&&this.onPanend(t))},e.onPanstart=function(t){var e=this.element.getBoundingClientRect();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(t)},e.onPanmove=function(t){this.triggerChange(t)},e.onPanend=function(t){this.triggerChange(t),this.triggerAnimation(t)},e.triggerChange=function(t){var e=this.getAngle(t.center.x,t.center.y),n=this.getQuadrant(t.center.x,t.center.y),i=this.getDifference(this.prevAngle,e,this.prevQuadrant,n);this.prevAngle=e,this.prevQuadrant=n,0!==i&&(this.lastDiff=i,this.observer.change(this,t,Se(this.axes,[-i])))},e.triggerAnimation=function(t){var e=t.velocityX,n=t.velocityY,i=Math.sqrt(e*e+n*n)*(0<this.lastDiff?-1:1),r=i/2*Math.abs(i/-this.observer.options.deceleration);this.observer.release(this,t,Se(this.axes,[r*this.coefficientForDistanceToAngle]))},e.getDifference=function(t,e,n,i){return null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t},e.getPosFromOrigin=function(t,e){return{x:t-this.rotateOrigin[0],y:this.rotateOrigin[1]-e}},e.getAngle=function(t,e){var n=this.getPosFromOrigin(t,e),i=n.x,r=n.y,s=180*Math.atan2(r,i)/Math.PI;return s<0?360+s:s},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}(De),Ce=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._base=null,this._prev=null,this.pinchRecognizer=null,void 0===ne)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=h(t),this.options=m({scale:1,threshold:0,inputType:["touch","pointer"],hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},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){var e={threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[Oe];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=Me(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=Ae(this.element,m({inputClass:i},this.options.hammerManagerOptions)),this.element[Oe]=n}return this.pinchRecognizer=new oe(e),this.hammer.add(this.pinchRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null,this.dettachEvent()),this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[Oe],this.element=null,this.hammer=null},e.removeRecognizer=function(){this.hammer&&this.pinchRecognizer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null)},e.onPinchStart=function(t){this._base=this.observer.get(this)[this.axes[0]];var e=this.getOffset(t.scale);this.observer.hold(this,t),this.observer.change(this,t,Se(this.axes,[e])),this._prev=t.scale},e.onPinchMove=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,Se(this.axes,[e])),this._prev=t.scale},e.onPinchEnd=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,Se(this.axes,[e])),this.observer.release(this,t,Se(this.axes,[0]),0),this._base=null,this._prev=null},e.getOffset=function(t,e){return void 0===e&&(e=1),this._base*(t-e)*this.options.scale},e.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},e.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},e.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},t}(),ze=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=h(t),this.options=m({scale:1,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.dettachEvent(),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onWheel=function(t){var e=this;if(this._isEnabled&&(t.preventDefault(),0!==t.deltaY)){this._isHolded||(this.observer.hold(this,t),this._isHolded=!0);var n=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY));this.observer.change(this,t,Se(this.axes,[n])),clearTimeout(this._timer),this._timer=setTimeout(function(){e._isHolded&&(e._isHolded=!1,e.observer.release(e,t,Se(e.axes,[0])))},50)}},e.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}(),Fe=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=h(t),this.options=m({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.dettachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onKeydown=function(t){if(this._isEnabled){var e=!0,n=1,i=-1;switch(t.keyCode){case 37:case 65:n=-1;break;case 39:case 68:break;case 40:case 83:n=-1,i=1;break;case 38:case 87:i=1;break;default:e=!1}if((-1===i&&!this.axes[0]||1===i&&!this.axes[1])&&(e=!1),e){var r=-1===i?[+this.options.scale[0]*n,0]:[0,+this.options.scale[1]*n];this._isHolded||(this.observer.hold(this,event),this._isHolded=!0),clearTimeout(this._timer),this.observer.change(this,event,Se(this.axes,r))}}},e.onKeyup=function(t){var e=this;this._isHolded&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.release(e,t,Se(e.axes,[0,0])),e._isHolded=!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._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("keydown",this.onKeydown,!1),this.element.removeEventListener("keypress",this.onKeydown,!1),this.element.removeEventListener("keyup",this.onKeyup,!1),this._isEnabled=!1,this.observer=null},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}();return Pe.PanInput=De,Pe.RotatePanInput=Re,Pe.PinchInput=Ce,Pe.WheelInput=ze,Pe.MoveKeyInput=Fe,Pe}); | ||
!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=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])};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var m=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};function a(t){return void 0===t}var r,t=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var n=this._eventHandler[t]||[];if(!(0<n.length))return!0;n=n.concat(),e.eventType=t;var i=!1,r=[e],s=0;e.stop=function(){i=!0},e.currentTarget=this;for(var o=arguments.length,a=new Array(2<o?o-2:0),h=2;h<o;h++)a[h-2]=arguments[h];for(1<=a.length&&(r=r.concat(a)),s=0;n[s];s++)n[s].apply(this,r);return!i},e.once=function(r,s){if("object"==typeof r&&a(s)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof s){var o=this;this.on(r,function t(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];s.apply(o,n),o.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&a(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(a(t))return this._eventHandler={},this;if(a(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var n,i=t;for(n in i)this.off(n,i[n]);return this}var r,s,o=this._eventHandler[t];if(o)for(r=0;void 0!==(s=o[r]);r++)if(s===e){o=o.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}();function f(t,e,n,i){var r=t,s=[n[0]?e[0]:i?e[0]-i[0]:e[0],n[1]?e[1]:i?e[1]+i[1]:e[1]];return r=Math.max(s[0],r),r=Math.min(s[1],r)}function s(t,e){return t<e[0]||t>e[1]}function u(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function g(t,e,n){var i=t,r=e[0],s=e[1],o=s-r;return n[1]&&s<t&&(i=(i-s)%o+r),n[0]&&t<r&&(i=(i-r)%o+s),i}function o(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}function h(t,e){var n;if(void 0===e&&(e=!1),"string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=t,n=o(i.childNodes)}else n=o(document.querySelectorAll(t));e||(n=1<=n.length?n[0]:void 0)}else t===r?n=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in r&&t instanceof jQuery||t.constructor.prototype.jquery?n=e?t.toArray():t.get(0):Array.isArray(t)&&(n=t.map(function(t){return h(t)}),e||(n=1<=n.length?n[0]:void 0)):n=t;return n}var y=(r="undefined"==typeof window?{navigator:{userAgent:""}}:window).requestAnimationFrame||r.webkitRequestAnimationFrame,c=r.cancelAnimationFrame||r.webkitCancelAnimationFrame;if(y&&!c){var l={},d=y;y=function(e){var n=d(function(t){l[n]&&e(t)});return l[n]=!0,n},c=function(t){delete l[t]}}else y&&c||(y=function(t){return r.setTimeout(function(){t(r.performance&&r.performance.now&&r.performance.now()||(new Date).getTime())},16)},c=r.clearTimeout);function b(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function p(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function v(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function x(t,n){return v(t,function(t,e){return t===n[e]})}var E={};function w(t,e){var n,i;return E[e]||(E[e]=(i=(n=e)<1?Math.pow(10,T(n)):1,function(t){return 0===n?0:Math.round(Math.round(t/n)*n*i)/i})),E[e](t)}function P(t,n){if(!t||!n)return t;var i="number"==typeof n;return b(t,function(t,e){return w(t,i?n:n[e])})}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 _(t,e,n){return Math.max(Math.min(t,n),e)}var O=function(){function t(t){var e=t.options,n=t.itm,i=t.em,r=t.axm;this.options=e,this.itm=n,this.em=i,this.axm=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,o=this;if(void 0!==e)n=e;else{var i=b(t,function(t,e){return n=Math.abs(t-s[e]),i=o.options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r});n=Object.keys(i).reduce(function(t,e){return Math.max(t,i[e])},-1/0)}return _(n,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,n){var i=this.axm.get(),r=t,s=n&&n.event||null;return{depaPos:i,destPos:r,duration:_(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,r),inputEvent:s,input:n&&n.input||null,isTrusted:!!s,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var n=this.axm.get(t),i=this.axm.map(n,function(t,e){return g(t,e.range,e.circular)});v(i,function(t,e){return n[e]===t})||this.em.triggerChange(i,!1,n,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,c(r)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var r},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.axm.get(),n=this.axm.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e){return u(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axm.map(e,function(t,e){return g(t,e.range,e.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(!!t),this.axm.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.itm.setInterrupt(!1),this.em.triggerFinish(t)},e.animateLoop=function(r,s){if(r.duration){this._animateParam=m({},r);var h=this._animateParam,u=this,c=h.destPos,l=h.depaPos,f=0,d=b(l,function(t,e){return t<=c[e]?1:-1}),p=b(c,function(t){return t}),v=(new Date).getTime();h.startTime=v,function t(){u._raf=null;var e=(new Date).getTime(),o=(e-h.startTime)/r.duration,a=u.easing(o),n=u.axm.map(l,function(t,e,n){var i=1<=o?c[n]:t+h.delta[n]*(a-f),r=g(i,e.range,e.circular);if(i!==r){var s=d[n]*(e.range[1]-e.range[0]);c[n]-=s,l[n]-=s}return r}),i=!u.em.triggerChange(n,!1,l);if(l=n,v=e,1<=(f=a))return x(c=u.getFinalPos(c,p),u.axm.get(Object.keys(c)))||u.em.triggerChange(c,!0,l),void s();i?u.finish(!1):u._raf=y(t)}()}else this.em.triggerChange(r.destPos,!0),s()},e.getFinalPos=function(t,n){var i=this;return b(t,function(t,e){return t>=n[e]-1e-6&&t<=n[e]+1e-6?n[e]:w(t,i.getRoundUnit(t,e))})},e.getRoundUnit=function(t,e){var n,i=this.options.round,r=null;if(!i){var s=this.axm.getAxisOptions(e);n=Math.max(T(s.range[0]),T(s.range[1]),T(t)),r=1/Math.pow(10,n)}return r||i},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=_(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this,r=this.createAnimationParam(t,e,n),s=m({},r.depaPos),o=this.em.triggerAnimationStart(r),a=this.getUserControll(r);if(!o&&this.axm.every(a.destPos,function(t,e){return u(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!x(a.destPos,s)){var h=n&&n.event||null;this.animateLoop({depaPos:s,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(s,a.destPos),isTrusted:!!h,inputEvent:h,input:n&&n.input||null},function(){return i.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.grab(n);var i=this.axm.get(n);if(x(t,i))return this;this.itm.setInterrupt(!0);var r=p(t,function(t,e){return i[e]!==t});return Object.keys(r).length&&(x(r=this.axm.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:f(t,n,i)}),i)||(0<e?this.animateTo(r,e):(this.em.triggerChange(r),this.finish(!1)))),this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(b(this.axm.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},t}(),S=function(){function t(t){this.axes=t}var e=t.prototype;return e.triggerHold=function(t,e){var n=this.getRoundPos(t).roundPos;this.axes.trigger("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("release",t)},e.triggerChange=function(t,e,n,i,r){void 0===r&&(r=!1);var s=this.am,o=s.axm,a=s.getEventInfo(),h=this.getRoundPos(t,n),u=h.roundPos,c=h.roundDepa,l=o.moveTo(u,c),f=i&&i.event||a&&a.event||null,d={pos:l.pos,delta:l.delta,holding:r,inputEvent:f,isTrusted:!!f,input:i&&i.input||a&&a.input||null,set:f?this.createUserControll(l.pos):function(){}},p=this.axes.trigger("change",d);return f&&o.set(d.set().destPos),p},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("animationStart",t)},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this.axes.trigger("animationEnd",{isTrusted:t})},e.triggerFinish=function(t){void 0===t&&(t=!1),this.axes.trigger("finish",{isTrusted:t})},e.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:m({},t),duration:e};return function(t,e){return t&&(n.destPos=m({},t)),void 0!==e&&(n.duration=e),n}},e.setAnimationManager=function(t){this.am=t},e.destroy=function(){this.axes.off()},e.getRoundPos=function(t,e){var n=this.axes.options.round;return{roundPos:P(t,n),roundDepa:P(e,n)}},t}(),A=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}(),M=function(){function t(t,e){var n=this;this.axis=t,this.options=e,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._complementOptions=function(){var r=this;Object.keys(this.axis).forEach(function(i){r.axis[i]=m({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])})})},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},{}):m({},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?g(t,e.range,e.circular):0})),{pos:m({},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 v(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this.axis;return p(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!s(t,e.range)})},e.getAxisOptions=function(t){return this.axis[t]},t}(),I=function(){function t(t){var e=t.options,n=t.itm,i=t.em,r=t.axm,s=t.am;this.isOutside=!1,this.moveDistance=null,this.isStopped=!1,this.options=e,this.itm=n,this.em=i,this.axm=r,this.am=s}var e=t.prototype;return e.atOutside=function(t){var o=this;if(this.isOutside)return this.axm.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});var a=this.am.easing(1e-5)/1e-5;return this.axm.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-o.am.easing((n-t)/(r[0]*a))*r[0]:i<t?i+o.am.easing((t-i)/(r[1]*a))*r[1]:t})},e.get=function(t){return this.axm.get(t.axes)},e.hold=function(t,e){if(!this.itm.isInterrupted()&&t.axes.length){var n={input:t,event:e};this.isStopped=!1,this.itm.setInterrupt(!0),this.am.grab(t.axes,n),!this.moveDistance&&this.em.triggerHold(this.axm.get(),n),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes)}},e.change=function(t,e,n){if(!this.isStopped&&this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,r=this.moveDistance||this.axm.get(t.axes);i=b(r,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),this.isOutside&&this.axm.every(r,function(t,e){return!s(t,e.range)})&&(this.isOutside=!1),r=this.atOutside(r),i=this.atOutside(i),!this.em.triggerChange(i,!1,r,{input:t,event:e},!0)&&(this.isStopped=!0,this.moveDistance=null,this.am.finish(!1))}},e.release=function(t,e,n,i){if(!this.isStopped&&this.itm.isInterrupting()&&this.moveDistance){var r=this.axm.get(t.axes),s=this.axm.get(),o=this.axm.get(this.axm.map(n,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?r[n]+t:f(r[n]+t,e.range,e.circular,e.bounce)})),a=this.am.getDuration(o,r,i);0===a&&(o=m({},s));var h={depaPos:s,destPos:o,duration:a,delta:this.axm.getDelta(s,o),inputEvent:e,input:t,isTrusted:!0};this.em.triggerRelease(h),this.moveDistance=null;var u=this.am.getUserControll(h),c=x(u.destPos,s),l={input:t,event:e};c||0===u.duration?(!c&&this.em.triggerChange(u.destPos,!1,s,l,!0),this.itm.setInterrupt(!1),this.axm.isOutside()?this.am.restore(l):this.em.triggerFinish(!0)):this.am.animateTo(u.destPos,u.duration,l)}},t}();function D(){return(D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function R(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function C(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var z,F="function"!=typeof Object.assign?function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign,H=["","webkit","Moz","MS","ms","o"],e="undefined"==typeof document?{style:{}}:document.createElement("div"),Y="function",W=Math.round,X=Math.abs,k=Date.now;function j(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),s=0;s<H.length;){if((i=(n=H[s])?n+r:e)in t)return i;s++}}z="undefined"==typeof window?{}:window;var N=j(e.style,"touchAction"),L=void 0!==N;var q="compute",V="manipulation",U="none",B="pan-x",K="pan-y",Q=function(){if(!L)return!1;var e={},n=z.CSS&&z.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return e[t]=!n||z.CSS.supports("touch-action",t)}),e}(),G="ontouchstart"in z,J=void 0!==j(z,"PointerEvent"),Z=G&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),$="touch",tt="mouse",et=25,nt=1,it=4,rt=8,st=1,ot=2,at=4,ht=8,ut=16,ct=ot|at,lt=ht|ut,ft=ct|lt,dt=["x","y"],pt=["clientX","clientY"];function vt(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(void 0!==t.length)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function mt(t,e){return typeof t===Y?t.apply(e&&e[0]||void 0,e):t}function gt(t,e){return-1<t.indexOf(e)}var yt=function(){function t(t,e){this.manager=t,this.set(e)}var e=t.prototype;return e.set=function(t){t===q&&(t=this.compute()),L&&this.manager.element.style&&Q[t]&&(this.manager.element.style[N]=t),this.actions=t.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var e=[];return vt(this.manager.recognizers,function(t){mt(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(t){if(gt(t,U))return U;var e=gt(t,B),n=gt(t,K);return e&&n?U:e||n?e?B:K:gt(t,V)?V:"auto"}(e.join(" "))},e.preventDefaults=function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,r=gt(i,U)&&!Q[U],s=gt(i,K)&&!Q[K],o=gt(i,B)&&!Q[B];if(r){var a=1===t.pointers.length,h=t.distance<2,u=t.deltaTime<250;if(a&&h&&u)return}if(!o||!s)return r||s&&n&ct||o&&n<?this.preventSrc(e):void 0}},e.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},t}();function bt(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function xt(t){var e=t.length;if(1===e)return{x:W(t[0].clientX),y:W(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:W(n/e),y:W(i/e)}}function Et(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:W(t.pointers[n].clientX),clientY:W(t.pointers[n].clientY)},n++;return{timeStamp:k(),pointers:e,center:xt(e),deltaX:t.deltaX,deltaY:t.deltaY}}function wt(t,e,n){n||(n=dt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function Pt(t,e,n){n||(n=dt);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function Tt(t,e){return t===e?st:X(t)>=X(e)?t<0?ot:at:e<0?ht:ut}function _t(t,e,n){return{x:e/t||0,y:n/t||0}}function Ot(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=Et(e)),1<r&&!n.firstMultiple?n.firstMultiple=Et(e):1===r&&(n.firstMultiple=!1);var s,o,a,h,u,c,l=n.firstInput,f=n.firstMultiple,d=f?f.center:l.center,p=e.center=xt(i);e.timeStamp=k(),e.deltaTime=e.timeStamp-l.timeStamp,e.angle=Pt(d,p),e.distance=wt(d,p),s=n,a=(o=e).center,h=s.offsetDelta||{},u=s.prevDelta||{},c=s.prevInput||{},o.eventType!==nt&&c.eventType!==it||(u=s.prevDelta={x:c.deltaX||0,y:c.deltaY||0},h=s.offsetDelta={x:a.x,y:a.y}),o.deltaX=u.x+(a.x-h.x),o.deltaY=u.y+(a.y-h.y),e.offsetDirection=Tt(e.deltaX,e.deltaY);var v,m,g,y,b=_t(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=b.x,e.overallVelocityY=b.y,e.overallVelocity=X(b.x)>X(b.y)?b.x:b.y,e.scale=f?(v=f.pointers,wt((m=i)[0],m[1],pt)/wt(v[0],v[1],pt)):1,e.rotation=f?(g=f.pointers,Pt((y=i)[1],y[0],pt)+Pt(g[1],g[0],pt)):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,s,o=t.lastInterval||e,a=e.timeStamp-o.timeStamp;if(e.eventType!==rt&&(et<a||void 0===o.velocity)){var h=e.deltaX-o.deltaX,u=e.deltaY-o.deltaY,c=_t(a,h,u);i=c.x,r=c.y,n=X(c.x)>X(c.y)?c.x:c.y,s=Tt(h,u),t.lastInterval=e}else n=o.velocity,i=o.velocityX,r=o.velocityY,s=o.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=s}(n,e);var x=t.element;bt(e.srcEvent.target,x)&&(x=e.srcEvent.target),e.target=x}function St(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,s=e&nt&&i-r==0,o=e&(it|rt)&&i-r==0;n.isFirst=!!s,n.isFinal=!!o,s&&(t.session={}),n.eventType=e,Ot(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function At(t){return t.trim().split(/\s+/g)}function Mt(e,t,n){vt(At(t),function(t){e.addEventListener(t,n,!1)})}function It(e,t,n){vt(At(t),function(t){e.removeEventListener(t,n,!1)})}function Dt(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var Rt=function(){function t(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){mt(e.options.enable,[e])&&n.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&Mt(this.element,this.evEl,this.domHandler),this.evTarget&&Mt(this.target,this.evTarget,this.domHandler),this.evWin&&Mt(Dt(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&It(this.element,this.evEl,this.domHandler),this.evTarget&&It(this.target,this.evTarget,this.domHandler),this.evWin&&It(Dt(this.element),this.evWin,this.domHandler)},t}();function Ct(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}var zt={pointerdown:nt,pointermove:2,pointerup:it,pointercancel:rt,pointerout:rt},Ft={2:$,3:"pen",4:tt,5:"kinect"},Ht="pointerdown",Yt="pointermove pointerup pointercancel";z.MSPointerEvent&&!z.PointerEvent&&(Ht="MSPointerDown",Yt="MSPointerMove MSPointerUp MSPointerCancel");var Wt=function(n){function i(){var t,e=i.prototype;return e.evEl=Ht,e.evWin=Yt,(t=n.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return R(i,n),i.prototype.handler=function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=zt[i],s=Ft[t.pointerType]||t.pointerType,o=s===$,a=Ct(e,t.pointerId,"pointerId");r&nt&&(0===t.button||o)?a<0&&(e.push(t),a=e.length-1):r&(it|rt)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:s,srcEvent:t}),n&&e.splice(a,1))},i}(Rt);function Xt(t){return Array.prototype.slice.call(t,0)}function kt(t,n,e){for(var i=[],r=[],s=0;s<t.length;){var o=n?t[s][n]:t[s];Ct(r,o)<0&&i.push(t[s]),r[s]=o,s++}return e&&(i=n?i.sort(function(t,e){return t[n]>e[n]}):i.sort()),i}var jt={touchstart:nt,touchmove:2,touchend:it,touchcancel:rt},Nt=function(e){function n(){var t;return n.prototype.evTarget="touchstart touchmove touchend touchcancel",(t=e.apply(this,arguments)||this).targetIds={},t}return R(n,e),n.prototype.handler=function(t){var e=jt[t.type],n=function(t,e){var n,i,r=Xt(t.touches),s=this.targetIds;if(e&(2|nt)&&1===r.length)return s[r[0].identifier]=!0,[r,r];var o=Xt(t.changedTouches),a=[],h=this.target;if(i=r.filter(function(t){return bt(t.target,h)}),e===nt)for(n=0;n<i.length;)s[i[n].identifier]=!0,n++;n=0;for(;n<o.length;)s[o[n].identifier]&&a.push(o[n]),e&(it|rt)&&delete s[o[n].identifier],n++;return a.length?[kt(i.concat(a),"identifier",!0),a]:void 0}.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:$,srcEvent:t})},n}(Rt);var Lt={mousedown:nt,mousemove:2,mouseup:it},qt=function(n){function i(){var t,e=i.prototype;return e.evEl="mousedown",e.evWin="mousemove mouseup",(t=n.apply(this,arguments)||this).pressed=!1,t}return R(i,n),i.prototype.handler=function(t){var e=Lt[t.type];e&nt&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=it),this.pressed&&(e&it&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:tt,srcEvent:t}))},i}(Rt),Vt=2500,Ut=25;function Bt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY},i=this.lastTouches;this.lastTouches.push(n);setTimeout(function(){var t=i.indexOf(n);-1<t&&i.splice(t,1)},Vt)}}var Kt=function(){return function(n){function t(t,e){var s;return(s=n.call(this,t,e)||this).handler=function(t,e,n){var i=n.pointerType===$,r=n.pointerType===tt;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(t,e){t&nt?(this.primaryTouch=e.changedPointers[0].identifier,Bt.call(this,e)):t&(it|rt)&&Bt.call(this,e)}).call(C(C(s)),e,n);else if(r&&function(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],s=Math.abs(e-r.x),o=Math.abs(n-r.y);if(s<=Ut&&o<=Ut)return!0}return!1}.call(C(C(s)),n))return;s.callback(t,e,n)}},s.touch=new Nt(s.manager,s.handler),s.mouse=new qt(s.manager,s.handler),s.primaryTouch=null,s.lastTouches=[],s}return R(t,n),t.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},t}(Rt)}();function Qt(t,e,n){return!!Array.isArray(t)&&(vt(t,n[e],n),!0)}var Gt=1;function Jt(t,e){var n=e.manager;return n?n.get(t):t}function Zt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}var $t=function(){function t(t){void 0===t&&(t={}),this.options=D({enable:!0},t),this.id=Gt++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var e=t.prototype;return e.set=function(t){return F(this.options,t),this.manager&&this.manager.touchAction.update(),this},e.recognizeWith=function(t){if(Qt(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Jt(t,this)).id]||(e[t.id]=t).recognizeWith(this),this},e.dropRecognizeWith=function(t){return Qt(t,"dropRecognizeWith",this)||(t=Jt(t,this),delete this.simultaneous[t.id]),this},e.requireFailure=function(t){if(Qt(t,"requireFailure",this))return this;var e=this.requireFail;return-1===Ct(e,t=Jt(t,this))&&(e.push(t),t.requireFailure(this)),this},e.dropRequireFailure=function(t){if(Qt(t,"dropRequireFailure",this))return this;t=Jt(t,this);var e=Ct(this.requireFail,t);return-1<e&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return 0<this.requireFail.length},e.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},e.emit=function(e){var n=this,t=this.state;function i(t){n.manager.emit(t,e)}t<8&&i(n.options.event+Zt(t)),i(n.options.event),e.additionalEvent&&i(e.additionalEvent),8<=t&&i(n.options.event+Zt(t))},e.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=32},e.canEmit=function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},e.recognize=function(t){var e=F({},t);if(!mt(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},e.process=function(t){},e.getTouchAction=function(){},e.reset=function(){},t}(),te={domEvents:!1,touchAction:q,enable:!0,inputTarget:null,inputClass:null,preset:[],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function ee(n,i){var r,s=n.element;s.style&&(vt(n.options.cssProps,function(t,e){r=j(s.style,e),s.style[r]=i?(n.oldCssProps[r]=s.style[r],t):n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}var ne=function(){function t(t,e){var n,i=this;this.options=F({},te,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(J?Wt:Z?Nt:G?Kt:qt))(n,St),this.touchAction=new yt(this,this.options.touchAction),ee(this,!0),vt(this.options.recognizers,function(t){var e=i.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return F(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var s=0;s<i.length;)n=i[s],2===e.stopped||r&&n!==r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&14&n.state&&(r=e.curRecognizer=n),s++}},e.get=function(t){if(t instanceof $t)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event===t)return e[n];return null},e.add=function(t){if(Qt(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),(t.manager=this).touchAction.update(),t},e.remove=function(t){if(Qt(t,"remove",this))return this;var e=this.get(t);if(t){var n=this.recognizers,i=Ct(n,e);-1!==i&&(n.splice(i,1),this.touchAction.update())}return this},e.on=function(t,e){if(void 0===t||void 0===e)return this;var n=this.handlers;return vt(At(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this},e.off=function(t,e){if(void 0===t)return this;var n=this.handlers;return vt(At(t),function(t){e?n[t]&&n[t].splice(Ct(n[t],e),1):delete n[t]}),this},e.emit=function(t,e){var n,i,r;this.options.domEvents&&(n=t,i=e,(r=document.createEvent("Event")).initEvent(n,!0,!0),(r.gesture=i).target.dispatchEvent(r));var s=this.handlers[t]&&this.handlers[t].slice();if(s&&s.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var o=0;o<s.length;)s[o](e),o++}},e.destroy=function(){this.element&&ee(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},t}();var ie=function(e){function t(t){return void 0===t&&(t={}),e.call(this,D({pointers:1},t))||this}R(t,e);var n=t.prototype;return n.attrTest=function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},n.process=function(t){var e=this.state,n=t.eventType,i=6&e,r=this.attrTest(t);return i&&(n&rt||!r)?16|e:i||r?n&it?8|e:2&e?4|e:2:32},t}($t);function re(t){return t===ut?"down":t===ht?"up":t===ot?"left":t===at?"right":""}var se=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,D({event:"pan",threshold:10,pointers:1,direction:ft},t))||this).pX=null,e.pY=null,e}R(t,n);var e=t.prototype;return e.getTouchAction=function(){var t=this.options.direction,e=[];return t&ct&&e.push(K),t<&&e.push(B),e},e.directionTest=function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,s=t.deltaX,o=t.deltaY;return r&e.direction||(i=e.direction&ct?(r=0===s?st:s<0?ot:at,n=s!==this.pX,Math.abs(t.deltaX)):(r=0===o?st:o<0?ht:ut,n=o!==this.pY,Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},e.attrTest=function(t){return ie.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=re(t.direction);e&&(t.additionalEvent=this.options.event+e),n.prototype.emit.call(this,t)},t}(ie),oe=function(n){function t(t){return void 0===t&&(t={}),n.call(this,D({event:"pinch",threshold:0,pointers:2},t))||this}R(t,n);var e=t.prototype;return e.getTouchAction=function(){return[U]},e.attrTest=function(t){return n.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},e.emit=function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}n.prototype.emit.call(this,t)},t}(ie),ae="undefined"!=typeof window&&window||{},he=(ae.RegExp,ae.navigator),ue={browser:[{criteria:"PhantomJS",identity:"PhantomJS"},{criteria:/Whale/,identity:"Whale",versionSearch:"Whale"},{criteria:/Edge/,identity:"Edge",versionSearch:"Edge"},{criteria:/MSIE|Trident|Windows Phone/,identity:"IE",versionSearch:"IEMobile|MSIE|rv"},{criteria:/MiuiBrowser/,identity:"MIUI Browser",versionSearch:"MiuiBrowser"},{criteria:/SamsungBrowser/,identity:"Samsung Internet",versionSearch:"SamsungBrowser"},{criteria:/SAMSUNG /,identity:"Samsung Internet",versionSearch:"Version"},{criteria:/Chrome|CriOS/,identity:"Chrome"},{criteria:/Android/,identity:"Android Browser",versionSearch:"Version"},{criteria:/iPhone|iPad/,identity:"Safari",versionSearch:"Version"},{criteria:"Apple",identity:"Safari",versionSearch:"Version"},{criteria:"Firefox",identity:"Firefox"}],os:[{criteria:/Windows Phone/,identity:"Windows Phone",versionSearch:"Windows Phone"},{criteria:"Windows 2000",identity:"Window",versionAlias:"5.0"},{criteria:/Windows NT/,identity:"Window",versionSearch:"Windows NT"},{criteria:/iPhone|iPad/,identity:"iOS",versionSearch:"iPhone OS|CPU OS"},{criteria:"Mac",versionSearch:"OS X",identity:"MAC"},{criteria:/Android/,identity:"Android"},{criteria:/Tizen/,identity:"Tizen"},{criteria:/Web0S/,identity:"WebOS"}],webview:[{criteria:/iPhone|iPad/,browserVersionSearch:"Version",webviewBrowserVersion:/-1/},{criteria:/iPhone|iPad|Android/,webviewToken:/NAVER|DAUM|; wv/}],defaultString:{browser:{version:"-1",name:"unknown"},os:{version:"-1",name:"unknown"}}};function ce(t,e){for(var n=[],i=0;i<t.length;i++)e(t[i])&&n.push(t[i]);return n}var le=void 0;function fe(t,e){return e&&e.test?!!e.test(t):-1<t.indexOf(e)}function de(t,e){var n=ce(t,function(t){return fe(le,t.criteria)})[0];return n&&n.identity||e.name}function pe(t,i){return ce(t,function(t){var e=t.criteria,n=new RegExp(t.identity,"i").test(i);return!!(e?n&&fe(le,e):n)})[0]}function ve(t,e){var n=ue.defaultString.browser.version,i=new RegExp("("+t+")","i").exec(e);if(!i)return n;var r=i.index,s=i[0];if(-1<r){var o=r+s.length+1;n=e.substring(o).split(" ")[0].replace(/_/g,".").replace(/;|\)/g,"")}return n}function me(t){var e,n;if(t)return ve((e=t,(n=pe(ue.browser,e))||(n={criteria:e,versionSearch:e,identity:e}),n).versionSearch||t,le)}function ge(t){var e,n=(e=t,pe(ue.os,e)||{}),i=ue.defaultString.os.version,r=void 0;if(t){if(n.versionAlias)return n.versionAlias;var s=n.versionSearch||t,o=new RegExp("("+s+")\\s([\\d_\\.]+|\\d_0)","i");return o.exec(le)&&(r=o.exec(le)[2].replace(/_/g,".").replace(/;|\)/g,"")),r||i}}function ye(){var t=de(ue.os,ue.defaultString.os);return{name:t,version:ge(t)}}function be(){var t,e,n=de(ue.browser,ue.defaultString.browser);return{name:n,version:me(n),webview:(t=ue.webview,e=void 0,function(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return!0;return!1}(ce(t,function(t){return fe(le,t.criteria)}),function(t){return e=ve(t.browserVersionSearch,le),!(!fe(le,t.webviewToken)&&!fe(e,t.webviewBrowserVersion))}))}}function xe(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:he.userAgent;le=t;var e={os:ye(),browser:be(),isMobile:-1!==le.indexOf("Mobi")};return e.browser.name=e.browser.name.toLowerCase(),e.os.name=e.os.name.toLowerCase(),e.os.version=e.os.version.toLowerCase(),"ios"===e.os.name&&e.browser.webview&&(e.browser.version="-1"),e}xe.VERSION="2.1.5";var Ee="ontouchstart"in r&&-1<xe(r.navigator.userAgent).browser.name.indexOf("safari"),we=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""}(),Pe=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={});var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=m({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null},e),i.itm=new A(i.options),i.axm=new M(i.axis,i.options),i.em=new S(i),i.am=new O(i),i.io=new I(i),i.em.setAnimationManager(i.am),n&&i.em.triggerChange(n),i}n(t,r);var e=t.prototype;return e.connect=function(t,e){var n;if(n="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e),"hammer"in e){var i=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});i.length&&(e.hammer=i[0].hammer)}return e.mapAxes(n),e.connect(this.io),this._inputs.push(e),this},e.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);0<=e&&(this._inputs[e].disconnect(),this._inputs.splice(e,1))}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},e.get=function(t){return this.axm.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.am.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.am.setBy(t,e),this},e.isBounceArea=function(t){return this.axm.isOutside(t)},e.destroy=function(){this.disconnect(),this.em.destroy()},t.VERSION="2.6.1",t.TRANSFORM=we,t.DIRECTION_NONE=st,t.DIRECTION_LEFT=ot,t.DIRECTION_RIGHT=at,t.DIRECTION_UP=ht,t.DIRECTION_DOWN=ut,t.DIRECTION_HORIZONTAL=ct,t.DIRECTION_VERTICAL=lt,t.DIRECTION_ALL=ft,t}(t),Te="PointerEvent"in r||"MSPointerEvent"in r,_e="ontouchstart"in r,Oe="_EGJS_AXES_INPUTTYPE_";function Se(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function Ae(t,e){try{return new ne(t,m({},e))}catch(t){return null}}function Me(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=_e;break;case"pointer":i=Te}}),i?Wt:e&&n?Kt:e?Nt:n?qt:null}function Ie(t,e,n){return n?!!(e===ft||e&t&&n&t):!!(e&t)}var De=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this.panRecognizer=null,this.isRightEdge=!1,this.rightEdgeTimer=0,this.panFlag=!1,void 0===ne)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=h(t),this.options=m({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onHammerInput=this.onHammerInput.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?ft:e?ct:n?lt:st,this.axes=t},e.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[Oe];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=Me(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=Ae(this.element,m({inputClass:i},this.options.hammerManagerOptions)),this.element[Oe]=n}return this.panRecognizer=new se(e),this.hammer.add(this.panRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&this.dettachEvent(),this._direction=st,this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[Oe],this.element=null,this.hammer=null},e.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},e.removeRecognizer=function(){this.hammer&&this.panRecognizer&&(this.hammer.remove(this.panRecognizer),this.panRecognizer=null)},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?(this.panFlag=!1)!==t.srcEvent.cancelable&&(this.observer.hold(this,t),this.isRightEdge=Ee&&t.center.x>window.innerWidth-30,this.panFlag=!0):t.isFinal&&this.onPanend(t))},e.onPanmove=function(t){var e=this;if(this.panFlag){var n=function(t,e){if(e<0||90<e)return st;var n=Math.abs(t);return e<n&&n<180-e?lt:ct}(t.angle,this.options.thresholdAngle),i=this.hammer.session.prevInput;if(i&&Ee){if(t.center.x<0)return void this.onPanend(m({},i,{velocityX:0,velocityY:0,offsetX:0,offsetY:0}));this.isRightEdge&&(clearTimeout(this.rightEdgeTimer),t.deltaX<-30?this.isRightEdge=!1:this.rightEdgeTimer=window.setTimeout(function(){e.onPanend(m({},i,{velocityX:0,velocityY:0,offsetX:0,offsetY:0}))},100))}t.offsetY=i?(t.offsetX=t.deltaX-i.deltaX,t.deltaY-i.deltaY):t.offsetX=0;var r=this.getOffset([t.offsetX,t.offsetY],[Ie(ct,this._direction,n),Ie(lt,this._direction,n)]),s=r.some(function(t){return 0!==t});if(s){var o=t.srcEvent;!1!==o.cancelable&&o.preventDefault(),o.stopPropagation()}(t.preventSystemEvent=s)&&this.observer.change(this,t,Se(this.axes,r))}},e.onPanend=function(t){if(this.panFlag){clearTimeout(this.rightEdgeTimer),this.panFlag=!1;var e,n,i,r,s=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[Ie(ct,this._direction),Ie(lt,this._direction)]);e=s,n=this.observer.options.deceleration,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=Math.abs(i/-n),s=[e[0]/2*r,e[1]/2*r],this.observer.release(this,t,Se(this.axes,s))}},e.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},e.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),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}(),Re=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n.prevQuadrant=null,n.lastDiff=0,n}n(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=Pe.DIRECTION_ALL,this.axes=t},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?(this.observer.hold(this,t),this.onPanstart(t)):t.isFinal&&this.onPanend(t))},e.onPanstart=function(t){var e=this.element.getBoundingClientRect();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(t)},e.onPanmove=function(t){this.triggerChange(t)},e.onPanend=function(t){this.triggerChange(t),this.triggerAnimation(t)},e.triggerChange=function(t){var e=this.getAngle(t.center.x,t.center.y),n=this.getQuadrant(t.center.x,t.center.y),i=this.getDifference(this.prevAngle,e,this.prevQuadrant,n);this.prevAngle=e,this.prevQuadrant=n,0!==i&&(this.lastDiff=i,this.observer.change(this,t,Se(this.axes,[-i])))},e.triggerAnimation=function(t){var e=t.velocityX,n=t.velocityY,i=Math.sqrt(e*e+n*n)*(0<this.lastDiff?-1:1),r=i/2*Math.abs(i/-this.observer.options.deceleration);this.observer.release(this,t,Se(this.axes,[r*this.coefficientForDistanceToAngle]))},e.getDifference=function(t,e,n,i){return null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t},e.getPosFromOrigin=function(t,e){return{x:t-this.rotateOrigin[0],y:this.rotateOrigin[1]-e}},e.getAngle=function(t,e){var n=this.getPosFromOrigin(t,e),i=n.x,r=n.y,s=180*Math.atan2(r,i)/Math.PI;return s<0?360+s:s},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}(De),Ce=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._base=null,this._prev=null,this.pinchRecognizer=null,void 0===ne)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=h(t),this.options=m({scale:1,threshold:0,inputType:["touch","pointer"],hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},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){var e={threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[Oe];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=Me(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=Ae(this.element,m({inputClass:i},this.options.hammerManagerOptions)),this.element[Oe]=n}return this.pinchRecognizer=new oe(e),this.hammer.add(this.pinchRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null,this.dettachEvent()),this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[Oe],this.element=null,this.hammer=null},e.removeRecognizer=function(){this.hammer&&this.pinchRecognizer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null)},e.onPinchStart=function(t){this._base=this.observer.get(this)[this.axes[0]];var e=this.getOffset(t.scale);this.observer.hold(this,t),this.observer.change(this,t,Se(this.axes,[e])),this._prev=t.scale},e.onPinchMove=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,Se(this.axes,[e])),this._prev=t.scale},e.onPinchEnd=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,Se(this.axes,[e])),this.observer.release(this,t,Se(this.axes,[0]),0),this._base=null,this._prev=null},e.getOffset=function(t,e){return void 0===e&&(e=1),this._base*(t-e)*this.options.scale},e.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},e.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},e.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},t}(),ze=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=h(t),this.options=m({scale:1,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.dettachEvent(),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onWheel=function(t){var e=this;if(this._isEnabled&&(t.preventDefault(),0!==t.deltaY)){this._isHolded||(this.observer.hold(this,t),this._isHolded=!0);var n=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY));this.observer.change(this,t,Se(this.axes,[n])),clearTimeout(this._timer),this._timer=setTimeout(function(){e._isHolded&&(e._isHolded=!1,e.observer.release(e,t,Se(e.axes,[0])))},50)}},e.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}(),Fe=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=h(t),this.options=m({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.dettachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onKeydown=function(t){if(this._isEnabled){var e=!0,n=1,i=-1;switch(t.keyCode){case 37:case 65:n=-1;break;case 39:case 68:break;case 40:case 83:n=-1,i=1;break;case 38:case 87:i=1;break;default:e=!1}if((-1===i&&!this.axes[0]||1===i&&!this.axes[1])&&(e=!1),e){var r=-1===i?[+this.options.scale[0]*n,0]:[0,+this.options.scale[1]*n];this._isHolded||(this.observer.hold(this,event),this._isHolded=!0),clearTimeout(this._timer),this.observer.change(this,event,Se(this.axes,r))}}},e.onKeyup=function(t){var e=this;this._isHolded&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.release(e,t,Se(e.axes,[0,0])),e._isHolded=!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._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("keydown",this.onKeydown,!1),this.element.removeEventListener("keypress",this.onKeydown,!1),this.element.removeEventListener("keyup",this.onKeyup,!1),this._isEnabled=!1,this.observer=null},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}();return Pe.PanInput=De,Pe.RotatePanInput=Re,Pe.PinchInput=Ce,Pe.WheelInput=ze,Pe.MoveKeyInput=Fe,Pe}); | ||
//# sourceMappingURL=axes.pkgd.min.js.map |
@@ -14,3 +14,3 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
} | ||
var AnimationManager = (function () { | ||
var AnimationManager = /** @class */ (function () { | ||
function AnimationManager(_a) { | ||
@@ -83,2 +83,3 @@ var options = _a.options, itm = _a.itm, em = _a.em, axm = _a.axm; | ||
this._animateParam = null; | ||
// for Circular | ||
var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) { return isCircularable(v, opt.range, opt.circular); }); | ||
@@ -123,4 +124,8 @@ Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) { return getCirculatedPos(v, opt.range, opt.circular); })); | ||
: pos + info_1.delta[key] * (easingPer - prevEasingPer_1); | ||
// Subtract distance from distance already moved. | ||
// Recalculate the remaining distance. | ||
// Fix the bouncing phenomenon by changing the range. | ||
var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular); | ||
if (nextPos !== circulatedPos) { | ||
// circular | ||
var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]); | ||
@@ -148,2 +153,3 @@ destPos_1[key] -= rangeOffset; | ||
else { | ||
// animationEnd | ||
self_1._raf = requestAnimationFrame(loop); | ||
@@ -158,10 +164,24 @@ } | ||
}; | ||
/** | ||
* Get estimated final value. | ||
* | ||
* If destPos is within the 'error range' of the original intended position, the initial intended position is returned. | ||
* - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100; | ||
* If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos. | ||
* - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123 | ||
* | ||
* @param originalIntendedPos | ||
* @param destPos | ||
*/ | ||
AnimationManager.prototype.getFinalPos = function (destPos, originalIntendedPos) { | ||
var _this = this; | ||
// compare destPos and originalIntendedPos | ||
var ERROR_LIMIT = 0.000001; | ||
var finalPos = map(destPos, function (value, key) { | ||
if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) { | ||
// In error range, return original intended | ||
return originalIntendedPos[key]; | ||
} | ||
else { | ||
// Out of error range, return rounded pos. | ||
var roundUnit = _this.getRoundUnit(value, key); | ||
@@ -175,5 +195,7 @@ var result = roundNumber(value, roundUnit); | ||
AnimationManager.prototype.getRoundUnit = function (val, key) { | ||
var roundUnit = this.options.round; | ||
var minRoundUnit = null; | ||
var roundUnit = this.options.round; // manual mode | ||
var minRoundUnit = null; // auto mode | ||
// auto mode | ||
if (!roundUnit) { | ||
// Get minimum round unit | ||
var options = this.axm.getAxisOptions(key); | ||
@@ -195,3 +217,5 @@ minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val))); | ||
var retTrigger = this.em.triggerAnimationStart(param); | ||
// to control | ||
var userWish = this.getUserControll(param); | ||
// You can't stop the 'animationStart' event when 'circular' is true. | ||
if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) { return isCircularable(v, opt.range, opt.circular); })) { | ||
@@ -198,0 +222,0 @@ console.warn("You can't stop the 'animation' event when 'circular' is true."); |
@@ -26,3 +26,95 @@ var __extends = (this && this.__extends) || (function () { | ||
import { TRANSFORM, DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL } from "./const"; | ||
var Axes = (function (_super) { | ||
/** | ||
* @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. | ||
* @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. | ||
* @property {Number[]} [range] The coordinate of range <ko>좌표 범위</ko> | ||
* @property {Number} [range.0=0] The coordinate of the minimum <ko>최소 좌표</ko> | ||
* @property {Number} [range.1=0] The coordinate of the maximum <ko>최대 좌표</ko> | ||
* @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area<ko>바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다</ko> | ||
* @property {Number} [bounce.0=0] The size of coordinate of the minimum area <ko>최소 좌표 바운스 영역의 크기</ko> | ||
* @property {Number} [bounce.1=0] The size of coordinate of the maximum area <ko>최대 좌표 바운스 영역의 크기</ko> | ||
* @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to "true" and an element is dragged outside the coordinate area, the element will appear on the other side.<ko>순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다</ko> | ||
* @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum <ko>최소 좌표 방향의 순환 여부</ko> | ||
* @property {Boolean} [circular.1=false] Indicates whether to circulate to the coordinate of the maximum <ko>최대 좌표 방향의 순환 여부</ko> | ||
**/ | ||
/** | ||
* @typedef {Object} AxesOption The option object of the eg.Axes module | ||
* @ko eg.Axes 모듈의 옵션 객체 | ||
* @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation <ko>애니메이션에 적용할 easing 함수</ko> | ||
* @property {Number} [maximumDuration=Infinity] Maximum duration of the animation <ko>가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간</ko> | ||
* @property {Number} [minimumDuration=0] Minimum duration of the animation <ko>가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간</ko> | ||
* @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. <ko>사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다</ko> | ||
* @property {Boolean} [interruptable=true] Indicates whether an animation is interruptible.<br>- true: It can be paused or stopped by user action or the API.<br>- false: It cannot be paused or stopped by user action or the API while it is running.<ko>진행 중인 애니메이션 중지 가능 여부.<br>- true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다.<br>- false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다</ko> | ||
* @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95) <br>[Details](https://github.com/naver/egjs-axes/wiki/round-option)<ko>반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95).<br>[상세내용](https://github.com/naver/egjs-axes/wiki/round-option)</ko> | ||
**/ | ||
/** | ||
* @class eg.Axes | ||
* @classdesc 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. | ||
* @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다. | ||
* @extends eg.Component | ||
* | ||
* @param {Object.<string, AxisOption>} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. <ko>eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.</ko> | ||
* @param {AxesOption} [options] The option object of the eg.Axes module<ko>eg.Axes 모듈의 옵션 객체</ko> | ||
* @param {Object.<string, number>} [startPos] The coordinates to be moved when creating an instance. not triggering change event.<ko>인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음.</ko> | ||
* | ||
* @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} | ||
* @example | ||
* | ||
* // 1. Initialize eg.Axes | ||
* const axes = new eg.Axes({ | ||
* something1: { | ||
* range: [0, 150], | ||
* bounce: 50 | ||
* }, | ||
* something2: { | ||
* range: [0, 200], | ||
* bounce: 100 | ||
* }, | ||
* somethingN: { | ||
* range: [1, 10], | ||
* } | ||
* }, { | ||
* deceleration : 0.0024 | ||
* }); | ||
* | ||
* // 2. attach event handler | ||
* axes.on({ | ||
* "hold" : function(evt) { | ||
* }, | ||
* "release" : function(evt) { | ||
* }, | ||
* "animationStart" : function(evt) { | ||
* }, | ||
* "animationEnd" : function(evt) { | ||
* }, | ||
* "change" : function(evt) { | ||
* } | ||
* }); | ||
* | ||
* // 3. Initialize inputTypes | ||
* const panInputArea = new eg.Axes.PanInput("#area", { | ||
* scale: [0.5, 1] | ||
* }); | ||
* const panInputHmove = new eg.Axes.PanInput("#hmove"); | ||
* const panInputVmove = new eg.Axes.PanInput("#vmove"); | ||
* const pinchInputArea = new eg.Axes.PinchInput("#area", { | ||
* scale: 1.5 | ||
* }); | ||
* | ||
* // 4. Connect eg.Axes and InputTypes | ||
* // [PanInput] When the mouse or touchscreen is down and moved. | ||
* // Connect the 'something2' axis to the mouse or touchscreen x position and | ||
* // connect the 'somethingN' axis to the mouse or touchscreen y position. | ||
* axes.connect(["something2", "somethingN"], panInputArea); // or axes.connect("something2 somethingN", panInputArea); | ||
* | ||
* // Connect only one 'something1' axis to the mouse or touchscreen x position. | ||
* axes.connect(["something1"], panInputHmove); // or axes.connect("something1", panInputHmove); | ||
* | ||
* // Connect only one 'something2' axis to the mouse or touchscreen y position. | ||
* axes.connect(["", "something2"], panInputVmove); // or axes.connect(" something2", panInputVmove); | ||
* | ||
* // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). | ||
* axes.connect("something2", pinchInputArea); | ||
*/ | ||
var Axes = /** @class */ (function (_super) { | ||
__extends(Axes, _super); | ||
@@ -54,2 +146,26 @@ function Axes(axis, options, startPos) { | ||
} | ||
/** | ||
* Connect the axis of eg.Axes to the inputType. | ||
* @ko eg.Axes의 축과 inputType을 연결한다 | ||
* @method eg.Axes#connect | ||
* @param {(String[]|String)} axes The name of the axis to associate with inputType <ko>inputType과 연결할 축의 이름</ko> | ||
* @param {Object} inputType The inputType instance to associate with the axis of eg.Axes <ko>eg.Axes의 축과 연결할 inputType 인스턴스<ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* } | ||
* }); | ||
* | ||
* axes.connect("x", new eg.Axes.PanInput("#area1")) | ||
* .connect("x xOther", new eg.Axes.PanInput("#area2")) | ||
* .connect(" xOther", new eg.Axes.PanInput("#area3")) | ||
* .connect(["x"], new eg.Axes.PanInput("#area4")) | ||
* .connect(["xOther", "x"], new eg.Axes.PanInput("#area5")) | ||
* .connect(["", "xOther"], new eg.Axes.PanInput("#area6")); | ||
*/ | ||
Axes.prototype.connect = function (axes, inputType) { | ||
@@ -63,5 +179,7 @@ var mapped; | ||
} | ||
// check same instance | ||
if (~this._inputs.indexOf(inputType)) { | ||
this.disconnect(inputType); | ||
} | ||
// check same element in hammer type for share | ||
if ("hammer" in inputType) { | ||
@@ -78,2 +196,29 @@ var targets = this._inputs.filter(function (v) { return v.hammer && v.element === inputType.element; }); | ||
}; | ||
/** | ||
* Disconnect the axis of eg.Axes from the inputType. | ||
* @ko eg.Axes의 축과 inputType의 연결을 끊는다. | ||
* @method eg.Axes#disconnect | ||
* @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes <ko>eg.Axes의 축과 연결한 inputType 인스턴스<ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* } | ||
* }); | ||
* | ||
* const input1 = new eg.Axes.PanInput("#area1"); | ||
* const input2 = new eg.Axes.PanInput("#area2"); | ||
* const input3 = new eg.Axes.PanInput("#area3"); | ||
* | ||
* axes.connect("x", input1); | ||
* .connect("x xOther", input2) | ||
* .connect(["xOther", "x"], input3); | ||
* | ||
* axes.disconnect(input1); // disconnects input1 | ||
* axes.disconnect(); // disconnects all of them | ||
*/ | ||
Axes.prototype.disconnect = function (inputType) { | ||
@@ -93,5 +238,55 @@ if (inputType) { | ||
}; | ||
/** | ||
* Returns the current position of the coordinates. | ||
* @ko 좌표의 현재 위치를 반환한다 | ||
* @method eg.Axes#get | ||
* @param {Object} [axes] The names of the axis <ko>축 이름들</ko> | ||
* @return {Object.<string, number>} Axis coordinate information <ko>축 좌표 정보</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }); | ||
* | ||
* axes.get(); // {"x": 0, "xOther": -100, "zoom": 50} | ||
* axes.get(["x", "zoom"]); // {"x": 0, "zoom": 50} | ||
*/ | ||
Axes.prototype.get = function (axes) { | ||
return this.axm.get(axes); | ||
}; | ||
/** | ||
* Moves an axis to specific coordinates. | ||
* @ko 좌표를 이동한다. | ||
* @method eg.Axes#setTo | ||
* @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko> | ||
* @param {Number} [duration=0] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }); | ||
* | ||
* axes.setTo({"x": 30, "zoom": 60}); | ||
* axes.get(); // {"x": 30, "xOther": -100, "zoom": 60} | ||
* | ||
* axes.setTo({"x": 100, "xOther": 60}, 1000); // animatation | ||
* | ||
* // after 1000 ms | ||
* axes.get(); // {"x": 100, "xOther": 60, "zoom": 60} | ||
*/ | ||
Axes.prototype.setTo = function (pos, duration) { | ||
@@ -102,2 +297,30 @@ if (duration === void 0) { duration = 0; } | ||
}; | ||
/** | ||
* Moves an axis from the current coordinates to specific coordinates. | ||
* @ko 현재 좌표를 기준으로 좌표를 이동한다. | ||
* @method eg.Axes#setBy | ||
* @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko> | ||
* @param {Number} [duration=0] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }); | ||
* | ||
* axes.setBy({"x": 30, "zoom": 10}); | ||
* axes.get(); // {"x": 30, "xOther": -100, "zoom": 60} | ||
* | ||
* axes.setBy({"x": 70, "xOther": 60}, 1000); // animatation | ||
* | ||
* // after 1000 ms | ||
* axes.get(); // {"x": 100, "xOther": -40, "zoom": 60} | ||
*/ | ||
Axes.prototype.setBy = function (pos, duration) { | ||
@@ -108,5 +331,33 @@ if (duration === void 0) { duration = 0; } | ||
}; | ||
/** | ||
* Returns whether there is a coordinate in the bounce area of the target axis. | ||
* @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다 | ||
* @method eg.Axes#isBounceArea | ||
* @param {Object} [axes] The names of the axis <ko>축 이름들</ko> | ||
* @return {Boolen} Whether the bounce area exists. <ko>bounce 영역 존재 여부</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }); | ||
* | ||
* axes.isBounceArea(["x"]); | ||
* axes.isBounceArea(["x", "zoom"]); | ||
* axes.isBounceArea(); | ||
*/ | ||
Axes.prototype.isBounceArea = function (axes) { | ||
return this.axm.isOutside(axes); | ||
}; | ||
/** | ||
* Destroys properties, and events used in a module and disconnect all connections to inputTypes. | ||
* @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다. | ||
* @method eg.Axes#destroy | ||
*/ | ||
Axes.prototype.destroy = function () { | ||
@@ -116,11 +367,71 @@ this.disconnect(); | ||
}; | ||
/** | ||
* Version info string | ||
* @ko 버전정보 문자열 | ||
* @name VERSION | ||
* @static | ||
* @type {String} | ||
* @example | ||
* eg.Axes.VERSION; // ex) 3.3.3 | ||
* @memberof eg.Axes | ||
*/ | ||
Axes.VERSION = "#__VERSION__#"; | ||
/** | ||
* @name eg.Axes.TRANSFORM | ||
* @desc Returns the transform attribute with CSS vendor prefixes. | ||
* @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다. | ||
* | ||
* @constant | ||
* @type {String} | ||
* @example | ||
* eg.Axes.TRANSFORM; // "transform" or "webkitTransform" | ||
*/ | ||
Axes.TRANSFORM = TRANSFORM; | ||
/** | ||
* @name eg.Axes.DIRECTION_NONE | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
Axes.DIRECTION_NONE = DIRECTION_NONE; | ||
/** | ||
* @name eg.Axes.DIRECTION_LEFT | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
Axes.DIRECTION_LEFT = DIRECTION_LEFT; | ||
/** | ||
* @name eg.Axes.DIRECTION_RIGHT | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
Axes.DIRECTION_RIGHT = DIRECTION_RIGHT; | ||
/** | ||
* @name eg.Axes.DIRECTION_UP | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
Axes.DIRECTION_UP = DIRECTION_UP; | ||
/** | ||
* @name eg.Axes.DIRECTION_DOWN | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
Axes.DIRECTION_DOWN = DIRECTION_DOWN; | ||
/** | ||
* @name eg.Axes.DIRECTION_HORIZONTAL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; | ||
/** | ||
* @name eg.Axes.DIRECTION_VERTICAL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL; | ||
/** | ||
* @name eg.Axes.DIRECTION_ALL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
Axes.DIRECTION_ALL = DIRECTION_ALL; | ||
@@ -127,0 +438,0 @@ return Axes; |
@@ -11,3 +11,3 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
import { map, filter, every } from "./utils"; | ||
var AxisManager = (function () { | ||
var AxisManager = /** @class */ (function () { | ||
function AxisManager(axis, options) { | ||
@@ -23,2 +23,6 @@ var _this = this; | ||
} | ||
/** | ||
* set up 'css' expression | ||
* @private | ||
*/ | ||
AxisManager.prototype._complementOptions = function () { | ||
@@ -25,0 +29,0 @@ var _this = this; |
@@ -0,3 +1,5 @@ | ||
/* eslint-disable no-new-func, no-nested-ternary */ | ||
var win; | ||
if (typeof window === "undefined") { | ||
// window is undefined in node.js | ||
win = { | ||
@@ -12,3 +14,4 @@ navigator: { | ||
} | ||
/* eslint-enable no-new-func, no-nested-ternary */ | ||
export { win as window }; | ||
//# sourceMappingURL=browser.js.map |
@@ -0,1 +1,9 @@ | ||
// export const DIRECTION_NONE = 1; | ||
// export const DIRECTION_LEFT = 2; | ||
// export const DIRECTION_RIGHT = 4; | ||
// export const DIRECTION_HORIZONTAL = 2 | 4; | ||
// export const DIRECTION_UP = 8; | ||
// export const DIRECTION_DOWN = 16; | ||
// export const DIRECTION_VERTICAL = 8 | 16; | ||
// export const DIRECTION_ALL = 2 | 4 | 8 | 16; | ||
export { DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, } from "@egjs/hammerjs"; | ||
@@ -2,0 +10,0 @@ import getAgent from "@egjs/agent"; |
@@ -11,2 +11,3 @@ export function getInsidePosition(destPos, range, circular, bounce) { | ||
} | ||
// determine outside | ||
export function isOutside(pos, range) { | ||
@@ -17,2 +18,3 @@ return pos < range[0] || pos > range[1]; | ||
var duration = Math.sqrt(distance / deceleration * 2); | ||
// when duration is under 100, then value is zero | ||
return duration < 100 ? 0 : duration; | ||
@@ -29,6 +31,6 @@ } | ||
var length = max - min; | ||
if (circular[1] && pos > max) { | ||
if (circular[1] && pos > max) { // right | ||
toPos = (toPos - max) % length + min; | ||
} | ||
if (circular[0] && pos < min) { | ||
if (circular[0] && pos < min) { // left | ||
toPos = (toPos - min) % length + max; | ||
@@ -35,0 +37,0 @@ } |
@@ -10,6 +10,32 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
import { roundNumbers } from "./utils"; | ||
var EventManager = (function () { | ||
var EventManager = /** @class */ (function () { | ||
function EventManager(axes) { | ||
this.axes = axes; | ||
} | ||
/** | ||
* This event is fired when a user holds an element on the screen of the device. | ||
* @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 | ||
* @name eg.Axes#hold | ||
* @event | ||
* @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @property {Object.<string, number>} pos coordinate <ko>좌표 정보</ko> | ||
* @property {Object} input The instance of inputType where the event occurred<ko>이벤트가 발생한 inputType 인스턴스</ko> | ||
* @property {Object} inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko> | ||
* @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko> | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("hold", function(event) { | ||
* // event.pos | ||
* // event.input | ||
* // event.inputEvent | ||
* // isTrusted | ||
* }); | ||
*/ | ||
EventManager.prototype.triggerHold = function (pos, option) { | ||
@@ -24,2 +50,73 @@ var roundPos = this.getRoundPos(pos).roundPos; | ||
}; | ||
/** | ||
* Specifies the coordinates to move after the 'change' event. It works when the holding value of the change event is true. | ||
* @ko 'change' 이벤트 이후 이동할 좌표를 지정한다. change이벤트의 holding 값이 true일 경우에 동작한다 | ||
* @name set | ||
* @function | ||
* @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("change", function(event) { | ||
* event.holding && event.set({x: 10}); | ||
* }); | ||
*/ | ||
/** Specifies the animation coordinates to move after the 'release' or 'animationStart' events. | ||
* @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다. | ||
* @name setTo | ||
* @function | ||
* @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko> | ||
* @param {Number} [duration] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("animationStart", function(event) { | ||
* event.setTo({x: 10}, 2000); | ||
* }); | ||
*/ | ||
/** | ||
* This event is fired when a user release an element on the screen of the device. | ||
* @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 | ||
* @name eg.Axes#release | ||
* @event | ||
* @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @property {Object.<string, number>} depaPos The coordinates when releasing an element<ko>손을 뗐을 때의 좌표 </ko> | ||
* @property {Object.<string, number>} destPos The coordinates to move to after releasing an element<ko>손을 뗀 뒤에 이동할 좌표</ko> | ||
* @property {Object.<string, number>} delta The movement variation of coordinate <ko>좌표의 변화량</ko> | ||
* @property {Object} inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko> | ||
* @property {Object} input The instance of inputType where the event occurred<ko>이벤트가 발생한 inputType 인스턴스</ko> | ||
* @property {setTo} setTo Specifies the animation coordinates to move after the event <ko>이벤트 이후 이동할 애니메이션 좌표를 지정한다</ko> | ||
* @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko> | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("release", function(event) { | ||
* // event.depaPos | ||
* // event.destPos | ||
* // event.delta | ||
* // event.input | ||
* // event.inputEvent | ||
* // event.setTo | ||
* // event.isTrusted | ||
* | ||
* // if you want to change the animation coordinates to move after the 'release' event. | ||
* event.setTo({x: 10}, 2000); | ||
* }); | ||
*/ | ||
EventManager.prototype.triggerRelease = function (param) { | ||
@@ -32,2 +129,38 @@ var _a = this.getRoundPos(param.destPos, param.depaPos), roundPos = _a.roundPos, roundDepa = _a.roundDepa; | ||
}; | ||
/** | ||
* This event is fired when coordinate changes. | ||
* @ko 좌표가 변경됐을 때 발생하는 이벤트 | ||
* @name eg.Axes#change | ||
* @event | ||
* @type {object} The object of data to be sent when the event is fired <ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @property {Object.<string, number>} pos The coordinate <ko>좌표</ko> | ||
* @property {Object.<string, number>} delta The movement variation of coordinate <ko>좌표의 변화량</ko> | ||
* @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.<ko>사용자가 기기의 화면을 누르고 있는지 여부</ko> | ||
* @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> | ||
* @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.<ko>inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.</ko> | ||
* @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true <ko>이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.</ko> | ||
* @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko> | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("change", function(event) { | ||
* // event.pos | ||
* // event.delta | ||
* // event.input | ||
* // event.inputEvent | ||
* // event.holding | ||
* // event.set | ||
* // event.isTrusted | ||
* | ||
* // if you want to change the coordinates to move after the 'change' event. | ||
* // it works when the holding value of the change event is true. | ||
* event.holding && event.set({x: 10}); | ||
* }); | ||
*/ | ||
EventManager.prototype.triggerChange = function (pos, isAccurate, depaPos, option, holding) { | ||
@@ -54,2 +187,38 @@ if (holding === void 0) { holding = false; } | ||
}; | ||
/** | ||
* This event is fired when animation starts. | ||
* @ko 에니메이션이 시작할 때 발생한다. | ||
* @name eg.Axes#animationStart | ||
* @event | ||
* @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @property {Object.<string, number>} depaPos The coordinates when animation starts<ko>애니메이션이 시작 되었을 때의 좌표 </ko> | ||
* @property {Object.<string, number>} destPos The coordinates to move to. If you change this value, you can run the animation<ko>이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다</ko> | ||
* @property {Object.<string, number>} delta The movement variation of coordinate <ko>좌표의 변화량</ko> | ||
* @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.<ko>애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.</ko> | ||
* @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> | ||
* @property {Object} inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko> | ||
* @property {setTo} setTo Specifies the animation coordinates to move after the event <ko>이벤트 이후 이동할 애니메이션 좌표를 지정한다</ko> | ||
* @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko> | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("release", function(event) { | ||
* // event.depaPos | ||
* // event.destPos | ||
* // event.delta | ||
* // event.input | ||
* // event.inputEvent | ||
* // event.setTo | ||
* // event.isTrusted | ||
* | ||
* // if you want to change the animation coordinates to move after the 'animationStart' event. | ||
* event.setTo({x: 10}, 2000); | ||
* }); | ||
*/ | ||
EventManager.prototype.triggerAnimationStart = function (param) { | ||
@@ -62,2 +231,22 @@ var _a = this.getRoundPos(param.destPos, param.depaPos), roundPos = _a.roundPos, roundDepa = _a.roundDepa; | ||
}; | ||
/** | ||
* This event is fired when animation ends. | ||
* @ko 에니메이션이 끝났을 때 발생한다. | ||
* @name eg.Axes#animationEnd | ||
* @event | ||
* @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko> | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("animationEnd", function(event) { | ||
* // event.isTrusted | ||
* }); | ||
*/ | ||
EventManager.prototype.triggerAnimationEnd = function (isTrusted) { | ||
@@ -69,2 +258,22 @@ if (isTrusted === void 0) { isTrusted = false; } | ||
}; | ||
/** | ||
* This event is fired when all actions have been completed. | ||
* @ko 에니메이션이 끝났을 때 발생한다. | ||
* @name eg.Axes#finish | ||
* @event | ||
* @type {object} The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call <ko>사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.</ko> | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("finish", function(event) { | ||
* // event.isTrusted | ||
* }); | ||
*/ | ||
EventManager.prototype.triggerFinish = function (isTrusted) { | ||
@@ -78,2 +287,3 @@ if (isTrusted === void 0) { isTrusted = false; } | ||
if (duration === void 0) { duration = 0; } | ||
// to controll | ||
var userControl = { | ||
@@ -96,3 +306,7 @@ destPos: __assign({}, pos), | ||
EventManager.prototype.getRoundPos = function (pos, depaPos) { | ||
// round value if round exist | ||
var roundUnit = this.axes.options.round; | ||
// if (round == null) { | ||
// return {pos, depaPos}; // undefined, undefined | ||
// } | ||
return { | ||
@@ -99,0 +313,0 @@ roundPos: roundNumbers(pos, roundUnit), |
@@ -11,3 +11,3 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
import { map, equal } from "./utils"; | ||
var InputObserver = (function () { | ||
var InputObserver = /** @class */ (function () { | ||
function InputObserver(_a) { | ||
@@ -24,2 +24,3 @@ var options = _a.options, itm = _a.itm, em = _a.em, axm = _a.axm, am = _a.am; | ||
} | ||
// when move pointer is held in outside | ||
InputObserver.prototype.atOutside = function (pos) { | ||
@@ -35,2 +36,4 @@ var _this = this; | ||
else { | ||
// when start pointer is held in inside | ||
// get a initialization slope value to prevent smooth animation. | ||
var initSlope_1 = this.am.easing(0.00001) / 0.00001; | ||
@@ -45,6 +48,6 @@ return this.axm.map(pos, function (v, opt) { | ||
} | ||
else if (v < min) { | ||
else if (v < min) { // left | ||
return min - _this.am.easing((min - v) / (out[0] * initSlope_1)) * out[0]; | ||
} | ||
else if (v > max) { | ||
else if (v > max) { // right | ||
return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1]; | ||
@@ -80,4 +83,6 @@ } | ||
var destPos; | ||
// for outside logic | ||
destPos = map(depaPos, function (v, k) { return v + (offset[k] || 0); }); | ||
this.moveDistance && (this.moveDistance = destPos); | ||
// from outside to inside | ||
if (this.isOutside && | ||
@@ -117,2 +122,3 @@ this.axm.every(depaPos, function (v, opt) { return !isOutside(v, opt.range); })) { | ||
} | ||
// prepare params | ||
var param = { | ||
@@ -129,2 +135,3 @@ depaPos: depaPos, | ||
this.moveDistance = null; | ||
// to contol | ||
var userWish = this.am.getUserControll(param); | ||
@@ -131,0 +138,0 @@ var isEqual = equal(userWish.destPos, depaPos); |
@@ -24,2 +24,3 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
try { | ||
// create Hammer | ||
return new Manager(element, __assign({}, options)); | ||
@@ -45,2 +46,3 @@ } | ||
case "pointer": hasPointer = SUPPORT_POINTER_EVENTS; | ||
// no default | ||
} | ||
@@ -47,0 +49,0 @@ }); |
@@ -24,3 +24,26 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
var DELAY = 80; | ||
var MoveKeyInput = (function () { | ||
/** | ||
* @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module | ||
* @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체 | ||
* @property {Array<Number>} [scale] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko> | ||
* @property {Number} [scale[0]=1] Coordinate scale for the first axis<ko>첫번째 축의 배율</ko> | ||
* @property {Number} [scale[1]=1] Coordinate scale for the decond axis<ko>두번째 축의 배율</ko> | ||
**/ | ||
/** | ||
* @class eg.Axes.MoveKeyInput | ||
* @classdesc A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis. | ||
* @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다. | ||
* | ||
* @example | ||
* const moveKey = new eg.Axes.MoveKeyInput("#area", { | ||
* scale: [1, 1] | ||
* }); | ||
* | ||
* // Connect 'x', 'y' axes when the moveKey is pressed. | ||
* axes.connect(["x", "y"], moveKey); | ||
* | ||
* @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module <ko>eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트</ko> | ||
* @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput module<ko>eg.Axes.MoveKeyInput 모듈의 옵션 객체</ko> | ||
*/ | ||
var MoveKeyInput = /** @class */ (function () { | ||
function MoveKeyInput(el, options) { | ||
@@ -44,2 +67,3 @@ this.axes = []; | ||
this.dettachEvent(); | ||
// add tabindex="0" to the container for making it focusable | ||
if (this.element.getAttribute("tabindex") !== "0") { | ||
@@ -55,2 +79,7 @@ this.element.setAttribute("tabindex", "0"); | ||
}; | ||
/** | ||
* Destroys elements, properties, and events used in a module. | ||
* @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. | ||
* @method eg.Axes.MoveKeyInput#destroy | ||
*/ | ||
MoveKeyInput.prototype.destroy = function () { | ||
@@ -127,2 +156,8 @@ this.disconnect(); | ||
}; | ||
/** | ||
* Enables input devices | ||
* @ko 입력 장치를 사용할 수 있게 한다 | ||
* @method eg.Axes.MoveKeyInput#enable | ||
* @return {eg.Axes.MoveKeyInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
MoveKeyInput.prototype.enable = function () { | ||
@@ -132,2 +167,8 @@ this._isEnabled = true; | ||
}; | ||
/** | ||
* Disables input devices | ||
* @ko 입력 장치를 사용할 수 없게 한다. | ||
* @method eg.Axes.MoveKeyInput#disable | ||
* @return {eg.Axes.MoveKeyInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
MoveKeyInput.prototype.disable = function () { | ||
@@ -137,2 +178,8 @@ this._isEnabled = false; | ||
}; | ||
/** | ||
* Returns whether to use an input device | ||
* @ko 입력 장치를 사용 여부를 반환한다. | ||
* @method eg.Axes.MoveKeyInput#isEnable | ||
* @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko> | ||
*/ | ||
MoveKeyInput.prototype.isEnable = function () { | ||
@@ -139,0 +186,0 @@ return this._isEnabled; |
@@ -13,2 +13,3 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
import { IS_IOS_SAFARI, EDGE_DISTANCE } from "../const"; | ||
// get user's direction | ||
export function getDirectionByAngle(angle, thresholdAngle) { | ||
@@ -39,3 +40,38 @@ if (thresholdAngle < 0 || thresholdAngle > 90) { | ||
} | ||
var PanInput = (function () { | ||
/** | ||
* @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module. | ||
* @ko eg.Axes.PanInput 모듈의 옵션 객체 | ||
* @property {String[]} [inputType=["touch","mouse", "pointer"]] Types of input devices.<br>- touch: Touch screen<br>- mouse: Mouse <ko>입력 장치 종류.<br>- touch: 터치 입력 장치<br>- mouse: 마우스</ko> | ||
* @property {Number[]} [scale] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko> | ||
* @property {Number} [scale.0=1] horizontal axis scale <ko>수평축 배율</ko> | ||
* @property {Number} [scale.1=1] vertical axis scale <ko>수직축 배율</ko> | ||
* @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) <ko>사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)</ko> | ||
* @property {Number} [threshold=0] Minimal pan distance required before recognizing <ko>사용자의 Pan 동작을 인식하기 위해산 최소한의 거리</ko> | ||
* @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager <ko>Hammer.Manager의 옵션</ko> | ||
**/ | ||
/** | ||
* @class eg.Axes.PanInput | ||
* @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes. | ||
* @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다. | ||
* | ||
* @example | ||
* const pan = new eg.Axes.PanInput("#area", { | ||
* inputType: ["touch"], | ||
* scale: [1, 1.3], | ||
* }); | ||
* | ||
* // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. | ||
* // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. | ||
* axes.connect(["something2", "somethingN"], pan); // or axes.connect("something2 somethingN", pan); | ||
* | ||
* // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. | ||
* axes.connect(["something1"], pan); // or axes.connect("something1", pan); | ||
* | ||
* // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. | ||
* axes.connect(["", "something2"], pan); // or axes.connect(" something2", pan); | ||
* | ||
* @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module <ko>eg.Axes.PanInput 모듈을 사용할 엘리먼트</ko> | ||
* @param {PanInputOption} [options] The option object of the eg.Axes.PanInput module<ko>eg.Axes.PanInput 모듈의 옵션 객체</ko> | ||
*/ | ||
var PanInput = /** @class */ (function () { | ||
function PanInput(el, options) { | ||
@@ -49,2 +85,10 @@ this.axes = []; | ||
this.panFlag = false; | ||
/** | ||
* Hammer helps you add support for touch gestures to your page | ||
* | ||
* @external Hammer | ||
* @see {@link http://hammerjs.github.io|Hammer.JS} | ||
* @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents} | ||
* @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS | ||
*/ | ||
if (typeof Manager === "undefined") { | ||
@@ -60,2 +104,4 @@ throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/"); | ||
hammerManagerOptions: { | ||
// css properties were removed due to usablility issue | ||
// http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html | ||
cssProps: { | ||
@@ -95,3 +141,4 @@ userSelect: "none", | ||
}; | ||
if (this.hammer) { | ||
if (this.hammer) { // for sharing hammer instance. | ||
// hammer remove previous PanRecognizer. | ||
this.removeRecognizer(); | ||
@@ -127,2 +174,7 @@ this.dettachEvent(); | ||
}; | ||
/** | ||
* Destroys elements, properties, and events used in a module. | ||
* @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. | ||
* @method eg.Axes.PanInput#destroy | ||
*/ | ||
PanInput.prototype.destroy = function () { | ||
@@ -137,2 +189,8 @@ this.disconnect(); | ||
}; | ||
/** | ||
* Enables input devices | ||
* @ko 입력 장치를 사용할 수 있게 한다 | ||
* @method eg.Axes.PanInput#enable | ||
* @return {eg.Axes.PanInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
PanInput.prototype.enable = function () { | ||
@@ -142,2 +200,8 @@ this.hammer && (this.hammer.get("pan").options.enable = true); | ||
}; | ||
/** | ||
* Disables input devices | ||
* @ko 입력 장치를 사용할 수 없게 한다. | ||
* @method eg.Axes.PanInput#disable | ||
* @return {eg.Axes.PanInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
PanInput.prototype.disable = function () { | ||
@@ -147,2 +211,8 @@ this.hammer && (this.hammer.get("pan").options.enable = false); | ||
}; | ||
/** | ||
* Returns whether to use an input device | ||
* @ko 입력 장치를 사용 여부를 반환한다. | ||
* @method eg.Axes.PanInput#isEnable | ||
* @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko> | ||
*/ | ||
PanInput.prototype.isEnable = function () { | ||
@@ -178,6 +248,8 @@ return !!(this.hammer && this.hammer.get("pan").options.enable); | ||
var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); | ||
// not support offset properties in Hammerjs - start | ||
var prevInput = this.hammer.session.prevInput; | ||
if (prevInput && IS_IOS_SAFARI) { | ||
var SwipeLeftToRight = event.center.x < 0; | ||
if (SwipeLeftToRight) { | ||
var swipeLeftToRight = event.center.x < 0; | ||
if (swipeLeftToRight) { | ||
// iOS swipe left => right | ||
this.onPanend(__assign({}, prevInput, { velocityX: 0, velocityY: 0, offsetX: 0, offsetY: 0 })); | ||
@@ -188,7 +260,9 @@ return; | ||
clearTimeout(this.rightEdgeTimer); | ||
var SwipeRightToLeft = event.deltaX < -EDGE_DISTANCE; | ||
if (SwipeRightToLeft) { | ||
// - is right to left | ||
var swipeRightToLeft = event.deltaX < -EDGE_DISTANCE; | ||
if (swipeRightToLeft) { | ||
this.isRightEdge = false; | ||
} | ||
else { | ||
// iOS swipe right => left | ||
this.rightEdgeTimer = window.setTimeout(function () { | ||
@@ -200,2 +274,3 @@ _this.onPanend(__assign({}, prevInput, { velocityX: 0, velocityY: 0, offsetX: 0, offsetY: 0 })); | ||
} | ||
/* eslint-disable no-param-reassign */ | ||
if (prevInput) { | ||
@@ -202,0 +277,0 @@ event.offsetX = event.deltaX - prevInput.deltaX; |
@@ -12,3 +12,25 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
import { UNIQUEKEY, toAxis, convertInputType, createHammer } from "./InputType"; | ||
var PinchInput = (function () { | ||
/** | ||
* @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module | ||
* @ko eg.Axes.PinchInput 모듈의 옵션 객체 | ||
* @property {Number} [scale=1] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko> | ||
* @property {Number} [threshold=0] Minimal scale before recognizing <ko>사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율</ko> | ||
* @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager <ko>Hammer.Manager의 옵션</ko> | ||
**/ | ||
/** | ||
* @class eg.Axes.PinchInput | ||
* @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis. | ||
* @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. | ||
* @example | ||
* const pinch = new eg.Axes.PinchInput("#area", { | ||
* scale: 1 | ||
* }); | ||
* | ||
* // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). | ||
* axes.connect("something", pinch); | ||
* | ||
* @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module <ko>eg.Axes.PinchInput 모듈을 사용할 엘리먼트</ko> | ||
* @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput module<ko>eg.Axes.PinchInput 모듈의 옵션 객체</ko> | ||
*/ | ||
var PinchInput = /** @class */ (function () { | ||
function PinchInput(el, options) { | ||
@@ -21,2 +43,10 @@ this.axes = []; | ||
this.pinchRecognizer = null; | ||
/** | ||
* Hammer helps you add support for touch gestures to your page | ||
* | ||
* @external Hammer | ||
* @see {@link http://hammerjs.github.io|Hammer.JS} | ||
* @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents} | ||
* @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS | ||
*/ | ||
if (typeof Manager === "undefined") { | ||
@@ -31,2 +61,4 @@ throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/"); | ||
hammerManagerOptions: { | ||
// css properties were removed due to usablility issue | ||
// http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html | ||
cssProps: { | ||
@@ -49,3 +81,4 @@ userSelect: "none", | ||
var hammerOption = { threshold: this.options.threshold }; | ||
if (this.hammer) { | ||
if (this.hammer) { // for sharing hammer instance. | ||
// hammer remove previous PinchRecognizer. | ||
this.removeRecognizer(); | ||
@@ -82,2 +115,7 @@ this.dettachEvent(); | ||
}; | ||
/** | ||
* Destroys elements, properties, and events used in a module. | ||
* @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. | ||
* @method eg.Axes.PinchInput#destroy | ||
*/ | ||
PinchInput.prototype.destroy = function () { | ||
@@ -134,2 +172,8 @@ this.disconnect(); | ||
}; | ||
/** | ||
* Enables input devices | ||
* @ko 입력 장치를 사용할 수 있게 한다 | ||
* @method eg.Axes.PinchInput#enable | ||
* @return {eg.Axes.PinchInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
PinchInput.prototype.enable = function () { | ||
@@ -139,2 +183,8 @@ this.hammer && (this.hammer.get("pinch").options.enable = true); | ||
}; | ||
/** | ||
* Disables input devices | ||
* @ko 입력 장치를 사용할 수 없게 한다. | ||
* @method eg.Axes.PinchInput#disable | ||
* @return {eg.Axes.PinchInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
PinchInput.prototype.disable = function () { | ||
@@ -144,2 +194,8 @@ this.hammer && (this.hammer.get("pinch").options.enable = false); | ||
}; | ||
/** | ||
* Returns whether to use an input device | ||
* @ko 입력 장치를 사용 여부를 반환한다. | ||
* @method eg.Axes.PinchInput#isEnable | ||
* @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko> | ||
*/ | ||
PinchInput.prototype.isEnable = function () { | ||
@@ -146,0 +202,0 @@ return !!(this.hammer && this.hammer.get("pinch").options.enable); |
@@ -14,3 +14,24 @@ var __extends = (this && this.__extends) || (function () { | ||
import { PanInput } from "./PanInput"; | ||
var RotatePanInput = (function (_super) { | ||
/** | ||
* @class eg.Axes.RotatePanInput | ||
* @classdesc A module that passes the angle moved by touch to Axes and uses one axis of rotation.<br>[Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput) | ||
* @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.<br>[상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4) | ||
* | ||
* @example | ||
* const input = new eg.Axes.RotatePanInput("#area"); | ||
* | ||
* var axes = new eg.Axes({ | ||
* // property name('angle') could be anything you want (eg. x, y, z...) | ||
* angle: { | ||
* range: [-180, 180] // from -180deg to 180deg | ||
* } | ||
* }); | ||
* | ||
* axes.connect("angle", input) | ||
* | ||
* @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module <ko>eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트</ko> | ||
* @param {PanInputOption} [options] The option object of the eg.Axes.PanInput module<ko>eg.Axes.PanInput 모듈의 옵션 객체</ko> | ||
* @extends eg.Axes.PanInput | ||
*/ | ||
var RotatePanInput = /** @class */ (function (_super) { | ||
__extends(RotatePanInput, _super); | ||
@@ -40,4 +61,10 @@ function RotatePanInput(el, options) { | ||
var rect = this.element.getBoundingClientRect(); | ||
this.coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); | ||
/** | ||
* Responsive | ||
*/ | ||
// TODO: how to do if element is ellipse not circle. | ||
this.coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360 | ||
// TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin | ||
this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; | ||
// init angle. | ||
this.prevAngle = null; | ||
@@ -63,3 +90,3 @@ this.triggerChange(event); | ||
this.lastDiff = diff; | ||
this.observer.change(this, event, toAxis(this.axes, [-diff])); | ||
this.observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise | ||
}; | ||
@@ -69,3 +96,3 @@ RotatePanInput.prototype.triggerAnimation = function (event) { | ||
var vy = event.velocityY; | ||
var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); | ||
var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise | ||
var duration = Math.abs(velocity / -this.observer.options.deceleration); | ||
@@ -100,4 +127,14 @@ var distance = velocity / 2 * duration; | ||
var angle = Math.atan2(y, x) * 180 / Math.PI; | ||
// console.log(angle, x, y); | ||
return angle < 0 ? 360 + angle : angle; | ||
}; | ||
/** | ||
* Quadrant | ||
* y(+) | ||
* | | ||
* 2 | 1 | ||
* --------------->x(+) | ||
* 3 | 4 | ||
* | | ||
*/ | ||
RotatePanInput.prototype.getQuadrant = function (posX, posY) { | ||
@@ -104,0 +141,0 @@ var _a = this.getPosFromOrigin(posX, posY), x = _a.x, y = _a.y; |
@@ -11,3 +11,24 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
import { toAxis } from "./InputType"; | ||
var WheelInput = (function () { | ||
/** | ||
* @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module | ||
* @ko eg.Axes.WheelInput 모듈의 옵션 객체 | ||
* @property {Number} [scale=1] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko> | ||
**/ | ||
/** | ||
* @class eg.Axes.WheelInput | ||
* @classdesc A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis. | ||
* @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. | ||
* | ||
* @example | ||
* const wheel = new eg.Axes.WheelInput("#area", { | ||
* scale: 1 | ||
* }); | ||
* | ||
* // Connect 'something' axis when the mousewheel is moved. | ||
* axes.connect("something", wheel); | ||
* | ||
* @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module <ko>eg.Axes.WheelInput 모듈을 사용할 엘리먼트</ko> | ||
* @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput module<ko>eg.Axes.WheelInput 모듈의 옵션 객체</ko> | ||
*/ | ||
var WheelInput = /** @class */ (function () { | ||
function WheelInput(el, options) { | ||
@@ -38,2 +59,7 @@ this.axes = []; | ||
}; | ||
/** | ||
* Destroys elements, properties, and events used in a module. | ||
* @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. | ||
* @method eg.Axes.WheelInput#destroy | ||
*/ | ||
WheelInput.prototype.destroy = function () { | ||
@@ -81,2 +107,8 @@ this.disconnect(); | ||
}; | ||
/** | ||
* Enables input devices | ||
* @ko 입력 장치를 사용할 수 있게 한다 | ||
* @method eg.Axes.WheelInput#enable | ||
* @return {eg.Axes.WheelInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
WheelInput.prototype.enable = function () { | ||
@@ -86,2 +118,8 @@ this._isEnabled = true; | ||
}; | ||
/** | ||
* Disables input devices | ||
* @ko 입력 장치를 사용할 수 없게 한다. | ||
* @method eg.Axes.WheelInput#disable | ||
* @return {eg.Axes.WheelInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
WheelInput.prototype.disable = function () { | ||
@@ -91,2 +129,8 @@ this._isEnabled = false; | ||
}; | ||
/** | ||
* Returns whether to use an input device | ||
* @ko 입력 장치를 사용 여부를 반환한다. | ||
* @method eg.Axes.WheelInput#isEnable | ||
* @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko> | ||
*/ | ||
WheelInput.prototype.isEnable = function () { | ||
@@ -93,0 +137,0 @@ return this._isEnabled; |
@@ -1,7 +0,8 @@ | ||
var InterruptManager = (function () { | ||
var InterruptManager = /** @class */ (function () { | ||
function InterruptManager(options) { | ||
this.options = options; | ||
this._prevented = false; | ||
this._prevented = false; // check whether the animation event was prevented | ||
} | ||
InterruptManager.prototype.isInterrupting = function () { | ||
// when interruptable is 'true', return value is always 'true'. | ||
return this.options.interruptable || this._prevented; | ||
@@ -8,0 +9,0 @@ }; |
import { window } from "./browser"; | ||
export function toArray(nodes) { | ||
// const el = Array.prototype.slice.call(nodes); | ||
// for IE8 | ||
var el = []; | ||
@@ -12,5 +14,7 @@ for (var i = 0, len = nodes.length; i < len; i++) { | ||
var el; | ||
if (typeof param === "string") { | ||
if (typeof param === "string") { // String (HTML, Selector) | ||
// check if string is HTML tag format | ||
var match = param.match(/^<([a-z]+)\s*([^>]*)>/); | ||
if (match) { | ||
// creating element | ||
if (match) { // HTML | ||
var dummy = document.createElement("div"); | ||
@@ -20,3 +24,3 @@ dummy.innerHTML = param; | ||
} | ||
else { | ||
else { // Selector | ||
el = toArray(document.querySelectorAll(param)); | ||
@@ -28,11 +32,11 @@ } | ||
} | ||
else if (param === window) { | ||
else if (param === window) { // window | ||
el = param; | ||
} | ||
else if (param.nodeName && | ||
(param.nodeType === 1 || param.nodeType === 9)) { | ||
(param.nodeType === 1 || param.nodeType === 9)) { // HTMLElement, Document | ||
el = param; | ||
} | ||
else if (("jQuery" in window && param instanceof jQuery) || | ||
param.constructor.prototype.jquery) { | ||
param.constructor.prototype.jquery) { // jQuery | ||
el = multi ? param.toArray() : param.get(0); | ||
@@ -75,5 +79,16 @@ } | ||
} | ||
/** | ||
* A polyfill for the window.requestAnimationFrame() method. | ||
* @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame | ||
* @private | ||
*/ | ||
export function requestAnimationFrame(fp) { | ||
return raf(fp); | ||
} | ||
/** | ||
* A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method. | ||
* @param {Number} key − The ID value returned through a call to the requestAnimationFrame() method. <ko>requestAnimationFrame() 메서드가 반환한 아이디 값</ko> | ||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame | ||
* @private | ||
*/ | ||
export function cancelAnimationFrame(key) { | ||
@@ -109,2 +124,3 @@ caf(key); | ||
export function roundNumber(num, roundUnit) { | ||
// Cache for performance | ||
if (!roundNumFunc[roundUnit]) { | ||
@@ -128,2 +144,4 @@ roundNumFunc[roundUnit] = getRoundFunc(roundUnit); | ||
if (v.indexOf("e") >= 0) { | ||
// Exponential Format | ||
// 1e-10, 1e-12 | ||
var p = 0; | ||
@@ -137,5 +155,9 @@ var e = 1; | ||
} | ||
// In general, following has performance benefit. | ||
// https://jsperf.com/precision-calculation | ||
return v.indexOf(".") >= 0 ? (v.length - v.indexOf(".") - 1) : 0; | ||
} | ||
export function inversePow(n) { | ||
// replace Math.pow(10, -n) to solve floating point issue. | ||
// eg. Math.pow(10, -4) => 0.00009999999999999999 | ||
return 1 / Math.pow(10, n); | ||
@@ -142,0 +164,0 @@ } |
{ | ||
"name": "@egjs/axes", | ||
"version": "2.6.1-beta2", | ||
"version": "2.6.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, |
@@ -266,5 +266,5 @@ import { DIRECTION_ALL, DIRECTION_HORIZONTAL, DIRECTION_NONE, DIRECTION_VERTICAL, Manager, Pan } from "@egjs/hammerjs"; | ||
if (prevInput && IS_IOS_SAFARI) { | ||
const SwipeLeftToRight = event.center.x < 0; | ||
const swipeLeftToRight = event.center.x < 0; | ||
if (SwipeLeftToRight) { | ||
if (swipeLeftToRight) { | ||
// iOS swipe left => right | ||
@@ -283,5 +283,5 @@ this.onPanend({ | ||
// - is right to left | ||
const SwipeRightToLeft = event.deltaX < -EDGE_DISTANCE; | ||
const swipeRightToLeft = event.deltaX < -EDGE_DISTANCE; | ||
if (SwipeRightToLeft) { | ||
if (swipeRightToLeft) { | ||
this.isRightEdge = false; | ||
@@ -288,0 +288,0 @@ } else { |
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
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
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
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
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
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1898954
16280
1