@egjs/axes
Advanced tools
Comparing version 2.0.0-rc.4 to 2.0.0
@@ -8,4 +8,4 @@ /*! | ||
* | ||
* @version 2.0.0-rc | ||
* @version 2.0.0 | ||
*/ | ||
!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";Object.defineProperty(e,"__esModule",{value:!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))},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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=function(){function AxisManager(t){var e=this;this.options=t,this._pos=Object.keys(this.options.axis).reduce(function(t,n){return t[n]=e.options.axis[n].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.get=function(t){var e=this;return t?t.reduce(function(t,n){return n&&n in e._pos&&(t[n]=e._pos[n]),t},{}):i({},this._pos)},AxisManager.prototype.moveTo=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e]);return i({},this._pos)},AxisManager.prototype.every=function(t,e){var n=this.options.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.options.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.options.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";Object.defineProperty(e,"__esModule",{value:!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";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}Object.defineProperty(e,"__esModule",{value:!0}),e.$=$},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}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2);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";var i=n(7),r=function(t){return t&&t.__esModule?t:{"default":t}}(i);r["default"].VERSION="2.0.0-rc",t.exports=r["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};Object.defineProperty(e,"__esModule",{value:!0});var o=n(8),s=n(9),a=n(10),u=n(11),h=n(1),c=n(12),p=n(13),m=n(14),f=n(3),l=function(t){function Axes(e){var n=t.call(this)||this;return n._inputs=[],n.options=r({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:Infinity,deceleration:6e-4,axis:{}},e),n._complementOptions(),n._em=new a.EventManager(n),n._axm=new h.AxisManager(n.options),n._itm=new u.InterruptManager(n.options),n._am=new s.AnimationManager(n.options,n._itm,n._em,n._axm),n._io=new c.InputObserver(n.options,n._itm,n._em,n._axm,n._am),n}return i(Axes,t),Axes.prototype._complementOptions=function(){var t=this;Object.keys(this.options.axis).forEach(function(e){t.options.axis[e]=r({range:[0,100],bounce:[0,0],circular:[!1,!1]},t.options.axis[e]),["bounce","circular"].forEach(function(n){var i=t.options.axis,r=i[e][n];/string|number|boolean/.test(typeof r)&&(i[e][n]=[r,r])})})},Axes.prototype.connect=function(t,e){var n;n="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e);var i=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});return i.length&&(e.hammer=i[0].hammer),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.isOutside=function(t){return this._axm.isOutside(t)},Axes.prototype.destroy=function(){this.disconnect(),this._em.destroy()},Axes.PanInput=p.PanInput,Axes.PinchInput=m.PinchInput,Axes.TRANSFORM=f.TRANSFORM,Axes.DIRECTION_ALL=f.DIRECTION.DIRECTION_ALL,Axes.DIRECTION_DOWN=f.DIRECTION.DIRECTION_DOWN,Axes.DIRECTION_HORIZONTAL=f.DIRECTION.DIRECTION_HORIZONTAL,Axes.DIRECTION_LEFT=f.DIRECTION.DIRECTION_LEFT,Axes.DIRECTION_NONE=f.DIRECTION.DIRECTION_NONE,Axes.DIRECTION_RIGHT=f.DIRECTION.DIRECTION_RIGHT,Axes.DIRECTION_UP=f.DIRECTION.DIRECTION_UP,Axes.DIRECTION_VERTICAL=f.DIRECTION.DIRECTION_VERTICAL,Axes}(o);e["default"]=l},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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),s=function(){function AnimationManager(t,e,n,i){this.options=t,this.itm=e,this.em=n,this.axm=i}return 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 this.options.maximumDuration>i?i:this.options.maximumDuration},AnimationManager.prototype.createAnimationParam=function(t,e,n){void 0===n&&(n=null);var i=this.axm.get(Object.keys(t)),o=this.axm.map(t,function(t,e,n){return r["default"].getInsidePosition(t,n.range,n.circular,n.bounce)}),s=this.axm.map(o,function(t,e){return t-i[e]}),a=this.options.maximumDuration;return{depaPos:i,destPos:o,duration:a>e?e:a,distance:s,inputEvent:n,done:this.animationEnd.bind(this)}},AnimationManager.prototype.grab=function(t){if(this._animateParam&&!t.length){var e=this.axm.get(t),n=this.axm.map(e,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)});this.axm.every(n,function(t,n){return e[n]===t})||this.em.triggerChange(this.axm.moveTo(n),!0),this._animateParam=null,this._raf&&window.cancelAnimationFrame(this._raf),this._raf=null,this.em.trigger("animationEnd")}},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,this.setTo(this.axm.map(this.axm.get(),function(t,e,n){return r["default"].getCirculatedPos(Math.round(t),n.range,n.circular)})),this.itm.setInterrupt(!1),this.em.trigger("animationEnd"),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 void e();r._raf=window.requestAnimationFrame(loop)}()}else this.em.triggerChange(this.axm.moveTo(t.destPos)),e()},AnimationManager.prototype.animateTo=function(t,e,n){var i=this;void 0===n&&(n=null);var s=(this.axm.get(),this.createAnimationParam(t,e,n)),a=this.em.trigger("animationStart",s);!a&&this.axm.every(s.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."),a&&!o.AxisManager.equal(s.destPos,s.depaPos)&&this.animateLoop(s,function(){return i.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(this.axm.moveTo(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(this.axm.moveTo(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=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function EventManager(t){this.axes=t}return EventManager.prototype.trigger=function(t,e){return this.axes.trigger(t,e)},EventManager.prototype.triggerChange=function(t,e){void 0===e&&(e=null),this.trigger("change",{pos:t,holding:null!==e,inputEvent:e})},EventManager.prototype.destroy=function(){this.axes.off()},EventManager}();e.EventManager=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!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";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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(0),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}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){if(!this.itm.isInterrupted()&&t.axes.length){this.itm.setInterrupt(!0),this.am.grab(t.axes);var n=this.axm.get();this.em.trigger("hold",{pos:n,inputEvent: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=this.axm.get(t.axes);this.moveDistance=this.axm.map(this.moveDistance,function(t,e){return t+(n[e]||0)});var r=this.axm.map(this.moveDistance,function(t,e,n){return o["default"].getCirculatedPos(t,n.range,n.circular)});this.isOutside&&this.axm.every(i,function(t,e,n){return!o["default"].isOutside(t,n.range)})&&(this.isOutside=!1),r=this.atOutside(r),this.em.triggerChange(this.axm.moveTo(r),e)}},InputObserver.prototype.release=function(t,e,n,s){if(this.itm.isInterrupting()){var a=this.axm.get(t.axes),u=this.axm.get(),h=this.axm.map(n,function(t,e,n){return o["default"].getInsidePosition(a[e]+t,n.range,n.circular,n.bounce)}),c={depaPos:u,destPos:i({},u,h),duration:this.am.getDuration(h,a,s),inputEvent:e};this.em.trigger("release",c),this.axm.isOutside()?this.am.restore(e):r.AxisManager.equal(c.destPos,c.depaPos)?this.itm.setInterrupt(!1):this.am.animateTo(c.destPos,c.duration),this.moveDistance=null}},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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(3),s=n(4),a=n(5),u=function(){function PanInput(t,e){if(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(){this.hammer&&(this.hammer.get("pan").options.enable=!0)},PanInput.prototype.disable=function(){this.hammer&&(this.hammer.get("pan").options.enable=!1)},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)},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).on("panend",this.onPanend)},PanInput.prototype.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove).off("panend",this.onPanend),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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(4),s=n(5),a=function(){function PinchInput(t,e){if(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(){this.hammer&&(this.hammer.get("pinch").options.enable=!0)},PinchInput.prototype.disable=function(){this.hammer&&(this.hammer.get("pinch").options.enable=!1)},PinchInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},PinchInput}();e.PinchInput=a}])}); | ||
!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}])}); |
@@ -8,3 +8,3 @@ /*! | ||
* | ||
* @version 2.0.0-rc | ||
* @version 2.0.0 | ||
* | ||
@@ -15,2 +15,2 @@ * 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";Object.defineProperty(e,"__esModule",{value:!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))},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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=function(){function AxisManager(t){var e=this;this.options=t,this._pos=Object.keys(this.options.axis).reduce(function(t,n){return t[n]=e.options.axis[n].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.get=function(t){var e=this;return t?t.reduce(function(t,n){return n&&n in e._pos&&(t[n]=e._pos[n]),t},{}):i({},this._pos)},AxisManager.prototype.moveTo=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e]);return i({},this._pos)},AxisManager.prototype.every=function(t,e){var n=this.options.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.options.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.options.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<c.length;){if(n=c[o],(i=n?n+r:e)in t)return i;o++}return a}function uniqueId(){return g++}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&O&&i-r==0,s=e&(A|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 c=getVelocity(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=c.x,e.overallVelocityY=c.y,e.overallVelocity=f(c.x)>f(c.y)?c.x:c.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 h=t.element;hasParent(e.srcEvent.target,h)&&(h=e.srcEvent.target),e.target=h}function computeDeltaXY(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==O&&o.eventType!==A||(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 c=e.deltaX-s.deltaX,h=e.deltaY-s.deltaY,p=getVelocity(u,c,h);i=p.x,r=p.y,n=f(p.x)>f(p.y)?p.x:p.y,o=getDirection(c,h),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?x:f(t)>=f(e)?t<0?R:C:e<0?D:N}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],k)+getAngle(t[1],t[0],k)}function getScale(t,e){return getDistance(e[0],e[1],k)/getDistance(t[0],t[1],k)}function MouseInput(){this.evEl=j,this.evWin=H,this.pressed=!1,Input.apply(this,arguments)}function PointerEventInput(){this.evEl=F,this.evWin=U,Input.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function SingleTouchInput(){this.evTarget=W,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&(A|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&(O|P)&&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===O)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&(A|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&O?(this.primaryTouch=e.changedPointers[0].identifier,setLastTouch.call(this,e)):t&(A|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&ht?"cancel":t&ut?"end":t&at?"move":t&st?"start":""}function directionStr(t){return t==N?"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,c=["","webkit","Moz","MS","ms","o"],h=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`."),v=deprecate(function(t,e){return d(t,e,!0)},"merge","Use `assign`."),g=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,O=1,P=2,A=4,b=8,x=1,R=2,C=4,D=8,N=16,M=R|C,w=D|N,S=M|w,z=["x","y"],k=["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 L={mousedown:O,mousemove:P,mouseup:A},j="mousedown",H="mousemove mouseup";inherit(MouseInput,Input,{handler:function(t){var e=L[t.type];e&O&&0===t.button&&(this.pressed=!0),e&P&&1!==t.which&&(e=A),this.pressed&&(e&A&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))}});var q={pointerdown:O,pointermove:P,pointerup:A,pointercancel:b,pointerout:b},Y={2:"touch",3:"pen",4:"mouse",5:"kinect"},F="pointerdown",U="pointermove pointerup pointercancel";r.MSPointerEvent&&!r.PointerEvent&&(F="MSPointerDown",U="MSPointerMove MSPointerUp MSPointerCancel"),inherit(PointerEventInput,Input,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=q[i],o=Y[t.pointerType]||t.pointerType,s="touch"==o,a=inArray(e,t.pointerId,"pointerId");r&O&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&(A|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 X={touchstart:O,touchmove:P,touchend:A,touchcancel:b},W="touchstart",V="touchstart touchmove touchend touchcancel";inherit(SingleTouchInput,Input,{handler:function(t){var e=X[t.type];if(e===O&&(this.started=!0),this.started){var n=normalizeSingleTouches.call(this,t,e);e&(A|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:O,touchmove:P,touchend:A,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 K=prefixed(h.style,"touchAction"),$=K!==a,J="auto",tt="manipulation",et="none",nt="pan-x",it="pan-y",rt=function(){if(!$)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()),$&&this.manager.element.style&&rt[t]&&(this.manager.element.style[K]=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,c=t.deltaTime<250;if(a&&u&&c)return}return s&&o?void 0:r||o&&n&M||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,ct=ut,ht=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&(ct|ht|32)&&(this.state=ot),this.state=this.process(e),this.state&(st|at|ut|ht)&&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|ht:i||r?n&A?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&M&&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&M?(r=0===o?x:o<0?R:C,n=o!=this.pX,i=Math.abs(t.deltaX)):(r=0===s?x:s<0?D:N,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&(A|b)&&!r)this.reset();else if(t.eventType&O)this.reset(),this._timer=setTimeoutContext(function(){this.state=ct,this.tryEmit()},e.time,this);else if(t.eventType&A)return ct;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===ct&&(t&&t.eventType&A?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:M|w,pointers:1},getTouchAction:function(){return PanRecognizer.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(M|w)?e=t.overallVelocity:n&M?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&A},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&O&&0===this.count)return this.failTimeout();if(i&&r&&n){if(t.eventType!=A)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=ct,this.tryEmit()},e.interval,this),st):ct}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==ct&&(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:M}],[PanRecognizer,{direction:M},["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&ct)&&(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:O,INPUT_MOVE:P,INPUT_END:A,INPUT_CANCEL:b,STATE_POSSIBLE:ot,STATE_BEGAN:st,STATE_CHANGED:at,STATE_ENDED:ut,STATE_RECOGNIZED:ct,STATE_CANCELLED:ht,STATE_FAILED:32,DIRECTION_NONE:x,DIRECTION_LEFT:R,DIRECTION_RIGHT:C,DIRECTION_UP:D,DIRECTION_DOWN:N,DIRECTION_HORIZONTAL:M,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:v,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";Object.defineProperty(e,"__esModule",{value:!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";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}Object.defineProperty(e,"__esModule",{value:!0}),e.$=$},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}Object.defineProperty(e,"__esModule",{value:!0});var i=n(2);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";var i=n(7),r=function(t){return t&&t.__esModule?t:{"default":t}}(i);r["default"].VERSION="2.0.0-rc",t.exports=r["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};Object.defineProperty(e,"__esModule",{value:!0});var o=n(8),s=n(9),a=n(10),u=n(11),c=n(1),h=n(12),p=n(13),l=n(14),f=n(3),m=function(t){function Axes(e){var n=t.call(this)||this;return n._inputs=[],n.options=r({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:Infinity,deceleration:6e-4,axis:{}},e),n._complementOptions(),n._em=new a.EventManager(n),n._axm=new c.AxisManager(n.options),n._itm=new u.InterruptManager(n.options),n._am=new s.AnimationManager(n.options,n._itm,n._em,n._axm),n._io=new h.InputObserver(n.options,n._itm,n._em,n._axm,n._am),n}return i(Axes,t),Axes.prototype._complementOptions=function(){var t=this;Object.keys(this.options.axis).forEach(function(e){t.options.axis[e]=r({range:[0,100],bounce:[0,0],circular:[!1,!1]},t.options.axis[e]),["bounce","circular"].forEach(function(n){var i=t.options.axis,r=i[e][n];/string|number|boolean/.test(typeof r)&&(i[e][n]=[r,r])})})},Axes.prototype.connect=function(t,e){var n;n="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e);var i=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});return i.length&&(e.hammer=i[0].hammer),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.isOutside=function(t){return this._axm.isOutside(t)},Axes.prototype.destroy=function(){this.disconnect(),this._em.destroy()},Axes.PanInput=p.PanInput,Axes.PinchInput=l.PinchInput,Axes.TRANSFORM=f.TRANSFORM,Axes.DIRECTION_ALL=f.DIRECTION.DIRECTION_ALL,Axes.DIRECTION_DOWN=f.DIRECTION.DIRECTION_DOWN,Axes.DIRECTION_HORIZONTAL=f.DIRECTION.DIRECTION_HORIZONTAL,Axes.DIRECTION_LEFT=f.DIRECTION.DIRECTION_LEFT,Axes.DIRECTION_NONE=f.DIRECTION.DIRECTION_NONE,Axes.DIRECTION_RIGHT=f.DIRECTION.DIRECTION_RIGHT,Axes.DIRECTION_UP=f.DIRECTION.DIRECTION_UP,Axes.DIRECTION_VERTICAL=f.DIRECTION.DIRECTION_VERTICAL,Axes}(o);e["default"]=m},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__.i=function(t){return t},__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=1)}([function(t,e,n){"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!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 defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(t,e,n){return e&&defineProperties(t.prototype,e),n&&defineProperties(t,n),t}}();e.Component=function(){function Component(){_classCallCheck(this,Component),this._eventHandler={},this.options={}}return r(Component,[{key:"option",value:function(){if(arguments.length>=2){var t=arguments.length<=0?undefined:arguments[0],e=arguments.length<=1?undefined:arguments[1];return this.options[t]=e,this}var n=arguments.length<=0?undefined:arguments[0];if("string"==typeof n)return this.options[n];if(0===arguments.length)return this.options;var i=n;return this.options=i,this}},{key:"trigger",value: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=void 0;e.stop=function(){return i=!0};for(var s=arguments.length,a=Array(s>2?s-2:0),u=2;u<s;u++)a[u-2]=arguments[u];a.length>=1&&(r=r.concat(a));for(o in n)n[o].apply(this,r);return!i}},{key:"once",value: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}},{key:"hasOn",value:function(t){return!!this._eventHandler[t]}},{key:"on",value: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&&(o=this._eventHandler[t]=[]),o.push(e)}return this}},{key:"off",value: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;s=r[o];o++)if(s===e){r=r.splice(o,1);break}}return this}}]),Component}()},function(t,e,n){"use strict";var i=n(0);t.exports=i.Component}])})},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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(0),o=n(1),s=function(){function AnimationManager(t,e,n,i){this.options=t,this.itm=e,this.em=n,this.axm=i}return 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 this.options.maximumDuration>i?i:this.options.maximumDuration},AnimationManager.prototype.createAnimationParam=function(t,e,n){void 0===n&&(n=null);var i=this.axm.get(Object.keys(t)),o=this.axm.map(t,function(t,e,n){return r["default"].getInsidePosition(t,n.range,n.circular,n.bounce)}),s=this.axm.map(o,function(t,e){return t-i[e]}),a=this.options.maximumDuration;return{depaPos:i,destPos:o,duration:a>e?e:a,distance:s,inputEvent:n,done:this.animationEnd.bind(this)}},AnimationManager.prototype.grab=function(t){if(this._animateParam&&!t.length){var e=this.axm.get(t),n=this.axm.map(e,function(t,e,n){return r["default"].getCirculatedPos(t,n.range,n.circular)});this.axm.every(n,function(t,n){return e[n]===t})||this.em.triggerChange(this.axm.moveTo(n),!0),this._animateParam=null,this._raf&&window.cancelAnimationFrame(this._raf),this._raf=null,this.em.trigger("animationEnd")}},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,this.setTo(this.axm.map(this.axm.get(),function(t,e,n){return r["default"].getCirculatedPos(Math.round(t),n.range,n.circular)})),this.itm.setInterrupt(!1),this.em.trigger("animationEnd"),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 void e();r._raf=window.requestAnimationFrame(loop)}()}else this.em.triggerChange(this.axm.moveTo(t.destPos)),e()},AnimationManager.prototype.animateTo=function(t,e,n){var i=this;void 0===n&&(n=null);var s=(this.axm.get(),this.createAnimationParam(t,e,n)),a=this.em.trigger("animationStart",s);!a&&this.axm.every(s.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."),a&&!o.AxisManager.equal(s.destPos,s.depaPos)&&this.animateLoop(s,function(){return i.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(this.axm.moveTo(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(this.axm.moveTo(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=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function EventManager(t){this.axes=t}return EventManager.prototype.trigger=function(t,e){return this.axes.trigger(t,e)},EventManager.prototype.triggerChange=function(t,e){void 0===e&&(e=null),this.trigger("change",{pos:t,holding:null!==e,inputEvent:e})},EventManager.prototype.destroy=function(){this.axes.off()},EventManager}();e.EventManager=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!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";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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(1),o=n(0),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}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){if(!this.itm.isInterrupted()&&t.axes.length){this.itm.setInterrupt(!0),this.am.grab(t.axes);var n=this.axm.get();this.em.trigger("hold",{pos:n,inputEvent: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=this.axm.get(t.axes);this.moveDistance=this.axm.map(this.moveDistance,function(t,e){return t+(n[e]||0)});var r=this.axm.map(this.moveDistance,function(t,e,n){return o["default"].getCirculatedPos(t,n.range,n.circular)});this.isOutside&&this.axm.every(i,function(t,e,n){return!o["default"].isOutside(t,n.range)})&&(this.isOutside=!1),r=this.atOutside(r),this.em.triggerChange(this.axm.moveTo(r),e)}},InputObserver.prototype.release=function(t,e,n,s){if(this.itm.isInterrupting()){var a=this.axm.get(t.axes),u=this.axm.get(),c=this.axm.map(n,function(t,e,n){return o["default"].getInsidePosition(a[e]+t,n.range,n.circular,n.bounce)}),h={depaPos:u,destPos:i({},u,c),duration:this.am.getDuration(c,a,s),inputEvent:e};this.em.trigger("release",h),this.axm.isOutside()?this.am.restore(e):r.AxisManager.equal(h.destPos,h.depaPos)?this.itm.setInterrupt(!1):this.am.animateTo(h.destPos,h.duration),this.moveDistance=null}},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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(3),s=n(4),a=n(5),u=function(){function PanInput(t,e){if(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(){this.hammer&&(this.hammer.get("pan").options.enable=!0)},PanInput.prototype.disable=function(){this.hammer&&(this.hammer.get("pan").options.enable=!1)},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)},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).on("panend",this.onPanend)},PanInput.prototype.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove).off("panend",this.onPanend),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};Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=n(4),s=n(5),a=function(){function PinchInput(t,e){if(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(){this.hammer&&(this.hammer.get("pinch").options.enable=!0)},PinchInput.prototype.disable=function(){this.hammer&&(this.hammer.get("pinch").options.enable=!1)},PinchInput.prototype.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},PinchInput}();e.PinchInput=a}])}); | ||
!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}])}); |
@@ -5,3 +5,17 @@ declare module Component { | ||
function off(name: string, fn: (e) => void); | ||
function trigger(name: string, options: { [key: string]: any }): boolean; | ||
function off(); | ||
} | ||
declare interface AxisOption { | ||
range?: number[]; | ||
bounce?: number[]; | ||
circular?: boolean[]; | ||
} | ||
declare interface AxesOption { | ||
easing?: (x: number) => number; | ||
maximumDuration?: number; | ||
minimumDuration?: number; | ||
deceleration?: number; | ||
interruptable?: boolean; | ||
} |
{ | ||
"name": "@egjs/axes", | ||
"version": "2.0.0-rc.4", | ||
"description": "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.", | ||
"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", | ||
@@ -12,5 +12,5 @@ "scripts": { | ||
"lint": "tslint src", | ||
"jsdoc": "rm -rf ./doc && jsdoc -c jsdoc.json", | ||
"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 -s demo", | ||
"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", | ||
@@ -35,3 +35,3 @@ "demo:prebuild-version": "cpx 'dist/**/*' demo/release/$npm_package_version/dist --clean && cpx 'doc/**/*' demo/release/$npm_package_version/doc --clean", | ||
"dependencies": { | ||
"@egjs/component": "^2.0.0-rc.1", | ||
"@egjs/component": "^2.0.0", | ||
"hammerjs": "^2.0.8" | ||
@@ -41,20 +41,17 @@ }, | ||
"@egjs/common-demo": "github:naver/egjs#common-demo", | ||
"awesome-typescript-loader": "^3.2.1", | ||
"awesome-typescript-loader": "^3.2.2", | ||
"babel-core": "^6.25.0", | ||
"babel-loader": "^7.1.1", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0", | ||
"babel-plugin-transform-es3-property-literals": "^6.22.0", | ||
"babel-preset-es2015": "^6.24.1", | ||
"chai": "^4.1.0", | ||
"chai": "^4.1.1", | ||
"clean-webpack-plugin": "^0.1.16", | ||
"coveralls": "^2.13.1", | ||
"cpx": "^1.5.0", | ||
"egjs-jsdoc-template": "1.3.1", | ||
"egjs-jsdoc-template": "^1.3.3", | ||
"gh-pages": "^1.0.0", | ||
"hammer-simulator": "0.0.1", | ||
"husky": "^0.14.3", | ||
"inject-loader": "^3.0.0", | ||
"istanbul-instrumenter-loader": "^2.0.0", | ||
"jsdoc": "^3.5.3", | ||
"inject-loader": "^3.0.1", | ||
"istanbul-instrumenter-loader": "^3.0.0", | ||
"jsdoc": "^3.5.4", | ||
"karma": "^1.7.0", | ||
@@ -70,14 +67,12 @@ "karma-chai": "^0.1.0", | ||
"lite-fixture": "^1.0.2", | ||
"mocha": "^3.4.2", | ||
"sinon": "^2.3.8", | ||
"mocha": "^3.5.0", | ||
"sinon": "^3.0.0", | ||
"string-replace-webpack-plugin": "0.1.3", | ||
"ts-lint": "^4.5.1", | ||
"tslint": "^5.5.0", | ||
"tslint-eslint-rules": "^4.1.1", | ||
"tslint-loader": "^3.5.3", | ||
"typescript": "^2.4.1", | ||
"uglify-js": "^2.8.28", | ||
"typescript": "^2.4.2", | ||
"uglifyjs-webpack-plugin": "^0.4.6", | ||
"webpack": "^3.3.0", | ||
"webpack-dev-server": "^2.5.1", | ||
"webpack": "^3.4.1", | ||
"webpack-dev-server": "^2.6.1", | ||
"webpack-merge": "^4.1.0", | ||
@@ -84,0 +79,0 @@ "write-file-webpack-plugin": "^4.1.0" |
import Coordinate from "./Coordinate"; | ||
import { Axis, AxisManager } from "./AxisManager"; | ||
import { AxesOption } from "./AxesOption"; | ||
import { InterruptManager } from "./InterruptManager"; | ||
import { EventManager } from "./EventManager"; | ||
import {requestAnimationFrame, cancelAnimationFrame} from "./utils"; | ||
interface AnimationParam { | ||
export interface AnimationParam { | ||
depaPos: Axis; | ||
destPos: Axis; | ||
duration: number; | ||
distance: Axis; | ||
done: () => void; | ||
delta: Axis; | ||
setTo?: (destPos?: Axis, duration?: number) => { destPos: Axis, duration: number }; | ||
done?: () => void; | ||
startTime?: number; | ||
@@ -21,2 +22,6 @@ inputEvent?; | ||
static getDuration(duration: number, min: number, max: number): number { | ||
return Math.max(Math.min(duration, max), min); | ||
} | ||
constructor( | ||
@@ -28,2 +33,3 @@ private options: AxesOption, | ||
) { | ||
this.animationEnd = this.animationEnd.bind(this); | ||
} | ||
@@ -43,8 +49,11 @@ getDuration(depaPos: Axis, destPos: Axis, wishDuration?: number) { | ||
} | ||
return this.options.maximumDuration > duration ? duration : this.options.maximumDuration; | ||
return AnimationManager.getDuration( | ||
duration, | ||
this.options.minimumDuration, | ||
this.options.maximumDuration); | ||
} | ||
private createAnimationParam(pos: Axis, duration: number, inputEvent = null): AnimationParam { | ||
const depaPos: Axis = this.axm.get(Object.keys(pos)); | ||
const destPos: Axis = this.axm.map(pos, (v, k, opt) => { | ||
const depaPos: Axis = this.axm.get(); | ||
const destPos: Axis = this.axm.get(this.axm.map(pos, (v, k, opt) => { | ||
return Coordinate.getInsidePosition( | ||
@@ -56,17 +65,17 @@ v, | ||
); | ||
}); | ||
const distance: Axis = this.axm.map(destPos, (v, k) => v - depaPos[k]); | ||
const maximumDuration = this.options.maximumDuration; | ||
})); | ||
return { | ||
depaPos, | ||
destPos, | ||
duration: maximumDuration > duration ? duration : maximumDuration, | ||
distance, | ||
duration: AnimationManager.getDuration( | ||
duration, | ||
this.options.minimumDuration, | ||
this.options.maximumDuration), | ||
delta: this.axm.getDelta(depaPos, destPos), | ||
inputEvent, | ||
done: this.animationEnd.bind(this) | ||
done: this.animationEnd | ||
}; | ||
} | ||
grab(axes: string[]) { | ||
grab(axes: string[], event?) { | ||
if (this._animateParam && !axes.length) { | ||
@@ -77,8 +86,8 @@ const orgPos: Axis = this.axm.get(axes); | ||
if (!this.axm.every(pos, (v, k) => orgPos[k] === v)) { | ||
this.em.triggerChange(this.axm.moveTo(pos), true); | ||
this.em.triggerChange(pos, event); | ||
} | ||
this._animateParam = null; | ||
this._raf && window.cancelAnimationFrame(this._raf); | ||
this._raf && cancelAnimationFrame(this._raf); | ||
this._raf = null; | ||
this.em.trigger("animationEnd"); | ||
this.em.triggerAnimationEnd(); | ||
} | ||
@@ -98,14 +107,12 @@ } | ||
// for Circular | ||
this.setTo(this.axm.map( | ||
const circularTargets = this.axm.filter( | ||
this.axm.get(), | ||
(v, k, opt) => Coordinate.getCirculatedPos(Math.round(v), opt.range, opt.circular) | ||
(v, k, opt) => Coordinate.isCircularable(v, opt.range, opt.circular) | ||
); | ||
Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map( | ||
circularTargets, | ||
(v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular) | ||
)); | ||
this.itm.setInterrupt(false); | ||
/** | ||
* This event is fired when animation ends. | ||
* @ko 에니메이션이 끝났을 때 발생한다. | ||
* @name eg.Axes#animationEnd | ||
* @event | ||
*/ | ||
this.em.trigger("animationEnd"); | ||
this.em.triggerAnimationEnd(); | ||
this.axm.isOutside() && this.restore(); | ||
@@ -124,9 +131,12 @@ } | ||
if (self.frame(info) >= 1) { | ||
if (!AxisManager.equal(param.destPos, self.axm.get(Object.keys(param.destPos)))) { | ||
self.em.triggerChange(param.destPos); | ||
} | ||
complete(); | ||
return; | ||
} // animationEnd | ||
self._raf = window.requestAnimationFrame(loop); | ||
self._raf = requestAnimationFrame(loop); | ||
})(); | ||
} else { | ||
this.em.triggerChange(this.axm.moveTo(param.destPos)); | ||
this.em.triggerChange(param.destPos); | ||
complete(); | ||
@@ -136,10 +146,23 @@ } | ||
getUserControll(param: AnimationParam) { | ||
const userWish = param.setTo(); | ||
userWish.destPos = this.axm.get(userWish.destPos); | ||
userWish.duration = AnimationManager.getDuration( | ||
userWish.duration, | ||
this.options.minimumDuration, | ||
this.options.maximumDuration); | ||
return userWish; | ||
} | ||
animateTo(destPos: Axis, duration: number, inputEvent = null) { | ||
const depaPos = this.axm.get(); | ||
const param: AnimationParam = this.createAnimationParam(destPos, duration, inputEvent); | ||
const retTrigger = this.em.trigger("animationStart", param); | ||
const depaPos = { ...param.depaPos }; | ||
const retTrigger = this.em.triggerAnimationStart(param); | ||
// to control | ||
const userWish = this.getUserControll(param); | ||
// You can't stop the 'animationStart' event when 'circular' is true. | ||
if (!retTrigger && this.axm.every( | ||
param.destPos, | ||
userWish.destPos, | ||
(v, k, opt) => Coordinate.isCircularable(v, opt.range, opt.circular))) { | ||
@@ -149,5 +172,10 @@ console.warn("You can't stop the 'animation' event when 'circular' is true."); | ||
retTrigger && | ||
!AxisManager.equal(param.destPos, param.depaPos) && | ||
this.animateLoop(param, () => this.animationEnd()); | ||
if (retTrigger && !AxisManager.equal(userWish.destPos, depaPos)) { | ||
this.animateLoop({ | ||
depaPos, | ||
destPos: userWish.destPos, | ||
duration: userWish.duration, | ||
delta: this.axm.getDelta(depaPos, userWish.destPos), | ||
}, () => this.animationEnd()); | ||
} | ||
} | ||
@@ -164,3 +192,3 @@ | ||
}); | ||
this.em.triggerChange(this.axm.moveTo(toPos)); | ||
this.em.triggerChange(toPos); | ||
return easingPer; | ||
@@ -173,11 +201,2 @@ } | ||
/** | ||
* Moves an element to specific coordinates. | ||
* @ko 좌표를 이동한다. | ||
* @method eg.Axes#setTo | ||
* @param {Number} x The X coordinate to move to <ko>이동할 x좌표</ko> | ||
* @param {Number} y The Y coordinate to move to <ko>이동할 y좌표</ko> | ||
* @param {Number} [duration=0] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>자신의 인스턴스</ko> | ||
*/ | ||
setTo(pos: Axis, duration: number = 0) { | ||
@@ -205,3 +224,3 @@ const axes: string[] = Object.keys(pos); | ||
} else { | ||
this.em.triggerChange(this.axm.moveTo(movedPos)); | ||
this.em.triggerChange(movedPos); | ||
this.itm.setInterrupt(false); | ||
@@ -212,11 +231,2 @@ } | ||
/** | ||
* Moves an element from the current coordinates to specific coordinates. The change event is fired when the method is executed. | ||
* @ko 현재 좌표를 기준으로 좌표를 이동한다. 메서드가 실행되면 change 이벤트가 발생한다 | ||
* @method eg.Axes#setBy | ||
* @param {Number} x The X coordinate to move to <ko>이동할 x좌표</ko> | ||
* @param {Number} y The Y coordinate to move to <ko>이동할 y좌표</ko> | ||
* @param {Number} [duration=0] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>자신의 인스턴스</ko> | ||
*/ | ||
setBy(pos: Axis, duration = 0) { | ||
@@ -223,0 +233,0 @@ return this.setTo( |
340
src/Axes.ts
import * as Component from "@egjs/component"; | ||
import {AxesOption} from "./AxesOption"; | ||
import {AnimationManager} from "./AnimationManager"; | ||
@@ -10,2 +9,3 @@ import {EventManager} from "./EventManager"; | ||
import {PinchInput} from "./inputType/PinchInput"; | ||
import {WheelInput} from "./inputType/WheelInput"; | ||
import {TRANSFORM, DIRECTION} from "./const"; | ||
@@ -15,24 +15,159 @@ import {IInputType} from "./inputType/InputType"; | ||
/** | ||
* Copyright (c) NAVER Corp. | ||
* egjs-axes projects are licensed under the MIT license | ||
*/ | ||
* @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. | ||
* @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. | ||
* @property {Number[]} [range] The coordinate of range <ko>좌표 범위</ko> | ||
* @property {Number} [range.0=0] The coordinate of the minimum <ko>최소 좌표</ko> | ||
* @property {Number} [range.1=0] The coordinate of the maximum <ko>최대 좌표</ko> | ||
* @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area<ko>바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다</ko> | ||
* @property {Number} [bounce.0=0] The size of coordinate of the minimum area <ko>최소 좌표 바운스 영역의 크기</ko> | ||
* @property {Number} [bounce.1=0] The size of coordinate of the maximum area <ko>최대 좌표 바운스 영역의 크기</ko> | ||
* @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to "true" and an element is dragged outside the coordinate area, the element will appear on the other side.<ko>순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다</ko> | ||
* @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum <ko>최소 좌표 방향의 순환 여부</ko> | ||
* @property {Boolean} [circular.1=false] Indicates whether to circulate to the coordinate of the maximum <ko>최대 좌표 방향의 순환 여부</ko> | ||
**/ | ||
/** | ||
* 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. | ||
* @alias eg.Axes | ||
* @typedef {Object} AxesOption The option object of the eg.Axes module | ||
* @ko eg.Axes 모듈의 옵션 객체 | ||
* @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation <ko>애니메이션에 적용할 easing 함수</ko> | ||
* @property {Number} [maximumDuration=Infinity] Maximum duration of the animation <ko>가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간</ko> | ||
* @property {Number} [minimumDuration=0] Minimum duration of the animation <ko>가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간</ko> | ||
* @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. <ko>사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다</ko> | ||
* @property {Boolean} [interruptable=true] Indicates whether an animation is interruptible.<br>- true: It can be paused or stopped by user action or the API.<br>- false: It cannot be paused or stopped by user action or the API while it is running.<ko>진행 중인 애니메이션 중지 가능 여부.<br>- true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다.<br>- false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다</ko> | ||
**/ | ||
/** | ||
* @class eg.Axes | ||
* @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions. | ||
* @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다. | ||
* @extends eg.Component | ||
* | ||
* @param {Object.<string, AxisOption>} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. <ko>eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.</ko> | ||
* @param {AxesOption} [options] The option object of the eg.Axes module<ko>eg.Axes 모듈의 옵션 객체</ko> | ||
* @param {Object.<string, number>} startPos The coordinates to be moved when creating an instance<ko>인스턴스 생성시 이동할 좌표</ko> | ||
* | ||
* @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} | ||
* @example | ||
* | ||
* // 1. Initialize eg.Axes | ||
* const axes = new eg.Axes({ | ||
* something1: { | ||
* range: [0, 150], | ||
* bounce: 50 | ||
* }, | ||
* something2: { | ||
* range: [0, 200], | ||
* bounce: 100 | ||
* }, | ||
* somethingN: { | ||
* range: [1, 10], | ||
* } | ||
* }, { | ||
* deceleration : 0.0024 | ||
* }); | ||
* | ||
* // 2. attach event handler | ||
* axes.on({ | ||
* "hold" : function(evt) { | ||
* }, | ||
* "release" : function(evt) { | ||
* }, | ||
* "animationStart" : function(evt) { | ||
* }, | ||
* "animationEnd" : function(evt) { | ||
* }, | ||
* "change" : function(evt) { | ||
* } | ||
* }); | ||
* | ||
* // 3. Initialize inputTypes | ||
* const panInputArea = new eg.Axes.PanInput("#area", { | ||
* scale: [0.5, 1] | ||
* }); | ||
* const panInputHmove = new eg.Axes.PanInput("#hmove"); | ||
* const panInputVmove = new eg.Axes.PanInput("#vmove"); | ||
* const pinchInputArea = new eg.Axes.PinchInput("#area", { | ||
* scale: 1.5 | ||
* }); | ||
* | ||
* // 4. Connect eg.Axes and InputTypes | ||
* // [PanInput] When the mouse or touchscreen is down and moved. | ||
* // Connect the 'something2' axis to the mouse or touchscreen x position and | ||
* // connect the 'somethingN' axis to the mouse or touchscreen y position. | ||
* axes.connect(["something2", "somethingN"], panInputArea); // or axes.connect("something2 somethingN", panInputArea); | ||
* | ||
* // Connect only one 'something1' axis to the mouse or touchscreen x position. | ||
* axes.connect(["something1"], panInputHmove); // or axes.connect("something1", panInputHmove); | ||
* | ||
* // Connect only one 'something2' axis to the mouse or touchscreen y position. | ||
* axes.connect(["", "something2"], panInputVmove); // or axes.connect(" something2", panInputVmove); | ||
* | ||
* // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). | ||
* axes.connect("something2", pinchInputArea); | ||
*/ | ||
export default class Axes extends Component { | ||
static VERSION = "#__VERSION__#"; | ||
static PanInput = PanInput; | ||
static PinchInput = PinchInput; | ||
static WheelInput = WheelInput; | ||
/** | ||
* @name eg.Axes.TRANSFORM | ||
* @desc Returns the transform attribute with CSS vendor prefixes. | ||
* @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다. | ||
* | ||
* @constant | ||
* @type {String} | ||
* @example | ||
* eg.Axes.TRANSFORM; // "transform" or "webkitTransform" | ||
*/ | ||
static TRANSFORM = TRANSFORM; | ||
static DIRECTION_ALL = DIRECTION.DIRECTION_ALL; | ||
static DIRECTION_DOWN = DIRECTION.DIRECTION_DOWN; | ||
static DIRECTION_HORIZONTAL = DIRECTION.DIRECTION_HORIZONTAL; | ||
/** | ||
* @name eg.Axes.DIRECTION_NONE | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
static DIRECTION_NONE = DIRECTION.DIRECTION_NONE; | ||
/** | ||
* @name eg.Axes.DIRECTION_LEFT | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
static DIRECTION_LEFT = DIRECTION.DIRECTION_LEFT; | ||
static DIRECTION_NONE = DIRECTION.DIRECTION_NONE; | ||
/** | ||
* @name eg.Axes.DIRECTION_RIGHT | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
static DIRECTION_RIGHT = DIRECTION.DIRECTION_RIGHT; | ||
/** | ||
* @name eg.Axes.DIRECTION_UP | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
static DIRECTION_UP = DIRECTION.DIRECTION_UP; | ||
/** | ||
* @name eg.Axes.DIRECTION_DOWN | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
static DIRECTION_DOWN = DIRECTION.DIRECTION_DOWN; | ||
/** | ||
* @name eg.Axes.DIRECTION_HORIZONTAL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
static DIRECTION_HORIZONTAL = DIRECTION.DIRECTION_HORIZONTAL; | ||
/** | ||
* @name eg.Axes.DIRECTION_VERTICAL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
static DIRECTION_VERTICAL = DIRECTION.DIRECTION_VERTICAL; | ||
/** | ||
* @name eg.Axes.DIRECTION_ALL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
static DIRECTION_ALL = DIRECTION.DIRECTION_ALL; | ||
@@ -47,3 +182,3 @@ options: AxesOption; | ||
constructor(options: AxesOption) { | ||
constructor(public axis: { [key: string]: AxisOption } = {}, options: AxesOption, startPos?: Axis) { | ||
super(); | ||
@@ -56,12 +191,13 @@ this.options = { ...{ | ||
maximumDuration: Infinity, | ||
minimumDuration: 0, | ||
deceleration: 0.0006, | ||
axis: {}, | ||
}, ...options}; | ||
this._complementOptions(); | ||
this._em = new EventManager(this); | ||
this._axm = new AxisManager(this.options); | ||
this._axm = new AxisManager(this.axis, this.options); | ||
this._em = new EventManager(this, this._axm); | ||
this._itm = new InterruptManager(this.options); | ||
this._am = new AnimationManager(this.options, this._itm, this._em, this._axm); | ||
this._io = new InputObserver(this.options, this._itm, this._em, this._axm, this._am); | ||
startPos && setTimeout(() => this._em.triggerChange(startPos), 0); | ||
} | ||
@@ -74,11 +210,11 @@ | ||
private _complementOptions() { | ||
Object.keys(this.options.axis).forEach(axis => { | ||
this.options.axis[axis] = { ...{ | ||
Object.keys(this.axis).forEach(axis => { | ||
this.axis[axis] = { ...{ | ||
range: [0, 100], | ||
bounce: [0, 0], | ||
circular: [false, false] | ||
}, ...this.options.axis[axis]}; | ||
}, ...this.axis[axis]}; | ||
["bounce", "circular"].forEach(v => { | ||
const axisOption = this.options.axis; | ||
const axisOption = this.axis; | ||
const key = axisOption[axis][v]; | ||
@@ -93,2 +229,26 @@ | ||
/** | ||
* Connect the axis of eg.Axes to the inputType. | ||
* @ko eg.Axes의 축과 inputType을 연결한다 | ||
* @method eg.Axes#connect | ||
* @param {(String[]|String)} axes The name of the axis to associate with inputType <ko>inputType과 연결할 축의 이름</ko> | ||
* @param {Object} inputType The inputType instance to associate with the axis of eg.Axes <ko>eg.Axes의 축과 연결할 inputType 인스턴스<ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* } | ||
* }); | ||
* | ||
* axes.connect("x", new eg.Axes.PanInput("#area1")) | ||
* .connect("x xOther", new eg.Axes.PanInput("#area2")) | ||
* .connect(" xOther", new eg.Axes.PanInput("#area3")) | ||
* .connect(["x"], new eg.Axes.PanInput("#area4")) | ||
* .connect(["xOther", "x"], new eg.Axes.PanInput("#area5")) | ||
* .connect(["", "xOther"], new eg.Axes.PanInput("#area6")); | ||
*/ | ||
connect(axes: string[] | string, inputType: IInputType) { | ||
@@ -108,5 +268,7 @@ let mapped; | ||
// check same element in hammer type for share | ||
const targets = this._inputs.filter(v => v.hammer && v.element === inputType.element); | ||
if (targets.length) { | ||
inputType.hammer = targets[0].hammer; | ||
if ("hammer" in inputType) { | ||
const targets = this._inputs.filter(v => v.hammer && v.element === inputType.element); | ||
if (targets.length) { | ||
inputType.hammer = targets[0].hammer; | ||
} | ||
} | ||
@@ -118,3 +280,29 @@ inputType.mapAxes(mapped); | ||
} | ||
/** | ||
* Disconnect the axis of eg.Axes from the inputType. | ||
* @ko eg.Axes의 축과 inputType의 연결을 끊는다. | ||
* @method eg.Axes#disconnect | ||
* @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes <ko>eg.Axes의 축과 연결한 inputType 인스턴스<ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* } | ||
* }); | ||
* | ||
* const input1 = new eg.Axes.PanInput("#area1"); | ||
* const input2 = new eg.Axes.PanInput("#area2"); | ||
* const input3 = new eg.Axes.PanInput("#area3"); | ||
* | ||
* axes.connect("x", input1); | ||
* .connect("x xOther", input2) | ||
* .connect(["xOther", "x"], input3); | ||
* | ||
* axes.disconnect(input1); // disconnects input1 | ||
* axes.disconnect(); // disconnects all of them | ||
*/ | ||
disconnect(inputType?: IInputType) { | ||
@@ -132,2 +320,24 @@ if (inputType) { | ||
/** | ||
* Returns the current position of the coordinates. | ||
* @ko 좌표의 현재 위치를 반환한다 | ||
* @method eg.Axes#get | ||
* @param {Object} [axes] The names of the axis <ko>축 이름들</ko> | ||
* @return {Object.<string, number>} Axis coordinate information <ko>축 좌표 정보</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }); | ||
* | ||
* axes.get(); // {"x": 0, "xOther": -100, "zoom": 50} | ||
* axes.get(["x", "zoom"]); // {"x": 0, "zoom": 50} | ||
*/ | ||
get(axes?: string[]) { | ||
@@ -137,2 +347,30 @@ return this._axm.get(axes); | ||
/** | ||
* Moves an axis to specific coordinates. | ||
* @ko 좌표를 이동한다. | ||
* @method eg.Axes#setTo | ||
* @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko> | ||
* @param {Number} [duration=0] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }); | ||
* | ||
* axes.setTo({"x": 30, "zoom": 60}); | ||
* axes.get(); // {"x": 30, "xOther": -100, "zoom": 60} | ||
* | ||
* axes.setTo({"x": 100, "xOther": 60}, 1000); // animatation | ||
* | ||
* // after 1000 ms | ||
* axes.get(); // {"x": 100, "xOther": 60, "zoom": 60} | ||
*/ | ||
setTo(pos: Axis, duration = 0) { | ||
@@ -143,2 +381,30 @@ this._am.setTo(pos, duration); | ||
/** | ||
* Moves an axis from the current coordinates to specific coordinates. | ||
* @ko 현재 좌표를 기준으로 좌표를 이동한다. | ||
* @method eg.Axes#setBy | ||
* @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko> | ||
* @param {Number} [duration=0] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko> | ||
* @return {eg.Axes} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }); | ||
* | ||
* axes.setBy({"x": 30, "zoom": 10}); | ||
* axes.get(); // {"x": 30, "xOther": -100, "zoom": 60} | ||
* | ||
* axes.setBy({"x": 70, "xOther": 60}, 1000); // animatation | ||
* | ||
* // after 1000 ms | ||
* axes.get(); // {"x": 100, "xOther": -40, "zoom": 60} | ||
*/ | ||
setBy(pos: Axis, duration = 0) { | ||
@@ -149,6 +415,34 @@ this._am.setBy(pos, duration); | ||
isOutside(axes?: string[]) { | ||
/** | ||
* Returns whether there is a coordinate in the bounce area of the target axis. | ||
* @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다 | ||
* @method eg.Axes#isBounceArea | ||
* @param {Object} [axes] The names of the axis <ko>축 이름들</ko> | ||
* @return {Boolen} Whether the bounce area exists. <ko>bounce 영역 존재 여부</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "xOther": { | ||
* range: [-100, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }); | ||
* | ||
* axes.isBounceArea(["x"]); | ||
* axes.isBounceArea(["x", "zoom"]); | ||
* axes.isBounceArea(); | ||
*/ | ||
isBounceArea(axes?: string[]) { | ||
return this._axm.isOutside(axes); | ||
} | ||
/** | ||
* Destroys properties, and events used in a module and disconnect all connections to inputTypes. | ||
* @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다. | ||
* @method eg.Axes#destroy | ||
*/ | ||
destroy() { | ||
@@ -155,0 +449,0 @@ this.disconnect(); |
@@ -1,2 +0,1 @@ | ||
import { AxisOption, AxesOption } from "./AxesOption"; | ||
import Coordinate from "./Coordinate"; | ||
@@ -18,10 +17,14 @@ | ||
} | ||
constructor(private options: AxesOption) { | ||
this._pos = Object.keys(this.options.axis).reduce((acc, v) => { | ||
acc[v] = this.options.axis[v].range[0]; | ||
constructor(private axis, private options: AxesOption) { | ||
this._pos = Object.keys(this.axis).reduce((acc, v) => { | ||
acc[v] = this.axis[v].range[0]; | ||
return acc; | ||
}, {}); | ||
} | ||
get(axes?: string[]): Axis { | ||
if (axes) { | ||
getDelta(depaPos: Axis, destPos: Axis): Axis { | ||
const fullDepaPos = this.get(depaPos); | ||
return this.map(this.get(destPos), (v, k) => v - fullDepaPos[k]); | ||
} | ||
get(axes?: string[] | Axis): Axis { | ||
if (axes && Array.isArray(axes)) { | ||
return axes.reduce((acc, v) => { | ||
@@ -34,6 +37,17 @@ if (v && (v in this._pos)) { | ||
} else { | ||
return { ...this._pos }; | ||
return { ...this._pos, ...<Axis>(axes || {}) }; | ||
} | ||
} | ||
moveTo(pos: Axis): Axis { | ||
moveTo(pos: Axis): { [key: string]: Axis } { | ||
const delta = this.map(this._pos, (v, key) => { | ||
return pos[key] ? pos[key] - this._pos[key] : 0; | ||
}); | ||
this.set(pos); | ||
return { | ||
pos: { ...this._pos }, | ||
delta | ||
}; | ||
} | ||
set(pos: Axis) { | ||
for (const k in pos) { | ||
@@ -44,3 +58,2 @@ if (k && (k in this._pos)) { | ||
} | ||
return { ...this._pos }; | ||
} | ||
@@ -50,3 +63,3 @@ every( | ||
callback: (value: number, key: string, options: AxisOption) => boolean): boolean { | ||
const axisOptions = this.options.axis; | ||
const axisOptions = this.axis; | ||
for (const k in pos) { | ||
@@ -65,3 +78,3 @@ if (k) { | ||
const filtered: Axis = {}; | ||
const axisOptions = this.options.axis; | ||
const axisOptions = this.axis; | ||
for (const k in pos) { | ||
@@ -81,3 +94,3 @@ if (k) { | ||
const tranformed: Axis = {}; | ||
const axisOptions = this.options.axis; | ||
const axisOptions = this.axis; | ||
for (const k in pos) { | ||
@@ -84,0 +97,0 @@ if (k) { |
@@ -1,42 +0,1 @@ | ||
/** | ||
* @name eg.MovableCoord.DIRECTION_NONE | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
/** | ||
* @name eg.MovableCoord.DIRECTION_LEFT | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
/** | ||
* @name eg.MovableCoord.DIRECTION_RIGHT | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
/** | ||
* @name eg.MovableCoord.DIRECTION_UP | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
/** | ||
* @name eg.MovableCoord.DIRECTION_DOWN | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
/** | ||
* @name eg.MovableCoord.DIRECTION_HORIZONTAL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
/** | ||
* @name eg.MovableCoord.DIRECTION_VERTICAL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
/** | ||
* @name eg.MovableCoord.DIRECTION_ALL | ||
* @constant | ||
* @type {Number} | ||
*/ | ||
export enum DIRECTION { | ||
@@ -43,0 +2,0 @@ DIRECTION_NONE = 1, |
@@ -10,4 +10,4 @@ import {Axis} from "./AxisManager"; | ||
): number { | ||
let toDestPos = destPos; | ||
const targetRange = [ | ||
let toDestPos: number = destPos; | ||
const targetRange: number[] = [ | ||
circular[0] ? range[0] : (bounce ? range[0] - bounce[0] : range[0]), | ||
@@ -20,3 +20,3 @@ circular[1] ? range[1] : (bounce ? range[1] + bounce[1] : range[1]) | ||
return Math.min(targetRange[1], Math.max(targetRange[0], toDestPos)); | ||
return +Math.min(targetRange[1], Math.max(targetRange[0], toDestPos)).toFixed(5); | ||
}, | ||
@@ -23,0 +23,0 @@ |
import { Axis } from "./AxisManager"; | ||
import { AnimationParam } from "./AnimationManager"; | ||
export class EventManager { | ||
constructor(private axes) { | ||
constructor(private axes, private axm) { | ||
} | ||
/** | ||
* This event is fired when a user holds an element on the screen of the device. | ||
* @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 | ||
* @name eg.Axes#hold | ||
* @event | ||
* @param {Object} param The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @param {Object.<string, number>} param.pos coordinate <ko>좌표 정보</ko> | ||
* @param {Object} param.inputEvent The event object received from inputType <ko>inputType으로 부터 받은 이벤트 객체</ko> | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("hold", function(event) { | ||
* // event.pos | ||
* // event.inputEvent | ||
* }); | ||
*/ | ||
triggerHold(pos: Axis, event) { | ||
this.axes.trigger("hold", { | ||
pos, | ||
inputEvent: event, | ||
}); | ||
} | ||
} | ||
trigger(name, option?) { | ||
return this.axes.trigger(name, option); | ||
} | ||
/** Specifies the coordinates to move after the 'change' event. It works when the holding value of the change event is true. | ||
* @ko 'change' 이벤트 이후 이동할 좌표를 지정한다. change이벤트의 holding 값이 true일 경우에 동작한다 | ||
* @name set | ||
* @function | ||
* @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("change", function(event) { | ||
* event.holding && event.set({x: 10}); | ||
* }); | ||
*/ | ||
/** Specifies the animation coordinates to move after the 'release' or 'animationStart' events. | ||
* @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다. | ||
* @name setTo | ||
* @function | ||
* @param {Object.<string, number>} pos The coordinate to move to <ko>이동할 좌표</ko> | ||
* @param {Number} [duration] Duration of the animation (unit: ms) <ko>애니메이션 진행 시간(단위: ms)</ko> | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("animationStart", function(event) { | ||
* event.setTo({x: 10}, 2000); | ||
* }); | ||
*/ | ||
/** | ||
* This event is fired when a user release an element on the screen of the device. | ||
* @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 | ||
* @name eg.Axes#release | ||
* @event | ||
* | ||
* @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 releasing an element<ko>손을 뗐을 때의 좌표 </ko> | ||
* @param {Object.<string, number>} param.destPos The coordinates to move to after releasing an element<ko>손을 뗀 뒤에 이동할 좌표</ko> | ||
* @param {Object.<string, number>} param.delta The movement variation of coordinate <ko>좌표의 변화량</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 'release' event. | ||
* event.setTo({x: 10}, 2000); | ||
* }); | ||
*/ | ||
triggerRelease(param: AnimationParam, event = null) { | ||
param.setTo = this.createUserControll(param.destPos, param.duration); | ||
this.axes.trigger("release", param); | ||
} | ||
// trigger 'change' event | ||
/** | ||
* This event is fired when coordinate changes. | ||
* @ko 좌표가 변경됐을 때 발생하는 이벤트 | ||
* @name eg.Axes#change | ||
* @event | ||
* | ||
* @param {Object} param The object of data to be sent when the event is fired <ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @param {Object.<string, number>} param.pos The coordinate <ko>좌표</ko> | ||
* @param {Object.<string, number>} param.delta The movement variation of coordinate <ko>좌표의 변화량</ko> | ||
* @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 {set} param.set Specifies the coordinates to move after the event. It works when the holding value is true <ko>이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.</ko> | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("change", function(event) { | ||
* // event.pos | ||
* // event.delta | ||
* // event.inputEvent | ||
* // event.holding | ||
* // event.set | ||
* | ||
* // if you want to change the coordinates to move after the 'change' event. | ||
* // it works when the holding value of the change event is true. | ||
* event.holding && event.set({x: 10}); | ||
* }); | ||
*/ | ||
triggerChange(pos: Axis, event = null) { | ||
/** | ||
* This event is fired when coordinate changes. | ||
* @ko 좌표가 변경됐을 때 발생하는 이벤트 | ||
* @name eg.Axes#change | ||
* @event | ||
* | ||
* @param {Object} param The object of data to be sent when the event is fired <ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @param {Array} param.position departure coordinate <ko>좌표</ko> | ||
* @param {Number} param.position.0 The X coordinate <ko>x 좌표</ko> | ||
* @param {Number} param.pos.1 The Y coordinate <ko>y 좌표</ko> | ||
* @param {Boolean} param.holding Indicates whether a user holds an element on the screen of the device.<ko>사용자가 기기의 화면을 누르고 있는지 여부</ko> | ||
* @param {Object} param.hammerEvent The event information of Hammer.JS. It returns null if the event is fired through a call to the setTo() or setBy() method.<ko>Hammer.JS의 이벤트 정보. setTo() 메서드나 setBy() 메서드를 호출해 이벤트가 발생했을 때는 'null'을 반환한다.</ko> | ||
* | ||
*/ | ||
this.trigger("change", { | ||
pos, | ||
const moveTo = this.axm.moveTo(pos); | ||
const param = { | ||
pos: moveTo.pos, | ||
delta: moveTo.delta, | ||
holding: event !== null, | ||
inputEvent: event, | ||
}); | ||
set: event ? this.createUserControll(moveTo.pos) : () => {}, | ||
}; | ||
this.axes.trigger("change", param); | ||
event && this.axm.set(param.set()["destPos"]); | ||
} | ||
/** | ||
* 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); | ||
return this.axes.trigger("animationStart", param); | ||
} | ||
/** | ||
* This event is fired when animation ends. | ||
* @ko 에니메이션이 끝났을 때 발생한다. | ||
* @name eg.Axes#animationEnd | ||
* @event | ||
* | ||
* @example | ||
* const axes = new eg.Axes({ | ||
* "x": { | ||
* range: [0, 100] | ||
* }, | ||
* "zoom": { | ||
* range: [50, 30] | ||
* } | ||
* }).on("animationEnd", function() { | ||
* }); | ||
*/ | ||
triggerAnimationEnd() { | ||
this.axes.trigger("animationEnd"); | ||
} | ||
private createUserControll(pos: Axis, duration: number = 0) { | ||
// to controll | ||
const userControl = { | ||
destPos: {...pos}, | ||
duration : duration | ||
}; | ||
return function(toPos?: Axis, userDuration?: number): { destPos: Axis, duration: number } { | ||
toPos && (userControl.destPos = { ...toPos }); | ||
(userDuration !== undefined) && (userControl.duration = userDuration); | ||
return userControl; | ||
}; | ||
} | ||
destroy() { | ||
@@ -35,0 +228,0 @@ this.axes.off(); |
import Axes from "./Axes"; | ||
import { InterruptManager } from "./InterruptManager"; | ||
import { AxesOption } from "./AxesOption"; | ||
import { IInputType, IInputTypeObserver } from "./inputType/InputType"; | ||
import { EventManager } from "./EventManager"; | ||
import { AxisManager, Axis } from "./AxisManager"; | ||
import { AnimationManager } from "./AnimationManager"; | ||
import { AnimationParam, AnimationManager } from "./AnimationManager"; | ||
import Coordinate from "./Coordinate"; | ||
@@ -12,3 +11,3 @@ | ||
isOutside = false; | ||
moveDistance: Axis; | ||
moveDistance: Axis = null; | ||
constructor( | ||
@@ -54,20 +53,6 @@ public options: AxesOption, | ||
this.itm.setInterrupt(true); | ||
this.am.grab(inputType.axes); | ||
const pos = this.axm.get(); | ||
/** | ||
* This event is fired when a user holds an element on the screen of the device. | ||
* @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 | ||
* @event eg.Axes#hold | ||
* @param {Object} param The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @param {Array} param.pos coordinate <ko>좌표 정보</ko> | ||
* @param {Number} param.pos.0 The X coordinate<ko>x 좌표</ko> | ||
* @param {Number} param.pos.1 The Y coordinate<ko>y 좌표</ko> | ||
* @param {Object} param.hammerEvent The event information of Hammer.JS. It returns null if the event is fired through a call to the setTo() or setBy() method.<ko>Hammer.JS의 이벤트 정보. setTo() 메서드나 setBy() 메서드를 호출해 이벤트가 발생했을 때는 'null'을 반환한다.</ko> | ||
* | ||
*/ | ||
this.em.trigger("hold", { | ||
pos, | ||
inputEvent: event, | ||
}); | ||
this.am.grab(inputType.axes, event); | ||
if (!this.moveDistance) { | ||
this.em.triggerHold(this.axm.get(), event); | ||
} | ||
this.isOutside = this.axm.isOutside(inputType.axes); | ||
@@ -81,5 +66,8 @@ this.moveDistance = this.axm.get(inputType.axes); | ||
const depaPos: Axis = this.axm.get(inputType.axes); | ||
let destPos: Axis; | ||
// for outside logic | ||
this.moveDistance = this.axm.map(this.moveDistance, (v, k) => v + (offset[k] || 0)); | ||
let destPos: Axis = this.axm.map(this.moveDistance, (v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular)); | ||
destPos = this.axm.map(this.moveDistance || depaPos, (v, k) => v + (offset[k] || 0)); | ||
this.moveDistance && (this.moveDistance = destPos); | ||
destPos = this.axm.map(destPos, (v, k, opt) => Coordinate.getCirculatedPos(v, opt.range, opt.circular)); | ||
@@ -92,3 +80,4 @@ // from outside to inside | ||
destPos = this.atOutside(destPos); | ||
this.em.triggerChange(this.axm.moveTo(destPos), event); | ||
this.em.triggerChange(destPos, event); | ||
} | ||
@@ -99,5 +88,8 @@ release(inputType: IInputType, event, offset: Axis, inputDuration?: number) { | ||
} | ||
if (!this.moveDistance) { | ||
return; | ||
} | ||
const pos: Axis = this.axm.get(inputType.axes); | ||
const depaPos: Axis = this.axm.get(); | ||
const destPos: Axis = this.axm.map(offset, (v, k, opt) => { | ||
const destPos: Axis = this.axm.get(this.axm.map(offset, (v, k, opt) => { | ||
return Coordinate.getInsidePosition( | ||
@@ -109,37 +101,25 @@ pos[k] + v, | ||
); | ||
}); | ||
/** | ||
* This event is fired when a user release an element on the screen of the device. | ||
* @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 | ||
* @event eg.Axes#release | ||
* | ||
* @param {Object} param The object of data to be sent when the event is fired<ko>이벤트가 발생할 때 전달되는 데이터 객체</ko> | ||
* @param {Array} param.depaPos The coordinates when releasing an element<ko>손을 뗐을 때의 좌표현재 </ko> | ||
* @param {Number} param.depaPos.0 The X coordinate <ko> x 좌표</ko> | ||
* @param {Number} param.depaPos.1 The Y coordinate <ko> y 좌표</ko> | ||
* @param {Array} param.destPos The coordinates to move to after releasing an element<ko>손을 뗀 뒤에 이동할 좌표</ko> | ||
* @param {Number} param.destPos.0 The X coordinate <ko>x 좌표</ko> | ||
* @param {Number} param.destPos.1 The Y coordinate <ko>y 좌표</ko> | ||
* @param {Object} param.hammerEvent The event information of Hammer.JS. It returns null if the event is fired through a call to the setTo() or setBy() method.<ko>Hammer.JS의 이벤트 정보. setTo() 메서드나 setBy() 메서드를 호출해 이벤트가 발생했을 때는 'null'을 반환한다</ko> | ||
* | ||
*/ | ||
// prepare duration | ||
const param = { | ||
})); | ||
// prepare params | ||
const param: AnimationParam = { | ||
depaPos, | ||
destPos: { ...depaPos, ...destPos}, | ||
destPos, | ||
duration: this.am.getDuration(destPos, pos, inputDuration), | ||
inputEvent: event | ||
} | ||
this.em.trigger("release", param); | ||
if (this.axm.isOutside()) { | ||
this.am.restore(event); | ||
delta: this.axm.getDelta(depaPos, destPos), | ||
inputEvent: event, | ||
}; | ||
this.em.triggerRelease(param); | ||
this.moveDistance = null; | ||
// to contol | ||
const userWish = this.am.getUserControll(param); | ||
const isEqual = AxisManager.equal(userWish.destPos, depaPos); | ||
if (isEqual || userWish.duration === 0) { | ||
!isEqual && this.em.triggerChange(userWish.destPos, event); | ||
this.itm.setInterrupt(false); | ||
this.axm.isOutside() && this.am.restore(event); | ||
} else { | ||
if (AxisManager.equal(param.destPos, param.depaPos)) { | ||
this.itm.setInterrupt(false); | ||
} else { | ||
this.am.animateTo(param.destPos, param.duration); | ||
} | ||
this.am.animateTo(userWish.destPos, userWish.duration, event); | ||
} | ||
this.moveDistance = null; | ||
} | ||
}; |
import * as Hammer from "hammerjs"; | ||
import { AxesOption } from "../AxesOption"; | ||
import { Axis } from "../AxisManager"; | ||
@@ -4,0 +3,0 @@ |
@@ -15,7 +15,41 @@ import { InputObserver } from "./../InputObserver"; | ||
/** | ||
* @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module. | ||
* @ko eg.Axes.PanInput 모듈의 옵션 객체 | ||
* @property {String[]} [inputType=["touch","mouse"]] Types of input devices.<br>- touch: Touch screen<br>- mouse: Mouse <ko>입력 장치 종류.<br>- touch: 터치 입력 장치<br>- mouse: 마우스</ko> | ||
* @property {Number[]} [scale] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko> | ||
* @property {Number} [scale.0=1] horizontal axis scale <ko>수평축 배율</ko> | ||
* @property {Number} [scale.1=1] vertical axis scale <ko>수직축 배율</ko> | ||
* @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) <ko>사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)</ko> | ||
* @property {Number} [threshold=0] Minimal pan distance required before recognizing <ko>사용자의 Pan 동작을 인식하기 위해산 최소한의 거리</ko> | ||
**/ | ||
/** | ||
* @class eg.Axes.PanInput | ||
* @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes. | ||
* @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다. | ||
* | ||
* @example | ||
* const pan = new eg.Axes.PanInput("#area", { | ||
* inputType: ["touch"], | ||
* scale: [1, 1.3], | ||
* }); | ||
* | ||
* // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. | ||
* // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. | ||
* axes.connect(["something2", "somethingN"], pan); // or axes.connect("something2 somethingN", pan); | ||
* | ||
* // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. | ||
* axes.connect(["something1"], pan); // or axes.connect("something1", pan); | ||
* | ||
* // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. | ||
* axes.connect(["", "something2"], pan); // or axes.connect(" something2", pan); | ||
* | ||
* @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module <ko>eg.Axes.PanInput 모듈을 사용할 엘리먼트</ko> | ||
* @param {PanInputOption} [options] The option object of the eg.Axes.PanInput module<ko>eg.Axes.PanInput 모듈의 옵션 객체</ko> | ||
*/ | ||
export class PanInput implements IInputType { | ||
options: PanInputOption; | ||
axes: string[]; | ||
hammer; | ||
element: HTMLElement; | ||
axes: string[] = []; | ||
hammer = null; | ||
element: HTMLElement = null; | ||
private observer: IInputTypeObserver; | ||
@@ -136,2 +170,7 @@ private _direction: DIRECTION; | ||
/** | ||
* Destroys elements, properties, and events used in a module. | ||
* @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. | ||
* @method eg.Axes.PanInput#destroy | ||
*/ | ||
destroy() { | ||
@@ -147,8 +186,28 @@ this.disconnect(); | ||
/** | ||
* Enables input devices | ||
* @ko 입력 장치를 사용할 수 있게 한다 | ||
* @method eg.Axes.PanInput#enable | ||
* @return {eg.Axes.PanInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
enable() { | ||
this.hammer && (this.hammer.get("pan").options.enable = true); | ||
return this; | ||
} | ||
/** | ||
* Disables input devices | ||
* @ko 입력 장치를 사용할 수 없게 한다. | ||
* @method eg.Axes.PanInput#disable | ||
* @return {eg.Axes.PanInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
disable() { | ||
this.hammer && (this.hammer.get("pan").options.enable = false); | ||
return this; | ||
} | ||
/** | ||
* Returns whether to use an input device | ||
* @ko 입력 장치를 사용 여부를 반환한다. | ||
* @method eg.Axes.PanInput#isEnable | ||
* @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko> | ||
*/ | ||
isEnable() { | ||
@@ -159,4 +218,8 @@ return !!(this.hammer && this.hammer.get("pan").options.enable); | ||
private onHammerInput(event) { | ||
if (this.isEnable() && event.isFirst) { | ||
this.observer.hold(this, event); | ||
if (this.isEnable()) { | ||
if (event.isFirst) { | ||
this.observer.hold(this, event); | ||
} else if (event.isFinal) { | ||
this.onPanend(event); | ||
} | ||
} | ||
@@ -212,4 +275,3 @@ } | ||
this.hammer.on("hammer.input", this.onHammerInput) | ||
.on("panstart panmove", this.onPanmove) | ||
.on("panend", this.onPanend); | ||
.on("panstart panmove", this.onPanmove); | ||
} | ||
@@ -219,4 +281,3 @@ | ||
this.hammer.off("hammer.input", this.onHammerInput) | ||
.off("panstart panmove", this.onPanmove) | ||
.off("panend", this.onPanend); | ||
.off("panstart panmove", this.onPanmove); | ||
this.observer = null; | ||
@@ -223,0 +284,0 @@ } |
@@ -12,7 +12,30 @@ import { InputObserver } from "./../InputObserver"; | ||
/** | ||
* @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module | ||
* @ko eg.Axes.PinchInput 모듈의 옵션 객체 | ||
* @property {Number} [scale=1] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko> | ||
* @property {Number} [threshold=0] Minimal scale before recognizing <ko>사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율</ko> | ||
**/ | ||
/** | ||
* @class eg.Axes.PinchInput | ||
* @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis. | ||
* @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. | ||
* @example | ||
* const pinch = new eg.Axes.PinchInput("#area", { | ||
* scale: 1 | ||
* }); | ||
* | ||
* // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). | ||
* axes.connect("something", pinch); | ||
* | ||
* @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module <ko>eg.Axes.PinchInput 모듈을 사용할 엘리먼트</ko> | ||
* @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput module<ko>eg.Axes.PinchInput 모듈의 옵션 객체</ko> | ||
*/ | ||
export class PinchInput implements IInputType { | ||
options: PinchInputOption; | ||
axes: string[]; | ||
hammer; | ||
element; | ||
axes: string[] = []; | ||
hammer = null; | ||
element: HTMLElement = null; | ||
private observer: IInputTypeObserver; | ||
@@ -79,2 +102,7 @@ private _prev: number = null; | ||
/** | ||
* Destroys elements, properties, and events used in a module. | ||
* @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. | ||
* @method eg.Axes.PinchInput#destroy | ||
*/ | ||
destroy() { | ||
@@ -119,8 +147,28 @@ this.disconnect(); | ||
/** | ||
* Enables input devices | ||
* @ko 입력 장치를 사용할 수 있게 한다 | ||
* @method eg.Axes.PinchInput#enable | ||
* @return {eg.Axes.PinchInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
enable() { | ||
this.hammer && (this.hammer.get("pinch").options.enable = true); | ||
return this; | ||
} | ||
/** | ||
* Disables input devices | ||
* @ko 입력 장치를 사용할 수 없게 한다. | ||
* @method eg.Axes.PinchInput#disable | ||
* @return {eg.Axes.PinchInput} An instance of a module itself <ko>모듈 자신의 인스턴스</ko> | ||
*/ | ||
disable() { | ||
this.hammer && (this.hammer.get("pinch").options.enable = false); | ||
return this; | ||
} | ||
/** | ||
* Returns whether to use an input device | ||
* @ko 입력 장치를 사용 여부를 반환한다. | ||
* @method eg.Axes.PinchInput#isEnable | ||
* @return {Boolean} Whether to use an input device <ko>입력장치 사용여부</ko> | ||
*/ | ||
isEnable() { | ||
@@ -127,0 +175,0 @@ return !!(this.hammer && this.hammer.get("pinch").options.enable); |
@@ -1,2 +0,1 @@ | ||
import { AxesOption } from "./AxesOption"; | ||
export class InterruptManager { | ||
@@ -3,0 +2,0 @@ private _prevented = false; // check whether the animation event was prevented |
@@ -38,1 +38,47 @@ declare var jQuery: any; | ||
} | ||
let raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame; | ||
let caf = window.cancelAnimationFrame || window.webkitCancelAnimationFrame; | ||
if (raf && !caf) { | ||
const keyInfo = {}; | ||
const oldraf = raf; | ||
raf = function(callback) { | ||
function wrapCallback(timestamp) { | ||
if (keyInfo[key]) { | ||
callback(timestamp); | ||
} | ||
} | ||
const key = oldraf(wrapCallback); | ||
keyInfo[key] = true; | ||
return key; | ||
}; | ||
caf = function(key) { | ||
delete keyInfo[key]; | ||
}; | ||
} else if (!(raf && caf)) { | ||
raf = function(callback) { | ||
return window.setTimeout(function() { | ||
callback(window.performance && window.performance.now()); | ||
}, 16); | ||
}; | ||
caf = window.clearTimeout; | ||
} | ||
/** | ||
* A polyfill for the window.requestAnimationFrame() method. | ||
* @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame | ||
* @private | ||
*/ | ||
export function requestAnimationFrame(fp) { | ||
return raf(fp); | ||
}; | ||
/** | ||
* A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method. | ||
* @param {Number} key − The ID value returned through a call to the requestAnimationFrame() method. <ko>requestAnimationFrame() 메서드가 반환한 아이디 값</ko> | ||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame | ||
* @private | ||
*/ | ||
export function cancelAnimationFrame(key) { | ||
caf(key); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is 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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
408249
38
25
8517
2
Updated@egjs/component@^2.0.0