@egjs/axes
Advanced tools
Comparing version 2.0.0 to 2.1.1
@@ -8,4 +8,5 @@ /*! | ||
* | ||
* @version 2.0.0 | ||
* @version 2.1.1 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("hammerjs"),require("@egjs/component")):"function"==typeof define&&define.amd?define("Axes",["hammerjs","@egjs/component"],e):"object"==typeof exports?exports.Axes=e(require("hammerjs"),require("@egjs/component")):(t.eg=t.eg||{},t.eg.Axes=e(t.Hammer,t.eg.Component))}(this,function(t,e){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,n){"use strict";function $(t,e){void 0===e&&(e=!1);var n;if("string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=t,n=Array.prototype.slice.call(i.childNodes)}else n=Array.prototype.slice.call(document.querySelectorAll(t));e||(n=n.length>=1?n[0]:undefined)}else t===window?n=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in window&&t instanceof jQuery||t.constructor.prototype.jquery?n=e?t.toArray():t.get(0):Array.isArray(t)&&(n=t.map(function(t){return $(t)}),e||(n=n.length>=1?n[0]:undefined)):n=t;return n}function requestAnimationFrame(t){return i(t)}function cancelAnimationFrame(t){r(t)}e.__esModule=!0,e.$=$;var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame,r=window.cancelAnimationFrame||window.webkitCancelAnimationFrame;if(i&&!r){var o={},s=i;i=function(t){function wrapCallback(n){o[e]&&t(n)}var e=s(wrapCallback);return o[e]=!0,e},r=function(t){delete o[t]}}else i&&r||(i=function(t){return window.setTimeout(function(){t(window.performance&&window.performance.now())},16)},r=window.clearTimeout);e.requestAnimationFrame=requestAnimationFrame,e.cancelAnimationFrame=cancelAnimationFrame},function(t,e,n){"use strict";e.__esModule=!0;var i={getInsidePosition:function(t,e,n,i){var r=t,o=[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(o[0],r),r=Math.min(o[1],r),+Math.min(o[1],Math.max(o[0],r)).toFixed(5)},isOutside:function(t,e){return t<e[0]||t>e[1]},getDuration:function(t,e){var n=Math.sqrt(t/e*2);return n<100?0:n},isCircularable:function(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]},getCirculatedPos:function(t,e,n){var i=t,r=e[0],o=e[1],s=o-r;return n[1]&&t>o&&(i=(i-o)%s+r),n[0]&&t<r&&(i=(i-r)%s+o),+i.toFixed(5)}};e["default"]=i},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(1),o=function(){function AxisManager(t,e){var n=this;this.axis=t,this.options=e,this._pos=Object.keys(this.axis).reduce(function(t,e){return t[e]=n.axis[e].range[0],t},{})}return AxisManager.equal=function(t,e){for(var n in t)if(t[n]!==e[n])return!1;return!0},AxisManager.prototype.getDelta=function(t,e){var n=this.get(t);return this.map(this.get(e),function(t,e){return t-n[e]})},AxisManager.prototype.get=function(t){var e=this;return t&&Array.isArray(t)?t.reduce(function(t,n){return n&&n in e._pos&&(t[n]=e._pos[n]),t},{}):i({},this._pos,t||{})},AxisManager.prototype.moveTo=function(t){var e=this,n=this.map(this._pos,function(n,i){return t[i]?t[i]-e._pos[i]:0});return this.set(t),{pos:i({},this._pos),delta:n}},AxisManager.prototype.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},AxisManager.prototype.every=function(t,e){var n=this.axis;for(var i in t)if(i&&!e(t[i],i,n[i]))return!1;return!0},AxisManager.prototype.filter=function(t,e){var n={},i=this.axis;for(var r in t)r&&e(t[r],r,i[r])&&(n[r]=t[r]);return n},AxisManager.prototype.map=function(t,e){var n={},i=this.axis;for(var r in t)r&&(n[r]=e(t[r],r,i[r]));return n},AxisManager.prototype.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e,n){return!r["default"].isOutside(t,n.range)})},AxisManager}();e.AxisManager=o},function(e,n){e.exports=t},function(t,e,n){"use strict";function toAxis(t,e){return e.reduce(function(e,n,i){return t[i]&&(e[t[i]]=n),e},{})}function createHammer(t,e,n){try{var r={recognizers:[e],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}};return n&&(r.inputClass=n),new i.Manager(t,r)}catch(o){return null}}function convertInputType(t){void 0===t&&(t=[]);var n=!1,r=!1;return t.forEach(function(t){switch(t){case"mouse":r=!0;break;case"touch":n=e.SUPPORT_TOUCH}}),n&&i.TouchInput||r&&i.MouseInput||null}e.__esModule=!0;var i=n(3);e.SUPPORT_TOUCH="ontouchstart"in window,e.UNIQUEKEY="_EGJS_AXES_INPUTTYPE_",e.toAxis=toAxis,e.createHammer=createHammer,e.convertInputType=convertInputType},function(t,e,n){"use strict";e.__esModule=!0;!function(t){t[t.DIRECTION_NONE=1]="DIRECTION_NONE",t[t.DIRECTION_LEFT=2]="DIRECTION_LEFT",t[t.DIRECTION_RIGHT=4]="DIRECTION_RIGHT",t[t.DIRECTION_HORIZONTAL=6]="DIRECTION_HORIZONTAL",t[t.DIRECTION_UP=8]="DIRECTION_UP",t[t.DIRECTION_DOWN=16]="DIRECTION_DOWN",t[t.DIRECTION_VERTICAL=24]="DIRECTION_VERTICAL",t[t.DIRECTION_ALL=30]="DIRECTION_ALL"}(e.DIRECTION||(e.DIRECTION={})),e.TRANSFORM=function(){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""}()},function(t,e,n){"use strict";var i=n(7);t.exports=i["default"]},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=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])};return function(e,n){function __(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(__.prototype=n.prototype,new __)}}(),r=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var o=n(8),s=n(9),a=n(10),u=n(11),h=n(2),c=n(12),p=n(13),m=n(14),l=n(15),f=n(5),d=function(t){function Axes(e,n,i){void 0===e&&(e={});var o=t.call(this)||this;return o.axis=e,o._inputs=[],o.options=r({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:Infinity,minimumDuration:0,deceleration:6e-4},n),o._complementOptions(),o._axm=new h.AxisManager(o.axis,o.options),o._em=new a.EventManager(o,o._axm),o._itm=new u.InterruptManager(o.options),o._am=new s.AnimationManager(o.options,o._itm,o._em,o._axm),o._io=new c.InputObserver(o.options,o._itm,o._em,o._axm,o._am),i&&setTimeout(function(){return o._em.triggerChange(i)},0),o}return i(Axes,t),Axes.prototype._complementOptions=function(){var t=this;Object.keys(this.axis).forEach(function(e){t.axis[e]=r({range:[0,100],bounce:[0,0],circular:[!1,!1]},t.axis[e]),["bounce","circular"].forEach(function(n){var i=t.axis,r=i[e][n];/string|number|boolean/.test(typeof r)&&(i[e][n]=[r,r])})})},Axes.prototype.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},Axes.prototype.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);this._inputs[e].disconnect(),~e&&this._inputs.splice(e,1)}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},Axes.prototype.get=function(t){return this._axm.get(t)},Axes.prototype.setTo=function(t,e){return void 0===e&&(e=0),this._am.setTo(t,e),this},Axes.prototype.setBy=function(t,e){return void 0===e&&(e=0),this._am.setBy(t,e),this},Axes.prototype.isBounceArea=function(t){return this._axm.isOutside(t)},Axes.prototype.destroy=function(){this.disconnect(),this._em.destroy()},Axes.VERSION="#__VERSION__#",Axes.PanInput=p.PanInput,Axes.PinchInput=m.PinchInput,Axes.WheelInput=l.WheelInput,Axes.TRANSFORM=f.TRANSFORM,Axes.DIRECTION_NONE=f.DIRECTION.DIRECTION_NONE,Axes.DIRECTION_LEFT=f.DIRECTION.DIRECTION_LEFT,Axes.DIRECTION_RIGHT=f.DIRECTION.DIRECTION_RIGHT,Axes.DIRECTION_UP=f.DIRECTION.DIRECTION_UP,Axes.DIRECTION_DOWN=f.DIRECTION.DIRECTION_DOWN,Axes.DIRECTION_HORIZONTAL=f.DIRECTION.DIRECTION_HORIZONTAL,Axes.DIRECTION_VERTICAL=f.DIRECTION.DIRECTION_VERTICAL,Axes.DIRECTION_ALL=f.DIRECTION.DIRECTION_ALL,Axes}(o);e["default"]=d},function(t,n){t.exports=e},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(1),o=n(2),s=n(0),a=function(){function AnimationManager(t,e,n,i){this.options=t,this.itm=e,this.em=n,this.axm=i,this.animationEnd=this.animationEnd.bind(this)}return AnimationManager.getDuration=function(t,e,n){return Math.max(Math.min(t,n),e)},AnimationManager.prototype.getDuration=function(t,e,n){var i,o=this;if(void 0!==n)i=n;else{var s=this.axm.map(e,function(e,n){return r["default"].getDuration(Math.abs(Math.abs(e)-Math.abs(t[n])),o.options.deceleration)});i=Object.keys(s).reduce(function(t,e){return Math.max(t,s[e])},-Infinity)}return AnimationManager.getDuration(i,this.options.minimumDuration,this.options.maximumDuration)},AnimationManager.prototype.createAnimationParam=function(t,e,n){void 0===n&&(n=null);var i=this.axm.get(),o=this.axm.get(this.axm.map(t,function(t,e,n){return r["default"].getInsidePosition(t,n.range,n.circular,n.bounce)}));return{depaPos:i,destPos:o,duration:AnimationManager.getDuration(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,o),inputEvent:n,done:this.animationEnd}},AnimationManager.prototype.grab=function(t,e){if(this._animateParam&&!t.length){var n=this.axm.get(t),i=this.axm.map(n,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)});this.axm.every(i,function(t,e){return n[e]===t})||this.em.triggerChange(i,e),this._animateParam=null,this._raf&&s.cancelAnimationFrame(this._raf),this._raf=null,this.em.triggerAnimationEnd()}},AnimationManager.prototype.restore=function(t){void 0===t&&(t=null);var e=this.axm.get(),n=this.axm.map(e,function(t,e,n){return Math.min(n.range[1],Math.max(n.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},AnimationManager.prototype.animationEnd=function(){this._animateParam=null;var t=this.axm.filter(this.axm.get(),function(t,e,n){return r["default"].isCircularable(t,n.range,n.circular)});Object.keys(t).length>0&&this.setTo(this.axm.map(t,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(),this.axm.isOutside()&&this.restore()},AnimationManager.prototype.animateLoop=function(t,e){if(this._animateParam=i({},t),this._animateParam.startTime=(new Date).getTime(),t.duration){var n=this._animateParam,r=this;!function loop(){if(r._raf=null,r.frame(n)>=1)return o.AxisManager.equal(t.destPos,r.axm.get(Object.keys(t.destPos)))||r.em.triggerChange(t.destPos),void e();r._raf=s.requestAnimationFrame(loop)}()}else this.em.triggerChange(t.destPos),e()},AnimationManager.prototype.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=AnimationManager.getDuration(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},AnimationManager.prototype.animateTo=function(t,e,n){var s=this;void 0===n&&(n=null);var a=this.createAnimationParam(t,e,n),u=i({},a.depaPos),h=this.em.triggerAnimationStart(a),c=this.getUserControll(a);!h&&this.axm.every(c.destPos,function(t,e,n){return r["default"].isCircularable(t,n.range,n.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),h&&!o.AxisManager.equal(c.destPos,u)&&this.animateLoop({depaPos:u,destPos:c.destPos,duration:c.duration,delta:this.axm.getDelta(u,c.destPos)},function(){return s.animationEnd()})},AnimationManager.prototype.frame=function(t){var e=(new Date).getTime()-t.startTime,n=this.easing(e/t.duration),i=t.depaPos;return i=this.axm.map(i,function(e,i,o){return e+=(t.destPos[i]-e)*n,r["default"].getCirculatedPos(e,o.range,o.circular)}),this.em.triggerChange(i),n},AnimationManager.prototype.easing=function(t){return t>1?1:this.options.easing(t)},AnimationManager.prototype.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t);this.grab(n);var i=this.axm.get(n);if(o.AxisManager.equal(t,i))return this;this.itm.setInterrupt(!0);var s=this.axm.filter(t,function(t,e){return i[e]!==t});if(Object.keys(s).length)return s=this.axm.map(s,function(t,n,i){return t=r["default"].getInsidePosition(t,i.range,i.circular),e?t:r["default"].getCirculatedPos(t,i.range,i.circular)}),o.AxisManager.equal(s,i)?this:(e?this.animateTo(s,e):(this.em.triggerChange(s),this.itm.setInterrupt(!1)),this)},AnimationManager.prototype.setBy=function(t,e){return void 0===e&&(e=0),this.setTo(this.axm.map(this.axm.get(Object.keys(t)),function(e,n){return e+t[n]}),e)},AnimationManager}();e.AnimationManager=a},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=function(){function EventManager(t,e){this.axes=t,this.axm=e}return EventManager.prototype.triggerHold=function(t,e){this.axes.trigger("hold",{pos:t,inputEvent:e})},EventManager.prototype.triggerRelease=function(t,e){void 0===e&&(e=null),t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("release",t)},EventManager.prototype.triggerChange=function(t,e){void 0===e&&(e=null);var n=this.axm.moveTo(t),i={pos:n.pos,delta:n.delta,holding:null!==e,inputEvent:e,set:e?this.createUserControll(n.pos):function(){}};this.axes.trigger("change",i),e&&this.axm.set(i.set().destPos)},EventManager.prototype.triggerAnimationStart=function(t){return t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("animationStart",t)},EventManager.prototype.triggerAnimationEnd=function(){this.axes.trigger("animationEnd")},EventManager.prototype.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:i({},t),duration:e};return function(t,e){return t&&(n.destPos=i({},t)),e!==undefined&&(n.duration=e),n}},EventManager.prototype.destroy=function(){this.axes.off()},EventManager}();e.EventManager=r},function(t,e,n){"use strict";e.__esModule=!0;var i=function(){function InterruptManager(t){this.options=t,this._prevented=!1}return InterruptManager.prototype.isInterrupting=function(){return this.options.interruptable||this._prevented},InterruptManager.prototype.isInterrupted=function(){return!this.options.interruptable&&this._prevented},InterruptManager.prototype.setInterrupt=function(t){!this.options.interruptable&&(this._prevented=t)},InterruptManager}();e.InterruptManager=i},function(t,e,n){"use strict";e.__esModule=!0;var i=n(2),r=n(1),o=function(){function InputObserver(t,e,n,i,r){this.options=t,this.itm=e,this.em=n,this.axm=i,this.am=r,this.isOutside=!1,this.moveDistance=null}return InputObserver.prototype.atOutside=function(t){var e=this;if(this.isOutside)return this.axm.map(t,function(t,e,n){var i=n.range[0]-n.bounce[0],r=n.range[1]+n.bounce[1];return t>r?r:t<i?i:t});var n=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,i,r){var o=r.range[0],s=r.range[1],a=r.bounce;return t<o?o-e.am.easing((o-t)/(a[0]*n))*a[0]:t>s?s+e.am.easing((t-s)/(a[1]*n))*a[1]:t})},InputObserver.prototype.hold=function(t,e){!this.itm.isInterrupted()&&t.axes.length&&(this.itm.setInterrupt(!0),this.am.grab(t.axes,e),this.moveDistance||this.em.triggerHold(this.axm.get(),e),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes))},InputObserver.prototype.change=function(t,e,n){if(this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,o=this.axm.get(t.axes);i=this.axm.map(this.moveDistance||o,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),i=this.axm.map(i,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)}),this.isOutside&&this.axm.every(o,function(t,e,n){return!r["default"].isOutside(t,n.range)})&&(this.isOutside=!1),i=this.atOutside(i),this.em.triggerChange(i,e)}},InputObserver.prototype.release=function(t,e,n,o){if(this.itm.isInterrupting()&&this.moveDistance){var s=this.axm.get(t.axes),a=this.axm.get(),u=this.axm.get(this.axm.map(n,function(t,e,n){return r["default"].getInsidePosition(s[e]+t,n.range,n.circular,n.bounce)})),h={depaPos:a,destPos:u,duration:this.am.getDuration(u,s,o),delta:this.axm.getDelta(a,u),inputEvent:e};this.em.triggerRelease(h),this.moveDistance=null;var c=this.am.getUserControll(h),p=i.AxisManager.equal(c.destPos,a);p||0===c.duration?(!p&&this.em.triggerChange(c.destPos,e),this.itm.setInterrupt(!1),this.axm.isOutside()&&this.am.restore(e)):this.am.animateTo(c.destPos,c.duration,e)}},InputObserver}();e.InputObserver=o},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(3),o=n(5),s=n(0),a=n(4),u=function(){function PanInput(t,e){if(this.axes=[],this.hammer=null,this.element=null,void 0===r)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=s.$(t),this.options=i({inputType:["touch","mouse"],scale:[1,1],thresholdAngle:45,threshold:0},e),this.onHammerInput=this.onHammerInput.bind(this),this.onPanmove=this.onPanmove.bind(this),this.onPanend=this.onPanend.bind(this)}return PanInput.getDirectionByAngle=function(t,e){if(e<0||e>90)return o.DIRECTION.DIRECTION_NONE;var n=Math.abs(t);return n>e&&n<180-e?o.DIRECTION.DIRECTION_VERTICAL:o.DIRECTION.DIRECTION_HORIZONTAL},PanInput.getNextOffset=function(t,e){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.abs(n/-e);return[t[0]/2*i,t[1]/2*i]},PanInput.useDirection=function(t,e,n){return n?!!(e===o.DIRECTION.DIRECTION_ALL||e&t&&n&t):!!(e&t)},PanInput.prototype.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?o.DIRECTION.DIRECTION_ALL:e?o.DIRECTION.DIRECTION_HORIZONTAL:n?o.DIRECTION.DIRECTION_VERTICAL:o.DIRECTION.DIRECTION_NONE,this.axes=t},PanInput.prototype.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.dettachEvent(),this.hammer.add(new r.Pan(e));else{var n=this.element[a.UNIQUEKEY];n?this.hammer.destroy():n=String(Math.round(Math.random()*(new Date).getTime()));var i=a.convertInputType(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=a.createHammer(this.element,[r.Pan,e],i),this.element[a.UNIQUEKEY]=n}return this.attachEvent(t),this},PanInput.prototype.disconnect=function(){return this.hammer&&this.dettachEvent(),this._direction=o.DIRECTION.DIRECTION_NONE,this},PanInput.prototype.destroy=function(){this.disconnect(),this.hammer&&this.hammer.destroy(),delete this.element[a.UNIQUEKEY],this.element=null,this.hammer=null},PanInput.prototype.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},PanInput.prototype.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},PanInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},PanInput.prototype.onHammerInput=function(t){this.isEnable()&&(t.isFirst?this.observer.hold(this,t):t.isFinal&&this.onPanend(t))},PanInput.prototype.onPanmove=function(t){var e=PanInput.getDirectionByAngle(t.angle,this.options.thresholdAngle),n=this.hammer.session.prevInput;n?(t.offsetX=t.deltaX-n.deltaX,t.offsetY=t.deltaY-n.deltaY):(t.offsetX=0,t.offsetY=0);var i=this.getOffset([t.offsetX,t.offsetY],[PanInput.useDirection(o.DIRECTION.DIRECTION_HORIZONTAL,this._direction,e),PanInput.useDirection(o.DIRECTION.DIRECTION_VERTICAL,this._direction,e)]),r=i.some(function(t){return 0!==t});r&&(t.srcEvent.preventDefault(),t.srcEvent.stopPropagation()),t.preventSystemEvent=r,r&&this.observer.change(this,t,a.toAxis(this.axes,i))},PanInput.prototype.onPanend=function(t){var e=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[PanInput.useDirection(o.DIRECTION.DIRECTION_HORIZONTAL,this._direction),PanInput.useDirection(o.DIRECTION.DIRECTION_VERTICAL,this._direction)]);e=PanInput.getNextOffset(e,this.observer.options.deceleration),this.observer.release(this,t,a.toAxis(this.axes,e))},PanInput.prototype.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},PanInput.prototype.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),this.observer=null},PanInput.prototype.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},PanInput}();e.PanInput=u},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(3),o=n(0),s=n(4),a=function(){function PinchInput(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._prev=null,void 0===r)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=o.$(t),this.options=i({scale:1,threshold:0},e),this.onPinchStart=this.onPinchStart.bind(this),this.onPinchMove=this.onPinchMove.bind(this),this.onPinchEnd=this.onPinchEnd.bind(this)}return PinchInput.prototype.mapAxes=function(t){this.axes=t},PinchInput.prototype.connect=function(t){var e={threshold:this.options.threshold};if(this.hammer)this.dettachEvent(),this.hammer.add(new r.Pinch(e));else{var n=this.element[s.UNIQUEKEY];n?this.hammer.destroy():n=String(Math.round(Math.random()*(new Date).getTime())),this.hammer=s.createHammer(this.element,[r.Pinch,e],r.TouchInput),this.element[s.UNIQUEKEY]=n}return this.attachEvent(t),this},PinchInput.prototype.disconnect=function(){return this.hammer&&this.dettachEvent(),this},PinchInput.prototype.destroy=function(){this.disconnect(),this.hammer&&this.hammer.destroy(),delete this.element[s.UNIQUEKEY],this.element=null,this.hammer=null},PinchInput.prototype.onPinchStart=function(t){this._prev=t.scale,this.observer.hold(this,t)},PinchInput.prototype.onPinchMove=function(t){var e=(t.scale-this._prev)*this.options.scale;this.observer.change(this,t,s.toAxis(this.axes,[e])),this._prev=t.scale},PinchInput.prototype.onPinchEnd=function(t){this.observer.release(this,t,s.toAxis(this.axes,[0]),0),this._prev=null},PinchInput.prototype.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},PinchInput.prototype.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},PinchInput.prototype.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},PinchInput.prototype.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},PinchInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},PinchInput}();e.PinchInput=a},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(0),o=n(4),s=function(){function WheelInput(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._timer=null,this.element=r.$(t),this.options=i({scale:1,throttle:100},e),this.onWheel=this.onWheel.bind(this)}return WheelInput.prototype.mapAxes=function(t){this.axes=t},WheelInput.prototype.connect=function(t){return this.dettachEvent(),this.attachEvent(t),this},WheelInput.prototype.disconnect=function(){return this.dettachEvent(),this},WheelInput.prototype.destroy=function(){this.disconnect(),this.element=null},WheelInput.prototype.onWheel=function(t){var e=this;this._isEnabled&&(t.preventDefault(),0!==t.deltaY&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.hold(e,t);var n=(t.deltaY>0?-1:1)*e.options.scale;e.observer.change(e,t,o.toAxis(e.axes,[n])),e.observer.release(e,t,o.toAxis(e.axes,[0]))},200)))},WheelInput.prototype.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},WheelInput.prototype.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null},WheelInput.prototype.enable=function(){return this._isEnabled=!0,this},WheelInput.prototype.disable=function(){return this._isEnabled=!1,this},WheelInput.prototype.isEnable=function(){return this._isEnabled},WheelInput}();e.WheelInput=s}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("hammerjs"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["hammerjs","@egjs/component"],e):"object"==typeof exports?exports.Axes=e(require("hammerjs"),require("@egjs/component")):(t.eg=t.eg||{},t.eg.Axes=e(t.Hammer,t.eg.Component))}(this,function(t,e){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,n){"use strict";function $(t,e){void 0===e&&(e=!1);var n;if("string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=t,n=Array.prototype.slice.call(i.childNodes)}else n=Array.prototype.slice.call(document.querySelectorAll(t));e||(n=n.length>=1?n[0]:undefined)}else t===window?n=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in window&&t instanceof jQuery||t.constructor.prototype.jquery?n=e?t.toArray():t.get(0):Array.isArray(t)&&(n=t.map(function(t){return $(t)}),e||(n=n.length>=1?n[0]:undefined)):n=t;return n}function requestAnimationFrame(t){return i(t)}function cancelAnimationFrame(t){r(t)}e.__esModule=!0,e.$=$;var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame,r=window.cancelAnimationFrame||window.webkitCancelAnimationFrame;if(i&&!r){var s={},o=i;i=function(t){function wrapCallback(n){s[e]&&t(n)}var e=o(wrapCallback);return s[e]=!0,e},r=function(t){delete s[t]}}else i&&r||(i=function(t){return window.setTimeout(function(){t(window.performance&&window.performance.now())},16)},r=window.clearTimeout);e.requestAnimationFrame=requestAnimationFrame,e.cancelAnimationFrame=cancelAnimationFrame},function(t,e,n){"use strict";e.__esModule=!0;var i={getInsidePosition:function(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),+Math.min(s[1],Math.max(s[0],r)).toFixed(5)},isOutside:function(t,e){return t<e[0]||t>e[1]},getDuration:function(t,e){var n=Math.sqrt(t/e*2);return n<100?0:n},isCircularable:function(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]},getCirculatedPos:function(t,e,n){var i=t,r=e[0],s=e[1],o=s-r;return n[1]&&t>s&&(i=(i-s)%o+r),n[0]&&t<r&&(i=(i-r)%o+s),+i.toFixed(5)}};e["default"]=i},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(1),s=function(){function AxisManager(t,e){var n=this;this.axis=t,this.options=e,this._pos=Object.keys(this.axis).reduce(function(t,e){return t[e]=n.axis[e].range[0],t},{})}return AxisManager.equal=function(t,e){for(var n in t)if(t[n]!==e[n])return!1;return!0},AxisManager.prototype.getDelta=function(t,e){var n=this.get(t);return this.map(this.get(e),function(t,e){return t-n[e]})},AxisManager.prototype.get=function(t){var e=this;return t&&Array.isArray(t)?t.reduce(function(t,n){return n&&n in e._pos&&(t[n]=e._pos[n]),t},{}):i({},this._pos,t||{})},AxisManager.prototype.moveTo=function(t){var e=this,n=this.map(this._pos,function(n,i){return t[i]?t[i]-e._pos[i]:0});return this.set(t),{pos:i({},this._pos),delta:n}},AxisManager.prototype.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},AxisManager.prototype.every=function(t,e){var n=this.axis;for(var i in t)if(i&&!e(t[i],i,n[i]))return!1;return!0},AxisManager.prototype.filter=function(t,e){var n={},i=this.axis;for(var r in t)r&&e(t[r],r,i[r])&&(n[r]=t[r]);return n},AxisManager.prototype.map=function(t,e){var n={},i=this.axis;for(var r in t)r&&(n[r]=e(t[r],r,i[r]));return n},AxisManager.prototype.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e,n){return!r["default"].isOutside(t,n.range)})},AxisManager}();e.AxisManager=s},function(e,n){e.exports=t},function(t,e,n){"use strict";function toAxis(t,e){return e.reduce(function(e,n,i){return t[i]&&(e[t[i]]=n),e},{})}function createHammer(t,e,n){try{var r={recognizers:[e],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}};return n&&(r.inputClass=n),new i.Manager(t,r)}catch(s){return null}}function convertInputType(t){void 0===t&&(t=[]);var n=!1,r=!1;return t.forEach(function(t){switch(t){case"mouse":r=!0;break;case"touch":n=e.SUPPORT_TOUCH}}),n&&i.TouchInput||r&&i.MouseInput||null}e.__esModule=!0;var i=n(3);e.SUPPORT_TOUCH="ontouchstart"in window,e.UNIQUEKEY="_EGJS_AXES_INPUTTYPE_",e.toAxis=toAxis,e.createHammer=createHammer,e.convertInputType=convertInputType},function(t,e,n){"use strict";e.__esModule=!0;!function(t){t[t.DIRECTION_NONE=1]="DIRECTION_NONE",t[t.DIRECTION_LEFT=2]="DIRECTION_LEFT",t[t.DIRECTION_RIGHT=4]="DIRECTION_RIGHT",t[t.DIRECTION_HORIZONTAL=6]="DIRECTION_HORIZONTAL",t[t.DIRECTION_UP=8]="DIRECTION_UP",t[t.DIRECTION_DOWN=16]="DIRECTION_DOWN",t[t.DIRECTION_VERTICAL=24]="DIRECTION_VERTICAL",t[t.DIRECTION_ALL=30]="DIRECTION_ALL"}(e.DIRECTION||(e.DIRECTION={})),e.TRANSFORM=function(){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""}()},function(t,e,n){"use strict";var i=n(7);t.exports=i["default"]},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=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])};return function(e,n){function __(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(__.prototype=n.prototype,new __)}}(),r=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var s=n(8),o=n(9),a=n(10),u=n(11),h=n(2),c=n(12),p=n(13),m=n(14),l=n(15),f=n(5),d=function(t){function Axes(e,n,i){void 0===e&&(e={});var s=t.call(this)||this;return s.axis=e,s._inputs=[],s.options=r({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:Infinity,minimumDuration:0,deceleration:6e-4},n),s._complementOptions(),s._axm=new h.AxisManager(s.axis,s.options),s._em=new a.EventManager(s,s._axm),s._itm=new u.InterruptManager(s.options),s._am=new o.AnimationManager(s.options,s._itm,s._em,s._axm),s._io=new c.InputObserver(s.options,s._itm,s._em,s._axm,s._am),i&&setTimeout(function(){return s._em.triggerChange(i)},0),s}return i(Axes,t),Axes.prototype._complementOptions=function(){var t=this;Object.keys(this.axis).forEach(function(e){t.axis[e]=r({range:[0,100],bounce:[0,0],circular:[!1,!1]},t.axis[e]),["bounce","circular"].forEach(function(n){var i=t.axis,r=i[e][n];/string|number|boolean/.test(typeof r)&&(i[e][n]=[r,r])})})},Axes.prototype.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},Axes.prototype.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);this._inputs[e].disconnect(),~e&&this._inputs.splice(e,1)}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},Axes.prototype.get=function(t){return this._axm.get(t)},Axes.prototype.setTo=function(t,e){return void 0===e&&(e=0),this._am.setTo(t,e),this},Axes.prototype.setBy=function(t,e){return void 0===e&&(e=0),this._am.setBy(t,e),this},Axes.prototype.isBounceArea=function(t){return this._axm.isOutside(t)},Axes.prototype.destroy=function(){this.disconnect(),this._em.destroy()},Axes.VERSION="#__VERSION__#",Axes.PanInput=p.PanInput,Axes.PinchInput=m.PinchInput,Axes.WheelInput=l.WheelInput,Axes.TRANSFORM=f.TRANSFORM,Axes.DIRECTION_NONE=f.DIRECTION.DIRECTION_NONE,Axes.DIRECTION_LEFT=f.DIRECTION.DIRECTION_LEFT,Axes.DIRECTION_RIGHT=f.DIRECTION.DIRECTION_RIGHT,Axes.DIRECTION_UP=f.DIRECTION.DIRECTION_UP,Axes.DIRECTION_DOWN=f.DIRECTION.DIRECTION_DOWN,Axes.DIRECTION_HORIZONTAL=f.DIRECTION.DIRECTION_HORIZONTAL,Axes.DIRECTION_VERTICAL=f.DIRECTION.DIRECTION_VERTICAL,Axes.DIRECTION_ALL=f.DIRECTION.DIRECTION_ALL,Axes}(s);e["default"]=d},function(t,n){t.exports=e},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(1),s=n(2),o=n(0),a=function(){function AnimationManager(t,e,n,i){this.options=t,this.itm=e,this.em=n,this.axm=i,this.animationEnd=this.animationEnd.bind(this)}return AnimationManager.getDuration=function(t,e,n){return Math.max(Math.min(t,n),e)},AnimationManager.prototype.getDuration=function(t,e,n){var i,s=this;if(void 0!==n)i=n;else{var o=this.axm.map(e,function(e,n){return r["default"].getDuration(Math.abs(Math.abs(e)-Math.abs(t[n])),s.options.deceleration)});i=Object.keys(o).reduce(function(t,e){return Math.max(t,o[e])},-Infinity)}return AnimationManager.getDuration(i,this.options.minimumDuration,this.options.maximumDuration)},AnimationManager.prototype.createAnimationParam=function(t,e,n){void 0===n&&(n=null);var i=this.axm.get(),s=this.axm.get(this.axm.map(t,function(t,e,n){return r["default"].getInsidePosition(t,n.range,n.circular,n.bounce)}));return{depaPos:i,destPos:s,duration:AnimationManager.getDuration(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,s),inputEvent:n,done:this.animationEnd}},AnimationManager.prototype.grab=function(t,e,n){if(this._animateParam&&!t.length){var i=this.axm.get(t),s=this.axm.map(i,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)});this.axm.every(s,function(t,e){return i[e]===t})||this.em.triggerChange(s,e,n),this._animateParam=null,this._raf&&o.cancelAnimationFrame(this._raf),this._raf=null,this.em.triggerAnimationEnd()}},AnimationManager.prototype.restore=function(t){void 0===t&&(t=null);var e=this.axm.get(),n=this.axm.map(e,function(t,e,n){return Math.min(n.range[1],Math.max(n.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},AnimationManager.prototype.animationEnd=function(){this._animateParam=null;var t=this.axm.filter(this.axm.get(),function(t,e,n){return r["default"].isCircularable(t,n.range,n.circular)});Object.keys(t).length>0&&this.setTo(this.axm.map(t,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(),this.axm.isOutside()&&this.restore()},AnimationManager.prototype.animateLoop=function(t,e){if(this._animateParam=i({},t),this._animateParam.startTime=(new Date).getTime(),t.duration){var n=this._animateParam,r=this;!function loop(){if(r._raf=null,r.frame(n)>=1)return s.AxisManager.equal(t.destPos,r.axm.get(Object.keys(t.destPos)))||r.em.triggerChange(t.destPos),void e();r._raf=o.requestAnimationFrame(loop)}()}else this.em.triggerChange(t.destPos),e()},AnimationManager.prototype.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=AnimationManager.getDuration(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},AnimationManager.prototype.animateTo=function(t,e,n){var o=this;void 0===n&&(n=null);var a=this.createAnimationParam(t,e,n),u=i({},a.depaPos),h=this.em.triggerAnimationStart(a),c=this.getUserControll(a);!h&&this.axm.every(c.destPos,function(t,e,n){return r["default"].isCircularable(t,n.range,n.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),h&&!s.AxisManager.equal(c.destPos,u)&&this.animateLoop({depaPos:u,destPos:c.destPos,duration:c.duration,delta:this.axm.getDelta(u,c.destPos)},function(){return o.animationEnd()})},AnimationManager.prototype.frame=function(t){var e=(new Date).getTime()-t.startTime,n=this.easing(e/t.duration),i=t.depaPos;return i=this.axm.map(i,function(e,i,s){return e+=(t.destPos[i]-e)*n,r["default"].getCirculatedPos(e,s.range,s.circular)}),this.em.triggerChange(i),n},AnimationManager.prototype.easing=function(t){return t>1?1:this.options.easing(t)},AnimationManager.prototype.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t);this.grab(n);var i=this.axm.get(n);if(s.AxisManager.equal(t,i))return this;this.itm.setInterrupt(!0);var o=this.axm.filter(t,function(t,e){return i[e]!==t});if(Object.keys(o).length)return o=this.axm.map(o,function(t,n,i){return t=r["default"].getInsidePosition(t,i.range,i.circular),e?t:r["default"].getCirculatedPos(t,i.range,i.circular)}),s.AxisManager.equal(o,i)?this:(e?this.animateTo(o,e):(this.em.triggerChange(o),this.itm.setInterrupt(!1)),this)},AnimationManager.prototype.setBy=function(t,e){return void 0===e&&(e=0),this.setTo(this.axm.map(this.axm.get(Object.keys(t)),function(e,n){return e+t[n]}),e)},AnimationManager}();e.AnimationManager=a},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=function(){function EventManager(t,e){this.axes=t,this.axm=e}return EventManager.prototype.triggerHold=function(t,e,n){this.axes.trigger("hold",{pos:t,input:e,inputEvent:n})},EventManager.prototype.triggerRelease=function(t){t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("release",t)},EventManager.prototype.triggerChange=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var i=this.axm.moveTo(t),r={pos:i.pos,delta:i.delta,holding:!!n,inputEvent:n,input:e,set:n?this.createUserControll(i.pos):function(){}};this.axes.trigger("change",r),n&&this.axm.set(r.set().destPos)},EventManager.prototype.triggerAnimationStart=function(t){return t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("animationStart",t)},EventManager.prototype.triggerAnimationEnd=function(){this.axes.trigger("animationEnd")},EventManager.prototype.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:i({},t),duration:e};return function(t,e){return t&&(n.destPos=i({},t)),e!==undefined&&(n.duration=e),n}},EventManager.prototype.destroy=function(){this.axes.off()},EventManager}();e.EventManager=r},function(t,e,n){"use strict";e.__esModule=!0;var i=function(){function InterruptManager(t){this.options=t,this._prevented=!1}return InterruptManager.prototype.isInterrupting=function(){return this.options.interruptable||this._prevented},InterruptManager.prototype.isInterrupted=function(){return!this.options.interruptable&&this._prevented},InterruptManager.prototype.setInterrupt=function(t){!this.options.interruptable&&(this._prevented=t)},InterruptManager}();e.InterruptManager=i},function(t,e,n){"use strict";e.__esModule=!0;var i=n(2),r=n(1),s=function(){function InputObserver(t,e,n,i,r){this.options=t,this.itm=e,this.em=n,this.axm=i,this.am=r,this.isOutside=!1,this.moveDistance=null}return InputObserver.prototype.atOutside=function(t){var e=this;if(this.isOutside)return this.axm.map(t,function(t,e,n){var i=n.range[0]-n.bounce[0],r=n.range[1]+n.bounce[1];return t>r?r:t<i?i:t});var n=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,i,r){var s=r.range[0],o=r.range[1],a=r.bounce;return t<s?s-e.am.easing((s-t)/(a[0]*n))*a[0]:t>o?o+e.am.easing((t-o)/(a[1]*n))*a[1]:t})},InputObserver.prototype.get=function(t){return this.axm.get(t.axes)},InputObserver.prototype.hold=function(t,e){!this.itm.isInterrupted()&&t.axes.length&&(this.itm.setInterrupt(!0),this.am.grab(t.axes,t,e),this.moveDistance||this.em.triggerHold(this.axm.get(),t,e),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes))},InputObserver.prototype.change=function(t,e,n){if(this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,s=this.axm.get(t.axes);i=this.axm.map(this.moveDistance||s,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),i=this.axm.map(i,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)}),this.isOutside&&this.axm.every(s,function(t,e,n){return!r["default"].isOutside(t,n.range)})&&(this.isOutside=!1),i=this.atOutside(i),this.em.triggerChange(i,t,e)}},InputObserver.prototype.release=function(t,e,n,s){if(this.itm.isInterrupting()&&this.moveDistance){var o=this.axm.get(t.axes),a=this.axm.get(),u=this.axm.get(this.axm.map(n,function(t,e,n){return r["default"].getInsidePosition(o[e]+t,n.range,n.circular,n.bounce)})),h={depaPos:a,destPos:u,duration:this.am.getDuration(u,o,s),delta:this.axm.getDelta(a,u),inputEvent:e,input:t};this.em.triggerRelease(h),this.moveDistance=null;var c=this.am.getUserControll(h),p=i.AxisManager.equal(c.destPos,a);p||0===c.duration?(!p&&this.em.triggerChange(c.destPos,t,e),this.itm.setInterrupt(!1),this.axm.isOutside()&&this.am.restore(e)):this.am.animateTo(c.destPos,c.duration,e)}},InputObserver}();e.InputObserver=s},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(3),s=n(5),o=n(0),a=n(4),u=function(){function PanInput(t,e){if(this.axes=[],this.hammer=null,this.element=null,void 0===r)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=o.$(t),this.options=i({inputType:["touch","mouse"],scale:[1,1],thresholdAngle:45,threshold:0},e),this.onHammerInput=this.onHammerInput.bind(this),this.onPanmove=this.onPanmove.bind(this),this.onPanend=this.onPanend.bind(this)}return PanInput.getDirectionByAngle=function(t,e){if(e<0||e>90)return s.DIRECTION.DIRECTION_NONE;var n=Math.abs(t);return n>e&&n<180-e?s.DIRECTION.DIRECTION_VERTICAL:s.DIRECTION.DIRECTION_HORIZONTAL},PanInput.getNextOffset=function(t,e){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.abs(n/-e);return[t[0]/2*i,t[1]/2*i]},PanInput.useDirection=function(t,e,n){return n?!!(e===s.DIRECTION.DIRECTION_ALL||e&t&&n&t):!!(e&t)},PanInput.prototype.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?s.DIRECTION.DIRECTION_ALL:e?s.DIRECTION.DIRECTION_HORIZONTAL:n?s.DIRECTION.DIRECTION_VERTICAL:s.DIRECTION.DIRECTION_NONE,this.axes=t},PanInput.prototype.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.dettachEvent(),this.hammer.add(new r.Pan(e));else{var n=this.element[a.UNIQUEKEY];n?this.hammer.destroy():n=String(Math.round(Math.random()*(new Date).getTime()));var i=a.convertInputType(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=a.createHammer(this.element,[r.Pan,e],i),this.element[a.UNIQUEKEY]=n}return this.attachEvent(t),this},PanInput.prototype.disconnect=function(){return this.hammer&&this.dettachEvent(),this._direction=s.DIRECTION.DIRECTION_NONE,this},PanInput.prototype.destroy=function(){this.disconnect(),this.hammer&&this.hammer.destroy(),delete this.element[a.UNIQUEKEY],this.element=null,this.hammer=null},PanInput.prototype.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},PanInput.prototype.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},PanInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},PanInput.prototype.onHammerInput=function(t){this.isEnable()&&(t.isFirst?this.observer.hold(this,t):t.isFinal&&this.onPanend(t))},PanInput.prototype.onPanmove=function(t){var e=PanInput.getDirectionByAngle(t.angle,this.options.thresholdAngle),n=this.hammer.session.prevInput;n?(t.offsetX=t.deltaX-n.deltaX,t.offsetY=t.deltaY-n.deltaY):(t.offsetX=0,t.offsetY=0);var i=this.getOffset([t.offsetX,t.offsetY],[PanInput.useDirection(s.DIRECTION.DIRECTION_HORIZONTAL,this._direction,e),PanInput.useDirection(s.DIRECTION.DIRECTION_VERTICAL,this._direction,e)]),r=i.some(function(t){return 0!==t});r&&(t.srcEvent.preventDefault(),t.srcEvent.stopPropagation()),t.preventSystemEvent=r,r&&this.observer.change(this,t,a.toAxis(this.axes,i))},PanInput.prototype.onPanend=function(t){var e=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[PanInput.useDirection(s.DIRECTION.DIRECTION_HORIZONTAL,this._direction),PanInput.useDirection(s.DIRECTION.DIRECTION_VERTICAL,this._direction)]);e=PanInput.getNextOffset(e,this.observer.options.deceleration),this.observer.release(this,t,a.toAxis(this.axes,e))},PanInput.prototype.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},PanInput.prototype.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),this.observer=null},PanInput.prototype.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},PanInput}();e.PanInput=u},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(3),s=n(0),o=n(4),a=function(){function PinchInput(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._base=null,this._prev=null,void 0===r)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=s.$(t),this.options=i({scale:1,threshold:0},e),this.onPinchStart=this.onPinchStart.bind(this),this.onPinchMove=this.onPinchMove.bind(this),this.onPinchEnd=this.onPinchEnd.bind(this)}return PinchInput.prototype.mapAxes=function(t){this.axes=t},PinchInput.prototype.connect=function(t){var e={threshold:this.options.threshold};if(this.hammer)this.dettachEvent(),this.hammer.add(new r.Pinch(e));else{var n=this.element[o.UNIQUEKEY];n?this.hammer.destroy():n=String(Math.round(Math.random()*(new Date).getTime())),this.hammer=o.createHammer(this.element,[r.Pinch,e],r.TouchInput),this.element[o.UNIQUEKEY]=n}return this.attachEvent(t),this},PinchInput.prototype.disconnect=function(){return this.hammer&&this.dettachEvent(),this},PinchInput.prototype.destroy=function(){this.disconnect(),this.hammer&&this.hammer.destroy(),delete this.element[o.UNIQUEKEY],this.element=null,this.hammer=null},PinchInput.prototype.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,o.toAxis(this.axes,[e])),this._prev=t.scale},PinchInput.prototype.onPinchMove=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,o.toAxis(this.axes,[e])),this._prev=t.scale},PinchInput.prototype.onPinchEnd=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,o.toAxis(this.axes,[e])),this.observer.release(this,t,o.toAxis(this.axes,[0]),0),this._base=null,this._prev=null},PinchInput.prototype.getOffset=function(t,e){return void 0===e&&(e=1),this._base*(t-e)*this.options.scale},PinchInput.prototype.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},PinchInput.prototype.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},PinchInput.prototype.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},PinchInput.prototype.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},PinchInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},PinchInput}();e.PinchInput=a},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(0),s=n(4),o=function(){function WheelInput(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._timer=null,this.element=r.$(t),this.options=i({scale:1,throttle:100},e),this.onWheel=this.onWheel.bind(this)}return WheelInput.prototype.mapAxes=function(t){this.axes=t},WheelInput.prototype.connect=function(t){return this.dettachEvent(),this.attachEvent(t),this},WheelInput.prototype.disconnect=function(){return this.dettachEvent(),this},WheelInput.prototype.destroy=function(){this.disconnect(),this.element=null},WheelInput.prototype.onWheel=function(t){var e=this;this._isEnabled&&(t.preventDefault(),0!==t.deltaY&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.hold(e,t);var n=(t.deltaY>0?-1:1)*e.options.scale;e.observer.change(e,t,s.toAxis(e.axes,[n])),e.observer.release(e,t,s.toAxis(e.axes,[0]))},200)))},WheelInput.prototype.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},WheelInput.prototype.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null},WheelInput.prototype.enable=function(){return this._isEnabled=!0,this},WheelInput.prototype.disable=function(){return this._isEnabled=!1,this},WheelInput.prototype.isEnable=function(){return this._isEnabled},WheelInput}();e.WheelInput=o}])}); | ||
//# sourceMappingURL=axes.min.js.map |
@@ -8,3 +8,3 @@ /*! | ||
* | ||
* @version 2.0.0 | ||
* @version 2.1.1 | ||
* | ||
@@ -15,2 +15,3 @@ * All-in-one packaged file for ease use of '@egjs/axes' with below dependencies. | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Axes",[],e):"object"==typeof exports?exports.Axes=e():(t.eg=t.eg||{},t.eg.Axes=e())}(this,function(){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,n){"use strict";function $(t,e){void 0===e&&(e=!1);var n;if("string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=t,n=Array.prototype.slice.call(i.childNodes)}else n=Array.prototype.slice.call(document.querySelectorAll(t));e||(n=n.length>=1?n[0]:undefined)}else t===window?n=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in window&&t instanceof jQuery||t.constructor.prototype.jquery?n=e?t.toArray():t.get(0):Array.isArray(t)&&(n=t.map(function(t){return $(t)}),e||(n=n.length>=1?n[0]:undefined)):n=t;return n}function requestAnimationFrame(t){return i(t)}function cancelAnimationFrame(t){r(t)}e.__esModule=!0,e.$=$;var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame,r=window.cancelAnimationFrame||window.webkitCancelAnimationFrame;if(i&&!r){var o={},s=i;i=function(t){function wrapCallback(n){o[e]&&t(n)}var e=s(wrapCallback);return o[e]=!0,e},r=function(t){delete o[t]}}else i&&r||(i=function(t){return window.setTimeout(function(){t(window.performance&&window.performance.now())},16)},r=window.clearTimeout);e.requestAnimationFrame=requestAnimationFrame,e.cancelAnimationFrame=cancelAnimationFrame},function(t,e,n){"use strict";e.__esModule=!0;var i={getInsidePosition:function(t,e,n,i){var r=t,o=[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(o[0],r),r=Math.min(o[1],r),+Math.min(o[1],Math.max(o[0],r)).toFixed(5)},isOutside:function(t,e){return t<e[0]||t>e[1]},getDuration:function(t,e){var n=Math.sqrt(t/e*2);return n<100?0:n},isCircularable:function(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]},getCirculatedPos:function(t,e,n){var i=t,r=e[0],o=e[1],s=o-r;return n[1]&&t>o&&(i=(i-o)%s+r),n[0]&&t<r&&(i=(i-r)%s+o),+i.toFixed(5)}};e["default"]=i},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(1),o=function(){function AxisManager(t,e){var n=this;this.axis=t,this.options=e,this._pos=Object.keys(this.axis).reduce(function(t,e){return t[e]=n.axis[e].range[0],t},{})}return AxisManager.equal=function(t,e){for(var n in t)if(t[n]!==e[n])return!1;return!0},AxisManager.prototype.getDelta=function(t,e){var n=this.get(t);return this.map(this.get(e),function(t,e){return t-n[e]})},AxisManager.prototype.get=function(t){var e=this;return t&&Array.isArray(t)?t.reduce(function(t,n){return n&&n in e._pos&&(t[n]=e._pos[n]),t},{}):i({},this._pos,t||{})},AxisManager.prototype.moveTo=function(t){var e=this,n=this.map(this._pos,function(n,i){return t[i]?t[i]-e._pos[i]:0});return this.set(t),{pos:i({},this._pos),delta:n}},AxisManager.prototype.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},AxisManager.prototype.every=function(t,e){var n=this.axis;for(var i in t)if(i&&!e(t[i],i,n[i]))return!1;return!0},AxisManager.prototype.filter=function(t,e){var n={},i=this.axis;for(var r in t)r&&e(t[r],r,i[r])&&(n[r]=t[r]);return n},AxisManager.prototype.map=function(t,e){var n={},i=this.axis;for(var r in t)r&&(n[r]=e(t[r],r,i[r]));return n},AxisManager.prototype.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e,n){return!r["default"].isOutside(t,n.range)})},AxisManager}();e.AxisManager=o},function(t,e,n){var i;!function(r,o,s,a){"use strict";function setTimeoutContext(t,e,n){return setTimeout(bindFn(t,n),e)}function invokeArrayArg(t,e,n){return!!Array.isArray(t)&&(each(t,n[e],n),!0)}function each(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==a)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 deprecate(t,e,n){var i="DEPRECATED METHOD: "+e+"\n"+n+" AT \n";return function(){var e=new Error("get-stack-trace"),n=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=r.console&&(r.console.warn||r.console.log);return o&&o.call(r.console,i,n),t.apply(this,arguments)}}function inherit(t,e,n){var i,r=e.prototype;i=t.prototype=Object.create(r),i.constructor=t,i._super=r,n&&u(i,n)}function bindFn(t,e){return function(){return t.apply(e,arguments)}}function boolOrFn(t,e){return typeof t==p?t.apply(e?e[0]||a:a,e):t}function ifUndefined(t,e){return t===a?e:t}function addEventListeners(t,e,n){each(splitStr(e),function(e){t.addEventListener(e,n,!1)})}function removeEventListeners(t,e,n){each(splitStr(e),function(e){t.removeEventListener(e,n,!1)})}function hasParent(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function inStr(t,e){return t.indexOf(e)>-1}function splitStr(t){return t.trim().split(/\s+/g)}function inArray(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}function toArray(t){return Array.prototype.slice.call(t,0)}function uniqueArray(t,e,n){for(var i=[],r=[],o=0;o<t.length;){var s=e?t[o][e]:t[o];inArray(r,s)<0&&i.push(t[o]),r[o]=s,o++}return n&&(i=e?i.sort(function(t,n){return t[e]>n[e]}):i.sort()),i}function prefixed(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o<h.length;){if(n=h[o],(i=n?n+r:e)in t)return i;o++}return a}function uniqueId(){return v++}function getWindowForElement(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||r}function Input(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){boolOrFn(t.options.enable,[t])&&n.handler(e)},this.init()}function createInputInstance(t){var e=t.options.inputClass;return new(e||(y?PointerEventInput:T?TouchInput:_?TouchMouseInput:MouseInput))(t,inputHandler)}function inputHandler(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&A&&i-r==0,s=e&(O|b)&&i-r==0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,computeInputData(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function computeInputData(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=simpleCloneInputData(e)),r>1&&!n.firstMultiple?n.firstMultiple=simpleCloneInputData(e):1===r&&(n.firstMultiple=!1);var o=n.firstInput,s=n.firstMultiple,a=s?s.center:o.center,u=e.center=getCenter(i);e.timeStamp=m(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=getAngle(a,u),e.distance=getDistance(a,u),computeDeltaXY(n,e),e.offsetDirection=getDirection(e.deltaX,e.deltaY);var h=getVelocity(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=h.x,e.overallVelocityY=h.y,e.overallVelocity=f(h.x)>f(h.y)?h.x:h.y,e.scale=s?getScale(s.pointers,i):1,e.rotation=s?getRotation(s.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,computeIntervalInputData(n,e);var c=t.element;hasParent(e.srcEvent.target,c)&&(c=e.srcEvent.target),e.target=c}function computeDeltaXY(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==A&&o.eventType!==O||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}function computeIntervalInputData(t,e){var n,i,r,o,s=t.lastInterval||e,u=e.timeStamp-s.timeStamp;if(e.eventType!=b&&(u>E||s.velocity===a)){var h=e.deltaX-s.deltaX,c=e.deltaY-s.deltaY,p=getVelocity(u,h,c);i=p.x,r=p.y,n=f(p.x)>f(p.y)?p.x:p.y,o=getDirection(h,c),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}function simpleCloneInputData(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:l(t.pointers[n].clientX),clientY:l(t.pointers[n].clientY)},n++;return{timeStamp:m(),pointers:e,center:getCenter(e),deltaX:t.deltaX,deltaY:t.deltaY}}function getCenter(t){var e=t.length;if(1===e)return{x:l(t[0].clientX),y:l(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:l(n/e),y:l(i/e)}}function getVelocity(t,e,n){return{x:e/t||0,y:n/t||0}}function getDirection(t,e){return t===e?P:f(t)>=f(e)?t<0?R:C:e<0?D:M}function getDistance(t,e,n){n||(n=z);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function getAngle(t,e,n){n||(n=z);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function getRotation(t,e){return getAngle(e[1],e[0],L)+getAngle(t[1],t[0],L)}function getScale(t,e){return getDistance(e[0],e[1],L)/getDistance(t[0],t[1],L)}function MouseInput(){this.evEl=q,this.evWin=H,this.pressed=!1,Input.apply(this,arguments)}function PointerEventInput(){this.evEl=W,this.evWin=Y,Input.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function SingleTouchInput(){this.evTarget=X,this.evWin=V,this.started=!1,Input.apply(this,arguments)}function normalizeSingleTouches(t,e){var n=toArray(t.touches),i=toArray(t.changedTouches);return e&(O|b)&&(n=uniqueArray(n.concat(i),"identifier",!0)),[n,i]}function TouchInput(){this.evTarget=Z,this.targetIds={},Input.apply(this,arguments)}function getTouches(t,e){var n=toArray(t.touches),i=this.targetIds;if(e&(A|x)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,s=toArray(t.changedTouches),a=[],u=this.target;if(o=n.filter(function(t){return hasParent(t.target,u)}),e===A)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;for(r=0;r<s.length;)i[s[r].identifier]&&a.push(s[r]),e&(O|b)&&delete i[s[r].identifier],r++;return a.length?[uniqueArray(o.concat(a),"identifier",!0),a]:void 0}function TouchMouseInput(){Input.apply(this,arguments);var t=bindFn(this.handler,this);this.touch=new TouchInput(this.manager,t),this.mouse=new MouseInput(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function recordTouches(t,e){t&A?(this.primaryTouch=e.changedPointers[0].identifier,setLastTouch.call(this,e)):t&(O|b)&&setLastTouch.call(this,e)}function setLastTouch(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY};this.lastTouches.push(n);var i=this.lastTouches,r=function(){var t=i.indexOf(n);t>-1&&i.splice(t,1)};setTimeout(r,G)}}function isSyntheticEvent(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(e-r.x),s=Math.abs(n-r.y);if(o<=Q&&s<=Q)return!0}return!1}function TouchAction(t,e){this.manager=t,this.set(e)}function cleanTouchActions(t){if(inStr(t,et))return et;var e=inStr(t,nt),n=inStr(t,it);return e&&n?et:e||n?e?nt:it:inStr(t,tt)?tt:J}function Recognizer(t){this.options=u({},this.defaults,t||{}),this.id=uniqueId(),this.manager=null,this.options.enable=ifUndefined(this.options.enable,!0),this.state=ot,this.simultaneous={},this.requireFail=[]}function stateStr(t){return t&ct?"cancel":t&ut?"end":t&at?"move":t&st?"start":""}function directionStr(t){return t==M?"down":t==D?"up":t==R?"left":t==C?"right":""}function getRecognizerByNameIfManager(t,e){var n=e.manager;return n?n.get(t):t}function AttrRecognizer(){Recognizer.apply(this,arguments)}function PanRecognizer(){AttrRecognizer.apply(this,arguments),this.pX=null,this.pY=null}function PinchRecognizer(){AttrRecognizer.apply(this,arguments)}function PressRecognizer(){Recognizer.apply(this,arguments),this._timer=null,this._input=null}function RotateRecognizer(){AttrRecognizer.apply(this,arguments)}function SwipeRecognizer(){AttrRecognizer.apply(this,arguments)}function TapRecognizer(){Recognizer.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Hammer(t,e){return e=e||{},e.recognizers=ifUndefined(e.recognizers,Hammer.defaults.preset),new Manager(t,e)}function Manager(t,e){this.options=u({},Hammer.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=createInputInstance(this),this.touchAction=new TouchAction(this,this.options.touchAction),toggleCssProps(this,!0),each(this.options.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function toggleCssProps(t,e){var n=t.element;if(n.style){var i;each(t.options.cssProps,function(r,o){i=prefixed(n.style,o),e?(t.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=t.oldCssProps[i]||""}),e||(t.oldCssProps={})}}function triggerDomEvent(t,e){var n=o.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=e,e.target.dispatchEvent(n)}var u,h=["","webkit","Moz","MS","ms","o"],c=o.createElement("div"),p="function",l=Math.round,f=Math.abs,m=Date.now;u="function"!=typeof Object.assign?function(t){if(t===a||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(i!==a&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var d=deprecate(function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===a)&&(t[i[r]]=e[i[r]]),r++;return t},"extend","Use `assign`."),g=deprecate(function(t,e){return d(t,e,!0)},"merge","Use `assign`."),v=1,I=/mobile|tablet|ip(ad|hone|od)|android/i,_="ontouchstart"in r,y=prefixed(r,"PointerEvent")!==a,T=_&&I.test(navigator.userAgent),E=25,A=1,x=2,O=4,b=8,P=1,R=2,C=4,D=8,M=16,N=R|C,w=D|M,S=N|w,z=["x","y"],L=["clientX","clientY"];Input.prototype={handler:function(){},init:function(){this.evEl&&addEventListeners(this.element,this.evEl,this.domHandler),this.evTarget&&addEventListeners(this.target,this.evTarget,this.domHandler),this.evWin&&addEventListeners(getWindowForElement(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&removeEventListeners(this.element,this.evEl,this.domHandler),this.evTarget&&removeEventListeners(this.target,this.evTarget,this.domHandler),this.evWin&&removeEventListeners(getWindowForElement(this.element),this.evWin,this.domHandler)}};var k={mousedown:A,mousemove:x,mouseup:O},q="mousedown",H="mousemove mouseup";inherit(MouseInput,Input,{handler:function(t){var e=k[t.type];e&A&&0===t.button&&(this.pressed=!0),e&x&&1!==t.which&&(e=O),this.pressed&&(e&O&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))}});var F={pointerdown:A,pointermove:x,pointerup:O,pointercancel:b,pointerout:b},j={2:"touch",3:"pen",4:"mouse",5:"kinect"},W="pointerdown",Y="pointermove pointerup pointercancel";r.MSPointerEvent&&!r.PointerEvent&&(W="MSPointerDown",Y="MSPointerMove MSPointerUp MSPointerCancel"),inherit(PointerEventInput,Input,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=F[i],o=j[t.pointerType]||t.pointerType,s="touch"==o,a=inArray(e,t.pointerId,"pointerId");r&A&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&(O|b)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))}});var U={touchstart:A,touchmove:x,touchend:O,touchcancel:b},X="touchstart",V="touchstart touchmove touchend touchcancel";inherit(SingleTouchInput,Input,{handler:function(t){var e=U[t.type];if(e===A&&(this.started=!0),this.started){var n=normalizeSingleTouches.call(this,t,e);e&(O|b)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:t})}}});var B={touchstart:A,touchmove:x,touchend:O,touchcancel:b},Z="touchstart touchmove touchend touchcancel";inherit(TouchInput,Input,{handler:function(t){var e=B[t.type],n=getTouches.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:t})}});var G=2500,Q=25;inherit(TouchMouseInput,Input,{handler:function(t,e,n){var i="touch"==n.pointerType,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)recordTouches.call(this,e,n);else if(r&&isSyntheticEvent.call(this,n))return;this.callback(t,e,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var $=prefixed(c.style,"touchAction"),K=$!==a,J="auto",tt="manipulation",et="none",nt="pan-x",it="pan-y",rt=function(){if(!K)return!1;var t={},e=r.CSS&&r.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(n){t[n]=!e||r.CSS.supports("touch-action",n)}),t}();TouchAction.prototype={set:function(t){"compute"==t&&(t=this.compute()),K&&this.manager.element.style&&rt[t]&&(this.manager.element.style[$]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return each(this.manager.recognizers,function(e){boolOrFn(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),cleanTouchActions(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var i=this.actions,r=inStr(i,et)&&!rt[et],o=inStr(i,it)&&!rt[it],s=inStr(i,nt)&&!rt[nt];if(r){var a=1===t.pointers.length,u=t.distance<2,h=t.deltaTime<250;if(a&&u&&h)return}return s&&o?void 0:r||o&&n&N||s&&n&w?this.preventSrc(e):void 0},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var ot=1,st=2,at=4,ut=8,ht=ut,ct=16;Recognizer.prototype={defaults:{},set:function(t){return u(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(invokeArrayArg(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=getRecognizerByNameIfManager(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return invokeArrayArg(t,"dropRecognizeWith",this)?this:(t=getRecognizerByNameIfManager(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(invokeArrayArg(t,"requireFailure",this))return this;var e=this.requireFail;return t=getRecognizerByNameIfManager(t,this),-1===inArray(e,t)&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(invokeArrayArg(t,"dropRequireFailure",this))return this;t=getRecognizerByNameIfManager(t,this);var e=inArray(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function emit(n){e.manager.emit(n,t)}var e=this,n=this.state;n<ut&&emit(e.options.event+stateStr(n)),emit(e.options.event),t.additionalEvent&&emit(t.additionalEvent),n>=ut&&emit(e.options.event+stateStr(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(32|ot)))return!1;t++}return!0},recognize:function(t){var e=u({},t);if(!boolOrFn(this.options.enable,[this,e]))return this.reset(),void(this.state=32);this.state&(ht|ct|32)&&(this.state=ot),this.state=this.process(e),this.state&(st|at|ut|ct)&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},inherit(AttrRecognizer,Recognizer,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,n=t.eventType,i=e&(st|at),r=this.attrTest(t);return i&&(n&b||!r)?e|ct:i||r?n&O?e|ut:e&st?e|at:st:32}}),inherit(PanRecognizer,AttrRecognizer,{defaults:{event:"pan",threshold:10,pointers:1,direction:S},getTouchAction:function(){var t=this.options.direction,e=[];return t&N&&e.push(it),t&w&&e.push(nt),e},directionTest:function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(e.direction&N?(r=0===o?P:o<0?R:C,n=o!=this.pX,i=Math.abs(t.deltaX)):(r=0===s?P:s<0?D:M,n=s!=this.pY,i=Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},attrTest:function(t){return AttrRecognizer.prototype.attrTest.call(this,t)&&(this.state&st||!(this.state&st)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=directionStr(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),inherit(PinchRecognizer,AttrRecognizer,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[et]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&st)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),inherit(PressRecognizer,Recognizer,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[J]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,r=t.deltaTime>e.time;if(this._input=t,!i||!n||t.eventType&(O|b)&&!r)this.reset();else if(t.eventType&A)this.reset(),this._timer=setTimeoutContext(function(){this.state=ht,this.tryEmit()},e.time,this);else if(t.eventType&O)return ht;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===ht&&(t&&t.eventType&O?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=m(),this.manager.emit(this.options.event,this._input)))}}),inherit(RotateRecognizer,AttrRecognizer,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[et]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&st)}}),inherit(SwipeRecognizer,AttrRecognizer,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:N|w,pointers:1},getTouchAction:function(){return PanRecognizer.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(N|w)?e=t.overallVelocity:n&N?e=t.overallVelocityX:n&w&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&f(e)>this.options.velocity&&t.eventType&O},emit:function(t){var e=directionStr(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),inherit(TapRecognizer,Recognizer,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,r=t.deltaTime<e.time;if(this.reset(),t.eventType&A&&0===this.count)return this.failTimeout();if(i&&r&&n){if(t.eventType!=O)return this.failTimeout();var o=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter||getDistance(this.pCenter,t.center)<e.posThreshold;this.pTime=t.timeStamp,this.pCenter=t.center,s&&o?this.count+=1:this.count=1,this._input=t;if(0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=setTimeoutContext(function(){this.state=ht,this.tryEmit()},e.interval,this),st):ht}return 32},failTimeout:function(){return this._timer=setTimeoutContext(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ht&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Hammer.VERSION="2.0.7",Hammer.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[RotateRecognizer,{enable:!1}],[PinchRecognizer,{enable:!1},["rotate"]],[SwipeRecognizer,{direction:N}],[PanRecognizer,{direction:N},["swipe"]],[TapRecognizer],[TapRecognizer,{event:"doubletap",taps:2},["tap"]],[PressRecognizer]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};Manager.prototype={set:function(t){return u(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var n,i=this.recognizers,r=e.curRecognizer;(!r||r&&r.state&ht)&&(r=e.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===e.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&n.state&(st|at|ut)&&(r=e.curRecognizer=n),o++}},get:function(t){if(t instanceof Recognizer)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];return null},add:function(t){if(invokeArrayArg(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(invokeArrayArg(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,n=inArray(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){if(t!==a&&e!==a){var n=this.handlers;return each(splitStr(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this}},off:function(t,e){if(t!==a){var n=this.handlers;return each(splitStr(t),function(t){e?n[t]&&n[t].splice(inArray(n[t],e),1):delete n[t]}),this}},emit:function(t,e){this.options.domEvents&&triggerDomEvent(t,e);var n=this.handlers[t]&&this.handlers[t].slice();if(n&&n.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var i=0;i<n.length;)n[i](e),i++}},destroy:function(){this.element&&toggleCssProps(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},u(Hammer,{INPUT_START:A,INPUT_MOVE:x,INPUT_END:O,INPUT_CANCEL:b,STATE_POSSIBLE:ot,STATE_BEGAN:st,STATE_CHANGED:at,STATE_ENDED:ut,STATE_RECOGNIZED:ht,STATE_CANCELLED:ct,STATE_FAILED:32,DIRECTION_NONE:P,DIRECTION_LEFT:R,DIRECTION_RIGHT:C,DIRECTION_UP:D,DIRECTION_DOWN:M,DIRECTION_HORIZONTAL:N,DIRECTION_VERTICAL:w,DIRECTION_ALL:S,Manager:Manager,Input:Input,TouchAction:TouchAction,TouchInput:TouchInput,MouseInput:MouseInput,PointerEventInput:PointerEventInput,TouchMouseInput:TouchMouseInput,SingleTouchInput:SingleTouchInput,Recognizer:Recognizer,AttrRecognizer:AttrRecognizer,Tap:TapRecognizer,Pan:PanRecognizer,Swipe:SwipeRecognizer,Pinch:PinchRecognizer,Rotate:RotateRecognizer,Press:PressRecognizer,on:addEventListeners,off:removeEventListeners,each:each,merge:g,extend:d,assign:u,inherit:inherit,bindFn:bindFn,prefixed:prefixed}),(void 0!==r?r:"undefined"!=typeof self?self:{}).Hammer=Hammer,(i=function(){return Hammer}.call(e,n,e,t))!==a&&(t.exports=i)}(window,document)},function(t,e,n){"use strict";function toAxis(t,e){return e.reduce(function(e,n,i){return t[i]&&(e[t[i]]=n),e},{})}function createHammer(t,e,n){try{var r={recognizers:[e],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}};return n&&(r.inputClass=n),new i.Manager(t,r)}catch(o){return null}}function convertInputType(t){void 0===t&&(t=[]);var n=!1,r=!1;return t.forEach(function(t){switch(t){case"mouse":r=!0;break;case"touch":n=e.SUPPORT_TOUCH}}),n&&i.TouchInput||r&&i.MouseInput||null}e.__esModule=!0;var i=n(3);e.SUPPORT_TOUCH="ontouchstart"in window,e.UNIQUEKEY="_EGJS_AXES_INPUTTYPE_",e.toAxis=toAxis,e.createHammer=createHammer,e.convertInputType=convertInputType},function(t,e,n){"use strict";e.__esModule=!0;!function(t){t[t.DIRECTION_NONE=1]="DIRECTION_NONE",t[t.DIRECTION_LEFT=2]="DIRECTION_LEFT",t[t.DIRECTION_RIGHT=4]="DIRECTION_RIGHT",t[t.DIRECTION_HORIZONTAL=6]="DIRECTION_HORIZONTAL",t[t.DIRECTION_UP=8]="DIRECTION_UP",t[t.DIRECTION_DOWN=16]="DIRECTION_DOWN",t[t.DIRECTION_VERTICAL=24]="DIRECTION_VERTICAL",t[t.DIRECTION_ALL=30]="DIRECTION_ALL"}(e.DIRECTION||(e.DIRECTION={})),e.TRANSFORM=function(){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""}()},function(t,e,n){"use strict";var i=n(7);t.exports=i["default"]},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=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])};return function(e,n){function __(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(__.prototype=n.prototype,new __)}}(),r=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var o=n(8),s=n(9),a=n(10),u=n(11),h=n(2),c=n(12),p=n(13),l=n(14),f=n(15),m=n(5),d=function(t){function Axes(e,n,i){void 0===e&&(e={});var o=t.call(this)||this;return o.axis=e,o._inputs=[],o.options=r({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:Infinity,minimumDuration:0,deceleration:6e-4},n),o._complementOptions(),o._axm=new h.AxisManager(o.axis,o.options),o._em=new a.EventManager(o,o._axm),o._itm=new u.InterruptManager(o.options),o._am=new s.AnimationManager(o.options,o._itm,o._em,o._axm),o._io=new c.InputObserver(o.options,o._itm,o._em,o._axm,o._am),i&&setTimeout(function(){return o._em.triggerChange(i)},0),o}return i(Axes,t),Axes.prototype._complementOptions=function(){var t=this;Object.keys(this.axis).forEach(function(e){t.axis[e]=r({range:[0,100],bounce:[0,0],circular:[!1,!1]},t.axis[e]),["bounce","circular"].forEach(function(n){var i=t.axis,r=i[e][n];/string|number|boolean/.test(typeof r)&&(i[e][n]=[r,r])})})},Axes.prototype.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},Axes.prototype.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);this._inputs[e].disconnect(),~e&&this._inputs.splice(e,1)}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},Axes.prototype.get=function(t){return this._axm.get(t)},Axes.prototype.setTo=function(t,e){return void 0===e&&(e=0),this._am.setTo(t,e),this},Axes.prototype.setBy=function(t,e){return void 0===e&&(e=0),this._am.setBy(t,e),this},Axes.prototype.isBounceArea=function(t){return this._axm.isOutside(t)},Axes.prototype.destroy=function(){this.disconnect(),this._em.destroy()},Axes.VERSION="#__VERSION__#",Axes.PanInput=p.PanInput,Axes.PinchInput=l.PinchInput,Axes.WheelInput=f.WheelInput,Axes.TRANSFORM=m.TRANSFORM,Axes.DIRECTION_NONE=m.DIRECTION.DIRECTION_NONE,Axes.DIRECTION_LEFT=m.DIRECTION.DIRECTION_LEFT,Axes.DIRECTION_RIGHT=m.DIRECTION.DIRECTION_RIGHT,Axes.DIRECTION_UP=m.DIRECTION.DIRECTION_UP,Axes.DIRECTION_DOWN=m.DIRECTION.DIRECTION_DOWN,Axes.DIRECTION_HORIZONTAL=m.DIRECTION.DIRECTION_HORIZONTAL,Axes.DIRECTION_VERTICAL=m.DIRECTION.DIRECTION_VERTICAL,Axes.DIRECTION_ALL=m.DIRECTION.DIRECTION_ALL,Axes}(o);e["default"]=d},function(t,e,n){!function(e,n){t.exports=n()}(0,function(){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=0)}([function(t,e,n){"use strict";var i=n(1),r=function(t){return t&&t.__esModule?t:{"default":t}}(i);r["default"].VERSION="2.0.0",t.exports=r["default"]},function(t,e,n){"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){function Component(){_classCallCheck(this,Component),this._eventHandler={},this.options={}}return Component.prototype.trigger=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=this._eventHandler[t]||[];if(!(n.length>0))return!0;n=n.concat(),e.eventType=t;var i=!1,r=[e],o=0;e.stop=function(){i=!0};for(var s=arguments.length,a=Array(s>2?s-2:0),u=2;u<s;u++)a[u-2]=arguments[u];for(a.length>=1&&(r=r.concat(a)),o=0;n[o];o++)n[o].apply(this,r);return!i},Component.prototype.once=function(t,e){if("object"===(void 0===t?"undefined":i(t))&&void 0===e){var n=t,r=void 0;for(r in n)this.once(r,n[r]);return this}if("string"==typeof t&&"function"==typeof e){var o=this;this.on(t,function listener(){for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];e.apply(o,i),o.off(t,listener)})}return this},Component.prototype.hasOn=function(t){return!!this._eventHandler[t]},Component.prototype.on=function(t,e){if("object"===(void 0===t?"undefined":i(t))&&void 0===e){var n=t,r=void 0;for(r in n)this.on(r,n[r]);return this}if("string"==typeof t&&"function"==typeof e){var o=this._eventHandler[t];void 0===o&&(this._eventHandler[t]=[],o=this._eventHandler[t]),o.push(e)}return this},Component.prototype.off=function(t,e){if(void 0===t)return this._eventHandler={},this;if(void 0===e){if("string"==typeof t)return this._eventHandler[t]=undefined,this;var n=t,i=void 0;for(i in n)this.off(i,n[i]);return this}var r=this._eventHandler[t];if(r){var o=void 0,s=void 0;for(o=0;(s=r[o])!==undefined;o++)if(s===e){r=r.splice(o,1);break}}return this},Component}();e["default"]=r,t.exports=e["default"]}])})},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(1),o=n(2),s=n(0),a=function(){function AnimationManager(t,e,n,i){this.options=t,this.itm=e,this.em=n,this.axm=i,this.animationEnd=this.animationEnd.bind(this)}return AnimationManager.getDuration=function(t,e,n){return Math.max(Math.min(t,n),e)},AnimationManager.prototype.getDuration=function(t,e,n){var i,o=this;if(void 0!==n)i=n;else{var s=this.axm.map(e,function(e,n){return r["default"].getDuration(Math.abs(Math.abs(e)-Math.abs(t[n])),o.options.deceleration)});i=Object.keys(s).reduce(function(t,e){return Math.max(t,s[e])},-Infinity)}return AnimationManager.getDuration(i,this.options.minimumDuration,this.options.maximumDuration)},AnimationManager.prototype.createAnimationParam=function(t,e,n){void 0===n&&(n=null);var i=this.axm.get(),o=this.axm.get(this.axm.map(t,function(t,e,n){return r["default"].getInsidePosition(t,n.range,n.circular,n.bounce)}));return{depaPos:i,destPos:o,duration:AnimationManager.getDuration(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,o),inputEvent:n,done:this.animationEnd}},AnimationManager.prototype.grab=function(t,e){if(this._animateParam&&!t.length){var n=this.axm.get(t),i=this.axm.map(n,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)});this.axm.every(i,function(t,e){return n[e]===t})||this.em.triggerChange(i,e),this._animateParam=null,this._raf&&s.cancelAnimationFrame(this._raf),this._raf=null,this.em.triggerAnimationEnd()}},AnimationManager.prototype.restore=function(t){void 0===t&&(t=null);var e=this.axm.get(),n=this.axm.map(e,function(t,e,n){return Math.min(n.range[1],Math.max(n.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},AnimationManager.prototype.animationEnd=function(){this._animateParam=null;var t=this.axm.filter(this.axm.get(),function(t,e,n){return r["default"].isCircularable(t,n.range,n.circular)});Object.keys(t).length>0&&this.setTo(this.axm.map(t,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(),this.axm.isOutside()&&this.restore()},AnimationManager.prototype.animateLoop=function(t,e){if(this._animateParam=i({},t),this._animateParam.startTime=(new Date).getTime(),t.duration){var n=this._animateParam,r=this;!function loop(){if(r._raf=null,r.frame(n)>=1)return o.AxisManager.equal(t.destPos,r.axm.get(Object.keys(t.destPos)))||r.em.triggerChange(t.destPos),void e();r._raf=s.requestAnimationFrame(loop)}()}else this.em.triggerChange(t.destPos),e()},AnimationManager.prototype.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=AnimationManager.getDuration(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},AnimationManager.prototype.animateTo=function(t,e,n){var s=this;void 0===n&&(n=null);var a=this.createAnimationParam(t,e,n),u=i({},a.depaPos),h=this.em.triggerAnimationStart(a),c=this.getUserControll(a);!h&&this.axm.every(c.destPos,function(t,e,n){return r["default"].isCircularable(t,n.range,n.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),h&&!o.AxisManager.equal(c.destPos,u)&&this.animateLoop({depaPos:u,destPos:c.destPos,duration:c.duration,delta:this.axm.getDelta(u,c.destPos)},function(){return s.animationEnd()})},AnimationManager.prototype.frame=function(t){var e=(new Date).getTime()-t.startTime,n=this.easing(e/t.duration),i=t.depaPos;return i=this.axm.map(i,function(e,i,o){return e+=(t.destPos[i]-e)*n,r["default"].getCirculatedPos(e,o.range,o.circular)}),this.em.triggerChange(i),n},AnimationManager.prototype.easing=function(t){return t>1?1:this.options.easing(t)},AnimationManager.prototype.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t);this.grab(n);var i=this.axm.get(n);if(o.AxisManager.equal(t,i))return this;this.itm.setInterrupt(!0);var s=this.axm.filter(t,function(t,e){return i[e]!==t});if(Object.keys(s).length)return s=this.axm.map(s,function(t,n,i){return t=r["default"].getInsidePosition(t,i.range,i.circular),e?t:r["default"].getCirculatedPos(t,i.range,i.circular)}),o.AxisManager.equal(s,i)?this:(e?this.animateTo(s,e):(this.em.triggerChange(s),this.itm.setInterrupt(!1)),this)},AnimationManager.prototype.setBy=function(t,e){return void 0===e&&(e=0),this.setTo(this.axm.map(this.axm.get(Object.keys(t)),function(e,n){return e+t[n]}),e)},AnimationManager}();e.AnimationManager=a},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=function(){function EventManager(t,e){this.axes=t,this.axm=e}return EventManager.prototype.triggerHold=function(t,e){this.axes.trigger("hold",{pos:t,inputEvent:e})},EventManager.prototype.triggerRelease=function(t,e){void 0===e&&(e=null),t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("release",t)},EventManager.prototype.triggerChange=function(t,e){void 0===e&&(e=null);var n=this.axm.moveTo(t),i={pos:n.pos,delta:n.delta,holding:null!==e,inputEvent:e,set:e?this.createUserControll(n.pos):function(){}};this.axes.trigger("change",i),e&&this.axm.set(i.set().destPos)},EventManager.prototype.triggerAnimationStart=function(t){return t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("animationStart",t)},EventManager.prototype.triggerAnimationEnd=function(){this.axes.trigger("animationEnd")},EventManager.prototype.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:i({},t),duration:e};return function(t,e){return t&&(n.destPos=i({},t)),e!==undefined&&(n.duration=e),n}},EventManager.prototype.destroy=function(){this.axes.off()},EventManager}();e.EventManager=r},function(t,e,n){"use strict";e.__esModule=!0;var i=function(){function InterruptManager(t){this.options=t,this._prevented=!1}return InterruptManager.prototype.isInterrupting=function(){return this.options.interruptable||this._prevented},InterruptManager.prototype.isInterrupted=function(){return!this.options.interruptable&&this._prevented},InterruptManager.prototype.setInterrupt=function(t){!this.options.interruptable&&(this._prevented=t)},InterruptManager}();e.InterruptManager=i},function(t,e,n){"use strict";e.__esModule=!0;var i=n(2),r=n(1),o=function(){function InputObserver(t,e,n,i,r){this.options=t,this.itm=e,this.em=n,this.axm=i,this.am=r,this.isOutside=!1,this.moveDistance=null}return InputObserver.prototype.atOutside=function(t){var e=this;if(this.isOutside)return this.axm.map(t,function(t,e,n){var i=n.range[0]-n.bounce[0],r=n.range[1]+n.bounce[1];return t>r?r:t<i?i:t});var n=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,i,r){var o=r.range[0],s=r.range[1],a=r.bounce;return t<o?o-e.am.easing((o-t)/(a[0]*n))*a[0]:t>s?s+e.am.easing((t-s)/(a[1]*n))*a[1]:t})},InputObserver.prototype.hold=function(t,e){!this.itm.isInterrupted()&&t.axes.length&&(this.itm.setInterrupt(!0),this.am.grab(t.axes,e),this.moveDistance||this.em.triggerHold(this.axm.get(),e),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes))},InputObserver.prototype.change=function(t,e,n){if(this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,o=this.axm.get(t.axes);i=this.axm.map(this.moveDistance||o,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),i=this.axm.map(i,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)}),this.isOutside&&this.axm.every(o,function(t,e,n){return!r["default"].isOutside(t,n.range)})&&(this.isOutside=!1),i=this.atOutside(i),this.em.triggerChange(i,e)}},InputObserver.prototype.release=function(t,e,n,o){if(this.itm.isInterrupting()&&this.moveDistance){var s=this.axm.get(t.axes),a=this.axm.get(),u=this.axm.get(this.axm.map(n,function(t,e,n){return r["default"].getInsidePosition(s[e]+t,n.range,n.circular,n.bounce)})),h={depaPos:a,destPos:u,duration:this.am.getDuration(u,s,o),delta:this.axm.getDelta(a,u),inputEvent:e};this.em.triggerRelease(h),this.moveDistance=null;var c=this.am.getUserControll(h),p=i.AxisManager.equal(c.destPos,a);p||0===c.duration?(!p&&this.em.triggerChange(c.destPos,e),this.itm.setInterrupt(!1),this.axm.isOutside()&&this.am.restore(e)):this.am.animateTo(c.destPos,c.duration,e)}},InputObserver}();e.InputObserver=o},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(3),o=n(5),s=n(0),a=n(4),u=function(){function PanInput(t,e){if(this.axes=[],this.hammer=null,this.element=null,void 0===r)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=s.$(t),this.options=i({inputType:["touch","mouse"],scale:[1,1],thresholdAngle:45,threshold:0},e),this.onHammerInput=this.onHammerInput.bind(this),this.onPanmove=this.onPanmove.bind(this),this.onPanend=this.onPanend.bind(this)}return PanInput.getDirectionByAngle=function(t,e){if(e<0||e>90)return o.DIRECTION.DIRECTION_NONE;var n=Math.abs(t);return n>e&&n<180-e?o.DIRECTION.DIRECTION_VERTICAL:o.DIRECTION.DIRECTION_HORIZONTAL},PanInput.getNextOffset=function(t,e){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.abs(n/-e);return[t[0]/2*i,t[1]/2*i]},PanInput.useDirection=function(t,e,n){return n?!!(e===o.DIRECTION.DIRECTION_ALL||e&t&&n&t):!!(e&t)},PanInput.prototype.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?o.DIRECTION.DIRECTION_ALL:e?o.DIRECTION.DIRECTION_HORIZONTAL:n?o.DIRECTION.DIRECTION_VERTICAL:o.DIRECTION.DIRECTION_NONE,this.axes=t},PanInput.prototype.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.dettachEvent(),this.hammer.add(new r.Pan(e));else{var n=this.element[a.UNIQUEKEY];n?this.hammer.destroy():n=String(Math.round(Math.random()*(new Date).getTime()));var i=a.convertInputType(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=a.createHammer(this.element,[r.Pan,e],i),this.element[a.UNIQUEKEY]=n}return this.attachEvent(t),this},PanInput.prototype.disconnect=function(){return this.hammer&&this.dettachEvent(),this._direction=o.DIRECTION.DIRECTION_NONE,this},PanInput.prototype.destroy=function(){this.disconnect(),this.hammer&&this.hammer.destroy(),delete this.element[a.UNIQUEKEY],this.element=null,this.hammer=null},PanInput.prototype.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},PanInput.prototype.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},PanInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},PanInput.prototype.onHammerInput=function(t){this.isEnable()&&(t.isFirst?this.observer.hold(this,t):t.isFinal&&this.onPanend(t))},PanInput.prototype.onPanmove=function(t){var e=PanInput.getDirectionByAngle(t.angle,this.options.thresholdAngle),n=this.hammer.session.prevInput;n?(t.offsetX=t.deltaX-n.deltaX,t.offsetY=t.deltaY-n.deltaY):(t.offsetX=0,t.offsetY=0);var i=this.getOffset([t.offsetX,t.offsetY],[PanInput.useDirection(o.DIRECTION.DIRECTION_HORIZONTAL,this._direction,e),PanInput.useDirection(o.DIRECTION.DIRECTION_VERTICAL,this._direction,e)]),r=i.some(function(t){return 0!==t});r&&(t.srcEvent.preventDefault(),t.srcEvent.stopPropagation()),t.preventSystemEvent=r,r&&this.observer.change(this,t,a.toAxis(this.axes,i))},PanInput.prototype.onPanend=function(t){var e=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[PanInput.useDirection(o.DIRECTION.DIRECTION_HORIZONTAL,this._direction),PanInput.useDirection(o.DIRECTION.DIRECTION_VERTICAL,this._direction)]);e=PanInput.getNextOffset(e,this.observer.options.deceleration),this.observer.release(this,t,a.toAxis(this.axes,e))},PanInput.prototype.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},PanInput.prototype.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),this.observer=null},PanInput.prototype.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},PanInput}();e.PanInput=u},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(3),o=n(0),s=n(4),a=function(){function PinchInput(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._prev=null,void 0===r)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=o.$(t),this.options=i({scale:1,threshold:0},e),this.onPinchStart=this.onPinchStart.bind(this),this.onPinchMove=this.onPinchMove.bind(this),this.onPinchEnd=this.onPinchEnd.bind(this)}return PinchInput.prototype.mapAxes=function(t){this.axes=t},PinchInput.prototype.connect=function(t){var e={threshold:this.options.threshold};if(this.hammer)this.dettachEvent(),this.hammer.add(new r.Pinch(e));else{var n=this.element[s.UNIQUEKEY];n?this.hammer.destroy():n=String(Math.round(Math.random()*(new Date).getTime())),this.hammer=s.createHammer(this.element,[r.Pinch,e],r.TouchInput),this.element[s.UNIQUEKEY]=n}return this.attachEvent(t),this},PinchInput.prototype.disconnect=function(){return this.hammer&&this.dettachEvent(),this},PinchInput.prototype.destroy=function(){this.disconnect(),this.hammer&&this.hammer.destroy(),delete this.element[s.UNIQUEKEY],this.element=null,this.hammer=null},PinchInput.prototype.onPinchStart=function(t){this._prev=t.scale,this.observer.hold(this,t)},PinchInput.prototype.onPinchMove=function(t){var e=(t.scale-this._prev)*this.options.scale;this.observer.change(this,t,s.toAxis(this.axes,[e])),this._prev=t.scale},PinchInput.prototype.onPinchEnd=function(t){this.observer.release(this,t,s.toAxis(this.axes,[0]),0),this._prev=null},PinchInput.prototype.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},PinchInput.prototype.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},PinchInput.prototype.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},PinchInput.prototype.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},PinchInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},PinchInput}();e.PinchInput=a},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(0),o=n(4),s=function(){function WheelInput(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._timer=null,this.element=r.$(t),this.options=i({scale:1,throttle:100},e),this.onWheel=this.onWheel.bind(this)}return WheelInput.prototype.mapAxes=function(t){this.axes=t},WheelInput.prototype.connect=function(t){return this.dettachEvent(),this.attachEvent(t),this},WheelInput.prototype.disconnect=function(){return this.dettachEvent(),this},WheelInput.prototype.destroy=function(){this.disconnect(),this.element=null},WheelInput.prototype.onWheel=function(t){var e=this;this._isEnabled&&(t.preventDefault(),0!==t.deltaY&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.hold(e,t);var n=(t.deltaY>0?-1:1)*e.options.scale;e.observer.change(e,t,o.toAxis(e.axes,[n])),e.observer.release(e,t,o.toAxis(e.axes,[0]))},200)))},WheelInput.prototype.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},WheelInput.prototype.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null},WheelInput.prototype.enable=function(){return this._isEnabled=!0,this},WheelInput.prototype.disable=function(){return this._isEnabled=!1,this},WheelInput.prototype.isEnable=function(){return this._isEnabled},WheelInput}();e.WheelInput=s}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Axes=e():(t.eg=t.eg||{},t.eg.Axes=e())}(this,function(){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=6)}([function(t,e,n){"use strict";function $(t,e){void 0===e&&(e=!1);var n;if("string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=t,n=Array.prototype.slice.call(i.childNodes)}else n=Array.prototype.slice.call(document.querySelectorAll(t));e||(n=n.length>=1?n[0]:undefined)}else t===window?n=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in window&&t instanceof jQuery||t.constructor.prototype.jquery?n=e?t.toArray():t.get(0):Array.isArray(t)&&(n=t.map(function(t){return $(t)}),e||(n=n.length>=1?n[0]:undefined)):n=t;return n}function requestAnimationFrame(t){return i(t)}function cancelAnimationFrame(t){r(t)}e.__esModule=!0,e.$=$;var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame,r=window.cancelAnimationFrame||window.webkitCancelAnimationFrame;if(i&&!r){var o={},s=i;i=function(t){function wrapCallback(n){o[e]&&t(n)}var e=s(wrapCallback);return o[e]=!0,e},r=function(t){delete o[t]}}else i&&r||(i=function(t){return window.setTimeout(function(){t(window.performance&&window.performance.now())},16)},r=window.clearTimeout);e.requestAnimationFrame=requestAnimationFrame,e.cancelAnimationFrame=cancelAnimationFrame},function(t,e,n){"use strict";e.__esModule=!0;var i={getInsidePosition:function(t,e,n,i){var r=t,o=[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(o[0],r),r=Math.min(o[1],r),+Math.min(o[1],Math.max(o[0],r)).toFixed(5)},isOutside:function(t,e){return t<e[0]||t>e[1]},getDuration:function(t,e){var n=Math.sqrt(t/e*2);return n<100?0:n},isCircularable:function(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]},getCirculatedPos:function(t,e,n){var i=t,r=e[0],o=e[1],s=o-r;return n[1]&&t>o&&(i=(i-o)%s+r),n[0]&&t<r&&(i=(i-r)%s+o),+i.toFixed(5)}};e["default"]=i},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(1),o=function(){function AxisManager(t,e){var n=this;this.axis=t,this.options=e,this._pos=Object.keys(this.axis).reduce(function(t,e){return t[e]=n.axis[e].range[0],t},{})}return AxisManager.equal=function(t,e){for(var n in t)if(t[n]!==e[n])return!1;return!0},AxisManager.prototype.getDelta=function(t,e){var n=this.get(t);return this.map(this.get(e),function(t,e){return t-n[e]})},AxisManager.prototype.get=function(t){var e=this;return t&&Array.isArray(t)?t.reduce(function(t,n){return n&&n in e._pos&&(t[n]=e._pos[n]),t},{}):i({},this._pos,t||{})},AxisManager.prototype.moveTo=function(t){var e=this,n=this.map(this._pos,function(n,i){return t[i]?t[i]-e._pos[i]:0});return this.set(t),{pos:i({},this._pos),delta:n}},AxisManager.prototype.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},AxisManager.prototype.every=function(t,e){var n=this.axis;for(var i in t)if(i&&!e(t[i],i,n[i]))return!1;return!0},AxisManager.prototype.filter=function(t,e){var n={},i=this.axis;for(var r in t)r&&e(t[r],r,i[r])&&(n[r]=t[r]);return n},AxisManager.prototype.map=function(t,e){var n={},i=this.axis;for(var r in t)r&&(n[r]=e(t[r],r,i[r]));return n},AxisManager.prototype.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e,n){return!r["default"].isOutside(t,n.range)})},AxisManager}();e.AxisManager=o},function(t,e,n){var i;!function(r,o,s,a){"use strict";function setTimeoutContext(t,e,n){return setTimeout(bindFn(t,n),e)}function invokeArrayArg(t,e,n){return!!Array.isArray(t)&&(each(t,n[e],n),!0)}function each(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==a)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 deprecate(t,e,n){var i="DEPRECATED METHOD: "+e+"\n"+n+" AT \n";return function(){var e=new Error("get-stack-trace"),n=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=r.console&&(r.console.warn||r.console.log);return o&&o.call(r.console,i,n),t.apply(this,arguments)}}function inherit(t,e,n){var i,r=e.prototype;i=t.prototype=Object.create(r),i.constructor=t,i._super=r,n&&u(i,n)}function bindFn(t,e){return function(){return t.apply(e,arguments)}}function boolOrFn(t,e){return typeof t==p?t.apply(e?e[0]||a:a,e):t}function ifUndefined(t,e){return t===a?e:t}function addEventListeners(t,e,n){each(splitStr(e),function(e){t.addEventListener(e,n,!1)})}function removeEventListeners(t,e,n){each(splitStr(e),function(e){t.removeEventListener(e,n,!1)})}function hasParent(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function inStr(t,e){return t.indexOf(e)>-1}function splitStr(t){return t.trim().split(/\s+/g)}function inArray(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}function toArray(t){return Array.prototype.slice.call(t,0)}function uniqueArray(t,e,n){for(var i=[],r=[],o=0;o<t.length;){var s=e?t[o][e]:t[o];inArray(r,s)<0&&i.push(t[o]),r[o]=s,o++}return n&&(i=e?i.sort(function(t,n){return t[e]>n[e]}):i.sort()),i}function prefixed(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o<h.length;){if(n=h[o],(i=n?n+r:e)in t)return i;o++}return a}function uniqueId(){return v++}function getWindowForElement(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||r}function Input(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){boolOrFn(t.options.enable,[t])&&n.handler(e)},this.init()}function createInputInstance(t){var e=t.options.inputClass;return new(e||(y?PointerEventInput:T?TouchInput:_?TouchMouseInput:MouseInput))(t,inputHandler)}function inputHandler(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&A&&i-r==0,s=e&(b|O)&&i-r==0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,computeInputData(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function computeInputData(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=simpleCloneInputData(e)),r>1&&!n.firstMultiple?n.firstMultiple=simpleCloneInputData(e):1===r&&(n.firstMultiple=!1);var o=n.firstInput,s=n.firstMultiple,a=s?s.center:o.center,u=e.center=getCenter(i);e.timeStamp=m(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=getAngle(a,u),e.distance=getDistance(a,u),computeDeltaXY(n,e),e.offsetDirection=getDirection(e.deltaX,e.deltaY);var h=getVelocity(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=h.x,e.overallVelocityY=h.y,e.overallVelocity=f(h.x)>f(h.y)?h.x:h.y,e.scale=s?getScale(s.pointers,i):1,e.rotation=s?getRotation(s.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,computeIntervalInputData(n,e);var c=t.element;hasParent(e.srcEvent.target,c)&&(c=e.srcEvent.target),e.target=c}function computeDeltaXY(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==A&&o.eventType!==b||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}function computeIntervalInputData(t,e){var n,i,r,o,s=t.lastInterval||e,u=e.timeStamp-s.timeStamp;if(e.eventType!=O&&(u>E||s.velocity===a)){var h=e.deltaX-s.deltaX,c=e.deltaY-s.deltaY,p=getVelocity(u,h,c);i=p.x,r=p.y,n=f(p.x)>f(p.y)?p.x:p.y,o=getDirection(h,c),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}function simpleCloneInputData(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:l(t.pointers[n].clientX),clientY:l(t.pointers[n].clientY)},n++;return{timeStamp:m(),pointers:e,center:getCenter(e),deltaX:t.deltaX,deltaY:t.deltaY}}function getCenter(t){var e=t.length;if(1===e)return{x:l(t[0].clientX),y:l(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:l(n/e),y:l(i/e)}}function getVelocity(t,e,n){return{x:e/t||0,y:n/t||0}}function getDirection(t,e){return t===e?P:f(t)>=f(e)?t<0?R:C:e<0?D:M}function getDistance(t,e,n){n||(n=z);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function getAngle(t,e,n){n||(n=z);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function getRotation(t,e){return getAngle(e[1],e[0],L)+getAngle(t[1],t[0],L)}function getScale(t,e){return getDistance(e[0],e[1],L)/getDistance(t[0],t[1],L)}function MouseInput(){this.evEl=q,this.evWin=H,this.pressed=!1,Input.apply(this,arguments)}function PointerEventInput(){this.evEl=W,this.evWin=Y,Input.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function SingleTouchInput(){this.evTarget=X,this.evWin=V,this.started=!1,Input.apply(this,arguments)}function normalizeSingleTouches(t,e){var n=toArray(t.touches),i=toArray(t.changedTouches);return e&(b|O)&&(n=uniqueArray(n.concat(i),"identifier",!0)),[n,i]}function TouchInput(){this.evTarget=Z,this.targetIds={},Input.apply(this,arguments)}function getTouches(t,e){var n=toArray(t.touches),i=this.targetIds;if(e&(A|x)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,s=toArray(t.changedTouches),a=[],u=this.target;if(o=n.filter(function(t){return hasParent(t.target,u)}),e===A)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;for(r=0;r<s.length;)i[s[r].identifier]&&a.push(s[r]),e&(b|O)&&delete i[s[r].identifier],r++;return a.length?[uniqueArray(o.concat(a),"identifier",!0),a]:void 0}function TouchMouseInput(){Input.apply(this,arguments);var t=bindFn(this.handler,this);this.touch=new TouchInput(this.manager,t),this.mouse=new MouseInput(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function recordTouches(t,e){t&A?(this.primaryTouch=e.changedPointers[0].identifier,setLastTouch.call(this,e)):t&(b|O)&&setLastTouch.call(this,e)}function setLastTouch(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY};this.lastTouches.push(n);var i=this.lastTouches,r=function(){var t=i.indexOf(n);t>-1&&i.splice(t,1)};setTimeout(r,G)}}function isSyntheticEvent(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(e-r.x),s=Math.abs(n-r.y);if(o<=Q&&s<=Q)return!0}return!1}function TouchAction(t,e){this.manager=t,this.set(e)}function cleanTouchActions(t){if(inStr(t,et))return et;var e=inStr(t,nt),n=inStr(t,it);return e&&n?et:e||n?e?nt:it:inStr(t,tt)?tt:J}function Recognizer(t){this.options=u({},this.defaults,t||{}),this.id=uniqueId(),this.manager=null,this.options.enable=ifUndefined(this.options.enable,!0),this.state=ot,this.simultaneous={},this.requireFail=[]}function stateStr(t){return t&ct?"cancel":t&ut?"end":t&at?"move":t&st?"start":""}function directionStr(t){return t==M?"down":t==D?"up":t==R?"left":t==C?"right":""}function getRecognizerByNameIfManager(t,e){var n=e.manager;return n?n.get(t):t}function AttrRecognizer(){Recognizer.apply(this,arguments)}function PanRecognizer(){AttrRecognizer.apply(this,arguments),this.pX=null,this.pY=null}function PinchRecognizer(){AttrRecognizer.apply(this,arguments)}function PressRecognizer(){Recognizer.apply(this,arguments),this._timer=null,this._input=null}function RotateRecognizer(){AttrRecognizer.apply(this,arguments)}function SwipeRecognizer(){AttrRecognizer.apply(this,arguments)}function TapRecognizer(){Recognizer.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Hammer(t,e){return e=e||{},e.recognizers=ifUndefined(e.recognizers,Hammer.defaults.preset),new Manager(t,e)}function Manager(t,e){this.options=u({},Hammer.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=createInputInstance(this),this.touchAction=new TouchAction(this,this.options.touchAction),toggleCssProps(this,!0),each(this.options.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function toggleCssProps(t,e){var n=t.element;if(n.style){var i;each(t.options.cssProps,function(r,o){i=prefixed(n.style,o),e?(t.oldCssProps[i]=n.style[i],n.style[i]=r):n.style[i]=t.oldCssProps[i]||""}),e||(t.oldCssProps={})}}function triggerDomEvent(t,e){var n=o.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=e,e.target.dispatchEvent(n)}var u,h=["","webkit","Moz","MS","ms","o"],c=o.createElement("div"),p="function",l=Math.round,f=Math.abs,m=Date.now;u="function"!=typeof Object.assign?function(t){if(t===a||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(i!==a&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign;var d=deprecate(function(t,e,n){for(var i=Object.keys(e),r=0;r<i.length;)(!n||n&&t[i[r]]===a)&&(t[i[r]]=e[i[r]]),r++;return t},"extend","Use `assign`."),g=deprecate(function(t,e){return d(t,e,!0)},"merge","Use `assign`."),v=1,I=/mobile|tablet|ip(ad|hone|od)|android/i,_="ontouchstart"in r,y=prefixed(r,"PointerEvent")!==a,T=_&&I.test(navigator.userAgent),E=25,A=1,x=2,b=4,O=8,P=1,R=2,C=4,D=8,M=16,N=R|C,w=D|M,S=N|w,z=["x","y"],L=["clientX","clientY"];Input.prototype={handler:function(){},init:function(){this.evEl&&addEventListeners(this.element,this.evEl,this.domHandler),this.evTarget&&addEventListeners(this.target,this.evTarget,this.domHandler),this.evWin&&addEventListeners(getWindowForElement(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&removeEventListeners(this.element,this.evEl,this.domHandler),this.evTarget&&removeEventListeners(this.target,this.evTarget,this.domHandler),this.evWin&&removeEventListeners(getWindowForElement(this.element),this.evWin,this.domHandler)}};var k={mousedown:A,mousemove:x,mouseup:b},q="mousedown",H="mousemove mouseup";inherit(MouseInput,Input,{handler:function(t){var e=k[t.type];e&A&&0===t.button&&(this.pressed=!0),e&x&&1!==t.which&&(e=b),this.pressed&&(e&b&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))}});var F={pointerdown:A,pointermove:x,pointerup:b,pointercancel:O,pointerout:O},j={2:"touch",3:"pen",4:"mouse",5:"kinect"},W="pointerdown",Y="pointermove pointerup pointercancel";r.MSPointerEvent&&!r.PointerEvent&&(W="MSPointerDown",Y="MSPointerMove MSPointerUp MSPointerCancel"),inherit(PointerEventInput,Input,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=F[i],o=j[t.pointerType]||t.pointerType,s="touch"==o,a=inArray(e,t.pointerId,"pointerId");r&A&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&(b|O)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))}});var U={touchstart:A,touchmove:x,touchend:b,touchcancel:O},X="touchstart",V="touchstart touchmove touchend touchcancel";inherit(SingleTouchInput,Input,{handler:function(t){var e=U[t.type];if(e===A&&(this.started=!0),this.started){var n=normalizeSingleTouches.call(this,t,e);e&(b|O)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:t})}}});var B={touchstart:A,touchmove:x,touchend:b,touchcancel:O},Z="touchstart touchmove touchend touchcancel";inherit(TouchInput,Input,{handler:function(t){var e=B[t.type],n=getTouches.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:t})}});var G=2500,Q=25;inherit(TouchMouseInput,Input,{handler:function(t,e,n){var i="touch"==n.pointerType,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)recordTouches.call(this,e,n);else if(r&&isSyntheticEvent.call(this,n))return;this.callback(t,e,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var $=prefixed(c.style,"touchAction"),K=$!==a,J="auto",tt="manipulation",et="none",nt="pan-x",it="pan-y",rt=function(){if(!K)return!1;var t={},e=r.CSS&&r.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(n){t[n]=!e||r.CSS.supports("touch-action",n)}),t}();TouchAction.prototype={set:function(t){"compute"==t&&(t=this.compute()),K&&this.manager.element.style&&rt[t]&&(this.manager.element.style[$]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return each(this.manager.recognizers,function(e){boolOrFn(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),cleanTouchActions(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var i=this.actions,r=inStr(i,et)&&!rt[et],o=inStr(i,it)&&!rt[it],s=inStr(i,nt)&&!rt[nt];if(r){var a=1===t.pointers.length,u=t.distance<2,h=t.deltaTime<250;if(a&&u&&h)return}return s&&o?void 0:r||o&&n&N||s&&n&w?this.preventSrc(e):void 0},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var ot=1,st=2,at=4,ut=8,ht=ut,ct=16;Recognizer.prototype={defaults:{},set:function(t){return u(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(invokeArrayArg(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=getRecognizerByNameIfManager(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return invokeArrayArg(t,"dropRecognizeWith",this)?this:(t=getRecognizerByNameIfManager(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(invokeArrayArg(t,"requireFailure",this))return this;var e=this.requireFail;return t=getRecognizerByNameIfManager(t,this),-1===inArray(e,t)&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(invokeArrayArg(t,"dropRequireFailure",this))return this;t=getRecognizerByNameIfManager(t,this);var e=inArray(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function emit(n){e.manager.emit(n,t)}var e=this,n=this.state;n<ut&&emit(e.options.event+stateStr(n)),emit(e.options.event),t.additionalEvent&&emit(t.additionalEvent),n>=ut&&emit(e.options.event+stateStr(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=32},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(32|ot)))return!1;t++}return!0},recognize:function(t){var e=u({},t);if(!boolOrFn(this.options.enable,[this,e]))return this.reset(),void(this.state=32);this.state&(ht|ct|32)&&(this.state=ot),this.state=this.process(e),this.state&(st|at|ut|ct)&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},inherit(AttrRecognizer,Recognizer,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,n=t.eventType,i=e&(st|at),r=this.attrTest(t);return i&&(n&O||!r)?e|ct:i||r?n&b?e|ut:e&st?e|at:st:32}}),inherit(PanRecognizer,AttrRecognizer,{defaults:{event:"pan",threshold:10,pointers:1,direction:S},getTouchAction:function(){var t=this.options.direction,e=[];return t&N&&e.push(it),t&w&&e.push(nt),e},directionTest:function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(e.direction&N?(r=0===o?P:o<0?R:C,n=o!=this.pX,i=Math.abs(t.deltaX)):(r=0===s?P:s<0?D:M,n=s!=this.pY,i=Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},attrTest:function(t){return AttrRecognizer.prototype.attrTest.call(this,t)&&(this.state&st||!(this.state&st)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=directionStr(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),inherit(PinchRecognizer,AttrRecognizer,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[et]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&st)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),inherit(PressRecognizer,Recognizer,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[J]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,r=t.deltaTime>e.time;if(this._input=t,!i||!n||t.eventType&(b|O)&&!r)this.reset();else if(t.eventType&A)this.reset(),this._timer=setTimeoutContext(function(){this.state=ht,this.tryEmit()},e.time,this);else if(t.eventType&b)return ht;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===ht&&(t&&t.eventType&b?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=m(),this.manager.emit(this.options.event,this._input)))}}),inherit(RotateRecognizer,AttrRecognizer,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[et]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&st)}}),inherit(SwipeRecognizer,AttrRecognizer,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:N|w,pointers:1},getTouchAction:function(){return PanRecognizer.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(N|w)?e=t.overallVelocity:n&N?e=t.overallVelocityX:n&w&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&f(e)>this.options.velocity&&t.eventType&b},emit:function(t){var e=directionStr(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),inherit(TapRecognizer,Recognizer,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[tt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,r=t.deltaTime<e.time;if(this.reset(),t.eventType&A&&0===this.count)return this.failTimeout();if(i&&r&&n){if(t.eventType!=b)return this.failTimeout();var o=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter||getDistance(this.pCenter,t.center)<e.posThreshold;this.pTime=t.timeStamp,this.pCenter=t.center,s&&o?this.count+=1:this.count=1,this._input=t;if(0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=setTimeoutContext(function(){this.state=ht,this.tryEmit()},e.interval,this),st):ht}return 32},failTimeout:function(){return this._timer=setTimeoutContext(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ht&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Hammer.VERSION="2.0.7",Hammer.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[RotateRecognizer,{enable:!1}],[PinchRecognizer,{enable:!1},["rotate"]],[SwipeRecognizer,{direction:N}],[PanRecognizer,{direction:N},["swipe"]],[TapRecognizer],[TapRecognizer,{event:"doubletap",taps:2},["tap"]],[PressRecognizer]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};Manager.prototype={set:function(t){return u(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var n,i=this.recognizers,r=e.curRecognizer;(!r||r&&r.state&ht)&&(r=e.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===e.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&n.state&(st|at|ut)&&(r=e.curRecognizer=n),o++}},get:function(t){if(t instanceof Recognizer)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];return null},add:function(t){if(invokeArrayArg(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(invokeArrayArg(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,n=inArray(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){if(t!==a&&e!==a){var n=this.handlers;return each(splitStr(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this}},off:function(t,e){if(t!==a){var n=this.handlers;return each(splitStr(t),function(t){e?n[t]&&n[t].splice(inArray(n[t],e),1):delete n[t]}),this}},emit:function(t,e){this.options.domEvents&&triggerDomEvent(t,e);var n=this.handlers[t]&&this.handlers[t].slice();if(n&&n.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var i=0;i<n.length;)n[i](e),i++}},destroy:function(){this.element&&toggleCssProps(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},u(Hammer,{INPUT_START:A,INPUT_MOVE:x,INPUT_END:b,INPUT_CANCEL:O,STATE_POSSIBLE:ot,STATE_BEGAN:st,STATE_CHANGED:at,STATE_ENDED:ut,STATE_RECOGNIZED:ht,STATE_CANCELLED:ct,STATE_FAILED:32,DIRECTION_NONE:P,DIRECTION_LEFT:R,DIRECTION_RIGHT:C,DIRECTION_UP:D,DIRECTION_DOWN:M,DIRECTION_HORIZONTAL:N,DIRECTION_VERTICAL:w,DIRECTION_ALL:S,Manager:Manager,Input:Input,TouchAction:TouchAction,TouchInput:TouchInput,MouseInput:MouseInput,PointerEventInput:PointerEventInput,TouchMouseInput:TouchMouseInput,SingleTouchInput:SingleTouchInput,Recognizer:Recognizer,AttrRecognizer:AttrRecognizer,Tap:TapRecognizer,Pan:PanRecognizer,Swipe:SwipeRecognizer,Pinch:PinchRecognizer,Rotate:RotateRecognizer,Press:PressRecognizer,on:addEventListeners,off:removeEventListeners,each:each,merge:g,extend:d,assign:u,inherit:inherit,bindFn:bindFn,prefixed:prefixed}),(void 0!==r?r:"undefined"!=typeof self?self:{}).Hammer=Hammer,(i=function(){return Hammer}.call(e,n,e,t))!==a&&(t.exports=i)}(window,document)},function(t,e,n){"use strict";function toAxis(t,e){return e.reduce(function(e,n,i){return t[i]&&(e[t[i]]=n),e},{})}function createHammer(t,e,n){try{var r={recognizers:[e],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}};return n&&(r.inputClass=n),new i.Manager(t,r)}catch(o){return null}}function convertInputType(t){void 0===t&&(t=[]);var n=!1,r=!1;return t.forEach(function(t){switch(t){case"mouse":r=!0;break;case"touch":n=e.SUPPORT_TOUCH}}),n&&i.TouchInput||r&&i.MouseInput||null}e.__esModule=!0;var i=n(3);e.SUPPORT_TOUCH="ontouchstart"in window,e.UNIQUEKEY="_EGJS_AXES_INPUTTYPE_",e.toAxis=toAxis,e.createHammer=createHammer,e.convertInputType=convertInputType},function(t,e,n){"use strict";e.__esModule=!0;!function(t){t[t.DIRECTION_NONE=1]="DIRECTION_NONE",t[t.DIRECTION_LEFT=2]="DIRECTION_LEFT",t[t.DIRECTION_RIGHT=4]="DIRECTION_RIGHT",t[t.DIRECTION_HORIZONTAL=6]="DIRECTION_HORIZONTAL",t[t.DIRECTION_UP=8]="DIRECTION_UP",t[t.DIRECTION_DOWN=16]="DIRECTION_DOWN",t[t.DIRECTION_VERTICAL=24]="DIRECTION_VERTICAL",t[t.DIRECTION_ALL=30]="DIRECTION_ALL"}(e.DIRECTION||(e.DIRECTION={})),e.TRANSFORM=function(){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""}()},function(t,e,n){"use strict";var i=n(7);t.exports=i["default"]},function(t,e,n){"use strict";var i=this&&this.__extends||function(){var t=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])};return function(e,n){function __(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(__.prototype=n.prototype,new __)}}(),r=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var o=n(8),s=n(9),a=n(10),u=n(11),h=n(2),c=n(12),p=n(13),l=n(14),f=n(15),m=n(5),d=function(t){function Axes(e,n,i){void 0===e&&(e={});var o=t.call(this)||this;return o.axis=e,o._inputs=[],o.options=r({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:Infinity,minimumDuration:0,deceleration:6e-4},n),o._complementOptions(),o._axm=new h.AxisManager(o.axis,o.options),o._em=new a.EventManager(o,o._axm),o._itm=new u.InterruptManager(o.options),o._am=new s.AnimationManager(o.options,o._itm,o._em,o._axm),o._io=new c.InputObserver(o.options,o._itm,o._em,o._axm,o._am),i&&setTimeout(function(){return o._em.triggerChange(i)},0),o}return i(Axes,t),Axes.prototype._complementOptions=function(){var t=this;Object.keys(this.axis).forEach(function(e){t.axis[e]=r({range:[0,100],bounce:[0,0],circular:[!1,!1]},t.axis[e]),["bounce","circular"].forEach(function(n){var i=t.axis,r=i[e][n];/string|number|boolean/.test(typeof r)&&(i[e][n]=[r,r])})})},Axes.prototype.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},Axes.prototype.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);this._inputs[e].disconnect(),~e&&this._inputs.splice(e,1)}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},Axes.prototype.get=function(t){return this._axm.get(t)},Axes.prototype.setTo=function(t,e){return void 0===e&&(e=0),this._am.setTo(t,e),this},Axes.prototype.setBy=function(t,e){return void 0===e&&(e=0),this._am.setBy(t,e),this},Axes.prototype.isBounceArea=function(t){return this._axm.isOutside(t)},Axes.prototype.destroy=function(){this.disconnect(),this._em.destroy()},Axes.VERSION="#__VERSION__#",Axes.PanInput=p.PanInput,Axes.PinchInput=l.PinchInput,Axes.WheelInput=f.WheelInput,Axes.TRANSFORM=m.TRANSFORM,Axes.DIRECTION_NONE=m.DIRECTION.DIRECTION_NONE,Axes.DIRECTION_LEFT=m.DIRECTION.DIRECTION_LEFT,Axes.DIRECTION_RIGHT=m.DIRECTION.DIRECTION_RIGHT,Axes.DIRECTION_UP=m.DIRECTION.DIRECTION_UP,Axes.DIRECTION_DOWN=m.DIRECTION.DIRECTION_DOWN,Axes.DIRECTION_HORIZONTAL=m.DIRECTION.DIRECTION_HORIZONTAL,Axes.DIRECTION_VERTICAL=m.DIRECTION.DIRECTION_VERTICAL,Axes.DIRECTION_ALL=m.DIRECTION.DIRECTION_ALL,Axes}(o);e["default"]=d},function(t,e,n){!function(e,n){t.exports=n()}(0,function(){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.d=function(t,e,n){__webpack_require__.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return __webpack_require__.d(e,"a",e),e},__webpack_require__.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=0)}([function(t,e,n){"use strict";var i=n(1),r=function(t){return t&&t.__esModule?t:{"default":t}}(i);r["default"].VERSION="2.0.0",t.exports=r["default"]},function(t,e,n){"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){function Component(){_classCallCheck(this,Component),this._eventHandler={},this.options={}}return Component.prototype.trigger=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},n=this._eventHandler[t]||[];if(!(n.length>0))return!0;n=n.concat(),e.eventType=t;var i=!1,r=[e],o=0;e.stop=function(){i=!0};for(var s=arguments.length,a=Array(s>2?s-2:0),u=2;u<s;u++)a[u-2]=arguments[u];for(a.length>=1&&(r=r.concat(a)),o=0;n[o];o++)n[o].apply(this,r);return!i},Component.prototype.once=function(t,e){if("object"===(void 0===t?"undefined":i(t))&&void 0===e){var n=t,r=void 0;for(r in n)this.once(r,n[r]);return this}if("string"==typeof t&&"function"==typeof e){var o=this;this.on(t,function listener(){for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];e.apply(o,i),o.off(t,listener)})}return this},Component.prototype.hasOn=function(t){return!!this._eventHandler[t]},Component.prototype.on=function(t,e){if("object"===(void 0===t?"undefined":i(t))&&void 0===e){var n=t,r=void 0;for(r in n)this.on(r,n[r]);return this}if("string"==typeof t&&"function"==typeof e){var o=this._eventHandler[t];void 0===o&&(this._eventHandler[t]=[],o=this._eventHandler[t]),o.push(e)}return this},Component.prototype.off=function(t,e){if(void 0===t)return this._eventHandler={},this;if(void 0===e){if("string"==typeof t)return this._eventHandler[t]=undefined,this;var n=t,i=void 0;for(i in n)this.off(i,n[i]);return this}var r=this._eventHandler[t];if(r){var o=void 0,s=void 0;for(o=0;(s=r[o])!==undefined;o++)if(s===e){r=r.splice(o,1);break}}return this},Component}();e["default"]=r,t.exports=e["default"]}])})},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(1),o=n(2),s=n(0),a=function(){function AnimationManager(t,e,n,i){this.options=t,this.itm=e,this.em=n,this.axm=i,this.animationEnd=this.animationEnd.bind(this)}return AnimationManager.getDuration=function(t,e,n){return Math.max(Math.min(t,n),e)},AnimationManager.prototype.getDuration=function(t,e,n){var i,o=this;if(void 0!==n)i=n;else{var s=this.axm.map(e,function(e,n){return r["default"].getDuration(Math.abs(Math.abs(e)-Math.abs(t[n])),o.options.deceleration)});i=Object.keys(s).reduce(function(t,e){return Math.max(t,s[e])},-Infinity)}return AnimationManager.getDuration(i,this.options.minimumDuration,this.options.maximumDuration)},AnimationManager.prototype.createAnimationParam=function(t,e,n){void 0===n&&(n=null);var i=this.axm.get(),o=this.axm.get(this.axm.map(t,function(t,e,n){return r["default"].getInsidePosition(t,n.range,n.circular,n.bounce)}));return{depaPos:i,destPos:o,duration:AnimationManager.getDuration(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,o),inputEvent:n,done:this.animationEnd}},AnimationManager.prototype.grab=function(t,e,n){if(this._animateParam&&!t.length){var i=this.axm.get(t),o=this.axm.map(i,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)});this.axm.every(o,function(t,e){return i[e]===t})||this.em.triggerChange(o,e,n),this._animateParam=null,this._raf&&s.cancelAnimationFrame(this._raf),this._raf=null,this.em.triggerAnimationEnd()}},AnimationManager.prototype.restore=function(t){void 0===t&&(t=null);var e=this.axm.get(),n=this.axm.map(e,function(t,e,n){return Math.min(n.range[1],Math.max(n.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},AnimationManager.prototype.animationEnd=function(){this._animateParam=null;var t=this.axm.filter(this.axm.get(),function(t,e,n){return r["default"].isCircularable(t,n.range,n.circular)});Object.keys(t).length>0&&this.setTo(this.axm.map(t,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(),this.axm.isOutside()&&this.restore()},AnimationManager.prototype.animateLoop=function(t,e){if(this._animateParam=i({},t),this._animateParam.startTime=(new Date).getTime(),t.duration){var n=this._animateParam,r=this;!function loop(){if(r._raf=null,r.frame(n)>=1)return o.AxisManager.equal(t.destPos,r.axm.get(Object.keys(t.destPos)))||r.em.triggerChange(t.destPos),void e();r._raf=s.requestAnimationFrame(loop)}()}else this.em.triggerChange(t.destPos),e()},AnimationManager.prototype.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=AnimationManager.getDuration(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},AnimationManager.prototype.animateTo=function(t,e,n){var s=this;void 0===n&&(n=null);var a=this.createAnimationParam(t,e,n),u=i({},a.depaPos),h=this.em.triggerAnimationStart(a),c=this.getUserControll(a);!h&&this.axm.every(c.destPos,function(t,e,n){return r["default"].isCircularable(t,n.range,n.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),h&&!o.AxisManager.equal(c.destPos,u)&&this.animateLoop({depaPos:u,destPos:c.destPos,duration:c.duration,delta:this.axm.getDelta(u,c.destPos)},function(){return s.animationEnd()})},AnimationManager.prototype.frame=function(t){var e=(new Date).getTime()-t.startTime,n=this.easing(e/t.duration),i=t.depaPos;return i=this.axm.map(i,function(e,i,o){return e+=(t.destPos[i]-e)*n,r["default"].getCirculatedPos(e,o.range,o.circular)}),this.em.triggerChange(i),n},AnimationManager.prototype.easing=function(t){return t>1?1:this.options.easing(t)},AnimationManager.prototype.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t);this.grab(n);var i=this.axm.get(n);if(o.AxisManager.equal(t,i))return this;this.itm.setInterrupt(!0);var s=this.axm.filter(t,function(t,e){return i[e]!==t});if(Object.keys(s).length)return s=this.axm.map(s,function(t,n,i){return t=r["default"].getInsidePosition(t,i.range,i.circular),e?t:r["default"].getCirculatedPos(t,i.range,i.circular)}),o.AxisManager.equal(s,i)?this:(e?this.animateTo(s,e):(this.em.triggerChange(s),this.itm.setInterrupt(!1)),this)},AnimationManager.prototype.setBy=function(t,e){return void 0===e&&(e=0),this.setTo(this.axm.map(this.axm.get(Object.keys(t)),function(e,n){return e+t[n]}),e)},AnimationManager}();e.AnimationManager=a},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=function(){function EventManager(t,e){this.axes=t,this.axm=e}return EventManager.prototype.triggerHold=function(t,e,n){this.axes.trigger("hold",{pos:t,input:e,inputEvent:n})},EventManager.prototype.triggerRelease=function(t){t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("release",t)},EventManager.prototype.triggerChange=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=null);var i=this.axm.moveTo(t),r={pos:i.pos,delta:i.delta,holding:!!n,inputEvent:n,input:e,set:n?this.createUserControll(i.pos):function(){}};this.axes.trigger("change",r),n&&this.axm.set(r.set().destPos)},EventManager.prototype.triggerAnimationStart=function(t){return t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("animationStart",t)},EventManager.prototype.triggerAnimationEnd=function(){this.axes.trigger("animationEnd")},EventManager.prototype.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:i({},t),duration:e};return function(t,e){return t&&(n.destPos=i({},t)),e!==undefined&&(n.duration=e),n}},EventManager.prototype.destroy=function(){this.axes.off()},EventManager}();e.EventManager=r},function(t,e,n){"use strict";e.__esModule=!0;var i=function(){function InterruptManager(t){this.options=t,this._prevented=!1}return InterruptManager.prototype.isInterrupting=function(){return this.options.interruptable||this._prevented},InterruptManager.prototype.isInterrupted=function(){return!this.options.interruptable&&this._prevented},InterruptManager.prototype.setInterrupt=function(t){!this.options.interruptable&&(this._prevented=t)},InterruptManager}();e.InterruptManager=i},function(t,e,n){"use strict";e.__esModule=!0;var i=n(2),r=n(1),o=function(){function InputObserver(t,e,n,i,r){this.options=t,this.itm=e,this.em=n,this.axm=i,this.am=r,this.isOutside=!1,this.moveDistance=null}return InputObserver.prototype.atOutside=function(t){var e=this;if(this.isOutside)return this.axm.map(t,function(t,e,n){var i=n.range[0]-n.bounce[0],r=n.range[1]+n.bounce[1];return t>r?r:t<i?i:t});var n=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,i,r){var o=r.range[0],s=r.range[1],a=r.bounce;return t<o?o-e.am.easing((o-t)/(a[0]*n))*a[0]:t>s?s+e.am.easing((t-s)/(a[1]*n))*a[1]:t})},InputObserver.prototype.get=function(t){return this.axm.get(t.axes)},InputObserver.prototype.hold=function(t,e){!this.itm.isInterrupted()&&t.axes.length&&(this.itm.setInterrupt(!0),this.am.grab(t.axes,t,e),this.moveDistance||this.em.triggerHold(this.axm.get(),t,e),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes))},InputObserver.prototype.change=function(t,e,n){if(this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,o=this.axm.get(t.axes);i=this.axm.map(this.moveDistance||o,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),i=this.axm.map(i,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)}),this.isOutside&&this.axm.every(o,function(t,e,n){return!r["default"].isOutside(t,n.range)})&&(this.isOutside=!1),i=this.atOutside(i),this.em.triggerChange(i,t,e)}},InputObserver.prototype.release=function(t,e,n,o){if(this.itm.isInterrupting()&&this.moveDistance){var s=this.axm.get(t.axes),a=this.axm.get(),u=this.axm.get(this.axm.map(n,function(t,e,n){return r["default"].getInsidePosition(s[e]+t,n.range,n.circular,n.bounce)})),h={depaPos:a,destPos:u,duration:this.am.getDuration(u,s,o),delta:this.axm.getDelta(a,u),inputEvent:e,input:t};this.em.triggerRelease(h),this.moveDistance=null;var c=this.am.getUserControll(h),p=i.AxisManager.equal(c.destPos,a);p||0===c.duration?(!p&&this.em.triggerChange(c.destPos,t,e),this.itm.setInterrupt(!1),this.axm.isOutside()&&this.am.restore(e)):this.am.animateTo(c.destPos,c.duration,e)}},InputObserver}();e.InputObserver=o},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(3),o=n(5),s=n(0),a=n(4),u=function(){function PanInput(t,e){if(this.axes=[],this.hammer=null,this.element=null,void 0===r)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=s.$(t),this.options=i({inputType:["touch","mouse"],scale:[1,1],thresholdAngle:45,threshold:0},e),this.onHammerInput=this.onHammerInput.bind(this),this.onPanmove=this.onPanmove.bind(this),this.onPanend=this.onPanend.bind(this)}return PanInput.getDirectionByAngle=function(t,e){if(e<0||e>90)return o.DIRECTION.DIRECTION_NONE;var n=Math.abs(t);return n>e&&n<180-e?o.DIRECTION.DIRECTION_VERTICAL:o.DIRECTION.DIRECTION_HORIZONTAL},PanInput.getNextOffset=function(t,e){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.abs(n/-e);return[t[0]/2*i,t[1]/2*i]},PanInput.useDirection=function(t,e,n){return n?!!(e===o.DIRECTION.DIRECTION_ALL||e&t&&n&t):!!(e&t)},PanInput.prototype.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?o.DIRECTION.DIRECTION_ALL:e?o.DIRECTION.DIRECTION_HORIZONTAL:n?o.DIRECTION.DIRECTION_VERTICAL:o.DIRECTION.DIRECTION_NONE,this.axes=t},PanInput.prototype.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.dettachEvent(),this.hammer.add(new r.Pan(e));else{var n=this.element[a.UNIQUEKEY];n?this.hammer.destroy():n=String(Math.round(Math.random()*(new Date).getTime()));var i=a.convertInputType(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=a.createHammer(this.element,[r.Pan,e],i),this.element[a.UNIQUEKEY]=n}return this.attachEvent(t),this},PanInput.prototype.disconnect=function(){return this.hammer&&this.dettachEvent(),this._direction=o.DIRECTION.DIRECTION_NONE,this},PanInput.prototype.destroy=function(){this.disconnect(),this.hammer&&this.hammer.destroy(),delete this.element[a.UNIQUEKEY],this.element=null,this.hammer=null},PanInput.prototype.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},PanInput.prototype.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},PanInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},PanInput.prototype.onHammerInput=function(t){this.isEnable()&&(t.isFirst?this.observer.hold(this,t):t.isFinal&&this.onPanend(t))},PanInput.prototype.onPanmove=function(t){var e=PanInput.getDirectionByAngle(t.angle,this.options.thresholdAngle),n=this.hammer.session.prevInput;n?(t.offsetX=t.deltaX-n.deltaX,t.offsetY=t.deltaY-n.deltaY):(t.offsetX=0,t.offsetY=0);var i=this.getOffset([t.offsetX,t.offsetY],[PanInput.useDirection(o.DIRECTION.DIRECTION_HORIZONTAL,this._direction,e),PanInput.useDirection(o.DIRECTION.DIRECTION_VERTICAL,this._direction,e)]),r=i.some(function(t){return 0!==t});r&&(t.srcEvent.preventDefault(),t.srcEvent.stopPropagation()),t.preventSystemEvent=r,r&&this.observer.change(this,t,a.toAxis(this.axes,i))},PanInput.prototype.onPanend=function(t){var e=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[PanInput.useDirection(o.DIRECTION.DIRECTION_HORIZONTAL,this._direction),PanInput.useDirection(o.DIRECTION.DIRECTION_VERTICAL,this._direction)]);e=PanInput.getNextOffset(e,this.observer.options.deceleration),this.observer.release(this,t,a.toAxis(this.axes,e))},PanInput.prototype.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},PanInput.prototype.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),this.observer=null},PanInput.prototype.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},PanInput}();e.PanInput=u},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(3),o=n(0),s=n(4),a=function(){function PinchInput(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._base=null,this._prev=null,void 0===r)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=o.$(t),this.options=i({scale:1,threshold:0},e),this.onPinchStart=this.onPinchStart.bind(this),this.onPinchMove=this.onPinchMove.bind(this),this.onPinchEnd=this.onPinchEnd.bind(this)}return PinchInput.prototype.mapAxes=function(t){this.axes=t},PinchInput.prototype.connect=function(t){var e={threshold:this.options.threshold};if(this.hammer)this.dettachEvent(),this.hammer.add(new r.Pinch(e));else{var n=this.element[s.UNIQUEKEY];n?this.hammer.destroy():n=String(Math.round(Math.random()*(new Date).getTime())),this.hammer=s.createHammer(this.element,[r.Pinch,e],r.TouchInput),this.element[s.UNIQUEKEY]=n}return this.attachEvent(t),this},PinchInput.prototype.disconnect=function(){return this.hammer&&this.dettachEvent(),this},PinchInput.prototype.destroy=function(){this.disconnect(),this.hammer&&this.hammer.destroy(),delete this.element[s.UNIQUEKEY],this.element=null,this.hammer=null},PinchInput.prototype.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,s.toAxis(this.axes,[e])),this._prev=t.scale},PinchInput.prototype.onPinchMove=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,s.toAxis(this.axes,[e])),this._prev=t.scale},PinchInput.prototype.onPinchEnd=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,s.toAxis(this.axes,[e])),this.observer.release(this,t,s.toAxis(this.axes,[0]),0),this._base=null,this._prev=null},PinchInput.prototype.getOffset=function(t,e){return void 0===e&&(e=1),this._base*(t-e)*this.options.scale},PinchInput.prototype.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},PinchInput.prototype.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},PinchInput.prototype.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},PinchInput.prototype.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},PinchInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},PinchInput}();e.PinchInput=a},function(t,e,n){"use strict";var i=this&&this.__assign||Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t};e.__esModule=!0;var r=n(0),o=n(4),s=function(){function WheelInput(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._timer=null,this.element=r.$(t),this.options=i({scale:1,throttle:100},e),this.onWheel=this.onWheel.bind(this)}return WheelInput.prototype.mapAxes=function(t){this.axes=t},WheelInput.prototype.connect=function(t){return this.dettachEvent(),this.attachEvent(t),this},WheelInput.prototype.disconnect=function(){return this.dettachEvent(),this},WheelInput.prototype.destroy=function(){this.disconnect(),this.element=null},WheelInput.prototype.onWheel=function(t){var e=this;this._isEnabled&&(t.preventDefault(),0!==t.deltaY&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.hold(e,t);var n=(t.deltaY>0?-1:1)*e.options.scale;e.observer.change(e,t,o.toAxis(e.axes,[n])),e.observer.release(e,t,o.toAxis(e.axes,[0]))},200)))},WheelInput.prototype.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},WheelInput.prototype.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null},WheelInput.prototype.enable=function(){return this._isEnabled=!0,this},WheelInput.prototype.disable=function(){return this._isEnabled=!1,this},WheelInput.prototype.isEnable=function(){return this._isEnabled},WheelInput}();e.WheelInput=s}])}); | ||
//# sourceMappingURL=axes.pkgd.min.js.map |
156
package.json
{ | ||
"name": "@egjs/axes", | ||
"version": "2.0.0", | ||
"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.", | ||
"main": "dist/axes.js", | ||
"scripts": { | ||
"start": "webpack-dev-server --open", | ||
"build": "webpack --env production && webpack --env packaged ", | ||
"test": "karma start", | ||
"test:chrome": "karma start --chrome", | ||
"lint": "tslint src", | ||
"jsdoc": "rm -rf ./doc && rm -rf .outjs && tsc && jsdoc -c jsdoc.json", | ||
"coverage": "karma start --coverage", | ||
"demo:start": "npm run demo:prebuild-latest && npm run demo:updateVersion && jekyll serve --host=0.0.0.0 -s demo", | ||
"demo:build": "npm run demo:updateVersion && jekyll build -s demo", | ||
"demo:prebuild-version": "cpx 'dist/**/*' demo/release/$npm_package_version/dist --clean && cpx 'doc/**/*' demo/release/$npm_package_version/doc --clean", | ||
"demo:prebuild-latest": "cpx 'dist/**/*' demo/release/latest/dist --clean && cpx 'doc/**/*' demo/release/latest/doc --clean", | ||
"demo:deploy": "npm run build && npm run jsdoc && npm run demo:prebuild-version && npm run demo:prebuild-latest && npm run demo:build && gh-pages -d demo/_site --remote upstream", | ||
"demo:updateVersion": "echo $npm_package_version > demo/_data/version.yml", | ||
"demo:setup": "cpx 'node_modules/@egjs/common-demo/**/*' 'demo/' && rm demo/package.json", | ||
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
"prepush": "npm run lint", | ||
"commitmsg": "node config/validate-commit-msg.js" | ||
}, | ||
"author": { | ||
"name": "NAVER Corp." | ||
}, | ||
"namespace": { | ||
"eg": "eg", | ||
"Hammer": "Hammer" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@egjs/component": "^2.0.0", | ||
"hammerjs": "^2.0.8" | ||
}, | ||
"devDependencies": { | ||
"@egjs/common-demo": "github:naver/egjs#common-demo", | ||
"awesome-typescript-loader": "^3.2.2", | ||
"babel-core": "^6.25.0", | ||
"babel-loader": "^7.1.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"chai": "^4.1.1", | ||
"clean-webpack-plugin": "^0.1.16", | ||
"coveralls": "^2.13.1", | ||
"cpx": "^1.5.0", | ||
"egjs-jsdoc-template": "^1.3.3", | ||
"gh-pages": "^1.0.0", | ||
"hammer-simulator": "0.0.1", | ||
"husky": "^0.14.3", | ||
"inject-loader": "^3.0.1", | ||
"istanbul-instrumenter-loader": "^3.0.0", | ||
"jsdoc": "^3.5.4", | ||
"karma": "^1.7.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage-istanbul-reporter": "^1.3.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.3", | ||
"karma-sinon": "^1.0.5", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "^2.0.4", | ||
"lite-fixture": "^1.0.2", | ||
"mocha": "^3.5.0", | ||
"sinon": "^3.0.0", | ||
"string-replace-webpack-plugin": "0.1.3", | ||
"tslint": "^5.5.0", | ||
"tslint-eslint-rules": "^4.1.1", | ||
"tslint-loader": "^3.5.3", | ||
"typescript": "^2.4.2", | ||
"uglifyjs-webpack-plugin": "^0.4.6", | ||
"webpack": "^3.4.1", | ||
"webpack-dev-server": "^2.6.1", | ||
"webpack-merge": "^4.1.0", | ||
"write-file-webpack-plugin": "^4.1.0" | ||
} | ||
"name": "@egjs/axes", | ||
"version": "2.1.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.", | ||
"main": "dist/axes.js", | ||
"types": "declaration/Axes.d.ts", | ||
"scripts": { | ||
"start": "webpack-dev-server --open", | ||
"build": "webpack --env production && webpack --env packaged && npm run declaration", | ||
"test": "karma start", | ||
"test:chrome": "karma start --chrome", | ||
"lint": "tslint src", | ||
"jsdoc": "rm -rf ./doc && rm -rf outjs && tsc -p tsconfig.doc.json && jsdoc -c jsdoc.json", | ||
"declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json", | ||
"coverage": "karma start --coverage", | ||
"demo:start": "npm run demo:prebuild-latest && npm run demo:updateVersion && jekyll serve --host=0.0.0.0 -s demo", | ||
"demo:build": "npm run demo:updateVersion && jekyll build -s demo", | ||
"demo:prebuild-version": "cpx 'dist/**/*' demo/release/$npm_package_version/dist --clean && cpx 'doc/**/*' demo/release/$npm_package_version/doc --clean", | ||
"demo:prebuild-latest": "cpx 'dist/**/*' demo/release/latest/dist --clean && cpx 'doc/**/*' demo/release/latest/doc --clean", | ||
"demo:deploy": "npm run build && npm run jsdoc && npm run demo:prebuild-version && npm run demo:prebuild-latest && npm run demo:build && gh-pages -d demo/_site --add --remote upstream", | ||
"demo:updateVersion": "echo $npm_package_version > demo/_data/version.yml", | ||
"demo:setup": "cpx 'node_modules/@egjs/common-demo/**/*' 'demo/' && rm demo/package.json", | ||
"release": "node config/release.js", | ||
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
"prepush": "npm run lint", | ||
"commitmsg": "node config/validate-commit-msg.js" | ||
}, | ||
"author": { | ||
"name": "NAVER Corp." | ||
}, | ||
"namespace": { | ||
"eg": "eg", | ||
"Hammer": "Hammer" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"@egjs/component": "^2.0.0", | ||
"hammerjs": "^2.0.8" | ||
}, | ||
"devDependencies": { | ||
"@egjs/common-demo": "github:naver/egjs#common-demo", | ||
"awesome-typescript-loader": "^3.2.3", | ||
"babel-core": "^6.26.0", | ||
"babel-loader": "^7.1.2", | ||
"babel-preset-es2015": "^6.24.1", | ||
"chai": "^4.1.1", | ||
"chalk": "^2.1.0", | ||
"clean-webpack-plugin": "^0.1.16", | ||
"coveralls": "^2.13.1", | ||
"cpx": "^1.5.0", | ||
"egjs-jsdoc-template": "^1.4.0", | ||
"fs-extra": "^4.0.1", | ||
"gh-pages": "^1.0.0", | ||
"hammer-simulator": "0.0.1", | ||
"husky": "^0.14.3", | ||
"inject-loader": "^3.0.1", | ||
"istanbul-instrumenter-loader": "^3.0.0", | ||
"jsdoc": "^3.5.4", | ||
"karma": "^1.7.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-coverage-istanbul-reporter": "^1.3.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.4", | ||
"karma-sinon": "^1.0.5", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "^2.0.4", | ||
"lite-fixture": "^1.0.2", | ||
"mocha": "^3.5.0", | ||
"sinon": "^3.2.1", | ||
"string-replace-webpack-plugin": "0.1.3", | ||
"sync-exec": "^0.6.2", | ||
"tslint": "^5.7.0", | ||
"tslint-eslint-rules": "^4.1.1", | ||
"tslint-loader": "^3.5.3", | ||
"typescript": "^2.4.2", | ||
"uglifyjs-webpack-plugin": "^0.4.6", | ||
"webpack": "^3.5.5", | ||
"webpack-dev-server": "^2.7.1", | ||
"webpack-merge": "^4.1.0", | ||
"write-file-webpack-plugin": "^4.1.0" | ||
} | ||
} |
# egjs-axes [![npm version](https://badge.fury.io/js/%40egjs%2Faxes.svg)](https://badge.fury.io/js/%40egjs%2Faxes) [![Build Status](https://travis-ci.org/naver/egjs-axes.svg?branch=master)](https://travis-ci.org/naver/egjs-axes) [![Coverage Status](https://coveralls.io/repos/github/naver/egjs-axes/badge.svg?branch=master)](https://coveralls.io/github/naver/egjs-axes?branch=master) | ||
A module used to change the information of user action entered by various input devices such as touch screen or mouse into logical coordinates within the virtual coordinate system. The coordinate information sorted by time events occurred is provided if animations are made by user actions. | ||
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. | ||
<img src="https://github.com/naver/egjs-axes/raw/master/demo/assets/image/structure.png" style="width:100%"> | ||
You can easily create a UI that responds to user actions. | ||
![car360 using egjs-axes](https://github.com/naver/egjs-axes/raw/master/demo/assets/image/360car.gif) | ||
@@ -10,2 +14,4 @@ | ||
- [API documentation](https://naver.github.io/egjs-axes/release/latest/doc/) | ||
- [How to create an ui that responds to user actions using eg.axes](https://medium.com/@sculove/how-to-create-a-ui-that-responds-to-user-actions-using-eg-axes-5037d180d5ab) | ||
- [How to create a custom InputType](https://github.com/naver/egjs-axes/wiki/How-to-create-a-custom-InputType) | ||
@@ -62,3 +68,3 @@ ## Download and Installation | ||
|[egjs-component](http://github.com/naver/egjs/egjs-component)|[Hammer.JS](http://hammerjs.github.io/)| | ||
|[egjs-component](http://github.com/naver/egjs-component)|[Hammer.JS](http://hammerjs.github.io/)| | ||
|----|----| | ||
@@ -93,3 +99,3 @@ |2.0.0+|2.0.4+| | ||
Use npm script to build billboard.js | ||
Use npm script to build eg.Axes | ||
@@ -96,0 +102,0 @@ ```bash |
@@ -0,1 +1,2 @@ | ||
import { IInputType } from "./inputType/InputType"; | ||
import Coordinate from "./Coordinate"; | ||
@@ -5,3 +6,4 @@ import { Axis, AxisManager } from "./AxisManager"; | ||
import { EventManager } from "./EventManager"; | ||
import {requestAnimationFrame, cancelAnimationFrame} from "./utils"; | ||
import { requestAnimationFrame, cancelAnimationFrame } from "./utils"; | ||
import { AxesOption } from "./Axes"; | ||
@@ -17,2 +19,3 @@ export interface AnimationParam { | ||
inputEvent?; | ||
input?: IInputType | ||
} | ||
@@ -61,4 +64,4 @@ | ||
opt.range, | ||
opt.circular, | ||
opt.bounce, | ||
opt.circular as boolean[], | ||
opt.bounce as number[] | ||
); | ||
@@ -79,9 +82,9 @@ })); | ||
grab(axes: string[], event?) { | ||
grab(axes: string[], inputType?: IInputType, event?) { | ||
if (this._animateParam && !axes.length) { | ||
const orgPos: Axis = this.axm.get(axes); | ||
const pos: Axis = this.axm.map(orgPos, | ||
(v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular)); | ||
(v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular as boolean[])); | ||
if (!this.axm.every(pos, (v, k) => orgPos[k] === v)) { | ||
this.em.triggerChange(pos, event); | ||
this.em.triggerChange(pos, inputType, event); | ||
} | ||
@@ -108,7 +111,7 @@ this._animateParam = null; | ||
this.axm.get(), | ||
(v, k, opt) => Coordinate.isCircularable(v, opt.range, opt.circular) | ||
(v, k, opt) => Coordinate.isCircularable(v, opt.range, opt.circular as boolean[]) | ||
); | ||
Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map( | ||
circularTargets, | ||
(v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular) | ||
(v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular as boolean[]) | ||
)); | ||
@@ -164,5 +167,5 @@ this.itm.setInterrupt(false); | ||
if (!retTrigger && this.axm.every( | ||
userWish.destPos, | ||
(v, k, opt) => Coordinate.isCircularable(v, opt.range, opt.circular))) { | ||
console.warn("You can't stop the 'animation' event when 'circular' is true."); | ||
userWish.destPos, | ||
(v, k, opt) => Coordinate.isCircularable(v, opt.range, opt.circular as boolean[]))) { | ||
console.warn("You can't stop the 'animation' event when 'circular' is true."); | ||
} | ||
@@ -187,3 +190,3 @@ | ||
v += (param.destPos[k] - v) * easingPer; | ||
return Coordinate.getCirculatedPos(v, opt.range, opt.circular); | ||
return Coordinate.getCirculatedPos(v, opt.range, opt.circular as boolean[]); | ||
}); | ||
@@ -212,4 +215,4 @@ this.em.triggerChange(toPos); | ||
movedPos = this.axm.map(movedPos, (v, k, opt) => { | ||
v = Coordinate.getInsidePosition(v, opt.range, opt.circular); | ||
return duration ? v : Coordinate.getCirculatedPos(v, opt.range, opt.circular); | ||
v = Coordinate.getInsidePosition(v, opt.range, opt.circular as boolean[]); | ||
return duration ? v : Coordinate.getCirculatedPos(v, opt.range, opt.circular as boolean[]); | ||
}); | ||
@@ -216,0 +219,0 @@ if (AxisManager.equal(movedPos, orgPos)) { |
import * as Component from "@egjs/component"; | ||
import {AnimationManager} from "./AnimationManager"; | ||
import {EventManager} from "./EventManager"; | ||
import {InterruptManager} from "./InterruptManager"; | ||
import {AxisManager, Axis} from "./AxisManager"; | ||
import {InputObserver} from "./InputObserver"; | ||
import {PanInput} from "./inputType/PanInput"; | ||
import {PinchInput} from "./inputType/PinchInput"; | ||
import {WheelInput} from "./inputType/WheelInput"; | ||
import {TRANSFORM, DIRECTION} from "./const"; | ||
import {IInputType} from "./inputType/InputType"; | ||
import { AnimationManager } from "./AnimationManager"; | ||
import { EventManager } from "./EventManager"; | ||
import { InterruptManager } from "./InterruptManager"; | ||
import { AxisManager, AxisOption, Axis } from "./AxisManager"; | ||
import { InputObserver } from "./InputObserver"; | ||
import { PanInput } from "./inputType/PanInput"; | ||
import { PinchInput } from "./inputType/PinchInput"; | ||
import { WheelInput } from "./inputType/WheelInput"; | ||
import { TRANSFORM, DIRECTION } from "./const"; | ||
import { IInputType } from "./inputType/InputType"; | ||
export interface AxesOption { | ||
easing?: (x: number) => number; | ||
maximumDuration?: number; | ||
minimumDuration?: number; | ||
deceleration?: number; | ||
interruptable?: boolean; | ||
} | ||
/** | ||
@@ -45,3 +53,3 @@ * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. | ||
* @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<ko>인스턴스 생성시 이동할 좌표</ko> | ||
* @param {Object.<string, number>} [startPos] The coordinates to be moved when creating an instance<ko>인스턴스 생성시 이동할 좌표</ko> | ||
* | ||
@@ -183,11 +191,13 @@ * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} | ||
super(); | ||
this.options = { ...{ | ||
easing: function easeOutCubic(x) { | ||
return 1 - Math.pow(1 - x, 3); | ||
}, | ||
interruptable: true, | ||
maximumDuration: Infinity, | ||
minimumDuration: 0, | ||
deceleration: 0.0006, | ||
}, ...options}; | ||
this.options = { | ||
...{ | ||
easing: function easeOutCubic(x) { | ||
return 1 - Math.pow(1 - x, 3); | ||
}, | ||
interruptable: true, | ||
maximumDuration: Infinity, | ||
minimumDuration: 0, | ||
deceleration: 0.0006, | ||
}, ...options | ||
}; | ||
@@ -209,7 +219,9 @@ this._complementOptions(); | ||
Object.keys(this.axis).forEach(axis => { | ||
this.axis[axis] = { ...{ | ||
range: [0, 100], | ||
bounce: [0, 0], | ||
circular: [false, false] | ||
}, ...this.axis[axis]}; | ||
this.axis[axis] = { | ||
...{ | ||
range: [0, 100], | ||
bounce: [0, 0], | ||
circular: [false, false] | ||
}, ...this.axis[axis] | ||
}; | ||
@@ -216,0 +228,0 @@ ["bounce", "circular"].forEach(v => { |
import Coordinate from "./Coordinate"; | ||
import { AxesOption } from "./Axes"; | ||
@@ -7,2 +8,8 @@ export interface Axis { | ||
export interface AxisOption { | ||
range?: number[]; | ||
bounce?: number|number[]; | ||
circular?: boolean|boolean[]; | ||
} | ||
export class AxisManager { | ||
@@ -9,0 +16,0 @@ private _pos: Axis; |
@@ -1,5 +0,5 @@ | ||
import {Axis} from "./AxisManager"; | ||
import { Axis } from "./AxisManager"; | ||
const Coordinate = { | ||
getInsidePosition( | ||
getInsidePosition( | ||
destPos: number, | ||
@@ -9,3 +9,3 @@ range: number[], | ||
bounce?: number[], | ||
): number { | ||
): number { | ||
let toDestPos: number = destPos; | ||
@@ -21,3 +21,3 @@ const targetRange: number[] = [ | ||
return +Math.min(targetRange[1], Math.max(targetRange[0], toDestPos)).toFixed(5); | ||
}, | ||
}, | ||
@@ -38,8 +38,8 @@ | ||
return (circular[1] && destPos > range[1]) || | ||
(circular[0] && destPos < range[0]); | ||
(circular[0] && destPos < range[0]); | ||
}, | ||
getCirculatedPos(pos: number, range: number[], circular: boolean[]): number { | ||
let toPos = pos; | ||
const min = range[0]; | ||
const max = range[1]; | ||
let toPos = pos; | ||
const min = range[0]; | ||
const max = range[1]; | ||
const length = max - min; | ||
@@ -46,0 +46,0 @@ |
@@ -0,1 +1,2 @@ | ||
import { IInputType } from "./inputType/InputType"; | ||
import { Axis } from "./AxisManager"; | ||
@@ -5,3 +6,3 @@ import { AnimationParam } from "./AnimationManager"; | ||
export class EventManager { | ||
constructor(private axes, private axm) { | ||
constructor(private axes, private axm) { | ||
} | ||
@@ -15,2 +16,3 @@ /** | ||
* @param {Object.<string, number>} param.pos coordinate <ko>좌표 정보</ko> | ||
* @param {Object} param.input The instance of inputType where the event occurred<ko>이벤트가 발생한 inputType 인스턴스</ko> | ||
* @param {Object} param.inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko> | ||
@@ -28,8 +30,10 @@ * | ||
* // event.pos | ||
* // event.input | ||
* // event.inputEvent | ||
* }); | ||
*/ | ||
triggerHold(pos: Axis, event) { | ||
triggerHold(pos: Axis, input: IInputType, event) { | ||
this.axes.trigger("hold", { | ||
pos, | ||
input, | ||
inputEvent: event, | ||
@@ -85,2 +89,3 @@ }); | ||
* @param {Object} param.inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko> | ||
* @param {Object} param.input The instance of inputType where the event occurred<ko>이벤트가 발생한 inputType 인스턴스</ko> | ||
* @param {setTo} param.setTo Specifies the animation coordinates to move after the event <ko>이벤트 이후 이동할 애니메이션 좌표를 지정한다</ko> | ||
@@ -100,2 +105,3 @@ * | ||
* // event.delta | ||
* // event.input | ||
* // event.inputEvent | ||
@@ -108,3 +114,3 @@ * // event.setTo | ||
*/ | ||
triggerRelease(param: AnimationParam, event = null) { | ||
triggerRelease(param: AnimationParam) { | ||
param.setTo = this.createUserControll(param.destPos, param.duration); | ||
@@ -124,3 +130,4 @@ this.axes.trigger("release", param); | ||
* @param {Boolean} param.holding Indicates whether a user holds an element on the screen of the device.<ko>사용자가 기기의 화면을 누르고 있는지 여부</ko> | ||
* @param {Object} param.inputEvent The event object received from inputType. It returns null if the event is fired through a call to the setTo() or setBy() method.<ko>inputType으로 부터 받은 이벤트 객체. setTo() 메서드나 setBy() 메서드를 호출해 이벤트가 발생했을 때는 'null'을 반환한다.</ko> | ||
* @param {Object} param.input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.<ko>이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.</ko> | ||
* @param {Object} param.inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.<ko>inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.</ko> | ||
* @param {set} param.set Specifies the coordinates to move after the event. It works when the holding value is true <ko>이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.</ko> | ||
@@ -139,2 +146,3 @@ * | ||
* // event.delta | ||
* // event.input | ||
* // event.inputEvent | ||
@@ -149,3 +157,3 @@ * // event.holding | ||
*/ | ||
triggerChange(pos: Axis, event = null) { | ||
triggerChange(pos: Axis, input: IInputType = null, event = null) { | ||
const moveTo = this.axm.moveTo(pos); | ||
@@ -155,5 +163,6 @@ const param = { | ||
delta: moveTo.delta, | ||
holding: event !== null, | ||
holding: !!event, | ||
inputEvent: event, | ||
set: event ? this.createUserControll(moveTo.pos) : () => {}, | ||
input, | ||
set: event ? this.createUserControll(moveTo.pos) : () => { }, | ||
}; | ||
@@ -165,36 +174,36 @@ this.axes.trigger("change", param); | ||
/** | ||
* This event is fired when animation starts. | ||
* @ko 에니메이션이 시작할 때 발생한다. | ||
* @name eg.Axes#animationStart | ||
* @event | ||
* | ||
* @param {Object} param The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @param {Object.<string, number>} param.depaPos The coordinates when animation starts<ko>애니메이션이 시작 되었을 때의 좌표 </ko> | ||
* @param {Object.<string, number>} param.destPos The coordinates to move to. If you change this value, you can run the animation<ko>이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다</ko> | ||
* @param {Object.<string, number>} param.delta The movement variation of coordinate <ko>좌표의 변화량</ko> | ||
* @param {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.<ko>애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.</ko> | ||
* @param {Object} param.inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko> | ||
* @param {setTo} param.setTo Specifies the animation coordinates to move after the event <ko>이벤트 이후 이동할 애니메이션 좌표를 지정한다</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.inputEvent | ||
* // event.setTo | ||
* | ||
* // if you want to change the animation coordinates to move after the 'animationStart' event. | ||
* event.setTo({x: 10}, 2000); | ||
* }); | ||
*/ | ||
triggerAnimationStart(param: AnimationParam): Boolean { | ||
/** | ||
* This event is fired when animation starts. | ||
* @ko 에니메이션이 시작할 때 발생한다. | ||
* @name eg.Axes#animationStart | ||
* @event | ||
* | ||
* @param {Object} param The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @param {Object.<string, number>} param.depaPos The coordinates when animation starts<ko>애니메이션이 시작 되었을 때의 좌표 </ko> | ||
* @param {Object.<string, number>} param.destPos The coordinates to move to. If you change this value, you can run the animation<ko>이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다</ko> | ||
* @param {Object.<string, number>} param.delta The movement variation of coordinate <ko>좌표의 변화량</ko> | ||
* @param {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.<ko>애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.</ko> | ||
* @param {Object} param.inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko> | ||
* @param {setTo} param.setTo Specifies the animation coordinates to move after the event <ko>이벤트 이후 이동할 애니메이션 좌표를 지정한다</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.inputEvent | ||
* // event.setTo | ||
* | ||
* // if you want to change the animation coordinates to move after the 'animationStart' event. | ||
* event.setTo({x: 10}, 2000); | ||
* }); | ||
*/ | ||
triggerAnimationStart(param: AnimationParam): Boolean { | ||
param.setTo = this.createUserControll(param.destPos, param.duration); | ||
@@ -228,6 +237,6 @@ return this.axes.trigger("animationStart", param); | ||
const userControl = { | ||
destPos: {...pos}, | ||
duration : duration | ||
destPos: { ...pos }, | ||
duration: duration | ||
}; | ||
return function(toPos?: Axis, userDuration?: number): { destPos: Axis, duration: number } { | ||
return function (toPos?: Axis, userDuration?: number): { destPos: Axis, duration: number } { | ||
toPos && (userControl.destPos = { ...toPos }); | ||
@@ -234,0 +243,0 @@ (userDuration !== undefined) && (userControl.duration = userDuration); |
@@ -7,2 +7,3 @@ import Axes from "./Axes"; | ||
import { AnimationParam, AnimationManager } from "./AnimationManager"; | ||
import { AxesOption } from "./Axes"; | ||
import Coordinate from "./Coordinate"; | ||
@@ -47,3 +48,5 @@ | ||
} | ||
get(inputType: IInputType): Axis { | ||
return this.axm.get(inputType.axes); | ||
} | ||
hold(inputType: IInputType, event) { | ||
@@ -54,5 +57,5 @@ if (this.itm.isInterrupted() || !inputType.axes.length) { | ||
this.itm.setInterrupt(true); | ||
this.am.grab(inputType.axes, event); | ||
this.am.grab(inputType.axes, inputType, event); | ||
if (!this.moveDistance) { | ||
this.em.triggerHold(this.axm.get(), event); | ||
this.em.triggerHold(this.axm.get(), inputType, event); | ||
} | ||
@@ -62,3 +65,3 @@ this.isOutside = this.axm.isOutside(inputType.axes); | ||
} | ||
change(inputType, event, offset: Axis) { | ||
change(inputType: IInputType, event, offset: Axis) { | ||
if (!this.itm.isInterrupting() || this.axm.every(offset, v => v === 0)) { | ||
@@ -73,3 +76,3 @@ return; | ||
this.moveDistance && (this.moveDistance = destPos); | ||
destPos = this.axm.map(destPos, (v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular)); | ||
destPos = this.axm.map(destPos, (v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular as boolean[])); | ||
@@ -83,3 +86,3 @@ // from outside to inside | ||
this.em.triggerChange(destPos, event); | ||
this.em.triggerChange(destPos, inputType, event); | ||
} | ||
@@ -99,4 +102,4 @@ release(inputType: IInputType, event, offset: Axis, inputDuration?: number) { | ||
opt.range, | ||
opt.circular, | ||
opt.bounce, | ||
opt.circular as boolean[], | ||
opt.bounce as number[], | ||
); | ||
@@ -111,2 +114,3 @@ })); | ||
inputEvent: event, | ||
input: inputType, | ||
}; | ||
@@ -120,3 +124,3 @@ this.em.triggerRelease(param); | ||
if (isEqual || userWish.duration === 0) { | ||
!isEqual && this.em.triggerChange(userWish.destPos, event); | ||
!isEqual && this.em.triggerChange(userWish.destPos, inputType, event); | ||
this.itm.setInterrupt(false); | ||
@@ -123,0 +127,0 @@ this.axm.isOutside() && this.am.restore(event); |
import * as Hammer from "hammerjs"; | ||
import { Axis } from "../AxisManager"; | ||
import { AxesOption } from "../Axes"; | ||
@@ -19,2 +20,3 @@ export interface IInputType { | ||
options: AxesOption; | ||
get(inputType: IInputType): Axis; | ||
change(inputType: IInputType, event, offset: Axis); | ||
@@ -21,0 +23,0 @@ hold(inputType: IInputType, event); |
@@ -91,3 +91,3 @@ import { InputObserver } from "./../InputObserver"; | ||
constructor(el: string | HTMLElement, options: PanInputOption) { | ||
constructor(el: string | HTMLElement, options?: PanInputOption) { | ||
/** | ||
@@ -94,0 +94,0 @@ * Hammer helps you add support for touch gestures to your page |
@@ -41,4 +41,5 @@ import { InputObserver } from "./../InputObserver"; | ||
private observer: IInputTypeObserver; | ||
private _base: number = null; | ||
private _prev: number = null; | ||
constructor(el, options: PinchInputOption) { | ||
constructor(el, options?: PinchInputOption) { | ||
/** | ||
@@ -59,3 +60,3 @@ * Hammer helps you add support for touch gestures to your page | ||
scale: 1, | ||
threshold: 0 | ||
threshold: 0, | ||
}, ...options | ||
@@ -119,14 +120,23 @@ }; | ||
private onPinchStart(event) { | ||
this._prev = event.scale; | ||
this.observer.hold(this, event); | ||
this._base = this.observer.get(this)[this.axes[0]]; | ||
const offset = this.getOffset(event.scale); | ||
this.observer.hold(this, event); | ||
this.observer.change(this, event, toAxis(this.axes, [offset])); | ||
this._prev = event.scale; | ||
} | ||
private onPinchMove(event) { | ||
const offset = (event.scale - this._prev) * this.options.scale; | ||
this.observer.change(this, event, toAxis(this.axes, [offset])); | ||
const offset = this.getOffset(event.scale, this._prev); | ||
this.observer.change(this, event, toAxis(this.axes, [offset])); | ||
this._prev = event.scale; | ||
} | ||
private onPinchEnd(event) { | ||
const offset = this.getOffset(event.scale, this._prev); | ||
this.observer.change(this, event, toAxis(this.axes, [offset])); | ||
this.observer.release(this, event, toAxis(this.axes, [0]), 0); | ||
this._base = null; | ||
this._prev = null; | ||
} | ||
} | ||
private getOffset(pinchScale: number, prev: number = 1): number { | ||
return this._base * (pinchScale - prev) * this.options.scale; | ||
} | ||
@@ -133,0 +143,0 @@ private attachEvent(observer: IInputTypeObserver) { |
@@ -42,3 +42,3 @@ import { InputObserver } from "./../InputObserver"; | ||
private observer: IInputTypeObserver; | ||
constructor(el, options: WheelInputOption) { | ||
constructor(el, options?: WheelInputOption) { | ||
this.element = $(el); | ||
@@ -45,0 +45,0 @@ this.options = { |
@@ -0,1 +1,2 @@ | ||
import { AxesOption } from "./Axes"; | ||
export class InterruptManager { | ||
@@ -2,0 +3,0 @@ private _prevented = false; // check whether the animation event was prevented |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
806775
44
9205
163
41