diff --git a/.gitignore b/.gitignore index 7af49ee7..386777c3 100644 --- a/.gitignore +++ b/.gitignore @@ -200,4 +200,4 @@ CHANGELOG.md build/ outjs/ declaration/ -dist/ + diff --git a/dist/axes.esm.js b/dist/axes.esm.js new file mode 100644 index 00000000..50bdb95e --- /dev/null +++ b/dist/axes.esm.js @@ -0,0 +1,3891 @@ +/* +Copyright (c) 2015 NAVER Corp. +name: @egjs/axes +license: MIT +author: NAVER Corp. +repository: https://github.com/naver/egjs-axes +version: 3.3.0 +*/ +import getAgent from '@egjs/agent'; +import Component, { ComponentEvent } from '@egjs/component'; + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/* global Reflect, Promise */ +var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || { + __proto__: [] + } instanceof Array && function (d, b) { + d.__proto__ = b; + } || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} +var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + + return t; + }; + + return __assign.apply(this, arguments); +}; + +/* eslint-disable no-new-func, no-nested-ternary */ +var win; + +if (typeof window === "undefined") { + // window is undefined in node.js + win = { + navigator: { + userAgent: "" + } + }; +} else { + win = window; +} + +var DIRECTION_NONE = 1; +var DIRECTION_LEFT = 2; +var DIRECTION_RIGHT = 4; +var DIRECTION_HORIZONTAL = 2 | 4; +var DIRECTION_UP = 8; +var DIRECTION_DOWN = 16; +var DIRECTION_VERTICAL = 8 | 16; +var DIRECTION_ALL = 2 | 4 | 8 | 16; +var MOUSE_LEFT = "left"; +var MOUSE_RIGHT = "right"; +var MOUSE_MIDDLE = "middle"; +var VELOCITY_INTERVAL = 16; +var IOS_EDGE_THRESHOLD = 30; +var IS_IOS_SAFARI = "ontouchstart" in win && getAgent().browser.name === "safari"; +var TRANSFORM = function () { + if (typeof document === "undefined") { + return ""; + } + + var bodyStyle = (document.head || document.getElementsByTagName("head")[0]).style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in bodyStyle) { + return target[i]; + } + } + + return ""; +}(); +var PREVENT_DRAG_CSSPROPS = { + "user-select": "none", + "-webkit-user-drag": "none" +}; + +var toArray = function (nodes) { + // const el = Array.prototype.slice.call(nodes); + // for IE8 + var el = []; + + for (var i = 0, len = nodes.length; i < len; i++) { + el.push(nodes[i]); + } + + return el; +}; +var $ = function (param, multi) { + if (multi === void 0) { + multi = false; + } + + var el; + + if (typeof param === "string") { + // String (HTML, Selector) + // check if string is HTML tag format + var match = param.match(/^<([a-z]+)\s*([^>]*)>/); // creating element + + if (match) { + // HTML + var dummy = document.createElement("div"); + dummy.innerHTML = param; + el = toArray(dummy.childNodes); + } else { + // Selector + el = toArray(document.querySelectorAll(param)); + } + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } else if (param === win) { + // window + el = param; + } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) { + // HTMLElement, Document + el = param; + } else if ("jQuery" in win && param instanceof jQuery || param.constructor.prototype.jquery) { + // jQuery + el = multi ? param.toArray() : param.get(0); + } else if (Array.isArray(param)) { + el = param.map(function (v) { + return $(v); + }); + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } + + return el; +}; +var raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame; +var caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame; + +if (raf && !caf) { + var keyInfo_1 = {}; + var oldraf_1 = raf; + + raf = function (callback) { + var wrapCallback = function (timestamp) { + if (keyInfo_1[key]) { + callback(timestamp); + } + }; + + var key = oldraf_1(wrapCallback); + keyInfo_1[key] = true; + return key; + }; + + caf = function (key) { + delete keyInfo_1[key]; + }; +} else if (!(raf && caf)) { + raf = function (callback) { + return win.setTimeout(function () { + callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime()); + }, 16); + }; + + caf = win.clearTimeout; +} +/** + * A polyfill for the window.requestAnimationFrame() method. + * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame + * @private + */ + + +var requestAnimationFrame = function (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. requestAnimationFrame() 메서드가 반환한 아이디 값 + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame + * @private + */ + +var cancelAnimationFrame = function (key) { + caf(key); +}; +var map = function (obj, callback) { + var tranformed = {}; + + for (var k in obj) { + if (k) { + tranformed[k] = callback(obj[k], k); + } + } + + return tranformed; +}; +var filter = function (obj, callback) { + var filtered = {}; + + for (var k in obj) { + if (k && callback(obj[k], k)) { + filtered[k] = obj[k]; + } + } + + return filtered; +}; +var every = function (obj, callback) { + for (var k in obj) { + if (k && !callback(obj[k], k)) { + return false; + } + } + + return true; +}; +var equal = function (target, base) { + return every(target, function (v, k) { + return v === base[k]; + }); +}; +var roundNumFunc = {}; +var roundNumber = function (num, roundUnit) { + // Cache for performance + if (!roundNumFunc[roundUnit]) { + roundNumFunc[roundUnit] = getRoundFunc(roundUnit); + } + + return roundNumFunc[roundUnit](num); +}; +var roundNumbers = function (num, roundUnit) { + if (!num || !roundUnit) { + return num; + } + + return map(num, function (value, key) { + return roundNumber(value, typeof roundUnit === "number" ? roundUnit : roundUnit[key]); + }); +}; +var getDecimalPlace = function (val) { + if (!isFinite(val)) { + return 0; + } + + var v = "" + val; + + if (v.indexOf("e") >= 0) { + // Exponential Format + // 1e-10, 1e-12 + var p = 0; + var e = 1; + + while (Math.round(val * e) / e !== val) { + e *= 10; + p++; + } + + return p; + } // In general, following has performance benefit. + // https://jsperf.com/precision-calculation + + + return v.indexOf(".") >= 0 ? v.length - v.indexOf(".") - 1 : 0; +}; +var inversePow = function (n) { + // replace Math.pow(10, -n) to solve floating point issue. + // eg. Math.pow(10, -4) => 0.00009999999999999999 + return 1 / Math.pow(10, n); +}; +var getRoundFunc = function (v) { + var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1; + return function (n) { + if (v === 0) { + return 0; + } + + return Math.round(Math.round(n / v) * v * p) / p; + }; +}; +var getAngle = function (posX, posY) { + return Math.atan2(posY, posX) * 180 / Math.PI; +}; +var isCssPropsFromAxes = function (originalCssProps) { + var same = true; + Object.keys(PREVENT_DRAG_CSSPROPS).forEach(function (prop) { + if (!originalCssProps || originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]) { + same = false; + } + }); + return same; +}; +var setCssProps = function (element, option, direction) { + var _a; + + var touchActionMap = (_a = {}, _a[DIRECTION_NONE] = "auto", _a[DIRECTION_ALL] = "none", _a[DIRECTION_VERTICAL] = "pan-x", _a[DIRECTION_HORIZONTAL] = "pan-y", _a); + var oldCssProps = {}; + + if (element && element.style) { + var touchAction = option.touchAction ? option.touchAction : touchActionMap[direction]; + + var newCssProps_1 = __assign(__assign({}, PREVENT_DRAG_CSSPROPS), { + "touch-action": element.style["touch-action"] === "none" ? "none" : touchAction + }); + + Object.keys(newCssProps_1).forEach(function (prop) { + oldCssProps[prop] = element.style[prop]; + element.style[prop] = newCssProps_1[prop]; + }); + } + + return oldCssProps; +}; +var revertCssProps = function (element, originalCssProps) { + if (element && element.style && originalCssProps) { + Object.keys(originalCssProps).forEach(function (prop) { + element.style[prop] = originalCssProps[prop]; + }); + } + + return; +}; + +var EventManager = +/*#__PURE__*/ +function () { + function EventManager(_axes) { + this._axes = _axes; + } + /** + * This event is fired when a user holds an element on the screen of the device. + * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 + * @event Axes#hold + * @type {object} + * @property {Object.} pos coordinate 좌표 정보 + * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스 + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("hold", function(event) { + * // event.pos + * // event.input + * // event.inputEvent + * // isTrusted + * }); + * ``` + */ + + + var __proto = EventManager.prototype; + + __proto.hold = function (pos, option) { + var roundPos = this._getRoundPos(pos).roundPos; + + this._axes.trigger(new ComponentEvent("hold", { + pos: roundPos, + input: option.input || null, + inputEvent: option.event || null, + isTrusted: true + })); + }; + /** + * 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일 경우에 동작한다 + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @example + * ```js + * 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' 이벤트 이후 이동할 좌표를 지정한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @example + * ```js + * 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 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 + * @event Axes#release + * @type {object} + * @property {Object.} depaPos The coordinates when releasing an element손을 뗐을 때의 좌표 + * @property {Object.} destPos The coordinates to move to after releasing an element손을 뗀 뒤에 이동할 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Object.} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value 손을 뗐을 때의 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치. + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스 + * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("release", function(event) { + * // event.depaPos + * // event.destPos + * // event.delta + * // event.input + * // event.inputEvent + * // event.setTo + * // event.isTrusted + * + * // if you want to change the animation coordinates to move after the 'release' event. + * event.setTo({x: 10}, 2000); + * }); + * ``` + */ + + + __proto.triggerRelease = function (param) { + var _a = this._getRoundPos(param.destPos, param.depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + param.destPos = roundPos; + param.depaPos = roundDepa; + param.setTo = this._createUserControll(param.destPos, param.duration); + + this._axes.trigger(new ComponentEvent("release", __assign(__assign({}, param), { + bounceRatio: this._getBounceRatio(roundPos) + }))); + }; + /** + * This event is fired when coordinate changes. + * @ko 좌표가 변경됐을 때 발생하는 이벤트 + * @event Axes#change + * @type {object} + * @property {Object.} pos The coordinate 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Object.} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value 현재 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치. + * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.사용자가 기기의 화면을 누르고 있는지 여부 + * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true 이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다. + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("change", function(event) { + * // event.pos + * // event.delta + * // event.input + * // event.inputEvent + * // event.holding + * // event.set + * // event.isTrusted + * + * // if you want to change the coordinates to move after the 'change' event. + * // it works when the holding value of the change event is true. + * event.holding && event.set({x: 10}); + * }); + * ``` + */ + + + __proto.triggerChange = function (pos, depaPos, option, holding) { + if (holding === void 0) { + holding = false; + } + + var animationManager = this.animationManager; + var axisManager = animationManager.axisManager; + var eventInfo = animationManager.getEventInfo(); + + var _a = this._getRoundPos(pos, depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + var moveTo = axisManager.moveTo(roundPos, roundDepa); + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || (eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.event) || null; + var param = { + pos: moveTo.pos, + delta: moveTo.delta, + bounceRatio: this._getBounceRatio(moveTo.pos), + holding: holding, + inputEvent: inputEvent, + isTrusted: !!inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || (eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.input) || null, + set: inputEvent ? this._createUserControll(moveTo.pos) : function () {} + }; + var event = new ComponentEvent("change", param); + + this._axes.trigger(event); + + if (inputEvent) { + axisManager.set(param.set().destPos); + } + + return !event.isCanceled(); + }; + /** + * This event is fired when animation starts. + * @ko 에니메이션이 시작할 때 발생한다. + * @event Axes#animationStart + * @type {object} + * @property {Object.} depaPos The coordinates when animation starts애니메이션이 시작 되었을 때의 좌표 + * @property {Object.} destPos The coordinates to move to. If you change this value, you can run the animation이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다. + * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("release", function(event) { + * // event.depaPos + * // event.destPos + * // event.delta + * // event.input + * // event.inputEvent + * // event.setTo + * // event.isTrusted + * + * // if you want to change the animation coordinates to move after the 'animationStart' event. + * event.setTo({x: 10}, 2000); + * }); + * ``` + */ + + + __proto.triggerAnimationStart = function (param) { + var _a = this._getRoundPos(param.destPos, param.depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + param.destPos = roundPos; + param.depaPos = roundDepa; + param.setTo = this._createUserControll(param.destPos, param.duration); + var event = new ComponentEvent("animationStart", param); + + this._axes.trigger(event); + + return !event.isCanceled(); + }; + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생한다. + * @event Axes#animationEnd + * @type {object} + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("animationEnd", function(event) { + * // event.isTrusted + * }); + * ``` + */ + + + __proto.triggerAnimationEnd = function (isTrusted) { + if (isTrusted === void 0) { + isTrusted = false; + } + + this._axes.trigger(new ComponentEvent("animationEnd", { + isTrusted: isTrusted + })); + }; + /** + * This event is fired when all actions have been completed. + * @ko 에니메이션이 끝났을 때 발생한다. + * @event Axes#finish + * @type {object} + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("finish", function(event) { + * // event.isTrusted + * }); + * ``` + */ + + + __proto.triggerFinish = function (isTrusted) { + if (isTrusted === void 0) { + isTrusted = false; + } + + this._axes.trigger(new ComponentEvent("finish", { + isTrusted: isTrusted + })); + }; + + __proto.setAnimationManager = function (animationManager) { + this.animationManager = animationManager; + }; + + __proto.destroy = function () { + this._axes.off(); + }; + + __proto._createUserControll = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } // to controll + + + var userControl = { + destPos: __assign({}, pos), + duration: duration + }; + return function (toPos, userDuration) { + if (toPos) { + userControl.destPos = __assign({}, toPos); + } + + if (userDuration !== undefined) { + userControl.duration = userDuration; + } + + return userControl; + }; + }; + + __proto._getRoundPos = function (pos, depaPos) { + // round value if round exist + var roundUnit = this._axes.options.round; // if (round == null) { + // return {pos, depaPos}; // undefined, undefined + // } + + return { + roundPos: roundNumbers(pos, roundUnit), + roundDepa: roundNumbers(depaPos, roundUnit) + }; + }; + + __proto._getBounceRatio = function (pos) { + return this._axes.axisManager.map(pos, function (v, opt) { + if (v < opt.range[0] && opt.bounce[0] !== 0) { + return (opt.range[0] - v) / opt.bounce[0]; + } else if (v > opt.range[1] && opt.bounce[1] !== 0) { + return (v - opt.range[1]) / opt.bounce[1]; + } else { + return 0; + } + }); + }; + + return EventManager; +}(); + +var InterruptManager = +/*#__PURE__*/ +function () { + function InterruptManager(_options) { + this._options = _options; + this._prevented = false; // check whether the animation event was prevented + } + + var __proto = InterruptManager.prototype; + + __proto.isInterrupting = function () { + // when interruptable is 'true', return value is always 'true'. + return this._options.interruptable || this._prevented; + }; + + __proto.isInterrupted = function () { + return !this._options.interruptable && this._prevented; + }; + + __proto.setInterrupt = function (prevented) { + if (!this._options.interruptable) { + this._prevented = prevented; + } + }; + + return InterruptManager; +}(); + +var getInsidePosition = function (destPos, range, circular, bounce) { + var toDestPos = destPos; + var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]]; + toDestPos = Math.max(targetRange[0], toDestPos); + toDestPos = Math.min(targetRange[1], toDestPos); + return toDestPos; +}; // determine outside + +var isOutside = function (pos, range) { + return pos < range[0] || pos > range[1]; +}; // determine whether position has reached the maximum moveable area + +var isEndofBounce = function (pos, range, bounce, circular) { + return !circular[0] && pos === range[0] - bounce[0] || !circular[1] && pos === range[1] + bounce[1]; +}; +var getDuration = function (distance, deceleration) { + var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero + + return duration < 100 ? 0 : duration; +}; +var isCircularable = function (destPos, range, circular) { + return circular[1] && destPos > range[1] || circular[0] && destPos < range[0]; +}; +var getCirculatedPos = function (pos, range, circular) { + var toPos = pos; + var min = range[0]; + var max = range[1]; + var length = max - min; + + if (circular[1] && pos > max) { + // right + toPos = (toPos - max) % length + min; + } + + if (circular[0] && pos < min) { + // left + toPos = (toPos - min) % length + max; + } + + return toPos; +}; + +var AxisManager = +/*#__PURE__*/ +function () { + function AxisManager(_axis) { + var _this = this; + + this._axis = _axis; + + this._complementOptions(); + + this._pos = Object.keys(this._axis).reduce(function (acc, v) { + acc[v] = _this._axis[v].range[0]; + return acc; + }, {}); + } + + var __proto = AxisManager.prototype; + + __proto.getDelta = function (depaPos, destPos) { + var fullDepaPos = this.get(depaPos); + return map(this.get(destPos), function (v, k) { + return v - fullDepaPos[k]; + }); + }; + + __proto.get = function (axes) { + var _this = this; + + if (axes && Array.isArray(axes)) { + return axes.reduce(function (acc, v) { + if (v && v in _this._pos) { + acc[v] = _this._pos[v]; + } + + return acc; + }, {}); + } else { + return __assign(__assign({}, this._pos), axes || {}); + } + }; + + __proto.moveTo = function (pos, depaPos) { + if (depaPos === void 0) { + depaPos = this._pos; + } + + var delta = map(this._pos, function (v, key) { + return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0; + }); + this.set(this.map(pos, function (v, opt) { + return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0; + })); + return { + pos: __assign({}, this._pos), + delta: delta + }; + }; + + __proto.set = function (pos) { + for (var k in pos) { + if (k && k in this._pos) { + this._pos[k] = pos[k]; + } + } + }; + + __proto.every = function (pos, callback) { + var axisOptions = this._axis; + return every(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.filter = function (pos, callback) { + var axisOptions = this._axis; + return filter(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.map = function (pos, callback) { + var axisOptions = this._axis; + return map(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.isOutside = function (axes) { + return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) { + return !isOutside(v, opt.range); + }); + }; + + __proto.getAxisOptions = function (key) { + return this._axis[key]; + }; + /** + * set up 'css' expression + * @private + */ + + + __proto._complementOptions = function () { + var _this = this; + + Object.keys(this._axis).forEach(function (axis) { + _this._axis[axis] = __assign({ + range: [0, 100], + bounce: [0, 0], + circular: [false, false] + }, _this._axis[axis]); + ["bounce", "circular"].forEach(function (v) { + var axisOption = _this._axis; + var key = axisOption[axis][v]; + + if (/string|number|boolean/.test(typeof key)) { + axisOption[axis][v] = [key, key]; + } + }); + }); + }; + + return AxisManager; +}(); + +var SUPPORT_TOUCH = ("ontouchstart" in win); +var SUPPORT_POINTER = ("PointerEvent" in win); +var SUPPORT_MSPOINTER = ("MSPointerEvent" in win); +var SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER; + +var EventInput = +/*#__PURE__*/ +function () { + function EventInput() { + var _this = this; + + this._stopContextMenu = function (event) { + event.preventDefault(); + win.removeEventListener("contextmenu", _this._stopContextMenu); + }; + } + + var __proto = EventInput.prototype; + + __proto.extendEvent = function (event) { + var _a; + + var prevEvent = this.prevEvent; + + var center = this._getCenter(event); + + var movement = prevEvent ? this._getMovement(event) : { + x: 0, + y: 0 + }; + var scale = prevEvent ? this._getScale(event) : 1; + var angle = prevEvent ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y) : 0; + var deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x; + var deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y; + var offsetX = movement.x; + var offsetY = movement.y; + var latestInterval = this._latestInterval; + var timeStamp = Date.now(); + var deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0; + var velocityX = prevEvent ? prevEvent.velocityX : 0; + var velocityY = prevEvent ? prevEvent.velocityY : 0; + + if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) { + if (latestInterval) { + _a = [(deltaX - latestInterval.deltaX) / deltaTime, (deltaY - latestInterval.deltaY) / deltaTime], velocityX = _a[0], velocityY = _a[1]; + } + + this._latestInterval = { + timestamp: timeStamp, + deltaX: deltaX, + deltaY: deltaY + }; + } + + return { + srcEvent: event, + scale: scale, + angle: angle, + center: center, + deltaX: deltaX, + deltaY: deltaY, + offsetX: offsetX, + offsetY: offsetY, + velocityX: velocityX, + velocityY: velocityY, + preventSystemEvent: true + }; + }; + + __proto._getDistance = function (start, end) { + var x = end.clientX - start.clientX; + var y = end.clientY - start.clientY; + return Math.sqrt(x * x + y * y); + }; + + __proto._getButton = function (event) { + var buttonCodeMap = { + 1: MOUSE_LEFT, + 2: MOUSE_RIGHT, + 4: MOUSE_MIDDLE + }; + var button = this._isTouchEvent(event) ? MOUSE_LEFT : buttonCodeMap[event.buttons]; + return button ? button : null; + }; + + __proto._isTouchEvent = function (event) { + return event.type.indexOf("touch") > -1; + }; + + __proto._isValidButton = function (button, inputButton) { + return inputButton.indexOf(button) > -1; + }; + + __proto._preventMouseButton = function (event, button) { + if (button === MOUSE_RIGHT) { + win.addEventListener("contextmenu", this._stopContextMenu); + } else if (button === MOUSE_MIDDLE) { + event.preventDefault(); + } + }; + + return EventInput; +}(); + +var MouseEventInput = +/*#__PURE__*/ +function (_super) { + __extends(MouseEventInput, _super); + + function MouseEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["mousedown"]; + _this.move = ["mousemove"]; + _this.end = ["mouseup"]; + return _this; + } + + var __proto = MouseEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function () { + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + return; + }; + + __proto.getTouches = function () { + return 0; + }; + + __proto._getScale = function () { + return 1; + }; + + __proto._getCenter = function (event) { + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + return { + x: event.clientX - prev.clientX, + y: event.clientY - prev.clientY + }; + }; + + return MouseEventInput; +}(EventInput); + +var TouchEventInput = +/*#__PURE__*/ +function (_super) { + __extends(TouchEventInput, _super); + + function TouchEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["touchstart"]; + _this.move = ["touchmove"]; + _this.end = ["touchend", "touchcancel"]; + return _this; + } + + var __proto = TouchEventInput.prototype; + + __proto.onEventStart = function (event) { + this._baseTouches = event.touches; + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event) { + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + this._baseTouches = event.touches; + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._baseTouches = null; + return; + }; + + __proto.getTouches = function (event) { + return event.touches.length; + }; + + __proto._getScale = function (event) { + if (event.touches.length !== 2 || this._baseTouches.length < 2) { + return null; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(event.touches[0], event.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]); + }; + + __proto._getCenter = function (event) { + return { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + + if (event.touches[0].identifier !== prev.touches[0].identifier) { + return { + x: 0, + y: 0 + }; + } + + return { + x: event.touches[0].clientX - prev.touches[0].clientX, + y: event.touches[0].clientY - prev.touches[0].clientY + }; + }; + + return TouchEventInput; +}(EventInput); + +var PointerEventInput = +/*#__PURE__*/ +function (_super) { + __extends(PointerEventInput, _super); + + function PointerEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = SUPPORT_POINTER ? ["pointerdown"] : ["MSPointerDown"]; + _this.move = SUPPORT_POINTER ? ["pointermove"] : ["MSPointerMove"]; + _this.end = SUPPORT_POINTER ? ["pointerup", "pointercancel"] : ["MSPointerUp", "MSPointerCancel"]; // store first, recent inputs for each event id + + _this._firstInputs = []; + _this._recentInputs = []; + return _this; + } + + var __proto = PointerEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + this._updatePointerEvent(event); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + this._updatePointerEvent(event); + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + this._removePointerEvent(event); + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._firstInputs = []; + this._recentInputs = []; + return; + }; + + __proto.getTouches = function () { + return this._recentInputs.length; + }; + + __proto._getScale = function () { + if (this._recentInputs.length !== 2) { + return null; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(this._recentInputs[0], this._recentInputs[1]) / this._getDistance(this._firstInputs[0], this._firstInputs[1]); + }; + + __proto._getCenter = function (event) { + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + + if (event.pointerId !== prev.pointerId) { + return { + x: 0, + y: 0 + }; + } + + return { + x: event.clientX - prev.clientX, + y: event.clientY - prev.clientY + }; + }; + + __proto._updatePointerEvent = function (event) { + var _this = this; + + var addFlag = false; + + this._recentInputs.forEach(function (e, i) { + if (e.pointerId === event.pointerId) { + addFlag = true; + _this._recentInputs[i] = event; + } + }); + + if (!addFlag) { + this._firstInputs.push(event); + + this._recentInputs.push(event); + } + }; + + __proto._removePointerEvent = function (event) { + this._firstInputs = this._firstInputs.filter(function (x) { + return x.pointerId !== event.pointerId; + }); + this._recentInputs = this._recentInputs.filter(function (x) { + return x.pointerId !== event.pointerId; + }); + }; + + return PointerEventInput; +}(EventInput); + +var TouchMouseEventInput = +/*#__PURE__*/ +function (_super) { + __extends(TouchMouseEventInput, _super); + + function TouchMouseEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["mousedown", "touchstart"]; + _this.move = ["mousemove", "touchmove"]; + _this.end = ["mouseup", "touchend", "touchcancel"]; + return _this; + } + + var __proto = TouchMouseEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (this._isTouchEvent(event)) { + this._baseTouches = event.touches; + } + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + if (this._isTouchEvent(event)) { + this._baseTouches = event.touches; + } + + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._baseTouches = null; + return; + }; + + __proto.getTouches = function (event) { + return this._isTouchEvent(event) ? event.touches.length : 0; + }; + + __proto._getScale = function (event) { + if (this._isTouchEvent(event)) { + if (event.touches.length !== 2 || this._baseTouches.length < 2) { + return 1; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(event.touches[0], event.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]); + } + + return this.prevEvent.scale; + }; + + __proto._getCenter = function (event) { + if (this._isTouchEvent(event)) { + return { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + } + + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var _this = this; + + var prev = this.prevEvent.srcEvent; + + var _a = [event, prev].map(function (e) { + if (_this._isTouchEvent(e)) { + return { + id: e.touches[0].identifier, + x: e.touches[0].clientX, + y: e.touches[0].clientY + }; + } + + return { + id: null, + x: e.clientX, + y: e.clientY + }; + }), + nextSpot = _a[0], + prevSpot = _a[1]; + + return nextSpot.id === prevSpot.id ? { + x: nextSpot.x - prevSpot.x, + y: nextSpot.y - prevSpot.y + } : { + x: 0, + y: 0 + }; + }; + + return TouchMouseEventInput; +}(EventInput); + +var toAxis = function (source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); +}; +var convertInputType = function (inputType) { + if (inputType === void 0) { + inputType = []; + } + + var hasTouch = false; + var hasMouse = false; + var hasPointer = false; + inputType.forEach(function (v) { + switch (v) { + case "mouse": + hasMouse = true; + break; + + case "touch": + hasTouch = SUPPORT_TOUCH; + break; + + case "pointer": + hasPointer = SUPPORT_POINTER_EVENTS; + // no default + } + }); + + if (hasPointer) { + return new PointerEventInput(); + } else if (hasTouch && hasMouse) { + return new TouchMouseEventInput(); + } else if (hasTouch) { + return new TouchEventInput(); + } else if (hasMouse) { + return new MouseEventInput(); + } + + return null; +}; + +var InputObserver = +/*#__PURE__*/ +function () { + function InputObserver(_a) { + var options = _a.options, + interruptManager = _a.interruptManager, + eventManager = _a.eventManager, + axisManager = _a.axisManager, + animationManager = _a.animationManager; + this._isOutside = false; + this._moveDistance = null; + this._isStopped = false; + this.options = options; + this._interruptManager = interruptManager; + this._eventManager = eventManager; + this._axisManager = axisManager; + this._animationManager = animationManager; + } + + var __proto = InputObserver.prototype; + + __proto.get = function (input) { + return this._axisManager.get(input.axes); + }; + + __proto.hold = function (input, event) { + if (this._interruptManager.isInterrupted() || !input.axes.length) { + return; + } + + var changeOption = { + input: input, + event: event + }; + this._isStopped = false; + + this._interruptManager.setInterrupt(true); + + this._animationManager.stopAnimation(changeOption); + + if (!this._moveDistance) { + this._eventManager.hold(this._axisManager.get(), changeOption); + } + + this._isOutside = this._axisManager.isOutside(input.axes); + this._moveDistance = this._axisManager.get(input.axes); + }; + + __proto.change = function (input, event, offset, useAnimation) { + if (this._isStopped || !this._interruptManager.isInterrupting() || this._axisManager.every(offset, function (v) { + return v === 0; + })) { + return; + } + + var nativeEvent = event.srcEvent ? event.srcEvent : event; + + if (nativeEvent.__childrenAxesAlreadyChanged) { + return; + } + + var depaPos = this._moveDistance || this._axisManager.get(input.axes); + + var destPos; // for outside logic + + destPos = map(depaPos, function (v, k) { + return v + (offset[k] || 0); + }); + + if (this._moveDistance) { + this._moveDistance = this._axisManager.map(destPos, function (v, _a) { + var circular = _a.circular, + range = _a.range; + return circular && (circular[0] || circular[1]) ? getCirculatedPos(v, range, circular) : v; + }); + } // from outside to inside + + + if (this._isOutside && this._axisManager.every(depaPos, function (v, opt) { + return !isOutside(v, opt.range); + })) { + this._isOutside = false; + } + + depaPos = this._atOutside(depaPos); + destPos = this._atOutside(destPos); + + if (!this.options.nested || !this._isEndofAxis(offset, depaPos, destPos)) { + nativeEvent.__childrenAxesAlreadyChanged = true; + } + + var changeOption = { + input: input, + event: event + }; + + if (useAnimation) { + var duration = this._animationManager.getDuration(destPos, depaPos); + + this._animationManager.animateTo(destPos, duration, changeOption); + } else { + var isCanceled = !this._eventManager.triggerChange(destPos, depaPos, changeOption, true); + + if (isCanceled) { + this._isStopped = true; + this._moveDistance = null; + + this._animationManager.finish(false); + } + } + }; + + __proto.release = function (input, event, velocity, inputDuration) { + if (this._isStopped || !this._interruptManager.isInterrupting() || !this._moveDistance) { + return; + } + + var nativeEvent = event.srcEvent ? event.srcEvent : event; + + if (nativeEvent.__childrenAxesAlreadyReleased) { + velocity = velocity.map(function () { + return 0; + }); + } + + var pos = this._axisManager.get(input.axes); + + var depaPos = this._axisManager.get(); + + var displacement = this._animationManager.getDisplacement(velocity); + + var offset = toAxis(input.axes, displacement); + + var destPos = this._axisManager.get(this._axisManager.map(offset, function (v, opt, k) { + if (opt.circular && (opt.circular[0] || opt.circular[1])) { + return pos[k] + v; + } else { + return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce); + } + })); + + nativeEvent.__childrenAxesAlreadyReleased = true; + + var duration = this._animationManager.getDuration(destPos, pos, inputDuration); + + if (duration === 0) { + destPos = __assign({}, depaPos); + } // prepare params + + + var param = { + depaPos: depaPos, + destPos: destPos, + duration: duration, + delta: this._axisManager.getDelta(depaPos, destPos), + inputEvent: event, + input: input, + isTrusted: true + }; + + this._eventManager.triggerRelease(param); + + this._moveDistance = null; // to contol + + var userWish = this._animationManager.getUserControl(param); + + var isEqual = equal(userWish.destPos, depaPos); + var changeOption = { + input: input, + event: event + }; + + if (isEqual || userWish.duration === 0) { + if (!isEqual) { + this._eventManager.triggerChange(userWish.destPos, depaPos, changeOption, true); + } + + this._interruptManager.setInterrupt(false); + + if (this._axisManager.isOutside()) { + this._animationManager.restore(changeOption); + } else { + this._eventManager.triggerFinish(true); + } + } else { + this._animationManager.animateTo(userWish.destPos, userWish.duration, changeOption); + } + }; // when move pointer is held in outside + + + __proto._atOutside = function (pos) { + var _this = this; + + if (this._isOutside) { + return this._axisManager.map(pos, function (v, opt) { + var tn = opt.range[0] - opt.bounce[0]; + var tx = opt.range[1] + opt.bounce[1]; + return v > tx ? tx : v < tn ? tn : v; + }); + } else { + return this._axisManager.map(pos, function (v, opt) { + var min = opt.range[0]; + var max = opt.range[1]; + var out = opt.bounce; + var circular = opt.circular; + + if (circular && (circular[0] || circular[1])) { + return v; + } else if (v < min) { + // left + return min - _this._animationManager.interpolate(min - v, out[0]); + } else if (v > max) { + // right + return max + _this._animationManager.interpolate(v - max, out[1]); + } + + return v; + }); + } + }; + + __proto._isEndofAxis = function (offset, depaPos, destPos) { + return this._axisManager.every(depaPos, function (value, option, key) { + return offset[key] === 0 || depaPos[key] === destPos[key] && isEndofBounce(value, option.range, option.bounce, option.circular); + }); + }; + + return InputObserver; +}(); + +var clamp = function (value, min, max) { + return Math.max(Math.min(value, max), min); +}; + +var AnimationManager = +/*#__PURE__*/ +function () { + function AnimationManager(_a) { + var options = _a.options, + interruptManager = _a.interruptManager, + eventManager = _a.eventManager, + axisManager = _a.axisManager; + this._options = options; + this.interruptManager = interruptManager; + this.eventManager = eventManager; + this.axisManager = axisManager; + this.animationEnd = this.animationEnd.bind(this); + } + + var __proto = AnimationManager.prototype; + + __proto.getDuration = function (depaPos, destPos, wishDuration) { + var _this = this; + + var duration; + + if (typeof wishDuration !== "undefined") { + duration = wishDuration; + } else { + var durations_1 = map(destPos, function (v, k) { + return getDuration(Math.abs(v - depaPos[k]), _this._options.deceleration); + }); + duration = Object.keys(durations_1).reduce(function (max, v) { + return Math.max(max, durations_1[v]); + }, -Infinity); + } + + return clamp(duration, this._options.minimumDuration, this._options.maximumDuration); + }; + + __proto.getDisplacement = function (velocity) { + var totalVelocity = Math.pow(velocity.reduce(function (total, v) { + return total + v * v; + }, 0), 1 / velocity.length); + var duration = Math.abs(totalVelocity / -this._options.deceleration); + return velocity.map(function (v) { + return v / 2 * duration; + }); + }; + + __proto.stopAnimation = function (option) { + if (this._animateParam) { + var orgPos_1 = this.axisManager.get(); + var pos = this.axisManager.map(orgPos_1, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + }); + + if (!every(pos, function (v, k) { + return orgPos_1[k] === v; + })) { + this.eventManager.triggerChange(pos, orgPos_1, option, !!option); + } + + this._animateParam = null; + + if (this._raf) { + cancelAnimationFrame(this._raf); + } + + this._raf = null; + this.eventManager.triggerAnimationEnd(!!(option === null || option === void 0 ? void 0 : option.event)); + } + }; + + __proto.getEventInfo = function () { + if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) { + return { + input: this._animateParam.input, + event: this._animateParam.inputEvent + }; + } else { + return null; + } + }; + + __proto.restore = function (option) { + var pos = this.axisManager.get(); + var destPos = this.axisManager.map(pos, function (v, opt) { + return Math.min(opt.range[1], Math.max(opt.range[0], v)); + }); + this.stopAnimation(); + this.animateTo(destPos, this.getDuration(pos, destPos), option); + }; + + __proto.animationEnd = function () { + var beforeParam = this.getEventInfo(); + this._animateParam = null; // for Circular + + var circularTargets = this.axisManager.filter(this.axisManager.get(), function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + }); + + if (Object.keys(circularTargets).length > 0) { + this.setTo(this.axisManager.map(circularTargets, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + })); + } + + this.interruptManager.setInterrupt(false); + this.eventManager.triggerAnimationEnd(!!beforeParam); + + if (this.axisManager.isOutside()) { + this.restore(beforeParam); + } else { + this.finish(!!beforeParam); + } + }; + + __proto.finish = function (isTrusted) { + this._animateParam = null; + this.interruptManager.setInterrupt(false); + this.eventManager.triggerFinish(isTrusted); + }; + + __proto.getUserControl = function (param) { + var userWish = param.setTo(); + userWish.destPos = this.axisManager.get(userWish.destPos); + userWish.duration = clamp(userWish.duration, this._options.minimumDuration, this._options.maximumDuration); + return userWish; + }; + + __proto.animateTo = function (destPos, duration, option) { + var _this = this; + + this.stopAnimation(); + + var param = this._createAnimationParam(destPos, duration, option); + + var depaPos = __assign({}, param.depaPos); + + var retTrigger = this.eventManager.triggerAnimationStart(param); // to control + + var userWish = this.getUserControl(param); // You can't stop the 'animationStart' event when 'circular' is true. + + if (!retTrigger && this.axisManager.every(userWish.destPos, function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + })) { + console.warn("You can't stop the 'animation' event when 'circular' is true."); + } + + if (retTrigger && !equal(userWish.destPos, depaPos)) { + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || null; + + this._animateLoop({ + depaPos: depaPos, + destPos: userWish.destPos, + duration: userWish.duration, + delta: this.axisManager.getDelta(depaPos, userWish.destPos), + isTrusted: !!inputEvent, + inputEvent: inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || null + }, function () { + return _this.animationEnd(); + }); + } + }; + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + var axes = Object.keys(pos); + var orgPos = this.axisManager.get(axes); + + if (equal(pos, orgPos)) { + return this; + } + + this.interruptManager.setInterrupt(true); + var movedPos = filter(pos, function (v, k) { + return orgPos[k] !== v; + }); + + if (!Object.keys(movedPos).length) { + return this; + } + + movedPos = this.axisManager.map(movedPos, function (v, opt) { + var range = opt.range, + circular = opt.circular; + + if (circular && (circular[0] || circular[1])) { + return v; + } else { + return getInsidePosition(v, range, circular); + } + }); + + if (equal(movedPos, orgPos)) { + return this; + } + + if (duration > 0) { + this.animateTo(movedPos, duration); + } else { + this.stopAnimation(); + this.eventManager.triggerChange(movedPos); + this.finish(false); + } + + return this; + }; + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + return this.setTo(map(this.axisManager.get(Object.keys(pos)), function (v, k) { + return v + pos[k]; + }), duration); + }; + + __proto._createAnimationParam = function (pos, duration, option) { + var depaPos = this.axisManager.get(); + var destPos = pos; + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || null; + return { + depaPos: depaPos, + destPos: destPos, + duration: clamp(duration, this._options.minimumDuration, this._options.maximumDuration), + delta: this.axisManager.getDelta(depaPos, destPos), + inputEvent: inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || null, + isTrusted: !!inputEvent, + done: this.animationEnd + }; + }; + + __proto._animateLoop = function (param, complete) { + var _this = this; + + if (param.duration) { + this._animateParam = __assign(__assign({}, param), { + startTime: new Date().getTime() + }); + var originalIntendedPos_1 = map(param.destPos, function (v) { + return v; + }); + + var state_1 = this._initState(this._animateParam); + + var loop_1 = function () { + _this._raf = null; + var animateParam = _this._animateParam; + + var nextState = _this._getNextState(state_1); + + var isCanceled = !_this.eventManager.triggerChange(nextState.pos, state_1.pos); + state_1 = nextState; + + if (nextState.finished) { + animateParam.destPos = _this._getFinalPos(animateParam.destPos, originalIntendedPos_1); + + if (!equal(animateParam.destPos, _this.axisManager.get(Object.keys(animateParam.destPos)))) { + _this.eventManager.triggerChange(animateParam.destPos, nextState.pos); + } + + complete(); + return; + } else if (isCanceled) { + _this.finish(false); + } else { + _this._raf = requestAnimationFrame(loop_1); + } + }; + + loop_1(); + } else { + this.eventManager.triggerChange(param.destPos); + complete(); + } + }; + /** + * Get estimated final value. + * + * If destPos is within the 'error range' of the original intended position, the initial intended position is returned. + * - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100; + * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos. + * - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123 + * @param originalIntendedPos + * @param destPos + */ + + + __proto._getFinalPos = function (destPos, originalIntendedPos) { + var _this = this; // compare destPos and originalIntendedPos + // eslint-disable-next-line @typescript-eslint/naming-convention + + + var ERROR_LIMIT = 0.000001; + var finalPos = map(destPos, function (value, key) { + if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) { + // In error range, return original intended + return originalIntendedPos[key]; + } else { + // Out of error range, return rounded pos. + var roundUnit = _this._getRoundUnit(value, key); + + var result = roundNumber(value, roundUnit); + return result; + } + }); + return finalPos; + }; + + __proto._getRoundUnit = function (val, key) { + var roundUnit = this._options.round; // manual mode + + var minRoundUnit = null; // auto mode + // auto mode + + if (!roundUnit) { + // Get minimum round unit + var options = this.axisManager.getAxisOptions(key); + minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val))); + } + + return minRoundUnit || roundUnit; + }; + + return AnimationManager; +}(); + +var EasingManager = +/*#__PURE__*/ +function (_super) { + __extends(EasingManager, _super); + + function EasingManager() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this._useDuration = true; + return _this; + } + + var __proto = EasingManager.prototype; + + __proto.interpolate = function (displacement, threshold) { + var initSlope = this._easing(0.00001) / 0.00001; + return this._easing(displacement / (threshold * initSlope)) * threshold; + }; + + __proto.updateAnimation = function (options) { + var animateParam = this._animateParam; + + if (!animateParam) { + return; + } + + var diffTime = new Date().getTime() - animateParam.startTime; + var pos = (options === null || options === void 0 ? void 0 : options.destPos) || animateParam.destPos; + var duration = (options === null || options === void 0 ? void 0 : options.duration) || animateParam.duration; + + if ((options === null || options === void 0 ? void 0 : options.restart) || duration <= diffTime) { + this.setTo(pos, duration - diffTime); + return; + } + + if (options === null || options === void 0 ? void 0 : options.destPos) { + var currentPos = this.axisManager.get(); // When destination is changed, new delta should be calculated as remaining percent. + // For example, moving x:0, y:0 to x:200, y:200 and it has current easing percent of 92%. coordinate is x:184 and y:184 + // If destination changes to x:300, y:300. xdelta:200, ydelta:200 changes to xdelta:116, ydelta:116 and use remaining easingPer as 100%, not 8% as previous. + // Therefore, original easingPer by time is kept. And divided by (1 - self._initialEasingPer) which means new total easing percent. Like calculating 8% as 100%. + + this._initialEasingPer = this._prevEasingPer; + animateParam.delta = this.axisManager.getDelta(currentPos, pos); + animateParam.destPos = pos; + } + + if (options === null || options === void 0 ? void 0 : options.duration) { + var ratio = (diffTime + this._durationOffset) / animateParam.duration; // Use durationOffset for keeping animation ratio after duration is changed. + // newRatio = (diffTime + newDurationOffset) / newDuration = oldRatio + // newDurationOffset = oldRatio * newDuration - diffTime + + this._durationOffset = ratio * duration - diffTime; + animateParam.duration = duration; + } + }; + + __proto._initState = function (info) { + this._initialEasingPer = 0; + this._prevEasingPer = 0; + this._durationOffset = 0; + return { + pos: info.depaPos, + easingPer: 0, + finished: false + }; + }; + + __proto._getNextState = function (prevState) { + var _this = this; + + var animateParam = this._animateParam; + var prevPos = prevState.pos; + var destPos = animateParam.destPos; + var directions = map(prevPos, function (value, key) { + return value <= destPos[key] ? 1 : -1; + }); + var diffTime = new Date().getTime() - animateParam.startTime; + var ratio = (diffTime + this._durationOffset) / animateParam.duration; + + var easingPer = this._easing(ratio); + + var toPos = this.axisManager.map(prevPos, function (pos, options, key) { + var nextPos = ratio >= 1 ? destPos[key] : pos + animateParam.delta[key] * (easingPer - _this._prevEasingPer) / (1 - _this._initialEasingPer); // Subtract distance from distance already moved. + // Recalculate the remaining distance. + // Fix the bouncing phenomenon by changing the range. + + var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular); + + if (nextPos !== circulatedPos) { + // circular + var rangeOffset = directions[key] * (options.range[1] - options.range[0]); + destPos[key] -= rangeOffset; + prevPos[key] -= rangeOffset; + } + + return circulatedPos; + }); + this._prevEasingPer = easingPer; + return { + pos: toPos, + easingPer: easingPer, + finished: easingPer >= 1 + }; + }; + + __proto._easing = function (p) { + return p > 1 ? 1 : this._options.easing(p); + }; + + return EasingManager; +}(AnimationManager); + +/** + * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. + * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @param {Number[]} [range] The coordinate of range 좌표 범위 + * @param {Number} [range[0]=0] The coordinate of the minimum 최소 좌표 + * @param {Number} [range[1]=0] The coordinate of the maximum 최대 좌표 + * @param {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바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다 + * @param {Number} [bounce[0]=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기 + * @param {Number} [bounce[1]=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기 + * @param {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.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다 + * @param {Boolean} [circular[0]=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부 + * @param {Boolean} [circular[1]=false] Indicates whether to circulate to the coordinate of the maximum 최대 좌표 방향의 순환 여부 + **/ + +/** + * @typedef {Object} AxesOption The option object of the eg.Axes module + * @ko eg.Axes 모듈의 옵션 객체 + * @param {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수 + * @param {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간 + * @param {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간 + * @param {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다 + * @param {Boolean} [interruptable=true] Indicates whether an animation is interruptible. + * - true: It can be paused or stopped by user action or the API. + * - false: It cannot be paused or stopped by user action or the API while it is running. + * 진행 중인 애니메이션 중지 가능 여부. + * - true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다. + * - false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다 + * @param {Number} [round=null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95) + * [Details](https://github.com/naver/egjs-axes/wiki/round-option)반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95). + * [상세내용](https://github.com/naver/egjs-axes/wiki/round-option) + * @param {Boolean} [nested=false] Whether the event propagates to other instances when the coordinates reach the end of the movable area 좌표가 이동 가능한 영역의 끝까지 도달했을 때 다른 인스턴스들로의 이벤트 전파 여부 + **/ + +/** + * 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.} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @param {AxesOption} [options={}] The option object of the eg.Axes moduleeg.Axes 모듈의 옵션 객체 + * @param {Object.} [startPos=null] The coordinates to be moved when creating an instance. not triggering change event.인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음. + * + * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * ```js + * // 1. Initialize eg.Axes + * const axes = new eg.Axes({ + * something1: { + * range: [0, 150], + * bounce: 50 + * }, + * something2: { + * range: [0, 200], + * bounce: 100 + * }, + * somethingN: { + * range: [1, 10], + * } + * }, { + * deceleration : 0.0024 + * }); + * + * // 2. attach event handler + * axes.on({ + * "hold" : function(evt) { + * }, + * "release" : function(evt) { + * }, + * "animationStart" : function(evt) { + * }, + * "animationEnd" : function(evt) { + * }, + * "change" : function(evt) { + * } + * }); + * + * // 3. Initialize inputTypes + * const panInputArea = new eg.Axes.PanInput("#area", { + * scale: [0.5, 1] + * }); + * const panInputHmove = new eg.Axes.PanInput("#hmove"); + * const panInputVmove = new eg.Axes.PanInput("#vmove"); + * const pinchInputArea = new eg.Axes.PinchInput("#area", { + * scale: 1.5 + * }); + * + * // 4. Connect eg.Axes and InputTypes + * // [PanInput] When the mouse or touchscreen is down and moved. + * // Connect the 'something2' axis to the mouse or touchscreen x position and + * // connect the 'somethingN' axis to the mouse or touchscreen y position. + * axes.connect(["something2", "somethingN"], panInputArea); // or axes.connect("something2 somethingN", panInputArea); + * + * // Connect only one 'something1' axis to the mouse or touchscreen x position. + * axes.connect(["something1"], panInputHmove); // or axes.connect("something1", panInputHmove); + * + * // Connect only one 'something2' axis to the mouse or touchscreen y position. + * axes.connect(["", "something2"], panInputVmove); // or axes.connect(" something2", panInputVmove); + * + * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). + * axes.connect("something2", pinchInputArea); + * ``` + */ + +var Axes = +/*#__PURE__*/ +function (_super) { + __extends(Axes, _super); + /** + * + */ + + + function Axes(axis, options, startPos) { + if (axis === void 0) { + axis = {}; + } + + if (options === void 0) { + options = {}; + } + + if (startPos === void 0) { + startPos = null; + } + + var _this = _super.call(this) || this; + + _this.axis = axis; + _this._inputs = []; + _this.options = __assign({ + easing: function (x) { + return 1 - Math.pow(1 - x, 3); + }, + interruptable: true, + maximumDuration: Infinity, + minimumDuration: 0, + deceleration: 0.0006, + round: null, + nested: false + }, options); + _this.interruptManager = new InterruptManager(_this.options); + _this.axisManager = new AxisManager(_this.axis); + _this.eventManager = new EventManager(_this); + _this.animationManager = new EasingManager(_this); + _this.inputObserver = new InputObserver(_this); + + _this.eventManager.setAnimationManager(_this.animationManager); + + if (startPos) { + _this.eventManager.triggerChange(startPos); + } + + return _this; + } + /** + * Connect the axis of eg.Axes to the inputType. + * @ko eg.Axes의 축과 inputType을 연결한다 + * @param {(String[]|String)} axes The name of the axis to associate with inputType inputType과 연결할 축의 이름 + * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes eg.Axes의 축과 연결할 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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")); + * ``` + */ + + + var __proto = Axes.prototype; + + __proto.connect = function (axes, inputType) { + var mapped; + + if (typeof axes === "string") { + mapped = axes.split(" "); + } else { + mapped = axes.concat(); + } // check same instance + + + if (~this._inputs.indexOf(inputType)) { + this.disconnect(inputType); + } + + inputType.mapAxes(mapped); + inputType.connect(this.inputObserver); + + this._inputs.push(inputType); + + return this; + }; + /** + * Disconnect the axis of eg.Axes from the inputType. + * @ko eg.Axes의 축과 inputType의 연결을 끊는다. + * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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 + * ``` + */ + + + __proto.disconnect = function (inputType) { + if (inputType) { + var index = this._inputs.indexOf(inputType); + + if (index >= 0) { + this._inputs[index].disconnect(); + + this._inputs.splice(index, 1); + } + } else { + this._inputs.forEach(function (v) { + return v.disconnect(); + }); + + this._inputs = []; + } + + return this; + }; + /** + * Returns the current position of the coordinates. + * @ko 좌표의 현재 위치를 반환한다 + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Object.} Axis coordinate information 축 좌표 정보 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.get = function (axes) { + return this.axisManager.get(axes); + }; + /** + * Moves an axis to specific coordinates. + * @ko 좌표를 이동한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + this.animationManager.setTo(pos, duration); + return this; + }; + /** + * Moves an axis from the current coordinates to specific coordinates. + * @ko 현재 좌표를 기준으로 좌표를 이동한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + this.animationManager.setBy(pos, duration); + return this; + }; + /** + * Stop an animation in progress. + * @ko 재생 중인 애니메이션을 정지한다. + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * }); + * + * axes.setTo({"x": 10}, 1000); // start animatation + * + * // after 500 ms + * axes.stopAnimation(); // stop animation during movement. + * ``` + */ + + + __proto.stopAnimation = function () { + this.animationManager.stopAnimation(); + return this; + }; + /** + * Change the destination of an animation in progress. + * @ko 재생 중인 애니메이션의 목적지와 진행 시간을 변경한다. + * @param {UpdateAnimationOption} pos The coordinate to move to 이동할 좌표 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 200] + * }, + * "y": { + * range: [0, 200] + * } + * }); + * + * axes.setTo({"x": 50, "y": 50}, 1000); // trigger animation by setTo + * + * // after 500 ms + * axes.updateAnimation({destPos: {"x": 100, "y": 100}}); // animation will end after 500 ms, at {"x": 100, "y": 100} + * + * // after 500 ms + * axes.setTo({"x": 50, "y": 50}, 1000); // trigger animation by setTo + * + * // after 700 ms + * axes.updateAnimation({destPos: {"x": 100, "y": 100}, duration: 1500, restart: true}); // this works same as axes.setTo({"x": 100, "y": 100}, 800) since restart is true. + * ``` + */ + + + __proto.updateAnimation = function (options) { + this.animationManager.updateAnimation(options); + return this; + }; + /** + * Returns whether there is a coordinate in the bounce area of ​​the target axis. + * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다 + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부 + * @example + * ```js + * 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(); + * ``` + */ + + + __proto.isBounceArea = function (axes) { + return this.axisManager.isOutside(axes); + }; + /** + * Destroys properties, and events used in a module and disconnect all connections to inputTypes. + * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.eventManager.destroy(); + }; + /** + * @name VERSION + * @desc Version info string + * @ko 버전정보 문자열 + * + * @constant + * @type {String} + * @example + * ```js + * eg.Axes.VERSION; // ex) 3.3.3 + * ``` + */ + + + Axes.VERSION = "3.3.0"; + /* eslint-enable */ + + /** + * @name TRANSFORM + * @desc Returns the transform attribute with CSS vendor prefixes. + * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다. + * + * @constant + * @type {String} + * @example + * ```js + * eg.Axes.TRANSFORM; // "transform" or "webkitTransform" + * ``` + */ + + Axes.TRANSFORM = TRANSFORM; + /** + * @name DIRECTION_NONE + * @constant + * @type {Number} + */ + + Axes.DIRECTION_NONE = DIRECTION_NONE; + /** + * @name DIRECTION_LEFT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_LEFT = DIRECTION_LEFT; + /** + * @name DIRECTION_RIGHT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_RIGHT = DIRECTION_RIGHT; + /** + * @name DIRECTION_UP + * @constant + * @type {Number} + */ + + Axes.DIRECTION_UP = DIRECTION_UP; + /** + * @name DIRECTION_DOWN + * @constant + * @type {Number} + */ + + Axes.DIRECTION_DOWN = DIRECTION_DOWN; + /** + * @name DIRECTION_HORIZONTAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + /** + * @name DIRECTION_VERTICAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + /** + * @name DIRECTION_ALL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_ALL = DIRECTION_ALL; + return Axes; +}(Component); + +/* eslint-disable @typescript-eslint/no-empty-function */ + +var getDirectionByAngle = function (angle, thresholdAngle) { + if (thresholdAngle < 0 || thresholdAngle > 90) { + return DIRECTION_NONE; + } + + var toAngle = Math.abs(angle); + return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL; +}; +var useDirection = function (checkType, direction, userDirection) { + if (userDirection) { + return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType); + } else { + return !!(direction & checkType); + } +}; +/** + * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module. + * @ko eg.Axes.PanInput 모듈의 옵션 객체 + * @param {String[]} [inputType=["touch", "mouse", "pointer"]] Types of input devices + * - touch: Touch screen + * - mouse: Mouse + * - pointer: Mouse and touch 입력 장치 종류 + * - touch: 터치 입력 장치 + * - mouse: 마우스 + * - pointer: 마우스 및 터치 + * @param {String[]} [inputButton=["left"]] List of buttons to allow input + * - left: Left mouse button and normal touch + * - middle: Mouse wheel press + * - right: Right mouse button 입력을 허용할 버튼 목록 + * - left: 마우스 왼쪽 버튼 + * - middle: 마우스 휠 눌림 + * - right: 마우스 오른쪽 버튼 + * @param {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [scale[0]=1] horizontal axis scale 수평축 배율 + * @param {Number} [scale[1]=1] vertical axis scale 수직축 배율 + * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90) + * @param {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리 + * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px) + * @param {String} [touchAction=null] Value that overrides the element's "touch-action" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. 엘리먼트의 "touch-action" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다. + **/ + +/** + * 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 + * ```js + * 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 eg.Axes.PanInput 모듈을 사용할 엘리먼트 + * @param {PanInputOption} [options={}] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체 + */ + +var PanInput = +/*#__PURE__*/ +function () { + /** + * + */ + function PanInput(el, options) { + var _this = this; + + this.axes = []; + this.element = null; + this._enabled = false; + this._activeEvent = null; + this._atRightEdge = false; + this._rightEdgeTimer = 0; + + this._forceRelease = function () { + var activeEvent = _this._activeEvent; + var prevEvent = activeEvent.prevEvent; + activeEvent.onRelease(); + + _this._observer.release(_this, prevEvent, [0, 0]); + + _this._detachWindowEvent(activeEvent); + }; + + this._voidFunction = function () {}; + + this.element = $(el); + this.options = __assign({ + inputType: ["touch", "mouse", "pointer"], + inputButton: [MOUSE_LEFT], + scale: [1, 1], + thresholdAngle: 45, + threshold: 0, + iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD, + releaseOnScroll: false, + touchAction: null + }, options); + this._onPanstart = this._onPanstart.bind(this); + this._onPanmove = this._onPanmove.bind(this); + this._onPanend = this._onPanend.bind(this); + } + + var __proto = PanInput.prototype; + + __proto.mapAxes = function (axes) { + var useHorizontal = !!axes[0]; + var useVertical = !!axes[1]; + + if (useHorizontal && useVertical) { + this._direction = DIRECTION_ALL; + } else if (useHorizontal) { + this._direction = DIRECTION_HORIZONTAL; + } else if (useVertical) { + this._direction = DIRECTION_VERTICAL; + } else { + this._direction = DIRECTION_NONE; + } + + this.axes = axes; + }; + + __proto.connect = function (observer) { + if (this._activeEvent) { + this._detachElementEvent(); + + this._detachWindowEvent(this._activeEvent); + } + + this._attachElementEvent(observer); + + this._originalCssProps = setCssProps(this.element, this.options, this._direction); + return this; + }; + + __proto.disconnect = function () { + this._detachElementEvent(); + + this._detachWindowEvent(this._activeEvent); + + if (!isCssPropsFromAxes(this._originalCssProps)) { + revertCssProps(this.element, this._originalCssProps); + } + + this._direction = DIRECTION_NONE; + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onPanstart = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventStart(event, this.options.inputButton); + + if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { + return; + } + + if (panEvent.srcEvent.cancelable !== false) { + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + + this._observer.hold(this, panEvent); + + this._atRightEdge = IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold; + + this._attachWindowEvent(activeEvent); + + activeEvent.prevEvent = panEvent; + } + }; + + __proto._onPanmove = function (event) { + var _this = this; + + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventMove(event, this.options.inputButton); + + if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { + return; + } + + var _a = this.options, + iOSEdgeSwipeThreshold = _a.iOSEdgeSwipeThreshold, + releaseOnScroll = _a.releaseOnScroll; + var userDirection = getDirectionByAngle(panEvent.angle, this.options.thresholdAngle); + + if (releaseOnScroll && !panEvent.srcEvent.cancelable) { + this._onPanend(event); + + return; + } + + if (activeEvent.prevEvent && IS_IOS_SAFARI) { + var swipeLeftToRight = panEvent.center.x < 0; + + if (swipeLeftToRight) { + // iOS swipe left => right + this._forceRelease(); + + return; + } else if (this._atRightEdge) { + clearTimeout(this._rightEdgeTimer); // - is right to left + + var swipeRightToLeft = panEvent.deltaX < -iOSEdgeSwipeThreshold; + + if (swipeRightToLeft) { + this._atRightEdge = false; + } else { + // iOS swipe right => left + this._rightEdgeTimer = window.setTimeout(function () { + return _this._forceRelease(); + }, 100); + } + } + } + + var offset = this._getOffset([panEvent.offsetX, panEvent.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]); + + var prevent = offset.some(function (v) { + return v !== 0; + }); + + if (prevent) { + if (panEvent.srcEvent.cancelable !== false) { + panEvent.srcEvent.preventDefault(); + } + + panEvent.srcEvent.stopPropagation(); + } + + panEvent.preventSystemEvent = prevent; + + if (prevent) { + this._observer.change(this, panEvent, toAxis(this.axes, offset)); + } + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanend = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this._enabled || activeEvent.getTouches(event) !== 0) { + return; + } + + this._detachWindowEvent(activeEvent); + + clearTimeout(this._rightEdgeTimer); + var prevEvent = activeEvent.prevEvent; + + var velocity = this._getOffset([Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1), Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]); + + activeEvent.onRelease(); + + this._observer.release(this, prevEvent, velocity); + }; + + __proto._attachWindowEvent = function (activeEvent) { + var _this = this; + + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + window.addEventListener(event, _this._onPanmove, { + passive: false + }); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + window.addEventListener(event, _this._onPanend, { + passive: false + }); + }); + }; + + __proto._detachWindowEvent = function (activeEvent) { + var _this = this; + + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + window.removeEventListener(event, _this._onPanmove); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + window.removeEventListener(event, _this._onPanend); + }); + }; + + __proto._getOffset = function (properties, direction) { + var offset = [0, 0]; + var scale = this.options.scale; + + if (direction[0]) { + offset[0] = properties[0] * scale[0]; + } + + if (direction[1]) { + offset[1] = properties[1] * scale[1]; + } + + return offset; + }; + + __proto._attachElementEvent = function (observer) { + var _this = this; + + var activeEvent = convertInputType(this.options.inputType); + + if (!activeEvent) { + return; + } + + this._observer = observer; + this._enabled = true; + this._activeEvent = activeEvent; + activeEvent.start.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, _this._onPanstart); + }); // adding event listener to element prevents invalid behavior in iOS Safari + + activeEvent.move.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, _this._voidFunction); + }); + }; + + __proto._detachElementEvent = function () { + var _this = this; + + var activeEvent = this._activeEvent; + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._onPanstart); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._voidFunction); + }); + this._enabled = false; + this._observer = null; + }; + + return PanInput; +}(); + +/** + * A module that passes the angle moved by touch to Axes and uses one axis of rotation. + * [Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput) + * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다. + * [상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4) + * + * @example + * ```js + * const input = new eg.Axes.RotatePanInput("#area"); + * + * var axes = new eg.Axes({ + * // property name('angle') could be anything you want (eg. x, y, z...) + * angle: { + * range: [-180, 180] // from -180deg to 180deg + * } + * }); + * + * axes.connect("angle", input) + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트 + * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체 + * @extends PanInput + */ + +var RotatePanInput = +/*#__PURE__*/ +function (_super) { + __extends(RotatePanInput, _super); + /** + * + */ + + + function RotatePanInput(el, options) { + var _this = _super.call(this, el, options) || this; + + _this._prevQuadrant = null; + _this._lastDiff = 0; + return _this; + } + + var __proto = RotatePanInput.prototype; + + __proto.mapAxes = function (axes) { + this._direction = Axes.DIRECTION_ALL; + this.axes = axes; + }; + + __proto._onPanstart = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventStart(event, this.options.inputButton); + + if (!panEvent || !this.isEnabled()) { + return; + } + + var rect = this.element.getBoundingClientRect(); + + this._observer.hold(this, panEvent); + + this._attachWindowEvent(activeEvent); // TODO: how to do if element is ellipse not circle. + + + this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360 + // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin + + this._rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle. + + this._prevAngle = null; + + this._triggerChange(panEvent); + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanmove = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventMove(event, this.options.inputButton); + + if (!panEvent || !this.isEnabled()) { + return; + } + + if (panEvent.srcEvent.cancelable !== false) { + panEvent.srcEvent.preventDefault(); + } + + panEvent.srcEvent.stopPropagation(); + + this._triggerChange(panEvent); + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanend = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this.isEnabled()) { + return; + } + + var prevEvent = activeEvent.prevEvent; + + this._triggerChange(prevEvent); + + var vx = prevEvent.velocityX; + var vy = prevEvent.velocityY; + var velocity = Math.sqrt(vx * vx + vy * vy) * (this._lastDiff > 0 ? -1 : 1); // clockwise + + activeEvent.onRelease(); + + this._observer.release(this, prevEvent, [velocity * this._coefficientForDistanceToAngle]); + + this._detachWindowEvent(activeEvent); + }; + + __proto._triggerChange = function (event) { + var _a = this._getPosFromOrigin(event.center.x, event.center.y), + x = _a.x, + y = _a.y; + + var angle = getAngle(x, y); + var positiveAngle = angle < 0 ? 360 + angle : angle; + + var quadrant = this._getQuadrant(event.center.x, event.center.y); + + var diff = this._getDifference(this._prevAngle, positiveAngle, this._prevQuadrant, quadrant); + + this._prevAngle = positiveAngle; + this._prevQuadrant = quadrant; + + if (diff === 0) { + return; + } + + this._lastDiff = diff; + + this._observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise + + }; + + __proto._getDifference = function (prevAngle, angle, prevQuadrant, quadrant) { + var diff; + + if (prevAngle === null) { + diff = 0; + } else if (prevQuadrant === 1 && quadrant === 4) { + diff = -prevAngle - (360 - angle); + } else if (prevQuadrant === 4 && quadrant === 1) { + diff = 360 - prevAngle + angle; + } else { + diff = angle - prevAngle; + } + + return diff; + }; + + __proto._getPosFromOrigin = function (posX, posY) { + return { + x: posX - this._rotateOrigin[0], + y: this._rotateOrigin[1] - posY + }; + }; + + __proto._getQuadrant = function (posX, posY) { + /** + * Quadrant + * y(+) + * | + * 2 | 1 + * --------------->x(+) + * 3 | 4 + * | + */ + var _a = this._getPosFromOrigin(posX, posY), + x = _a.x, + y = _a.y; + + var q = 0; + + if (x >= 0 && y >= 0) { + q = 1; + } else if (x < 0 && y >= 0) { + q = 2; + } else if (x < 0 && y < 0) { + q = 3; + } else if (x >= 0 && y < 0) { + q = 4; + } + + return q; + }; + + return RotatePanInput; +}(PanInput); + +/** + * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module + * @ko eg.Axes.PinchInput 모듈의 옵션 객체 + * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율 + * @param {String[]} [inputType=["touch", "pointer"]] Types of input devices + * - touch: Touch screen + * - pointer: Mouse and touch 입력 장치 종류 + * - touch: 터치 입력 장치 + * - pointer: 마우스 및 터치 + * @param {String} [touchAction="none"] Value that overrides the element's "touch-action" css property. It is set to "none" to prevent scrolling during touch. 엘리먼트의 "touch-action" CSS 속성을 덮어쓰는 값. 터치 도중 스크롤을 방지하기 위해 "none" 으로 설정되어 있다. + **/ + +/** + * 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 + * ```js + * 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 eg.Axes.PinchInput 모듈을 사용할 엘리먼트 + * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput moduleeg.Axes.PinchInput 모듈의 옵션 객체 + */ + +var PinchInput = +/*#__PURE__*/ +function () { + /** + * + */ + function PinchInput(el, options) { + this.axes = []; + this.element = null; + this._pinchFlag = false; + this._enabled = false; + this._activeEvent = null; + this.element = $(el); + this.options = __assign({ + scale: 1, + threshold: 0, + inputType: ["touch", "pointer"], + touchAction: "none" + }, options); + this._onPinchStart = this._onPinchStart.bind(this); + this._onPinchMove = this._onPinchMove.bind(this); + this._onPinchEnd = this._onPinchEnd.bind(this); + } + + var __proto = PinchInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + if (this._activeEvent) { + this._detachEvent(); + } + + this._attachEvent(observer); + + this._originalCssProps = setCssProps(this.element, this.options, DIRECTION_ALL); + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + if (!isCssPropsFromAxes(this._originalCssProps)) { + revertCssProps(this.element, this._originalCssProps); + } + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onPinchStart = function (event) { + var activeEvent = this._activeEvent; + var pinchEvent = activeEvent.onEventStart(event); + + if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) { + return; + } + + this._baseValue = this._observer.get(this)[this.axes[0]]; + + this._observer.hold(this, event); + + this._pinchFlag = true; + activeEvent.prevEvent = pinchEvent; + }; + + __proto._onPinchMove = function (event) { + var activeEvent = this._activeEvent; + var pinchEvent = activeEvent.onEventMove(event); + + if (!pinchEvent || !this._pinchFlag || !this._enabled || activeEvent.getTouches(event) !== 2) { + return; + } + + var offset = this._getOffset(pinchEvent.scale, activeEvent.prevEvent.scale); + + this._observer.change(this, event, toAxis(this.axes, [offset])); + + activeEvent.prevEvent = pinchEvent; + }; + + __proto._onPinchEnd = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this._pinchFlag || !this._enabled || activeEvent.getTouches(event) >= 2) { + return; + } + + activeEvent.onRelease(); + + this._observer.release(this, event, [0], 0); + + this._baseValue = null; + this._pinchFlag = false; + }; + + __proto._attachEvent = function (observer) { + var _this = this; + + var activeEvent = convertInputType(this.options.inputType); + + if (!activeEvent) { + return; + } + + this._observer = observer; + this._enabled = true; + this._activeEvent = activeEvent; + activeEvent.start.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchStart, false); + }); + activeEvent.move.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchMove, false); + }); + activeEvent.end.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchEnd, false); + }); + }; + + __proto._detachEvent = function () { + var _this = this; + + var activeEvent = this._activeEvent; + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchStart, false); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchMove, false); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchEnd, false); + }); + this._enabled = false; + this._observer = null; + }; + + __proto._getOffset = function (pinchScale, prev) { + if (prev === void 0) { + prev = 1; + } + + return this._baseValue * (pinchScale - prev) * this.options.scale; + }; + + return PinchInput; +}(); + +/** + * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module + * @ko eg.Axes.WheelInput 모듈의 옵션 객체 + * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [releaseDelay=300] Millisecond that trigger release event after last input마지막 입력 이후 release 이벤트가 트리거되기까지의 밀리초 + * @param {Boolean} [useNormalized=true] Whether to calculate scroll speed the same in all browsers모든 브라우저에서 스크롤 속도를 동일하게 처리할지 여부 + * @param {Boolean} [useAnimation=false] Whether to process coordinate changes through the mouse wheel as a continuous animation마우스 휠을 통한 좌표 변화를 연속적인 애니메이션으로 처리할지 여부 + **/ + +/** + * A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis. + * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. + * + * @example + * ```js + * const wheel = new eg.Axes.WheelInput("#area", { + * scale: 1 + * }); + * + * // Connect 'something' axis when the mousewheel is moved. + * axes.connect("something", wheel); + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module eg.Axes.WheelInput 모듈을 사용할 엘리먼트 + * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput moduleeg.Axes.WheelInput 모듈의 옵션 객체 + */ + +var WheelInput = +/*#__PURE__*/ +function () { + /** + * + */ + function WheelInput(el, options) { + this.axes = []; + this.element = null; + this._enabled = false; + this._holding = false; + this._timer = null; + this.element = $(el); + this.options = __assign({ + scale: 1, + releaseDelay: 300, + useNormalized: true, + useAnimation: false + }, options); + this._onWheel = this._onWheel.bind(this); + } + + var __proto = WheelInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + this._detachEvent(); + + this._attachEvent(observer); + + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onWheel = function (event) { + var _this = this; + + if (!this._enabled) { + return; + } + + event.preventDefault(); + + if (event.deltaY === 0) { + return; + } + + if (!this._holding) { + this._observer.hold(this, event); + + this._holding = true; + } + + var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY)); + + this._observer.change(this, event, toAxis(this.axes, [offset]), this.options.useAnimation); + + clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (_this._holding) { + _this._holding = false; + + _this._observer.release(_this, event, [0]); + } + }, this.options.releaseDelay); + }; + + __proto._attachEvent = function (observer) { + this._observer = observer; + this.element.addEventListener("wheel", this._onWheel); + this._enabled = true; + }; + + __proto._detachEvent = function () { + this.element.removeEventListener("wheel", this._onWheel); + this._enabled = false; + this._observer = null; + + if (this._timer) { + clearTimeout(this._timer); + this._timer = null; + } + }; + + return WheelInput; +}(); + +var KEY_LEFT_ARROW = 37; +var KEY_A = 65; +var KEY_UP_ARROW = 38; +var KEY_W = 87; +var KEY_RIGHT_ARROW = 39; +var KEY_D = 68; +var KEY_DOWN_ARROW = 40; +var KEY_S = 83; +/* eslint-disable */ + +var DIRECTION_REVERSE = -1; +var DIRECTION_FORWARD = 1; +var DIRECTION_HORIZONTAL$1 = -1; +var DIRECTION_VERTICAL$1 = 1; +var DELAY = 80; +/** + * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module + * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체 + * @param {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율 + * @param {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율 + **/ + +/** + * A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis. + * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다. + * + * @example + * ```js + * const moveKey = new eg.Axes.MoveKeyInput("#area", { + * scale: [1, 1] + * }); + * + * // Connect 'x', 'y' axes when the moveKey is pressed. + * axes.connect(["x", "y"], moveKey); + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트 + * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput moduleeg.Axes.MoveKeyInput 모듈의 옵션 객체 + */ + +var MoveKeyInput = +/*#__PURE__*/ +function () { + /** + * + */ + function MoveKeyInput(el, options) { + this.axes = []; + this.element = null; + this._enabled = false; + this._holding = false; + this._timer = null; + this.element = $(el); + this.options = __assign({ + scale: [1, 1] + }, options); + this._onKeydown = this._onKeydown.bind(this); + this._onKeyup = this._onKeyup.bind(this); + } + + var __proto = MoveKeyInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + this._detachEvent(); // add tabindex="0" to the container for making it focusable + + + if (this.element.getAttribute("tabindex") !== "0") { + this.element.setAttribute("tabindex", "0"); + } + + this._attachEvent(observer); + + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onKeydown = function (event) { + if (!this._enabled) { + return; + } + + var isMoveKey = true; + var direction = DIRECTION_FORWARD; + var move = DIRECTION_HORIZONTAL$1; + + switch (event.keyCode) { + case KEY_LEFT_ARROW: + case KEY_A: + direction = DIRECTION_REVERSE; + break; + + case KEY_RIGHT_ARROW: + case KEY_D: + break; + + case KEY_DOWN_ARROW: + case KEY_S: + direction = DIRECTION_REVERSE; + move = DIRECTION_VERTICAL$1; + break; + + case KEY_UP_ARROW: + case KEY_W: + move = DIRECTION_VERTICAL$1; + break; + + default: + isMoveKey = false; + } + + if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) { + isMoveKey = false; + } + + if (!isMoveKey) { + return; + } + + event.preventDefault(); + var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction]; + + if (!this._holding) { + this._observer.hold(this, event); + + this._holding = true; + } + + clearTimeout(this._timer); + + this._observer.change(this, event, toAxis(this.axes, offsets)); + }; + + __proto._onKeyup = function (event) { + var _this = this; + + if (!this._holding) { + return; + } + + clearTimeout(this._timer); + this._timer = setTimeout(function () { + _this._observer.release(_this, event, [0, 0]); + + _this._holding = false; + }, DELAY); + }; + + __proto._attachEvent = function (observer) { + this._observer = observer; + this.element.addEventListener("keydown", this._onKeydown, false); + this.element.addEventListener("keypress", this._onKeydown, false); + this.element.addEventListener("keyup", this._onKeyup, false); + this._enabled = true; + }; + + __proto._detachEvent = function () { + this.element.removeEventListener("keydown", this._onKeydown, false); + this.element.removeEventListener("keypress", this._onKeydown, false); + this.element.removeEventListener("keyup", this._onKeyup, false); + this._enabled = false; + this._observer = null; + }; + + return MoveKeyInput; +}(); + +export default Axes; +export { PanInput, RotatePanInput, PinchInput, WheelInput, MoveKeyInput }; +//# sourceMappingURL=axes.esm.js.map diff --git a/dist/axes.esm.js.map b/dist/axes.esm.js.map new file mode 100644 index 00000000..e72ab9ce --- /dev/null +++ b/dist/axes.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axes.esm.js","sources":["../src/browser.ts","../src/const.ts","../src/utils.ts","../src/EventManager.ts","../src/InterruptManager.ts","../src/Coordinate.ts","../src/AxisManager.ts","../src/eventInput/EventInput.ts","../src/eventInput/MouseEventInput.ts","../src/eventInput/TouchEventInput.ts","../src/eventInput/PointerEventInput.ts","../src/eventInput/TouchMouseEventInput.ts","../src/inputType/InputType.ts","../src/InputObserver.ts","../src/animation/AnimationManager.ts","../src/animation/EasingManager.ts","../src/Axes.ts","../src/inputType/PanInput.ts","../src/inputType/RotatePanInput.ts","../src/inputType/PinchInput.ts","../src/inputType/WheelInput.ts","../src/inputType/MoveKeyInput.ts"],"sourcesContent":["/* eslint-disable no-new-func, no-nested-ternary */\n\nlet win: any;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {\n navigator: {\n userAgent: \"\",\n },\n };\n} else {\n win = window;\n}\n/* eslint-enable no-new-func, no-nested-ternary */\n\nexport { win as window };\n","export const DIRECTION_NONE = 1;\nexport const DIRECTION_LEFT = 2;\nexport const DIRECTION_RIGHT = 4;\nexport const DIRECTION_HORIZONTAL = 2 | 4;\nexport const DIRECTION_UP = 8;\nexport const DIRECTION_DOWN = 16;\nexport const DIRECTION_VERTICAL = 8 | 16;\nexport const DIRECTION_ALL = 2 | 4 | 8 | 16;\n\nexport const MOUSE_LEFT = \"left\";\nexport const MOUSE_RIGHT = \"right\";\nexport const MOUSE_MIDDLE = \"middle\";\n\nexport const VELOCITY_INTERVAL = 16;\n\nimport getAgent from \"@egjs/agent\";\n\nimport { window } from \"./browser\";\n\nexport const IOS_EDGE_THRESHOLD = 30;\nexport const IS_IOS_SAFARI =\n \"ontouchstart\" in window && getAgent().browser.name === \"safari\";\n\nexport const TRANSFORM = (() => {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n const bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0])\n .style;\n const target = [\n \"transform\",\n \"webkitTransform\",\n \"msTransform\",\n \"mozTransform\",\n ];\n for (let i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n return \"\";\n})();\n\nexport const PREVENT_DRAG_CSSPROPS = {\n \"user-select\": \"none\",\n \"-webkit-user-drag\": \"none\",\n};\n","import { window } from \"./browser\";\nimport { PREVENT_DRAG_CSSPROPS } from \"./const\";\nimport { PanInputOption } from \"./inputType/PanInput\";\nimport { PinchInputOption } from \"./inputType/PinchInput\";\nimport { ObjectInterface } from \"./types\";\nimport {\n DIRECTION_NONE,\n DIRECTION_VERTICAL,\n DIRECTION_HORIZONTAL,\n DIRECTION_ALL,\n} from \"./const\";\n\ndeclare let jQuery: any;\n\nexport const toArray = (nodes: NodeList): HTMLElement[] => {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n const el = [];\n for (let i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n return el;\n};\n\nexport const $ = (param, multi = false) => {\n let el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n const match = param.match(/^<([a-z]+)\\s*([^>]*)>/);\n\n // creating element\n if (match) {\n // HTML\n const dummy = document.createElement(\"div\");\n\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === window) {\n // window\n el = param;\n } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) {\n // HTMLElement, Document\n el = param;\n } else if (\n (\"jQuery\" in window && param instanceof jQuery) ||\n param.constructor.prototype.jquery\n ) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map((v) => $(v));\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n return el;\n};\n\nlet raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame;\nlet caf = window.cancelAnimationFrame || window.webkitCancelAnimationFrame;\nif (raf && !caf) {\n const keyInfo = {};\n const oldraf = raf;\n raf = (callback: FrameRequestCallback) => {\n const wrapCallback = (timestamp: number) => {\n if (keyInfo[key]) {\n callback(timestamp);\n }\n };\n const key = oldraf(wrapCallback);\n keyInfo[key] = true;\n return key;\n };\n caf = (key: number) => {\n delete keyInfo[key];\n };\n} else if (!(raf && caf)) {\n raf = (callback: FrameRequestCallback) => {\n return window.setTimeout(() => {\n callback(\n ((window.performance &&\n window.performance.now &&\n window.performance.now()) as number) || new Date().getTime()\n );\n }, 16);\n };\n caf = window.clearTimeout;\n}\n\n/**\n * A polyfill for the window.requestAnimationFrame() method.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame\n * @private\n */\nexport const requestAnimationFrame = (fp) => {\n return raf(fp);\n};\n/**\n * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method.\n * @param {Number} key −\tThe ID value returned through a call to the requestAnimationFrame() method. requestAnimationFrame() 메서드가 반환한 아이디 값\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame\n * @private\n */\nexport const cancelAnimationFrame = (key) => {\n caf(key);\n};\n\nexport const map = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => U\n): ObjectInterface => {\n const tranformed: ObjectInterface = {};\n\n for (const k in obj) {\n if (k) {\n tranformed[k] = callback(obj[k], k);\n }\n }\n return tranformed;\n};\n\nexport const filter = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n): ObjectInterface => {\n const filtered: ObjectInterface = {};\n\n for (const k in obj) {\n if (k && callback(obj[k], k)) {\n filtered[k] = obj[k];\n }\n }\n return filtered;\n};\nexport const every = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n) => {\n for (const k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n return true;\n};\nexport const equal = (\n target: ObjectInterface,\n base: ObjectInterface\n): boolean => {\n return every(target, (v, k) => v === base[k]);\n};\n\nconst roundNumFunc = {};\n\nexport const roundNumber = (num: number, roundUnit: number) => {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n};\n\nexport const roundNumbers = (\n num: ObjectInterface,\n roundUnit: ObjectInterface | number\n): ObjectInterface => {\n if (!num || !roundUnit) {\n return num;\n }\n return map(num, (value, key) =>\n roundNumber(\n value,\n typeof roundUnit === \"number\" ? roundUnit : roundUnit[key]\n )\n );\n};\n\nexport const getDecimalPlace = (val: number): number => {\n if (!isFinite(val)) {\n return 0;\n }\n\n const v = `${val}`;\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n let p = 0;\n let e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n }\n\n // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n};\n\nexport const inversePow = (n: number) => {\n // replace Math.pow(10, -n) to solve floating point issue.\n // eg. Math.pow(10, -4) => 0.00009999999999999999\n return 1 / Math.pow(10, n);\n};\n\nexport const getRoundFunc = (v: number) => {\n const p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n\n return (n: number) => {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n};\n\nexport const getAngle = (posX: number, posY: number) => {\n return (Math.atan2(posY, posX) * 180) / Math.PI;\n};\n\nexport const isCssPropsFromAxes = (originalCssProps: {\n [key: string]: string;\n}) => {\n let same = true;\n Object.keys(PREVENT_DRAG_CSSPROPS).forEach((prop) => {\n if (\n !originalCssProps ||\n originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]\n ) {\n same = false;\n }\n });\n return same;\n};\n\nexport const setCssProps = (\n element: HTMLElement,\n option: PanInputOption | PinchInputOption,\n direction: number\n): { [key: string]: string } => {\n const touchActionMap = {\n [DIRECTION_NONE]: \"auto\",\n [DIRECTION_ALL]: \"none\",\n [DIRECTION_VERTICAL]: \"pan-x\",\n [DIRECTION_HORIZONTAL]: \"pan-y\",\n };\n const oldCssProps = {};\n if (element && element.style) {\n const touchAction = option.touchAction\n ? option.touchAction\n : touchActionMap[direction];\n const newCssProps = {\n ...PREVENT_DRAG_CSSPROPS,\n \"touch-action\":\n element.style[\"touch-action\"] === \"none\" ? \"none\" : touchAction,\n };\n Object.keys(newCssProps).forEach((prop) => {\n oldCssProps[prop] = element.style[prop];\n element.style[prop] = newCssProps[prop];\n });\n }\n return oldCssProps;\n};\n\nexport const revertCssProps = (\n element: HTMLElement,\n originalCssProps: { [key: string]: string }\n): { [key: string]: string } => {\n if (element && element.style && originalCssProps) {\n Object.keys(originalCssProps).forEach((prop) => {\n element.style[prop] = originalCssProps[prop];\n });\n }\n return;\n};\n","import { ComponentEvent } from \"@egjs/component\";\n\nimport { InputType } from \"./inputType/InputType\";\nimport { Axis } from \"./AxisManager\";\nimport Axes from \"./Axes\";\nimport { roundNumbers } from \"./utils\";\nimport { AnimationParam, OnAnimationStart, OnRelease } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface ChangeEventOption {\n input: InputType;\n event;\n}\n\nexport class EventManager {\n public animationManager: AnimationManager;\n public constructor(private _axes: Axes) {}\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @event Axes#hold\n * @type {object}\n * @property {Object.} pos coordinate 좌표 정보\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"hold\", function(event) {\n * // event.pos\n * // event.input\n * // event.inputEvent\n * // isTrusted\n * });\n * ```\n */\n public hold(pos: Axis, option: ChangeEventOption) {\n const { roundPos } = this._getRoundPos(pos);\n\n this._axes.trigger(\n new ComponentEvent(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true,\n })\n );\n }\n\n /**\n * Specifies the coordinates to move after the 'change' event. It works when the holding value of the change event is true.\n * @ko 'change' 이벤트 이후 이동할 좌표를 지정한다. change이벤트의 holding 값이 true일 경우에 동작한다\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events.\n * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationStart\", function(event) {\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n /**\n * This event is fired when a user release an element on the screen of the device.\n * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트\n * @event Axes#release\n * @type {object}\n * @property {Object.} depaPos The coordinates when releasing an element손을 뗐을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to after releasing an element손을 뗀 뒤에 이동할 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value 손을 뗐을 때의 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'release' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerRelease(param: AnimationParam) {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n this._axes.trigger(\n new ComponentEvent(\"release\", {\n ...param,\n bounceRatio: this._getBounceRatio(roundPos),\n } as OnRelease)\n );\n }\n\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @event Axes#change\n * @type {object}\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value 현재 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.사용자가 기기의 화면을 누르고 있는지 여부\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true 이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * // event.pos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.holding\n * // event.set\n * // event.isTrusted\n *\n * // if you want to change the coordinates to move after the 'change' event.\n * // it works when the holding value of the change event is true.\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n public triggerChange(\n pos: Axis,\n depaPos?: Axis,\n option?: ChangeEventOption,\n holding: boolean = false\n ) {\n const animationManager = this.animationManager;\n const axisManager = animationManager.axisManager;\n const eventInfo = animationManager.getEventInfo();\n const { roundPos, roundDepa } = this._getRoundPos(pos, depaPos);\n const moveTo = axisManager.moveTo(roundPos, roundDepa);\n const inputEvent = option?.event || eventInfo?.event || null;\n const param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n bounceRatio: this._getBounceRatio(moveTo.pos),\n holding,\n inputEvent,\n isTrusted: !!inputEvent,\n input: option?.input || eventInfo?.input || null,\n set: inputEvent ? this._createUserControll(moveTo.pos) : () => {}, // eslint-disable-line @typescript-eslint/no-empty-function\n };\n const event = new ComponentEvent(\"change\", param);\n this._axes.trigger(event);\n\n if (inputEvent) {\n axisManager.set(\n (param.set() as { destPos: Axis; duration: number }).destPos\n );\n }\n\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @event Axes#animationStart\n * @type {object}\n * @property {Object.} depaPos The coordinates when animation starts애니메이션이 시작 되었을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to. If you change this value, you can run the animation이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'animationStart' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerAnimationStart(param: AnimationParam): boolean {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n const event = new ComponentEvent(\n \"animationStart\",\n param as OnAnimationStart\n );\n this._axes.trigger(event);\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#animationEnd\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationEnd\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerAnimationEnd(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"animationEnd\", {\n isTrusted,\n })\n );\n }\n\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#finish\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"finish\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerFinish(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"finish\", {\n isTrusted,\n })\n );\n }\n\n public setAnimationManager(animationManager: AnimationManager) {\n this.animationManager = animationManager;\n }\n\n public destroy() {\n this._axes.off();\n }\n\n private _createUserControll(pos: Axis, duration: number = 0) {\n // to controll\n const userControl = {\n destPos: { ...pos },\n duration,\n };\n return (\n toPos?: Axis,\n userDuration?: number\n ): { destPos: Axis; duration: number } => {\n if (toPos) {\n userControl.destPos = { ...toPos };\n }\n if (userDuration !== undefined) {\n userControl.duration = userDuration;\n }\n return userControl;\n };\n }\n\n private _getRoundPos(pos: Axis, depaPos?: Axis) {\n // round value if round exist\n const roundUnit = this._axes.options.round;\n\n // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit),\n };\n }\n\n private _getBounceRatio(pos: Axis): Axis {\n return this._axes.axisManager.map(pos, (v, opt) => {\n if (v < opt.range[0] && opt.bounce[0] !== 0) {\n return (opt.range[0] - v) / opt.bounce[0];\n } else if (v > opt.range[1] && opt.bounce[1] !== 0) {\n return (v - opt.range[1]) / opt.bounce[1];\n } else {\n return 0;\n }\n });\n }\n}\n","import { AxesOption } from \"./Axes\";\nexport class InterruptManager {\n private _prevented = false; // check whether the animation event was prevented\n public constructor(private _options: AxesOption) {}\n\n public isInterrupting() {\n // when interruptable is 'true', return value is always 'true'.\n return this._options.interruptable || this._prevented;\n }\n\n public isInterrupted() {\n return !this._options.interruptable && this._prevented;\n }\n\n public setInterrupt(prevented) {\n if (!this._options.interruptable) {\n this._prevented = prevented;\n }\n }\n}\n","export const getInsidePosition = (\n destPos: number,\n range: number[],\n circular: boolean[],\n bounce?: number[]\n): number => {\n let toDestPos: number = destPos;\n const targetRange: number[] = [\n circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0],\n circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1],\n ];\n\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n\n return toDestPos;\n};\n\n// determine outside\nexport const isOutside = (pos: number, range: number[]): boolean => {\n return pos < range[0] || pos > range[1];\n};\n\n// determine whether position has reached the maximum moveable area\nexport const isEndofBounce = (\n pos: number,\n range: number[],\n bounce: number[],\n circular: boolean[]\n): boolean => {\n return (\n (!circular[0] && pos === range[0] - bounce[0]) ||\n (!circular[1] && pos === range[1] + bounce[1])\n );\n};\n\nexport const getDuration = (distance: number, deceleration): number => {\n const duration = Math.sqrt((distance / deceleration) * 2);\n\n // when duration is under 100, then value is zero\n return duration < 100 ? 0 : duration;\n};\n\nexport const isCircularable = (\n destPos: number,\n range: number[],\n circular: boolean[]\n): boolean => {\n return (\n (circular[1] && destPos > range[1]) || (circular[0] && destPos < range[0])\n );\n};\n\nexport const getCirculatedPos = (\n pos: number,\n range: number[],\n circular: boolean[]\n): number => {\n let toPos = pos;\n const min = range[0];\n const max = range[1];\n const length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = ((toPos - max) % length) + min;\n }\n if (circular[0] && pos < min) {\n // left\n toPos = ((toPos - min) % length) + max;\n }\n return toPos;\n};\n","import { isOutside, getCirculatedPos } from \"./Coordinate\";\nimport { map, filter, every } from \"./utils\";\nimport { ObjectInterface } from \"./types\";\n\nexport interface Axis {\n [key: string]: number;\n}\n\nexport interface AxisOption {\n range?: number[];\n bounce?: number | number[];\n circular?: boolean | boolean[];\n}\n\nexport class AxisManager {\n private _pos: Axis;\n public constructor(private _axis: ObjectInterface) {\n this._complementOptions();\n this._pos = Object.keys(this._axis).reduce((acc, v) => {\n acc[v] = this._axis[v].range[0];\n return acc;\n }, {});\n }\n\n public getDelta(depaPos: Axis, destPos: Axis): Axis {\n const fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), (v, k) => v - fullDepaPos[k]);\n }\n\n public get(axes?: string[] | Axis): Axis {\n if (axes && Array.isArray(axes)) {\n return axes.reduce((acc, v) => {\n if (v && v in this._pos) {\n acc[v] = this._pos[v];\n }\n return acc;\n }, {});\n } else {\n return { ...this._pos, ...((axes || {}) as Axis) };\n }\n }\n\n public moveTo(pos: Axis, depaPos: Axis = this._pos): { [key: string]: Axis } {\n const delta = map(this._pos, (v, key) => {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n\n this.set(\n this.map(pos, (v, opt) =>\n opt ? getCirculatedPos(v, opt.range, opt.circular as boolean[]) : 0\n )\n );\n return {\n pos: { ...this._pos },\n delta,\n };\n }\n\n public set(pos: Axis) {\n for (const k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n }\n\n public every(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): boolean {\n const axisOptions = this._axis;\n\n return every(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public filter(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): Axis {\n const axisOptions = this._axis;\n\n return filter(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public map(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => U\n ) {\n const axisOptions = this._axis;\n\n return map(pos, (value, key) =>\n callback(value, axisOptions[key], key)\n );\n }\n\n public isOutside(axes?: string[]) {\n return !this.every(\n axes ? this.get(axes) : this._pos,\n (v, opt) => !isOutside(v, opt.range)\n );\n }\n\n public getAxisOptions(key: string) {\n return this._axis[key];\n }\n\n /**\n * set up 'css' expression\n * @private\n */\n private _complementOptions() {\n Object.keys(this._axis).forEach((axis) => {\n this._axis[axis] = {\n ...{\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false],\n },\n ...this._axis[axis],\n };\n\n [\"bounce\", \"circular\"].forEach((v) => {\n const axisOption = this._axis;\n const key = axisOption[axis][v];\n\n if (/string|number|boolean/.test(typeof key)) {\n axisOption[axis][v] = [key, key];\n }\n });\n });\n }\n}\n","import { ExtendedEvent, InputEventType, LatestInterval } from \"../types\";\nimport { getAngle } from \"../utils\";\nimport { window } from \"../browser\";\nimport {\n MOUSE_LEFT,\n MOUSE_MIDDLE,\n MOUSE_RIGHT,\n VELOCITY_INTERVAL,\n} from \"../const\";\n\nexport const SUPPORT_TOUCH = \"ontouchstart\" in window;\nexport const SUPPORT_POINTER = \"PointerEvent\" in window;\nexport const SUPPORT_MSPOINTER = \"MSPointerEvent\" in window;\nexport const SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER;\n\nexport abstract class EventInput {\n public prevEvent: ExtendedEvent;\n private _latestInterval: LatestInterval;\n\n public abstract onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventEnd(event: InputEventType): void;\n\n public abstract onRelease(event: InputEventType): void;\n\n public abstract getTouches(event: InputEventType): number;\n\n protected abstract _getScale(event: InputEventType): number;\n\n protected abstract _getCenter(event: InputEventType): {\n x: number;\n y: number;\n };\n\n protected abstract _getMovement(event: InputEventType): {\n x: number;\n y: number;\n };\n\n public extendEvent(event: InputEventType): ExtendedEvent {\n const prevEvent = this.prevEvent;\n const center = this._getCenter(event);\n const movement = prevEvent ? this._getMovement(event) : { x: 0, y: 0 };\n const scale = prevEvent ? this._getScale(event) : 1;\n const angle = prevEvent\n ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y)\n : 0;\n const deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x;\n const deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y;\n const offsetX = movement.x;\n const offsetY = movement.y;\n const latestInterval = this._latestInterval;\n const timeStamp = Date.now();\n const deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;\n let velocityX = prevEvent ? prevEvent.velocityX : 0;\n let velocityY = prevEvent ? prevEvent.velocityY : 0;\n if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {\n if (latestInterval) {\n [velocityX, velocityY] = [\n (deltaX - latestInterval.deltaX) / deltaTime,\n (deltaY - latestInterval.deltaY) / deltaTime,\n ];\n }\n this._latestInterval = {\n timestamp: timeStamp,\n deltaX,\n deltaY,\n };\n }\n return {\n srcEvent: event,\n scale,\n angle,\n center,\n deltaX,\n deltaY,\n offsetX,\n offsetY,\n velocityX,\n velocityY,\n preventSystemEvent: true,\n };\n }\n\n protected _getDistance(\n start: Touch | PointerEvent,\n end: Touch | PointerEvent\n ): number {\n const x = end.clientX - start.clientX;\n const y = end.clientY - start.clientY;\n return Math.sqrt(x * x + y * y);\n }\n\n protected _getButton(event: InputEventType): string {\n const buttonCodeMap = { 1: MOUSE_LEFT, 2: MOUSE_RIGHT, 4: MOUSE_MIDDLE };\n const button = this._isTouchEvent(event)\n ? MOUSE_LEFT\n : buttonCodeMap[event.buttons];\n return button ? button : null;\n }\n\n protected _isTouchEvent(event: InputEventType): event is TouchEvent {\n return event.type.indexOf(\"touch\") > -1;\n }\n\n protected _isValidButton(button: string, inputButton: string[]): boolean {\n return inputButton.indexOf(button) > -1;\n }\n\n protected _preventMouseButton(event: InputEventType, button: string): void {\n if (button === MOUSE_RIGHT) {\n window.addEventListener(\"contextmenu\", this._stopContextMenu);\n } else if (button === MOUSE_MIDDLE) {\n event.preventDefault();\n }\n }\n\n private _stopContextMenu = (event: InputEventType) => {\n event.preventDefault();\n window.removeEventListener(\"contextmenu\", this._stopContextMenu);\n };\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class MouseEventInput extends EventInput {\n public readonly start = [\"mousedown\"];\n public readonly move = [\"mousemove\"];\n public readonly end = [\"mouseup\"];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(): void {\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n return;\n }\n\n public getTouches(): number {\n return 0;\n }\n\n protected _getScale(): number {\n return 1;\n }\n\n protected _getCenter(event: MouseEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as MouseEvent;\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchEventInput extends EventInput {\n public readonly start = [\"touchstart\"];\n public readonly move = [\"touchmove\"];\n public readonly end = [\"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(event: InputEventType): ExtendedEvent {\n this._baseTouches = (event as TouchEvent).touches;\n return this.extendEvent(event);\n }\n\n public onEventMove(event: InputEventType): ExtendedEvent {\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._baseTouches = (event as TouchEvent).touches;\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return (event as TouchEvent).touches.length;\n }\n\n protected _getScale(event: TouchEvent): number {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n\n protected _getCenter(event: TouchEvent): { x: number; y: number } {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n\n protected _getMovement(event: TouchEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as TouchEvent;\n if (event.touches[0].identifier !== prev.touches[0].identifier) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.touches[0].clientX - prev.touches[0].clientX,\n y: event.touches[0].clientY - prev.touches[0].clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput, SUPPORT_POINTER } from \"./EventInput\";\n\nexport class PointerEventInput extends EventInput {\n public readonly start = SUPPORT_POINTER ? [\"pointerdown\"] : [\"MSPointerDown\"];\n public readonly move = SUPPORT_POINTER ? [\"pointermove\"] : [\"MSPointerMove\"];\n public readonly end = SUPPORT_POINTER\n ? [\"pointerup\", \"pointercancel\"]\n : [\"MSPointerUp\", \"MSPointerCancel\"];\n\n // store first, recent inputs for each event id\n private _firstInputs: PointerEvent[] = [];\n private _recentInputs: PointerEvent[] = [];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._removePointerEvent(event as PointerEvent);\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._firstInputs = [];\n this._recentInputs = [];\n return;\n }\n\n public getTouches(): number {\n return this._recentInputs.length;\n }\n\n protected _getScale(): number {\n if (this._recentInputs.length !== 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(this._recentInputs[0], this._recentInputs[1]) /\n this._getDistance(this._firstInputs[0], this._firstInputs[1])\n );\n }\n\n protected _getCenter(event: PointerEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: PointerEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as PointerEvent;\n if (event.pointerId !== prev.pointerId) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n\n private _updatePointerEvent(event: PointerEvent) {\n let addFlag = false;\n this._recentInputs.forEach((e, i) => {\n if (e.pointerId === event.pointerId) {\n addFlag = true;\n this._recentInputs[i] = event;\n }\n });\n if (!addFlag) {\n this._firstInputs.push(event);\n this._recentInputs.push(event);\n }\n }\n\n private _removePointerEvent(event?: PointerEvent) {\n this._firstInputs = this._firstInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n this._recentInputs = this._recentInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchMouseEventInput extends EventInput {\n public readonly start = [\"mousedown\", \"touchstart\"];\n public readonly move = [\"mousemove\", \"touchmove\"];\n public readonly end = [\"mouseup\", \"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return this._isTouchEvent(event) ? event.touches.length : 0;\n }\n\n protected _getScale(event: MouseEvent | TouchEvent): number {\n if (this._isTouchEvent(event)) {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return 1; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n return this.prevEvent.scale;\n }\n\n protected _getCenter(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n if (this._isTouchEvent(event)) {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n const prev = this.prevEvent.srcEvent;\n const [nextSpot, prevSpot] = [event, prev].map((e) => {\n if (this._isTouchEvent(e)) {\n return {\n id: e.touches[0].identifier,\n x: e.touches[0].clientX,\n y: e.touches[0].clientY,\n };\n }\n return {\n id: null,\n x: e.clientX,\n y: e.clientY,\n };\n });\n return nextSpot.id === prevSpot.id\n ? { x: nextSpot.x - prevSpot.x, y: nextSpot.y - prevSpot.y }\n : { x: 0, y: 0 };\n }\n}\n","import { Axis } from \"../AxisManager\";\nimport { AxesOption } from \"../Axes\";\nimport { ActiveEvent } from \"../types\";\nimport { MouseEventInput } from \"../eventInput/MouseEventInput\";\nimport { TouchEventInput } from \"../eventInput/TouchEventInput\";\nimport { PointerEventInput } from \"../eventInput/PointerEventInput\";\nimport { TouchMouseEventInput } from \"../eventInput/TouchMouseEventInput\";\nimport {\n SUPPORT_POINTER_EVENTS,\n SUPPORT_TOUCH,\n} from \"../eventInput/EventInput\";\n\nexport interface InputType {\n axes: string[];\n element: HTMLElement;\n mapAxes(axes: string[]);\n connect(observer: InputTypeObserver): InputType;\n disconnect();\n destroy();\n enable?();\n disable?();\n isEnable?(): boolean;\n}\n\nexport interface InputTypeObserver {\n options: AxesOption;\n get(inputType: InputType): Axis;\n change(inputType: InputType, event, offset: Axis, useAnimation?: boolean);\n hold(inputType: InputType, event);\n release(\n inputType: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n );\n}\n\nexport const toAxis = (source: string[], offset: number[]): Axis => {\n return offset.reduce((acc, v, i) => {\n if (source[i]) {\n acc[source[i]] = v;\n }\n return acc;\n }, {});\n};\n\nexport const convertInputType = (inputType: string[] = []): ActiveEvent => {\n let hasTouch = false;\n let hasMouse = false;\n let hasPointer = false;\n\n inputType.forEach((v) => {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n if (hasPointer) {\n return new PointerEventInput();\n } else if (hasTouch && hasMouse) {\n return new TouchMouseEventInput();\n } else if (hasTouch) {\n return new TouchEventInput();\n } else if (hasMouse) {\n return new MouseEventInput();\n }\n return null;\n};\n","import { InterruptManager } from \"./InterruptManager\";\nimport { InputType, InputTypeObserver, toAxis } from \"./inputType/InputType\";\nimport { EventManager, ChangeEventOption } from \"./EventManager\";\nimport { AxisManager, Axis } from \"./AxisManager\";\nimport { AxesOption } from \"./Axes\";\nimport {\n isOutside,\n getInsidePosition,\n getCirculatedPos,\n isEndofBounce,\n} from \"./Coordinate\";\nimport { map, equal } from \"./utils\";\nimport { AnimationParam } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport class InputObserver implements InputTypeObserver {\n public options: AxesOption;\n private _interruptManager: InterruptManager;\n private _eventManager: EventManager;\n private _axisManager: AxisManager;\n private _animationManager: AnimationManager;\n private _isOutside = false;\n private _moveDistance: Axis = null;\n private _isStopped = false;\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n animationManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n animationManager: AnimationManager;\n }) {\n this.options = options;\n this._interruptManager = interruptManager;\n this._eventManager = eventManager;\n this._axisManager = axisManager;\n this._animationManager = animationManager;\n }\n\n public get(input: InputType): Axis {\n return this._axisManager.get(input.axes);\n }\n\n public hold(input: InputType, event) {\n if (this._interruptManager.isInterrupted() || !input.axes.length) {\n return;\n }\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n this._isStopped = false;\n this._interruptManager.setInterrupt(true);\n this._animationManager.stopAnimation(changeOption);\n if (!this._moveDistance) {\n this._eventManager.hold(this._axisManager.get(), changeOption);\n }\n this._isOutside = this._axisManager.isOutside(input.axes);\n this._moveDistance = this._axisManager.get(input.axes);\n }\n\n public change(input: InputType, event, offset: Axis, useAnimation?: boolean) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n this._axisManager.every(offset, (v) => v === 0)\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyChanged) {\n return;\n }\n let depaPos: Axis = this._moveDistance || this._axisManager.get(input.axes);\n let destPos: Axis;\n\n // for outside logic\n destPos = map(depaPos, (v, k) => v + (offset[k] || 0));\n if (this._moveDistance) {\n this._moveDistance = this._axisManager.map(\n destPos,\n (v, { circular, range }) =>\n circular && (circular[0] || circular[1])\n ? getCirculatedPos(v, range, circular as boolean[])\n : v\n );\n }\n // from outside to inside\n if (\n this._isOutside &&\n this._axisManager.every(depaPos, (v, opt) => !isOutside(v, opt.range))\n ) {\n this._isOutside = false;\n }\n depaPos = this._atOutside(depaPos);\n destPos = this._atOutside(destPos);\n\n if (!this.options.nested || !this._isEndofAxis(offset, depaPos, destPos)) {\n nativeEvent.__childrenAxesAlreadyChanged = true;\n }\n\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (useAnimation) {\n const duration = this._animationManager.getDuration(destPos, depaPos);\n this._animationManager.animateTo(destPos, duration, changeOption);\n } else {\n const isCanceled = !this._eventManager.triggerChange(\n destPos,\n depaPos,\n changeOption,\n true\n );\n if (isCanceled) {\n this._isStopped = true;\n this._moveDistance = null;\n this._animationManager.finish(false);\n }\n }\n }\n\n public release(\n input: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n ) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n !this._moveDistance\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyReleased) {\n velocity = velocity.map(() => 0);\n }\n const pos: Axis = this._axisManager.get(input.axes);\n const depaPos: Axis = this._axisManager.get();\n const displacement = this._animationManager.getDisplacement(velocity);\n const offset = toAxis(input.axes, displacement);\n let destPos: Axis = this._axisManager.get(\n this._axisManager.map(offset, (v, opt, k) => {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(\n pos[k] + v,\n opt.range,\n opt.circular as boolean[],\n opt.bounce as number[]\n );\n }\n })\n );\n nativeEvent.__childrenAxesAlreadyReleased = true;\n const duration = this._animationManager.getDuration(\n destPos,\n pos,\n inputDuration\n );\n\n if (duration === 0) {\n destPos = { ...depaPos };\n }\n // prepare params\n const param: AnimationParam = {\n depaPos,\n destPos,\n duration,\n delta: this._axisManager.getDelta(depaPos, destPos),\n inputEvent: event,\n input,\n isTrusted: true,\n };\n this._eventManager.triggerRelease(param);\n this._moveDistance = null;\n\n // to contol\n const userWish = this._animationManager.getUserControl(param);\n const isEqual = equal(userWish.destPos, depaPos);\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (isEqual || userWish.duration === 0) {\n if (!isEqual) {\n this._eventManager.triggerChange(\n userWish.destPos,\n depaPos,\n changeOption,\n true\n );\n }\n this._interruptManager.setInterrupt(false);\n if (this._axisManager.isOutside()) {\n this._animationManager.restore(changeOption);\n } else {\n this._eventManager.triggerFinish(true);\n }\n } else {\n this._animationManager.animateTo(\n userWish.destPos,\n userWish.duration,\n changeOption\n );\n }\n }\n\n // when move pointer is held in outside\n private _atOutside(pos: Axis) {\n if (this._isOutside) {\n return this._axisManager.map(pos, (v, opt) => {\n const tn = opt.range[0] - (opt.bounce[0] as number);\n const tx = opt.range[1] + (opt.bounce[1] as number);\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n return this._axisManager.map(pos, (v, opt) => {\n const min = opt.range[0];\n const max = opt.range[1];\n const out = opt.bounce;\n const circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return (\n min - this._animationManager.interpolate(min - v, out[0] as number)\n );\n } else if (v > max) {\n // right\n return (\n max + this._animationManager.interpolate(v - max, out[1] as number)\n );\n }\n return v;\n });\n }\n }\n\n private _isEndofAxis(offset: Axis, depaPos: Axis, destPos: Axis) {\n return this._axisManager.every(\n depaPos,\n (value, option, key) =>\n offset[key] === 0 ||\n (depaPos[key] === destPos[key] &&\n isEndofBounce(\n value,\n option.range,\n option.bounce as number[],\n option.circular as boolean[]\n ))\n );\n }\n}\n","import {\n getInsidePosition,\n isCircularable,\n getCirculatedPos,\n getDuration,\n} from \"../Coordinate\";\nimport { Axis, AxisManager } from \"../AxisManager\";\nimport { InterruptManager } from \"../InterruptManager\";\nimport { EventManager, ChangeEventOption } from \"../EventManager\";\nimport {\n requestAnimationFrame,\n cancelAnimationFrame,\n map,\n every,\n filter,\n equal,\n roundNumber,\n getDecimalPlace,\n inversePow,\n} from \"../utils\";\nimport { AxesOption } from \"../Axes\";\nimport {\n AnimationParam,\n ObjectInterface,\n UpdateAnimationOption,\n} from \"../types\";\n\nexport interface AnimationState {\n pos: Axis;\n easingPer: number;\n finished: boolean;\n}\n\nconst clamp = (value: number, min: number, max: number): number => {\n return Math.max(Math.min(value, max), min);\n};\n\nexport abstract class AnimationManager {\n public interruptManager: InterruptManager;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n protected _options: AxesOption;\n protected _animateParam: AnimationParam;\n private _raf: number;\n\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n }) {\n this._options = options;\n this.interruptManager = interruptManager;\n this.eventManager = eventManager;\n this.axisManager = axisManager;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n public abstract interpolate(displacement: number, threshold: number): number;\n\n public abstract updateAnimation(options: UpdateAnimationOption): void;\n\n protected abstract _initState(info: AnimationParam): AnimationState;\n\n protected abstract _getNextState(prevState: AnimationState): AnimationState;\n\n public getDuration(\n depaPos: Axis,\n destPos: Axis,\n wishDuration?: number\n ): number {\n let duration: number;\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n const durations: Axis = map(destPos, (v, k) =>\n getDuration(Math.abs(v - depaPos[k]), this._options.deceleration)\n );\n duration = Object.keys(durations).reduce(\n (max, v) => Math.max(max, durations[v]),\n -Infinity\n );\n }\n return clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n }\n\n public getDisplacement(velocity: number[]): number[] {\n const totalVelocity = Math.pow(\n velocity.reduce((total, v) => total + v * v, 0),\n 1 / velocity.length\n );\n const duration = Math.abs(totalVelocity / -this._options.deceleration);\n return velocity.map((v) => (v / 2) * duration);\n }\n\n public stopAnimation(option?: ChangeEventOption): void {\n if (this._animateParam) {\n const orgPos: Axis = this.axisManager.get();\n const pos: Axis = this.axisManager.map(orgPos, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n );\n if (!every(pos, (v, k) => orgPos[k] === v)) {\n this.eventManager.triggerChange(pos, orgPos, option, !!option);\n }\n this._animateParam = null;\n if (this._raf) {\n cancelAnimationFrame(this._raf);\n }\n this._raf = null;\n this.eventManager.triggerAnimationEnd(!!option?.event);\n }\n }\n\n public getEventInfo(): ChangeEventOption {\n if (\n this._animateParam &&\n this._animateParam.input &&\n this._animateParam.inputEvent\n ) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent,\n };\n } else {\n return null;\n }\n }\n\n public restore(option: ChangeEventOption): void {\n const pos: Axis = this.axisManager.get();\n const destPos: Axis = this.axisManager.map(pos, (v, opt) =>\n Math.min(opt.range[1], Math.max(opt.range[0], v))\n );\n this.stopAnimation();\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n }\n\n public animationEnd(): void {\n const beforeParam: ChangeEventOption = this.getEventInfo();\n this._animateParam = null;\n\n // for Circular\n const circularTargets = this.axisManager.filter(\n this.axisManager.get(),\n (v, opt) => isCircularable(v, opt.range, opt.circular as boolean[])\n );\n if (Object.keys(circularTargets).length > 0) {\n this.setTo(\n this.axisManager.map(circularTargets, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n )\n );\n }\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerAnimationEnd(!!beforeParam);\n if (this.axisManager.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n }\n\n public finish(isTrusted: boolean): void {\n this._animateParam = null;\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerFinish(isTrusted);\n }\n\n public getUserControl(param: AnimationParam): {\n destPos: Axis;\n duration: number;\n } {\n const userWish = param.setTo();\n userWish.destPos = this.axisManager.get(userWish.destPos);\n userWish.duration = clamp(\n userWish.duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n return userWish;\n }\n\n public animateTo(\n destPos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): void {\n this.stopAnimation();\n const param: AnimationParam = this._createAnimationParam(\n destPos,\n duration,\n option\n );\n const depaPos = { ...param.depaPos };\n const retTrigger = this.eventManager.triggerAnimationStart(param);\n\n // to control\n const userWish = this.getUserControl(param);\n\n // You can't stop the 'animationStart' event when 'circular' is true.\n if (\n !retTrigger &&\n this.axisManager.every(userWish.destPos, (v, opt) =>\n isCircularable(v, opt.range, opt.circular as boolean[])\n )\n ) {\n console.warn(\n \"You can't stop the 'animation' event when 'circular' is true.\"\n );\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n const inputEvent = option?.event || null;\n this._animateLoop(\n {\n depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axisManager.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent,\n input: option?.input || null,\n },\n () => this.animationEnd()\n );\n }\n }\n\n public setTo(pos: Axis, duration: number = 0) {\n const axes: string[] = Object.keys(pos);\n const orgPos: Axis = this.axisManager.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n this.interruptManager.setInterrupt(true);\n let movedPos = filter(pos, (v, k) => orgPos[k] !== v);\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axisManager.map(movedPos, (v, opt) => {\n const { range, circular } = opt;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular as boolean[]);\n }\n });\n\n if (equal(movedPos, orgPos)) {\n return this;\n }\n\n if (duration > 0) {\n this.animateTo(movedPos, duration);\n } else {\n this.stopAnimation();\n this.eventManager.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n }\n\n public setBy(pos: Axis, duration = 0) {\n return this.setTo(\n map(this.axisManager.get(Object.keys(pos)), (v, k) => v + pos[k]),\n duration\n );\n }\n\n private _createAnimationParam(\n pos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): AnimationParam {\n const depaPos: Axis = this.axisManager.get();\n const destPos: Axis = pos;\n const inputEvent = option?.event || null;\n return {\n depaPos,\n destPos,\n duration: clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n ),\n delta: this.axisManager.getDelta(depaPos, destPos),\n inputEvent,\n input: option?.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd,\n };\n }\n\n private _animateLoop(param: AnimationParam, complete: () => void): void {\n if (param.duration) {\n this._animateParam = {\n ...param,\n startTime: new Date().getTime(),\n };\n const originalIntendedPos = map(param.destPos, (v) => v);\n let state = this._initState(this._animateParam);\n\n const loop = () => {\n this._raf = null;\n const animateParam = this._animateParam;\n const nextState = this._getNextState(state);\n const isCanceled = !this.eventManager.triggerChange(\n nextState.pos,\n state.pos\n );\n\n state = nextState;\n\n if (nextState.finished) {\n animateParam.destPos = this._getFinalPos(\n animateParam.destPos,\n originalIntendedPos\n );\n if (\n !equal(\n animateParam.destPos,\n this.axisManager.get(Object.keys(animateParam.destPos))\n )\n ) {\n this.eventManager.triggerChange(\n animateParam.destPos,\n nextState.pos\n );\n }\n complete();\n return;\n } else if (isCanceled) {\n this.finish(false);\n } else {\n this._raf = requestAnimationFrame(loop);\n }\n };\n loop();\n } else {\n this.eventManager.triggerChange(param.destPos);\n complete();\n }\n }\n\n /**\n * Get estimated final value.\n *\n * If destPos is within the 'error range' of the original intended position, the initial intended position is returned.\n * - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100;\n * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos.\n * - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123\n * @param originalIntendedPos\n * @param destPos\n */\n private _getFinalPos(\n destPos: ObjectInterface,\n originalIntendedPos: ObjectInterface\n ): Axis {\n // compare destPos and originalIntendedPos\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const ERROR_LIMIT = 0.000001;\n const finalPos = map(destPos, (value, key) => {\n if (\n value >= originalIntendedPos[key] - ERROR_LIMIT &&\n value <= originalIntendedPos[key] + ERROR_LIMIT\n ) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n const roundUnit = this._getRoundUnit(value, key);\n const result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n }\n\n private _getRoundUnit(val: number, key: string): number {\n const roundUnit = this._options.round; // manual mode\n let minRoundUnit = null; // auto mode\n\n // auto mode\n if (!roundUnit) {\n // Get minimum round unit\n const options = this.axisManager.getAxisOptions(key);\n minRoundUnit = inversePow(\n Math.max(\n getDecimalPlace(options.range[0]),\n getDecimalPlace(options.range[1]),\n getDecimalPlace(val)\n )\n );\n }\n\n return minRoundUnit || roundUnit;\n }\n}\n","import { AxesOption } from \"../Axes\";\nimport { Axis } from \"../AxisManager\";\nimport { getCirculatedPos } from \"../Coordinate\";\nimport { AnimationParam, UpdateAnimationOption } from \"../types\";\nimport { map } from \"../utils\";\n\nimport { AnimationManager, AnimationState } from \"./AnimationManager\";\n\nexport class EasingManager extends AnimationManager {\n protected _useDuration = true;\n protected _options: AxesOption;\n private _durationOffset: number;\n private _initialEasingPer: number;\n private _prevEasingPer: number;\n\n public interpolate(displacement: number, threshold: number): number {\n const initSlope = this._easing(0.00001) / 0.00001;\n return this._easing(displacement / (threshold * initSlope)) * threshold;\n }\n\n public updateAnimation(options: UpdateAnimationOption): void {\n const animateParam = this._animateParam;\n if (!animateParam) {\n return;\n }\n\n const diffTime = new Date().getTime() - animateParam.startTime;\n const pos = options?.destPos || animateParam.destPos;\n const duration = options?.duration || animateParam.duration;\n if (options?.restart || duration <= diffTime) {\n this.setTo(pos, duration - diffTime);\n return;\n }\n if (options?.destPos) {\n const currentPos = this.axisManager.get();\n // When destination is changed, new delta should be calculated as remaining percent.\n // For example, moving x:0, y:0 to x:200, y:200 and it has current easing percent of 92%. coordinate is x:184 and y:184\n // If destination changes to x:300, y:300. xdelta:200, ydelta:200 changes to xdelta:116, ydelta:116 and use remaining easingPer as 100%, not 8% as previous.\n // Therefore, original easingPer by time is kept. And divided by (1 - self._initialEasingPer) which means new total easing percent. Like calculating 8% as 100%.\n this._initialEasingPer = this._prevEasingPer;\n animateParam.delta = this.axisManager.getDelta(currentPos, pos);\n animateParam.destPos = pos;\n }\n if (options?.duration) {\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n // Use durationOffset for keeping animation ratio after duration is changed.\n // newRatio = (diffTime + newDurationOffset) / newDuration = oldRatio\n // newDurationOffset = oldRatio * newDuration - diffTime\n this._durationOffset = ratio * duration - diffTime;\n animateParam.duration = duration;\n }\n }\n\n protected _initState(info: AnimationParam): AnimationState {\n this._initialEasingPer = 0;\n this._prevEasingPer = 0;\n this._durationOffset = 0;\n return {\n pos: info.depaPos,\n easingPer: 0,\n finished: false,\n };\n }\n\n protected _getNextState(prevState: AnimationState): AnimationState {\n const animateParam = this._animateParam;\n const prevPos = prevState.pos;\n const destPos = animateParam.destPos;\n const directions = map(prevPos, (value, key) => {\n return value <= destPos[key] ? 1 : -1;\n });\n const diffTime = new Date().getTime() - animateParam.startTime;\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n const easingPer = this._easing(ratio);\n\n const toPos: Axis = this.axisManager.map(prevPos, (pos, options, key) => {\n const nextPos =\n ratio >= 1\n ? destPos[key]\n : pos +\n (animateParam.delta[key] * (easingPer - this._prevEasingPer)) /\n (1 - this._initialEasingPer);\n\n // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n const circulatedPos = getCirculatedPos(\n nextPos,\n options.range,\n options.circular as boolean[]\n );\n if (nextPos !== circulatedPos) {\n // circular\n const rangeOffset =\n directions[key] * (options.range[1] - options.range[0]);\n\n destPos[key] -= rangeOffset;\n prevPos[key] -= rangeOffset;\n }\n return circulatedPos;\n });\n this._prevEasingPer = easingPer;\n return {\n pos: toPos,\n easingPer,\n finished: easingPer >= 1,\n };\n }\n\n private _easing(p: number): number {\n return p > 1 ? 1 : this._options.easing(p);\n }\n}\n","import Component from \"@egjs/component\";\n\nimport { EventManager } from \"./EventManager\";\nimport { InterruptManager } from \"./InterruptManager\";\nimport { AxisManager, AxisOption, Axis } from \"./AxisManager\";\nimport { InputObserver } from \"./InputObserver\";\nimport {\n TRANSFORM,\n DIRECTION_NONE,\n DIRECTION_LEFT,\n DIRECTION_RIGHT,\n DIRECTION_UP,\n DIRECTION_DOWN,\n DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL,\n DIRECTION_ALL,\n} from \"./const\";\nimport { InputType } from \"./inputType/InputType\";\nimport { AxesEvents, ObjectInterface, UpdateAnimationOption } from \"./types\";\nimport { EasingManager } from \"./animation/EasingManager\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface AxesOption {\n easing?: (x: number) => number;\n maximumDuration?: number;\n minimumDuration?: number;\n deceleration?: number;\n interruptable?: boolean;\n round?: number;\n nested?: boolean;\n}\n\n/**\n * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system.\n * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {Number[]} [range] The coordinate of range 좌표 범위\n * @param {Number} [range[0]=0] The coordinate of the minimum 최소 좌표\n * @param {Number} [range[1]=0] The coordinate of the maximum 최대 좌표\n * @param {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바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @param {Number} [bounce[0]=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @param {Number} [bounce[1]=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @param {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.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @param {Boolean} [circular[0]=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @param {Boolean} [circular[1]=false] Indicates whether to circulate to the coordinate of the maximum 최대 좌표 방향의 순환 여부\n **/\n\n/**\n * @typedef {Object} AxesOption The option object of the eg.Axes module\n * @ko eg.Axes 모듈의 옵션 객체\n * @param {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @param {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @param {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @param {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @param {Boolean} [interruptable=true] Indicates whether an animation is interruptible.\n * - true: It can be paused or stopped by user action or the API.\n * - false: It cannot be paused or stopped by user action or the API while it is running.\n * 진행 중인 애니메이션 중지 가능 여부.\n * - true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다.\n * - false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다\n * @param {Number} [round=null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)\n * [Details](https://github.com/naver/egjs-axes/wiki/round-option)반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95).\n * [상세내용](https://github.com/naver/egjs-axes/wiki/round-option)\n * @param {Boolean} [nested=false] Whether the event propagates to other instances when the coordinates reach the end of the movable area 좌표가 이동 가능한 영역의 끝까지 도달했을 때 다른 인스턴스들로의 이벤트 전파 여부\n **/\n\n/**\n * 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.\n * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다.\n * @extends eg.Component\n *\n * @param {Object.} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {AxesOption} [options={}] The option object of the eg.Axes moduleeg.Axes 모듈의 옵션 객체\n * @param {Object.} [startPos=null] The coordinates to be moved when creating an instance. not triggering change event.인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음.\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n * ```js\n * // 1. Initialize eg.Axes\n * const axes = new eg.Axes({\n *\tsomething1: {\n *\t\trange: [0, 150],\n *\t\tbounce: 50\n *\t},\n *\tsomething2: {\n *\t\trange: [0, 200],\n *\t\tbounce: 100\n *\t},\n *\tsomethingN: {\n *\t\trange: [1, 10],\n *\t}\n * }, {\n * deceleration : 0.0024\n * });\n *\n * // 2. attach event handler\n * axes.on({\n *\t\"hold\" : function(evt) {\n *\t},\n *\t\"release\" : function(evt) {\n *\t},\n *\t\"animationStart\" : function(evt) {\n *\t},\n *\t\"animationEnd\" : function(evt) {\n *\t},\n *\t\"change\" : function(evt) {\n *\t}\n * });\n *\n * // 3. Initialize inputTypes\n * const panInputArea = new eg.Axes.PanInput(\"#area\", {\n *\tscale: [0.5, 1]\n * });\n * const panInputHmove = new eg.Axes.PanInput(\"#hmove\");\n * const panInputVmove = new eg.Axes.PanInput(\"#vmove\");\n * const pinchInputArea = new eg.Axes.PinchInput(\"#area\", {\n *\tscale: 1.5\n * });\n *\n * // 4. Connect eg.Axes and InputTypes\n * // [PanInput] When the mouse or touchscreen is down and moved.\n * // Connect the 'something2' axis to the mouse or touchscreen x position and\n * // connect the 'somethingN' axis to the mouse or touchscreen y position.\n * axes.connect([\"something2\", \"somethingN\"], panInputArea); // or axes.connect(\"something2 somethingN\", panInputArea);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position.\n * axes.connect([\"something1\"], panInputHmove); // or axes.connect(\"something1\", panInputHmove);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position.\n * axes.connect([\"\", \"something2\"], panInputVmove); // or axes.connect(\" something2\", panInputVmove);\n *\n * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something2\", pinchInputArea);\n * ```\n */\nclass Axes extends Component {\n /**\n * @name VERSION\n * @desc Version info string\n * @ko 버전정보 문자열\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.VERSION; // ex) 3.3.3\n * ```\n */\n public static VERSION = \"#__VERSION__#\";\n /* eslint-disable */\n // for tree shaking\n public static PanInput;\n public static PinchInput;\n public static WheelInput;\n public static MoveKeyInput;\n public static RotatePanInput;\n /* eslint-enable */\n\n /**\n * @name TRANSFORM\n * @desc Returns the transform attribute with CSS vendor prefixes.\n * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다.\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n * ```\n */\n public static TRANSFORM = TRANSFORM;\n /**\n * @name DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n public static DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name DIRECTION_UP\n * @constant\n * @type {Number}\n */\n public static DIRECTION_UP = DIRECTION_UP;\n /**\n * @name DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n public static DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_ALL = DIRECTION_ALL;\n\n public options: AxesOption;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n public interruptManager: InterruptManager;\n public animationManager: AnimationManager;\n public inputObserver: InputObserver;\n private _inputs: InputType[] = [];\n\n /**\n *\n */\n public constructor(\n public axis: ObjectInterface = {},\n options: AxesOption = {},\n startPos: Axis = null\n ) {\n super();\n this.options = {\n ...{\n easing: (x) => {\n return 1 - Math.pow(1 - x, 3);\n },\n interruptable: true,\n maximumDuration: Infinity,\n minimumDuration: 0,\n deceleration: 0.0006,\n round: null,\n nested: false,\n },\n ...options,\n };\n\n this.interruptManager = new InterruptManager(this.options);\n this.axisManager = new AxisManager(this.axis);\n this.eventManager = new EventManager(this);\n this.animationManager = new EasingManager(this);\n this.inputObserver = new InputObserver(this);\n this.eventManager.setAnimationManager(this.animationManager);\n if (startPos) {\n this.eventManager.triggerChange(startPos);\n }\n }\n\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @param {(String[]|String)} axes The name of the axis to associate with inputType inputType과 연결할 축의 이름\n * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes eg.Axes의 축과 연결할 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * axes.connect(\"x\", new eg.Axes.PanInput(\"#area1\"))\n * .connect(\"x xOther\", new eg.Axes.PanInput(\"#area2\"))\n * .connect(\" xOther\", new eg.Axes.PanInput(\"#area3\"))\n * .connect([\"x\"], new eg.Axes.PanInput(\"#area4\"))\n * .connect([\"xOther\", \"x\"], new eg.Axes.PanInput(\"#area5\"))\n * .connect([\"\", \"xOther\"], new eg.Axes.PanInput(\"#area6\"));\n * ```\n */\n public connect(axes: string[] | string, inputType: InputType) {\n let mapped: string[];\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n }\n\n // check same instance\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.inputObserver);\n this._inputs.push(inputType);\n return this;\n }\n\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * const input1 = new eg.Axes.PanInput(\"#area1\");\n * const input2 = new eg.Axes.PanInput(\"#area2\");\n * const input3 = new eg.Axes.PanInput(\"#area3\");\n *\n * axes.connect(\"x\", input1);\n * .connect(\"x xOther\", input2)\n * .connect([\"xOther\", \"x\"], input3);\n *\n * axes.disconnect(input1); // disconnects input1\n * axes.disconnect(); // disconnects all of them\n * ```\n */\n public disconnect(inputType?: InputType) {\n if (inputType) {\n const index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach((v) => v.disconnect());\n this._inputs = [];\n }\n return this;\n }\n\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.get(); // {\"x\": 0, \"xOther\": -100, \"zoom\": 50}\n * axes.get([\"x\", \"zoom\"]); // {\"x\": 0, \"zoom\": 50}\n * ```\n */\n public get(axes?: string[]) {\n return this.axisManager.get(axes);\n }\n\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setTo({\"x\": 30, \"zoom\": 60});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setTo({\"x\": 100, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": 60, \"zoom\": 60}\n * ```\n */\n public setTo(pos: Axis, duration = 0) {\n this.animationManager.setTo(pos, duration);\n return this;\n }\n\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setBy({\"x\": 30, \"zoom\": 10});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setBy({\"x\": 70, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": -40, \"zoom\": 60}\n * ```\n */\n public setBy(pos: Axis, duration = 0) {\n this.animationManager.setBy(pos, duration);\n return this;\n }\n\n /**\n * Stop an animation in progress.\n * @ko 재생 중인 애니메이션을 정지한다.\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * });\n *\n * axes.setTo({\"x\": 10}, 1000); // start animatation\n *\n * // after 500 ms\n * axes.stopAnimation(); // stop animation during movement.\n * ```\n */\n public stopAnimation() {\n this.animationManager.stopAnimation();\n return this;\n }\n\n /**\n * Change the destination of an animation in progress.\n * @ko 재생 중인 애니메이션의 목적지와 진행 시간을 변경한다.\n * @param {UpdateAnimationOption} pos The coordinate to move to 이동할 좌표\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 200]\n * },\n * \"y\": {\n * range: [0, 200]\n * }\n * });\n *\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 500 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}}); // animation will end after 500 ms, at {\"x\": 100, \"y\": 100}\n *\n * // after 500 ms\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 700 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}, duration: 1500, restart: true}); // this works same as axes.setTo({\"x\": 100, \"y\": 100}, 800) since restart is true.\n * ```\n */\n public updateAnimation(options: UpdateAnimationOption) {\n this.animationManager.updateAnimation(options);\n return this;\n }\n\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.isBounceArea([\"x\"]);\n * axes.isBounceArea([\"x\", \"zoom\"]);\n * axes.isBounceArea();\n * ```\n */\n public isBounceArea(axes?: string[]) {\n return this.axisManager.isOutside(axes);\n }\n\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n */\n public destroy() {\n this.disconnect();\n this.eventManager.destroy();\n }\n}\n\nexport default Axes;\n","/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport {\n IS_IOS_SAFARI,\n IOS_EDGE_THRESHOLD,\n DIRECTION_NONE,\n DIRECTION_VERTICAL,\n DIRECTION_HORIZONTAL,\n DIRECTION_ALL,\n MOUSE_LEFT,\n} from \"../const\";\nimport { ActiveEvent, InputEventType } from \"../types\";\n\nimport {\n convertInputType,\n InputType,\n InputTypeObserver,\n toAxis,\n} from \"./InputType\";\n\nexport interface PanInputOption {\n inputType?: string[];\n inputButton?: string[];\n scale?: number[];\n thresholdAngle?: number;\n threshold?: number;\n iOSEdgeSwipeThreshold?: number;\n releaseOnScroll?: boolean;\n touchAction?: string;\n}\n\n// get user's direction\nexport const getDirectionByAngle = (\n angle: number,\n thresholdAngle: number\n): number => {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n const toAngle = Math.abs(angle);\n\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle\n ? DIRECTION_VERTICAL\n : DIRECTION_HORIZONTAL;\n};\n\nexport const useDirection = (checkType, direction, userDirection?): boolean => {\n if (userDirection) {\n return !!(\n direction === DIRECTION_ALL ||\n (direction & checkType && userDirection & checkType)\n );\n } else {\n return !!(direction & checkType);\n }\n};\n\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @param {String[]} [inputType=[\"touch\", \"mouse\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - mouse: Mouse\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - mouse: 마우스\n * - pointer: 마우스 및 터치\n * @param {String[]} [inputButton=[\"left\"]] List of buttons to allow input\n * - left: Left mouse button and normal touch\n * - middle: Mouse wheel press\n * - right: Right mouse button 입력을 허용할 버튼 목록\n * - left: 마우스 왼쪽 버튼\n * - middle: 마우스 휠 눌림\n * - right: 마우스 오른쪽 버튼 \n * @param {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] horizontal axis scale 수평축 배율\n * @param {Number} [scale[1]=1] vertical axis scale 수직축 배율\n * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @param {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @param {String} [touchAction=null] Value that overrides the element's \"touch-action\" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다.\n **/\n/**\n * 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.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\n * ```js\n * const pan = new eg.Axes.PanInput(\"#area\", {\n * \t\tinputType: [\"touch\"],\n * \t\tscale: [1, 1.3],\n * });\n *\n * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something2\", \"somethingN\"], pan); // or axes.connect(\"something2 somethingN\", pan);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something1\"], pan); // or axes.connect(\"something1\", pan);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"\", \"something2\"], pan); // or axes.connect(\" something2\", pan);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module eg.Axes.PanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options={}] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n */\nexport class PanInput implements InputType {\n public options: PanInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n protected _observer: InputTypeObserver;\n protected _direction: number;\n protected _enabled = false;\n protected _activeEvent: ActiveEvent = null;\n private _originalCssProps: { [key: string]: string };\n private _atRightEdge = false;\n private _rightEdgeTimer = 0;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n this.element = $(el);\n this.options = {\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n inputButton: [MOUSE_LEFT],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n releaseOnScroll: false,\n touchAction: null,\n ...options,\n };\n this._onPanstart = this._onPanstart.bind(this);\n this._onPanmove = this._onPanmove.bind(this);\n this._onPanend = this._onPanend.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n const useHorizontal = !!axes[0];\n const useVertical = !!axes[1];\n if (useHorizontal && useVertical) {\n this._direction = DIRECTION_ALL;\n } else if (useHorizontal) {\n this._direction = DIRECTION_HORIZONTAL;\n } else if (useVertical) {\n this._direction = DIRECTION_VERTICAL;\n } else {\n this._direction = DIRECTION_NONE;\n }\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n }\n this._attachElementEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n this._direction\n );\n return this;\n }\n\n public disconnect() {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n this._direction = DIRECTION_NONE;\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n protected _onPanstart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n const edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n\n this._observer.hold(this, panEvent);\n this._atRightEdge =\n IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold;\n this._attachWindowEvent(activeEvent);\n activeEvent.prevEvent = panEvent;\n }\n }\n\n protected _onPanmove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n const { iOSEdgeSwipeThreshold, releaseOnScroll } = this.options;\n const userDirection = getDirectionByAngle(\n panEvent.angle,\n this.options.thresholdAngle\n );\n\n if (releaseOnScroll && !panEvent.srcEvent.cancelable) {\n this._onPanend(event);\n return;\n }\n\n if (activeEvent.prevEvent && IS_IOS_SAFARI) {\n const swipeLeftToRight = panEvent.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this._forceRelease();\n return;\n } else if (this._atRightEdge) {\n clearTimeout(this._rightEdgeTimer);\n\n // - is right to left\n const swipeRightToLeft = panEvent.deltaX < -iOSEdgeSwipeThreshold;\n\n if (swipeRightToLeft) {\n this._atRightEdge = false;\n } else {\n // iOS swipe right => left\n this._rightEdgeTimer = window.setTimeout(\n () => this._forceRelease(),\n 100\n );\n }\n }\n }\n const offset: number[] = this._getOffset(\n [panEvent.offsetX, panEvent.offsetY],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection),\n useDirection(DIRECTION_VERTICAL, this._direction, userDirection),\n ]\n );\n const prevent = offset.some((v) => v !== 0);\n\n if (prevent) {\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n }\n panEvent.preventSystemEvent = prevent;\n if (prevent) {\n this._observer.change(this, panEvent, toAxis(this.axes, offset));\n }\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this._enabled || activeEvent.getTouches(event) !== 0) {\n return;\n }\n this._detachWindowEvent(activeEvent);\n clearTimeout(this._rightEdgeTimer);\n const prevEvent = activeEvent.prevEvent;\n const velocity = this._getOffset(\n [\n Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1),\n Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1),\n ],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction),\n useDirection(DIRECTION_VERTICAL, this._direction),\n ]\n );\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, velocity);\n }\n\n protected _attachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.addEventListener(event, this._onPanmove, { passive: false });\n });\n activeEvent?.end.forEach((event) => {\n window.addEventListener(event, this._onPanend, { passive: false });\n });\n }\n\n protected _detachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.removeEventListener(event, this._onPanmove);\n });\n activeEvent?.end.forEach((event) => {\n window.removeEventListener(event, this._onPanend);\n });\n }\n\n protected _getOffset(properties: number[], direction: boolean[]): number[] {\n const offset: number[] = [0, 0];\n const scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n return offset;\n }\n\n private _attachElementEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element?.addEventListener(event, this._onPanstart);\n });\n // adding event listener to element prevents invalid behavior in iOS Safari\n activeEvent.move.forEach((event) => {\n this.element?.addEventListener(event, this._voidFunction);\n });\n }\n\n private _detachElementEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element?.removeEventListener(event, this._onPanstart);\n });\n activeEvent?.move.forEach((event) => {\n this.element?.removeEventListener(event, this._voidFunction);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _forceRelease = () => {\n const activeEvent = this._activeEvent;\n const prevEvent = activeEvent.prevEvent;\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [0, 0]);\n this._detachWindowEvent(activeEvent);\n };\n\n private _voidFunction = () => {};\n}\n","import { ExtendedEvent } from \"../types\";\nimport Axes from \"../Axes\";\nimport { getAngle } from \"../utils\";\n\nimport { toAxis } from \"./InputType\";\nimport { PanInput, PanInputOption } from \"./PanInput\";\n\n/**\n * A module that passes the angle moved by touch to Axes and uses one axis of rotation.\n * [Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.\n * [상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\n * ```js\n * const input = new eg.Axes.RotatePanInput(\"#area\");\n *\n * var axes = new eg.Axes({\n *\t// property name('angle') could be anything you want (eg. x, y, z...)\n * \tangle: {\n * \t\trange: [-180, 180] // from -180deg to 180deg\n * \t}\n * });\n *\n * axes.connect(\"angle\", input)\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n * @extends PanInput\n */\nexport class RotatePanInput extends PanInput {\n private _rotateOrigin: number[];\n private _prevAngle: number;\n private _prevQuadrant: number = null;\n private _lastDiff = 0;\n private _coefficientForDistanceToAngle: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n super(el, options);\n }\n\n public mapAxes(axes: string[]) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n }\n\n protected _onPanstart(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n const rect = this.element.getBoundingClientRect();\n\n this._observer.hold(this, panEvent);\n this._attachWindowEvent(activeEvent);\n // TODO: how to do if element is ellipse not circle.\n this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360\n // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin\n this._rotateOrigin = [\n rect.left + (rect.width - 1) / 2,\n rect.top + (rect.height - 1) / 2,\n ];\n\n // init angle.\n this._prevAngle = null;\n\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanmove(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this.isEnabled()) {\n return;\n }\n const prevEvent = activeEvent.prevEvent;\n this._triggerChange(prevEvent);\n const vx = prevEvent.velocityX;\n const vy = prevEvent.velocityY;\n const velocity =\n Math.sqrt(vx * vx + vy * vy) * (this._lastDiff > 0 ? -1 : 1); // clockwise\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [\n velocity * this._coefficientForDistanceToAngle,\n ]);\n this._detachWindowEvent(activeEvent);\n }\n\n private _triggerChange(event: ExtendedEvent) {\n const { x, y } = this._getPosFromOrigin(event.center.x, event.center.y);\n const angle = getAngle(x, y);\n const positiveAngle = angle < 0 ? 360 + angle : angle;\n const quadrant = this._getQuadrant(event.center.x, event.center.y);\n const diff = this._getDifference(\n this._prevAngle,\n positiveAngle,\n this._prevQuadrant,\n quadrant\n );\n\n this._prevAngle = positiveAngle;\n this._prevQuadrant = quadrant;\n\n if (diff === 0) {\n return;\n }\n\n this._lastDiff = diff;\n this._observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise\n }\n\n private _getDifference(\n prevAngle: number,\n angle: number,\n prevQuadrant: number,\n quadrant: number\n ) {\n let diff: number;\n\n if (prevAngle === null) {\n diff = 0;\n } else if (prevQuadrant === 1 && quadrant === 4) {\n diff = -prevAngle - (360 - angle);\n } else if (prevQuadrant === 4 && quadrant === 1) {\n diff = 360 - prevAngle + angle;\n } else {\n diff = angle - prevAngle;\n }\n\n return diff;\n }\n\n private _getPosFromOrigin(posX: number, posY: number) {\n return {\n x: posX - this._rotateOrigin[0],\n y: this._rotateOrigin[1] - posY,\n };\n }\n\n private _getQuadrant(posX: number, posY: number) {\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n const { x, y } = this._getPosFromOrigin(posX, posY);\n let q = 0;\n\n if (x >= 0 && y >= 0) {\n q = 1;\n } else if (x < 0 && y >= 0) {\n q = 2;\n } else if (x < 0 && y < 0) {\n q = 3;\n } else if (x >= 0 && y < 0) {\n q = 4;\n }\n return q;\n }\n}\n","import { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport { ActiveEvent, InputEventType } from \"../types\";\nimport { DIRECTION_ALL } from \"../const\";\n\nimport {\n toAxis,\n convertInputType,\n InputType,\n InputTypeObserver,\n} from \"./InputType\";\n\nexport interface PinchInputOption {\n scale?: number;\n threshold?: number;\n inputType?: string[];\n touchAction?: string;\n}\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @param {String[]} [inputType=[\"touch\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - pointer: 마우스 및 터치\n * @param {String} [touchAction=\"none\"] Value that overrides the element's \"touch-action\" css property. It is set to \"none\" to prevent scrolling during touch. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 터치 도중 스크롤을 방지하기 위해 \"none\" 으로 설정되어 있다.\n **/\n\n/**\n * 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.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\n * ```js\n * const pinch = new eg.Axes.PinchInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something\", pinch);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module eg.Axes.PinchInput 모듈을 사용할 엘리먼트\n * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput moduleeg.Axes.PinchInput 모듈의 옵션 객체\n */\nexport class PinchInput implements InputType {\n public options: PinchInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _pinchFlag = false;\n private _enabled = false;\n private _originalCssProps: { [key: string]: string };\n private _activeEvent: ActiveEvent = null;\n private _baseValue: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PinchInputOption) {\n this.element = $(el);\n this.options = {\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n touchAction: \"none\",\n ...options,\n };\n this._onPinchStart = this._onPinchStart.bind(this);\n this._onPinchMove = this._onPinchMove.bind(this);\n this._onPinchEnd = this._onPinchEnd.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachEvent();\n }\n this._attachEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n DIRECTION_ALL\n );\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onPinchStart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventStart(event);\n if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) {\n return;\n }\n\n this._baseValue = this._observer.get(this)[this.axes[0]];\n this._observer.hold(this, event);\n this._pinchFlag = true;\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchMove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventMove(event);\n if (\n !pinchEvent ||\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) !== 2\n ) {\n return;\n }\n\n const offset = this._getOffset(\n pinchEvent.scale,\n activeEvent.prevEvent.scale\n );\n this._observer.change(this, event, toAxis(this.axes, [offset]));\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchEnd(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) >= 2\n ) {\n return;\n }\n\n activeEvent.onRelease();\n this._observer.release(this, event, [0], 0);\n this._baseValue = null;\n this._pinchFlag = false;\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element.addEventListener(event, this._onPinchStart, false);\n });\n activeEvent.move.forEach((event) => {\n this.element.addEventListener(event, this._onPinchMove, false);\n });\n activeEvent.end.forEach((event) => {\n this.element.addEventListener(event, this._onPinchEnd, false);\n });\n }\n\n private _detachEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchStart, false);\n });\n activeEvent?.move.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchMove, false);\n });\n activeEvent?.end.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchEnd, false);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _getOffset(pinchScale: number, prev: number = 1): number {\n return this._baseValue * (pinchScale - prev) * this.options.scale;\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport interface WheelInputOption {\n scale?: number;\n releaseDelay?: number;\n useNormalized?: boolean;\n useAnimation?: boolean;\n}\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [releaseDelay=300] Millisecond that trigger release event after last input마지막 입력 이후 release 이벤트가 트리거되기까지의 밀리초\n * @param {Boolean} [useNormalized=true] Whether to calculate scroll speed the same in all browsers모든 브라우저에서 스크롤 속도를 동일하게 처리할지 여부\n * @param {Boolean} [useAnimation=false] Whether to process coordinate changes through the mouse wheel as a continuous animation마우스 휠을 통한 좌표 변화를 연속적인 애니메이션으로 처리할지 여부\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis.\n * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const wheel = new eg.Axes.WheelInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when the mousewheel is moved.\n * axes.connect(\"something\", wheel);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module eg.Axes.WheelInput 모듈을 사용할 엘리먼트\n * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput moduleeg.Axes.WheelInput 모듈의 옵션 객체\n */\nexport class WheelInput implements InputType {\n public options: WheelInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: WheelInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: 1,\n releaseDelay: 300,\n useNormalized: true,\n useAnimation: false,\n },\n ...options,\n };\n this._onWheel = this._onWheel.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onWheel(event: WheelEvent) {\n if (!this._enabled) {\n return;\n }\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n const offset =\n (event.deltaY > 0 ? -1 : 1) *\n this.options.scale *\n (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this._observer.change(\n this,\n event,\n toAxis(this.axes, [offset]),\n this.options.useAnimation\n );\n clearTimeout(this._timer);\n\n this._timer = setTimeout(() => {\n if (this._holding) {\n this._holding = false;\n this._observer.release(this, event, [0]);\n }\n }, this.options.releaseDelay);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"wheel\", this._onWheel);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"wheel\", this._onWheel);\n this._enabled = false;\n this._observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport const KEY_LEFT_ARROW = 37;\nexport const KEY_A = 65;\nexport const KEY_UP_ARROW = 38;\nexport const KEY_W = 87;\nexport const KEY_RIGHT_ARROW = 39;\nexport const KEY_D = 68;\nexport const KEY_DOWN_ARROW = 40;\nexport const KEY_S = 83;\n\n/* eslint-disable */\nconst DIRECTION_REVERSE = -1;\nconst DIRECTION_FORWARD = 1;\nconst DIRECTION_HORIZONTAL = -1;\nconst DIRECTION_VERTICAL = 1;\nconst DELAY = 80;\n/* eslint-enable */\n\nexport interface MoveKeyInputOption {\n scale?: number[];\n}\n\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @param {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @param {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis.\n * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const moveKey = new eg.Axes.MoveKeyInput(\"#area\", {\n * \t\tscale: [1, 1]\n * });\n *\n * // Connect 'x', 'y' axes when the moveKey is pressed.\n * axes.connect([\"x\", \"y\"], moveKey);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트\n * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput moduleeg.Axes.MoveKeyInput 모듈의 옵션 객체\n */\nexport class MoveKeyInput implements InputType {\n public options: MoveKeyInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: MoveKeyInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: [1, 1],\n },\n ...options,\n };\n this._onKeydown = this._onKeydown.bind(this);\n this._onKeyup = this._onKeyup.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n\n // add tabindex=\"0\" to the container for making it focusable\n if (this.element.getAttribute(\"tabindex\") !== \"0\") {\n this.element.setAttribute(\"tabindex\", \"0\");\n }\n\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onKeydown(event: KeyboardEvent) {\n if (!this._enabled) {\n return;\n }\n\n let isMoveKey = true;\n let direction = DIRECTION_FORWARD;\n let move = DIRECTION_HORIZONTAL;\n\n switch (event.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL;\n break;\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL;\n break;\n default:\n isMoveKey = false;\n }\n if (\n (move === DIRECTION_HORIZONTAL && !this.axes[0]) ||\n (move === DIRECTION_VERTICAL && !this.axes[1])\n ) {\n isMoveKey = false;\n }\n if (!isMoveKey) {\n return;\n }\n event.preventDefault();\n const offsets =\n move === DIRECTION_HORIZONTAL\n ? [+this.options.scale[0] * direction, 0]\n : [0, +this.options.scale[1] * direction];\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n clearTimeout(this._timer);\n this._observer.change(this, event, toAxis(this.axes, offsets));\n }\n\n private _onKeyup(event: KeyboardEvent) {\n if (!this._holding) {\n return;\n }\n clearTimeout(this._timer);\n this._timer = setTimeout(() => {\n this._observer.release(this, event, [0, 0]);\n this._holding = false;\n }, DELAY);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"keydown\", this._onKeydown, false);\n this.element.addEventListener(\"keypress\", this._onKeydown, false);\n this.element.addEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"keydown\", this._onKeydown, false);\n this.element.removeEventListener(\"keypress\", this._onKeydown, false);\n this.element.removeEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = false;\n this._observer = null;\n }\n}\n"],"names":["win","window","navigator","userAgent","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_HORIZONTAL","DIRECTION_UP","DIRECTION_DOWN","DIRECTION_VERTICAL","DIRECTION_ALL","MOUSE_LEFT","MOUSE_RIGHT","MOUSE_MIDDLE","VELOCITY_INTERVAL","IOS_EDGE_THRESHOLD","IS_IOS_SAFARI","getAgent","browser","name","TRANSFORM","document","bodyStyle","head","getElementsByTagName","style","target","i","len","length","PREVENT_DRAG_CSSPROPS","toArray","nodes","el","push","$","param","multi","match","dummy","createElement","innerHTML","childNodes","querySelectorAll","undefined","nodeName","nodeType","jQuery","constructor","prototype","jquery","get","Array","isArray","map","v","raf","requestAnimationFrame","webkitRequestAnimationFrame","caf","cancelAnimationFrame","webkitCancelAnimationFrame","keyInfo_1","oldraf_1","callback","wrapCallback","timestamp","key","setTimeout","performance","now","Date","getTime","clearTimeout","fp","obj","tranformed","k","filter","filtered","every","equal","base","roundNumFunc","roundNumber","num","roundUnit","getRoundFunc","roundNumbers","value","getDecimalPlace","val","isFinite","indexOf","p","e","Math","round","inversePow","n","pow","getAngle","posX","posY","atan2","PI","isCssPropsFromAxes","originalCssProps","same","Object","keys","forEach","prop","setCssProps","element","option","direction","touchActionMap","_a","oldCssProps","touchAction","newCssProps_1","revertCssProps","_axes","pos","roundPos","_getRoundPos","trigger","ComponentEvent","input","inputEvent","event","isTrusted","destPos","depaPos","roundDepa","setTo","_createUserControll","duration","__assign","bounceRatio","_getBounceRatio","holding","animationManager","axisManager","eventInfo","getEventInfo","moveTo","delta","set","isCanceled","off","userControl","toPos","userDuration","options","opt","range","bounce","_options","interruptable","_prevented","prevented","getInsidePosition","circular","toDestPos","targetRange","max","min","isOutside","isEndofBounce","getDuration","distance","deceleration","sqrt","isCircularable","getCirculatedPos","_axis","_complementOptions","_pos","reduce","acc","_this","fullDepaPos","axes","axisOptions","axis","axisOption","test","SUPPORT_TOUCH","SUPPORT_POINTER","SUPPORT_MSPOINTER","SUPPORT_POINTER_EVENTS","preventDefault","removeEventListener","_stopContextMenu","prevEvent","center","_getCenter","movement","_getMovement","x","y","scale","_getScale","angle","deltaX","deltaY","offsetX","offsetY","latestInterval","_latestInterval","timeStamp","deltaTime","velocityX","velocityY","srcEvent","preventSystemEvent","start","end","clientX","clientY","buttonCodeMap","button","_isTouchEvent","buttons","type","inputButton","addEventListener","__extends","_getButton","_isValidButton","_preventMouseButton","extendEvent","prev","EventInput","_baseTouches","touches","_getDistance","identifier","_updatePointerEvent","_removePointerEvent","_firstInputs","_recentInputs","pointerId","addFlag","id","nextSpot","prevSpot","toAxis","source","offset","convertInputType","inputType","hasTouch","hasMouse","hasPointer","PointerEventInput","TouchMouseEventInput","TouchEventInput","MouseEventInput","interruptManager","eventManager","_interruptManager","_eventManager","_axisManager","_animationManager","isInterrupted","changeOption","_isStopped","setInterrupt","stopAnimation","_moveDistance","hold","_isOutside","useAnimation","isInterrupting","nativeEvent","__childrenAxesAlreadyChanged","_atOutside","nested","_isEndofAxis","animateTo","triggerChange","finish","velocity","inputDuration","__childrenAxesAlreadyReleased","displacement","getDisplacement","getDelta","triggerRelease","userWish","getUserControl","isEqual","restore","triggerFinish","tn","tx","out","interpolate","clamp","animationEnd","bind","wishDuration","durations_1","abs","Infinity","minimumDuration","maximumDuration","totalVelocity","total","_animateParam","orgPos_1","_raf","triggerAnimationEnd","beforeParam","circularTargets","_createAnimationParam","retTrigger","triggerAnimationStart","console","warn","_animateLoop","orgPos","movedPos","done","complete","startTime","originalIntendedPos_1","state_1","_initState","loop_1","animateParam","nextState","_getNextState","finished","_getFinalPos","originalIntendedPos","ERROR_LIMIT","finalPos","_getRoundUnit","result","minRoundUnit","getAxisOptions","threshold","initSlope","_easing","diffTime","restart","currentPos","_initialEasingPer","_prevEasingPer","ratio","_durationOffset","info","easingPer","prevState","prevPos","directions","nextPos","circulatedPos","rangeOffset","easing","AnimationManager","startPos","_super","InterruptManager","AxisManager","EventManager","EasingManager","inputObserver","InputObserver","setAnimationManager","mapped","split","concat","_inputs","disconnect","mapAxes","connect","index","splice","setBy","updateAnimation","destroy","Axes","Component","getDirectionByAngle","thresholdAngle","toAngle","useDirection","checkType","userDirection","activeEvent","_activeEvent","onRelease","_observer","release","_detachWindowEvent","iOSEdgeSwipeThreshold","releaseOnScroll","_onPanstart","_onPanmove","_onPanend","useHorizontal","useVertical","_direction","observer","_detachElementEvent","_attachElementEvent","_originalCssProps","_enabled","panEvent","onEventStart","getTouches","cancelable","edgeThreshold","_atRightEdge","innerWidth","_attachWindowEvent","onEventMove","swipeLeftToRight","_forceRelease","_rightEdgeTimer","swipeRightToLeft","_getOffset","prevent","some","stopPropagation","change","onEventEnd","move","passive","properties","_voidFunction","isEnabled","rect","getBoundingClientRect","_coefficientForDistanceToAngle","width","_rotateOrigin","left","top","height","_prevAngle","_triggerChange","vx","vy","_lastDiff","_getPosFromOrigin","positiveAngle","quadrant","_getQuadrant","diff","_getDifference","_prevQuadrant","prevAngle","prevQuadrant","q","PanInput","_onPinchStart","_onPinchMove","_onPinchEnd","_detachEvent","_attachEvent","pinchEvent","_baseValue","_pinchFlag","pinchScale","releaseDelay","useNormalized","_onWheel","_holding","_timer","KEY_LEFT_ARROW","KEY_A","KEY_UP_ARROW","KEY_W","KEY_RIGHT_ARROW","KEY_D","KEY_DOWN_ARROW","KEY_S","DIRECTION_REVERSE","DIRECTION_FORWARD","DELAY","_onKeydown","_onKeyup","getAttribute","setAttribute","isMoveKey","keyCode","offsets"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEA,IAAIA,GAAJ;;AAEA,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;;EAEjCD,GAAG,GAAG;IACJE,SAAS,EAAE;MACTC,SAAS,EAAE;;GAFf;CAFF,MAOO;EACLH,GAAG,GAAGC,MAAN;;;ACZK,IAAMG,cAAc,GAAG,CAAvB;AACP,AAAO,IAAMC,cAAc,GAAG,CAAvB;AACP,AAAO,IAAMC,eAAe,GAAG,CAAxB;AACP,AAAO,IAAMC,oBAAoB,GAAG,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QAAV,EAAoB;;;;IAGpBhZ,YAAY,CAAC,KAAKiZ,MAAN,CAAZ;SACKA,MAAL,GAActZ,UAAU,CAAC;MACvBkH,KAAI,CAACuN,SAAL,CAAeC,OAAf,CAAuBxN,KAAvB,EAA6BnD,KAA7B,EAAoC,CAAC,CAAD,EAAI,CAAJ,CAApC;;MACAmD,KAAI,CAACmS,QAAL,GAAgB,KAAhB;KAFsB,EAGrBY,KAHqB,CAAxB;GALM;;sBAWA,GAAR,UAAqB7E,QAArB;SACOX,SAAL,GAAiBW,QAAjB;SACKtS,OAAL,CAAakH,gBAAb,CAA8B,SAA9B,EAAyC,KAAKkQ,UAA9C,EAA0D,KAA1D;SACKpX,OAAL,CAAakH,gBAAb,CAA8B,UAA9B,EAA0C,KAAKkQ,UAA/C,EAA2D,KAA3D;SACKpX,OAAL,CAAakH,gBAAb,CAA8B,OAA9B,EAAuC,KAAKmQ,QAA5C,EAAsD,KAAtD;SACK3E,QAAL,GAAgB,IAAhB;GALM;;sBAQA,GAAR;SACO1S,OAAL,CAAagF,mBAAb,CAAiC,SAAjC,EAA4C,KAAKoS,UAAjD,EAA6D,KAA7D;SACKpX,OAAL,CAAagF,mBAAb,CAAiC,UAAjC,EAA6C,KAAKoS,UAAlD,EAA8D,KAA9D;SACKpX,OAAL,CAAagF,mBAAb,CAAiC,OAAjC,EAA0C,KAAKqS,QAA/C,EAAyD,KAAzD;SACK3E,QAAL,GAAgB,KAAhB;SACKf,SAAL,GAAiB,IAAjB;GALM;;qBAOV;GAjKA;;;;;"} \ No newline at end of file diff --git a/dist/axes.js b/dist/axes.js new file mode 100644 index 00000000..a976d4b3 --- /dev/null +++ b/dist/axes.js @@ -0,0 +1,3901 @@ +/* +Copyright (c) 2015 NAVER Corp. +name: @egjs/axes +license: MIT +author: NAVER Corp. +repository: https://github.com/naver/egjs-axes +version: 3.3.0 +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@egjs/agent'), require('@egjs/component')) : + typeof define === 'function' && define.amd ? define(['@egjs/agent', '@egjs/component'], factory) : + (global.eg = global.eg || {}, global.eg.Axes = factory(global.eg.agent,global.eg.Component)); +}(this, (function (getAgent,Component) { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + + /* global Reflect, Promise */ + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || { + __proto__: [] + } instanceof Array && function (d, b) { + d.__proto__ = b; + } || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + function __extends(d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + + return t; + }; + + return __assign.apply(this, arguments); + }; + + /* eslint-disable no-new-func, no-nested-ternary */ + var win; + + if (typeof window === "undefined") { + // window is undefined in node.js + win = { + navigator: { + userAgent: "" + } + }; + } else { + win = window; + } + + var DIRECTION_NONE = 1; + var DIRECTION_LEFT = 2; + var DIRECTION_RIGHT = 4; + var DIRECTION_HORIZONTAL = 2 | 4; + var DIRECTION_UP = 8; + var DIRECTION_DOWN = 16; + var DIRECTION_VERTICAL = 8 | 16; + var DIRECTION_ALL = 2 | 4 | 8 | 16; + var MOUSE_LEFT = "left"; + var MOUSE_RIGHT = "right"; + var MOUSE_MIDDLE = "middle"; + var VELOCITY_INTERVAL = 16; + var IOS_EDGE_THRESHOLD = 30; + var IS_IOS_SAFARI = "ontouchstart" in win && getAgent().browser.name === "safari"; + var TRANSFORM = function () { + if (typeof document === "undefined") { + return ""; + } + + var bodyStyle = (document.head || document.getElementsByTagName("head")[0]).style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in bodyStyle) { + return target[i]; + } + } + + return ""; + }(); + var PREVENT_DRAG_CSSPROPS = { + "user-select": "none", + "-webkit-user-drag": "none" + }; + + var toArray = function (nodes) { + // const el = Array.prototype.slice.call(nodes); + // for IE8 + var el = []; + + for (var i = 0, len = nodes.length; i < len; i++) { + el.push(nodes[i]); + } + + return el; + }; + var $ = function (param, multi) { + if (multi === void 0) { + multi = false; + } + + var el; + + if (typeof param === "string") { + // String (HTML, Selector) + // check if string is HTML tag format + var match = param.match(/^<([a-z]+)\s*([^>]*)>/); // creating element + + if (match) { + // HTML + var dummy = document.createElement("div"); + dummy.innerHTML = param; + el = toArray(dummy.childNodes); + } else { + // Selector + el = toArray(document.querySelectorAll(param)); + } + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } else if (param === win) { + // window + el = param; + } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) { + // HTMLElement, Document + el = param; + } else if ("jQuery" in win && param instanceof jQuery || param.constructor.prototype.jquery) { + // jQuery + el = multi ? param.toArray() : param.get(0); + } else if (Array.isArray(param)) { + el = param.map(function (v) { + return $(v); + }); + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } + + return el; + }; + var raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame; + var caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame; + + if (raf && !caf) { + var keyInfo_1 = {}; + var oldraf_1 = raf; + + raf = function (callback) { + var wrapCallback = function (timestamp) { + if (keyInfo_1[key]) { + callback(timestamp); + } + }; + + var key = oldraf_1(wrapCallback); + keyInfo_1[key] = true; + return key; + }; + + caf = function (key) { + delete keyInfo_1[key]; + }; + } else if (!(raf && caf)) { + raf = function (callback) { + return win.setTimeout(function () { + callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime()); + }, 16); + }; + + caf = win.clearTimeout; + } + /** + * A polyfill for the window.requestAnimationFrame() method. + * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame + * @private + */ + + + var requestAnimationFrame = function (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. requestAnimationFrame() 메서드가 반환한 아이디 값 + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame + * @private + */ + + var cancelAnimationFrame = function (key) { + caf(key); + }; + var map = function (obj, callback) { + var tranformed = {}; + + for (var k in obj) { + if (k) { + tranformed[k] = callback(obj[k], k); + } + } + + return tranformed; + }; + var filter = function (obj, callback) { + var filtered = {}; + + for (var k in obj) { + if (k && callback(obj[k], k)) { + filtered[k] = obj[k]; + } + } + + return filtered; + }; + var every = function (obj, callback) { + for (var k in obj) { + if (k && !callback(obj[k], k)) { + return false; + } + } + + return true; + }; + var equal = function (target, base) { + return every(target, function (v, k) { + return v === base[k]; + }); + }; + var roundNumFunc = {}; + var roundNumber = function (num, roundUnit) { + // Cache for performance + if (!roundNumFunc[roundUnit]) { + roundNumFunc[roundUnit] = getRoundFunc(roundUnit); + } + + return roundNumFunc[roundUnit](num); + }; + var roundNumbers = function (num, roundUnit) { + if (!num || !roundUnit) { + return num; + } + + return map(num, function (value, key) { + return roundNumber(value, typeof roundUnit === "number" ? roundUnit : roundUnit[key]); + }); + }; + var getDecimalPlace = function (val) { + if (!isFinite(val)) { + return 0; + } + + var v = "" + val; + + if (v.indexOf("e") >= 0) { + // Exponential Format + // 1e-10, 1e-12 + var p = 0; + var e = 1; + + while (Math.round(val * e) / e !== val) { + e *= 10; + p++; + } + + return p; + } // In general, following has performance benefit. + // https://jsperf.com/precision-calculation + + + return v.indexOf(".") >= 0 ? v.length - v.indexOf(".") - 1 : 0; + }; + var inversePow = function (n) { + // replace Math.pow(10, -n) to solve floating point issue. + // eg. Math.pow(10, -4) => 0.00009999999999999999 + return 1 / Math.pow(10, n); + }; + var getRoundFunc = function (v) { + var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1; + return function (n) { + if (v === 0) { + return 0; + } + + return Math.round(Math.round(n / v) * v * p) / p; + }; + }; + var getAngle = function (posX, posY) { + return Math.atan2(posY, posX) * 180 / Math.PI; + }; + var isCssPropsFromAxes = function (originalCssProps) { + var same = true; + Object.keys(PREVENT_DRAG_CSSPROPS).forEach(function (prop) { + if (!originalCssProps || originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]) { + same = false; + } + }); + return same; + }; + var setCssProps = function (element, option, direction) { + var _a; + + var touchActionMap = (_a = {}, _a[DIRECTION_NONE] = "auto", _a[DIRECTION_ALL] = "none", _a[DIRECTION_VERTICAL] = "pan-x", _a[DIRECTION_HORIZONTAL] = "pan-y", _a); + var oldCssProps = {}; + + if (element && element.style) { + var touchAction = option.touchAction ? option.touchAction : touchActionMap[direction]; + + var newCssProps_1 = __assign(__assign({}, PREVENT_DRAG_CSSPROPS), { + "touch-action": element.style["touch-action"] === "none" ? "none" : touchAction + }); + + Object.keys(newCssProps_1).forEach(function (prop) { + oldCssProps[prop] = element.style[prop]; + element.style[prop] = newCssProps_1[prop]; + }); + } + + return oldCssProps; + }; + var revertCssProps = function (element, originalCssProps) { + if (element && element.style && originalCssProps) { + Object.keys(originalCssProps).forEach(function (prop) { + element.style[prop] = originalCssProps[prop]; + }); + } + + return; + }; + + var EventManager = + /*#__PURE__*/ + function () { + function EventManager(_axes) { + this._axes = _axes; + } + /** + * This event is fired when a user holds an element on the screen of the device. + * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 + * @event Axes#hold + * @type {object} + * @property {Object.} pos coordinate 좌표 정보 + * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스 + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("hold", function(event) { + * // event.pos + * // event.input + * // event.inputEvent + * // isTrusted + * }); + * ``` + */ + + + var __proto = EventManager.prototype; + + __proto.hold = function (pos, option) { + var roundPos = this._getRoundPos(pos).roundPos; + + this._axes.trigger(new Component.ComponentEvent("hold", { + pos: roundPos, + input: option.input || null, + inputEvent: option.event || null, + isTrusted: true + })); + }; + /** + * 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일 경우에 동작한다 + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @example + * ```js + * 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' 이벤트 이후 이동할 좌표를 지정한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @example + * ```js + * 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 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 + * @event Axes#release + * @type {object} + * @property {Object.} depaPos The coordinates when releasing an element손을 뗐을 때의 좌표 + * @property {Object.} destPos The coordinates to move to after releasing an element손을 뗀 뒤에 이동할 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Object.} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value 손을 뗐을 때의 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치. + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스 + * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("release", function(event) { + * // event.depaPos + * // event.destPos + * // event.delta + * // event.input + * // event.inputEvent + * // event.setTo + * // event.isTrusted + * + * // if you want to change the animation coordinates to move after the 'release' event. + * event.setTo({x: 10}, 2000); + * }); + * ``` + */ + + + __proto.triggerRelease = function (param) { + var _a = this._getRoundPos(param.destPos, param.depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + param.destPos = roundPos; + param.depaPos = roundDepa; + param.setTo = this._createUserControll(param.destPos, param.duration); + + this._axes.trigger(new Component.ComponentEvent("release", __assign(__assign({}, param), { + bounceRatio: this._getBounceRatio(roundPos) + }))); + }; + /** + * This event is fired when coordinate changes. + * @ko 좌표가 변경됐을 때 발생하는 이벤트 + * @event Axes#change + * @type {object} + * @property {Object.} pos The coordinate 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Object.} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value 현재 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치. + * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.사용자가 기기의 화면을 누르고 있는지 여부 + * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true 이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다. + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("change", function(event) { + * // event.pos + * // event.delta + * // event.input + * // event.inputEvent + * // event.holding + * // event.set + * // event.isTrusted + * + * // if you want to change the coordinates to move after the 'change' event. + * // it works when the holding value of the change event is true. + * event.holding && event.set({x: 10}); + * }); + * ``` + */ + + + __proto.triggerChange = function (pos, depaPos, option, holding) { + if (holding === void 0) { + holding = false; + } + + var animationManager = this.animationManager; + var axisManager = animationManager.axisManager; + var eventInfo = animationManager.getEventInfo(); + + var _a = this._getRoundPos(pos, depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + var moveTo = axisManager.moveTo(roundPos, roundDepa); + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || (eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.event) || null; + var param = { + pos: moveTo.pos, + delta: moveTo.delta, + bounceRatio: this._getBounceRatio(moveTo.pos), + holding: holding, + inputEvent: inputEvent, + isTrusted: !!inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || (eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.input) || null, + set: inputEvent ? this._createUserControll(moveTo.pos) : function () {} + }; + var event = new Component.ComponentEvent("change", param); + + this._axes.trigger(event); + + if (inputEvent) { + axisManager.set(param.set().destPos); + } + + return !event.isCanceled(); + }; + /** + * This event is fired when animation starts. + * @ko 에니메이션이 시작할 때 발생한다. + * @event Axes#animationStart + * @type {object} + * @property {Object.} depaPos The coordinates when animation starts애니메이션이 시작 되었을 때의 좌표 + * @property {Object.} destPos The coordinates to move to. If you change this value, you can run the animation이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다. + * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("release", function(event) { + * // event.depaPos + * // event.destPos + * // event.delta + * // event.input + * // event.inputEvent + * // event.setTo + * // event.isTrusted + * + * // if you want to change the animation coordinates to move after the 'animationStart' event. + * event.setTo({x: 10}, 2000); + * }); + * ``` + */ + + + __proto.triggerAnimationStart = function (param) { + var _a = this._getRoundPos(param.destPos, param.depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + param.destPos = roundPos; + param.depaPos = roundDepa; + param.setTo = this._createUserControll(param.destPos, param.duration); + var event = new Component.ComponentEvent("animationStart", param); + + this._axes.trigger(event); + + return !event.isCanceled(); + }; + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생한다. + * @event Axes#animationEnd + * @type {object} + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("animationEnd", function(event) { + * // event.isTrusted + * }); + * ``` + */ + + + __proto.triggerAnimationEnd = function (isTrusted) { + if (isTrusted === void 0) { + isTrusted = false; + } + + this._axes.trigger(new Component.ComponentEvent("animationEnd", { + isTrusted: isTrusted + })); + }; + /** + * This event is fired when all actions have been completed. + * @ko 에니메이션이 끝났을 때 발생한다. + * @event Axes#finish + * @type {object} + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("finish", function(event) { + * // event.isTrusted + * }); + * ``` + */ + + + __proto.triggerFinish = function (isTrusted) { + if (isTrusted === void 0) { + isTrusted = false; + } + + this._axes.trigger(new Component.ComponentEvent("finish", { + isTrusted: isTrusted + })); + }; + + __proto.setAnimationManager = function (animationManager) { + this.animationManager = animationManager; + }; + + __proto.destroy = function () { + this._axes.off(); + }; + + __proto._createUserControll = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } // to controll + + + var userControl = { + destPos: __assign({}, pos), + duration: duration + }; + return function (toPos, userDuration) { + if (toPos) { + userControl.destPos = __assign({}, toPos); + } + + if (userDuration !== undefined) { + userControl.duration = userDuration; + } + + return userControl; + }; + }; + + __proto._getRoundPos = function (pos, depaPos) { + // round value if round exist + var roundUnit = this._axes.options.round; // if (round == null) { + // return {pos, depaPos}; // undefined, undefined + // } + + return { + roundPos: roundNumbers(pos, roundUnit), + roundDepa: roundNumbers(depaPos, roundUnit) + }; + }; + + __proto._getBounceRatio = function (pos) { + return this._axes.axisManager.map(pos, function (v, opt) { + if (v < opt.range[0] && opt.bounce[0] !== 0) { + return (opt.range[0] - v) / opt.bounce[0]; + } else if (v > opt.range[1] && opt.bounce[1] !== 0) { + return (v - opt.range[1]) / opt.bounce[1]; + } else { + return 0; + } + }); + }; + + return EventManager; + }(); + + var InterruptManager = + /*#__PURE__*/ + function () { + function InterruptManager(_options) { + this._options = _options; + this._prevented = false; // check whether the animation event was prevented + } + + var __proto = InterruptManager.prototype; + + __proto.isInterrupting = function () { + // when interruptable is 'true', return value is always 'true'. + return this._options.interruptable || this._prevented; + }; + + __proto.isInterrupted = function () { + return !this._options.interruptable && this._prevented; + }; + + __proto.setInterrupt = function (prevented) { + if (!this._options.interruptable) { + this._prevented = prevented; + } + }; + + return InterruptManager; + }(); + + var getInsidePosition = function (destPos, range, circular, bounce) { + var toDestPos = destPos; + var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]]; + toDestPos = Math.max(targetRange[0], toDestPos); + toDestPos = Math.min(targetRange[1], toDestPos); + return toDestPos; + }; // determine outside + + var isOutside = function (pos, range) { + return pos < range[0] || pos > range[1]; + }; // determine whether position has reached the maximum moveable area + + var isEndofBounce = function (pos, range, bounce, circular) { + return !circular[0] && pos === range[0] - bounce[0] || !circular[1] && pos === range[1] + bounce[1]; + }; + var getDuration = function (distance, deceleration) { + var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero + + return duration < 100 ? 0 : duration; + }; + var isCircularable = function (destPos, range, circular) { + return circular[1] && destPos > range[1] || circular[0] && destPos < range[0]; + }; + var getCirculatedPos = function (pos, range, circular) { + var toPos = pos; + var min = range[0]; + var max = range[1]; + var length = max - min; + + if (circular[1] && pos > max) { + // right + toPos = (toPos - max) % length + min; + } + + if (circular[0] && pos < min) { + // left + toPos = (toPos - min) % length + max; + } + + return toPos; + }; + + var AxisManager = + /*#__PURE__*/ + function () { + function AxisManager(_axis) { + var _this = this; + + this._axis = _axis; + + this._complementOptions(); + + this._pos = Object.keys(this._axis).reduce(function (acc, v) { + acc[v] = _this._axis[v].range[0]; + return acc; + }, {}); + } + + var __proto = AxisManager.prototype; + + __proto.getDelta = function (depaPos, destPos) { + var fullDepaPos = this.get(depaPos); + return map(this.get(destPos), function (v, k) { + return v - fullDepaPos[k]; + }); + }; + + __proto.get = function (axes) { + var _this = this; + + if (axes && Array.isArray(axes)) { + return axes.reduce(function (acc, v) { + if (v && v in _this._pos) { + acc[v] = _this._pos[v]; + } + + return acc; + }, {}); + } else { + return __assign(__assign({}, this._pos), axes || {}); + } + }; + + __proto.moveTo = function (pos, depaPos) { + if (depaPos === void 0) { + depaPos = this._pos; + } + + var delta = map(this._pos, function (v, key) { + return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0; + }); + this.set(this.map(pos, function (v, opt) { + return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0; + })); + return { + pos: __assign({}, this._pos), + delta: delta + }; + }; + + __proto.set = function (pos) { + for (var k in pos) { + if (k && k in this._pos) { + this._pos[k] = pos[k]; + } + } + }; + + __proto.every = function (pos, callback) { + var axisOptions = this._axis; + return every(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.filter = function (pos, callback) { + var axisOptions = this._axis; + return filter(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.map = function (pos, callback) { + var axisOptions = this._axis; + return map(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.isOutside = function (axes) { + return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) { + return !isOutside(v, opt.range); + }); + }; + + __proto.getAxisOptions = function (key) { + return this._axis[key]; + }; + /** + * set up 'css' expression + * @private + */ + + + __proto._complementOptions = function () { + var _this = this; + + Object.keys(this._axis).forEach(function (axis) { + _this._axis[axis] = __assign({ + range: [0, 100], + bounce: [0, 0], + circular: [false, false] + }, _this._axis[axis]); + ["bounce", "circular"].forEach(function (v) { + var axisOption = _this._axis; + var key = axisOption[axis][v]; + + if (/string|number|boolean/.test(typeof key)) { + axisOption[axis][v] = [key, key]; + } + }); + }); + }; + + return AxisManager; + }(); + + var SUPPORT_TOUCH = ("ontouchstart" in win); + var SUPPORT_POINTER = ("PointerEvent" in win); + var SUPPORT_MSPOINTER = ("MSPointerEvent" in win); + var SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER; + + var EventInput = + /*#__PURE__*/ + function () { + function EventInput() { + var _this = this; + + this._stopContextMenu = function (event) { + event.preventDefault(); + win.removeEventListener("contextmenu", _this._stopContextMenu); + }; + } + + var __proto = EventInput.prototype; + + __proto.extendEvent = function (event) { + var _a; + + var prevEvent = this.prevEvent; + + var center = this._getCenter(event); + + var movement = prevEvent ? this._getMovement(event) : { + x: 0, + y: 0 + }; + var scale = prevEvent ? this._getScale(event) : 1; + var angle = prevEvent ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y) : 0; + var deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x; + var deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y; + var offsetX = movement.x; + var offsetY = movement.y; + var latestInterval = this._latestInterval; + var timeStamp = Date.now(); + var deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0; + var velocityX = prevEvent ? prevEvent.velocityX : 0; + var velocityY = prevEvent ? prevEvent.velocityY : 0; + + if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) { + if (latestInterval) { + _a = [(deltaX - latestInterval.deltaX) / deltaTime, (deltaY - latestInterval.deltaY) / deltaTime], velocityX = _a[0], velocityY = _a[1]; + } + + this._latestInterval = { + timestamp: timeStamp, + deltaX: deltaX, + deltaY: deltaY + }; + } + + return { + srcEvent: event, + scale: scale, + angle: angle, + center: center, + deltaX: deltaX, + deltaY: deltaY, + offsetX: offsetX, + offsetY: offsetY, + velocityX: velocityX, + velocityY: velocityY, + preventSystemEvent: true + }; + }; + + __proto._getDistance = function (start, end) { + var x = end.clientX - start.clientX; + var y = end.clientY - start.clientY; + return Math.sqrt(x * x + y * y); + }; + + __proto._getButton = function (event) { + var buttonCodeMap = { + 1: MOUSE_LEFT, + 2: MOUSE_RIGHT, + 4: MOUSE_MIDDLE + }; + var button = this._isTouchEvent(event) ? MOUSE_LEFT : buttonCodeMap[event.buttons]; + return button ? button : null; + }; + + __proto._isTouchEvent = function (event) { + return event.type.indexOf("touch") > -1; + }; + + __proto._isValidButton = function (button, inputButton) { + return inputButton.indexOf(button) > -1; + }; + + __proto._preventMouseButton = function (event, button) { + if (button === MOUSE_RIGHT) { + win.addEventListener("contextmenu", this._stopContextMenu); + } else if (button === MOUSE_MIDDLE) { + event.preventDefault(); + } + }; + + return EventInput; + }(); + + var MouseEventInput = + /*#__PURE__*/ + function (_super) { + __extends(MouseEventInput, _super); + + function MouseEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["mousedown"]; + _this.move = ["mousemove"]; + _this.end = ["mouseup"]; + return _this; + } + + var __proto = MouseEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function () { + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + return; + }; + + __proto.getTouches = function () { + return 0; + }; + + __proto._getScale = function () { + return 1; + }; + + __proto._getCenter = function (event) { + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + return { + x: event.clientX - prev.clientX, + y: event.clientY - prev.clientY + }; + }; + + return MouseEventInput; + }(EventInput); + + var TouchEventInput = + /*#__PURE__*/ + function (_super) { + __extends(TouchEventInput, _super); + + function TouchEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["touchstart"]; + _this.move = ["touchmove"]; + _this.end = ["touchend", "touchcancel"]; + return _this; + } + + var __proto = TouchEventInput.prototype; + + __proto.onEventStart = function (event) { + this._baseTouches = event.touches; + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event) { + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + this._baseTouches = event.touches; + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._baseTouches = null; + return; + }; + + __proto.getTouches = function (event) { + return event.touches.length; + }; + + __proto._getScale = function (event) { + if (event.touches.length !== 2 || this._baseTouches.length < 2) { + return null; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(event.touches[0], event.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]); + }; + + __proto._getCenter = function (event) { + return { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + + if (event.touches[0].identifier !== prev.touches[0].identifier) { + return { + x: 0, + y: 0 + }; + } + + return { + x: event.touches[0].clientX - prev.touches[0].clientX, + y: event.touches[0].clientY - prev.touches[0].clientY + }; + }; + + return TouchEventInput; + }(EventInput); + + var PointerEventInput = + /*#__PURE__*/ + function (_super) { + __extends(PointerEventInput, _super); + + function PointerEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = SUPPORT_POINTER ? ["pointerdown"] : ["MSPointerDown"]; + _this.move = SUPPORT_POINTER ? ["pointermove"] : ["MSPointerMove"]; + _this.end = SUPPORT_POINTER ? ["pointerup", "pointercancel"] : ["MSPointerUp", "MSPointerCancel"]; // store first, recent inputs for each event id + + _this._firstInputs = []; + _this._recentInputs = []; + return _this; + } + + var __proto = PointerEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + this._updatePointerEvent(event); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + this._updatePointerEvent(event); + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + this._removePointerEvent(event); + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._firstInputs = []; + this._recentInputs = []; + return; + }; + + __proto.getTouches = function () { + return this._recentInputs.length; + }; + + __proto._getScale = function () { + if (this._recentInputs.length !== 2) { + return null; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(this._recentInputs[0], this._recentInputs[1]) / this._getDistance(this._firstInputs[0], this._firstInputs[1]); + }; + + __proto._getCenter = function (event) { + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + + if (event.pointerId !== prev.pointerId) { + return { + x: 0, + y: 0 + }; + } + + return { + x: event.clientX - prev.clientX, + y: event.clientY - prev.clientY + }; + }; + + __proto._updatePointerEvent = function (event) { + var _this = this; + + var addFlag = false; + + this._recentInputs.forEach(function (e, i) { + if (e.pointerId === event.pointerId) { + addFlag = true; + _this._recentInputs[i] = event; + } + }); + + if (!addFlag) { + this._firstInputs.push(event); + + this._recentInputs.push(event); + } + }; + + __proto._removePointerEvent = function (event) { + this._firstInputs = this._firstInputs.filter(function (x) { + return x.pointerId !== event.pointerId; + }); + this._recentInputs = this._recentInputs.filter(function (x) { + return x.pointerId !== event.pointerId; + }); + }; + + return PointerEventInput; + }(EventInput); + + var TouchMouseEventInput = + /*#__PURE__*/ + function (_super) { + __extends(TouchMouseEventInput, _super); + + function TouchMouseEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["mousedown", "touchstart"]; + _this.move = ["mousemove", "touchmove"]; + _this.end = ["mouseup", "touchend", "touchcancel"]; + return _this; + } + + var __proto = TouchMouseEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (this._isTouchEvent(event)) { + this._baseTouches = event.touches; + } + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + if (this._isTouchEvent(event)) { + this._baseTouches = event.touches; + } + + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._baseTouches = null; + return; + }; + + __proto.getTouches = function (event) { + return this._isTouchEvent(event) ? event.touches.length : 0; + }; + + __proto._getScale = function (event) { + if (this._isTouchEvent(event)) { + if (event.touches.length !== 2 || this._baseTouches.length < 2) { + return 1; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(event.touches[0], event.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]); + } + + return this.prevEvent.scale; + }; + + __proto._getCenter = function (event) { + if (this._isTouchEvent(event)) { + return { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + } + + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var _this = this; + + var prev = this.prevEvent.srcEvent; + + var _a = [event, prev].map(function (e) { + if (_this._isTouchEvent(e)) { + return { + id: e.touches[0].identifier, + x: e.touches[0].clientX, + y: e.touches[0].clientY + }; + } + + return { + id: null, + x: e.clientX, + y: e.clientY + }; + }), + nextSpot = _a[0], + prevSpot = _a[1]; + + return nextSpot.id === prevSpot.id ? { + x: nextSpot.x - prevSpot.x, + y: nextSpot.y - prevSpot.y + } : { + x: 0, + y: 0 + }; + }; + + return TouchMouseEventInput; + }(EventInput); + + var toAxis = function (source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + }; + var convertInputType = function (inputType) { + if (inputType === void 0) { + inputType = []; + } + + var hasTouch = false; + var hasMouse = false; + var hasPointer = false; + inputType.forEach(function (v) { + switch (v) { + case "mouse": + hasMouse = true; + break; + + case "touch": + hasTouch = SUPPORT_TOUCH; + break; + + case "pointer": + hasPointer = SUPPORT_POINTER_EVENTS; + // no default + } + }); + + if (hasPointer) { + return new PointerEventInput(); + } else if (hasTouch && hasMouse) { + return new TouchMouseEventInput(); + } else if (hasTouch) { + return new TouchEventInput(); + } else if (hasMouse) { + return new MouseEventInput(); + } + + return null; + }; + + var InputObserver = + /*#__PURE__*/ + function () { + function InputObserver(_a) { + var options = _a.options, + interruptManager = _a.interruptManager, + eventManager = _a.eventManager, + axisManager = _a.axisManager, + animationManager = _a.animationManager; + this._isOutside = false; + this._moveDistance = null; + this._isStopped = false; + this.options = options; + this._interruptManager = interruptManager; + this._eventManager = eventManager; + this._axisManager = axisManager; + this._animationManager = animationManager; + } + + var __proto = InputObserver.prototype; + + __proto.get = function (input) { + return this._axisManager.get(input.axes); + }; + + __proto.hold = function (input, event) { + if (this._interruptManager.isInterrupted() || !input.axes.length) { + return; + } + + var changeOption = { + input: input, + event: event + }; + this._isStopped = false; + + this._interruptManager.setInterrupt(true); + + this._animationManager.stopAnimation(changeOption); + + if (!this._moveDistance) { + this._eventManager.hold(this._axisManager.get(), changeOption); + } + + this._isOutside = this._axisManager.isOutside(input.axes); + this._moveDistance = this._axisManager.get(input.axes); + }; + + __proto.change = function (input, event, offset, useAnimation) { + if (this._isStopped || !this._interruptManager.isInterrupting() || this._axisManager.every(offset, function (v) { + return v === 0; + })) { + return; + } + + var nativeEvent = event.srcEvent ? event.srcEvent : event; + + if (nativeEvent.__childrenAxesAlreadyChanged) { + return; + } + + var depaPos = this._moveDistance || this._axisManager.get(input.axes); + + var destPos; // for outside logic + + destPos = map(depaPos, function (v, k) { + return v + (offset[k] || 0); + }); + + if (this._moveDistance) { + this._moveDistance = this._axisManager.map(destPos, function (v, _a) { + var circular = _a.circular, + range = _a.range; + return circular && (circular[0] || circular[1]) ? getCirculatedPos(v, range, circular) : v; + }); + } // from outside to inside + + + if (this._isOutside && this._axisManager.every(depaPos, function (v, opt) { + return !isOutside(v, opt.range); + })) { + this._isOutside = false; + } + + depaPos = this._atOutside(depaPos); + destPos = this._atOutside(destPos); + + if (!this.options.nested || !this._isEndofAxis(offset, depaPos, destPos)) { + nativeEvent.__childrenAxesAlreadyChanged = true; + } + + var changeOption = { + input: input, + event: event + }; + + if (useAnimation) { + var duration = this._animationManager.getDuration(destPos, depaPos); + + this._animationManager.animateTo(destPos, duration, changeOption); + } else { + var isCanceled = !this._eventManager.triggerChange(destPos, depaPos, changeOption, true); + + if (isCanceled) { + this._isStopped = true; + this._moveDistance = null; + + this._animationManager.finish(false); + } + } + }; + + __proto.release = function (input, event, velocity, inputDuration) { + if (this._isStopped || !this._interruptManager.isInterrupting() || !this._moveDistance) { + return; + } + + var nativeEvent = event.srcEvent ? event.srcEvent : event; + + if (nativeEvent.__childrenAxesAlreadyReleased) { + velocity = velocity.map(function () { + return 0; + }); + } + + var pos = this._axisManager.get(input.axes); + + var depaPos = this._axisManager.get(); + + var displacement = this._animationManager.getDisplacement(velocity); + + var offset = toAxis(input.axes, displacement); + + var destPos = this._axisManager.get(this._axisManager.map(offset, function (v, opt, k) { + if (opt.circular && (opt.circular[0] || opt.circular[1])) { + return pos[k] + v; + } else { + return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce); + } + })); + + nativeEvent.__childrenAxesAlreadyReleased = true; + + var duration = this._animationManager.getDuration(destPos, pos, inputDuration); + + if (duration === 0) { + destPos = __assign({}, depaPos); + } // prepare params + + + var param = { + depaPos: depaPos, + destPos: destPos, + duration: duration, + delta: this._axisManager.getDelta(depaPos, destPos), + inputEvent: event, + input: input, + isTrusted: true + }; + + this._eventManager.triggerRelease(param); + + this._moveDistance = null; // to contol + + var userWish = this._animationManager.getUserControl(param); + + var isEqual = equal(userWish.destPos, depaPos); + var changeOption = { + input: input, + event: event + }; + + if (isEqual || userWish.duration === 0) { + if (!isEqual) { + this._eventManager.triggerChange(userWish.destPos, depaPos, changeOption, true); + } + + this._interruptManager.setInterrupt(false); + + if (this._axisManager.isOutside()) { + this._animationManager.restore(changeOption); + } else { + this._eventManager.triggerFinish(true); + } + } else { + this._animationManager.animateTo(userWish.destPos, userWish.duration, changeOption); + } + }; // when move pointer is held in outside + + + __proto._atOutside = function (pos) { + var _this = this; + + if (this._isOutside) { + return this._axisManager.map(pos, function (v, opt) { + var tn = opt.range[0] - opt.bounce[0]; + var tx = opt.range[1] + opt.bounce[1]; + return v > tx ? tx : v < tn ? tn : v; + }); + } else { + return this._axisManager.map(pos, function (v, opt) { + var min = opt.range[0]; + var max = opt.range[1]; + var out = opt.bounce; + var circular = opt.circular; + + if (circular && (circular[0] || circular[1])) { + return v; + } else if (v < min) { + // left + return min - _this._animationManager.interpolate(min - v, out[0]); + } else if (v > max) { + // right + return max + _this._animationManager.interpolate(v - max, out[1]); + } + + return v; + }); + } + }; + + __proto._isEndofAxis = function (offset, depaPos, destPos) { + return this._axisManager.every(depaPos, function (value, option, key) { + return offset[key] === 0 || depaPos[key] === destPos[key] && isEndofBounce(value, option.range, option.bounce, option.circular); + }); + }; + + return InputObserver; + }(); + + var clamp = function (value, min, max) { + return Math.max(Math.min(value, max), min); + }; + + var AnimationManager = + /*#__PURE__*/ + function () { + function AnimationManager(_a) { + var options = _a.options, + interruptManager = _a.interruptManager, + eventManager = _a.eventManager, + axisManager = _a.axisManager; + this._options = options; + this.interruptManager = interruptManager; + this.eventManager = eventManager; + this.axisManager = axisManager; + this.animationEnd = this.animationEnd.bind(this); + } + + var __proto = AnimationManager.prototype; + + __proto.getDuration = function (depaPos, destPos, wishDuration) { + var _this = this; + + var duration; + + if (typeof wishDuration !== "undefined") { + duration = wishDuration; + } else { + var durations_1 = map(destPos, function (v, k) { + return getDuration(Math.abs(v - depaPos[k]), _this._options.deceleration); + }); + duration = Object.keys(durations_1).reduce(function (max, v) { + return Math.max(max, durations_1[v]); + }, -Infinity); + } + + return clamp(duration, this._options.minimumDuration, this._options.maximumDuration); + }; + + __proto.getDisplacement = function (velocity) { + var totalVelocity = Math.pow(velocity.reduce(function (total, v) { + return total + v * v; + }, 0), 1 / velocity.length); + var duration = Math.abs(totalVelocity / -this._options.deceleration); + return velocity.map(function (v) { + return v / 2 * duration; + }); + }; + + __proto.stopAnimation = function (option) { + if (this._animateParam) { + var orgPos_1 = this.axisManager.get(); + var pos = this.axisManager.map(orgPos_1, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + }); + + if (!every(pos, function (v, k) { + return orgPos_1[k] === v; + })) { + this.eventManager.triggerChange(pos, orgPos_1, option, !!option); + } + + this._animateParam = null; + + if (this._raf) { + cancelAnimationFrame(this._raf); + } + + this._raf = null; + this.eventManager.triggerAnimationEnd(!!(option === null || option === void 0 ? void 0 : option.event)); + } + }; + + __proto.getEventInfo = function () { + if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) { + return { + input: this._animateParam.input, + event: this._animateParam.inputEvent + }; + } else { + return null; + } + }; + + __proto.restore = function (option) { + var pos = this.axisManager.get(); + var destPos = this.axisManager.map(pos, function (v, opt) { + return Math.min(opt.range[1], Math.max(opt.range[0], v)); + }); + this.stopAnimation(); + this.animateTo(destPos, this.getDuration(pos, destPos), option); + }; + + __proto.animationEnd = function () { + var beforeParam = this.getEventInfo(); + this._animateParam = null; // for Circular + + var circularTargets = this.axisManager.filter(this.axisManager.get(), function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + }); + + if (Object.keys(circularTargets).length > 0) { + this.setTo(this.axisManager.map(circularTargets, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + })); + } + + this.interruptManager.setInterrupt(false); + this.eventManager.triggerAnimationEnd(!!beforeParam); + + if (this.axisManager.isOutside()) { + this.restore(beforeParam); + } else { + this.finish(!!beforeParam); + } + }; + + __proto.finish = function (isTrusted) { + this._animateParam = null; + this.interruptManager.setInterrupt(false); + this.eventManager.triggerFinish(isTrusted); + }; + + __proto.getUserControl = function (param) { + var userWish = param.setTo(); + userWish.destPos = this.axisManager.get(userWish.destPos); + userWish.duration = clamp(userWish.duration, this._options.minimumDuration, this._options.maximumDuration); + return userWish; + }; + + __proto.animateTo = function (destPos, duration, option) { + var _this = this; + + this.stopAnimation(); + + var param = this._createAnimationParam(destPos, duration, option); + + var depaPos = __assign({}, param.depaPos); + + var retTrigger = this.eventManager.triggerAnimationStart(param); // to control + + var userWish = this.getUserControl(param); // You can't stop the 'animationStart' event when 'circular' is true. + + if (!retTrigger && this.axisManager.every(userWish.destPos, function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + })) { + console.warn("You can't stop the 'animation' event when 'circular' is true."); + } + + if (retTrigger && !equal(userWish.destPos, depaPos)) { + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || null; + + this._animateLoop({ + depaPos: depaPos, + destPos: userWish.destPos, + duration: userWish.duration, + delta: this.axisManager.getDelta(depaPos, userWish.destPos), + isTrusted: !!inputEvent, + inputEvent: inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || null + }, function () { + return _this.animationEnd(); + }); + } + }; + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + var axes = Object.keys(pos); + var orgPos = this.axisManager.get(axes); + + if (equal(pos, orgPos)) { + return this; + } + + this.interruptManager.setInterrupt(true); + var movedPos = filter(pos, function (v, k) { + return orgPos[k] !== v; + }); + + if (!Object.keys(movedPos).length) { + return this; + } + + movedPos = this.axisManager.map(movedPos, function (v, opt) { + var range = opt.range, + circular = opt.circular; + + if (circular && (circular[0] || circular[1])) { + return v; + } else { + return getInsidePosition(v, range, circular); + } + }); + + if (equal(movedPos, orgPos)) { + return this; + } + + if (duration > 0) { + this.animateTo(movedPos, duration); + } else { + this.stopAnimation(); + this.eventManager.triggerChange(movedPos); + this.finish(false); + } + + return this; + }; + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + return this.setTo(map(this.axisManager.get(Object.keys(pos)), function (v, k) { + return v + pos[k]; + }), duration); + }; + + __proto._createAnimationParam = function (pos, duration, option) { + var depaPos = this.axisManager.get(); + var destPos = pos; + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || null; + return { + depaPos: depaPos, + destPos: destPos, + duration: clamp(duration, this._options.minimumDuration, this._options.maximumDuration), + delta: this.axisManager.getDelta(depaPos, destPos), + inputEvent: inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || null, + isTrusted: !!inputEvent, + done: this.animationEnd + }; + }; + + __proto._animateLoop = function (param, complete) { + var _this = this; + + if (param.duration) { + this._animateParam = __assign(__assign({}, param), { + startTime: new Date().getTime() + }); + var originalIntendedPos_1 = map(param.destPos, function (v) { + return v; + }); + + var state_1 = this._initState(this._animateParam); + + var loop_1 = function () { + _this._raf = null; + var animateParam = _this._animateParam; + + var nextState = _this._getNextState(state_1); + + var isCanceled = !_this.eventManager.triggerChange(nextState.pos, state_1.pos); + state_1 = nextState; + + if (nextState.finished) { + animateParam.destPos = _this._getFinalPos(animateParam.destPos, originalIntendedPos_1); + + if (!equal(animateParam.destPos, _this.axisManager.get(Object.keys(animateParam.destPos)))) { + _this.eventManager.triggerChange(animateParam.destPos, nextState.pos); + } + + complete(); + return; + } else if (isCanceled) { + _this.finish(false); + } else { + _this._raf = requestAnimationFrame(loop_1); + } + }; + + loop_1(); + } else { + this.eventManager.triggerChange(param.destPos); + complete(); + } + }; + /** + * Get estimated final value. + * + * If destPos is within the 'error range' of the original intended position, the initial intended position is returned. + * - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100; + * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos. + * - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123 + * @param originalIntendedPos + * @param destPos + */ + + + __proto._getFinalPos = function (destPos, originalIntendedPos) { + var _this = this; // compare destPos and originalIntendedPos + // eslint-disable-next-line @typescript-eslint/naming-convention + + + var ERROR_LIMIT = 0.000001; + var finalPos = map(destPos, function (value, key) { + if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) { + // In error range, return original intended + return originalIntendedPos[key]; + } else { + // Out of error range, return rounded pos. + var roundUnit = _this._getRoundUnit(value, key); + + var result = roundNumber(value, roundUnit); + return result; + } + }); + return finalPos; + }; + + __proto._getRoundUnit = function (val, key) { + var roundUnit = this._options.round; // manual mode + + var minRoundUnit = null; // auto mode + // auto mode + + if (!roundUnit) { + // Get minimum round unit + var options = this.axisManager.getAxisOptions(key); + minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val))); + } + + return minRoundUnit || roundUnit; + }; + + return AnimationManager; + }(); + + var EasingManager = + /*#__PURE__*/ + function (_super) { + __extends(EasingManager, _super); + + function EasingManager() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this._useDuration = true; + return _this; + } + + var __proto = EasingManager.prototype; + + __proto.interpolate = function (displacement, threshold) { + var initSlope = this._easing(0.00001) / 0.00001; + return this._easing(displacement / (threshold * initSlope)) * threshold; + }; + + __proto.updateAnimation = function (options) { + var animateParam = this._animateParam; + + if (!animateParam) { + return; + } + + var diffTime = new Date().getTime() - animateParam.startTime; + var pos = (options === null || options === void 0 ? void 0 : options.destPos) || animateParam.destPos; + var duration = (options === null || options === void 0 ? void 0 : options.duration) || animateParam.duration; + + if ((options === null || options === void 0 ? void 0 : options.restart) || duration <= diffTime) { + this.setTo(pos, duration - diffTime); + return; + } + + if (options === null || options === void 0 ? void 0 : options.destPos) { + var currentPos = this.axisManager.get(); // When destination is changed, new delta should be calculated as remaining percent. + // For example, moving x:0, y:0 to x:200, y:200 and it has current easing percent of 92%. coordinate is x:184 and y:184 + // If destination changes to x:300, y:300. xdelta:200, ydelta:200 changes to xdelta:116, ydelta:116 and use remaining easingPer as 100%, not 8% as previous. + // Therefore, original easingPer by time is kept. And divided by (1 - self._initialEasingPer) which means new total easing percent. Like calculating 8% as 100%. + + this._initialEasingPer = this._prevEasingPer; + animateParam.delta = this.axisManager.getDelta(currentPos, pos); + animateParam.destPos = pos; + } + + if (options === null || options === void 0 ? void 0 : options.duration) { + var ratio = (diffTime + this._durationOffset) / animateParam.duration; // Use durationOffset for keeping animation ratio after duration is changed. + // newRatio = (diffTime + newDurationOffset) / newDuration = oldRatio + // newDurationOffset = oldRatio * newDuration - diffTime + + this._durationOffset = ratio * duration - diffTime; + animateParam.duration = duration; + } + }; + + __proto._initState = function (info) { + this._initialEasingPer = 0; + this._prevEasingPer = 0; + this._durationOffset = 0; + return { + pos: info.depaPos, + easingPer: 0, + finished: false + }; + }; + + __proto._getNextState = function (prevState) { + var _this = this; + + var animateParam = this._animateParam; + var prevPos = prevState.pos; + var destPos = animateParam.destPos; + var directions = map(prevPos, function (value, key) { + return value <= destPos[key] ? 1 : -1; + }); + var diffTime = new Date().getTime() - animateParam.startTime; + var ratio = (diffTime + this._durationOffset) / animateParam.duration; + + var easingPer = this._easing(ratio); + + var toPos = this.axisManager.map(prevPos, function (pos, options, key) { + var nextPos = ratio >= 1 ? destPos[key] : pos + animateParam.delta[key] * (easingPer - _this._prevEasingPer) / (1 - _this._initialEasingPer); // Subtract distance from distance already moved. + // Recalculate the remaining distance. + // Fix the bouncing phenomenon by changing the range. + + var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular); + + if (nextPos !== circulatedPos) { + // circular + var rangeOffset = directions[key] * (options.range[1] - options.range[0]); + destPos[key] -= rangeOffset; + prevPos[key] -= rangeOffset; + } + + return circulatedPos; + }); + this._prevEasingPer = easingPer; + return { + pos: toPos, + easingPer: easingPer, + finished: easingPer >= 1 + }; + }; + + __proto._easing = function (p) { + return p > 1 ? 1 : this._options.easing(p); + }; + + return EasingManager; + }(AnimationManager); + + /** + * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. + * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @param {Number[]} [range] The coordinate of range 좌표 범위 + * @param {Number} [range[0]=0] The coordinate of the minimum 최소 좌표 + * @param {Number} [range[1]=0] The coordinate of the maximum 최대 좌표 + * @param {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바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다 + * @param {Number} [bounce[0]=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기 + * @param {Number} [bounce[1]=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기 + * @param {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.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다 + * @param {Boolean} [circular[0]=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부 + * @param {Boolean} [circular[1]=false] Indicates whether to circulate to the coordinate of the maximum 최대 좌표 방향의 순환 여부 + **/ + + /** + * @typedef {Object} AxesOption The option object of the eg.Axes module + * @ko eg.Axes 모듈의 옵션 객체 + * @param {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수 + * @param {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간 + * @param {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간 + * @param {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다 + * @param {Boolean} [interruptable=true] Indicates whether an animation is interruptible. + * - true: It can be paused or stopped by user action or the API. + * - false: It cannot be paused or stopped by user action or the API while it is running. + * 진행 중인 애니메이션 중지 가능 여부. + * - true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다. + * - false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다 + * @param {Number} [round=null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95) + * [Details](https://github.com/naver/egjs-axes/wiki/round-option)반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95). + * [상세내용](https://github.com/naver/egjs-axes/wiki/round-option) + * @param {Boolean} [nested=false] Whether the event propagates to other instances when the coordinates reach the end of the movable area 좌표가 이동 가능한 영역의 끝까지 도달했을 때 다른 인스턴스들로의 이벤트 전파 여부 + **/ + + /** + * 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.} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @param {AxesOption} [options={}] The option object of the eg.Axes moduleeg.Axes 모듈의 옵션 객체 + * @param {Object.} [startPos=null] The coordinates to be moved when creating an instance. not triggering change event.인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음. + * + * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * ```js + * // 1. Initialize eg.Axes + * const axes = new eg.Axes({ + * something1: { + * range: [0, 150], + * bounce: 50 + * }, + * something2: { + * range: [0, 200], + * bounce: 100 + * }, + * somethingN: { + * range: [1, 10], + * } + * }, { + * deceleration : 0.0024 + * }); + * + * // 2. attach event handler + * axes.on({ + * "hold" : function(evt) { + * }, + * "release" : function(evt) { + * }, + * "animationStart" : function(evt) { + * }, + * "animationEnd" : function(evt) { + * }, + * "change" : function(evt) { + * } + * }); + * + * // 3. Initialize inputTypes + * const panInputArea = new eg.Axes.PanInput("#area", { + * scale: [0.5, 1] + * }); + * const panInputHmove = new eg.Axes.PanInput("#hmove"); + * const panInputVmove = new eg.Axes.PanInput("#vmove"); + * const pinchInputArea = new eg.Axes.PinchInput("#area", { + * scale: 1.5 + * }); + * + * // 4. Connect eg.Axes and InputTypes + * // [PanInput] When the mouse or touchscreen is down and moved. + * // Connect the 'something2' axis to the mouse or touchscreen x position and + * // connect the 'somethingN' axis to the mouse or touchscreen y position. + * axes.connect(["something2", "somethingN"], panInputArea); // or axes.connect("something2 somethingN", panInputArea); + * + * // Connect only one 'something1' axis to the mouse or touchscreen x position. + * axes.connect(["something1"], panInputHmove); // or axes.connect("something1", panInputHmove); + * + * // Connect only one 'something2' axis to the mouse or touchscreen y position. + * axes.connect(["", "something2"], panInputVmove); // or axes.connect(" something2", panInputVmove); + * + * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). + * axes.connect("something2", pinchInputArea); + * ``` + */ + + var Axes = + /*#__PURE__*/ + function (_super) { + __extends(Axes, _super); + /** + * + */ + + + function Axes(axis, options, startPos) { + if (axis === void 0) { + axis = {}; + } + + if (options === void 0) { + options = {}; + } + + if (startPos === void 0) { + startPos = null; + } + + var _this = _super.call(this) || this; + + _this.axis = axis; + _this._inputs = []; + _this.options = __assign({ + easing: function (x) { + return 1 - Math.pow(1 - x, 3); + }, + interruptable: true, + maximumDuration: Infinity, + minimumDuration: 0, + deceleration: 0.0006, + round: null, + nested: false + }, options); + _this.interruptManager = new InterruptManager(_this.options); + _this.axisManager = new AxisManager(_this.axis); + _this.eventManager = new EventManager(_this); + _this.animationManager = new EasingManager(_this); + _this.inputObserver = new InputObserver(_this); + + _this.eventManager.setAnimationManager(_this.animationManager); + + if (startPos) { + _this.eventManager.triggerChange(startPos); + } + + return _this; + } + /** + * Connect the axis of eg.Axes to the inputType. + * @ko eg.Axes의 축과 inputType을 연결한다 + * @param {(String[]|String)} axes The name of the axis to associate with inputType inputType과 연결할 축의 이름 + * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes eg.Axes의 축과 연결할 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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")); + * ``` + */ + + + var __proto = Axes.prototype; + + __proto.connect = function (axes, inputType) { + var mapped; + + if (typeof axes === "string") { + mapped = axes.split(" "); + } else { + mapped = axes.concat(); + } // check same instance + + + if (~this._inputs.indexOf(inputType)) { + this.disconnect(inputType); + } + + inputType.mapAxes(mapped); + inputType.connect(this.inputObserver); + + this._inputs.push(inputType); + + return this; + }; + /** + * Disconnect the axis of eg.Axes from the inputType. + * @ko eg.Axes의 축과 inputType의 연결을 끊는다. + * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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 + * ``` + */ + + + __proto.disconnect = function (inputType) { + if (inputType) { + var index = this._inputs.indexOf(inputType); + + if (index >= 0) { + this._inputs[index].disconnect(); + + this._inputs.splice(index, 1); + } + } else { + this._inputs.forEach(function (v) { + return v.disconnect(); + }); + + this._inputs = []; + } + + return this; + }; + /** + * Returns the current position of the coordinates. + * @ko 좌표의 현재 위치를 반환한다 + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Object.} Axis coordinate information 축 좌표 정보 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.get = function (axes) { + return this.axisManager.get(axes); + }; + /** + * Moves an axis to specific coordinates. + * @ko 좌표를 이동한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + this.animationManager.setTo(pos, duration); + return this; + }; + /** + * Moves an axis from the current coordinates to specific coordinates. + * @ko 현재 좌표를 기준으로 좌표를 이동한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + this.animationManager.setBy(pos, duration); + return this; + }; + /** + * Stop an animation in progress. + * @ko 재생 중인 애니메이션을 정지한다. + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * }); + * + * axes.setTo({"x": 10}, 1000); // start animatation + * + * // after 500 ms + * axes.stopAnimation(); // stop animation during movement. + * ``` + */ + + + __proto.stopAnimation = function () { + this.animationManager.stopAnimation(); + return this; + }; + /** + * Change the destination of an animation in progress. + * @ko 재생 중인 애니메이션의 목적지와 진행 시간을 변경한다. + * @param {UpdateAnimationOption} pos The coordinate to move to 이동할 좌표 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 200] + * }, + * "y": { + * range: [0, 200] + * } + * }); + * + * axes.setTo({"x": 50, "y": 50}, 1000); // trigger animation by setTo + * + * // after 500 ms + * axes.updateAnimation({destPos: {"x": 100, "y": 100}}); // animation will end after 500 ms, at {"x": 100, "y": 100} + * + * // after 500 ms + * axes.setTo({"x": 50, "y": 50}, 1000); // trigger animation by setTo + * + * // after 700 ms + * axes.updateAnimation({destPos: {"x": 100, "y": 100}, duration: 1500, restart: true}); // this works same as axes.setTo({"x": 100, "y": 100}, 800) since restart is true. + * ``` + */ + + + __proto.updateAnimation = function (options) { + this.animationManager.updateAnimation(options); + return this; + }; + /** + * Returns whether there is a coordinate in the bounce area of ​​the target axis. + * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다 + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부 + * @example + * ```js + * 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(); + * ``` + */ + + + __proto.isBounceArea = function (axes) { + return this.axisManager.isOutside(axes); + }; + /** + * Destroys properties, and events used in a module and disconnect all connections to inputTypes. + * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.eventManager.destroy(); + }; + /** + * @name VERSION + * @desc Version info string + * @ko 버전정보 문자열 + * + * @constant + * @type {String} + * @example + * ```js + * eg.Axes.VERSION; // ex) 3.3.3 + * ``` + */ + + + Axes.VERSION = "3.3.0"; + /* eslint-enable */ + + /** + * @name TRANSFORM + * @desc Returns the transform attribute with CSS vendor prefixes. + * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다. + * + * @constant + * @type {String} + * @example + * ```js + * eg.Axes.TRANSFORM; // "transform" or "webkitTransform" + * ``` + */ + + Axes.TRANSFORM = TRANSFORM; + /** + * @name DIRECTION_NONE + * @constant + * @type {Number} + */ + + Axes.DIRECTION_NONE = DIRECTION_NONE; + /** + * @name DIRECTION_LEFT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_LEFT = DIRECTION_LEFT; + /** + * @name DIRECTION_RIGHT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_RIGHT = DIRECTION_RIGHT; + /** + * @name DIRECTION_UP + * @constant + * @type {Number} + */ + + Axes.DIRECTION_UP = DIRECTION_UP; + /** + * @name DIRECTION_DOWN + * @constant + * @type {Number} + */ + + Axes.DIRECTION_DOWN = DIRECTION_DOWN; + /** + * @name DIRECTION_HORIZONTAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + /** + * @name DIRECTION_VERTICAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + /** + * @name DIRECTION_ALL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_ALL = DIRECTION_ALL; + return Axes; + }(Component); + + /* eslint-disable @typescript-eslint/no-empty-function */ + + var getDirectionByAngle = function (angle, thresholdAngle) { + if (thresholdAngle < 0 || thresholdAngle > 90) { + return DIRECTION_NONE; + } + + var toAngle = Math.abs(angle); + return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL; + }; + var useDirection = function (checkType, direction, userDirection) { + if (userDirection) { + return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType); + } else { + return !!(direction & checkType); + } + }; + /** + * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module. + * @ko eg.Axes.PanInput 모듈의 옵션 객체 + * @param {String[]} [inputType=["touch", "mouse", "pointer"]] Types of input devices + * - touch: Touch screen + * - mouse: Mouse + * - pointer: Mouse and touch 입력 장치 종류 + * - touch: 터치 입력 장치 + * - mouse: 마우스 + * - pointer: 마우스 및 터치 + * @param {String[]} [inputButton=["left"]] List of buttons to allow input + * - left: Left mouse button and normal touch + * - middle: Mouse wheel press + * - right: Right mouse button 입력을 허용할 버튼 목록 + * - left: 마우스 왼쪽 버튼 + * - middle: 마우스 휠 눌림 + * - right: 마우스 오른쪽 버튼 + * @param {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [scale[0]=1] horizontal axis scale 수평축 배율 + * @param {Number} [scale[1]=1] vertical axis scale 수직축 배율 + * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90) + * @param {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리 + * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px) + * @param {String} [touchAction=null] Value that overrides the element's "touch-action" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. 엘리먼트의 "touch-action" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다. + **/ + + /** + * 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 + * ```js + * 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 eg.Axes.PanInput 모듈을 사용할 엘리먼트 + * @param {PanInputOption} [options={}] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체 + */ + + var PanInput = + /*#__PURE__*/ + function () { + /** + * + */ + function PanInput(el, options) { + var _this = this; + + this.axes = []; + this.element = null; + this._enabled = false; + this._activeEvent = null; + this._atRightEdge = false; + this._rightEdgeTimer = 0; + + this._forceRelease = function () { + var activeEvent = _this._activeEvent; + var prevEvent = activeEvent.prevEvent; + activeEvent.onRelease(); + + _this._observer.release(_this, prevEvent, [0, 0]); + + _this._detachWindowEvent(activeEvent); + }; + + this._voidFunction = function () {}; + + this.element = $(el); + this.options = __assign({ + inputType: ["touch", "mouse", "pointer"], + inputButton: [MOUSE_LEFT], + scale: [1, 1], + thresholdAngle: 45, + threshold: 0, + iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD, + releaseOnScroll: false, + touchAction: null + }, options); + this._onPanstart = this._onPanstart.bind(this); + this._onPanmove = this._onPanmove.bind(this); + this._onPanend = this._onPanend.bind(this); + } + + var __proto = PanInput.prototype; + + __proto.mapAxes = function (axes) { + var useHorizontal = !!axes[0]; + var useVertical = !!axes[1]; + + if (useHorizontal && useVertical) { + this._direction = DIRECTION_ALL; + } else if (useHorizontal) { + this._direction = DIRECTION_HORIZONTAL; + } else if (useVertical) { + this._direction = DIRECTION_VERTICAL; + } else { + this._direction = DIRECTION_NONE; + } + + this.axes = axes; + }; + + __proto.connect = function (observer) { + if (this._activeEvent) { + this._detachElementEvent(); + + this._detachWindowEvent(this._activeEvent); + } + + this._attachElementEvent(observer); + + this._originalCssProps = setCssProps(this.element, this.options, this._direction); + return this; + }; + + __proto.disconnect = function () { + this._detachElementEvent(); + + this._detachWindowEvent(this._activeEvent); + + if (!isCssPropsFromAxes(this._originalCssProps)) { + revertCssProps(this.element, this._originalCssProps); + } + + this._direction = DIRECTION_NONE; + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onPanstart = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventStart(event, this.options.inputButton); + + if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { + return; + } + + if (panEvent.srcEvent.cancelable !== false) { + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + + this._observer.hold(this, panEvent); + + this._atRightEdge = IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold; + + this._attachWindowEvent(activeEvent); + + activeEvent.prevEvent = panEvent; + } + }; + + __proto._onPanmove = function (event) { + var _this = this; + + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventMove(event, this.options.inputButton); + + if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { + return; + } + + var _a = this.options, + iOSEdgeSwipeThreshold = _a.iOSEdgeSwipeThreshold, + releaseOnScroll = _a.releaseOnScroll; + var userDirection = getDirectionByAngle(panEvent.angle, this.options.thresholdAngle); + + if (releaseOnScroll && !panEvent.srcEvent.cancelable) { + this._onPanend(event); + + return; + } + + if (activeEvent.prevEvent && IS_IOS_SAFARI) { + var swipeLeftToRight = panEvent.center.x < 0; + + if (swipeLeftToRight) { + // iOS swipe left => right + this._forceRelease(); + + return; + } else if (this._atRightEdge) { + clearTimeout(this._rightEdgeTimer); // - is right to left + + var swipeRightToLeft = panEvent.deltaX < -iOSEdgeSwipeThreshold; + + if (swipeRightToLeft) { + this._atRightEdge = false; + } else { + // iOS swipe right => left + this._rightEdgeTimer = window.setTimeout(function () { + return _this._forceRelease(); + }, 100); + } + } + } + + var offset = this._getOffset([panEvent.offsetX, panEvent.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]); + + var prevent = offset.some(function (v) { + return v !== 0; + }); + + if (prevent) { + if (panEvent.srcEvent.cancelable !== false) { + panEvent.srcEvent.preventDefault(); + } + + panEvent.srcEvent.stopPropagation(); + } + + panEvent.preventSystemEvent = prevent; + + if (prevent) { + this._observer.change(this, panEvent, toAxis(this.axes, offset)); + } + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanend = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this._enabled || activeEvent.getTouches(event) !== 0) { + return; + } + + this._detachWindowEvent(activeEvent); + + clearTimeout(this._rightEdgeTimer); + var prevEvent = activeEvent.prevEvent; + + var velocity = this._getOffset([Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1), Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]); + + activeEvent.onRelease(); + + this._observer.release(this, prevEvent, velocity); + }; + + __proto._attachWindowEvent = function (activeEvent) { + var _this = this; + + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + window.addEventListener(event, _this._onPanmove, { + passive: false + }); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + window.addEventListener(event, _this._onPanend, { + passive: false + }); + }); + }; + + __proto._detachWindowEvent = function (activeEvent) { + var _this = this; + + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + window.removeEventListener(event, _this._onPanmove); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + window.removeEventListener(event, _this._onPanend); + }); + }; + + __proto._getOffset = function (properties, direction) { + var offset = [0, 0]; + var scale = this.options.scale; + + if (direction[0]) { + offset[0] = properties[0] * scale[0]; + } + + if (direction[1]) { + offset[1] = properties[1] * scale[1]; + } + + return offset; + }; + + __proto._attachElementEvent = function (observer) { + var _this = this; + + var activeEvent = convertInputType(this.options.inputType); + + if (!activeEvent) { + return; + } + + this._observer = observer; + this._enabled = true; + this._activeEvent = activeEvent; + activeEvent.start.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, _this._onPanstart); + }); // adding event listener to element prevents invalid behavior in iOS Safari + + activeEvent.move.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, _this._voidFunction); + }); + }; + + __proto._detachElementEvent = function () { + var _this = this; + + var activeEvent = this._activeEvent; + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._onPanstart); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._voidFunction); + }); + this._enabled = false; + this._observer = null; + }; + + return PanInput; + }(); + + /** + * A module that passes the angle moved by touch to Axes and uses one axis of rotation. + * [Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput) + * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다. + * [상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4) + * + * @example + * ```js + * const input = new eg.Axes.RotatePanInput("#area"); + * + * var axes = new eg.Axes({ + * // property name('angle') could be anything you want (eg. x, y, z...) + * angle: { + * range: [-180, 180] // from -180deg to 180deg + * } + * }); + * + * axes.connect("angle", input) + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트 + * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체 + * @extends PanInput + */ + + var RotatePanInput = + /*#__PURE__*/ + function (_super) { + __extends(RotatePanInput, _super); + /** + * + */ + + + function RotatePanInput(el, options) { + var _this = _super.call(this, el, options) || this; + + _this._prevQuadrant = null; + _this._lastDiff = 0; + return _this; + } + + var __proto = RotatePanInput.prototype; + + __proto.mapAxes = function (axes) { + this._direction = Axes.DIRECTION_ALL; + this.axes = axes; + }; + + __proto._onPanstart = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventStart(event, this.options.inputButton); + + if (!panEvent || !this.isEnabled()) { + return; + } + + var rect = this.element.getBoundingClientRect(); + + this._observer.hold(this, panEvent); + + this._attachWindowEvent(activeEvent); // TODO: how to do if element is ellipse not circle. + + + this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360 + // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin + + this._rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle. + + this._prevAngle = null; + + this._triggerChange(panEvent); + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanmove = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventMove(event, this.options.inputButton); + + if (!panEvent || !this.isEnabled()) { + return; + } + + if (panEvent.srcEvent.cancelable !== false) { + panEvent.srcEvent.preventDefault(); + } + + panEvent.srcEvent.stopPropagation(); + + this._triggerChange(panEvent); + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanend = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this.isEnabled()) { + return; + } + + var prevEvent = activeEvent.prevEvent; + + this._triggerChange(prevEvent); + + var vx = prevEvent.velocityX; + var vy = prevEvent.velocityY; + var velocity = Math.sqrt(vx * vx + vy * vy) * (this._lastDiff > 0 ? -1 : 1); // clockwise + + activeEvent.onRelease(); + + this._observer.release(this, prevEvent, [velocity * this._coefficientForDistanceToAngle]); + + this._detachWindowEvent(activeEvent); + }; + + __proto._triggerChange = function (event) { + var _a = this._getPosFromOrigin(event.center.x, event.center.y), + x = _a.x, + y = _a.y; + + var angle = getAngle(x, y); + var positiveAngle = angle < 0 ? 360 + angle : angle; + + var quadrant = this._getQuadrant(event.center.x, event.center.y); + + var diff = this._getDifference(this._prevAngle, positiveAngle, this._prevQuadrant, quadrant); + + this._prevAngle = positiveAngle; + this._prevQuadrant = quadrant; + + if (diff === 0) { + return; + } + + this._lastDiff = diff; + + this._observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise + + }; + + __proto._getDifference = function (prevAngle, angle, prevQuadrant, quadrant) { + var diff; + + if (prevAngle === null) { + diff = 0; + } else if (prevQuadrant === 1 && quadrant === 4) { + diff = -prevAngle - (360 - angle); + } else if (prevQuadrant === 4 && quadrant === 1) { + diff = 360 - prevAngle + angle; + } else { + diff = angle - prevAngle; + } + + return diff; + }; + + __proto._getPosFromOrigin = function (posX, posY) { + return { + x: posX - this._rotateOrigin[0], + y: this._rotateOrigin[1] - posY + }; + }; + + __proto._getQuadrant = function (posX, posY) { + /** + * Quadrant + * y(+) + * | + * 2 | 1 + * --------------->x(+) + * 3 | 4 + * | + */ + var _a = this._getPosFromOrigin(posX, posY), + x = _a.x, + y = _a.y; + + var q = 0; + + if (x >= 0 && y >= 0) { + q = 1; + } else if (x < 0 && y >= 0) { + q = 2; + } else if (x < 0 && y < 0) { + q = 3; + } else if (x >= 0 && y < 0) { + q = 4; + } + + return q; + }; + + return RotatePanInput; + }(PanInput); + + /** + * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module + * @ko eg.Axes.PinchInput 모듈의 옵션 객체 + * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율 + * @param {String[]} [inputType=["touch", "pointer"]] Types of input devices + * - touch: Touch screen + * - pointer: Mouse and touch 입력 장치 종류 + * - touch: 터치 입력 장치 + * - pointer: 마우스 및 터치 + * @param {String} [touchAction="none"] Value that overrides the element's "touch-action" css property. It is set to "none" to prevent scrolling during touch. 엘리먼트의 "touch-action" CSS 속성을 덮어쓰는 값. 터치 도중 스크롤을 방지하기 위해 "none" 으로 설정되어 있다. + **/ + + /** + * 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 + * ```js + * 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 eg.Axes.PinchInput 모듈을 사용할 엘리먼트 + * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput moduleeg.Axes.PinchInput 모듈의 옵션 객체 + */ + + var PinchInput = + /*#__PURE__*/ + function () { + /** + * + */ + function PinchInput(el, options) { + this.axes = []; + this.element = null; + this._pinchFlag = false; + this._enabled = false; + this._activeEvent = null; + this.element = $(el); + this.options = __assign({ + scale: 1, + threshold: 0, + inputType: ["touch", "pointer"], + touchAction: "none" + }, options); + this._onPinchStart = this._onPinchStart.bind(this); + this._onPinchMove = this._onPinchMove.bind(this); + this._onPinchEnd = this._onPinchEnd.bind(this); + } + + var __proto = PinchInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + if (this._activeEvent) { + this._detachEvent(); + } + + this._attachEvent(observer); + + this._originalCssProps = setCssProps(this.element, this.options, DIRECTION_ALL); + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + if (!isCssPropsFromAxes(this._originalCssProps)) { + revertCssProps(this.element, this._originalCssProps); + } + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onPinchStart = function (event) { + var activeEvent = this._activeEvent; + var pinchEvent = activeEvent.onEventStart(event); + + if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) { + return; + } + + this._baseValue = this._observer.get(this)[this.axes[0]]; + + this._observer.hold(this, event); + + this._pinchFlag = true; + activeEvent.prevEvent = pinchEvent; + }; + + __proto._onPinchMove = function (event) { + var activeEvent = this._activeEvent; + var pinchEvent = activeEvent.onEventMove(event); + + if (!pinchEvent || !this._pinchFlag || !this._enabled || activeEvent.getTouches(event) !== 2) { + return; + } + + var offset = this._getOffset(pinchEvent.scale, activeEvent.prevEvent.scale); + + this._observer.change(this, event, toAxis(this.axes, [offset])); + + activeEvent.prevEvent = pinchEvent; + }; + + __proto._onPinchEnd = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this._pinchFlag || !this._enabled || activeEvent.getTouches(event) >= 2) { + return; + } + + activeEvent.onRelease(); + + this._observer.release(this, event, [0], 0); + + this._baseValue = null; + this._pinchFlag = false; + }; + + __proto._attachEvent = function (observer) { + var _this = this; + + var activeEvent = convertInputType(this.options.inputType); + + if (!activeEvent) { + return; + } + + this._observer = observer; + this._enabled = true; + this._activeEvent = activeEvent; + activeEvent.start.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchStart, false); + }); + activeEvent.move.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchMove, false); + }); + activeEvent.end.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchEnd, false); + }); + }; + + __proto._detachEvent = function () { + var _this = this; + + var activeEvent = this._activeEvent; + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchStart, false); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchMove, false); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchEnd, false); + }); + this._enabled = false; + this._observer = null; + }; + + __proto._getOffset = function (pinchScale, prev) { + if (prev === void 0) { + prev = 1; + } + + return this._baseValue * (pinchScale - prev) * this.options.scale; + }; + + return PinchInput; + }(); + + /** + * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module + * @ko eg.Axes.WheelInput 모듈의 옵션 객체 + * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [releaseDelay=300] Millisecond that trigger release event after last input마지막 입력 이후 release 이벤트가 트리거되기까지의 밀리초 + * @param {Boolean} [useNormalized=true] Whether to calculate scroll speed the same in all browsers모든 브라우저에서 스크롤 속도를 동일하게 처리할지 여부 + * @param {Boolean} [useAnimation=false] Whether to process coordinate changes through the mouse wheel as a continuous animation마우스 휠을 통한 좌표 변화를 연속적인 애니메이션으로 처리할지 여부 + **/ + + /** + * A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis. + * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. + * + * @example + * ```js + * const wheel = new eg.Axes.WheelInput("#area", { + * scale: 1 + * }); + * + * // Connect 'something' axis when the mousewheel is moved. + * axes.connect("something", wheel); + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module eg.Axes.WheelInput 모듈을 사용할 엘리먼트 + * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput moduleeg.Axes.WheelInput 모듈의 옵션 객체 + */ + + var WheelInput = + /*#__PURE__*/ + function () { + /** + * + */ + function WheelInput(el, options) { + this.axes = []; + this.element = null; + this._enabled = false; + this._holding = false; + this._timer = null; + this.element = $(el); + this.options = __assign({ + scale: 1, + releaseDelay: 300, + useNormalized: true, + useAnimation: false + }, options); + this._onWheel = this._onWheel.bind(this); + } + + var __proto = WheelInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + this._detachEvent(); + + this._attachEvent(observer); + + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onWheel = function (event) { + var _this = this; + + if (!this._enabled) { + return; + } + + event.preventDefault(); + + if (event.deltaY === 0) { + return; + } + + if (!this._holding) { + this._observer.hold(this, event); + + this._holding = true; + } + + var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY)); + + this._observer.change(this, event, toAxis(this.axes, [offset]), this.options.useAnimation); + + clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (_this._holding) { + _this._holding = false; + + _this._observer.release(_this, event, [0]); + } + }, this.options.releaseDelay); + }; + + __proto._attachEvent = function (observer) { + this._observer = observer; + this.element.addEventListener("wheel", this._onWheel); + this._enabled = true; + }; + + __proto._detachEvent = function () { + this.element.removeEventListener("wheel", this._onWheel); + this._enabled = false; + this._observer = null; + + if (this._timer) { + clearTimeout(this._timer); + this._timer = null; + } + }; + + return WheelInput; + }(); + + var KEY_LEFT_ARROW = 37; + var KEY_A = 65; + var KEY_UP_ARROW = 38; + var KEY_W = 87; + var KEY_RIGHT_ARROW = 39; + var KEY_D = 68; + var KEY_DOWN_ARROW = 40; + var KEY_S = 83; + /* eslint-disable */ + + var DIRECTION_REVERSE = -1; + var DIRECTION_FORWARD = 1; + var DIRECTION_HORIZONTAL$1 = -1; + var DIRECTION_VERTICAL$1 = 1; + var DELAY = 80; + /** + * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module + * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체 + * @param {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율 + * @param {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율 + **/ + + /** + * A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis. + * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다. + * + * @example + * ```js + * const moveKey = new eg.Axes.MoveKeyInput("#area", { + * scale: [1, 1] + * }); + * + * // Connect 'x', 'y' axes when the moveKey is pressed. + * axes.connect(["x", "y"], moveKey); + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트 + * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput moduleeg.Axes.MoveKeyInput 모듈의 옵션 객체 + */ + + var MoveKeyInput = + /*#__PURE__*/ + function () { + /** + * + */ + function MoveKeyInput(el, options) { + this.axes = []; + this.element = null; + this._enabled = false; + this._holding = false; + this._timer = null; + this.element = $(el); + this.options = __assign({ + scale: [1, 1] + }, options); + this._onKeydown = this._onKeydown.bind(this); + this._onKeyup = this._onKeyup.bind(this); + } + + var __proto = MoveKeyInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + this._detachEvent(); // add tabindex="0" to the container for making it focusable + + + if (this.element.getAttribute("tabindex") !== "0") { + this.element.setAttribute("tabindex", "0"); + } + + this._attachEvent(observer); + + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onKeydown = function (event) { + if (!this._enabled) { + return; + } + + var isMoveKey = true; + var direction = DIRECTION_FORWARD; + var move = DIRECTION_HORIZONTAL$1; + + switch (event.keyCode) { + case KEY_LEFT_ARROW: + case KEY_A: + direction = DIRECTION_REVERSE; + break; + + case KEY_RIGHT_ARROW: + case KEY_D: + break; + + case KEY_DOWN_ARROW: + case KEY_S: + direction = DIRECTION_REVERSE; + move = DIRECTION_VERTICAL$1; + break; + + case KEY_UP_ARROW: + case KEY_W: + move = DIRECTION_VERTICAL$1; + break; + + default: + isMoveKey = false; + } + + if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) { + isMoveKey = false; + } + + if (!isMoveKey) { + return; + } + + event.preventDefault(); + var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction]; + + if (!this._holding) { + this._observer.hold(this, event); + + this._holding = true; + } + + clearTimeout(this._timer); + + this._observer.change(this, event, toAxis(this.axes, offsets)); + }; + + __proto._onKeyup = function (event) { + var _this = this; + + if (!this._holding) { + return; + } + + clearTimeout(this._timer); + this._timer = setTimeout(function () { + _this._observer.release(_this, event, [0, 0]); + + _this._holding = false; + }, DELAY); + }; + + __proto._attachEvent = function (observer) { + this._observer = observer; + this.element.addEventListener("keydown", this._onKeydown, false); + this.element.addEventListener("keypress", this._onKeydown, false); + this.element.addEventListener("keyup", this._onKeyup, false); + this._enabled = true; + }; + + __proto._detachEvent = function () { + this.element.removeEventListener("keydown", this._onKeydown, false); + this.element.removeEventListener("keypress", this._onKeydown, false); + this.element.removeEventListener("keyup", this._onKeyup, false); + this._enabled = false; + this._observer = null; + }; + + return MoveKeyInput; + }(); + + Axes.PanInput = PanInput; + Axes.RotatePanInput = RotatePanInput; + Axes.PinchInput = PinchInput; + Axes.WheelInput = WheelInput; + Axes.MoveKeyInput = MoveKeyInput; + + return Axes; + +}))); +//# sourceMappingURL=axes.js.map diff --git a/dist/axes.js.map b/dist/axes.js.map new file mode 100644 index 00000000..5e5f10b0 --- /dev/null +++ b/dist/axes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axes.js","sources":["../src/browser.ts","../src/const.ts","../src/utils.ts","../src/EventManager.ts","../src/InterruptManager.ts","../src/Coordinate.ts","../src/AxisManager.ts","../src/eventInput/EventInput.ts","../src/eventInput/MouseEventInput.ts","../src/eventInput/TouchEventInput.ts","../src/eventInput/PointerEventInput.ts","../src/eventInput/TouchMouseEventInput.ts","../src/inputType/InputType.ts","../src/InputObserver.ts","../src/animation/AnimationManager.ts","../src/animation/EasingManager.ts","../src/Axes.ts","../src/inputType/PanInput.ts","../src/inputType/RotatePanInput.ts","../src/inputType/PinchInput.ts","../src/inputType/WheelInput.ts","../src/inputType/MoveKeyInput.ts","../src/index.umd.ts"],"sourcesContent":["/* eslint-disable no-new-func, no-nested-ternary */\n\nlet win: any;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {\n navigator: {\n userAgent: \"\",\n },\n };\n} else {\n win = window;\n}\n/* eslint-enable no-new-func, no-nested-ternary */\n\nexport { win as window };\n","export const DIRECTION_NONE = 1;\nexport const DIRECTION_LEFT = 2;\nexport const DIRECTION_RIGHT = 4;\nexport const DIRECTION_HORIZONTAL = 2 | 4;\nexport const DIRECTION_UP = 8;\nexport const DIRECTION_DOWN = 16;\nexport const DIRECTION_VERTICAL = 8 | 16;\nexport const DIRECTION_ALL = 2 | 4 | 8 | 16;\n\nexport const MOUSE_LEFT = \"left\";\nexport const MOUSE_RIGHT = \"right\";\nexport const MOUSE_MIDDLE = \"middle\";\n\nexport const VELOCITY_INTERVAL = 16;\n\nimport getAgent from \"@egjs/agent\";\n\nimport { window } from \"./browser\";\n\nexport const IOS_EDGE_THRESHOLD = 30;\nexport const IS_IOS_SAFARI =\n \"ontouchstart\" in window && getAgent().browser.name === \"safari\";\n\nexport const TRANSFORM = (() => {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n const bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0])\n .style;\n const target = [\n \"transform\",\n \"webkitTransform\",\n \"msTransform\",\n \"mozTransform\",\n ];\n for (let i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n return \"\";\n})();\n\nexport const PREVENT_DRAG_CSSPROPS = {\n \"user-select\": \"none\",\n \"-webkit-user-drag\": \"none\",\n};\n","import { window } from \"./browser\";\nimport { PREVENT_DRAG_CSSPROPS } from \"./const\";\nimport { PanInputOption } from \"./inputType/PanInput\";\nimport { PinchInputOption } from \"./inputType/PinchInput\";\nimport { ObjectInterface } from \"./types\";\nimport {\n DIRECTION_NONE,\n DIRECTION_VERTICAL,\n DIRECTION_HORIZONTAL,\n DIRECTION_ALL,\n} from \"./const\";\n\ndeclare let jQuery: any;\n\nexport const toArray = (nodes: NodeList): HTMLElement[] => {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n const el = [];\n for (let i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n return el;\n};\n\nexport const $ = (param, multi = false) => {\n let el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n const match = param.match(/^<([a-z]+)\\s*([^>]*)>/);\n\n // creating element\n if (match) {\n // HTML\n const dummy = document.createElement(\"div\");\n\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === window) {\n // window\n el = param;\n } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) {\n // HTMLElement, Document\n el = param;\n } else if (\n (\"jQuery\" in window && param instanceof jQuery) ||\n param.constructor.prototype.jquery\n ) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map((v) => $(v));\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n return el;\n};\n\nlet raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame;\nlet caf = window.cancelAnimationFrame || window.webkitCancelAnimationFrame;\nif (raf && !caf) {\n const keyInfo = {};\n const oldraf = raf;\n raf = (callback: FrameRequestCallback) => {\n const wrapCallback = (timestamp: number) => {\n if (keyInfo[key]) {\n callback(timestamp);\n }\n };\n const key = oldraf(wrapCallback);\n keyInfo[key] = true;\n return key;\n };\n caf = (key: number) => {\n delete keyInfo[key];\n };\n} else if (!(raf && caf)) {\n raf = (callback: FrameRequestCallback) => {\n return window.setTimeout(() => {\n callback(\n ((window.performance &&\n window.performance.now &&\n window.performance.now()) as number) || new Date().getTime()\n );\n }, 16);\n };\n caf = window.clearTimeout;\n}\n\n/**\n * A polyfill for the window.requestAnimationFrame() method.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame\n * @private\n */\nexport const requestAnimationFrame = (fp) => {\n return raf(fp);\n};\n/**\n * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method.\n * @param {Number} key −\tThe ID value returned through a call to the requestAnimationFrame() method. requestAnimationFrame() 메서드가 반환한 아이디 값\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame\n * @private\n */\nexport const cancelAnimationFrame = (key) => {\n caf(key);\n};\n\nexport const map = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => U\n): ObjectInterface => {\n const tranformed: ObjectInterface = {};\n\n for (const k in obj) {\n if (k) {\n tranformed[k] = callback(obj[k], k);\n }\n }\n return tranformed;\n};\n\nexport const filter = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n): ObjectInterface => {\n const filtered: ObjectInterface = {};\n\n for (const k in obj) {\n if (k && callback(obj[k], k)) {\n filtered[k] = obj[k];\n }\n }\n return filtered;\n};\nexport const every = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n) => {\n for (const k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n return true;\n};\nexport const equal = (\n target: ObjectInterface,\n base: ObjectInterface\n): boolean => {\n return every(target, (v, k) => v === base[k]);\n};\n\nconst roundNumFunc = {};\n\nexport const roundNumber = (num: number, roundUnit: number) => {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n};\n\nexport const roundNumbers = (\n num: ObjectInterface,\n roundUnit: ObjectInterface | number\n): ObjectInterface => {\n if (!num || !roundUnit) {\n return num;\n }\n return map(num, (value, key) =>\n roundNumber(\n value,\n typeof roundUnit === \"number\" ? roundUnit : roundUnit[key]\n )\n );\n};\n\nexport const getDecimalPlace = (val: number): number => {\n if (!isFinite(val)) {\n return 0;\n }\n\n const v = `${val}`;\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n let p = 0;\n let e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n }\n\n // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n};\n\nexport const inversePow = (n: number) => {\n // replace Math.pow(10, -n) to solve floating point issue.\n // eg. Math.pow(10, -4) => 0.00009999999999999999\n return 1 / Math.pow(10, n);\n};\n\nexport const getRoundFunc = (v: number) => {\n const p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n\n return (n: number) => {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n};\n\nexport const getAngle = (posX: number, posY: number) => {\n return (Math.atan2(posY, posX) * 180) / Math.PI;\n};\n\nexport const isCssPropsFromAxes = (originalCssProps: {\n [key: string]: string;\n}) => {\n let same = true;\n Object.keys(PREVENT_DRAG_CSSPROPS).forEach((prop) => {\n if (\n !originalCssProps ||\n originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]\n ) {\n same = false;\n }\n });\n return same;\n};\n\nexport const setCssProps = (\n element: HTMLElement,\n option: PanInputOption | PinchInputOption,\n direction: number\n): { [key: string]: string } => {\n const touchActionMap = {\n [DIRECTION_NONE]: \"auto\",\n [DIRECTION_ALL]: \"none\",\n [DIRECTION_VERTICAL]: \"pan-x\",\n [DIRECTION_HORIZONTAL]: \"pan-y\",\n };\n const oldCssProps = {};\n if (element && element.style) {\n const touchAction = option.touchAction\n ? option.touchAction\n : touchActionMap[direction];\n const newCssProps = {\n ...PREVENT_DRAG_CSSPROPS,\n \"touch-action\":\n element.style[\"touch-action\"] === \"none\" ? \"none\" : touchAction,\n };\n Object.keys(newCssProps).forEach((prop) => {\n oldCssProps[prop] = element.style[prop];\n element.style[prop] = newCssProps[prop];\n });\n }\n return oldCssProps;\n};\n\nexport const revertCssProps = (\n element: HTMLElement,\n originalCssProps: { [key: string]: string }\n): { [key: string]: string } => {\n if (element && element.style && originalCssProps) {\n Object.keys(originalCssProps).forEach((prop) => {\n element.style[prop] = originalCssProps[prop];\n });\n }\n return;\n};\n","import { ComponentEvent } from \"@egjs/component\";\n\nimport { InputType } from \"./inputType/InputType\";\nimport { Axis } from \"./AxisManager\";\nimport Axes from \"./Axes\";\nimport { roundNumbers } from \"./utils\";\nimport { AnimationParam, OnAnimationStart, OnRelease } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface ChangeEventOption {\n input: InputType;\n event;\n}\n\nexport class EventManager {\n public animationManager: AnimationManager;\n public constructor(private _axes: Axes) {}\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @event Axes#hold\n * @type {object}\n * @property {Object.} pos coordinate 좌표 정보\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"hold\", function(event) {\n * // event.pos\n * // event.input\n * // event.inputEvent\n * // isTrusted\n * });\n * ```\n */\n public hold(pos: Axis, option: ChangeEventOption) {\n const { roundPos } = this._getRoundPos(pos);\n\n this._axes.trigger(\n new ComponentEvent(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true,\n })\n );\n }\n\n /**\n * Specifies the coordinates to move after the 'change' event. It works when the holding value of the change event is true.\n * @ko 'change' 이벤트 이후 이동할 좌표를 지정한다. change이벤트의 holding 값이 true일 경우에 동작한다\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events.\n * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationStart\", function(event) {\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n /**\n * This event is fired when a user release an element on the screen of the device.\n * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트\n * @event Axes#release\n * @type {object}\n * @property {Object.} depaPos The coordinates when releasing an element손을 뗐을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to after releasing an element손을 뗀 뒤에 이동할 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value 손을 뗐을 때의 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'release' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerRelease(param: AnimationParam) {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n this._axes.trigger(\n new ComponentEvent(\"release\", {\n ...param,\n bounceRatio: this._getBounceRatio(roundPos),\n } as OnRelease)\n );\n }\n\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @event Axes#change\n * @type {object}\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value 현재 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.사용자가 기기의 화면을 누르고 있는지 여부\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true 이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * // event.pos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.holding\n * // event.set\n * // event.isTrusted\n *\n * // if you want to change the coordinates to move after the 'change' event.\n * // it works when the holding value of the change event is true.\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n public triggerChange(\n pos: Axis,\n depaPos?: Axis,\n option?: ChangeEventOption,\n holding: boolean = false\n ) {\n const animationManager = this.animationManager;\n const axisManager = animationManager.axisManager;\n const eventInfo = animationManager.getEventInfo();\n const { roundPos, roundDepa } = this._getRoundPos(pos, depaPos);\n const moveTo = axisManager.moveTo(roundPos, roundDepa);\n const inputEvent = option?.event || eventInfo?.event || null;\n const param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n bounceRatio: this._getBounceRatio(moveTo.pos),\n holding,\n inputEvent,\n isTrusted: !!inputEvent,\n input: option?.input || eventInfo?.input || null,\n set: inputEvent ? this._createUserControll(moveTo.pos) : () => {}, // eslint-disable-line @typescript-eslint/no-empty-function\n };\n const event = new ComponentEvent(\"change\", param);\n this._axes.trigger(event);\n\n if (inputEvent) {\n axisManager.set(\n (param.set() as { destPos: Axis; duration: number }).destPos\n );\n }\n\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @event Axes#animationStart\n * @type {object}\n * @property {Object.} depaPos The coordinates when animation starts애니메이션이 시작 되었을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to. If you change this value, you can run the animation이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'animationStart' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerAnimationStart(param: AnimationParam): boolean {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n const event = new ComponentEvent(\n \"animationStart\",\n param as OnAnimationStart\n );\n this._axes.trigger(event);\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#animationEnd\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationEnd\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerAnimationEnd(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"animationEnd\", {\n isTrusted,\n })\n );\n }\n\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#finish\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"finish\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerFinish(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"finish\", {\n isTrusted,\n })\n );\n }\n\n public setAnimationManager(animationManager: AnimationManager) {\n this.animationManager = animationManager;\n }\n\n public destroy() {\n this._axes.off();\n }\n\n private _createUserControll(pos: Axis, duration: number = 0) {\n // to controll\n const userControl = {\n destPos: { ...pos },\n duration,\n };\n return (\n toPos?: Axis,\n userDuration?: number\n ): { destPos: Axis; duration: number } => {\n if (toPos) {\n userControl.destPos = { ...toPos };\n }\n if (userDuration !== undefined) {\n userControl.duration = userDuration;\n }\n return userControl;\n };\n }\n\n private _getRoundPos(pos: Axis, depaPos?: Axis) {\n // round value if round exist\n const roundUnit = this._axes.options.round;\n\n // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit),\n };\n }\n\n private _getBounceRatio(pos: Axis): Axis {\n return this._axes.axisManager.map(pos, (v, opt) => {\n if (v < opt.range[0] && opt.bounce[0] !== 0) {\n return (opt.range[0] - v) / opt.bounce[0];\n } else if (v > opt.range[1] && opt.bounce[1] !== 0) {\n return (v - opt.range[1]) / opt.bounce[1];\n } else {\n return 0;\n }\n });\n }\n}\n","import { AxesOption } from \"./Axes\";\nexport class InterruptManager {\n private _prevented = false; // check whether the animation event was prevented\n public constructor(private _options: AxesOption) {}\n\n public isInterrupting() {\n // when interruptable is 'true', return value is always 'true'.\n return this._options.interruptable || this._prevented;\n }\n\n public isInterrupted() {\n return !this._options.interruptable && this._prevented;\n }\n\n public setInterrupt(prevented) {\n if (!this._options.interruptable) {\n this._prevented = prevented;\n }\n }\n}\n","export const getInsidePosition = (\n destPos: number,\n range: number[],\n circular: boolean[],\n bounce?: number[]\n): number => {\n let toDestPos: number = destPos;\n const targetRange: number[] = [\n circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0],\n circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1],\n ];\n\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n\n return toDestPos;\n};\n\n// determine outside\nexport const isOutside = (pos: number, range: number[]): boolean => {\n return pos < range[0] || pos > range[1];\n};\n\n// determine whether position has reached the maximum moveable area\nexport const isEndofBounce = (\n pos: number,\n range: number[],\n bounce: number[],\n circular: boolean[]\n): boolean => {\n return (\n (!circular[0] && pos === range[0] - bounce[0]) ||\n (!circular[1] && pos === range[1] + bounce[1])\n );\n};\n\nexport const getDuration = (distance: number, deceleration): number => {\n const duration = Math.sqrt((distance / deceleration) * 2);\n\n // when duration is under 100, then value is zero\n return duration < 100 ? 0 : duration;\n};\n\nexport const isCircularable = (\n destPos: number,\n range: number[],\n circular: boolean[]\n): boolean => {\n return (\n (circular[1] && destPos > range[1]) || (circular[0] && destPos < range[0])\n );\n};\n\nexport const getCirculatedPos = (\n pos: number,\n range: number[],\n circular: boolean[]\n): number => {\n let toPos = pos;\n const min = range[0];\n const max = range[1];\n const length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = ((toPos - max) % length) + min;\n }\n if (circular[0] && pos < min) {\n // left\n toPos = ((toPos - min) % length) + max;\n }\n return toPos;\n};\n","import { isOutside, getCirculatedPos } from \"./Coordinate\";\nimport { map, filter, every } from \"./utils\";\nimport { ObjectInterface } from \"./types\";\n\nexport interface Axis {\n [key: string]: number;\n}\n\nexport interface AxisOption {\n range?: number[];\n bounce?: number | number[];\n circular?: boolean | boolean[];\n}\n\nexport class AxisManager {\n private _pos: Axis;\n public constructor(private _axis: ObjectInterface) {\n this._complementOptions();\n this._pos = Object.keys(this._axis).reduce((acc, v) => {\n acc[v] = this._axis[v].range[0];\n return acc;\n }, {});\n }\n\n public getDelta(depaPos: Axis, destPos: Axis): Axis {\n const fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), (v, k) => v - fullDepaPos[k]);\n }\n\n public get(axes?: string[] | Axis): Axis {\n if (axes && Array.isArray(axes)) {\n return axes.reduce((acc, v) => {\n if (v && v in this._pos) {\n acc[v] = this._pos[v];\n }\n return acc;\n }, {});\n } else {\n return { ...this._pos, ...((axes || {}) as Axis) };\n }\n }\n\n public moveTo(pos: Axis, depaPos: Axis = this._pos): { [key: string]: Axis } {\n const delta = map(this._pos, (v, key) => {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n\n this.set(\n this.map(pos, (v, opt) =>\n opt ? getCirculatedPos(v, opt.range, opt.circular as boolean[]) : 0\n )\n );\n return {\n pos: { ...this._pos },\n delta,\n };\n }\n\n public set(pos: Axis) {\n for (const k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n }\n\n public every(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): boolean {\n const axisOptions = this._axis;\n\n return every(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public filter(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): Axis {\n const axisOptions = this._axis;\n\n return filter(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public map(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => U\n ) {\n const axisOptions = this._axis;\n\n return map(pos, (value, key) =>\n callback(value, axisOptions[key], key)\n );\n }\n\n public isOutside(axes?: string[]) {\n return !this.every(\n axes ? this.get(axes) : this._pos,\n (v, opt) => !isOutside(v, opt.range)\n );\n }\n\n public getAxisOptions(key: string) {\n return this._axis[key];\n }\n\n /**\n * set up 'css' expression\n * @private\n */\n private _complementOptions() {\n Object.keys(this._axis).forEach((axis) => {\n this._axis[axis] = {\n ...{\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false],\n },\n ...this._axis[axis],\n };\n\n [\"bounce\", \"circular\"].forEach((v) => {\n const axisOption = this._axis;\n const key = axisOption[axis][v];\n\n if (/string|number|boolean/.test(typeof key)) {\n axisOption[axis][v] = [key, key];\n }\n });\n });\n }\n}\n","import { ExtendedEvent, InputEventType, LatestInterval } from \"../types\";\nimport { getAngle } from \"../utils\";\nimport { window } from \"../browser\";\nimport {\n MOUSE_LEFT,\n MOUSE_MIDDLE,\n MOUSE_RIGHT,\n VELOCITY_INTERVAL,\n} from \"../const\";\n\nexport const SUPPORT_TOUCH = \"ontouchstart\" in window;\nexport const SUPPORT_POINTER = \"PointerEvent\" in window;\nexport const SUPPORT_MSPOINTER = \"MSPointerEvent\" in window;\nexport const SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER;\n\nexport abstract class EventInput {\n public prevEvent: ExtendedEvent;\n private _latestInterval: LatestInterval;\n\n public abstract onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventEnd(event: InputEventType): void;\n\n public abstract onRelease(event: InputEventType): void;\n\n public abstract getTouches(event: InputEventType): number;\n\n protected abstract _getScale(event: InputEventType): number;\n\n protected abstract _getCenter(event: InputEventType): {\n x: number;\n y: number;\n };\n\n protected abstract _getMovement(event: InputEventType): {\n x: number;\n y: number;\n };\n\n public extendEvent(event: InputEventType): ExtendedEvent {\n const prevEvent = this.prevEvent;\n const center = this._getCenter(event);\n const movement = prevEvent ? this._getMovement(event) : { x: 0, y: 0 };\n const scale = prevEvent ? this._getScale(event) : 1;\n const angle = prevEvent\n ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y)\n : 0;\n const deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x;\n const deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y;\n const offsetX = movement.x;\n const offsetY = movement.y;\n const latestInterval = this._latestInterval;\n const timeStamp = Date.now();\n const deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;\n let velocityX = prevEvent ? prevEvent.velocityX : 0;\n let velocityY = prevEvent ? prevEvent.velocityY : 0;\n if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {\n if (latestInterval) {\n [velocityX, velocityY] = [\n (deltaX - latestInterval.deltaX) / deltaTime,\n (deltaY - latestInterval.deltaY) / deltaTime,\n ];\n }\n this._latestInterval = {\n timestamp: timeStamp,\n deltaX,\n deltaY,\n };\n }\n return {\n srcEvent: event,\n scale,\n angle,\n center,\n deltaX,\n deltaY,\n offsetX,\n offsetY,\n velocityX,\n velocityY,\n preventSystemEvent: true,\n };\n }\n\n protected _getDistance(\n start: Touch | PointerEvent,\n end: Touch | PointerEvent\n ): number {\n const x = end.clientX - start.clientX;\n const y = end.clientY - start.clientY;\n return Math.sqrt(x * x + y * y);\n }\n\n protected _getButton(event: InputEventType): string {\n const buttonCodeMap = { 1: MOUSE_LEFT, 2: MOUSE_RIGHT, 4: MOUSE_MIDDLE };\n const button = this._isTouchEvent(event)\n ? MOUSE_LEFT\n : buttonCodeMap[event.buttons];\n return button ? button : null;\n }\n\n protected _isTouchEvent(event: InputEventType): event is TouchEvent {\n return event.type.indexOf(\"touch\") > -1;\n }\n\n protected _isValidButton(button: string, inputButton: string[]): boolean {\n return inputButton.indexOf(button) > -1;\n }\n\n protected _preventMouseButton(event: InputEventType, button: string): void {\n if (button === MOUSE_RIGHT) {\n window.addEventListener(\"contextmenu\", this._stopContextMenu);\n } else if (button === MOUSE_MIDDLE) {\n event.preventDefault();\n }\n }\n\n private _stopContextMenu = (event: InputEventType) => {\n event.preventDefault();\n window.removeEventListener(\"contextmenu\", this._stopContextMenu);\n };\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class MouseEventInput extends EventInput {\n public readonly start = [\"mousedown\"];\n public readonly move = [\"mousemove\"];\n public readonly end = [\"mouseup\"];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(): void {\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n return;\n }\n\n public getTouches(): number {\n return 0;\n }\n\n protected _getScale(): number {\n return 1;\n }\n\n protected _getCenter(event: MouseEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as MouseEvent;\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchEventInput extends EventInput {\n public readonly start = [\"touchstart\"];\n public readonly move = [\"touchmove\"];\n public readonly end = [\"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(event: InputEventType): ExtendedEvent {\n this._baseTouches = (event as TouchEvent).touches;\n return this.extendEvent(event);\n }\n\n public onEventMove(event: InputEventType): ExtendedEvent {\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._baseTouches = (event as TouchEvent).touches;\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return (event as TouchEvent).touches.length;\n }\n\n protected _getScale(event: TouchEvent): number {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n\n protected _getCenter(event: TouchEvent): { x: number; y: number } {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n\n protected _getMovement(event: TouchEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as TouchEvent;\n if (event.touches[0].identifier !== prev.touches[0].identifier) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.touches[0].clientX - prev.touches[0].clientX,\n y: event.touches[0].clientY - prev.touches[0].clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput, SUPPORT_POINTER } from \"./EventInput\";\n\nexport class PointerEventInput extends EventInput {\n public readonly start = SUPPORT_POINTER ? [\"pointerdown\"] : [\"MSPointerDown\"];\n public readonly move = SUPPORT_POINTER ? [\"pointermove\"] : [\"MSPointerMove\"];\n public readonly end = SUPPORT_POINTER\n ? [\"pointerup\", \"pointercancel\"]\n : [\"MSPointerUp\", \"MSPointerCancel\"];\n\n // store first, recent inputs for each event id\n private _firstInputs: PointerEvent[] = [];\n private _recentInputs: PointerEvent[] = [];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._removePointerEvent(event as PointerEvent);\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._firstInputs = [];\n this._recentInputs = [];\n return;\n }\n\n public getTouches(): number {\n return this._recentInputs.length;\n }\n\n protected _getScale(): number {\n if (this._recentInputs.length !== 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(this._recentInputs[0], this._recentInputs[1]) /\n this._getDistance(this._firstInputs[0], this._firstInputs[1])\n );\n }\n\n protected _getCenter(event: PointerEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: PointerEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as PointerEvent;\n if (event.pointerId !== prev.pointerId) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n\n private _updatePointerEvent(event: PointerEvent) {\n let addFlag = false;\n this._recentInputs.forEach((e, i) => {\n if (e.pointerId === event.pointerId) {\n addFlag = true;\n this._recentInputs[i] = event;\n }\n });\n if (!addFlag) {\n this._firstInputs.push(event);\n this._recentInputs.push(event);\n }\n }\n\n private _removePointerEvent(event?: PointerEvent) {\n this._firstInputs = this._firstInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n this._recentInputs = this._recentInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchMouseEventInput extends EventInput {\n public readonly start = [\"mousedown\", \"touchstart\"];\n public readonly move = [\"mousemove\", \"touchmove\"];\n public readonly end = [\"mouseup\", \"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return this._isTouchEvent(event) ? event.touches.length : 0;\n }\n\n protected _getScale(event: MouseEvent | TouchEvent): number {\n if (this._isTouchEvent(event)) {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return 1; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n return this.prevEvent.scale;\n }\n\n protected _getCenter(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n if (this._isTouchEvent(event)) {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n const prev = this.prevEvent.srcEvent;\n const [nextSpot, prevSpot] = [event, prev].map((e) => {\n if (this._isTouchEvent(e)) {\n return {\n id: e.touches[0].identifier,\n x: e.touches[0].clientX,\n y: e.touches[0].clientY,\n };\n }\n return {\n id: null,\n x: e.clientX,\n y: e.clientY,\n };\n });\n return nextSpot.id === prevSpot.id\n ? { x: nextSpot.x - prevSpot.x, y: nextSpot.y - prevSpot.y }\n : { x: 0, y: 0 };\n }\n}\n","import { Axis } from \"../AxisManager\";\nimport { AxesOption } from \"../Axes\";\nimport { ActiveEvent } from \"../types\";\nimport { MouseEventInput } from \"../eventInput/MouseEventInput\";\nimport { TouchEventInput } from \"../eventInput/TouchEventInput\";\nimport { PointerEventInput } from \"../eventInput/PointerEventInput\";\nimport { TouchMouseEventInput } from \"../eventInput/TouchMouseEventInput\";\nimport {\n SUPPORT_POINTER_EVENTS,\n SUPPORT_TOUCH,\n} from \"../eventInput/EventInput\";\n\nexport interface InputType {\n axes: string[];\n element: HTMLElement;\n mapAxes(axes: string[]);\n connect(observer: InputTypeObserver): InputType;\n disconnect();\n destroy();\n enable?();\n disable?();\n isEnable?(): boolean;\n}\n\nexport interface InputTypeObserver {\n options: AxesOption;\n get(inputType: InputType): Axis;\n change(inputType: InputType, event, offset: Axis, useAnimation?: boolean);\n hold(inputType: InputType, event);\n release(\n inputType: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n );\n}\n\nexport const toAxis = (source: string[], offset: number[]): Axis => {\n return offset.reduce((acc, v, i) => {\n if (source[i]) {\n acc[source[i]] = v;\n }\n return acc;\n }, {});\n};\n\nexport const convertInputType = (inputType: string[] = []): ActiveEvent => {\n let hasTouch = false;\n let hasMouse = false;\n let hasPointer = false;\n\n inputType.forEach((v) => {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n if (hasPointer) {\n return new PointerEventInput();\n } else if (hasTouch && hasMouse) {\n return new TouchMouseEventInput();\n } else if (hasTouch) {\n return new TouchEventInput();\n } else if (hasMouse) {\n return new MouseEventInput();\n }\n return null;\n};\n","import { InterruptManager } from \"./InterruptManager\";\nimport { InputType, InputTypeObserver, toAxis } from \"./inputType/InputType\";\nimport { EventManager, ChangeEventOption } from \"./EventManager\";\nimport { AxisManager, Axis } from \"./AxisManager\";\nimport { AxesOption } from \"./Axes\";\nimport {\n isOutside,\n getInsidePosition,\n getCirculatedPos,\n isEndofBounce,\n} from \"./Coordinate\";\nimport { map, equal } from \"./utils\";\nimport { AnimationParam } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport class InputObserver implements InputTypeObserver {\n public options: AxesOption;\n private _interruptManager: InterruptManager;\n private _eventManager: EventManager;\n private _axisManager: AxisManager;\n private _animationManager: AnimationManager;\n private _isOutside = false;\n private _moveDistance: Axis = null;\n private _isStopped = false;\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n animationManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n animationManager: AnimationManager;\n }) {\n this.options = options;\n this._interruptManager = interruptManager;\n this._eventManager = eventManager;\n this._axisManager = axisManager;\n this._animationManager = animationManager;\n }\n\n public get(input: InputType): Axis {\n return this._axisManager.get(input.axes);\n }\n\n public hold(input: InputType, event) {\n if (this._interruptManager.isInterrupted() || !input.axes.length) {\n return;\n }\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n this._isStopped = false;\n this._interruptManager.setInterrupt(true);\n this._animationManager.stopAnimation(changeOption);\n if (!this._moveDistance) {\n this._eventManager.hold(this._axisManager.get(), changeOption);\n }\n this._isOutside = this._axisManager.isOutside(input.axes);\n this._moveDistance = this._axisManager.get(input.axes);\n }\n\n public change(input: InputType, event, offset: Axis, useAnimation?: boolean) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n this._axisManager.every(offset, (v) => v === 0)\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyChanged) {\n return;\n }\n let depaPos: Axis = this._moveDistance || this._axisManager.get(input.axes);\n let destPos: Axis;\n\n // for outside logic\n destPos = map(depaPos, (v, k) => v + (offset[k] || 0));\n if (this._moveDistance) {\n this._moveDistance = this._axisManager.map(\n destPos,\n (v, { circular, range }) =>\n circular && (circular[0] || circular[1])\n ? getCirculatedPos(v, range, circular as boolean[])\n : v\n );\n }\n // from outside to inside\n if (\n this._isOutside &&\n this._axisManager.every(depaPos, (v, opt) => !isOutside(v, opt.range))\n ) {\n this._isOutside = false;\n }\n depaPos = this._atOutside(depaPos);\n destPos = this._atOutside(destPos);\n\n if (!this.options.nested || !this._isEndofAxis(offset, depaPos, destPos)) {\n nativeEvent.__childrenAxesAlreadyChanged = true;\n }\n\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (useAnimation) {\n const duration = this._animationManager.getDuration(destPos, depaPos);\n this._animationManager.animateTo(destPos, duration, changeOption);\n } else {\n const isCanceled = !this._eventManager.triggerChange(\n destPos,\n depaPos,\n changeOption,\n true\n );\n if (isCanceled) {\n this._isStopped = true;\n this._moveDistance = null;\n this._animationManager.finish(false);\n }\n }\n }\n\n public release(\n input: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n ) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n !this._moveDistance\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyReleased) {\n velocity = velocity.map(() => 0);\n }\n const pos: Axis = this._axisManager.get(input.axes);\n const depaPos: Axis = this._axisManager.get();\n const displacement = this._animationManager.getDisplacement(velocity);\n const offset = toAxis(input.axes, displacement);\n let destPos: Axis = this._axisManager.get(\n this._axisManager.map(offset, (v, opt, k) => {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(\n pos[k] + v,\n opt.range,\n opt.circular as boolean[],\n opt.bounce as number[]\n );\n }\n })\n );\n nativeEvent.__childrenAxesAlreadyReleased = true;\n const duration = this._animationManager.getDuration(\n destPos,\n pos,\n inputDuration\n );\n\n if (duration === 0) {\n destPos = { ...depaPos };\n }\n // prepare params\n const param: AnimationParam = {\n depaPos,\n destPos,\n duration,\n delta: this._axisManager.getDelta(depaPos, destPos),\n inputEvent: event,\n input,\n isTrusted: true,\n };\n this._eventManager.triggerRelease(param);\n this._moveDistance = null;\n\n // to contol\n const userWish = this._animationManager.getUserControl(param);\n const isEqual = equal(userWish.destPos, depaPos);\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (isEqual || userWish.duration === 0) {\n if (!isEqual) {\n this._eventManager.triggerChange(\n userWish.destPos,\n depaPos,\n changeOption,\n true\n );\n }\n this._interruptManager.setInterrupt(false);\n if (this._axisManager.isOutside()) {\n this._animationManager.restore(changeOption);\n } else {\n this._eventManager.triggerFinish(true);\n }\n } else {\n this._animationManager.animateTo(\n userWish.destPos,\n userWish.duration,\n changeOption\n );\n }\n }\n\n // when move pointer is held in outside\n private _atOutside(pos: Axis) {\n if (this._isOutside) {\n return this._axisManager.map(pos, (v, opt) => {\n const tn = opt.range[0] - (opt.bounce[0] as number);\n const tx = opt.range[1] + (opt.bounce[1] as number);\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n return this._axisManager.map(pos, (v, opt) => {\n const min = opt.range[0];\n const max = opt.range[1];\n const out = opt.bounce;\n const circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return (\n min - this._animationManager.interpolate(min - v, out[0] as number)\n );\n } else if (v > max) {\n // right\n return (\n max + this._animationManager.interpolate(v - max, out[1] as number)\n );\n }\n return v;\n });\n }\n }\n\n private _isEndofAxis(offset: Axis, depaPos: Axis, destPos: Axis) {\n return this._axisManager.every(\n depaPos,\n (value, option, key) =>\n offset[key] === 0 ||\n (depaPos[key] === destPos[key] &&\n isEndofBounce(\n value,\n option.range,\n option.bounce as number[],\n option.circular as boolean[]\n ))\n );\n }\n}\n","import {\n getInsidePosition,\n isCircularable,\n getCirculatedPos,\n getDuration,\n} from \"../Coordinate\";\nimport { Axis, AxisManager } from \"../AxisManager\";\nimport { InterruptManager } from \"../InterruptManager\";\nimport { EventManager, ChangeEventOption } from \"../EventManager\";\nimport {\n requestAnimationFrame,\n cancelAnimationFrame,\n map,\n every,\n filter,\n equal,\n roundNumber,\n getDecimalPlace,\n inversePow,\n} from \"../utils\";\nimport { AxesOption } from \"../Axes\";\nimport {\n AnimationParam,\n ObjectInterface,\n UpdateAnimationOption,\n} from \"../types\";\n\nexport interface AnimationState {\n pos: Axis;\n easingPer: number;\n finished: boolean;\n}\n\nconst clamp = (value: number, min: number, max: number): number => {\n return Math.max(Math.min(value, max), min);\n};\n\nexport abstract class AnimationManager {\n public interruptManager: InterruptManager;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n protected _options: AxesOption;\n protected _animateParam: AnimationParam;\n private _raf: number;\n\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n }) {\n this._options = options;\n this.interruptManager = interruptManager;\n this.eventManager = eventManager;\n this.axisManager = axisManager;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n public abstract interpolate(displacement: number, threshold: number): number;\n\n public abstract updateAnimation(options: UpdateAnimationOption): void;\n\n protected abstract _initState(info: AnimationParam): AnimationState;\n\n protected abstract _getNextState(prevState: AnimationState): AnimationState;\n\n public getDuration(\n depaPos: Axis,\n destPos: Axis,\n wishDuration?: number\n ): number {\n let duration: number;\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n const durations: Axis = map(destPos, (v, k) =>\n getDuration(Math.abs(v - depaPos[k]), this._options.deceleration)\n );\n duration = Object.keys(durations).reduce(\n (max, v) => Math.max(max, durations[v]),\n -Infinity\n );\n }\n return clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n }\n\n public getDisplacement(velocity: number[]): number[] {\n const totalVelocity = Math.pow(\n velocity.reduce((total, v) => total + v * v, 0),\n 1 / velocity.length\n );\n const duration = Math.abs(totalVelocity / -this._options.deceleration);\n return velocity.map((v) => (v / 2) * duration);\n }\n\n public stopAnimation(option?: ChangeEventOption): void {\n if (this._animateParam) {\n const orgPos: Axis = this.axisManager.get();\n const pos: Axis = this.axisManager.map(orgPos, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n );\n if (!every(pos, (v, k) => orgPos[k] === v)) {\n this.eventManager.triggerChange(pos, orgPos, option, !!option);\n }\n this._animateParam = null;\n if (this._raf) {\n cancelAnimationFrame(this._raf);\n }\n this._raf = null;\n this.eventManager.triggerAnimationEnd(!!option?.event);\n }\n }\n\n public getEventInfo(): ChangeEventOption {\n if (\n this._animateParam &&\n this._animateParam.input &&\n this._animateParam.inputEvent\n ) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent,\n };\n } else {\n return null;\n }\n }\n\n public restore(option: ChangeEventOption): void {\n const pos: Axis = this.axisManager.get();\n const destPos: Axis = this.axisManager.map(pos, (v, opt) =>\n Math.min(opt.range[1], Math.max(opt.range[0], v))\n );\n this.stopAnimation();\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n }\n\n public animationEnd(): void {\n const beforeParam: ChangeEventOption = this.getEventInfo();\n this._animateParam = null;\n\n // for Circular\n const circularTargets = this.axisManager.filter(\n this.axisManager.get(),\n (v, opt) => isCircularable(v, opt.range, opt.circular as boolean[])\n );\n if (Object.keys(circularTargets).length > 0) {\n this.setTo(\n this.axisManager.map(circularTargets, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n )\n );\n }\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerAnimationEnd(!!beforeParam);\n if (this.axisManager.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n }\n\n public finish(isTrusted: boolean): void {\n this._animateParam = null;\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerFinish(isTrusted);\n }\n\n public getUserControl(param: AnimationParam): {\n destPos: Axis;\n duration: number;\n } {\n const userWish = param.setTo();\n userWish.destPos = this.axisManager.get(userWish.destPos);\n userWish.duration = clamp(\n userWish.duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n return userWish;\n }\n\n public animateTo(\n destPos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): void {\n this.stopAnimation();\n const param: AnimationParam = this._createAnimationParam(\n destPos,\n duration,\n option\n );\n const depaPos = { ...param.depaPos };\n const retTrigger = this.eventManager.triggerAnimationStart(param);\n\n // to control\n const userWish = this.getUserControl(param);\n\n // You can't stop the 'animationStart' event when 'circular' is true.\n if (\n !retTrigger &&\n this.axisManager.every(userWish.destPos, (v, opt) =>\n isCircularable(v, opt.range, opt.circular as boolean[])\n )\n ) {\n console.warn(\n \"You can't stop the 'animation' event when 'circular' is true.\"\n );\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n const inputEvent = option?.event || null;\n this._animateLoop(\n {\n depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axisManager.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent,\n input: option?.input || null,\n },\n () => this.animationEnd()\n );\n }\n }\n\n public setTo(pos: Axis, duration: number = 0) {\n const axes: string[] = Object.keys(pos);\n const orgPos: Axis = this.axisManager.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n this.interruptManager.setInterrupt(true);\n let movedPos = filter(pos, (v, k) => orgPos[k] !== v);\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axisManager.map(movedPos, (v, opt) => {\n const { range, circular } = opt;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular as boolean[]);\n }\n });\n\n if (equal(movedPos, orgPos)) {\n return this;\n }\n\n if (duration > 0) {\n this.animateTo(movedPos, duration);\n } else {\n this.stopAnimation();\n this.eventManager.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n }\n\n public setBy(pos: Axis, duration = 0) {\n return this.setTo(\n map(this.axisManager.get(Object.keys(pos)), (v, k) => v + pos[k]),\n duration\n );\n }\n\n private _createAnimationParam(\n pos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): AnimationParam {\n const depaPos: Axis = this.axisManager.get();\n const destPos: Axis = pos;\n const inputEvent = option?.event || null;\n return {\n depaPos,\n destPos,\n duration: clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n ),\n delta: this.axisManager.getDelta(depaPos, destPos),\n inputEvent,\n input: option?.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd,\n };\n }\n\n private _animateLoop(param: AnimationParam, complete: () => void): void {\n if (param.duration) {\n this._animateParam = {\n ...param,\n startTime: new Date().getTime(),\n };\n const originalIntendedPos = map(param.destPos, (v) => v);\n let state = this._initState(this._animateParam);\n\n const loop = () => {\n this._raf = null;\n const animateParam = this._animateParam;\n const nextState = this._getNextState(state);\n const isCanceled = !this.eventManager.triggerChange(\n nextState.pos,\n state.pos\n );\n\n state = nextState;\n\n if (nextState.finished) {\n animateParam.destPos = this._getFinalPos(\n animateParam.destPos,\n originalIntendedPos\n );\n if (\n !equal(\n animateParam.destPos,\n this.axisManager.get(Object.keys(animateParam.destPos))\n )\n ) {\n this.eventManager.triggerChange(\n animateParam.destPos,\n nextState.pos\n );\n }\n complete();\n return;\n } else if (isCanceled) {\n this.finish(false);\n } else {\n this._raf = requestAnimationFrame(loop);\n }\n };\n loop();\n } else {\n this.eventManager.triggerChange(param.destPos);\n complete();\n }\n }\n\n /**\n * Get estimated final value.\n *\n * If destPos is within the 'error range' of the original intended position, the initial intended position is returned.\n * - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100;\n * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos.\n * - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123\n * @param originalIntendedPos\n * @param destPos\n */\n private _getFinalPos(\n destPos: ObjectInterface,\n originalIntendedPos: ObjectInterface\n ): Axis {\n // compare destPos and originalIntendedPos\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const ERROR_LIMIT = 0.000001;\n const finalPos = map(destPos, (value, key) => {\n if (\n value >= originalIntendedPos[key] - ERROR_LIMIT &&\n value <= originalIntendedPos[key] + ERROR_LIMIT\n ) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n const roundUnit = this._getRoundUnit(value, key);\n const result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n }\n\n private _getRoundUnit(val: number, key: string): number {\n const roundUnit = this._options.round; // manual mode\n let minRoundUnit = null; // auto mode\n\n // auto mode\n if (!roundUnit) {\n // Get minimum round unit\n const options = this.axisManager.getAxisOptions(key);\n minRoundUnit = inversePow(\n Math.max(\n getDecimalPlace(options.range[0]),\n getDecimalPlace(options.range[1]),\n getDecimalPlace(val)\n )\n );\n }\n\n return minRoundUnit || roundUnit;\n }\n}\n","import { AxesOption } from \"../Axes\";\nimport { Axis } from \"../AxisManager\";\nimport { getCirculatedPos } from \"../Coordinate\";\nimport { AnimationParam, UpdateAnimationOption } from \"../types\";\nimport { map } from \"../utils\";\n\nimport { AnimationManager, AnimationState } from \"./AnimationManager\";\n\nexport class EasingManager extends AnimationManager {\n protected _useDuration = true;\n protected _options: AxesOption;\n private _durationOffset: number;\n private _initialEasingPer: number;\n private _prevEasingPer: number;\n\n public interpolate(displacement: number, threshold: number): number {\n const initSlope = this._easing(0.00001) / 0.00001;\n return this._easing(displacement / (threshold * initSlope)) * threshold;\n }\n\n public updateAnimation(options: UpdateAnimationOption): void {\n const animateParam = this._animateParam;\n if (!animateParam) {\n return;\n }\n\n const diffTime = new Date().getTime() - animateParam.startTime;\n const pos = options?.destPos || animateParam.destPos;\n const duration = options?.duration || animateParam.duration;\n if (options?.restart || duration <= diffTime) {\n this.setTo(pos, duration - diffTime);\n return;\n }\n if (options?.destPos) {\n const currentPos = this.axisManager.get();\n // When destination is changed, new delta should be calculated as remaining percent.\n // For example, moving x:0, y:0 to x:200, y:200 and it has current easing percent of 92%. coordinate is x:184 and y:184\n // If destination changes to x:300, y:300. xdelta:200, ydelta:200 changes to xdelta:116, ydelta:116 and use remaining easingPer as 100%, not 8% as previous.\n // Therefore, original easingPer by time is kept. And divided by (1 - self._initialEasingPer) which means new total easing percent. Like calculating 8% as 100%.\n this._initialEasingPer = this._prevEasingPer;\n animateParam.delta = this.axisManager.getDelta(currentPos, pos);\n animateParam.destPos = pos;\n }\n if (options?.duration) {\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n // Use durationOffset for keeping animation ratio after duration is changed.\n // newRatio = (diffTime + newDurationOffset) / newDuration = oldRatio\n // newDurationOffset = oldRatio * newDuration - diffTime\n this._durationOffset = ratio * duration - diffTime;\n animateParam.duration = duration;\n }\n }\n\n protected _initState(info: AnimationParam): AnimationState {\n this._initialEasingPer = 0;\n this._prevEasingPer = 0;\n this._durationOffset = 0;\n return {\n pos: info.depaPos,\n easingPer: 0,\n finished: false,\n };\n }\n\n protected _getNextState(prevState: AnimationState): AnimationState {\n const animateParam = this._animateParam;\n const prevPos = prevState.pos;\n const destPos = animateParam.destPos;\n const directions = map(prevPos, (value, key) => {\n return value <= destPos[key] ? 1 : -1;\n });\n const diffTime = new Date().getTime() - animateParam.startTime;\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n const easingPer = this._easing(ratio);\n\n const toPos: Axis = this.axisManager.map(prevPos, (pos, options, key) => {\n const nextPos =\n ratio >= 1\n ? destPos[key]\n : pos +\n (animateParam.delta[key] * (easingPer - this._prevEasingPer)) /\n (1 - this._initialEasingPer);\n\n // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n const circulatedPos = getCirculatedPos(\n nextPos,\n options.range,\n options.circular as boolean[]\n );\n if (nextPos !== circulatedPos) {\n // circular\n const rangeOffset =\n directions[key] * (options.range[1] - options.range[0]);\n\n destPos[key] -= rangeOffset;\n prevPos[key] -= rangeOffset;\n }\n return circulatedPos;\n });\n this._prevEasingPer = easingPer;\n return {\n pos: toPos,\n easingPer,\n finished: easingPer >= 1,\n };\n }\n\n private _easing(p: number): number {\n return p > 1 ? 1 : this._options.easing(p);\n }\n}\n","import Component from \"@egjs/component\";\n\nimport { EventManager } from \"./EventManager\";\nimport { InterruptManager } from \"./InterruptManager\";\nimport { AxisManager, AxisOption, Axis } from \"./AxisManager\";\nimport { InputObserver } from \"./InputObserver\";\nimport {\n TRANSFORM,\n DIRECTION_NONE,\n DIRECTION_LEFT,\n DIRECTION_RIGHT,\n DIRECTION_UP,\n DIRECTION_DOWN,\n DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL,\n DIRECTION_ALL,\n} from \"./const\";\nimport { InputType } from \"./inputType/InputType\";\nimport { AxesEvents, ObjectInterface, UpdateAnimationOption } from \"./types\";\nimport { EasingManager } from \"./animation/EasingManager\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface AxesOption {\n easing?: (x: number) => number;\n maximumDuration?: number;\n minimumDuration?: number;\n deceleration?: number;\n interruptable?: boolean;\n round?: number;\n nested?: boolean;\n}\n\n/**\n * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system.\n * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {Number[]} [range] The coordinate of range 좌표 범위\n * @param {Number} [range[0]=0] The coordinate of the minimum 최소 좌표\n * @param {Number} [range[1]=0] The coordinate of the maximum 최대 좌표\n * @param {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바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @param {Number} [bounce[0]=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @param {Number} [bounce[1]=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @param {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.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @param {Boolean} [circular[0]=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @param {Boolean} [circular[1]=false] Indicates whether to circulate to the coordinate of the maximum 최대 좌표 방향의 순환 여부\n **/\n\n/**\n * @typedef {Object} AxesOption The option object of the eg.Axes module\n * @ko eg.Axes 모듈의 옵션 객체\n * @param {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @param {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @param {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @param {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @param {Boolean} [interruptable=true] Indicates whether an animation is interruptible.\n * - true: It can be paused or stopped by user action or the API.\n * - false: It cannot be paused or stopped by user action or the API while it is running.\n * 진행 중인 애니메이션 중지 가능 여부.\n * - true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다.\n * - false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다\n * @param {Number} [round=null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)\n * [Details](https://github.com/naver/egjs-axes/wiki/round-option)반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95).\n * [상세내용](https://github.com/naver/egjs-axes/wiki/round-option)\n * @param {Boolean} [nested=false] Whether the event propagates to other instances when the coordinates reach the end of the movable area 좌표가 이동 가능한 영역의 끝까지 도달했을 때 다른 인스턴스들로의 이벤트 전파 여부\n **/\n\n/**\n * 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.\n * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다.\n * @extends eg.Component\n *\n * @param {Object.} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {AxesOption} [options={}] The option object of the eg.Axes moduleeg.Axes 모듈의 옵션 객체\n * @param {Object.} [startPos=null] The coordinates to be moved when creating an instance. not triggering change event.인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음.\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n * ```js\n * // 1. Initialize eg.Axes\n * const axes = new eg.Axes({\n *\tsomething1: {\n *\t\trange: [0, 150],\n *\t\tbounce: 50\n *\t},\n *\tsomething2: {\n *\t\trange: [0, 200],\n *\t\tbounce: 100\n *\t},\n *\tsomethingN: {\n *\t\trange: [1, 10],\n *\t}\n * }, {\n * deceleration : 0.0024\n * });\n *\n * // 2. attach event handler\n * axes.on({\n *\t\"hold\" : function(evt) {\n *\t},\n *\t\"release\" : function(evt) {\n *\t},\n *\t\"animationStart\" : function(evt) {\n *\t},\n *\t\"animationEnd\" : function(evt) {\n *\t},\n *\t\"change\" : function(evt) {\n *\t}\n * });\n *\n * // 3. Initialize inputTypes\n * const panInputArea = new eg.Axes.PanInput(\"#area\", {\n *\tscale: [0.5, 1]\n * });\n * const panInputHmove = new eg.Axes.PanInput(\"#hmove\");\n * const panInputVmove = new eg.Axes.PanInput(\"#vmove\");\n * const pinchInputArea = new eg.Axes.PinchInput(\"#area\", {\n *\tscale: 1.5\n * });\n *\n * // 4. Connect eg.Axes and InputTypes\n * // [PanInput] When the mouse or touchscreen is down and moved.\n * // Connect the 'something2' axis to the mouse or touchscreen x position and\n * // connect the 'somethingN' axis to the mouse or touchscreen y position.\n * axes.connect([\"something2\", \"somethingN\"], panInputArea); // or axes.connect(\"something2 somethingN\", panInputArea);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position.\n * axes.connect([\"something1\"], panInputHmove); // or axes.connect(\"something1\", panInputHmove);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position.\n * axes.connect([\"\", \"something2\"], panInputVmove); // or axes.connect(\" something2\", panInputVmove);\n *\n * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something2\", pinchInputArea);\n * ```\n */\nclass Axes extends Component {\n /**\n * @name VERSION\n * @desc Version info string\n * @ko 버전정보 문자열\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.VERSION; // ex) 3.3.3\n * ```\n */\n public static VERSION = \"#__VERSION__#\";\n /* eslint-disable */\n // for tree shaking\n public static PanInput;\n public static PinchInput;\n public static WheelInput;\n public static MoveKeyInput;\n public static RotatePanInput;\n /* eslint-enable */\n\n /**\n * @name TRANSFORM\n * @desc Returns the transform attribute with CSS vendor prefixes.\n * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다.\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n * ```\n */\n public static TRANSFORM = TRANSFORM;\n /**\n * @name DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n public static DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name DIRECTION_UP\n * @constant\n * @type {Number}\n */\n public static DIRECTION_UP = DIRECTION_UP;\n /**\n * @name DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n public static DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_ALL = DIRECTION_ALL;\n\n public options: AxesOption;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n public interruptManager: InterruptManager;\n public animationManager: AnimationManager;\n public inputObserver: InputObserver;\n private _inputs: InputType[] = [];\n\n /**\n *\n */\n public constructor(\n public axis: ObjectInterface = {},\n options: AxesOption = {},\n startPos: Axis = null\n ) {\n super();\n this.options = {\n ...{\n easing: (x) => {\n return 1 - Math.pow(1 - x, 3);\n },\n interruptable: true,\n maximumDuration: Infinity,\n minimumDuration: 0,\n deceleration: 0.0006,\n round: null,\n nested: false,\n },\n ...options,\n };\n\n this.interruptManager = new InterruptManager(this.options);\n this.axisManager = new AxisManager(this.axis);\n this.eventManager = new EventManager(this);\n this.animationManager = new EasingManager(this);\n this.inputObserver = new InputObserver(this);\n this.eventManager.setAnimationManager(this.animationManager);\n if (startPos) {\n this.eventManager.triggerChange(startPos);\n }\n }\n\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @param {(String[]|String)} axes The name of the axis to associate with inputType inputType과 연결할 축의 이름\n * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes eg.Axes의 축과 연결할 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * axes.connect(\"x\", new eg.Axes.PanInput(\"#area1\"))\n * .connect(\"x xOther\", new eg.Axes.PanInput(\"#area2\"))\n * .connect(\" xOther\", new eg.Axes.PanInput(\"#area3\"))\n * .connect([\"x\"], new eg.Axes.PanInput(\"#area4\"))\n * .connect([\"xOther\", \"x\"], new eg.Axes.PanInput(\"#area5\"))\n * .connect([\"\", \"xOther\"], new eg.Axes.PanInput(\"#area6\"));\n * ```\n */\n public connect(axes: string[] | string, inputType: InputType) {\n let mapped: string[];\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n }\n\n // check same instance\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.inputObserver);\n this._inputs.push(inputType);\n return this;\n }\n\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * const input1 = new eg.Axes.PanInput(\"#area1\");\n * const input2 = new eg.Axes.PanInput(\"#area2\");\n * const input3 = new eg.Axes.PanInput(\"#area3\");\n *\n * axes.connect(\"x\", input1);\n * .connect(\"x xOther\", input2)\n * .connect([\"xOther\", \"x\"], input3);\n *\n * axes.disconnect(input1); // disconnects input1\n * axes.disconnect(); // disconnects all of them\n * ```\n */\n public disconnect(inputType?: InputType) {\n if (inputType) {\n const index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach((v) => v.disconnect());\n this._inputs = [];\n }\n return this;\n }\n\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.get(); // {\"x\": 0, \"xOther\": -100, \"zoom\": 50}\n * axes.get([\"x\", \"zoom\"]); // {\"x\": 0, \"zoom\": 50}\n * ```\n */\n public get(axes?: string[]) {\n return this.axisManager.get(axes);\n }\n\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setTo({\"x\": 30, \"zoom\": 60});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setTo({\"x\": 100, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": 60, \"zoom\": 60}\n * ```\n */\n public setTo(pos: Axis, duration = 0) {\n this.animationManager.setTo(pos, duration);\n return this;\n }\n\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setBy({\"x\": 30, \"zoom\": 10});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setBy({\"x\": 70, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": -40, \"zoom\": 60}\n * ```\n */\n public setBy(pos: Axis, duration = 0) {\n this.animationManager.setBy(pos, duration);\n return this;\n }\n\n /**\n * Stop an animation in progress.\n * @ko 재생 중인 애니메이션을 정지한다.\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * });\n *\n * axes.setTo({\"x\": 10}, 1000); // start animatation\n *\n * // after 500 ms\n * axes.stopAnimation(); // stop animation during movement.\n * ```\n */\n public stopAnimation() {\n this.animationManager.stopAnimation();\n return this;\n }\n\n /**\n * Change the destination of an animation in progress.\n * @ko 재생 중인 애니메이션의 목적지와 진행 시간을 변경한다.\n * @param {UpdateAnimationOption} pos The coordinate to move to 이동할 좌표\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 200]\n * },\n * \"y\": {\n * range: [0, 200]\n * }\n * });\n *\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 500 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}}); // animation will end after 500 ms, at {\"x\": 100, \"y\": 100}\n *\n * // after 500 ms\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 700 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}, duration: 1500, restart: true}); // this works same as axes.setTo({\"x\": 100, \"y\": 100}, 800) since restart is true.\n * ```\n */\n public updateAnimation(options: UpdateAnimationOption) {\n this.animationManager.updateAnimation(options);\n return this;\n }\n\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.isBounceArea([\"x\"]);\n * axes.isBounceArea([\"x\", \"zoom\"]);\n * axes.isBounceArea();\n * ```\n */\n public isBounceArea(axes?: string[]) {\n return this.axisManager.isOutside(axes);\n }\n\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n */\n public destroy() {\n this.disconnect();\n this.eventManager.destroy();\n }\n}\n\nexport default Axes;\n","/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport {\n IS_IOS_SAFARI,\n IOS_EDGE_THRESHOLD,\n DIRECTION_NONE,\n DIRECTION_VERTICAL,\n DIRECTION_HORIZONTAL,\n DIRECTION_ALL,\n MOUSE_LEFT,\n} from \"../const\";\nimport { ActiveEvent, InputEventType } from \"../types\";\n\nimport {\n convertInputType,\n InputType,\n InputTypeObserver,\n toAxis,\n} from \"./InputType\";\n\nexport interface PanInputOption {\n inputType?: string[];\n inputButton?: string[];\n scale?: number[];\n thresholdAngle?: number;\n threshold?: number;\n iOSEdgeSwipeThreshold?: number;\n releaseOnScroll?: boolean;\n touchAction?: string;\n}\n\n// get user's direction\nexport const getDirectionByAngle = (\n angle: number,\n thresholdAngle: number\n): number => {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n const toAngle = Math.abs(angle);\n\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle\n ? DIRECTION_VERTICAL\n : DIRECTION_HORIZONTAL;\n};\n\nexport const useDirection = (checkType, direction, userDirection?): boolean => {\n if (userDirection) {\n return !!(\n direction === DIRECTION_ALL ||\n (direction & checkType && userDirection & checkType)\n );\n } else {\n return !!(direction & checkType);\n }\n};\n\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @param {String[]} [inputType=[\"touch\", \"mouse\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - mouse: Mouse\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - mouse: 마우스\n * - pointer: 마우스 및 터치\n * @param {String[]} [inputButton=[\"left\"]] List of buttons to allow input\n * - left: Left mouse button and normal touch\n * - middle: Mouse wheel press\n * - right: Right mouse button 입력을 허용할 버튼 목록\n * - left: 마우스 왼쪽 버튼\n * - middle: 마우스 휠 눌림\n * - right: 마우스 오른쪽 버튼 \n * @param {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] horizontal axis scale 수평축 배율\n * @param {Number} [scale[1]=1] vertical axis scale 수직축 배율\n * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @param {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @param {String} [touchAction=null] Value that overrides the element's \"touch-action\" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다.\n **/\n/**\n * 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.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\n * ```js\n * const pan = new eg.Axes.PanInput(\"#area\", {\n * \t\tinputType: [\"touch\"],\n * \t\tscale: [1, 1.3],\n * });\n *\n * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something2\", \"somethingN\"], pan); // or axes.connect(\"something2 somethingN\", pan);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something1\"], pan); // or axes.connect(\"something1\", pan);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"\", \"something2\"], pan); // or axes.connect(\" something2\", pan);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module eg.Axes.PanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options={}] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n */\nexport class PanInput implements InputType {\n public options: PanInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n protected _observer: InputTypeObserver;\n protected _direction: number;\n protected _enabled = false;\n protected _activeEvent: ActiveEvent = null;\n private _originalCssProps: { [key: string]: string };\n private _atRightEdge = false;\n private _rightEdgeTimer = 0;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n this.element = $(el);\n this.options = {\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n inputButton: [MOUSE_LEFT],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n releaseOnScroll: false,\n touchAction: null,\n ...options,\n };\n this._onPanstart = this._onPanstart.bind(this);\n this._onPanmove = this._onPanmove.bind(this);\n this._onPanend = this._onPanend.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n const useHorizontal = !!axes[0];\n const useVertical = !!axes[1];\n if (useHorizontal && useVertical) {\n this._direction = DIRECTION_ALL;\n } else if (useHorizontal) {\n this._direction = DIRECTION_HORIZONTAL;\n } else if (useVertical) {\n this._direction = DIRECTION_VERTICAL;\n } else {\n this._direction = DIRECTION_NONE;\n }\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n }\n this._attachElementEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n this._direction\n );\n return this;\n }\n\n public disconnect() {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n this._direction = DIRECTION_NONE;\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n protected _onPanstart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n const edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n\n this._observer.hold(this, panEvent);\n this._atRightEdge =\n IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold;\n this._attachWindowEvent(activeEvent);\n activeEvent.prevEvent = panEvent;\n }\n }\n\n protected _onPanmove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n const { iOSEdgeSwipeThreshold, releaseOnScroll } = this.options;\n const userDirection = getDirectionByAngle(\n panEvent.angle,\n this.options.thresholdAngle\n );\n\n if (releaseOnScroll && !panEvent.srcEvent.cancelable) {\n this._onPanend(event);\n return;\n }\n\n if (activeEvent.prevEvent && IS_IOS_SAFARI) {\n const swipeLeftToRight = panEvent.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this._forceRelease();\n return;\n } else if (this._atRightEdge) {\n clearTimeout(this._rightEdgeTimer);\n\n // - is right to left\n const swipeRightToLeft = panEvent.deltaX < -iOSEdgeSwipeThreshold;\n\n if (swipeRightToLeft) {\n this._atRightEdge = false;\n } else {\n // iOS swipe right => left\n this._rightEdgeTimer = window.setTimeout(\n () => this._forceRelease(),\n 100\n );\n }\n }\n }\n const offset: number[] = this._getOffset(\n [panEvent.offsetX, panEvent.offsetY],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection),\n useDirection(DIRECTION_VERTICAL, this._direction, userDirection),\n ]\n );\n const prevent = offset.some((v) => v !== 0);\n\n if (prevent) {\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n }\n panEvent.preventSystemEvent = prevent;\n if (prevent) {\n this._observer.change(this, panEvent, toAxis(this.axes, offset));\n }\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this._enabled || activeEvent.getTouches(event) !== 0) {\n return;\n }\n this._detachWindowEvent(activeEvent);\n clearTimeout(this._rightEdgeTimer);\n const prevEvent = activeEvent.prevEvent;\n const velocity = this._getOffset(\n [\n Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1),\n Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1),\n ],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction),\n useDirection(DIRECTION_VERTICAL, this._direction),\n ]\n );\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, velocity);\n }\n\n protected _attachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.addEventListener(event, this._onPanmove, { passive: false });\n });\n activeEvent?.end.forEach((event) => {\n window.addEventListener(event, this._onPanend, { passive: false });\n });\n }\n\n protected _detachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.removeEventListener(event, this._onPanmove);\n });\n activeEvent?.end.forEach((event) => {\n window.removeEventListener(event, this._onPanend);\n });\n }\n\n protected _getOffset(properties: number[], direction: boolean[]): number[] {\n const offset: number[] = [0, 0];\n const scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n return offset;\n }\n\n private _attachElementEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element?.addEventListener(event, this._onPanstart);\n });\n // adding event listener to element prevents invalid behavior in iOS Safari\n activeEvent.move.forEach((event) => {\n this.element?.addEventListener(event, this._voidFunction);\n });\n }\n\n private _detachElementEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element?.removeEventListener(event, this._onPanstart);\n });\n activeEvent?.move.forEach((event) => {\n this.element?.removeEventListener(event, this._voidFunction);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _forceRelease = () => {\n const activeEvent = this._activeEvent;\n const prevEvent = activeEvent.prevEvent;\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [0, 0]);\n this._detachWindowEvent(activeEvent);\n };\n\n private _voidFunction = () => {};\n}\n","import { ExtendedEvent } from \"../types\";\nimport Axes from \"../Axes\";\nimport { getAngle } from \"../utils\";\n\nimport { toAxis } from \"./InputType\";\nimport { PanInput, PanInputOption } from \"./PanInput\";\n\n/**\n * A module that passes the angle moved by touch to Axes and uses one axis of rotation.\n * [Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.\n * [상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\n * ```js\n * const input = new eg.Axes.RotatePanInput(\"#area\");\n *\n * var axes = new eg.Axes({\n *\t// property name('angle') could be anything you want (eg. x, y, z...)\n * \tangle: {\n * \t\trange: [-180, 180] // from -180deg to 180deg\n * \t}\n * });\n *\n * axes.connect(\"angle\", input)\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n * @extends PanInput\n */\nexport class RotatePanInput extends PanInput {\n private _rotateOrigin: number[];\n private _prevAngle: number;\n private _prevQuadrant: number = null;\n private _lastDiff = 0;\n private _coefficientForDistanceToAngle: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n super(el, options);\n }\n\n public mapAxes(axes: string[]) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n }\n\n protected _onPanstart(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n const rect = this.element.getBoundingClientRect();\n\n this._observer.hold(this, panEvent);\n this._attachWindowEvent(activeEvent);\n // TODO: how to do if element is ellipse not circle.\n this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360\n // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin\n this._rotateOrigin = [\n rect.left + (rect.width - 1) / 2,\n rect.top + (rect.height - 1) / 2,\n ];\n\n // init angle.\n this._prevAngle = null;\n\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanmove(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this.isEnabled()) {\n return;\n }\n const prevEvent = activeEvent.prevEvent;\n this._triggerChange(prevEvent);\n const vx = prevEvent.velocityX;\n const vy = prevEvent.velocityY;\n const velocity =\n Math.sqrt(vx * vx + vy * vy) * (this._lastDiff > 0 ? -1 : 1); // clockwise\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [\n velocity * this._coefficientForDistanceToAngle,\n ]);\n this._detachWindowEvent(activeEvent);\n }\n\n private _triggerChange(event: ExtendedEvent) {\n const { x, y } = this._getPosFromOrigin(event.center.x, event.center.y);\n const angle = getAngle(x, y);\n const positiveAngle = angle < 0 ? 360 + angle : angle;\n const quadrant = this._getQuadrant(event.center.x, event.center.y);\n const diff = this._getDifference(\n this._prevAngle,\n positiveAngle,\n this._prevQuadrant,\n quadrant\n );\n\n this._prevAngle = positiveAngle;\n this._prevQuadrant = quadrant;\n\n if (diff === 0) {\n return;\n }\n\n this._lastDiff = diff;\n this._observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise\n }\n\n private _getDifference(\n prevAngle: number,\n angle: number,\n prevQuadrant: number,\n quadrant: number\n ) {\n let diff: number;\n\n if (prevAngle === null) {\n diff = 0;\n } else if (prevQuadrant === 1 && quadrant === 4) {\n diff = -prevAngle - (360 - angle);\n } else if (prevQuadrant === 4 && quadrant === 1) {\n diff = 360 - prevAngle + angle;\n } else {\n diff = angle - prevAngle;\n }\n\n return diff;\n }\n\n private _getPosFromOrigin(posX: number, posY: number) {\n return {\n x: posX - this._rotateOrigin[0],\n y: this._rotateOrigin[1] - posY,\n };\n }\n\n private _getQuadrant(posX: number, posY: number) {\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n const { x, y } = this._getPosFromOrigin(posX, posY);\n let q = 0;\n\n if (x >= 0 && y >= 0) {\n q = 1;\n } else if (x < 0 && y >= 0) {\n q = 2;\n } else if (x < 0 && y < 0) {\n q = 3;\n } else if (x >= 0 && y < 0) {\n q = 4;\n }\n return q;\n }\n}\n","import { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport { ActiveEvent, InputEventType } from \"../types\";\nimport { DIRECTION_ALL } from \"../const\";\n\nimport {\n toAxis,\n convertInputType,\n InputType,\n InputTypeObserver,\n} from \"./InputType\";\n\nexport interface PinchInputOption {\n scale?: number;\n threshold?: number;\n inputType?: string[];\n touchAction?: string;\n}\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @param {String[]} [inputType=[\"touch\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - pointer: 마우스 및 터치\n * @param {String} [touchAction=\"none\"] Value that overrides the element's \"touch-action\" css property. It is set to \"none\" to prevent scrolling during touch. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 터치 도중 스크롤을 방지하기 위해 \"none\" 으로 설정되어 있다.\n **/\n\n/**\n * 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.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\n * ```js\n * const pinch = new eg.Axes.PinchInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something\", pinch);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module eg.Axes.PinchInput 모듈을 사용할 엘리먼트\n * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput moduleeg.Axes.PinchInput 모듈의 옵션 객체\n */\nexport class PinchInput implements InputType {\n public options: PinchInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _pinchFlag = false;\n private _enabled = false;\n private _originalCssProps: { [key: string]: string };\n private _activeEvent: ActiveEvent = null;\n private _baseValue: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PinchInputOption) {\n this.element = $(el);\n this.options = {\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n touchAction: \"none\",\n ...options,\n };\n this._onPinchStart = this._onPinchStart.bind(this);\n this._onPinchMove = this._onPinchMove.bind(this);\n this._onPinchEnd = this._onPinchEnd.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachEvent();\n }\n this._attachEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n DIRECTION_ALL\n );\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onPinchStart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventStart(event);\n if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) {\n return;\n }\n\n this._baseValue = this._observer.get(this)[this.axes[0]];\n this._observer.hold(this, event);\n this._pinchFlag = true;\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchMove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventMove(event);\n if (\n !pinchEvent ||\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) !== 2\n ) {\n return;\n }\n\n const offset = this._getOffset(\n pinchEvent.scale,\n activeEvent.prevEvent.scale\n );\n this._observer.change(this, event, toAxis(this.axes, [offset]));\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchEnd(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) >= 2\n ) {\n return;\n }\n\n activeEvent.onRelease();\n this._observer.release(this, event, [0], 0);\n this._baseValue = null;\n this._pinchFlag = false;\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element.addEventListener(event, this._onPinchStart, false);\n });\n activeEvent.move.forEach((event) => {\n this.element.addEventListener(event, this._onPinchMove, false);\n });\n activeEvent.end.forEach((event) => {\n this.element.addEventListener(event, this._onPinchEnd, false);\n });\n }\n\n private _detachEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchStart, false);\n });\n activeEvent?.move.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchMove, false);\n });\n activeEvent?.end.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchEnd, false);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _getOffset(pinchScale: number, prev: number = 1): number {\n return this._baseValue * (pinchScale - prev) * this.options.scale;\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport interface WheelInputOption {\n scale?: number;\n releaseDelay?: number;\n useNormalized?: boolean;\n useAnimation?: boolean;\n}\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [releaseDelay=300] Millisecond that trigger release event after last input마지막 입력 이후 release 이벤트가 트리거되기까지의 밀리초\n * @param {Boolean} [useNormalized=true] Whether to calculate scroll speed the same in all browsers모든 브라우저에서 스크롤 속도를 동일하게 처리할지 여부\n * @param {Boolean} [useAnimation=false] Whether to process coordinate changes through the mouse wheel as a continuous animation마우스 휠을 통한 좌표 변화를 연속적인 애니메이션으로 처리할지 여부\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis.\n * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const wheel = new eg.Axes.WheelInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when the mousewheel is moved.\n * axes.connect(\"something\", wheel);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module eg.Axes.WheelInput 모듈을 사용할 엘리먼트\n * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput moduleeg.Axes.WheelInput 모듈의 옵션 객체\n */\nexport class WheelInput implements InputType {\n public options: WheelInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: WheelInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: 1,\n releaseDelay: 300,\n useNormalized: true,\n useAnimation: false,\n },\n ...options,\n };\n this._onWheel = this._onWheel.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onWheel(event: WheelEvent) {\n if (!this._enabled) {\n return;\n }\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n const offset =\n (event.deltaY > 0 ? -1 : 1) *\n this.options.scale *\n (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this._observer.change(\n this,\n event,\n toAxis(this.axes, [offset]),\n this.options.useAnimation\n );\n clearTimeout(this._timer);\n\n this._timer = setTimeout(() => {\n if (this._holding) {\n this._holding = false;\n this._observer.release(this, event, [0]);\n }\n }, this.options.releaseDelay);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"wheel\", this._onWheel);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"wheel\", this._onWheel);\n this._enabled = false;\n this._observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport const KEY_LEFT_ARROW = 37;\nexport const KEY_A = 65;\nexport const KEY_UP_ARROW = 38;\nexport const KEY_W = 87;\nexport const KEY_RIGHT_ARROW = 39;\nexport const KEY_D = 68;\nexport const KEY_DOWN_ARROW = 40;\nexport const KEY_S = 83;\n\n/* eslint-disable */\nconst DIRECTION_REVERSE = -1;\nconst DIRECTION_FORWARD = 1;\nconst DIRECTION_HORIZONTAL = -1;\nconst DIRECTION_VERTICAL = 1;\nconst DELAY = 80;\n/* eslint-enable */\n\nexport interface MoveKeyInputOption {\n scale?: number[];\n}\n\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @param {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @param {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis.\n * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const moveKey = new eg.Axes.MoveKeyInput(\"#area\", {\n * \t\tscale: [1, 1]\n * });\n *\n * // Connect 'x', 'y' axes when the moveKey is pressed.\n * axes.connect([\"x\", \"y\"], moveKey);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트\n * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput moduleeg.Axes.MoveKeyInput 모듈의 옵션 객체\n */\nexport class MoveKeyInput implements InputType {\n public options: MoveKeyInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: MoveKeyInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: [1, 1],\n },\n ...options,\n };\n this._onKeydown = this._onKeydown.bind(this);\n this._onKeyup = this._onKeyup.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n\n // add tabindex=\"0\" to the container for making it focusable\n if (this.element.getAttribute(\"tabindex\") !== \"0\") {\n this.element.setAttribute(\"tabindex\", \"0\");\n }\n\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onKeydown(event: KeyboardEvent) {\n if (!this._enabled) {\n return;\n }\n\n let isMoveKey = true;\n let direction = DIRECTION_FORWARD;\n let move = DIRECTION_HORIZONTAL;\n\n switch (event.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL;\n break;\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL;\n break;\n default:\n isMoveKey = false;\n }\n if (\n (move === DIRECTION_HORIZONTAL && !this.axes[0]) ||\n (move === DIRECTION_VERTICAL && !this.axes[1])\n ) {\n isMoveKey = false;\n }\n if (!isMoveKey) {\n return;\n }\n event.preventDefault();\n const offsets =\n move === DIRECTION_HORIZONTAL\n ? [+this.options.scale[0] * direction, 0]\n : [0, +this.options.scale[1] * direction];\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n clearTimeout(this._timer);\n this._observer.change(this, event, toAxis(this.axes, offsets));\n }\n\n private _onKeyup(event: KeyboardEvent) {\n if (!this._holding) {\n return;\n }\n clearTimeout(this._timer);\n this._timer = setTimeout(() => {\n this._observer.release(this, event, [0, 0]);\n this._holding = false;\n }, DELAY);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"keydown\", this._onKeydown, false);\n this.element.addEventListener(\"keypress\", this._onKeydown, false);\n this.element.addEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"keydown\", this._onKeydown, false);\n this.element.removeEventListener(\"keypress\", this._onKeydown, false);\n this.element.removeEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = false;\n this._observer = null;\n }\n}\n","import Axes from \"./Axes\";\nimport { PanInput } from \"./inputType/PanInput\";\nimport { RotatePanInput } from \"./inputType/RotatePanInput\";\nimport { PinchInput } from \"./inputType/PinchInput\";\nimport { WheelInput } from \"./inputType/WheelInput\";\nimport { MoveKeyInput } from \"./inputType/MoveKeyInput\";\n\nAxes.PanInput = PanInput;\nAxes.RotatePanInput = RotatePanInput;\nAxes.PinchInput = PinchInput;\nAxes.WheelInput = WheelInput;\nAxes.MoveKeyInput = MoveKeyInput;\n\nexport default Axes;\n"],"names":["win","window","navigator","userAgent","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_HORIZONTAL","DIRECTION_UP","DIRECTION_DOWN","DIRECTION_VERTICAL","DIRECTION_ALL","MOUSE_LEFT","MOUSE_RIGHT","MOUSE_MIDDLE","VELOCITY_INTERVAL","IOS_EDGE_THRESHOLD","IS_IOS_SAFARI","getAgent","browser","name","TRANSFORM","document","bodyStyle","head","getElementsByTagName","style","target","i","len","length","PREVENT_DRAG_CSSPROPS","toArray","nodes","el","push","$","param","multi","match","dummy","createElement","innerHTML","childNodes","querySelectorAll","undefined","nodeName","nodeType","jQuery","constructor","prototype","jquery","get","Array","isArray","map","v","raf","requestAnimationFrame","webkitRequestAnimationFrame","caf","cancelAnimationFrame","webkitCancelAnimationFrame","keyInfo_1","oldraf_1","callback","wrapCallback","timestamp","key","setTimeout","performance","now","Date","getTime","clearTimeout","fp","obj","tranformed","k","filter","filtered","every","equal","base","roundNumFunc","roundNumber","num","roundUnit","getRoundFunc","roundNumbers","value","getDecimalPlace","val","isFinite","indexOf","p","e","Math","round","inversePow","n","pow","getAngle","posX","posY","atan2","PI","isCssPropsFromAxes","originalCssProps","same","Object","keys","forEach","prop","setCssProps","element","option","direction","touchActionMap","_a","oldCssProps","touchAction","newCssProps_1","revertCssProps","_axes","pos","roundPos","_getRoundPos","trigger","ComponentEvent","input","inputEvent","event","isTrusted","destPos","depaPos","roundDepa","setTo","_createUserControll","duration","__assign","bounceRatio","_getBounceRatio","holding","animationManager","axisManager","eventInfo","getEventInfo","moveTo","delta","set","isCanceled","off","userControl","toPos","userDuration","options","opt","range","bounce","_options","interruptable","_prevented","prevented","getInsidePosition","circular","toDestPos","targetRange","max","min","isOutside","isEndofBounce","getDuration","distance","deceleration","sqrt","isCircularable","getCirculatedPos","_axis","_complementOptions","_pos","reduce","acc","_this","fullDepaPos","axes","axisOptions","axis","axisOption","test","SUPPORT_TOUCH","SUPPORT_POINTER","SUPPORT_MSPOINTER","SUPPORT_POINTER_EVENTS","preventDefault","removeEventListener","_stopContextMenu","prevEvent","center","_getCenter","movement","_getMovement","x","y","scale","_getScale","angle","deltaX","deltaY","offsetX","offsetY","latestInterval","_latestInterval","timeStamp","deltaTime","velocityX","velocityY","srcEvent","preventSystemEvent","start","end","clientX","clientY","buttonCodeMap","button","_isTouchEvent","buttons","type","inputButton","addEventListener","__extends","_getButton","_isValidButton","_preventMouseButton","extendEvent","prev","EventInput","_baseTouches","touches","_getDistance","identifier","_updatePointerEvent","_removePointerEvent","_firstInputs","_recentInputs","pointerId","addFlag","id","nextSpot","prevSpot","toAxis","source","offset","convertInputType","inputType","hasTouch","hasMouse","hasPointer","PointerEventInput","TouchMouseEventInput","TouchEventInput","MouseEventInput","interruptManager","eventManager","_interruptManager","_eventManager","_axisManager","_animationManager","isInterrupted","changeOption","_isStopped","setInterrupt","stopAnimation","_moveDistance","hold","_isOutside","useAnimation","isInterrupting","nativeEvent","__childrenAxesAlreadyChanged","_atOutside","nested","_isEndofAxis","animateTo","triggerChange","finish","velocity","inputDuration","__childrenAxesAlreadyReleased","displacement","getDisplacement","getDelta","triggerRelease","userWish","getUserControl","isEqual","restore","triggerFinish","tn","tx","out","interpolate","clamp","animationEnd","bind","wishDuration","durations_1","abs","Infinity","minimumDuration","maximumDuration","totalVelocity","total","_animateParam","orgPos_1","_raf","triggerAnimationEnd","beforeParam","circularTargets","_createAnimationParam","retTrigger","triggerAnimationStart","console","warn","_animateLoop","orgPos","movedPos","done","complete","startTime","originalIntendedPos_1","state_1","_initState","loop_1","animateParam","nextState","_getNextState","finished","_getFinalPos","originalIntendedPos","ERROR_LIMIT","finalPos","_getRoundUnit","result","minRoundUnit","getAxisOptions","threshold","initSlope","_easing","diffTime","restart","currentPos","_initialEasingPer","_prevEasingPer","ratio","_durationOffset","info","easingPer","prevState","prevPos","directions","nextPos","circulatedPos","rangeOffset","easing","AnimationManager","startPos","_super","InterruptManager","AxisManager","EventManager","EasingManager","inputObserver","InputObserver","setAnimationManager","mapped","split","concat","_inputs","disconnect","mapAxes","connect","index","splice","setBy","updateAnimation","destroy","Axes","Component","getDirectionByAngle","thresholdAngle","toAngle","useDirection","checkType","userDirection","activeEvent","_activeEvent","onRelease","_observer","release","_detachWindowEvent","iOSEdgeSwipeThreshold","releaseOnScroll","_onPanstart","_onPanmove","_onPanend","useHorizontal","useVertical","_direction","observer","_detachElementEvent","_attachElementEvent","_originalCssProps","_enabled","panEvent","onEventStart","getTouches","cancelable","edgeThreshold","_atRightEdge","innerWidth","_attachWindowEvent","onEventMove","swipeLeftToRight","_forceRelease","_rightEdgeTimer","swipeRightToLeft","_getOffset","prevent","some","stopPropagation","change","onEventEnd","move","passive","properties","_voidFunction","isEnabled","rect","getBoundingClientRect","_coefficientForDistanceToAngle","width","_rotateOrigin","left","top","height","_prevAngle","_triggerChange","vx","vy","_lastDiff","_getPosFromOrigin","positiveAngle","quadrant","_getQuadrant","diff","_getDifference","_prevQuadrant","prevAngle","prevQuadrant","q","PanInput","_onPinchStart","_onPinchMove","_onPinchEnd","_detachEvent","_attachEvent","pinchEvent","_baseValue","_pinchFlag","pinchScale","releaseDelay","useNormalized","_onWheel","_holding","_timer","KEY_LEFT_ARROW","KEY_A","KEY_UP_ARROW","KEY_W","KEY_RIGHT_ARROW","KEY_D","KEY_DOWN_ARROW","KEY_S","DIRECTION_REVERSE","DIRECTION_FORWARD","DELAY","_onKeydown","_onKeyup","getAttribute","setAttribute","isMoveKey","keyCode","offsets","RotatePanInput","PinchInput","WheelInput","MoveKeyInput"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IAEA,IAAIA,GAAJ;;IAEA,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;IACjC;IACAD,EAAAA,GAAG,GAAG;I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pX,OAAL,CAAagF,mBAAb,CAAiC,OAAjC,EAA0C,KAAKqS,QAA/C,EAAyD,KAAzD;IACA,SAAK3E,QAAL,GAAgB,KAAhB;IACA,SAAKf,SAAL,GAAiB,IAAjB;IACD,GANO;;IAOV,qBAAA;IAAC,GAjKD;;IC1CAX,IAAI,CAAC0E,QAAL,GAAgBA,QAAhB;IACA1E,IAAI,CAAC2G,cAAL,GAAsBA,cAAtB;IACA3G,IAAI,CAAC4G,UAAL,GAAkBA,UAAlB;IACA5G,IAAI,CAAC6G,UAAL,GAAkBA,UAAlB;IACA7G,IAAI,CAAC8G,YAAL,GAAoBA,YAApB;;;;;;;;"} \ No newline at end of file diff --git a/dist/axes.min.js b/dist/axes.min.js new file mode 100644 index 00000000..b323332a --- /dev/null +++ b/dist/axes.min.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2015 NAVER Corp. +name: @egjs/axes +license: MIT +author: NAVER Corp. +repository: https://github.com/naver/egjs-axes +version: 3.3.0 +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/agent"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["@egjs/agent","@egjs/component"],e):(t.eg=t.eg||{},t.eg.Axes=e(t.eg.agent,t.eg.Component))}(this,function(t,d){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t){for(var e=[],n=0,i=t.length;n]*)>/)?((n=document.createElement("div")).innerHTML=t,s(n.childNodes)):s(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==u&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in u&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return p(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},m=u.requestAnimationFrame||u.webkitRequestAnimationFrame,E=u.cancelAnimationFrame||u.webkitCancelAnimationFrame;m&&!E?(o={},a=m,m=function(e){var n=a(function(t){o[n]&&e(t)});return o[n]=!0,n},E=function(t){delete o[t]}):m&&E||(m=function(t){return u.setTimeout(function(){t(u.performance&&u.performance.now&&u.performance.now()||(new Date).getTime())},16)},E=u.clearTimeout);function x(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function M(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function b(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function y(t,n){return b(t,function(t,e){return t===n[e]})}function P(t,e){return F[e]||(F[e]=j(e)),F[e](t)}function T(t,n){return t&&n?x(t,function(t,e){return P(t,"number"==typeof n?n:n[e])}):t}function w(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function O(t,e){return 180*Math.atan2(e,t)/Math.PI}function A(e){var n=!0;return Object.keys(g).forEach(function(t){e&&e[t]===g[t]||(n=!1)}),n}function D(e,t,n){var i,s,r,o=((i={})[1]="auto",i[30]="none",i[c]="pan-x",i[6]="pan-y",i),a={};return e&&e.style&&(s=t.touchAction?t.touchAction:o[n],r=f(f({},g),{"touch-action":"none"===e.style["touch-action"]?"none":s}),Object.keys(r).forEach(function(t){a[t]=e.style[t],e.style[t]=r[t]})),a}function I(e,n){e&&e.style&&n&&Object.keys(n).forEach(function(t){e.style[t]=n[t]})}function C(t,e,n,i){var s=t,r=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],s=Math.max(r[0],s);return Math.min(r[1],s)}function R(t,e){return te[1]}function S(t,e,n){return n[1]&&t>e[1]||n[0]&&te.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),W=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),K=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return x(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):f(f({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=x(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?L(t,e.range,e.circular):0})),{pos:f({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return b(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return M(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return x(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!R(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var s=this;Object.keys(this._axis).forEach(function(i){s._axis[i]=f({range:[0,100],bounce:[0,0],circular:[!1,!1]},s._axis[i]),["bounce","circular"].forEach(function(t){var e=s._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),V="ontouchstart"in u,U="PointerEvent"in u,e="MSPointerEvent"in u,q=U||e,Q=function(){function t(){var e=this;this._stopContextMenu=function(t){t.preventDefault(),u.removeEventListener("contextmenu",e._stopContextMenu)}}var e=t.prototype;return e.extendEvent=function(t){var e,n=this.prevEvent,i=this._getCenter(t),s=n?this._getMovement(t):{x:0,y:0},r=n?this._getScale(t):1,o=n?O(i.x-n.center.x,i.y-n.center.y):0,a=n?n.deltaX+s.x:s.x,u=n?n.deltaY+s.y:s.y,h=s.x,c=s.y,l=this._latestInterval,v=Date.now(),_=l?v-l.timestamp:0,d=n?n.velocityX:0,f=n?n.velocityY:0;return(!l||16<=_)&&(l&&(d=(e=[(a-l.deltaX)/_,(u-l.deltaY)/_])[0],f=e[1]),this._latestInterval={timestamp:v,deltaX:a,deltaY:u}),{srcEvent:t,scale:r,angle:o,center:i,deltaX:a,deltaY:u,offsetX:h,offsetY:c,velocityX:d,velocityY:f,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},e._getButton=function(t){var e={1:h,2:l,4:v},n=this._isTouchEvent(t)?h:e[t.buttons];return n||null},e._isTouchEvent=function(t){return-1=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=s._getRoundUnit(t,e);return P(t,n)})},e._getRoundUnit=function(t,e){var n,i,s=this._options.round,r=null;return s||(n=this.axisManager.getAxisOptions(e),i=Math.max(w(n.range[0]),w(n.range[1]),w(t)),r=1/Math.pow(10,i)),r||s},t}()),tt=function(s){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=s.call(this)||this;return i.axis=t,i._inputs=[],i.options=f({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null,nested:!1},e),i.interruptManager=new W(i.options),i.axisManager=new K(i.axis),i.eventManager=new N(i),i.animationManager=new $(i),i.inputObserver=new J(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}r(t,s);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.3.0",t.TRANSFORM=n,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=c,t.DIRECTION_ALL=30,t}(d),et=function(){function t(t,e){var n=this;this.axes=[],this.element=null,this._enabled=!1,this._activeEvent=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this._forceRelease=function(){var t=n._activeEvent,e=t.prevEvent;t.onRelease(),n._observer.release(n,e,[0,0]),n._detachWindowEvent(t)},this._voidFunction=function(){},this.element=p(t),this.options=f({inputType:["touch","mouse","pointer"],inputButton:[h],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1,touchAction:null},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?c:1,this.axes=t},e.connect=function(t){return this._activeEvent&&(this._detachElementEvent(),this._detachWindowEvent(this._activeEvent)),this._attachElementEvent(t),this._originalCssProps=D(this.element,this.options,this._direction),this},e.disconnect=function(){return this._detachElementEvent(),this._detachWindowEvent(this._activeEvent),A(this._originalCssProps)||I(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n=this._activeEvent,i=n.onEventStart(t,this.options.inputButton);!i||!this._enabled||1window.innerWidth-e,this._attachWindowEvent(n),n.prevEvent=i)},e._onPanmove=function(t){var e=this,n=this._activeEvent,i=n.onEventMove(t,this.options.inputButton);if(i&&this._enabled&&!(1 {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n const el = [];\n for (let i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n return el;\n};\n\nexport const $ = (param, multi = false) => {\n let el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n const match = param.match(/^<([a-z]+)\\s*([^>]*)>/);\n\n // creating element\n if (match) {\n // HTML\n const dummy = document.createElement(\"div\");\n\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === window) {\n // window\n el = param;\n } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) {\n // HTMLElement, Document\n el = param;\n } else if (\n (\"jQuery\" in window && param instanceof jQuery) ||\n param.constructor.prototype.jquery\n ) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map((v) => $(v));\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n return el;\n};\n\nlet raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame;\nlet caf = window.cancelAnimationFrame || window.webkitCancelAnimationFrame;\nif (raf && !caf) {\n const keyInfo = {};\n const oldraf = raf;\n raf = (callback: FrameRequestCallback) => {\n const wrapCallback = (timestamp: number) => {\n if (keyInfo[key]) {\n callback(timestamp);\n }\n };\n const key = oldraf(wrapCallback);\n keyInfo[key] = true;\n return key;\n };\n caf = (key: number) => {\n delete keyInfo[key];\n };\n} else if (!(raf && caf)) {\n raf = (callback: FrameRequestCallback) => {\n return window.setTimeout(() => {\n callback(\n ((window.performance &&\n window.performance.now &&\n window.performance.now()) as number) || new Date().getTime()\n );\n }, 16);\n };\n caf = window.clearTimeout;\n}\n\n/**\n * A polyfill for the window.requestAnimationFrame() method.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame\n * @private\n */\nexport const requestAnimationFrame = (fp) => {\n return raf(fp);\n};\n/**\n * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method.\n * @param {Number} key −\tThe ID value returned through a call to the requestAnimationFrame() method. requestAnimationFrame() 메서드가 반환한 아이디 값\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame\n * @private\n */\nexport const cancelAnimationFrame = (key) => {\n caf(key);\n};\n\nexport const map = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => U\n): ObjectInterface => {\n const tranformed: ObjectInterface = {};\n\n for (const k in obj) {\n if (k) {\n tranformed[k] = callback(obj[k], k);\n }\n }\n return tranformed;\n};\n\nexport const filter = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n): ObjectInterface => {\n const filtered: ObjectInterface = {};\n\n for (const k in obj) {\n if (k && callback(obj[k], k)) {\n filtered[k] = obj[k];\n }\n }\n return filtered;\n};\nexport const every = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n) => {\n for (const k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n return true;\n};\nexport const equal = (\n target: ObjectInterface,\n base: ObjectInterface\n): boolean => {\n return every(target, (v, k) => v === base[k]);\n};\n\nconst roundNumFunc = {};\n\nexport const roundNumber = (num: number, roundUnit: number) => {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n};\n\nexport const roundNumbers = (\n num: ObjectInterface,\n roundUnit: ObjectInterface | number\n): ObjectInterface => {\n if (!num || !roundUnit) {\n return num;\n }\n return map(num, (value, key) =>\n roundNumber(\n value,\n typeof roundUnit === \"number\" ? roundUnit : roundUnit[key]\n )\n );\n};\n\nexport const getDecimalPlace = (val: number): number => {\n if (!isFinite(val)) {\n return 0;\n }\n\n const v = `${val}`;\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n let p = 0;\n let e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n }\n\n // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n};\n\nexport const inversePow = (n: number) => {\n // replace Math.pow(10, -n) to solve floating point issue.\n // eg. Math.pow(10, -4) => 0.00009999999999999999\n return 1 / Math.pow(10, n);\n};\n\nexport const getRoundFunc = (v: number) => {\n const p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n\n return (n: number) => {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n};\n\nexport const getAngle = (posX: number, posY: number) => {\n return (Math.atan2(posY, posX) * 180) / Math.PI;\n};\n\nexport const isCssPropsFromAxes = (originalCssProps: {\n [key: string]: string;\n}) => {\n let same = true;\n Object.keys(PREVENT_DRAG_CSSPROPS).forEach((prop) => {\n if (\n !originalCssProps ||\n originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]\n ) {\n same = false;\n }\n });\n return same;\n};\n\nexport const setCssProps = (\n element: HTMLElement,\n option: PanInputOption | PinchInputOption,\n direction: number\n): { [key: string]: string } => {\n const touchActionMap = {\n [DIRECTION_NONE]: \"auto\",\n [DIRECTION_ALL]: \"none\",\n [DIRECTION_VERTICAL]: \"pan-x\",\n [DIRECTION_HORIZONTAL]: \"pan-y\",\n };\n const oldCssProps = {};\n if (element && element.style) {\n const touchAction = option.touchAction\n ? option.touchAction\n : touchActionMap[direction];\n const newCssProps = {\n ...PREVENT_DRAG_CSSPROPS,\n \"touch-action\":\n element.style[\"touch-action\"] === \"none\" ? \"none\" : touchAction,\n };\n Object.keys(newCssProps).forEach((prop) => {\n oldCssProps[prop] = element.style[prop];\n element.style[prop] = newCssProps[prop];\n });\n }\n return oldCssProps;\n};\n\nexport const revertCssProps = (\n element: HTMLElement,\n originalCssProps: { [key: string]: string }\n): { [key: string]: string } => {\n if (element && element.style && originalCssProps) {\n Object.keys(originalCssProps).forEach((prop) => {\n element.style[prop] = originalCssProps[prop];\n });\n }\n return;\n};\n","/* eslint-disable no-new-func, no-nested-ternary */\n\nlet win: any;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {\n navigator: {\n userAgent: \"\",\n },\n };\n} else {\n win = window;\n}\n/* eslint-enable no-new-func, no-nested-ternary */\n\nexport { win as window };\n","export const DIRECTION_NONE = 1;\nexport const DIRECTION_LEFT = 2;\nexport const DIRECTION_RIGHT = 4;\nexport const DIRECTION_HORIZONTAL = 2 | 4;\nexport const DIRECTION_UP = 8;\nexport const DIRECTION_DOWN = 16;\nexport const DIRECTION_VERTICAL = 8 | 16;\nexport const DIRECTION_ALL = 2 | 4 | 8 | 16;\n\nexport const MOUSE_LEFT = \"left\";\nexport const MOUSE_RIGHT = \"right\";\nexport const MOUSE_MIDDLE = \"middle\";\n\nexport const VELOCITY_INTERVAL = 16;\n\nimport getAgent from \"@egjs/agent\";\n\nimport { window } from \"./browser\";\n\nexport const IOS_EDGE_THRESHOLD = 30;\nexport const IS_IOS_SAFARI =\n \"ontouchstart\" in window && getAgent().browser.name === \"safari\";\n\nexport const TRANSFORM = (() => {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n const bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0])\n .style;\n const target = [\n \"transform\",\n \"webkitTransform\",\n \"msTransform\",\n \"mozTransform\",\n ];\n for (let i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n return \"\";\n})();\n\nexport const PREVENT_DRAG_CSSPROPS = {\n \"user-select\": \"none\",\n \"-webkit-user-drag\": \"none\",\n};\n","export const getInsidePosition = (\n destPos: number,\n range: number[],\n circular: boolean[],\n bounce?: number[]\n): number => {\n let toDestPos: number = destPos;\n const targetRange: number[] = [\n circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0],\n circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1],\n ];\n\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n\n return toDestPos;\n};\n\n// determine outside\nexport const isOutside = (pos: number, range: number[]): boolean => {\n return pos < range[0] || pos > range[1];\n};\n\n// determine whether position has reached the maximum moveable area\nexport const isEndofBounce = (\n pos: number,\n range: number[],\n bounce: number[],\n circular: boolean[]\n): boolean => {\n return (\n (!circular[0] && pos === range[0] - bounce[0]) ||\n (!circular[1] && pos === range[1] + bounce[1])\n );\n};\n\nexport const getDuration = (distance: number, deceleration): number => {\n const duration = Math.sqrt((distance / deceleration) * 2);\n\n // when duration is under 100, then value is zero\n return duration < 100 ? 0 : duration;\n};\n\nexport const isCircularable = (\n destPos: number,\n range: number[],\n circular: boolean[]\n): boolean => {\n return (\n (circular[1] && destPos > range[1]) || (circular[0] && destPos < range[0])\n );\n};\n\nexport const getCirculatedPos = (\n pos: number,\n range: number[],\n circular: boolean[]\n): number => {\n let toPos = pos;\n const min = range[0];\n const max = range[1];\n const length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = ((toPos - max) % length) + min;\n }\n if (circular[0] && pos < min) {\n // left\n toPos = ((toPos - min) % length) + max;\n }\n return toPos;\n};\n","import { Axis } from \"../AxisManager\";\nimport { AxesOption } from \"../Axes\";\nimport { ActiveEvent } from \"../types\";\nimport { MouseEventInput } from \"../eventInput/MouseEventInput\";\nimport { TouchEventInput } from \"../eventInput/TouchEventInput\";\nimport { PointerEventInput } from \"../eventInput/PointerEventInput\";\nimport { TouchMouseEventInput } from \"../eventInput/TouchMouseEventInput\";\nimport {\n SUPPORT_POINTER_EVENTS,\n SUPPORT_TOUCH,\n} from \"../eventInput/EventInput\";\n\nexport interface InputType {\n axes: string[];\n element: HTMLElement;\n mapAxes(axes: string[]);\n connect(observer: InputTypeObserver): InputType;\n disconnect();\n destroy();\n enable?();\n disable?();\n isEnable?(): boolean;\n}\n\nexport interface InputTypeObserver {\n options: AxesOption;\n get(inputType: InputType): Axis;\n change(inputType: InputType, event, offset: Axis, useAnimation?: boolean);\n hold(inputType: InputType, event);\n release(\n inputType: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n );\n}\n\nexport const toAxis = (source: string[], offset: number[]): Axis => {\n return offset.reduce((acc, v, i) => {\n if (source[i]) {\n acc[source[i]] = v;\n }\n return acc;\n }, {});\n};\n\nexport const convertInputType = (inputType: string[] = []): ActiveEvent => {\n let hasTouch = false;\n let hasMouse = false;\n let hasPointer = false;\n\n inputType.forEach((v) => {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n if (hasPointer) {\n return new PointerEventInput();\n } else if (hasTouch && hasMouse) {\n return new TouchMouseEventInput();\n } else if (hasTouch) {\n return new TouchEventInput();\n } else if (hasMouse) {\n return new MouseEventInput();\n }\n return null;\n};\n","import {\n getInsidePosition,\n isCircularable,\n getCirculatedPos,\n getDuration,\n} from \"../Coordinate\";\nimport { Axis, AxisManager } from \"../AxisManager\";\nimport { InterruptManager } from \"../InterruptManager\";\nimport { EventManager, ChangeEventOption } from \"../EventManager\";\nimport {\n requestAnimationFrame,\n cancelAnimationFrame,\n map,\n every,\n filter,\n equal,\n roundNumber,\n getDecimalPlace,\n inversePow,\n} from \"../utils\";\nimport { AxesOption } from \"../Axes\";\nimport {\n AnimationParam,\n ObjectInterface,\n UpdateAnimationOption,\n} from \"../types\";\n\nexport interface AnimationState {\n pos: Axis;\n easingPer: number;\n finished: boolean;\n}\n\nconst clamp = (value: number, min: number, max: number): number => {\n return Math.max(Math.min(value, max), min);\n};\n\nexport abstract class AnimationManager {\n public interruptManager: InterruptManager;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n protected _options: AxesOption;\n protected _animateParam: AnimationParam;\n private _raf: number;\n\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n }) {\n this._options = options;\n this.interruptManager = interruptManager;\n this.eventManager = eventManager;\n this.axisManager = axisManager;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n public abstract interpolate(displacement: number, threshold: number): number;\n\n public abstract updateAnimation(options: UpdateAnimationOption): void;\n\n protected abstract _initState(info: AnimationParam): AnimationState;\n\n protected abstract _getNextState(prevState: AnimationState): AnimationState;\n\n public getDuration(\n depaPos: Axis,\n destPos: Axis,\n wishDuration?: number\n ): number {\n let duration: number;\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n const durations: Axis = map(destPos, (v, k) =>\n getDuration(Math.abs(v - depaPos[k]), this._options.deceleration)\n );\n duration = Object.keys(durations).reduce(\n (max, v) => Math.max(max, durations[v]),\n -Infinity\n );\n }\n return clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n }\n\n public getDisplacement(velocity: number[]): number[] {\n const totalVelocity = Math.pow(\n velocity.reduce((total, v) => total + v * v, 0),\n 1 / velocity.length\n );\n const duration = Math.abs(totalVelocity / -this._options.deceleration);\n return velocity.map((v) => (v / 2) * duration);\n }\n\n public stopAnimation(option?: ChangeEventOption): void {\n if (this._animateParam) {\n const orgPos: Axis = this.axisManager.get();\n const pos: Axis = this.axisManager.map(orgPos, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n );\n if (!every(pos, (v, k) => orgPos[k] === v)) {\n this.eventManager.triggerChange(pos, orgPos, option, !!option);\n }\n this._animateParam = null;\n if (this._raf) {\n cancelAnimationFrame(this._raf);\n }\n this._raf = null;\n this.eventManager.triggerAnimationEnd(!!option?.event);\n }\n }\n\n public getEventInfo(): ChangeEventOption {\n if (\n this._animateParam &&\n this._animateParam.input &&\n this._animateParam.inputEvent\n ) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent,\n };\n } else {\n return null;\n }\n }\n\n public restore(option: ChangeEventOption): void {\n const pos: Axis = this.axisManager.get();\n const destPos: Axis = this.axisManager.map(pos, (v, opt) =>\n Math.min(opt.range[1], Math.max(opt.range[0], v))\n );\n this.stopAnimation();\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n }\n\n public animationEnd(): void {\n const beforeParam: ChangeEventOption = this.getEventInfo();\n this._animateParam = null;\n\n // for Circular\n const circularTargets = this.axisManager.filter(\n this.axisManager.get(),\n (v, opt) => isCircularable(v, opt.range, opt.circular as boolean[])\n );\n if (Object.keys(circularTargets).length > 0) {\n this.setTo(\n this.axisManager.map(circularTargets, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n )\n );\n }\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerAnimationEnd(!!beforeParam);\n if (this.axisManager.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n }\n\n public finish(isTrusted: boolean): void {\n this._animateParam = null;\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerFinish(isTrusted);\n }\n\n public getUserControl(param: AnimationParam): {\n destPos: Axis;\n duration: number;\n } {\n const userWish = param.setTo();\n userWish.destPos = this.axisManager.get(userWish.destPos);\n userWish.duration = clamp(\n userWish.duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n return userWish;\n }\n\n public animateTo(\n destPos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): void {\n this.stopAnimation();\n const param: AnimationParam = this._createAnimationParam(\n destPos,\n duration,\n option\n );\n const depaPos = { ...param.depaPos };\n const retTrigger = this.eventManager.triggerAnimationStart(param);\n\n // to control\n const userWish = this.getUserControl(param);\n\n // You can't stop the 'animationStart' event when 'circular' is true.\n if (\n !retTrigger &&\n this.axisManager.every(userWish.destPos, (v, opt) =>\n isCircularable(v, opt.range, opt.circular as boolean[])\n )\n ) {\n console.warn(\n \"You can't stop the 'animation' event when 'circular' is true.\"\n );\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n const inputEvent = option?.event || null;\n this._animateLoop(\n {\n depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axisManager.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent,\n input: option?.input || null,\n },\n () => this.animationEnd()\n );\n }\n }\n\n public setTo(pos: Axis, duration: number = 0) {\n const axes: string[] = Object.keys(pos);\n const orgPos: Axis = this.axisManager.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n this.interruptManager.setInterrupt(true);\n let movedPos = filter(pos, (v, k) => orgPos[k] !== v);\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axisManager.map(movedPos, (v, opt) => {\n const { range, circular } = opt;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular as boolean[]);\n }\n });\n\n if (equal(movedPos, orgPos)) {\n return this;\n }\n\n if (duration > 0) {\n this.animateTo(movedPos, duration);\n } else {\n this.stopAnimation();\n this.eventManager.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n }\n\n public setBy(pos: Axis, duration = 0) {\n return this.setTo(\n map(this.axisManager.get(Object.keys(pos)), (v, k) => v + pos[k]),\n duration\n );\n }\n\n private _createAnimationParam(\n pos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): AnimationParam {\n const depaPos: Axis = this.axisManager.get();\n const destPos: Axis = pos;\n const inputEvent = option?.event || null;\n return {\n depaPos,\n destPos,\n duration: clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n ),\n delta: this.axisManager.getDelta(depaPos, destPos),\n inputEvent,\n input: option?.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd,\n };\n }\n\n private _animateLoop(param: AnimationParam, complete: () => void): void {\n if (param.duration) {\n this._animateParam = {\n ...param,\n startTime: new Date().getTime(),\n };\n const originalIntendedPos = map(param.destPos, (v) => v);\n let state = this._initState(this._animateParam);\n\n const loop = () => {\n this._raf = null;\n const animateParam = this._animateParam;\n const nextState = this._getNextState(state);\n const isCanceled = !this.eventManager.triggerChange(\n nextState.pos,\n state.pos\n );\n\n state = nextState;\n\n if (nextState.finished) {\n animateParam.destPos = this._getFinalPos(\n animateParam.destPos,\n originalIntendedPos\n );\n if (\n !equal(\n animateParam.destPos,\n this.axisManager.get(Object.keys(animateParam.destPos))\n )\n ) {\n this.eventManager.triggerChange(\n animateParam.destPos,\n nextState.pos\n );\n }\n complete();\n return;\n } else if (isCanceled) {\n this.finish(false);\n } else {\n this._raf = requestAnimationFrame(loop);\n }\n };\n loop();\n } else {\n this.eventManager.triggerChange(param.destPos);\n complete();\n }\n }\n\n /**\n * Get estimated final value.\n *\n * If destPos is within the 'error range' of the original intended position, the initial intended position is returned.\n * - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100;\n * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos.\n * - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123\n * @param originalIntendedPos\n * @param destPos\n */\n private _getFinalPos(\n destPos: ObjectInterface,\n originalIntendedPos: ObjectInterface\n ): Axis {\n // compare destPos and originalIntendedPos\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const ERROR_LIMIT = 0.000001;\n const finalPos = map(destPos, (value, key) => {\n if (\n value >= originalIntendedPos[key] - ERROR_LIMIT &&\n value <= originalIntendedPos[key] + ERROR_LIMIT\n ) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n const roundUnit = this._getRoundUnit(value, key);\n const result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n }\n\n private _getRoundUnit(val: number, key: string): number {\n const roundUnit = this._options.round; // manual mode\n let minRoundUnit = null; // auto mode\n\n // auto mode\n if (!roundUnit) {\n // Get minimum round unit\n const options = this.axisManager.getAxisOptions(key);\n minRoundUnit = inversePow(\n Math.max(\n getDecimalPlace(options.range[0]),\n getDecimalPlace(options.range[1]),\n getDecimalPlace(val)\n )\n );\n }\n\n return minRoundUnit || roundUnit;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport {\n IS_IOS_SAFARI,\n IOS_EDGE_THRESHOLD,\n DIRECTION_NONE,\n DIRECTION_VERTICAL,\n DIRECTION_HORIZONTAL,\n DIRECTION_ALL,\n MOUSE_LEFT,\n} from \"../const\";\nimport { ActiveEvent, InputEventType } from \"../types\";\n\nimport {\n convertInputType,\n InputType,\n InputTypeObserver,\n toAxis,\n} from \"./InputType\";\n\nexport interface PanInputOption {\n inputType?: string[];\n inputButton?: string[];\n scale?: number[];\n thresholdAngle?: number;\n threshold?: number;\n iOSEdgeSwipeThreshold?: number;\n releaseOnScroll?: boolean;\n touchAction?: string;\n}\n\n// get user's direction\nexport const getDirectionByAngle = (\n angle: number,\n thresholdAngle: number\n): number => {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n const toAngle = Math.abs(angle);\n\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle\n ? DIRECTION_VERTICAL\n : DIRECTION_HORIZONTAL;\n};\n\nexport const useDirection = (checkType, direction, userDirection?): boolean => {\n if (userDirection) {\n return !!(\n direction === DIRECTION_ALL ||\n (direction & checkType && userDirection & checkType)\n );\n } else {\n return !!(direction & checkType);\n }\n};\n\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @param {String[]} [inputType=[\"touch\", \"mouse\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - mouse: Mouse\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - mouse: 마우스\n * - pointer: 마우스 및 터치\n * @param {String[]} [inputButton=[\"left\"]] List of buttons to allow input\n * - left: Left mouse button and normal touch\n * - middle: Mouse wheel press\n * - right: Right mouse button 입력을 허용할 버튼 목록\n * - left: 마우스 왼쪽 버튼\n * - middle: 마우스 휠 눌림\n * - right: 마우스 오른쪽 버튼 \n * @param {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] horizontal axis scale 수평축 배율\n * @param {Number} [scale[1]=1] vertical axis scale 수직축 배율\n * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @param {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @param {String} [touchAction=null] Value that overrides the element's \"touch-action\" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다.\n **/\n/**\n * 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.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\n * ```js\n * const pan = new eg.Axes.PanInput(\"#area\", {\n * \t\tinputType: [\"touch\"],\n * \t\tscale: [1, 1.3],\n * });\n *\n * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something2\", \"somethingN\"], pan); // or axes.connect(\"something2 somethingN\", pan);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something1\"], pan); // or axes.connect(\"something1\", pan);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"\", \"something2\"], pan); // or axes.connect(\" something2\", pan);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module eg.Axes.PanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options={}] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n */\nexport class PanInput implements InputType {\n public options: PanInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n protected _observer: InputTypeObserver;\n protected _direction: number;\n protected _enabled = false;\n protected _activeEvent: ActiveEvent = null;\n private _originalCssProps: { [key: string]: string };\n private _atRightEdge = false;\n private _rightEdgeTimer = 0;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n this.element = $(el);\n this.options = {\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n inputButton: [MOUSE_LEFT],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n releaseOnScroll: false,\n touchAction: null,\n ...options,\n };\n this._onPanstart = this._onPanstart.bind(this);\n this._onPanmove = this._onPanmove.bind(this);\n this._onPanend = this._onPanend.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n const useHorizontal = !!axes[0];\n const useVertical = !!axes[1];\n if (useHorizontal && useVertical) {\n this._direction = DIRECTION_ALL;\n } else if (useHorizontal) {\n this._direction = DIRECTION_HORIZONTAL;\n } else if (useVertical) {\n this._direction = DIRECTION_VERTICAL;\n } else {\n this._direction = DIRECTION_NONE;\n }\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n }\n this._attachElementEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n this._direction\n );\n return this;\n }\n\n public disconnect() {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n this._direction = DIRECTION_NONE;\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n protected _onPanstart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n const edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n\n this._observer.hold(this, panEvent);\n this._atRightEdge =\n IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold;\n this._attachWindowEvent(activeEvent);\n activeEvent.prevEvent = panEvent;\n }\n }\n\n protected _onPanmove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n const { iOSEdgeSwipeThreshold, releaseOnScroll } = this.options;\n const userDirection = getDirectionByAngle(\n panEvent.angle,\n this.options.thresholdAngle\n );\n\n if (releaseOnScroll && !panEvent.srcEvent.cancelable) {\n this._onPanend(event);\n return;\n }\n\n if (activeEvent.prevEvent && IS_IOS_SAFARI) {\n const swipeLeftToRight = panEvent.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this._forceRelease();\n return;\n } else if (this._atRightEdge) {\n clearTimeout(this._rightEdgeTimer);\n\n // - is right to left\n const swipeRightToLeft = panEvent.deltaX < -iOSEdgeSwipeThreshold;\n\n if (swipeRightToLeft) {\n this._atRightEdge = false;\n } else {\n // iOS swipe right => left\n this._rightEdgeTimer = window.setTimeout(\n () => this._forceRelease(),\n 100\n );\n }\n }\n }\n const offset: number[] = this._getOffset(\n [panEvent.offsetX, panEvent.offsetY],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection),\n useDirection(DIRECTION_VERTICAL, this._direction, userDirection),\n ]\n );\n const prevent = offset.some((v) => v !== 0);\n\n if (prevent) {\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n }\n panEvent.preventSystemEvent = prevent;\n if (prevent) {\n this._observer.change(this, panEvent, toAxis(this.axes, offset));\n }\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this._enabled || activeEvent.getTouches(event) !== 0) {\n return;\n }\n this._detachWindowEvent(activeEvent);\n clearTimeout(this._rightEdgeTimer);\n const prevEvent = activeEvent.prevEvent;\n const velocity = this._getOffset(\n [\n Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1),\n Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1),\n ],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction),\n useDirection(DIRECTION_VERTICAL, this._direction),\n ]\n );\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, velocity);\n }\n\n protected _attachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.addEventListener(event, this._onPanmove, { passive: false });\n });\n activeEvent?.end.forEach((event) => {\n window.addEventListener(event, this._onPanend, { passive: false });\n });\n }\n\n protected _detachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.removeEventListener(event, this._onPanmove);\n });\n activeEvent?.end.forEach((event) => {\n window.removeEventListener(event, this._onPanend);\n });\n }\n\n protected _getOffset(properties: number[], direction: boolean[]): number[] {\n const offset: number[] = [0, 0];\n const scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n return offset;\n }\n\n private _attachElementEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element?.addEventListener(event, this._onPanstart);\n });\n // adding event listener to element prevents invalid behavior in iOS Safari\n activeEvent.move.forEach((event) => {\n this.element?.addEventListener(event, this._voidFunction);\n });\n }\n\n private _detachElementEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element?.removeEventListener(event, this._onPanstart);\n });\n activeEvent?.move.forEach((event) => {\n this.element?.removeEventListener(event, this._voidFunction);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _forceRelease = () => {\n const activeEvent = this._activeEvent;\n const prevEvent = activeEvent.prevEvent;\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [0, 0]);\n this._detachWindowEvent(activeEvent);\n };\n\n private _voidFunction = () => {};\n}\n","import { ComponentEvent } from \"@egjs/component\";\n\nimport { InputType } from \"./inputType/InputType\";\nimport { Axis } from \"./AxisManager\";\nimport Axes from \"./Axes\";\nimport { roundNumbers } from \"./utils\";\nimport { AnimationParam, OnAnimationStart, OnRelease } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface ChangeEventOption {\n input: InputType;\n event;\n}\n\nexport class EventManager {\n public animationManager: AnimationManager;\n public constructor(private _axes: Axes) {}\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @event Axes#hold\n * @type {object}\n * @property {Object.} pos coordinate 좌표 정보\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"hold\", function(event) {\n * // event.pos\n * // event.input\n * // event.inputEvent\n * // isTrusted\n * });\n * ```\n */\n public hold(pos: Axis, option: ChangeEventOption) {\n const { roundPos } = this._getRoundPos(pos);\n\n this._axes.trigger(\n new ComponentEvent(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true,\n })\n );\n }\n\n /**\n * Specifies the coordinates to move after the 'change' event. It works when the holding value of the change event is true.\n * @ko 'change' 이벤트 이후 이동할 좌표를 지정한다. change이벤트의 holding 값이 true일 경우에 동작한다\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events.\n * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationStart\", function(event) {\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n /**\n * This event is fired when a user release an element on the screen of the device.\n * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트\n * @event Axes#release\n * @type {object}\n * @property {Object.} depaPos The coordinates when releasing an element손을 뗐을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to after releasing an element손을 뗀 뒤에 이동할 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value 손을 뗐을 때의 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'release' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerRelease(param: AnimationParam) {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n this._axes.trigger(\n new ComponentEvent(\"release\", {\n ...param,\n bounceRatio: this._getBounceRatio(roundPos),\n } as OnRelease)\n );\n }\n\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @event Axes#change\n * @type {object}\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value 현재 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.사용자가 기기의 화면을 누르고 있는지 여부\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true 이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * // event.pos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.holding\n * // event.set\n * // event.isTrusted\n *\n * // if you want to change the coordinates to move after the 'change' event.\n * // it works when the holding value of the change event is true.\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n public triggerChange(\n pos: Axis,\n depaPos?: Axis,\n option?: ChangeEventOption,\n holding: boolean = false\n ) {\n const animationManager = this.animationManager;\n const axisManager = animationManager.axisManager;\n const eventInfo = animationManager.getEventInfo();\n const { roundPos, roundDepa } = this._getRoundPos(pos, depaPos);\n const moveTo = axisManager.moveTo(roundPos, roundDepa);\n const inputEvent = option?.event || eventInfo?.event || null;\n const param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n bounceRatio: this._getBounceRatio(moveTo.pos),\n holding,\n inputEvent,\n isTrusted: !!inputEvent,\n input: option?.input || eventInfo?.input || null,\n set: inputEvent ? this._createUserControll(moveTo.pos) : () => {}, // eslint-disable-line @typescript-eslint/no-empty-function\n };\n const event = new ComponentEvent(\"change\", param);\n this._axes.trigger(event);\n\n if (inputEvent) {\n axisManager.set(\n (param.set() as { destPos: Axis; duration: number }).destPos\n );\n }\n\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @event Axes#animationStart\n * @type {object}\n * @property {Object.} depaPos The coordinates when animation starts애니메이션이 시작 되었을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to. If you change this value, you can run the animation이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'animationStart' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerAnimationStart(param: AnimationParam): boolean {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n const event = new ComponentEvent(\n \"animationStart\",\n param as OnAnimationStart\n );\n this._axes.trigger(event);\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#animationEnd\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationEnd\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerAnimationEnd(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"animationEnd\", {\n isTrusted,\n })\n );\n }\n\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#finish\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"finish\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerFinish(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"finish\", {\n isTrusted,\n })\n );\n }\n\n public setAnimationManager(animationManager: AnimationManager) {\n this.animationManager = animationManager;\n }\n\n public destroy() {\n this._axes.off();\n }\n\n private _createUserControll(pos: Axis, duration: number = 0) {\n // to controll\n const userControl = {\n destPos: { ...pos },\n duration,\n };\n return (\n toPos?: Axis,\n userDuration?: number\n ): { destPos: Axis; duration: number } => {\n if (toPos) {\n userControl.destPos = { ...toPos };\n }\n if (userDuration !== undefined) {\n userControl.duration = userDuration;\n }\n return userControl;\n };\n }\n\n private _getRoundPos(pos: Axis, depaPos?: Axis) {\n // round value if round exist\n const roundUnit = this._axes.options.round;\n\n // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit),\n };\n }\n\n private _getBounceRatio(pos: Axis): Axis {\n return this._axes.axisManager.map(pos, (v, opt) => {\n if (v < opt.range[0] && opt.bounce[0] !== 0) {\n return (opt.range[0] - v) / opt.bounce[0];\n } else if (v > opt.range[1] && opt.bounce[1] !== 0) {\n return (v - opt.range[1]) / opt.bounce[1];\n } else {\n return 0;\n }\n });\n }\n}\n","import { AxesOption } from \"./Axes\";\nexport class InterruptManager {\n private _prevented = false; // check whether the animation event was prevented\n public constructor(private _options: AxesOption) {}\n\n public isInterrupting() {\n // when interruptable is 'true', return value is always 'true'.\n return this._options.interruptable || this._prevented;\n }\n\n public isInterrupted() {\n return !this._options.interruptable && this._prevented;\n }\n\n public setInterrupt(prevented) {\n if (!this._options.interruptable) {\n this._prevented = prevented;\n }\n }\n}\n","import { isOutside, getCirculatedPos } from \"./Coordinate\";\nimport { map, filter, every } from \"./utils\";\nimport { ObjectInterface } from \"./types\";\n\nexport interface Axis {\n [key: string]: number;\n}\n\nexport interface AxisOption {\n range?: number[];\n bounce?: number | number[];\n circular?: boolean | boolean[];\n}\n\nexport class AxisManager {\n private _pos: Axis;\n public constructor(private _axis: ObjectInterface) {\n this._complementOptions();\n this._pos = Object.keys(this._axis).reduce((acc, v) => {\n acc[v] = this._axis[v].range[0];\n return acc;\n }, {});\n }\n\n public getDelta(depaPos: Axis, destPos: Axis): Axis {\n const fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), (v, k) => v - fullDepaPos[k]);\n }\n\n public get(axes?: string[] | Axis): Axis {\n if (axes && Array.isArray(axes)) {\n return axes.reduce((acc, v) => {\n if (v && v in this._pos) {\n acc[v] = this._pos[v];\n }\n return acc;\n }, {});\n } else {\n return { ...this._pos, ...((axes || {}) as Axis) };\n }\n }\n\n public moveTo(pos: Axis, depaPos: Axis = this._pos): { [key: string]: Axis } {\n const delta = map(this._pos, (v, key) => {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n\n this.set(\n this.map(pos, (v, opt) =>\n opt ? getCirculatedPos(v, opt.range, opt.circular as boolean[]) : 0\n )\n );\n return {\n pos: { ...this._pos },\n delta,\n };\n }\n\n public set(pos: Axis) {\n for (const k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n }\n\n public every(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): boolean {\n const axisOptions = this._axis;\n\n return every(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public filter(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): Axis {\n const axisOptions = this._axis;\n\n return filter(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public map(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => U\n ) {\n const axisOptions = this._axis;\n\n return map(pos, (value, key) =>\n callback(value, axisOptions[key], key)\n );\n }\n\n public isOutside(axes?: string[]) {\n return !this.every(\n axes ? this.get(axes) : this._pos,\n (v, opt) => !isOutside(v, opt.range)\n );\n }\n\n public getAxisOptions(key: string) {\n return this._axis[key];\n }\n\n /**\n * set up 'css' expression\n * @private\n */\n private _complementOptions() {\n Object.keys(this._axis).forEach((axis) => {\n this._axis[axis] = {\n ...{\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false],\n },\n ...this._axis[axis],\n };\n\n [\"bounce\", \"circular\"].forEach((v) => {\n const axisOption = this._axis;\n const key = axisOption[axis][v];\n\n if (/string|number|boolean/.test(typeof key)) {\n axisOption[axis][v] = [key, key];\n }\n });\n });\n }\n}\n","import { ExtendedEvent, InputEventType, LatestInterval } from \"../types\";\nimport { getAngle } from \"../utils\";\nimport { window } from \"../browser\";\nimport {\n MOUSE_LEFT,\n MOUSE_MIDDLE,\n MOUSE_RIGHT,\n VELOCITY_INTERVAL,\n} from \"../const\";\n\nexport const SUPPORT_TOUCH = \"ontouchstart\" in window;\nexport const SUPPORT_POINTER = \"PointerEvent\" in window;\nexport const SUPPORT_MSPOINTER = \"MSPointerEvent\" in window;\nexport const SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER;\n\nexport abstract class EventInput {\n public prevEvent: ExtendedEvent;\n private _latestInterval: LatestInterval;\n\n public abstract onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventEnd(event: InputEventType): void;\n\n public abstract onRelease(event: InputEventType): void;\n\n public abstract getTouches(event: InputEventType): number;\n\n protected abstract _getScale(event: InputEventType): number;\n\n protected abstract _getCenter(event: InputEventType): {\n x: number;\n y: number;\n };\n\n protected abstract _getMovement(event: InputEventType): {\n x: number;\n y: number;\n };\n\n public extendEvent(event: InputEventType): ExtendedEvent {\n const prevEvent = this.prevEvent;\n const center = this._getCenter(event);\n const movement = prevEvent ? this._getMovement(event) : { x: 0, y: 0 };\n const scale = prevEvent ? this._getScale(event) : 1;\n const angle = prevEvent\n ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y)\n : 0;\n const deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x;\n const deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y;\n const offsetX = movement.x;\n const offsetY = movement.y;\n const latestInterval = this._latestInterval;\n const timeStamp = Date.now();\n const deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;\n let velocityX = prevEvent ? prevEvent.velocityX : 0;\n let velocityY = prevEvent ? prevEvent.velocityY : 0;\n if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {\n if (latestInterval) {\n [velocityX, velocityY] = [\n (deltaX - latestInterval.deltaX) / deltaTime,\n (deltaY - latestInterval.deltaY) / deltaTime,\n ];\n }\n this._latestInterval = {\n timestamp: timeStamp,\n deltaX,\n deltaY,\n };\n }\n return {\n srcEvent: event,\n scale,\n angle,\n center,\n deltaX,\n deltaY,\n offsetX,\n offsetY,\n velocityX,\n velocityY,\n preventSystemEvent: true,\n };\n }\n\n protected _getDistance(\n start: Touch | PointerEvent,\n end: Touch | PointerEvent\n ): number {\n const x = end.clientX - start.clientX;\n const y = end.clientY - start.clientY;\n return Math.sqrt(x * x + y * y);\n }\n\n protected _getButton(event: InputEventType): string {\n const buttonCodeMap = { 1: MOUSE_LEFT, 2: MOUSE_RIGHT, 4: MOUSE_MIDDLE };\n const button = this._isTouchEvent(event)\n ? MOUSE_LEFT\n : buttonCodeMap[event.buttons];\n return button ? button : null;\n }\n\n protected _isTouchEvent(event: InputEventType): event is TouchEvent {\n return event.type.indexOf(\"touch\") > -1;\n }\n\n protected _isValidButton(button: string, inputButton: string[]): boolean {\n return inputButton.indexOf(button) > -1;\n }\n\n protected _preventMouseButton(event: InputEventType, button: string): void {\n if (button === MOUSE_RIGHT) {\n window.addEventListener(\"contextmenu\", this._stopContextMenu);\n } else if (button === MOUSE_MIDDLE) {\n event.preventDefault();\n }\n }\n\n private _stopContextMenu = (event: InputEventType) => {\n event.preventDefault();\n window.removeEventListener(\"contextmenu\", this._stopContextMenu);\n };\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class MouseEventInput extends EventInput {\n public readonly start = [\"mousedown\"];\n public readonly move = [\"mousemove\"];\n public readonly end = [\"mouseup\"];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(): void {\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n return;\n }\n\n public getTouches(): number {\n return 0;\n }\n\n protected _getScale(): number {\n return 1;\n }\n\n protected _getCenter(event: MouseEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as MouseEvent;\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchEventInput extends EventInput {\n public readonly start = [\"touchstart\"];\n public readonly move = [\"touchmove\"];\n public readonly end = [\"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(event: InputEventType): ExtendedEvent {\n this._baseTouches = (event as TouchEvent).touches;\n return this.extendEvent(event);\n }\n\n public onEventMove(event: InputEventType): ExtendedEvent {\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._baseTouches = (event as TouchEvent).touches;\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return (event as TouchEvent).touches.length;\n }\n\n protected _getScale(event: TouchEvent): number {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n\n protected _getCenter(event: TouchEvent): { x: number; y: number } {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n\n protected _getMovement(event: TouchEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as TouchEvent;\n if (event.touches[0].identifier !== prev.touches[0].identifier) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.touches[0].clientX - prev.touches[0].clientX,\n y: event.touches[0].clientY - prev.touches[0].clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput, SUPPORT_POINTER } from \"./EventInput\";\n\nexport class PointerEventInput extends EventInput {\n public readonly start = SUPPORT_POINTER ? [\"pointerdown\"] : [\"MSPointerDown\"];\n public readonly move = SUPPORT_POINTER ? [\"pointermove\"] : [\"MSPointerMove\"];\n public readonly end = SUPPORT_POINTER\n ? [\"pointerup\", \"pointercancel\"]\n : [\"MSPointerUp\", \"MSPointerCancel\"];\n\n // store first, recent inputs for each event id\n private _firstInputs: PointerEvent[] = [];\n private _recentInputs: PointerEvent[] = [];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._removePointerEvent(event as PointerEvent);\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._firstInputs = [];\n this._recentInputs = [];\n return;\n }\n\n public getTouches(): number {\n return this._recentInputs.length;\n }\n\n protected _getScale(): number {\n if (this._recentInputs.length !== 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(this._recentInputs[0], this._recentInputs[1]) /\n this._getDistance(this._firstInputs[0], this._firstInputs[1])\n );\n }\n\n protected _getCenter(event: PointerEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: PointerEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as PointerEvent;\n if (event.pointerId !== prev.pointerId) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n\n private _updatePointerEvent(event: PointerEvent) {\n let addFlag = false;\n this._recentInputs.forEach((e, i) => {\n if (e.pointerId === event.pointerId) {\n addFlag = true;\n this._recentInputs[i] = event;\n }\n });\n if (!addFlag) {\n this._firstInputs.push(event);\n this._recentInputs.push(event);\n }\n }\n\n private _removePointerEvent(event?: PointerEvent) {\n this._firstInputs = this._firstInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n this._recentInputs = this._recentInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchMouseEventInput extends EventInput {\n public readonly start = [\"mousedown\", \"touchstart\"];\n public readonly move = [\"mousemove\", \"touchmove\"];\n public readonly end = [\"mouseup\", \"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return this._isTouchEvent(event) ? event.touches.length : 0;\n }\n\n protected _getScale(event: MouseEvent | TouchEvent): number {\n if (this._isTouchEvent(event)) {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return 1; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n return this.prevEvent.scale;\n }\n\n protected _getCenter(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n if (this._isTouchEvent(event)) {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n const prev = this.prevEvent.srcEvent;\n const [nextSpot, prevSpot] = [event, prev].map((e) => {\n if (this._isTouchEvent(e)) {\n return {\n id: e.touches[0].identifier,\n x: e.touches[0].clientX,\n y: e.touches[0].clientY,\n };\n }\n return {\n id: null,\n x: e.clientX,\n y: e.clientY,\n };\n });\n return nextSpot.id === prevSpot.id\n ? { x: nextSpot.x - prevSpot.x, y: nextSpot.y - prevSpot.y }\n : { x: 0, y: 0 };\n }\n}\n","import { InterruptManager } from \"./InterruptManager\";\nimport { InputType, InputTypeObserver, toAxis } from \"./inputType/InputType\";\nimport { EventManager, ChangeEventOption } from \"./EventManager\";\nimport { AxisManager, Axis } from \"./AxisManager\";\nimport { AxesOption } from \"./Axes\";\nimport {\n isOutside,\n getInsidePosition,\n getCirculatedPos,\n isEndofBounce,\n} from \"./Coordinate\";\nimport { map, equal } from \"./utils\";\nimport { AnimationParam } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport class InputObserver implements InputTypeObserver {\n public options: AxesOption;\n private _interruptManager: InterruptManager;\n private _eventManager: EventManager;\n private _axisManager: AxisManager;\n private _animationManager: AnimationManager;\n private _isOutside = false;\n private _moveDistance: Axis = null;\n private _isStopped = false;\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n animationManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n animationManager: AnimationManager;\n }) {\n this.options = options;\n this._interruptManager = interruptManager;\n this._eventManager = eventManager;\n this._axisManager = axisManager;\n this._animationManager = animationManager;\n }\n\n public get(input: InputType): Axis {\n return this._axisManager.get(input.axes);\n }\n\n public hold(input: InputType, event) {\n if (this._interruptManager.isInterrupted() || !input.axes.length) {\n return;\n }\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n this._isStopped = false;\n this._interruptManager.setInterrupt(true);\n this._animationManager.stopAnimation(changeOption);\n if (!this._moveDistance) {\n this._eventManager.hold(this._axisManager.get(), changeOption);\n }\n this._isOutside = this._axisManager.isOutside(input.axes);\n this._moveDistance = this._axisManager.get(input.axes);\n }\n\n public change(input: InputType, event, offset: Axis, useAnimation?: boolean) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n this._axisManager.every(offset, (v) => v === 0)\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyChanged) {\n return;\n }\n let depaPos: Axis = this._moveDistance || this._axisManager.get(input.axes);\n let destPos: Axis;\n\n // for outside logic\n destPos = map(depaPos, (v, k) => v + (offset[k] || 0));\n if (this._moveDistance) {\n this._moveDistance = this._axisManager.map(\n destPos,\n (v, { circular, range }) =>\n circular && (circular[0] || circular[1])\n ? getCirculatedPos(v, range, circular as boolean[])\n : v\n );\n }\n // from outside to inside\n if (\n this._isOutside &&\n this._axisManager.every(depaPos, (v, opt) => !isOutside(v, opt.range))\n ) {\n this._isOutside = false;\n }\n depaPos = this._atOutside(depaPos);\n destPos = this._atOutside(destPos);\n\n if (!this.options.nested || !this._isEndofAxis(offset, depaPos, destPos)) {\n nativeEvent.__childrenAxesAlreadyChanged = true;\n }\n\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (useAnimation) {\n const duration = this._animationManager.getDuration(destPos, depaPos);\n this._animationManager.animateTo(destPos, duration, changeOption);\n } else {\n const isCanceled = !this._eventManager.triggerChange(\n destPos,\n depaPos,\n changeOption,\n true\n );\n if (isCanceled) {\n this._isStopped = true;\n this._moveDistance = null;\n this._animationManager.finish(false);\n }\n }\n }\n\n public release(\n input: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n ) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n !this._moveDistance\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyReleased) {\n velocity = velocity.map(() => 0);\n }\n const pos: Axis = this._axisManager.get(input.axes);\n const depaPos: Axis = this._axisManager.get();\n const displacement = this._animationManager.getDisplacement(velocity);\n const offset = toAxis(input.axes, displacement);\n let destPos: Axis = this._axisManager.get(\n this._axisManager.map(offset, (v, opt, k) => {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(\n pos[k] + v,\n opt.range,\n opt.circular as boolean[],\n opt.bounce as number[]\n );\n }\n })\n );\n nativeEvent.__childrenAxesAlreadyReleased = true;\n const duration = this._animationManager.getDuration(\n destPos,\n pos,\n inputDuration\n );\n\n if (duration === 0) {\n destPos = { ...depaPos };\n }\n // prepare params\n const param: AnimationParam = {\n depaPos,\n destPos,\n duration,\n delta: this._axisManager.getDelta(depaPos, destPos),\n inputEvent: event,\n input,\n isTrusted: true,\n };\n this._eventManager.triggerRelease(param);\n this._moveDistance = null;\n\n // to contol\n const userWish = this._animationManager.getUserControl(param);\n const isEqual = equal(userWish.destPos, depaPos);\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (isEqual || userWish.duration === 0) {\n if (!isEqual) {\n this._eventManager.triggerChange(\n userWish.destPos,\n depaPos,\n changeOption,\n true\n );\n }\n this._interruptManager.setInterrupt(false);\n if (this._axisManager.isOutside()) {\n this._animationManager.restore(changeOption);\n } else {\n this._eventManager.triggerFinish(true);\n }\n } else {\n this._animationManager.animateTo(\n userWish.destPos,\n userWish.duration,\n changeOption\n );\n }\n }\n\n // when move pointer is held in outside\n private _atOutside(pos: Axis) {\n if (this._isOutside) {\n return this._axisManager.map(pos, (v, opt) => {\n const tn = opt.range[0] - (opt.bounce[0] as number);\n const tx = opt.range[1] + (opt.bounce[1] as number);\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n return this._axisManager.map(pos, (v, opt) => {\n const min = opt.range[0];\n const max = opt.range[1];\n const out = opt.bounce;\n const circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return (\n min - this._animationManager.interpolate(min - v, out[0] as number)\n );\n } else if (v > max) {\n // right\n return (\n max + this._animationManager.interpolate(v - max, out[1] as number)\n );\n }\n return v;\n });\n }\n }\n\n private _isEndofAxis(offset: Axis, depaPos: Axis, destPos: Axis) {\n return this._axisManager.every(\n depaPos,\n (value, option, key) =>\n offset[key] === 0 ||\n (depaPos[key] === destPos[key] &&\n isEndofBounce(\n value,\n option.range,\n option.bounce as number[],\n option.circular as boolean[]\n ))\n );\n }\n}\n","import { AxesOption } from \"../Axes\";\nimport { Axis } from \"../AxisManager\";\nimport { getCirculatedPos } from \"../Coordinate\";\nimport { AnimationParam, UpdateAnimationOption } from \"../types\";\nimport { map } from \"../utils\";\n\nimport { AnimationManager, AnimationState } from \"./AnimationManager\";\n\nexport class EasingManager extends AnimationManager {\n protected _useDuration = true;\n protected _options: AxesOption;\n private _durationOffset: number;\n private _initialEasingPer: number;\n private _prevEasingPer: number;\n\n public interpolate(displacement: number, threshold: number): number {\n const initSlope = this._easing(0.00001) / 0.00001;\n return this._easing(displacement / (threshold * initSlope)) * threshold;\n }\n\n public updateAnimation(options: UpdateAnimationOption): void {\n const animateParam = this._animateParam;\n if (!animateParam) {\n return;\n }\n\n const diffTime = new Date().getTime() - animateParam.startTime;\n const pos = options?.destPos || animateParam.destPos;\n const duration = options?.duration || animateParam.duration;\n if (options?.restart || duration <= diffTime) {\n this.setTo(pos, duration - diffTime);\n return;\n }\n if (options?.destPos) {\n const currentPos = this.axisManager.get();\n // When destination is changed, new delta should be calculated as remaining percent.\n // For example, moving x:0, y:0 to x:200, y:200 and it has current easing percent of 92%. coordinate is x:184 and y:184\n // If destination changes to x:300, y:300. xdelta:200, ydelta:200 changes to xdelta:116, ydelta:116 and use remaining easingPer as 100%, not 8% as previous.\n // Therefore, original easingPer by time is kept. And divided by (1 - self._initialEasingPer) which means new total easing percent. Like calculating 8% as 100%.\n this._initialEasingPer = this._prevEasingPer;\n animateParam.delta = this.axisManager.getDelta(currentPos, pos);\n animateParam.destPos = pos;\n }\n if (options?.duration) {\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n // Use durationOffset for keeping animation ratio after duration is changed.\n // newRatio = (diffTime + newDurationOffset) / newDuration = oldRatio\n // newDurationOffset = oldRatio * newDuration - diffTime\n this._durationOffset = ratio * duration - diffTime;\n animateParam.duration = duration;\n }\n }\n\n protected _initState(info: AnimationParam): AnimationState {\n this._initialEasingPer = 0;\n this._prevEasingPer = 0;\n this._durationOffset = 0;\n return {\n pos: info.depaPos,\n easingPer: 0,\n finished: false,\n };\n }\n\n protected _getNextState(prevState: AnimationState): AnimationState {\n const animateParam = this._animateParam;\n const prevPos = prevState.pos;\n const destPos = animateParam.destPos;\n const directions = map(prevPos, (value, key) => {\n return value <= destPos[key] ? 1 : -1;\n });\n const diffTime = new Date().getTime() - animateParam.startTime;\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n const easingPer = this._easing(ratio);\n\n const toPos: Axis = this.axisManager.map(prevPos, (pos, options, key) => {\n const nextPos =\n ratio >= 1\n ? destPos[key]\n : pos +\n (animateParam.delta[key] * (easingPer - this._prevEasingPer)) /\n (1 - this._initialEasingPer);\n\n // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n const circulatedPos = getCirculatedPos(\n nextPos,\n options.range,\n options.circular as boolean[]\n );\n if (nextPos !== circulatedPos) {\n // circular\n const rangeOffset =\n directions[key] * (options.range[1] - options.range[0]);\n\n destPos[key] -= rangeOffset;\n prevPos[key] -= rangeOffset;\n }\n return circulatedPos;\n });\n this._prevEasingPer = easingPer;\n return {\n pos: toPos,\n easingPer,\n finished: easingPer >= 1,\n };\n }\n\n private _easing(p: number): number {\n return p > 1 ? 1 : this._options.easing(p);\n }\n}\n","import Component from \"@egjs/component\";\n\nimport { EventManager } from \"./EventManager\";\nimport { InterruptManager } from \"./InterruptManager\";\nimport { AxisManager, AxisOption, Axis } from \"./AxisManager\";\nimport { InputObserver } from \"./InputObserver\";\nimport {\n TRANSFORM,\n DIRECTION_NONE,\n DIRECTION_LEFT,\n DIRECTION_RIGHT,\n DIRECTION_UP,\n DIRECTION_DOWN,\n DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL,\n DIRECTION_ALL,\n} from \"./const\";\nimport { InputType } from \"./inputType/InputType\";\nimport { AxesEvents, ObjectInterface, UpdateAnimationOption } from \"./types\";\nimport { EasingManager } from \"./animation/EasingManager\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface AxesOption {\n easing?: (x: number) => number;\n maximumDuration?: number;\n minimumDuration?: number;\n deceleration?: number;\n interruptable?: boolean;\n round?: number;\n nested?: boolean;\n}\n\n/**\n * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system.\n * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {Number[]} [range] The coordinate of range 좌표 범위\n * @param {Number} [range[0]=0] The coordinate of the minimum 최소 좌표\n * @param {Number} [range[1]=0] The coordinate of the maximum 최대 좌표\n * @param {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바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @param {Number} [bounce[0]=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @param {Number} [bounce[1]=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @param {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.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @param {Boolean} [circular[0]=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @param {Boolean} [circular[1]=false] Indicates whether to circulate to the coordinate of the maximum 최대 좌표 방향의 순환 여부\n **/\n\n/**\n * @typedef {Object} AxesOption The option object of the eg.Axes module\n * @ko eg.Axes 모듈의 옵션 객체\n * @param {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @param {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @param {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @param {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @param {Boolean} [interruptable=true] Indicates whether an animation is interruptible.\n * - true: It can be paused or stopped by user action or the API.\n * - false: It cannot be paused or stopped by user action or the API while it is running.\n * 진행 중인 애니메이션 중지 가능 여부.\n * - true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다.\n * - false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다\n * @param {Number} [round=null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)\n * [Details](https://github.com/naver/egjs-axes/wiki/round-option)반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95).\n * [상세내용](https://github.com/naver/egjs-axes/wiki/round-option)\n * @param {Boolean} [nested=false] Whether the event propagates to other instances when the coordinates reach the end of the movable area 좌표가 이동 가능한 영역의 끝까지 도달했을 때 다른 인스턴스들로의 이벤트 전파 여부\n **/\n\n/**\n * 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.\n * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다.\n * @extends eg.Component\n *\n * @param {Object.} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {AxesOption} [options={}] The option object of the eg.Axes moduleeg.Axes 모듈의 옵션 객체\n * @param {Object.} [startPos=null] The coordinates to be moved when creating an instance. not triggering change event.인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음.\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n * ```js\n * // 1. Initialize eg.Axes\n * const axes = new eg.Axes({\n *\tsomething1: {\n *\t\trange: [0, 150],\n *\t\tbounce: 50\n *\t},\n *\tsomething2: {\n *\t\trange: [0, 200],\n *\t\tbounce: 100\n *\t},\n *\tsomethingN: {\n *\t\trange: [1, 10],\n *\t}\n * }, {\n * deceleration : 0.0024\n * });\n *\n * // 2. attach event handler\n * axes.on({\n *\t\"hold\" : function(evt) {\n *\t},\n *\t\"release\" : function(evt) {\n *\t},\n *\t\"animationStart\" : function(evt) {\n *\t},\n *\t\"animationEnd\" : function(evt) {\n *\t},\n *\t\"change\" : function(evt) {\n *\t}\n * });\n *\n * // 3. Initialize inputTypes\n * const panInputArea = new eg.Axes.PanInput(\"#area\", {\n *\tscale: [0.5, 1]\n * });\n * const panInputHmove = new eg.Axes.PanInput(\"#hmove\");\n * const panInputVmove = new eg.Axes.PanInput(\"#vmove\");\n * const pinchInputArea = new eg.Axes.PinchInput(\"#area\", {\n *\tscale: 1.5\n * });\n *\n * // 4. Connect eg.Axes and InputTypes\n * // [PanInput] When the mouse or touchscreen is down and moved.\n * // Connect the 'something2' axis to the mouse or touchscreen x position and\n * // connect the 'somethingN' axis to the mouse or touchscreen y position.\n * axes.connect([\"something2\", \"somethingN\"], panInputArea); // or axes.connect(\"something2 somethingN\", panInputArea);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position.\n * axes.connect([\"something1\"], panInputHmove); // or axes.connect(\"something1\", panInputHmove);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position.\n * axes.connect([\"\", \"something2\"], panInputVmove); // or axes.connect(\" something2\", panInputVmove);\n *\n * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something2\", pinchInputArea);\n * ```\n */\nclass Axes extends Component {\n /**\n * @name VERSION\n * @desc Version info string\n * @ko 버전정보 문자열\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.VERSION; // ex) 3.3.3\n * ```\n */\n public static VERSION = \"#__VERSION__#\";\n /* eslint-disable */\n // for tree shaking\n public static PanInput;\n public static PinchInput;\n public static WheelInput;\n public static MoveKeyInput;\n public static RotatePanInput;\n /* eslint-enable */\n\n /**\n * @name TRANSFORM\n * @desc Returns the transform attribute with CSS vendor prefixes.\n * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다.\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n * ```\n */\n public static TRANSFORM = TRANSFORM;\n /**\n * @name DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n public static DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name DIRECTION_UP\n * @constant\n * @type {Number}\n */\n public static DIRECTION_UP = DIRECTION_UP;\n /**\n * @name DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n public static DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_ALL = DIRECTION_ALL;\n\n public options: AxesOption;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n public interruptManager: InterruptManager;\n public animationManager: AnimationManager;\n public inputObserver: InputObserver;\n private _inputs: InputType[] = [];\n\n /**\n *\n */\n public constructor(\n public axis: ObjectInterface = {},\n options: AxesOption = {},\n startPos: Axis = null\n ) {\n super();\n this.options = {\n ...{\n easing: (x) => {\n return 1 - Math.pow(1 - x, 3);\n },\n interruptable: true,\n maximumDuration: Infinity,\n minimumDuration: 0,\n deceleration: 0.0006,\n round: null,\n nested: false,\n },\n ...options,\n };\n\n this.interruptManager = new InterruptManager(this.options);\n this.axisManager = new AxisManager(this.axis);\n this.eventManager = new EventManager(this);\n this.animationManager = new EasingManager(this);\n this.inputObserver = new InputObserver(this);\n this.eventManager.setAnimationManager(this.animationManager);\n if (startPos) {\n this.eventManager.triggerChange(startPos);\n }\n }\n\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @param {(String[]|String)} axes The name of the axis to associate with inputType inputType과 연결할 축의 이름\n * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes eg.Axes의 축과 연결할 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * axes.connect(\"x\", new eg.Axes.PanInput(\"#area1\"))\n * .connect(\"x xOther\", new eg.Axes.PanInput(\"#area2\"))\n * .connect(\" xOther\", new eg.Axes.PanInput(\"#area3\"))\n * .connect([\"x\"], new eg.Axes.PanInput(\"#area4\"))\n * .connect([\"xOther\", \"x\"], new eg.Axes.PanInput(\"#area5\"))\n * .connect([\"\", \"xOther\"], new eg.Axes.PanInput(\"#area6\"));\n * ```\n */\n public connect(axes: string[] | string, inputType: InputType) {\n let mapped: string[];\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n }\n\n // check same instance\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.inputObserver);\n this._inputs.push(inputType);\n return this;\n }\n\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * const input1 = new eg.Axes.PanInput(\"#area1\");\n * const input2 = new eg.Axes.PanInput(\"#area2\");\n * const input3 = new eg.Axes.PanInput(\"#area3\");\n *\n * axes.connect(\"x\", input1);\n * .connect(\"x xOther\", input2)\n * .connect([\"xOther\", \"x\"], input3);\n *\n * axes.disconnect(input1); // disconnects input1\n * axes.disconnect(); // disconnects all of them\n * ```\n */\n public disconnect(inputType?: InputType) {\n if (inputType) {\n const index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach((v) => v.disconnect());\n this._inputs = [];\n }\n return this;\n }\n\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.get(); // {\"x\": 0, \"xOther\": -100, \"zoom\": 50}\n * axes.get([\"x\", \"zoom\"]); // {\"x\": 0, \"zoom\": 50}\n * ```\n */\n public get(axes?: string[]) {\n return this.axisManager.get(axes);\n }\n\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setTo({\"x\": 30, \"zoom\": 60});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setTo({\"x\": 100, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": 60, \"zoom\": 60}\n * ```\n */\n public setTo(pos: Axis, duration = 0) {\n this.animationManager.setTo(pos, duration);\n return this;\n }\n\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setBy({\"x\": 30, \"zoom\": 10});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setBy({\"x\": 70, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": -40, \"zoom\": 60}\n * ```\n */\n public setBy(pos: Axis, duration = 0) {\n this.animationManager.setBy(pos, duration);\n return this;\n }\n\n /**\n * Stop an animation in progress.\n * @ko 재생 중인 애니메이션을 정지한다.\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * });\n *\n * axes.setTo({\"x\": 10}, 1000); // start animatation\n *\n * // after 500 ms\n * axes.stopAnimation(); // stop animation during movement.\n * ```\n */\n public stopAnimation() {\n this.animationManager.stopAnimation();\n return this;\n }\n\n /**\n * Change the destination of an animation in progress.\n * @ko 재생 중인 애니메이션의 목적지와 진행 시간을 변경한다.\n * @param {UpdateAnimationOption} pos The coordinate to move to 이동할 좌표\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 200]\n * },\n * \"y\": {\n * range: [0, 200]\n * }\n * });\n *\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 500 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}}); // animation will end after 500 ms, at {\"x\": 100, \"y\": 100}\n *\n * // after 500 ms\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 700 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}, duration: 1500, restart: true}); // this works same as axes.setTo({\"x\": 100, \"y\": 100}, 800) since restart is true.\n * ```\n */\n public updateAnimation(options: UpdateAnimationOption) {\n this.animationManager.updateAnimation(options);\n return this;\n }\n\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.isBounceArea([\"x\"]);\n * axes.isBounceArea([\"x\", \"zoom\"]);\n * axes.isBounceArea();\n * ```\n */\n public isBounceArea(axes?: string[]) {\n return this.axisManager.isOutside(axes);\n }\n\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n */\n public destroy() {\n this.disconnect();\n this.eventManager.destroy();\n }\n}\n\nexport default Axes;\n","import { ExtendedEvent } from \"../types\";\nimport Axes from \"../Axes\";\nimport { getAngle } from \"../utils\";\n\nimport { toAxis } from \"./InputType\";\nimport { PanInput, PanInputOption } from \"./PanInput\";\n\n/**\n * A module that passes the angle moved by touch to Axes and uses one axis of rotation.\n * [Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.\n * [상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\n * ```js\n * const input = new eg.Axes.RotatePanInput(\"#area\");\n *\n * var axes = new eg.Axes({\n *\t// property name('angle') could be anything you want (eg. x, y, z...)\n * \tangle: {\n * \t\trange: [-180, 180] // from -180deg to 180deg\n * \t}\n * });\n *\n * axes.connect(\"angle\", input)\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n * @extends PanInput\n */\nexport class RotatePanInput extends PanInput {\n private _rotateOrigin: number[];\n private _prevAngle: number;\n private _prevQuadrant: number = null;\n private _lastDiff = 0;\n private _coefficientForDistanceToAngle: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n super(el, options);\n }\n\n public mapAxes(axes: string[]) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n }\n\n protected _onPanstart(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n const rect = this.element.getBoundingClientRect();\n\n this._observer.hold(this, panEvent);\n this._attachWindowEvent(activeEvent);\n // TODO: how to do if element is ellipse not circle.\n this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360\n // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin\n this._rotateOrigin = [\n rect.left + (rect.width - 1) / 2,\n rect.top + (rect.height - 1) / 2,\n ];\n\n // init angle.\n this._prevAngle = null;\n\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanmove(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this.isEnabled()) {\n return;\n }\n const prevEvent = activeEvent.prevEvent;\n this._triggerChange(prevEvent);\n const vx = prevEvent.velocityX;\n const vy = prevEvent.velocityY;\n const velocity =\n Math.sqrt(vx * vx + vy * vy) * (this._lastDiff > 0 ? -1 : 1); // clockwise\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [\n velocity * this._coefficientForDistanceToAngle,\n ]);\n this._detachWindowEvent(activeEvent);\n }\n\n private _triggerChange(event: ExtendedEvent) {\n const { x, y } = this._getPosFromOrigin(event.center.x, event.center.y);\n const angle = getAngle(x, y);\n const positiveAngle = angle < 0 ? 360 + angle : angle;\n const quadrant = this._getQuadrant(event.center.x, event.center.y);\n const diff = this._getDifference(\n this._prevAngle,\n positiveAngle,\n this._prevQuadrant,\n quadrant\n );\n\n this._prevAngle = positiveAngle;\n this._prevQuadrant = quadrant;\n\n if (diff === 0) {\n return;\n }\n\n this._lastDiff = diff;\n this._observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise\n }\n\n private _getDifference(\n prevAngle: number,\n angle: number,\n prevQuadrant: number,\n quadrant: number\n ) {\n let diff: number;\n\n if (prevAngle === null) {\n diff = 0;\n } else if (prevQuadrant === 1 && quadrant === 4) {\n diff = -prevAngle - (360 - angle);\n } else if (prevQuadrant === 4 && quadrant === 1) {\n diff = 360 - prevAngle + angle;\n } else {\n diff = angle - prevAngle;\n }\n\n return diff;\n }\n\n private _getPosFromOrigin(posX: number, posY: number) {\n return {\n x: posX - this._rotateOrigin[0],\n y: this._rotateOrigin[1] - posY,\n };\n }\n\n private _getQuadrant(posX: number, posY: number) {\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n const { x, y } = this._getPosFromOrigin(posX, posY);\n let q = 0;\n\n if (x >= 0 && y >= 0) {\n q = 1;\n } else if (x < 0 && y >= 0) {\n q = 2;\n } else if (x < 0 && y < 0) {\n q = 3;\n } else if (x >= 0 && y < 0) {\n q = 4;\n }\n return q;\n }\n}\n","import { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport { ActiveEvent, InputEventType } from \"../types\";\nimport { DIRECTION_ALL } from \"../const\";\n\nimport {\n toAxis,\n convertInputType,\n InputType,\n InputTypeObserver,\n} from \"./InputType\";\n\nexport interface PinchInputOption {\n scale?: number;\n threshold?: number;\n inputType?: string[];\n touchAction?: string;\n}\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @param {String[]} [inputType=[\"touch\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - pointer: 마우스 및 터치\n * @param {String} [touchAction=\"none\"] Value that overrides the element's \"touch-action\" css property. It is set to \"none\" to prevent scrolling during touch. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 터치 도중 스크롤을 방지하기 위해 \"none\" 으로 설정되어 있다.\n **/\n\n/**\n * 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.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\n * ```js\n * const pinch = new eg.Axes.PinchInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something\", pinch);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module eg.Axes.PinchInput 모듈을 사용할 엘리먼트\n * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput moduleeg.Axes.PinchInput 모듈의 옵션 객체\n */\nexport class PinchInput implements InputType {\n public options: PinchInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _pinchFlag = false;\n private _enabled = false;\n private _originalCssProps: { [key: string]: string };\n private _activeEvent: ActiveEvent = null;\n private _baseValue: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PinchInputOption) {\n this.element = $(el);\n this.options = {\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n touchAction: \"none\",\n ...options,\n };\n this._onPinchStart = this._onPinchStart.bind(this);\n this._onPinchMove = this._onPinchMove.bind(this);\n this._onPinchEnd = this._onPinchEnd.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachEvent();\n }\n this._attachEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n DIRECTION_ALL\n );\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onPinchStart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventStart(event);\n if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) {\n return;\n }\n\n this._baseValue = this._observer.get(this)[this.axes[0]];\n this._observer.hold(this, event);\n this._pinchFlag = true;\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchMove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventMove(event);\n if (\n !pinchEvent ||\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) !== 2\n ) {\n return;\n }\n\n const offset = this._getOffset(\n pinchEvent.scale,\n activeEvent.prevEvent.scale\n );\n this._observer.change(this, event, toAxis(this.axes, [offset]));\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchEnd(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) >= 2\n ) {\n return;\n }\n\n activeEvent.onRelease();\n this._observer.release(this, event, [0], 0);\n this._baseValue = null;\n this._pinchFlag = false;\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element.addEventListener(event, this._onPinchStart, false);\n });\n activeEvent.move.forEach((event) => {\n this.element.addEventListener(event, this._onPinchMove, false);\n });\n activeEvent.end.forEach((event) => {\n this.element.addEventListener(event, this._onPinchEnd, false);\n });\n }\n\n private _detachEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchStart, false);\n });\n activeEvent?.move.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchMove, false);\n });\n activeEvent?.end.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchEnd, false);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _getOffset(pinchScale: number, prev: number = 1): number {\n return this._baseValue * (pinchScale - prev) * this.options.scale;\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport interface WheelInputOption {\n scale?: number;\n releaseDelay?: number;\n useNormalized?: boolean;\n useAnimation?: boolean;\n}\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [releaseDelay=300] Millisecond that trigger release event after last input마지막 입력 이후 release 이벤트가 트리거되기까지의 밀리초\n * @param {Boolean} [useNormalized=true] Whether to calculate scroll speed the same in all browsers모든 브라우저에서 스크롤 속도를 동일하게 처리할지 여부\n * @param {Boolean} [useAnimation=false] Whether to process coordinate changes through the mouse wheel as a continuous animation마우스 휠을 통한 좌표 변화를 연속적인 애니메이션으로 처리할지 여부\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis.\n * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const wheel = new eg.Axes.WheelInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when the mousewheel is moved.\n * axes.connect(\"something\", wheel);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module eg.Axes.WheelInput 모듈을 사용할 엘리먼트\n * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput moduleeg.Axes.WheelInput 모듈의 옵션 객체\n */\nexport class WheelInput implements InputType {\n public options: WheelInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: WheelInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: 1,\n releaseDelay: 300,\n useNormalized: true,\n useAnimation: false,\n },\n ...options,\n };\n this._onWheel = this._onWheel.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onWheel(event: WheelEvent) {\n if (!this._enabled) {\n return;\n }\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n const offset =\n (event.deltaY > 0 ? -1 : 1) *\n this.options.scale *\n (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this._observer.change(\n this,\n event,\n toAxis(this.axes, [offset]),\n this.options.useAnimation\n );\n clearTimeout(this._timer);\n\n this._timer = setTimeout(() => {\n if (this._holding) {\n this._holding = false;\n this._observer.release(this, event, [0]);\n }\n }, this.options.releaseDelay);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"wheel\", this._onWheel);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"wheel\", this._onWheel);\n this._enabled = false;\n this._observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport const KEY_LEFT_ARROW = 37;\nexport const KEY_A = 65;\nexport const KEY_UP_ARROW = 38;\nexport const KEY_W = 87;\nexport const KEY_RIGHT_ARROW = 39;\nexport const KEY_D = 68;\nexport const KEY_DOWN_ARROW = 40;\nexport const KEY_S = 83;\n\n/* eslint-disable */\nconst DIRECTION_REVERSE = -1;\nconst DIRECTION_FORWARD = 1;\nconst DIRECTION_HORIZONTAL = -1;\nconst DIRECTION_VERTICAL = 1;\nconst DELAY = 80;\n/* eslint-enable */\n\nexport interface MoveKeyInputOption {\n scale?: number[];\n}\n\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @param {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @param {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis.\n * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const moveKey = new eg.Axes.MoveKeyInput(\"#area\", {\n * \t\tscale: [1, 1]\n * });\n *\n * // Connect 'x', 'y' axes when the moveKey is pressed.\n * axes.connect([\"x\", \"y\"], moveKey);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트\n * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput moduleeg.Axes.MoveKeyInput 모듈의 옵션 객체\n */\nexport class MoveKeyInput implements InputType {\n public options: MoveKeyInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: MoveKeyInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: [1, 1],\n },\n ...options,\n };\n this._onKeydown = this._onKeydown.bind(this);\n this._onKeyup = this._onKeyup.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n\n // add tabindex=\"0\" to the container for making it focusable\n if (this.element.getAttribute(\"tabindex\") !== \"0\") {\n this.element.setAttribute(\"tabindex\", \"0\");\n }\n\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onKeydown(event: KeyboardEvent) {\n if (!this._enabled) {\n return;\n }\n\n let isMoveKey = true;\n let direction = DIRECTION_FORWARD;\n let move = DIRECTION_HORIZONTAL;\n\n switch (event.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL;\n break;\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL;\n break;\n default:\n isMoveKey = false;\n }\n if (\n (move === DIRECTION_HORIZONTAL && !this.axes[0]) ||\n (move === DIRECTION_VERTICAL && !this.axes[1])\n ) {\n isMoveKey = false;\n }\n if (!isMoveKey) {\n return;\n }\n event.preventDefault();\n const offsets =\n move === DIRECTION_HORIZONTAL\n ? [+this.options.scale[0] * direction, 0]\n : [0, +this.options.scale[1] * direction];\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n clearTimeout(this._timer);\n this._observer.change(this, event, toAxis(this.axes, offsets));\n }\n\n private _onKeyup(event: KeyboardEvent) {\n if (!this._holding) {\n return;\n }\n clearTimeout(this._timer);\n this._timer = setTimeout(() => {\n this._observer.release(this, event, [0, 0]);\n this._holding = false;\n }, DELAY);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"keydown\", this._onKeydown, false);\n this.element.addEventListener(\"keypress\", this._onKeydown, false);\n this.element.addEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"keydown\", this._onKeydown, false);\n this.element.removeEventListener(\"keypress\", this._onKeydown, false);\n this.element.removeEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = false;\n this._observer = null;\n }\n}\n","import Axes from \"./Axes\";\nimport { PanInput } from \"./inputType/PanInput\";\nimport { RotatePanInput } from \"./inputType/RotatePanInput\";\nimport { PinchInput } from \"./inputType/PinchInput\";\nimport { WheelInput } from \"./inputType/WheelInput\";\nimport { MoveKeyInput } from \"./inputType/MoveKeyInput\";\n\nAxes.PanInput = PanInput;\nAxes.RotatePanInput = RotatePanInput;\nAxes.PinchInput = PinchInput;\nAxes.WheelInput = WheelInput;\nAxes.MoveKeyInput = MoveKeyInput;\n\nexport default Axes;\n"],"names":["toArray","nodes","el","i","len","length","push","keyInfo_1","oldraf_1","win","window","navigator","userAgent","DIRECTION_VERTICAL","MOUSE_LEFT","MOUSE_RIGHT","MOUSE_MIDDLE","IS_IOS_SAFARI","getAgent","browser","name","TRANSFORM","document","bodyStyle","head","getElementsByTagName","style","target","PREVENT_DRAG_CSSPROPS","$","param","multi","dummy","match","createElement","innerHTML","childNodes","querySelectorAll","undefined","nodeName","nodeType","jQuery","constructor","prototype","jquery","get","Array","isArray","map","v","raf","requestAnimationFrame","webkitRequestAnimationFrame","caf","cancelAnimationFrame","webkitCancelAnimationFrame","callback","key","timestamp","setTimeout","performance","now","Date","getTime","clearTimeout","obj","tranformed","k","filter","filtered","every","equal","base","roundNumber","num","roundUnit","roundNumFunc","getRoundFunc","roundNumbers","value","getDecimalPlace","val","isFinite","indexOf","p","e","Math","round","getAngle","posX","posY","atan2","PI","isCssPropsFromAxes","originalCssProps","same","Object","keys","forEach","prop","setCssProps","element","option","direction","touchAction","newCssProps_1","touchActionMap","_a","oldCssProps","revertCssProps","getInsidePosition","destPos","range","circular","bounce","toDestPos","targetRange","max","min","isOutside","pos","isCircularable","getCirculatedPos","toPos","toAxis","source","offset","reduce","acc","convertInputType","inputType","hasTouch","hasMouse","hasPointer","SUPPORT_TOUCH","SUPPORT_POINTER_EVENTS","PointerEventInput","TouchMouseEventInput","TouchEventInput","MouseEventInput","clamp","useDirection","checkType","userDirection","pow","n","_axes","roundPos","this","_getRoundPos","trigger","ComponentEvent","input","inputEvent","event","isTrusted","depaPos","roundDepa","setTo","_createUserControll","duration","__assign","bounceRatio","_getBounceRatio","holding","animationManager","axisManager","eventInfo","getEventInfo","moveTo","delta","set","isCanceled","off","userControl","userDuration","options","opt","_options","interruptable","_prevented","prevented","_axis","_complementOptions","_pos","_this","fullDepaPos","axes","axisOptions","axis","axisOption","test","SUPPORT_POINTER","SUPPORT_MSPOINTER","preventDefault","removeEventListener","_stopContextMenu","prevEvent","center","_getCenter","movement","_getMovement","x","y","scale","_getScale","angle","deltaX","deltaY","offsetX","offsetY","latestInterval","_latestInterval","timeStamp","deltaTime","velocityX","velocityY","srcEvent","preventSystemEvent","start","end","clientX","clientY","sqrt","buttonCodeMap","button","_isTouchEvent","buttons","type","inputButton","addEventListener","__extends","_getButton","_isValidButton","_preventMouseButton","extendEvent","prev","EventInput","_baseTouches","touches","_getDistance","identifier","_updatePointerEvent","_removePointerEvent","_firstInputs","_recentInputs","pointerId","addFlag","id","nextSpot","prevSpot","interruptManager","eventManager","_interruptManager","_eventManager","_axisManager","_animationManager","changeOption","isInterrupted","_isStopped","setInterrupt","stopAnimation","_moveDistance","hold","_isOutside","useAnimation","nativeEvent","isInterrupting","__childrenAxesAlreadyChanged","_atOutside","nested","_isEndofAxis","getDuration","animateTo","triggerChange","finish","velocity","inputDuration","displacement","userWish","isEqual","__childrenAxesAlreadyReleased","getDisplacement","getDelta","triggerRelease","getUserControl","restore","triggerFinish","tn","tx","out","interpolate","threshold","initSlope","_easing","diffTime","currentPos","ratio","animateParam","_animateParam","startTime","restart","_initialEasingPer","_prevEasingPer","_durationOffset","info","easingPer","finished","prevState","prevPos","directions","rangeOffset","nextPos","circulatedPos","easing","animationEnd","bind","wishDuration","durations_1","distance","abs","deceleration","Infinity","minimumDuration","maximumDuration","totalVelocity","total","orgPos_1","_raf","triggerAnimationEnd","beforeParam","circularTargets","_createAnimationParam","retTrigger","triggerAnimationStart","console","warn","_animateLoop","orgPos","movedPos","done","complete","originalIntendedPos_1","state_1","loop_1","_initState","nextState","_getNextState","_getFinalPos","originalIntendedPos","_getRoundUnit","minRoundUnit","getAxisOptions","startPos","_super","InterruptManager","AxisManager","EventManager","EasingManager","inputObserver","InputObserver","setAnimationManager","mapped","split","concat","_inputs","disconnect","mapAxes","connect","index","splice","setBy","updateAnimation","destroy","Axes","Component","activeEvent","_activeEvent","onRelease","_observer","release","_detachWindowEvent","thresholdAngle","iOSEdgeSwipeThreshold","releaseOnScroll","_onPanstart","_onPanmove","_onPanend","useHorizontal","useVertical","_direction","observer","_detachElementEvent","_attachElementEvent","_originalCssProps","_enabled","edgeThreshold","panEvent","onEventStart","getTouches","cancelable","_atRightEdge","innerWidth","_attachWindowEvent","onEventMove","toAngle","getDirectionByAngle","_forceRelease","_rightEdgeTimer","_getOffset","prevent","some","stopPropagation","change","onEventEnd","move","passive","properties","_voidFunction","DIRECTION_ALL","rect","isEnabled","getBoundingClientRect","_coefficientForDistanceToAngle","width","_rotateOrigin","left","top","height","_prevAngle","_triggerChange","vx","vy","_lastDiff","_getPosFromOrigin","positiveAngle","quadrant","_getQuadrant","diff","_getDifference","_prevQuadrant","prevAngle","prevQuadrant","q","PanInput","_onPinchStart","_onPinchMove","_onPinchEnd","_detachEvent","_attachEvent","pinchEvent","_baseValue","_pinchFlag","pinchScale","releaseDelay","useNormalized","_onWheel","_holding","_timer","_onKeydown","_onKeyup","getAttribute","setAttribute","offsets","isMoveKey","keyCode","RotatePanInput","PinchInput","WheelInput","MoveKeyInput"],"mappings":";;;;;;;;umBAcuB,SAAVA,EAAWC,WAGhBC,EAAK,GACFC,EAAI,EAAGC,EAAMH,EAAMI,OAAQF,EAAIC,EAAKD,IAC3CD,EAAGI,KAAKL,EAAME,WAETD,MAiDDK,EACAC,iNCjENC,EAFoB,oBAAXC,OAEH,CACJC,UAAW,CACTC,UAAW,KAITF,OCNKG,EAAqB,GAGrBC,EAAa,OACbC,EAAc,QACdC,EAAe,SASfC,EACX,iBAAkBP,GAAsC,WAA5BQ,IAAWC,QAAQC,KAEpCC,EAAa,cACA,oBAAbC,eACF,WAEHC,GAAaD,SAASE,MAAQF,SAASG,qBAAqB,QAAQ,IACvEC,MACGC,EAAS,CACb,YACA,kBACA,cACA,gBAEOxB,EAAI,EAAGC,EAAMuB,EAAOtB,OAAQF,EAAIC,EAAKD,OACxCwB,EAAOxB,KAAMoB,SACRI,EAAOxB,SAGX,GAjBiB,GAoBbyB,EAAwB,eACpB,2BACM,QFrBVC,EAAI,SAACC,EAAOC,OAWbC,EAGN9B,sBAdmB6B,MAGF,iBAAVD,GAWP5B,EARY4B,EAAMG,MAAM,2BAKlBD,EAAQV,SAASY,cAAc,QAE/BC,UAAYL,EACb9B,EAAQgC,EAAMI,aAGdpC,EAAQsB,SAASe,iBAAiBP,IAEpCC,IACH7B,EAAkB,GAAbA,EAAGG,OAAcH,EAAG,QAAKoC,IAEvBR,IAAUpB,KAGVoB,EAAMS,UAAgC,IAAnBT,EAAMU,UAAqC,IAAnBV,EAAMU,UAIzD,WAAY9B,GAAUoB,aAAiBW,QACxCX,EAAMY,YAAYC,UAAUC,OAG5B1C,EAAK6B,EAAQD,EAAM9B,UAAY8B,EAAMe,IAAI,GAChCC,MAAMC,QAAQjB,KACvB5B,EAAK4B,EAAMkB,IAAI,SAACC,UAAMpB,EAAEoB,KACnBl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iBrT,cACVN,KAAKqT,WAGVzY,aAAaoF,KAAKsT,aACbA,OAAS/Y,WAAW,WACvB8H,EAAKkM,UAAUC,QAAQnM,EAAM/B,EAAO,CAAC,EAAG,IACxC+B,EAAKgR,UAAW,GA7KR,qBAiLZ,SAAqBlE,QACdZ,UAAYY,OACZlS,QAAQiI,iBAAiB,UAAWlF,KAAKuT,YAAY,QACrDtW,QAAQiI,iBAAiB,WAAYlF,KAAKuT,YAAY,QACtDtW,QAAQiI,iBAAiB,QAASlF,KAAKwT,UAAU,QACjDjE,UAAW,kBAGlB,gBACOtS,QAAQ8F,oBAAoB,UAAW/C,KAAKuT,YAAY,QACxDtW,QAAQ8F,oBAAoB,WAAY/C,KAAKuT,YAAY,QACzDtW,QAAQ8F,oBAAoB,QAAS/C,KAAKwT,UAAU,QACpDjE,UAAW,OACXhB,UAAY,kBCzMrBL,GAAKsE,SAAWA,GAChBtE,GAAK4F,eAAiBA,GACtB5F,GAAK6F,WAAaA,GAClB7F,GAAK8F,WAAaA,GAClB9F,GAAK+F,aAAeA"} \ No newline at end of file diff --git a/dist/axes.pkgd.js b/dist/axes.pkgd.js new file mode 100644 index 00000000..3b8ee9db --- /dev/null +++ b/dist/axes.pkgd.js @@ -0,0 +1,4701 @@ +/* +Copyright (c) 2015 NAVER Corp. +name: @egjs/axes +license: MIT +author: NAVER Corp. +repository: https://github.com/naver/egjs-axes +version: 3.3.0 +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.eg = global.eg || {}, global.eg.Axes = factory()); +}(this, (function () { 'use strict'; + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + + /* global Reflect, Promise */ + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || { + __proto__: [] + } instanceof Array && function (d, b) { + d.__proto__ = b; + } || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + }; + + return extendStatics(d, b); + }; + + function __extends(d, b) { + extendStatics(d, b); + + function __() { + this.constructor = d; + } + + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + var __assign = function () { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + + return t; + }; + + return __assign.apply(this, arguments); + }; + + /* + Copyright (c) NAVER Corp. + name: @egjs/component + license: MIT + author: NAVER Corp. + repository: https://github.com/naver/egjs-component + version: 3.0.2 + */ + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + function __values$1(o) { + var s = typeof Symbol === "function" && Symbol.iterator, + m = s && o[s], + i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { + value: o && o[i++], + done: !o + }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + } + function __read$1(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), + r, + ar = [], + e; + + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { + e = { + error: error + }; + } finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } finally { + if (e) throw e.error; + } + } + + return ar; + } + function __spread$1() { + for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read$1(arguments[i])); + + return ar; + } + + /* + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + var isUndefined = function (value) { + return typeof value === "undefined"; + }; + + /** + * Event class to provide additional properties + * @ko Component에서 추가적인 프로퍼티를 제공하는 이벤트 클래스 + */ + + var ComponentEvent = + /*#__PURE__*/ + function () { + /** + * Create a new instance of ComponentEvent. + * @ko ComponentEvent의 새로운 인스턴스를 생성한다. + * @param eventType The name of the event.이벤트 이름. + * @param props An object that contains additional event properties.추가적인 이벤트 프로퍼티 오브젝트. + */ + function ComponentEvent(eventType, props) { + var e_1, _a; + + this._canceled = false; + + if (props) { + try { + for (var _b = __values$1(Object.keys(props)), _c = _b.next(); !_c.done; _c = _b.next()) { + var key = _c.value; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + + this[key] = props[key]; + } + } catch (e_1_1) { + e_1 = { + error: e_1_1 + }; + } finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } finally { + if (e_1) throw e_1.error; + } + } + } + + this.eventType = eventType; + } + /** + * Stop the event. {@link ComponentEvent#isCanceled} will return `true` after. + * @ko 이벤트를 중단한다. 이후 {@link ComponentEvent#isCanceled}가 `true`를 반환한다. + */ + + + var __proto = ComponentEvent.prototype; + + __proto.stop = function () { + this._canceled = true; + }; + /** + * Returns a boolean value that indicates whether {@link ComponentEvent#stop} is called before. + * @ko {@link ComponentEvent#stop}이 호출되었는지 여부를 반환한다. + * @return {boolean} A boolean value that indicates whether {@link ComponentEvent#stop} is called before.이전에 {@link ComponentEvent#stop}이 불려졌는지 여부를 반환한다. + */ + + + __proto.isCanceled = function () { + return this._canceled; + }; + + return ComponentEvent; + }(); + + /** + * A class used to manage events in a component + * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스 + */ + + var Component = + /*#__PURE__*/ + function () { + /** + * @support {"ie": "7+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.1+ (except 3.x)"} + */ + function Component() { + this._eventHandler = {}; + } + /** + * Trigger a custom event. + * @ko 커스텀 이벤트를 발생시킨다 + * @param {string | ComponentEvent} event The name of the custom event to be triggered or an instance of the ComponentEvent발생할 커스텀 이벤트의 이름 또는 ComponentEvent의 인스턴스 + * @param {any[]} params Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터 + * @return An instance of the component itself컴포넌트 자신의 인스턴스 + * @example + * ```ts + * import Component, { ComponentEvent } from "@egjs/component"; + * + * class Some extends Component<{ + * beforeHi: ComponentEvent<{ foo: number; bar: string }>; + * hi: { foo: { a: number; b: boolean } }; + * someEvent: (foo: number, bar: string) => void; + * someOtherEvent: void; // When there's no event argument + * }> { + * some(){ + * if(this.trigger("beforeHi")){ // When event call to stop return false. + * this.trigger("hi");// fire hi event. + * } + * } + * } + * + * const some = new Some(); + * some.on("beforeHi", e => { + * if(condition){ + * e.stop(); // When event call to stop, `hi` event not call. + * } + * // `currentTarget` is component instance. + * console.log(some === e.currentTarget); // true + * + * typeof e.foo; // number + * typeof e.bar; // string + * }); + * some.on("hi", e => { + * typeof e.foo.b; // boolean + * }); + * // If you want to more know event design. You can see article. + * // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F + * ``` + */ + + + var __proto = Component.prototype; + + __proto.trigger = function (event) { + var params = []; + + for (var _i = 1; _i < arguments.length; _i++) { + params[_i - 1] = arguments[_i]; + } + + var eventName = event instanceof ComponentEvent ? event.eventType : event; + + var handlers = __spread$1(this._eventHandler[eventName] || []); + + if (handlers.length <= 0) { + return this; + } + + if (event instanceof ComponentEvent) { + event.currentTarget = this; + handlers.forEach(function (handler) { + handler(event); + }); + } else { + handlers.forEach(function (handler) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + handler.apply(void 0, __spread$1(params)); + }); + } + + return this; + }; + /** + * Executed event just one time. + * @ko 이벤트가 한번만 실행된다. + * @param {string} eventName The name of the event to be attached or an event name - event handler mapped object.등록할 이벤트의 이름 또는 이벤트 이름-핸들러 오브젝트 + * @param {function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수 + * @return An instance of the component itself컴포넌트 자신의 인스턴스 + * @example + * ```ts + * import Component, { ComponentEvent } from "@egjs/component"; + * + * class Some extends Component<{ + * hi: ComponentEvent; + * }> { + * hi() { + * alert("hi"); + * } + * thing() { + * this.once("hi", this.hi); + * } + * } + * + * var some = new Some(); + * some.thing(); + * some.trigger(new ComponentEvent("hi")); + * // fire alert("hi"); + * some.trigger(new ComponentEvent("hi")); + * // Nothing happens + * ``` + */ + + + __proto.once = function (eventName, handlerToAttach) { + var _this = this; + + if (typeof eventName === "object" && isUndefined(handlerToAttach)) { + var eventHash = eventName; + + for (var key in eventHash) { + this.once(key, eventHash[key]); + } + + return this; + } else if (typeof eventName === "string" && typeof handlerToAttach === "function") { + var listener_1 = function () { + var args = []; + + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } // eslint-disable-next-line @typescript-eslint/no-unsafe-call + + + handlerToAttach.apply(void 0, __spread$1(args)); + + _this.off(eventName, listener_1); + }; + + this.on(eventName, listener_1); + } + + return this; + }; + /** + * Checks whether an event has been attached to a component. + * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다. + * @param {string} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름 + * @return {boolean} Indicates whether the event is attached. 이벤트 등록 여부 + * @example + * ```ts + * import Component from "@egjs/component"; + * + * class Some extends Component<{ + * hi: void; + * }> { + * some() { + * this.hasOn("hi");// check hi event. + * } + * } + * ``` + */ + + + __proto.hasOn = function (eventName) { + return !!this._eventHandler[eventName]; + }; + /** + * Attaches an event to a component. + * @ko 컴포넌트에 이벤트를 등록한다. + * @param {string} eventName The name of the event to be attached or an event name - event handler mapped object.등록할 이벤트의 이름 또는 이벤트 이름-핸들러 오브젝트 + * @param {function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수 + * @return An instance of a component itself컴포넌트 자신의 인스턴스 + * @example + * ```ts + * import Component, { ComponentEvent } from "@egjs/component"; + * + * class Some extends Component<{ + * hi: void; + * }> { + * hi() { + * console.log("hi"); + * } + * some() { + * this.on("hi",this.hi); //attach event + * } + * } + * ``` + */ + + + __proto.on = function (eventName, handlerToAttach) { + if (typeof eventName === "object" && isUndefined(handlerToAttach)) { + var eventHash = eventName; + + for (var name in eventHash) { + this.on(name, eventHash[name]); + } + + return this; + } else if (typeof eventName === "string" && typeof handlerToAttach === "function") { + var handlerList = this._eventHandler[eventName]; + + if (isUndefined(handlerList)) { + this._eventHandler[eventName] = []; + handlerList = this._eventHandler[eventName]; + } + + handlerList.push(handlerToAttach); + } + + return this; + }; + /** + * Detaches an event from the component.
If the `eventName` is not given this will detach all event handlers attached.
If the `handlerToDetach` is not given, this will detach all event handlers for `eventName`. + * @ko 컴포넌트에 등록된 이벤트를 해제한다.
`eventName`이 주어지지 않았을 경우 모든 이벤트 핸들러를 제거한다.
`handlerToAttach`가 주어지지 않았을 경우 `eventName`에 해당하는 모든 이벤트 핸들러를 제거한다. + * @param {string?} eventName The name of the event to be detached 해제할 이벤트의 이름 + * @param {function?} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수 + * @return An instance of a component itself 컴포넌트 자신의 인스턴스 + * @example + * ```ts + * import Component, { ComponentEvent } from "@egjs/component"; + * + * class Some extends Component<{ + * hi: void; + * }> { + * hi() { + * console.log("hi"); + * } + * some() { + * this.off("hi",this.hi); //detach event + * } + * } + * ``` + */ + + + __proto.off = function (eventName, handlerToDetach) { + var e_1, _a; // Detach all event handlers. + + + if (isUndefined(eventName)) { + this._eventHandler = {}; + return this; + } // Detach all handlers for eventname or detach event handlers by object. + + + if (isUndefined(handlerToDetach)) { + if (typeof eventName === "string") { + delete this._eventHandler[eventName]; + return this; + } else { + var eventHash = eventName; + + for (var name in eventHash) { + this.off(name, eventHash[name]); + } + + return this; + } + } // Detach single event handler + + + var handlerList = this._eventHandler[eventName]; + + if (handlerList) { + var idx = 0; + + try { + for (var handlerList_1 = __values$1(handlerList), handlerList_1_1 = handlerList_1.next(); !handlerList_1_1.done; handlerList_1_1 = handlerList_1.next()) { + var handlerFunction = handlerList_1_1.value; + + if (handlerFunction === handlerToDetach) { + handlerList.splice(idx, 1); + + if (handlerList.length <= 0) { + delete this._eventHandler[eventName]; + } + + break; + } + + idx++; + } + } catch (e_1_1) { + e_1 = { + error: e_1_1 + }; + } finally { + try { + if (handlerList_1_1 && !handlerList_1_1.done && (_a = handlerList_1.return)) _a.call(handlerList_1); + } finally { + if (e_1) throw e_1.error; + } + } + } + + return this; + }; + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @example + * Component.VERSION; // ex) 3.0.0 + * @memberof Component + */ + + + Component.VERSION = "3.0.2"; + return Component; + }(); + + /* + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + + var ComponentEvent$1 = ComponentEvent; + + /* eslint-disable no-new-func, no-nested-ternary */ + var win; + + if (typeof window === "undefined") { + // window is undefined in node.js + win = { + navigator: { + userAgent: "" + } + }; + } else { + win = window; + } + + /* + Copyright (c) 2015 NAVER Corp. + name: @egjs/agent + license: MIT + author: NAVER Corp. + repository: git+https://github.com/naver/agent.git + version: 2.2.1 + */ + function some(arr, callback) { + var length = arr.length; + + for (var i = 0; i < length; ++i) { + if (callback(arr[i], i)) { + return true; + } + } + + return false; + } + function find(arr, callback) { + var length = arr.length; + + for (var i = 0; i < length; ++i) { + if (callback(arr[i], i)) { + return arr[i]; + } + } + + return null; + } + function getUserAgent(agent) { + var userAgent = agent; + + if (typeof userAgent === "undefined") { + if (typeof navigator === "undefined" || !navigator) { + return ""; + } + + userAgent = navigator.userAgent || ""; + } + + return userAgent.toLowerCase(); + } + function execRegExp(pattern, text) { + try { + return new RegExp(pattern, "g").exec(text); + } catch (e) { + return null; + } + } + function hasUserAgentData() { + if (typeof navigator === "undefined" || !navigator || !navigator.userAgentData) { + return false; + } + + var userAgentData = navigator.userAgentData; + var brands = userAgentData.brands || userAgentData.uaList; + return !!(brands && brands.length); + } + function findVersion(versionTest, userAgent) { + var result = execRegExp("(" + versionTest + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", userAgent); + return result ? result[3] : ""; + } + function convertVersion(text) { + return text.replace(/_/g, "."); + } + function findPreset(presets, userAgent) { + var userPreset = null; + var version = "-1"; + some(presets, function (preset) { + var result = execRegExp("(" + preset.test + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", userAgent); + + if (!result || preset.brand) { + return false; + } + + userPreset = preset; + version = result[3] || "-1"; + + if (preset.versionAlias) { + version = preset.versionAlias; + } else if (preset.versionTest) { + version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version; + } + + version = convertVersion(version); + return true; + }); + return { + preset: userPreset, + version: version + }; + } + function findBrand(brands, preset) { + return find(brands, function (_a) { + var brand = _a.brand; + return execRegExp("" + preset.test, brand.toLowerCase()); + }); + } + + var BROWSER_PRESETS = [{ + test: "phantomjs", + id: "phantomjs" + }, { + test: "whale", + id: "whale" + }, { + test: "edgios|edge|edg", + id: "edge" + }, { + test: "msie|trident|windows phone", + id: "ie", + versionTest: "iemobile|msie|rv" + }, { + test: "miuibrowser", + id: "miui browser" + }, { + test: "samsungbrowser", + id: "samsung internet" + }, { + test: "samsung", + id: "samsung internet", + versionTest: "version" + }, { + test: "chrome|crios", + id: "chrome" + }, { + test: "firefox|fxios", + id: "firefox" + }, { + test: "android", + id: "android browser", + versionTest: "version" + }, { + test: "safari|iphone|ipad|ipod", + id: "safari", + versionTest: "version" + }]; // chromium's engine(blink) is based on applewebkit 537.36. + + var CHROMIUM_PRESETS = [{ + test: "(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)", + id: "chrome" + }, { + test: "chromium", + id: "chrome" + }, { + test: "whale", + id: "chrome", + brand: true + }]; + var WEBKIT_PRESETS = [{ + test: "applewebkit", + id: "webkit" + }]; + var WEBVIEW_PRESETS = [{ + test: "(?=(iphone|ipad))(?!(.*version))", + id: "webview" + }, { + test: "(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))", + id: "webview" + }, { + // test webview + test: "webview", + id: "webview" + }]; + var OS_PRESETS = [{ + test: "windows phone", + id: "windows phone" + }, { + test: "windows 2000", + id: "window", + versionAlias: "5.0" + }, { + test: "windows nt", + id: "window" + }, { + test: "iphone|ipad|ipod", + id: "ios", + versionTest: "iphone os|cpu os" + }, { + test: "mac os x", + id: "mac" + }, { + test: "android", + id: "android" + }, { + test: "tizen", + id: "tizen" + }, { + test: "webos|web0s", + id: "webos" + }]; + + function parseUserAgentData(osData) { + var userAgentData = navigator.userAgentData; + var brands = (userAgentData.uaList || userAgentData.brands).slice(); + var isMobile = userAgentData.mobile || false; + var firstBrand = brands[0]; + var browser = { + name: firstBrand.brand, + version: firstBrand.version, + majorVersion: -1, + webkit: false, + webview: some(WEBVIEW_PRESETS, function (preset) { + return findBrand(brands, preset); + }), + chromium: some(CHROMIUM_PRESETS, function (preset) { + return findBrand(brands, preset); + }) + }; + var os = { + name: "unknown", + version: "-1", + majorVersion: -1 + }; + browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) { + return findBrand(brands, preset); + }); + + if (osData) { + var platform_1 = osData.platform.toLowerCase(); + var result = find(OS_PRESETS, function (preset) { + return new RegExp("" + preset.test, "g").exec(platform_1); + }); + os.name = result ? result.id : platform_1; + os.version = osData.platformVersion; + } + + some(BROWSER_PRESETS, function (preset) { + var result = findBrand(brands, preset); + + if (!result) { + return false; + } + + browser.name = preset.id; + browser.version = osData ? osData.uaFullVersion : result.version; + return true; + }); + + if (navigator.platform === "Linux armv8l") { + os.name = "android"; + } else if (browser.webkit) { + os.name = isMobile ? "ios" : "mac"; + } + + if (os.name === "ios" && browser.webview) { + browser.version = "-1"; + } + + os.version = convertVersion(os.version); + browser.version = convertVersion(browser.version); + os.majorVersion = parseInt(os.version, 10); + browser.majorVersion = parseInt(browser.version, 10); + return { + browser: browser, + os: os, + isMobile: isMobile, + isHints: true + }; + } + + function parseUserAgent(userAgent) { + var nextAgent = getUserAgent(userAgent); + var isMobile = !!/mobi/g.exec(nextAgent); + var browser = { + name: "unknown", + version: "-1", + majorVersion: -1, + webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset, + chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset, + webkit: false + }; + var os = { + name: "unknown", + version: "-1", + majorVersion: -1 + }; + + var _a = findPreset(BROWSER_PRESETS, nextAgent), + browserPreset = _a.preset, + browserVersion = _a.version; + + var _b = findPreset(OS_PRESETS, nextAgent), + osPreset = _b.preset, + osVersion = _b.version; + + browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset; + + if (osPreset) { + os.name = osPreset.id; + os.version = osVersion; + os.majorVersion = parseInt(osVersion, 10); + } + + if (browserPreset) { + browser.name = browserPreset.id; + browser.version = browserVersion; + + if (browser.webview && os.name === "ios" && browser.name !== "safari") { + browser.webview = false; + } + } + + browser.majorVersion = parseInt(browser.version, 10); + return { + browser: browser, + os: os, + isMobile: isMobile, + isHints: false + }; + } + /** + * Extracts browser and operating system information from the user agent string. + * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다. + * @function eg.agent#agent + * @param - user agent string to parse 파싱할 유저에이전트 문자열 + * @return - agent Info 에이전트 정보 + * @example + import agent from "@egjs/agent"; + // eg.agent(); + const { os, browser, isMobile } = agent(); + */ + + function agent(userAgent) { + if (typeof userAgent === "undefined" && hasUserAgentData()) { + return parseUserAgentData(); + } else { + return parseUserAgent(userAgent); + } + } + + var DIRECTION_NONE = 1; + var DIRECTION_LEFT = 2; + var DIRECTION_RIGHT = 4; + var DIRECTION_HORIZONTAL = 2 | 4; + var DIRECTION_UP = 8; + var DIRECTION_DOWN = 16; + var DIRECTION_VERTICAL = 8 | 16; + var DIRECTION_ALL = 2 | 4 | 8 | 16; + var MOUSE_LEFT = "left"; + var MOUSE_RIGHT = "right"; + var MOUSE_MIDDLE = "middle"; + var VELOCITY_INTERVAL = 16; + var IOS_EDGE_THRESHOLD = 30; + var IS_IOS_SAFARI = "ontouchstart" in win && agent().browser.name === "safari"; + var TRANSFORM = function () { + if (typeof document === "undefined") { + return ""; + } + + var bodyStyle = (document.head || document.getElementsByTagName("head")[0]).style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in bodyStyle) { + return target[i]; + } + } + + return ""; + }(); + var PREVENT_DRAG_CSSPROPS = { + "user-select": "none", + "-webkit-user-drag": "none" + }; + + var toArray = function (nodes) { + // const el = Array.prototype.slice.call(nodes); + // for IE8 + var el = []; + + for (var i = 0, len = nodes.length; i < len; i++) { + el.push(nodes[i]); + } + + return el; + }; + var $ = function (param, multi) { + if (multi === void 0) { + multi = false; + } + + var el; + + if (typeof param === "string") { + // String (HTML, Selector) + // check if string is HTML tag format + var match = param.match(/^<([a-z]+)\s*([^>]*)>/); // creating element + + if (match) { + // HTML + var dummy = document.createElement("div"); + dummy.innerHTML = param; + el = toArray(dummy.childNodes); + } else { + // Selector + el = toArray(document.querySelectorAll(param)); + } + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } else if (param === win) { + // window + el = param; + } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) { + // HTMLElement, Document + el = param; + } else if ("jQuery" in win && param instanceof jQuery || param.constructor.prototype.jquery) { + // jQuery + el = multi ? param.toArray() : param.get(0); + } else if (Array.isArray(param)) { + el = param.map(function (v) { + return $(v); + }); + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } + + return el; + }; + var raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame; + var caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame; + + if (raf && !caf) { + var keyInfo_1 = {}; + var oldraf_1 = raf; + + raf = function (callback) { + var wrapCallback = function (timestamp) { + if (keyInfo_1[key]) { + callback(timestamp); + } + }; + + var key = oldraf_1(wrapCallback); + keyInfo_1[key] = true; + return key; + }; + + caf = function (key) { + delete keyInfo_1[key]; + }; + } else if (!(raf && caf)) { + raf = function (callback) { + return win.setTimeout(function () { + callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime()); + }, 16); + }; + + caf = win.clearTimeout; + } + /** + * A polyfill for the window.requestAnimationFrame() method. + * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame + * @private + */ + + + var requestAnimationFrame = function (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. requestAnimationFrame() 메서드가 반환한 아이디 값 + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame + * @private + */ + + var cancelAnimationFrame = function (key) { + caf(key); + }; + var map = function (obj, callback) { + var tranformed = {}; + + for (var k in obj) { + if (k) { + tranformed[k] = callback(obj[k], k); + } + } + + return tranformed; + }; + var filter = function (obj, callback) { + var filtered = {}; + + for (var k in obj) { + if (k && callback(obj[k], k)) { + filtered[k] = obj[k]; + } + } + + return filtered; + }; + var every = function (obj, callback) { + for (var k in obj) { + if (k && !callback(obj[k], k)) { + return false; + } + } + + return true; + }; + var equal = function (target, base) { + return every(target, function (v, k) { + return v === base[k]; + }); + }; + var roundNumFunc = {}; + var roundNumber = function (num, roundUnit) { + // Cache for performance + if (!roundNumFunc[roundUnit]) { + roundNumFunc[roundUnit] = getRoundFunc(roundUnit); + } + + return roundNumFunc[roundUnit](num); + }; + var roundNumbers = function (num, roundUnit) { + if (!num || !roundUnit) { + return num; + } + + return map(num, function (value, key) { + return roundNumber(value, typeof roundUnit === "number" ? roundUnit : roundUnit[key]); + }); + }; + var getDecimalPlace = function (val) { + if (!isFinite(val)) { + return 0; + } + + var v = "" + val; + + if (v.indexOf("e") >= 0) { + // Exponential Format + // 1e-10, 1e-12 + var p = 0; + var e = 1; + + while (Math.round(val * e) / e !== val) { + e *= 10; + p++; + } + + return p; + } // In general, following has performance benefit. + // https://jsperf.com/precision-calculation + + + return v.indexOf(".") >= 0 ? v.length - v.indexOf(".") - 1 : 0; + }; + var inversePow = function (n) { + // replace Math.pow(10, -n) to solve floating point issue. + // eg. Math.pow(10, -4) => 0.00009999999999999999 + return 1 / Math.pow(10, n); + }; + var getRoundFunc = function (v) { + var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1; + return function (n) { + if (v === 0) { + return 0; + } + + return Math.round(Math.round(n / v) * v * p) / p; + }; + }; + var getAngle = function (posX, posY) { + return Math.atan2(posY, posX) * 180 / Math.PI; + }; + var isCssPropsFromAxes = function (originalCssProps) { + var same = true; + Object.keys(PREVENT_DRAG_CSSPROPS).forEach(function (prop) { + if (!originalCssProps || originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]) { + same = false; + } + }); + return same; + }; + var setCssProps = function (element, option, direction) { + var _a; + + var touchActionMap = (_a = {}, _a[DIRECTION_NONE] = "auto", _a[DIRECTION_ALL] = "none", _a[DIRECTION_VERTICAL] = "pan-x", _a[DIRECTION_HORIZONTAL] = "pan-y", _a); + var oldCssProps = {}; + + if (element && element.style) { + var touchAction = option.touchAction ? option.touchAction : touchActionMap[direction]; + + var newCssProps_1 = __assign(__assign({}, PREVENT_DRAG_CSSPROPS), { + "touch-action": element.style["touch-action"] === "none" ? "none" : touchAction + }); + + Object.keys(newCssProps_1).forEach(function (prop) { + oldCssProps[prop] = element.style[prop]; + element.style[prop] = newCssProps_1[prop]; + }); + } + + return oldCssProps; + }; + var revertCssProps = function (element, originalCssProps) { + if (element && element.style && originalCssProps) { + Object.keys(originalCssProps).forEach(function (prop) { + element.style[prop] = originalCssProps[prop]; + }); + } + + return; + }; + + var EventManager = + /*#__PURE__*/ + function () { + function EventManager(_axes) { + this._axes = _axes; + } + /** + * This event is fired when a user holds an element on the screen of the device. + * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 + * @event Axes#hold + * @type {object} + * @property {Object.} pos coordinate 좌표 정보 + * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스 + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("hold", function(event) { + * // event.pos + * // event.input + * // event.inputEvent + * // isTrusted + * }); + * ``` + */ + + + var __proto = EventManager.prototype; + + __proto.hold = function (pos, option) { + var roundPos = this._getRoundPos(pos).roundPos; + + this._axes.trigger(new ComponentEvent$1("hold", { + pos: roundPos, + input: option.input || null, + inputEvent: option.event || null, + isTrusted: true + })); + }; + /** + * 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일 경우에 동작한다 + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @example + * ```js + * 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' 이벤트 이후 이동할 좌표를 지정한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @example + * ```js + * 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 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 + * @event Axes#release + * @type {object} + * @property {Object.} depaPos The coordinates when releasing an element손을 뗐을 때의 좌표 + * @property {Object.} destPos The coordinates to move to after releasing an element손을 뗀 뒤에 이동할 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Object.} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value 손을 뗐을 때의 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치. + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스 + * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("release", function(event) { + * // event.depaPos + * // event.destPos + * // event.delta + * // event.input + * // event.inputEvent + * // event.setTo + * // event.isTrusted + * + * // if you want to change the animation coordinates to move after the 'release' event. + * event.setTo({x: 10}, 2000); + * }); + * ``` + */ + + + __proto.triggerRelease = function (param) { + var _a = this._getRoundPos(param.destPos, param.depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + param.destPos = roundPos; + param.depaPos = roundDepa; + param.setTo = this._createUserControll(param.destPos, param.duration); + + this._axes.trigger(new ComponentEvent$1("release", __assign(__assign({}, param), { + bounceRatio: this._getBounceRatio(roundPos) + }))); + }; + /** + * This event is fired when coordinate changes. + * @ko 좌표가 변경됐을 때 발생하는 이벤트 + * @event Axes#change + * @type {object} + * @property {Object.} pos The coordinate 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Object.} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value 현재 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치. + * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.사용자가 기기의 화면을 누르고 있는지 여부 + * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true 이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다. + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("change", function(event) { + * // event.pos + * // event.delta + * // event.input + * // event.inputEvent + * // event.holding + * // event.set + * // event.isTrusted + * + * // if you want to change the coordinates to move after the 'change' event. + * // it works when the holding value of the change event is true. + * event.holding && event.set({x: 10}); + * }); + * ``` + */ + + + __proto.triggerChange = function (pos, depaPos, option, holding) { + if (holding === void 0) { + holding = false; + } + + var animationManager = this.animationManager; + var axisManager = animationManager.axisManager; + var eventInfo = animationManager.getEventInfo(); + + var _a = this._getRoundPos(pos, depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + var moveTo = axisManager.moveTo(roundPos, roundDepa); + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || (eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.event) || null; + var param = { + pos: moveTo.pos, + delta: moveTo.delta, + bounceRatio: this._getBounceRatio(moveTo.pos), + holding: holding, + inputEvent: inputEvent, + isTrusted: !!inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || (eventInfo === null || eventInfo === void 0 ? void 0 : eventInfo.input) || null, + set: inputEvent ? this._createUserControll(moveTo.pos) : function () {} + }; + var event = new ComponentEvent$1("change", param); + + this._axes.trigger(event); + + if (inputEvent) { + axisManager.set(param.set().destPos); + } + + return !event.isCanceled(); + }; + /** + * This event is fired when animation starts. + * @ko 에니메이션이 시작할 때 발생한다. + * @event Axes#animationStart + * @type {object} + * @property {Object.} depaPos The coordinates when animation starts애니메이션이 시작 되었을 때의 좌표 + * @property {Object.} destPos The coordinates to move to. If you change this value, you can run the animation이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다. + * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다. + * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체 + * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다 + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("release", function(event) { + * // event.depaPos + * // event.destPos + * // event.delta + * // event.input + * // event.inputEvent + * // event.setTo + * // event.isTrusted + * + * // if you want to change the animation coordinates to move after the 'animationStart' event. + * event.setTo({x: 10}, 2000); + * }); + * ``` + */ + + + __proto.triggerAnimationStart = function (param) { + var _a = this._getRoundPos(param.destPos, param.depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + param.destPos = roundPos; + param.depaPos = roundDepa; + param.setTo = this._createUserControll(param.destPos, param.duration); + var event = new ComponentEvent$1("animationStart", param); + + this._axes.trigger(event); + + return !event.isCanceled(); + }; + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생한다. + * @event Axes#animationEnd + * @type {object} + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("animationEnd", function(event) { + * // event.isTrusted + * }); + * ``` + */ + + + __proto.triggerAnimationEnd = function (isTrusted) { + if (isTrusted === void 0) { + isTrusted = false; + } + + this._axes.trigger(new ComponentEvent$1("animationEnd", { + isTrusted: isTrusted + })); + }; + /** + * This event is fired when all actions have been completed. + * @ko 에니메이션이 끝났을 때 발생한다. + * @event Axes#finish + * @type {object} + * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다. + * + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("finish", function(event) { + * // event.isTrusted + * }); + * ``` + */ + + + __proto.triggerFinish = function (isTrusted) { + if (isTrusted === void 0) { + isTrusted = false; + } + + this._axes.trigger(new ComponentEvent$1("finish", { + isTrusted: isTrusted + })); + }; + + __proto.setAnimationManager = function (animationManager) { + this.animationManager = animationManager; + }; + + __proto.destroy = function () { + this._axes.off(); + }; + + __proto._createUserControll = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } // to controll + + + var userControl = { + destPos: __assign({}, pos), + duration: duration + }; + return function (toPos, userDuration) { + if (toPos) { + userControl.destPos = __assign({}, toPos); + } + + if (userDuration !== undefined) { + userControl.duration = userDuration; + } + + return userControl; + }; + }; + + __proto._getRoundPos = function (pos, depaPos) { + // round value if round exist + var roundUnit = this._axes.options.round; // if (round == null) { + // return {pos, depaPos}; // undefined, undefined + // } + + return { + roundPos: roundNumbers(pos, roundUnit), + roundDepa: roundNumbers(depaPos, roundUnit) + }; + }; + + __proto._getBounceRatio = function (pos) { + return this._axes.axisManager.map(pos, function (v, opt) { + if (v < opt.range[0] && opt.bounce[0] !== 0) { + return (opt.range[0] - v) / opt.bounce[0]; + } else if (v > opt.range[1] && opt.bounce[1] !== 0) { + return (v - opt.range[1]) / opt.bounce[1]; + } else { + return 0; + } + }); + }; + + return EventManager; + }(); + + var InterruptManager = + /*#__PURE__*/ + function () { + function InterruptManager(_options) { + this._options = _options; + this._prevented = false; // check whether the animation event was prevented + } + + var __proto = InterruptManager.prototype; + + __proto.isInterrupting = function () { + // when interruptable is 'true', return value is always 'true'. + return this._options.interruptable || this._prevented; + }; + + __proto.isInterrupted = function () { + return !this._options.interruptable && this._prevented; + }; + + __proto.setInterrupt = function (prevented) { + if (!this._options.interruptable) { + this._prevented = prevented; + } + }; + + return InterruptManager; + }(); + + var getInsidePosition = function (destPos, range, circular, bounce) { + var toDestPos = destPos; + var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]]; + toDestPos = Math.max(targetRange[0], toDestPos); + toDestPos = Math.min(targetRange[1], toDestPos); + return toDestPos; + }; // determine outside + + var isOutside = function (pos, range) { + return pos < range[0] || pos > range[1]; + }; // determine whether position has reached the maximum moveable area + + var isEndofBounce = function (pos, range, bounce, circular) { + return !circular[0] && pos === range[0] - bounce[0] || !circular[1] && pos === range[1] + bounce[1]; + }; + var getDuration = function (distance, deceleration) { + var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero + + return duration < 100 ? 0 : duration; + }; + var isCircularable = function (destPos, range, circular) { + return circular[1] && destPos > range[1] || circular[0] && destPos < range[0]; + }; + var getCirculatedPos = function (pos, range, circular) { + var toPos = pos; + var min = range[0]; + var max = range[1]; + var length = max - min; + + if (circular[1] && pos > max) { + // right + toPos = (toPos - max) % length + min; + } + + if (circular[0] && pos < min) { + // left + toPos = (toPos - min) % length + max; + } + + return toPos; + }; + + var AxisManager = + /*#__PURE__*/ + function () { + function AxisManager(_axis) { + var _this = this; + + this._axis = _axis; + + this._complementOptions(); + + this._pos = Object.keys(this._axis).reduce(function (acc, v) { + acc[v] = _this._axis[v].range[0]; + return acc; + }, {}); + } + + var __proto = AxisManager.prototype; + + __proto.getDelta = function (depaPos, destPos) { + var fullDepaPos = this.get(depaPos); + return map(this.get(destPos), function (v, k) { + return v - fullDepaPos[k]; + }); + }; + + __proto.get = function (axes) { + var _this = this; + + if (axes && Array.isArray(axes)) { + return axes.reduce(function (acc, v) { + if (v && v in _this._pos) { + acc[v] = _this._pos[v]; + } + + return acc; + }, {}); + } else { + return __assign(__assign({}, this._pos), axes || {}); + } + }; + + __proto.moveTo = function (pos, depaPos) { + if (depaPos === void 0) { + depaPos = this._pos; + } + + var delta = map(this._pos, function (v, key) { + return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0; + }); + this.set(this.map(pos, function (v, opt) { + return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0; + })); + return { + pos: __assign({}, this._pos), + delta: delta + }; + }; + + __proto.set = function (pos) { + for (var k in pos) { + if (k && k in this._pos) { + this._pos[k] = pos[k]; + } + } + }; + + __proto.every = function (pos, callback) { + var axisOptions = this._axis; + return every(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.filter = function (pos, callback) { + var axisOptions = this._axis; + return filter(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.map = function (pos, callback) { + var axisOptions = this._axis; + return map(pos, function (value, key) { + return callback(value, axisOptions[key], key); + }); + }; + + __proto.isOutside = function (axes) { + return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) { + return !isOutside(v, opt.range); + }); + }; + + __proto.getAxisOptions = function (key) { + return this._axis[key]; + }; + /** + * set up 'css' expression + * @private + */ + + + __proto._complementOptions = function () { + var _this = this; + + Object.keys(this._axis).forEach(function (axis) { + _this._axis[axis] = __assign({ + range: [0, 100], + bounce: [0, 0], + circular: [false, false] + }, _this._axis[axis]); + ["bounce", "circular"].forEach(function (v) { + var axisOption = _this._axis; + var key = axisOption[axis][v]; + + if (/string|number|boolean/.test(typeof key)) { + axisOption[axis][v] = [key, key]; + } + }); + }); + }; + + return AxisManager; + }(); + + var SUPPORT_TOUCH = ("ontouchstart" in win); + var SUPPORT_POINTER = ("PointerEvent" in win); + var SUPPORT_MSPOINTER = ("MSPointerEvent" in win); + var SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER; + + var EventInput = + /*#__PURE__*/ + function () { + function EventInput() { + var _this = this; + + this._stopContextMenu = function (event) { + event.preventDefault(); + win.removeEventListener("contextmenu", _this._stopContextMenu); + }; + } + + var __proto = EventInput.prototype; + + __proto.extendEvent = function (event) { + var _a; + + var prevEvent = this.prevEvent; + + var center = this._getCenter(event); + + var movement = prevEvent ? this._getMovement(event) : { + x: 0, + y: 0 + }; + var scale = prevEvent ? this._getScale(event) : 1; + var angle = prevEvent ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y) : 0; + var deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x; + var deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y; + var offsetX = movement.x; + var offsetY = movement.y; + var latestInterval = this._latestInterval; + var timeStamp = Date.now(); + var deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0; + var velocityX = prevEvent ? prevEvent.velocityX : 0; + var velocityY = prevEvent ? prevEvent.velocityY : 0; + + if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) { + if (latestInterval) { + _a = [(deltaX - latestInterval.deltaX) / deltaTime, (deltaY - latestInterval.deltaY) / deltaTime], velocityX = _a[0], velocityY = _a[1]; + } + + this._latestInterval = { + timestamp: timeStamp, + deltaX: deltaX, + deltaY: deltaY + }; + } + + return { + srcEvent: event, + scale: scale, + angle: angle, + center: center, + deltaX: deltaX, + deltaY: deltaY, + offsetX: offsetX, + offsetY: offsetY, + velocityX: velocityX, + velocityY: velocityY, + preventSystemEvent: true + }; + }; + + __proto._getDistance = function (start, end) { + var x = end.clientX - start.clientX; + var y = end.clientY - start.clientY; + return Math.sqrt(x * x + y * y); + }; + + __proto._getButton = function (event) { + var buttonCodeMap = { + 1: MOUSE_LEFT, + 2: MOUSE_RIGHT, + 4: MOUSE_MIDDLE + }; + var button = this._isTouchEvent(event) ? MOUSE_LEFT : buttonCodeMap[event.buttons]; + return button ? button : null; + }; + + __proto._isTouchEvent = function (event) { + return event.type.indexOf("touch") > -1; + }; + + __proto._isValidButton = function (button, inputButton) { + return inputButton.indexOf(button) > -1; + }; + + __proto._preventMouseButton = function (event, button) { + if (button === MOUSE_RIGHT) { + win.addEventListener("contextmenu", this._stopContextMenu); + } else if (button === MOUSE_MIDDLE) { + event.preventDefault(); + } + }; + + return EventInput; + }(); + + var MouseEventInput = + /*#__PURE__*/ + function (_super) { + __extends(MouseEventInput, _super); + + function MouseEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["mousedown"]; + _this.move = ["mousemove"]; + _this.end = ["mouseup"]; + return _this; + } + + var __proto = MouseEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function () { + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + return; + }; + + __proto.getTouches = function () { + return 0; + }; + + __proto._getScale = function () { + return 1; + }; + + __proto._getCenter = function (event) { + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + return { + x: event.clientX - prev.clientX, + y: event.clientY - prev.clientY + }; + }; + + return MouseEventInput; + }(EventInput); + + var TouchEventInput = + /*#__PURE__*/ + function (_super) { + __extends(TouchEventInput, _super); + + function TouchEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["touchstart"]; + _this.move = ["touchmove"]; + _this.end = ["touchend", "touchcancel"]; + return _this; + } + + var __proto = TouchEventInput.prototype; + + __proto.onEventStart = function (event) { + this._baseTouches = event.touches; + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event) { + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + this._baseTouches = event.touches; + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._baseTouches = null; + return; + }; + + __proto.getTouches = function (event) { + return event.touches.length; + }; + + __proto._getScale = function (event) { + if (event.touches.length !== 2 || this._baseTouches.length < 2) { + return null; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(event.touches[0], event.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]); + }; + + __proto._getCenter = function (event) { + return { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + + if (event.touches[0].identifier !== prev.touches[0].identifier) { + return { + x: 0, + y: 0 + }; + } + + return { + x: event.touches[0].clientX - prev.touches[0].clientX, + y: event.touches[0].clientY - prev.touches[0].clientY + }; + }; + + return TouchEventInput; + }(EventInput); + + var PointerEventInput = + /*#__PURE__*/ + function (_super) { + __extends(PointerEventInput, _super); + + function PointerEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = SUPPORT_POINTER ? ["pointerdown"] : ["MSPointerDown"]; + _this.move = SUPPORT_POINTER ? ["pointermove"] : ["MSPointerMove"]; + _this.end = SUPPORT_POINTER ? ["pointerup", "pointercancel"] : ["MSPointerUp", "MSPointerCancel"]; // store first, recent inputs for each event id + + _this._firstInputs = []; + _this._recentInputs = []; + return _this; + } + + var __proto = PointerEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + this._updatePointerEvent(event); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + this._updatePointerEvent(event); + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + this._removePointerEvent(event); + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._firstInputs = []; + this._recentInputs = []; + return; + }; + + __proto.getTouches = function () { + return this._recentInputs.length; + }; + + __proto._getScale = function () { + if (this._recentInputs.length !== 2) { + return null; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(this._recentInputs[0], this._recentInputs[1]) / this._getDistance(this._firstInputs[0], this._firstInputs[1]); + }; + + __proto._getCenter = function (event) { + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var prev = this.prevEvent.srcEvent; + + if (event.pointerId !== prev.pointerId) { + return { + x: 0, + y: 0 + }; + } + + return { + x: event.clientX - prev.clientX, + y: event.clientY - prev.clientY + }; + }; + + __proto._updatePointerEvent = function (event) { + var _this = this; + + var addFlag = false; + + this._recentInputs.forEach(function (e, i) { + if (e.pointerId === event.pointerId) { + addFlag = true; + _this._recentInputs[i] = event; + } + }); + + if (!addFlag) { + this._firstInputs.push(event); + + this._recentInputs.push(event); + } + }; + + __proto._removePointerEvent = function (event) { + this._firstInputs = this._firstInputs.filter(function (x) { + return x.pointerId !== event.pointerId; + }); + this._recentInputs = this._recentInputs.filter(function (x) { + return x.pointerId !== event.pointerId; + }); + }; + + return PointerEventInput; + }(EventInput); + + var TouchMouseEventInput = + /*#__PURE__*/ + function (_super) { + __extends(TouchMouseEventInput, _super); + + function TouchMouseEventInput() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this.start = ["mousedown", "touchstart"]; + _this.move = ["mousemove", "touchmove"]; + _this.end = ["mouseup", "touchend", "touchcancel"]; + return _this; + } + + var __proto = TouchMouseEventInput.prototype; + + __proto.onEventStart = function (event, inputButton) { + var button = this._getButton(event); + + if (this._isTouchEvent(event)) { + this._baseTouches = event.touches; + } + + if (inputButton && !this._isValidButton(button, inputButton)) { + return null; + } + + this._preventMouseButton(event, button); + + return this.extendEvent(event); + }; + + __proto.onEventMove = function (event, inputButton) { + if (inputButton && !this._isValidButton(this._getButton(event), inputButton)) { + return null; + } + + return this.extendEvent(event); + }; + + __proto.onEventEnd = function (event) { + if (this._isTouchEvent(event)) { + this._baseTouches = event.touches; + } + + return; + }; + + __proto.onRelease = function () { + this.prevEvent = null; + this._baseTouches = null; + return; + }; + + __proto.getTouches = function (event) { + return this._isTouchEvent(event) ? event.touches.length : 0; + }; + + __proto._getScale = function (event) { + if (this._isTouchEvent(event)) { + if (event.touches.length !== 2 || this._baseTouches.length < 2) { + return 1; // TODO: consider calculating non-pinch gesture scale + } + + return this._getDistance(event.touches[0], event.touches[1]) / this._getDistance(this._baseTouches[0], this._baseTouches[1]); + } + + return this.prevEvent.scale; + }; + + __proto._getCenter = function (event) { + if (this._isTouchEvent(event)) { + return { + x: event.touches[0].clientX, + y: event.touches[0].clientY + }; + } + + return { + x: event.clientX, + y: event.clientY + }; + }; + + __proto._getMovement = function (event) { + var _this = this; + + var prev = this.prevEvent.srcEvent; + + var _a = [event, prev].map(function (e) { + if (_this._isTouchEvent(e)) { + return { + id: e.touches[0].identifier, + x: e.touches[0].clientX, + y: e.touches[0].clientY + }; + } + + return { + id: null, + x: e.clientX, + y: e.clientY + }; + }), + nextSpot = _a[0], + prevSpot = _a[1]; + + return nextSpot.id === prevSpot.id ? { + x: nextSpot.x - prevSpot.x, + y: nextSpot.y - prevSpot.y + } : { + x: 0, + y: 0 + }; + }; + + return TouchMouseEventInput; + }(EventInput); + + var toAxis = function (source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + }; + var convertInputType = function (inputType) { + if (inputType === void 0) { + inputType = []; + } + + var hasTouch = false; + var hasMouse = false; + var hasPointer = false; + inputType.forEach(function (v) { + switch (v) { + case "mouse": + hasMouse = true; + break; + + case "touch": + hasTouch = SUPPORT_TOUCH; + break; + + case "pointer": + hasPointer = SUPPORT_POINTER_EVENTS; + // no default + } + }); + + if (hasPointer) { + return new PointerEventInput(); + } else if (hasTouch && hasMouse) { + return new TouchMouseEventInput(); + } else if (hasTouch) { + return new TouchEventInput(); + } else if (hasMouse) { + return new MouseEventInput(); + } + + return null; + }; + + var InputObserver = + /*#__PURE__*/ + function () { + function InputObserver(_a) { + var options = _a.options, + interruptManager = _a.interruptManager, + eventManager = _a.eventManager, + axisManager = _a.axisManager, + animationManager = _a.animationManager; + this._isOutside = false; + this._moveDistance = null; + this._isStopped = false; + this.options = options; + this._interruptManager = interruptManager; + this._eventManager = eventManager; + this._axisManager = axisManager; + this._animationManager = animationManager; + } + + var __proto = InputObserver.prototype; + + __proto.get = function (input) { + return this._axisManager.get(input.axes); + }; + + __proto.hold = function (input, event) { + if (this._interruptManager.isInterrupted() || !input.axes.length) { + return; + } + + var changeOption = { + input: input, + event: event + }; + this._isStopped = false; + + this._interruptManager.setInterrupt(true); + + this._animationManager.stopAnimation(changeOption); + + if (!this._moveDistance) { + this._eventManager.hold(this._axisManager.get(), changeOption); + } + + this._isOutside = this._axisManager.isOutside(input.axes); + this._moveDistance = this._axisManager.get(input.axes); + }; + + __proto.change = function (input, event, offset, useAnimation) { + if (this._isStopped || !this._interruptManager.isInterrupting() || this._axisManager.every(offset, function (v) { + return v === 0; + })) { + return; + } + + var nativeEvent = event.srcEvent ? event.srcEvent : event; + + if (nativeEvent.__childrenAxesAlreadyChanged) { + return; + } + + var depaPos = this._moveDistance || this._axisManager.get(input.axes); + + var destPos; // for outside logic + + destPos = map(depaPos, function (v, k) { + return v + (offset[k] || 0); + }); + + if (this._moveDistance) { + this._moveDistance = this._axisManager.map(destPos, function (v, _a) { + var circular = _a.circular, + range = _a.range; + return circular && (circular[0] || circular[1]) ? getCirculatedPos(v, range, circular) : v; + }); + } // from outside to inside + + + if (this._isOutside && this._axisManager.every(depaPos, function (v, opt) { + return !isOutside(v, opt.range); + })) { + this._isOutside = false; + } + + depaPos = this._atOutside(depaPos); + destPos = this._atOutside(destPos); + + if (!this.options.nested || !this._isEndofAxis(offset, depaPos, destPos)) { + nativeEvent.__childrenAxesAlreadyChanged = true; + } + + var changeOption = { + input: input, + event: event + }; + + if (useAnimation) { + var duration = this._animationManager.getDuration(destPos, depaPos); + + this._animationManager.animateTo(destPos, duration, changeOption); + } else { + var isCanceled = !this._eventManager.triggerChange(destPos, depaPos, changeOption, true); + + if (isCanceled) { + this._isStopped = true; + this._moveDistance = null; + + this._animationManager.finish(false); + } + } + }; + + __proto.release = function (input, event, velocity, inputDuration) { + if (this._isStopped || !this._interruptManager.isInterrupting() || !this._moveDistance) { + return; + } + + var nativeEvent = event.srcEvent ? event.srcEvent : event; + + if (nativeEvent.__childrenAxesAlreadyReleased) { + velocity = velocity.map(function () { + return 0; + }); + } + + var pos = this._axisManager.get(input.axes); + + var depaPos = this._axisManager.get(); + + var displacement = this._animationManager.getDisplacement(velocity); + + var offset = toAxis(input.axes, displacement); + + var destPos = this._axisManager.get(this._axisManager.map(offset, function (v, opt, k) { + if (opt.circular && (opt.circular[0] || opt.circular[1])) { + return pos[k] + v; + } else { + return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce); + } + })); + + nativeEvent.__childrenAxesAlreadyReleased = true; + + var duration = this._animationManager.getDuration(destPos, pos, inputDuration); + + if (duration === 0) { + destPos = __assign({}, depaPos); + } // prepare params + + + var param = { + depaPos: depaPos, + destPos: destPos, + duration: duration, + delta: this._axisManager.getDelta(depaPos, destPos), + inputEvent: event, + input: input, + isTrusted: true + }; + + this._eventManager.triggerRelease(param); + + this._moveDistance = null; // to contol + + var userWish = this._animationManager.getUserControl(param); + + var isEqual = equal(userWish.destPos, depaPos); + var changeOption = { + input: input, + event: event + }; + + if (isEqual || userWish.duration === 0) { + if (!isEqual) { + this._eventManager.triggerChange(userWish.destPos, depaPos, changeOption, true); + } + + this._interruptManager.setInterrupt(false); + + if (this._axisManager.isOutside()) { + this._animationManager.restore(changeOption); + } else { + this._eventManager.triggerFinish(true); + } + } else { + this._animationManager.animateTo(userWish.destPos, userWish.duration, changeOption); + } + }; // when move pointer is held in outside + + + __proto._atOutside = function (pos) { + var _this = this; + + if (this._isOutside) { + return this._axisManager.map(pos, function (v, opt) { + var tn = opt.range[0] - opt.bounce[0]; + var tx = opt.range[1] + opt.bounce[1]; + return v > tx ? tx : v < tn ? tn : v; + }); + } else { + return this._axisManager.map(pos, function (v, opt) { + var min = opt.range[0]; + var max = opt.range[1]; + var out = opt.bounce; + var circular = opt.circular; + + if (circular && (circular[0] || circular[1])) { + return v; + } else if (v < min) { + // left + return min - _this._animationManager.interpolate(min - v, out[0]); + } else if (v > max) { + // right + return max + _this._animationManager.interpolate(v - max, out[1]); + } + + return v; + }); + } + }; + + __proto._isEndofAxis = function (offset, depaPos, destPos) { + return this._axisManager.every(depaPos, function (value, option, key) { + return offset[key] === 0 || depaPos[key] === destPos[key] && isEndofBounce(value, option.range, option.bounce, option.circular); + }); + }; + + return InputObserver; + }(); + + var clamp = function (value, min, max) { + return Math.max(Math.min(value, max), min); + }; + + var AnimationManager = + /*#__PURE__*/ + function () { + function AnimationManager(_a) { + var options = _a.options, + interruptManager = _a.interruptManager, + eventManager = _a.eventManager, + axisManager = _a.axisManager; + this._options = options; + this.interruptManager = interruptManager; + this.eventManager = eventManager; + this.axisManager = axisManager; + this.animationEnd = this.animationEnd.bind(this); + } + + var __proto = AnimationManager.prototype; + + __proto.getDuration = function (depaPos, destPos, wishDuration) { + var _this = this; + + var duration; + + if (typeof wishDuration !== "undefined") { + duration = wishDuration; + } else { + var durations_1 = map(destPos, function (v, k) { + return getDuration(Math.abs(v - depaPos[k]), _this._options.deceleration); + }); + duration = Object.keys(durations_1).reduce(function (max, v) { + return Math.max(max, durations_1[v]); + }, -Infinity); + } + + return clamp(duration, this._options.minimumDuration, this._options.maximumDuration); + }; + + __proto.getDisplacement = function (velocity) { + var totalVelocity = Math.pow(velocity.reduce(function (total, v) { + return total + v * v; + }, 0), 1 / velocity.length); + var duration = Math.abs(totalVelocity / -this._options.deceleration); + return velocity.map(function (v) { + return v / 2 * duration; + }); + }; + + __proto.stopAnimation = function (option) { + if (this._animateParam) { + var orgPos_1 = this.axisManager.get(); + var pos = this.axisManager.map(orgPos_1, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + }); + + if (!every(pos, function (v, k) { + return orgPos_1[k] === v; + })) { + this.eventManager.triggerChange(pos, orgPos_1, option, !!option); + } + + this._animateParam = null; + + if (this._raf) { + cancelAnimationFrame(this._raf); + } + + this._raf = null; + this.eventManager.triggerAnimationEnd(!!(option === null || option === void 0 ? void 0 : option.event)); + } + }; + + __proto.getEventInfo = function () { + if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) { + return { + input: this._animateParam.input, + event: this._animateParam.inputEvent + }; + } else { + return null; + } + }; + + __proto.restore = function (option) { + var pos = this.axisManager.get(); + var destPos = this.axisManager.map(pos, function (v, opt) { + return Math.min(opt.range[1], Math.max(opt.range[0], v)); + }); + this.stopAnimation(); + this.animateTo(destPos, this.getDuration(pos, destPos), option); + }; + + __proto.animationEnd = function () { + var beforeParam = this.getEventInfo(); + this._animateParam = null; // for Circular + + var circularTargets = this.axisManager.filter(this.axisManager.get(), function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + }); + + if (Object.keys(circularTargets).length > 0) { + this.setTo(this.axisManager.map(circularTargets, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + })); + } + + this.interruptManager.setInterrupt(false); + this.eventManager.triggerAnimationEnd(!!beforeParam); + + if (this.axisManager.isOutside()) { + this.restore(beforeParam); + } else { + this.finish(!!beforeParam); + } + }; + + __proto.finish = function (isTrusted) { + this._animateParam = null; + this.interruptManager.setInterrupt(false); + this.eventManager.triggerFinish(isTrusted); + }; + + __proto.getUserControl = function (param) { + var userWish = param.setTo(); + userWish.destPos = this.axisManager.get(userWish.destPos); + userWish.duration = clamp(userWish.duration, this._options.minimumDuration, this._options.maximumDuration); + return userWish; + }; + + __proto.animateTo = function (destPos, duration, option) { + var _this = this; + + this.stopAnimation(); + + var param = this._createAnimationParam(destPos, duration, option); + + var depaPos = __assign({}, param.depaPos); + + var retTrigger = this.eventManager.triggerAnimationStart(param); // to control + + var userWish = this.getUserControl(param); // You can't stop the 'animationStart' event when 'circular' is true. + + if (!retTrigger && this.axisManager.every(userWish.destPos, function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + })) { + console.warn("You can't stop the 'animation' event when 'circular' is true."); + } + + if (retTrigger && !equal(userWish.destPos, depaPos)) { + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || null; + + this._animateLoop({ + depaPos: depaPos, + destPos: userWish.destPos, + duration: userWish.duration, + delta: this.axisManager.getDelta(depaPos, userWish.destPos), + isTrusted: !!inputEvent, + inputEvent: inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || null + }, function () { + return _this.animationEnd(); + }); + } + }; + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + var axes = Object.keys(pos); + var orgPos = this.axisManager.get(axes); + + if (equal(pos, orgPos)) { + return this; + } + + this.interruptManager.setInterrupt(true); + var movedPos = filter(pos, function (v, k) { + return orgPos[k] !== v; + }); + + if (!Object.keys(movedPos).length) { + return this; + } + + movedPos = this.axisManager.map(movedPos, function (v, opt) { + var range = opt.range, + circular = opt.circular; + + if (circular && (circular[0] || circular[1])) { + return v; + } else { + return getInsidePosition(v, range, circular); + } + }); + + if (equal(movedPos, orgPos)) { + return this; + } + + if (duration > 0) { + this.animateTo(movedPos, duration); + } else { + this.stopAnimation(); + this.eventManager.triggerChange(movedPos); + this.finish(false); + } + + return this; + }; + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + return this.setTo(map(this.axisManager.get(Object.keys(pos)), function (v, k) { + return v + pos[k]; + }), duration); + }; + + __proto._createAnimationParam = function (pos, duration, option) { + var depaPos = this.axisManager.get(); + var destPos = pos; + var inputEvent = (option === null || option === void 0 ? void 0 : option.event) || null; + return { + depaPos: depaPos, + destPos: destPos, + duration: clamp(duration, this._options.minimumDuration, this._options.maximumDuration), + delta: this.axisManager.getDelta(depaPos, destPos), + inputEvent: inputEvent, + input: (option === null || option === void 0 ? void 0 : option.input) || null, + isTrusted: !!inputEvent, + done: this.animationEnd + }; + }; + + __proto._animateLoop = function (param, complete) { + var _this = this; + + if (param.duration) { + this._animateParam = __assign(__assign({}, param), { + startTime: new Date().getTime() + }); + var originalIntendedPos_1 = map(param.destPos, function (v) { + return v; + }); + + var state_1 = this._initState(this._animateParam); + + var loop_1 = function () { + _this._raf = null; + var animateParam = _this._animateParam; + + var nextState = _this._getNextState(state_1); + + var isCanceled = !_this.eventManager.triggerChange(nextState.pos, state_1.pos); + state_1 = nextState; + + if (nextState.finished) { + animateParam.destPos = _this._getFinalPos(animateParam.destPos, originalIntendedPos_1); + + if (!equal(animateParam.destPos, _this.axisManager.get(Object.keys(animateParam.destPos)))) { + _this.eventManager.triggerChange(animateParam.destPos, nextState.pos); + } + + complete(); + return; + } else if (isCanceled) { + _this.finish(false); + } else { + _this._raf = requestAnimationFrame(loop_1); + } + }; + + loop_1(); + } else { + this.eventManager.triggerChange(param.destPos); + complete(); + } + }; + /** + * Get estimated final value. + * + * If destPos is within the 'error range' of the original intended position, the initial intended position is returned. + * - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100; + * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos. + * - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123 + * @param originalIntendedPos + * @param destPos + */ + + + __proto._getFinalPos = function (destPos, originalIntendedPos) { + var _this = this; // compare destPos and originalIntendedPos + // eslint-disable-next-line @typescript-eslint/naming-convention + + + var ERROR_LIMIT = 0.000001; + var finalPos = map(destPos, function (value, key) { + if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) { + // In error range, return original intended + return originalIntendedPos[key]; + } else { + // Out of error range, return rounded pos. + var roundUnit = _this._getRoundUnit(value, key); + + var result = roundNumber(value, roundUnit); + return result; + } + }); + return finalPos; + }; + + __proto._getRoundUnit = function (val, key) { + var roundUnit = this._options.round; // manual mode + + var minRoundUnit = null; // auto mode + // auto mode + + if (!roundUnit) { + // Get minimum round unit + var options = this.axisManager.getAxisOptions(key); + minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val))); + } + + return minRoundUnit || roundUnit; + }; + + return AnimationManager; + }(); + + var EasingManager = + /*#__PURE__*/ + function (_super) { + __extends(EasingManager, _super); + + function EasingManager() { + var _this = _super !== null && _super.apply(this, arguments) || this; + + _this._useDuration = true; + return _this; + } + + var __proto = EasingManager.prototype; + + __proto.interpolate = function (displacement, threshold) { + var initSlope = this._easing(0.00001) / 0.00001; + return this._easing(displacement / (threshold * initSlope)) * threshold; + }; + + __proto.updateAnimation = function (options) { + var animateParam = this._animateParam; + + if (!animateParam) { + return; + } + + var diffTime = new Date().getTime() - animateParam.startTime; + var pos = (options === null || options === void 0 ? void 0 : options.destPos) || animateParam.destPos; + var duration = (options === null || options === void 0 ? void 0 : options.duration) || animateParam.duration; + + if ((options === null || options === void 0 ? void 0 : options.restart) || duration <= diffTime) { + this.setTo(pos, duration - diffTime); + return; + } + + if (options === null || options === void 0 ? void 0 : options.destPos) { + var currentPos = this.axisManager.get(); // When destination is changed, new delta should be calculated as remaining percent. + // For example, moving x:0, y:0 to x:200, y:200 and it has current easing percent of 92%. coordinate is x:184 and y:184 + // If destination changes to x:300, y:300. xdelta:200, ydelta:200 changes to xdelta:116, ydelta:116 and use remaining easingPer as 100%, not 8% as previous. + // Therefore, original easingPer by time is kept. And divided by (1 - self._initialEasingPer) which means new total easing percent. Like calculating 8% as 100%. + + this._initialEasingPer = this._prevEasingPer; + animateParam.delta = this.axisManager.getDelta(currentPos, pos); + animateParam.destPos = pos; + } + + if (options === null || options === void 0 ? void 0 : options.duration) { + var ratio = (diffTime + this._durationOffset) / animateParam.duration; // Use durationOffset for keeping animation ratio after duration is changed. + // newRatio = (diffTime + newDurationOffset) / newDuration = oldRatio + // newDurationOffset = oldRatio * newDuration - diffTime + + this._durationOffset = ratio * duration - diffTime; + animateParam.duration = duration; + } + }; + + __proto._initState = function (info) { + this._initialEasingPer = 0; + this._prevEasingPer = 0; + this._durationOffset = 0; + return { + pos: info.depaPos, + easingPer: 0, + finished: false + }; + }; + + __proto._getNextState = function (prevState) { + var _this = this; + + var animateParam = this._animateParam; + var prevPos = prevState.pos; + var destPos = animateParam.destPos; + var directions = map(prevPos, function (value, key) { + return value <= destPos[key] ? 1 : -1; + }); + var diffTime = new Date().getTime() - animateParam.startTime; + var ratio = (diffTime + this._durationOffset) / animateParam.duration; + + var easingPer = this._easing(ratio); + + var toPos = this.axisManager.map(prevPos, function (pos, options, key) { + var nextPos = ratio >= 1 ? destPos[key] : pos + animateParam.delta[key] * (easingPer - _this._prevEasingPer) / (1 - _this._initialEasingPer); // Subtract distance from distance already moved. + // Recalculate the remaining distance. + // Fix the bouncing phenomenon by changing the range. + + var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular); + + if (nextPos !== circulatedPos) { + // circular + var rangeOffset = directions[key] * (options.range[1] - options.range[0]); + destPos[key] -= rangeOffset; + prevPos[key] -= rangeOffset; + } + + return circulatedPos; + }); + this._prevEasingPer = easingPer; + return { + pos: toPos, + easingPer: easingPer, + finished: easingPer >= 1 + }; + }; + + __proto._easing = function (p) { + return p > 1 ? 1 : this._options.easing(p); + }; + + return EasingManager; + }(AnimationManager); + + /** + * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. + * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @param {Number[]} [range] The coordinate of range 좌표 범위 + * @param {Number} [range[0]=0] The coordinate of the minimum 최소 좌표 + * @param {Number} [range[1]=0] The coordinate of the maximum 최대 좌표 + * @param {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바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다 + * @param {Number} [bounce[0]=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기 + * @param {Number} [bounce[1]=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기 + * @param {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.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다 + * @param {Boolean} [circular[0]=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부 + * @param {Boolean} [circular[1]=false] Indicates whether to circulate to the coordinate of the maximum 최대 좌표 방향의 순환 여부 + **/ + + /** + * @typedef {Object} AxesOption The option object of the eg.Axes module + * @ko eg.Axes 모듈의 옵션 객체 + * @param {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수 + * @param {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간 + * @param {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간 + * @param {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다 + * @param {Boolean} [interruptable=true] Indicates whether an animation is interruptible. + * - true: It can be paused or stopped by user action or the API. + * - false: It cannot be paused or stopped by user action or the API while it is running. + * 진행 중인 애니메이션 중지 가능 여부. + * - true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다. + * - false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다 + * @param {Number} [round=null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95) + * [Details](https://github.com/naver/egjs-axes/wiki/round-option)반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95). + * [상세내용](https://github.com/naver/egjs-axes/wiki/round-option) + * @param {Boolean} [nested=false] Whether the event propagates to other instances when the coordinates reach the end of the movable area 좌표가 이동 가능한 영역의 끝까지 도달했을 때 다른 인스턴스들로의 이벤트 전파 여부 + **/ + + /** + * 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.} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @param {AxesOption} [options={}] The option object of the eg.Axes moduleeg.Axes 모듈의 옵션 객체 + * @param {Object.} [startPos=null] The coordinates to be moved when creating an instance. not triggering change event.인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음. + * + * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * ```js + * // 1. Initialize eg.Axes + * const axes = new eg.Axes({ + * something1: { + * range: [0, 150], + * bounce: 50 + * }, + * something2: { + * range: [0, 200], + * bounce: 100 + * }, + * somethingN: { + * range: [1, 10], + * } + * }, { + * deceleration : 0.0024 + * }); + * + * // 2. attach event handler + * axes.on({ + * "hold" : function(evt) { + * }, + * "release" : function(evt) { + * }, + * "animationStart" : function(evt) { + * }, + * "animationEnd" : function(evt) { + * }, + * "change" : function(evt) { + * } + * }); + * + * // 3. Initialize inputTypes + * const panInputArea = new eg.Axes.PanInput("#area", { + * scale: [0.5, 1] + * }); + * const panInputHmove = new eg.Axes.PanInput("#hmove"); + * const panInputVmove = new eg.Axes.PanInput("#vmove"); + * const pinchInputArea = new eg.Axes.PinchInput("#area", { + * scale: 1.5 + * }); + * + * // 4. Connect eg.Axes and InputTypes + * // [PanInput] When the mouse or touchscreen is down and moved. + * // Connect the 'something2' axis to the mouse or touchscreen x position and + * // connect the 'somethingN' axis to the mouse or touchscreen y position. + * axes.connect(["something2", "somethingN"], panInputArea); // or axes.connect("something2 somethingN", panInputArea); + * + * // Connect only one 'something1' axis to the mouse or touchscreen x position. + * axes.connect(["something1"], panInputHmove); // or axes.connect("something1", panInputHmove); + * + * // Connect only one 'something2' axis to the mouse or touchscreen y position. + * axes.connect(["", "something2"], panInputVmove); // or axes.connect(" something2", panInputVmove); + * + * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). + * axes.connect("something2", pinchInputArea); + * ``` + */ + + var Axes = + /*#__PURE__*/ + function (_super) { + __extends(Axes, _super); + /** + * + */ + + + function Axes(axis, options, startPos) { + if (axis === void 0) { + axis = {}; + } + + if (options === void 0) { + options = {}; + } + + if (startPos === void 0) { + startPos = null; + } + + var _this = _super.call(this) || this; + + _this.axis = axis; + _this._inputs = []; + _this.options = __assign({ + easing: function (x) { + return 1 - Math.pow(1 - x, 3); + }, + interruptable: true, + maximumDuration: Infinity, + minimumDuration: 0, + deceleration: 0.0006, + round: null, + nested: false + }, options); + _this.interruptManager = new InterruptManager(_this.options); + _this.axisManager = new AxisManager(_this.axis); + _this.eventManager = new EventManager(_this); + _this.animationManager = new EasingManager(_this); + _this.inputObserver = new InputObserver(_this); + + _this.eventManager.setAnimationManager(_this.animationManager); + + if (startPos) { + _this.eventManager.triggerChange(startPos); + } + + return _this; + } + /** + * Connect the axis of eg.Axes to the inputType. + * @ko eg.Axes의 축과 inputType을 연결한다 + * @param {(String[]|String)} axes The name of the axis to associate with inputType inputType과 연결할 축의 이름 + * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes eg.Axes의 축과 연결할 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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")); + * ``` + */ + + + var __proto = Axes.prototype; + + __proto.connect = function (axes, inputType) { + var mapped; + + if (typeof axes === "string") { + mapped = axes.split(" "); + } else { + mapped = axes.concat(); + } // check same instance + + + if (~this._inputs.indexOf(inputType)) { + this.disconnect(inputType); + } + + inputType.mapAxes(mapped); + inputType.connect(this.inputObserver); + + this._inputs.push(inputType); + + return this; + }; + /** + * Disconnect the axis of eg.Axes from the inputType. + * @ko eg.Axes의 축과 inputType의 연결을 끊는다. + * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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 + * ``` + */ + + + __proto.disconnect = function (inputType) { + if (inputType) { + var index = this._inputs.indexOf(inputType); + + if (index >= 0) { + this._inputs[index].disconnect(); + + this._inputs.splice(index, 1); + } + } else { + this._inputs.forEach(function (v) { + return v.disconnect(); + }); + + this._inputs = []; + } + + return this; + }; + /** + * Returns the current position of the coordinates. + * @ko 좌표의 현재 위치를 반환한다 + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Object.} Axis coordinate information 축 좌표 정보 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.get = function (axes) { + return this.axisManager.get(axes); + }; + /** + * Moves an axis to specific coordinates. + * @ko 좌표를 이동한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + this.animationManager.setTo(pos, duration); + return this; + }; + /** + * Moves an axis from the current coordinates to specific coordinates. + * @ko 현재 좌표를 기준으로 좌표를 이동한다. + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * 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} + * ``` + */ + + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + this.animationManager.setBy(pos, duration); + return this; + }; + /** + * Stop an animation in progress. + * @ko 재생 중인 애니메이션을 정지한다. + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * }); + * + * axes.setTo({"x": 10}, 1000); // start animatation + * + * // after 500 ms + * axes.stopAnimation(); // stop animation during movement. + * ``` + */ + + + __proto.stopAnimation = function () { + this.animationManager.stopAnimation(); + return this; + }; + /** + * Change the destination of an animation in progress. + * @ko 재생 중인 애니메이션의 목적지와 진행 시간을 변경한다. + * @param {UpdateAnimationOption} pos The coordinate to move to 이동할 좌표 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * ```js + * const axes = new eg.Axes({ + * "x": { + * range: [0, 200] + * }, + * "y": { + * range: [0, 200] + * } + * }); + * + * axes.setTo({"x": 50, "y": 50}, 1000); // trigger animation by setTo + * + * // after 500 ms + * axes.updateAnimation({destPos: {"x": 100, "y": 100}}); // animation will end after 500 ms, at {"x": 100, "y": 100} + * + * // after 500 ms + * axes.setTo({"x": 50, "y": 50}, 1000); // trigger animation by setTo + * + * // after 700 ms + * axes.updateAnimation({destPos: {"x": 100, "y": 100}, duration: 1500, restart: true}); // this works same as axes.setTo({"x": 100, "y": 100}, 800) since restart is true. + * ``` + */ + + + __proto.updateAnimation = function (options) { + this.animationManager.updateAnimation(options); + return this; + }; + /** + * Returns whether there is a coordinate in the bounce area of ​​the target axis. + * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다 + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부 + * @example + * ```js + * 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(); + * ``` + */ + + + __proto.isBounceArea = function (axes) { + return this.axisManager.isOutside(axes); + }; + /** + * Destroys properties, and events used in a module and disconnect all connections to inputTypes. + * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.eventManager.destroy(); + }; + /** + * @name VERSION + * @desc Version info string + * @ko 버전정보 문자열 + * + * @constant + * @type {String} + * @example + * ```js + * eg.Axes.VERSION; // ex) 3.3.3 + * ``` + */ + + + Axes.VERSION = "3.3.0"; + /* eslint-enable */ + + /** + * @name TRANSFORM + * @desc Returns the transform attribute with CSS vendor prefixes. + * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다. + * + * @constant + * @type {String} + * @example + * ```js + * eg.Axes.TRANSFORM; // "transform" or "webkitTransform" + * ``` + */ + + Axes.TRANSFORM = TRANSFORM; + /** + * @name DIRECTION_NONE + * @constant + * @type {Number} + */ + + Axes.DIRECTION_NONE = DIRECTION_NONE; + /** + * @name DIRECTION_LEFT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_LEFT = DIRECTION_LEFT; + /** + * @name DIRECTION_RIGHT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_RIGHT = DIRECTION_RIGHT; + /** + * @name DIRECTION_UP + * @constant + * @type {Number} + */ + + Axes.DIRECTION_UP = DIRECTION_UP; + /** + * @name DIRECTION_DOWN + * @constant + * @type {Number} + */ + + Axes.DIRECTION_DOWN = DIRECTION_DOWN; + /** + * @name DIRECTION_HORIZONTAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + /** + * @name DIRECTION_VERTICAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + /** + * @name DIRECTION_ALL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_ALL = DIRECTION_ALL; + return Axes; + }(Component); + + /* eslint-disable @typescript-eslint/no-empty-function */ + + var getDirectionByAngle = function (angle, thresholdAngle) { + if (thresholdAngle < 0 || thresholdAngle > 90) { + return DIRECTION_NONE; + } + + var toAngle = Math.abs(angle); + return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL; + }; + var useDirection = function (checkType, direction, userDirection) { + if (userDirection) { + return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType); + } else { + return !!(direction & checkType); + } + }; + /** + * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module. + * @ko eg.Axes.PanInput 모듈의 옵션 객체 + * @param {String[]} [inputType=["touch", "mouse", "pointer"]] Types of input devices + * - touch: Touch screen + * - mouse: Mouse + * - pointer: Mouse and touch 입력 장치 종류 + * - touch: 터치 입력 장치 + * - mouse: 마우스 + * - pointer: 마우스 및 터치 + * @param {String[]} [inputButton=["left"]] List of buttons to allow input + * - left: Left mouse button and normal touch + * - middle: Mouse wheel press + * - right: Right mouse button 입력을 허용할 버튼 목록 + * - left: 마우스 왼쪽 버튼 + * - middle: 마우스 휠 눌림 + * - right: 마우스 오른쪽 버튼 + * @param {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [scale[0]=1] horizontal axis scale 수평축 배율 + * @param {Number} [scale[1]=1] vertical axis scale 수직축 배율 + * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90) + * @param {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리 + * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px) + * @param {String} [touchAction=null] Value that overrides the element's "touch-action" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. 엘리먼트의 "touch-action" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다. + **/ + + /** + * 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 + * ```js + * 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 eg.Axes.PanInput 모듈을 사용할 엘리먼트 + * @param {PanInputOption} [options={}] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체 + */ + + var PanInput = + /*#__PURE__*/ + function () { + /** + * + */ + function PanInput(el, options) { + var _this = this; + + this.axes = []; + this.element = null; + this._enabled = false; + this._activeEvent = null; + this._atRightEdge = false; + this._rightEdgeTimer = 0; + + this._forceRelease = function () { + var activeEvent = _this._activeEvent; + var prevEvent = activeEvent.prevEvent; + activeEvent.onRelease(); + + _this._observer.release(_this, prevEvent, [0, 0]); + + _this._detachWindowEvent(activeEvent); + }; + + this._voidFunction = function () {}; + + this.element = $(el); + this.options = __assign({ + inputType: ["touch", "mouse", "pointer"], + inputButton: [MOUSE_LEFT], + scale: [1, 1], + thresholdAngle: 45, + threshold: 0, + iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD, + releaseOnScroll: false, + touchAction: null + }, options); + this._onPanstart = this._onPanstart.bind(this); + this._onPanmove = this._onPanmove.bind(this); + this._onPanend = this._onPanend.bind(this); + } + + var __proto = PanInput.prototype; + + __proto.mapAxes = function (axes) { + var useHorizontal = !!axes[0]; + var useVertical = !!axes[1]; + + if (useHorizontal && useVertical) { + this._direction = DIRECTION_ALL; + } else if (useHorizontal) { + this._direction = DIRECTION_HORIZONTAL; + } else if (useVertical) { + this._direction = DIRECTION_VERTICAL; + } else { + this._direction = DIRECTION_NONE; + } + + this.axes = axes; + }; + + __proto.connect = function (observer) { + if (this._activeEvent) { + this._detachElementEvent(); + + this._detachWindowEvent(this._activeEvent); + } + + this._attachElementEvent(observer); + + this._originalCssProps = setCssProps(this.element, this.options, this._direction); + return this; + }; + + __proto.disconnect = function () { + this._detachElementEvent(); + + this._detachWindowEvent(this._activeEvent); + + if (!isCssPropsFromAxes(this._originalCssProps)) { + revertCssProps(this.element, this._originalCssProps); + } + + this._direction = DIRECTION_NONE; + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onPanstart = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventStart(event, this.options.inputButton); + + if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { + return; + } + + if (panEvent.srcEvent.cancelable !== false) { + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + + this._observer.hold(this, panEvent); + + this._atRightEdge = IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold; + + this._attachWindowEvent(activeEvent); + + activeEvent.prevEvent = panEvent; + } + }; + + __proto._onPanmove = function (event) { + var _this = this; + + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventMove(event, this.options.inputButton); + + if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { + return; + } + + var _a = this.options, + iOSEdgeSwipeThreshold = _a.iOSEdgeSwipeThreshold, + releaseOnScroll = _a.releaseOnScroll; + var userDirection = getDirectionByAngle(panEvent.angle, this.options.thresholdAngle); + + if (releaseOnScroll && !panEvent.srcEvent.cancelable) { + this._onPanend(event); + + return; + } + + if (activeEvent.prevEvent && IS_IOS_SAFARI) { + var swipeLeftToRight = panEvent.center.x < 0; + + if (swipeLeftToRight) { + // iOS swipe left => right + this._forceRelease(); + + return; + } else if (this._atRightEdge) { + clearTimeout(this._rightEdgeTimer); // - is right to left + + var swipeRightToLeft = panEvent.deltaX < -iOSEdgeSwipeThreshold; + + if (swipeRightToLeft) { + this._atRightEdge = false; + } else { + // iOS swipe right => left + this._rightEdgeTimer = window.setTimeout(function () { + return _this._forceRelease(); + }, 100); + } + } + } + + var offset = this._getOffset([panEvent.offsetX, panEvent.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]); + + var prevent = offset.some(function (v) { + return v !== 0; + }); + + if (prevent) { + if (panEvent.srcEvent.cancelable !== false) { + panEvent.srcEvent.preventDefault(); + } + + panEvent.srcEvent.stopPropagation(); + } + + panEvent.preventSystemEvent = prevent; + + if (prevent) { + this._observer.change(this, panEvent, toAxis(this.axes, offset)); + } + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanend = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this._enabled || activeEvent.getTouches(event) !== 0) { + return; + } + + this._detachWindowEvent(activeEvent); + + clearTimeout(this._rightEdgeTimer); + var prevEvent = activeEvent.prevEvent; + + var velocity = this._getOffset([Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1), Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]); + + activeEvent.onRelease(); + + this._observer.release(this, prevEvent, velocity); + }; + + __proto._attachWindowEvent = function (activeEvent) { + var _this = this; + + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + window.addEventListener(event, _this._onPanmove, { + passive: false + }); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + window.addEventListener(event, _this._onPanend, { + passive: false + }); + }); + }; + + __proto._detachWindowEvent = function (activeEvent) { + var _this = this; + + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + window.removeEventListener(event, _this._onPanmove); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + window.removeEventListener(event, _this._onPanend); + }); + }; + + __proto._getOffset = function (properties, direction) { + var offset = [0, 0]; + var scale = this.options.scale; + + if (direction[0]) { + offset[0] = properties[0] * scale[0]; + } + + if (direction[1]) { + offset[1] = properties[1] * scale[1]; + } + + return offset; + }; + + __proto._attachElementEvent = function (observer) { + var _this = this; + + var activeEvent = convertInputType(this.options.inputType); + + if (!activeEvent) { + return; + } + + this._observer = observer; + this._enabled = true; + this._activeEvent = activeEvent; + activeEvent.start.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, _this._onPanstart); + }); // adding event listener to element prevents invalid behavior in iOS Safari + + activeEvent.move.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, _this._voidFunction); + }); + }; + + __proto._detachElementEvent = function () { + var _this = this; + + var activeEvent = this._activeEvent; + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._onPanstart); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + var _a; + + (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._voidFunction); + }); + this._enabled = false; + this._observer = null; + }; + + return PanInput; + }(); + + /** + * A module that passes the angle moved by touch to Axes and uses one axis of rotation. + * [Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput) + * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다. + * [상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4) + * + * @example + * ```js + * const input = new eg.Axes.RotatePanInput("#area"); + * + * var axes = new eg.Axes({ + * // property name('angle') could be anything you want (eg. x, y, z...) + * angle: { + * range: [-180, 180] // from -180deg to 180deg + * } + * }); + * + * axes.connect("angle", input) + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트 + * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체 + * @extends PanInput + */ + + var RotatePanInput = + /*#__PURE__*/ + function (_super) { + __extends(RotatePanInput, _super); + /** + * + */ + + + function RotatePanInput(el, options) { + var _this = _super.call(this, el, options) || this; + + _this._prevQuadrant = null; + _this._lastDiff = 0; + return _this; + } + + var __proto = RotatePanInput.prototype; + + __proto.mapAxes = function (axes) { + this._direction = Axes.DIRECTION_ALL; + this.axes = axes; + }; + + __proto._onPanstart = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventStart(event, this.options.inputButton); + + if (!panEvent || !this.isEnabled()) { + return; + } + + var rect = this.element.getBoundingClientRect(); + + this._observer.hold(this, panEvent); + + this._attachWindowEvent(activeEvent); // TODO: how to do if element is ellipse not circle. + + + this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360 + // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin + + this._rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle. + + this._prevAngle = null; + + this._triggerChange(panEvent); + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanmove = function (event) { + var activeEvent = this._activeEvent; + var panEvent = activeEvent.onEventMove(event, this.options.inputButton); + + if (!panEvent || !this.isEnabled()) { + return; + } + + if (panEvent.srcEvent.cancelable !== false) { + panEvent.srcEvent.preventDefault(); + } + + panEvent.srcEvent.stopPropagation(); + + this._triggerChange(panEvent); + + activeEvent.prevEvent = panEvent; + }; + + __proto._onPanend = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this.isEnabled()) { + return; + } + + var prevEvent = activeEvent.prevEvent; + + this._triggerChange(prevEvent); + + var vx = prevEvent.velocityX; + var vy = prevEvent.velocityY; + var velocity = Math.sqrt(vx * vx + vy * vy) * (this._lastDiff > 0 ? -1 : 1); // clockwise + + activeEvent.onRelease(); + + this._observer.release(this, prevEvent, [velocity * this._coefficientForDistanceToAngle]); + + this._detachWindowEvent(activeEvent); + }; + + __proto._triggerChange = function (event) { + var _a = this._getPosFromOrigin(event.center.x, event.center.y), + x = _a.x, + y = _a.y; + + var angle = getAngle(x, y); + var positiveAngle = angle < 0 ? 360 + angle : angle; + + var quadrant = this._getQuadrant(event.center.x, event.center.y); + + var diff = this._getDifference(this._prevAngle, positiveAngle, this._prevQuadrant, quadrant); + + this._prevAngle = positiveAngle; + this._prevQuadrant = quadrant; + + if (diff === 0) { + return; + } + + this._lastDiff = diff; + + this._observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise + + }; + + __proto._getDifference = function (prevAngle, angle, prevQuadrant, quadrant) { + var diff; + + if (prevAngle === null) { + diff = 0; + } else if (prevQuadrant === 1 && quadrant === 4) { + diff = -prevAngle - (360 - angle); + } else if (prevQuadrant === 4 && quadrant === 1) { + diff = 360 - prevAngle + angle; + } else { + diff = angle - prevAngle; + } + + return diff; + }; + + __proto._getPosFromOrigin = function (posX, posY) { + return { + x: posX - this._rotateOrigin[0], + y: this._rotateOrigin[1] - posY + }; + }; + + __proto._getQuadrant = function (posX, posY) { + /** + * Quadrant + * y(+) + * | + * 2 | 1 + * --------------->x(+) + * 3 | 4 + * | + */ + var _a = this._getPosFromOrigin(posX, posY), + x = _a.x, + y = _a.y; + + var q = 0; + + if (x >= 0 && y >= 0) { + q = 1; + } else if (x < 0 && y >= 0) { + q = 2; + } else if (x < 0 && y < 0) { + q = 3; + } else if (x >= 0 && y < 0) { + q = 4; + } + + return q; + }; + + return RotatePanInput; + }(PanInput); + + /** + * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module + * @ko eg.Axes.PinchInput 모듈의 옵션 객체 + * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율 + * @param {String[]} [inputType=["touch", "pointer"]] Types of input devices + * - touch: Touch screen + * - pointer: Mouse and touch 입력 장치 종류 + * - touch: 터치 입력 장치 + * - pointer: 마우스 및 터치 + * @param {String} [touchAction="none"] Value that overrides the element's "touch-action" css property. It is set to "none" to prevent scrolling during touch. 엘리먼트의 "touch-action" CSS 속성을 덮어쓰는 값. 터치 도중 스크롤을 방지하기 위해 "none" 으로 설정되어 있다. + **/ + + /** + * 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 + * ```js + * 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 eg.Axes.PinchInput 모듈을 사용할 엘리먼트 + * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput moduleeg.Axes.PinchInput 모듈의 옵션 객체 + */ + + var PinchInput = + /*#__PURE__*/ + function () { + /** + * + */ + function PinchInput(el, options) { + this.axes = []; + this.element = null; + this._pinchFlag = false; + this._enabled = false; + this._activeEvent = null; + this.element = $(el); + this.options = __assign({ + scale: 1, + threshold: 0, + inputType: ["touch", "pointer"], + touchAction: "none" + }, options); + this._onPinchStart = this._onPinchStart.bind(this); + this._onPinchMove = this._onPinchMove.bind(this); + this._onPinchEnd = this._onPinchEnd.bind(this); + } + + var __proto = PinchInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + if (this._activeEvent) { + this._detachEvent(); + } + + this._attachEvent(observer); + + this._originalCssProps = setCssProps(this.element, this.options, DIRECTION_ALL); + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + if (!isCssPropsFromAxes(this._originalCssProps)) { + revertCssProps(this.element, this._originalCssProps); + } + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onPinchStart = function (event) { + var activeEvent = this._activeEvent; + var pinchEvent = activeEvent.onEventStart(event); + + if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) { + return; + } + + this._baseValue = this._observer.get(this)[this.axes[0]]; + + this._observer.hold(this, event); + + this._pinchFlag = true; + activeEvent.prevEvent = pinchEvent; + }; + + __proto._onPinchMove = function (event) { + var activeEvent = this._activeEvent; + var pinchEvent = activeEvent.onEventMove(event); + + if (!pinchEvent || !this._pinchFlag || !this._enabled || activeEvent.getTouches(event) !== 2) { + return; + } + + var offset = this._getOffset(pinchEvent.scale, activeEvent.prevEvent.scale); + + this._observer.change(this, event, toAxis(this.axes, [offset])); + + activeEvent.prevEvent = pinchEvent; + }; + + __proto._onPinchEnd = function (event) { + var activeEvent = this._activeEvent; + activeEvent.onEventEnd(event); + + if (!this._pinchFlag || !this._enabled || activeEvent.getTouches(event) >= 2) { + return; + } + + activeEvent.onRelease(); + + this._observer.release(this, event, [0], 0); + + this._baseValue = null; + this._pinchFlag = false; + }; + + __proto._attachEvent = function (observer) { + var _this = this; + + var activeEvent = convertInputType(this.options.inputType); + + if (!activeEvent) { + return; + } + + this._observer = observer; + this._enabled = true; + this._activeEvent = activeEvent; + activeEvent.start.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchStart, false); + }); + activeEvent.move.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchMove, false); + }); + activeEvent.end.forEach(function (event) { + _this.element.addEventListener(event, _this._onPinchEnd, false); + }); + }; + + __proto._detachEvent = function () { + var _this = this; + + var activeEvent = this._activeEvent; + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchStart, false); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchMove, false); + }); + activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { + _this.element.removeEventListener(event, _this._onPinchEnd, false); + }); + this._enabled = false; + this._observer = null; + }; + + __proto._getOffset = function (pinchScale, prev) { + if (prev === void 0) { + prev = 1; + } + + return this._baseValue * (pinchScale - prev) * this.options.scale; + }; + + return PinchInput; + }(); + + /** + * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module + * @ko eg.Axes.WheelInput 모듈의 옵션 객체 + * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [releaseDelay=300] Millisecond that trigger release event after last input마지막 입력 이후 release 이벤트가 트리거되기까지의 밀리초 + * @param {Boolean} [useNormalized=true] Whether to calculate scroll speed the same in all browsers모든 브라우저에서 스크롤 속도를 동일하게 처리할지 여부 + * @param {Boolean} [useAnimation=false] Whether to process coordinate changes through the mouse wheel as a continuous animation마우스 휠을 통한 좌표 변화를 연속적인 애니메이션으로 처리할지 여부 + **/ + + /** + * A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis. + * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. + * + * @example + * ```js + * const wheel = new eg.Axes.WheelInput("#area", { + * scale: 1 + * }); + * + * // Connect 'something' axis when the mousewheel is moved. + * axes.connect("something", wheel); + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module eg.Axes.WheelInput 모듈을 사용할 엘리먼트 + * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput moduleeg.Axes.WheelInput 모듈의 옵션 객체 + */ + + var WheelInput = + /*#__PURE__*/ + function () { + /** + * + */ + function WheelInput(el, options) { + this.axes = []; + this.element = null; + this._enabled = false; + this._holding = false; + this._timer = null; + this.element = $(el); + this.options = __assign({ + scale: 1, + releaseDelay: 300, + useNormalized: true, + useAnimation: false + }, options); + this._onWheel = this._onWheel.bind(this); + } + + var __proto = WheelInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + this._detachEvent(); + + this._attachEvent(observer); + + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onWheel = function (event) { + var _this = this; + + if (!this._enabled) { + return; + } + + event.preventDefault(); + + if (event.deltaY === 0) { + return; + } + + if (!this._holding) { + this._observer.hold(this, event); + + this._holding = true; + } + + var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY)); + + this._observer.change(this, event, toAxis(this.axes, [offset]), this.options.useAnimation); + + clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (_this._holding) { + _this._holding = false; + + _this._observer.release(_this, event, [0]); + } + }, this.options.releaseDelay); + }; + + __proto._attachEvent = function (observer) { + this._observer = observer; + this.element.addEventListener("wheel", this._onWheel); + this._enabled = true; + }; + + __proto._detachEvent = function () { + this.element.removeEventListener("wheel", this._onWheel); + this._enabled = false; + this._observer = null; + + if (this._timer) { + clearTimeout(this._timer); + this._timer = null; + } + }; + + return WheelInput; + }(); + + var KEY_LEFT_ARROW = 37; + var KEY_A = 65; + var KEY_UP_ARROW = 38; + var KEY_W = 87; + var KEY_RIGHT_ARROW = 39; + var KEY_D = 68; + var KEY_DOWN_ARROW = 40; + var KEY_S = 83; + /* eslint-disable */ + + var DIRECTION_REVERSE = -1; + var DIRECTION_FORWARD = 1; + var DIRECTION_HORIZONTAL$1 = -1; + var DIRECTION_VERTICAL$1 = 1; + var DELAY = 80; + /** + * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module + * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체 + * @param {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @param {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율 + * @param {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율 + **/ + + /** + * A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis. + * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다. + * + * @example + * ```js + * const moveKey = new eg.Axes.MoveKeyInput("#area", { + * scale: [1, 1] + * }); + * + * // Connect 'x', 'y' axes when the moveKey is pressed. + * axes.connect(["x", "y"], moveKey); + * ``` + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트 + * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput moduleeg.Axes.MoveKeyInput 모듈의 옵션 객체 + */ + + var MoveKeyInput = + /*#__PURE__*/ + function () { + /** + * + */ + function MoveKeyInput(el, options) { + this.axes = []; + this.element = null; + this._enabled = false; + this._holding = false; + this._timer = null; + this.element = $(el); + this.options = __assign({ + scale: [1, 1] + }, options); + this._onKeydown = this._onKeydown.bind(this); + this._onKeyup = this._onKeyup.bind(this); + } + + var __proto = MoveKeyInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + this._detachEvent(); // add tabindex="0" to the container for making it focusable + + + if (this.element.getAttribute("tabindex") !== "0") { + this.element.setAttribute("tabindex", "0"); + } + + this._attachEvent(observer); + + return this; + }; + + __proto.disconnect = function () { + this._detachEvent(); + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._enabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._enabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnabled = function () { + return this._enabled; + }; + + __proto._onKeydown = function (event) { + if (!this._enabled) { + return; + } + + var isMoveKey = true; + var direction = DIRECTION_FORWARD; + var move = DIRECTION_HORIZONTAL$1; + + switch (event.keyCode) { + case KEY_LEFT_ARROW: + case KEY_A: + direction = DIRECTION_REVERSE; + break; + + case KEY_RIGHT_ARROW: + case KEY_D: + break; + + case KEY_DOWN_ARROW: + case KEY_S: + direction = DIRECTION_REVERSE; + move = DIRECTION_VERTICAL$1; + break; + + case KEY_UP_ARROW: + case KEY_W: + move = DIRECTION_VERTICAL$1; + break; + + default: + isMoveKey = false; + } + + if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) { + isMoveKey = false; + } + + if (!isMoveKey) { + return; + } + + event.preventDefault(); + var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction]; + + if (!this._holding) { + this._observer.hold(this, event); + + this._holding = true; + } + + clearTimeout(this._timer); + + this._observer.change(this, event, toAxis(this.axes, offsets)); + }; + + __proto._onKeyup = function (event) { + var _this = this; + + if (!this._holding) { + return; + } + + clearTimeout(this._timer); + this._timer = setTimeout(function () { + _this._observer.release(_this, event, [0, 0]); + + _this._holding = false; + }, DELAY); + }; + + __proto._attachEvent = function (observer) { + this._observer = observer; + this.element.addEventListener("keydown", this._onKeydown, false); + this.element.addEventListener("keypress", this._onKeydown, false); + this.element.addEventListener("keyup", this._onKeyup, false); + this._enabled = true; + }; + + __proto._detachEvent = function () { + this.element.removeEventListener("keydown", this._onKeydown, false); + this.element.removeEventListener("keypress", this._onKeydown, false); + this.element.removeEventListener("keyup", this._onKeyup, false); + this._enabled = false; + this._observer = null; + }; + + return MoveKeyInput; + }(); + + Axes.PanInput = PanInput; + Axes.RotatePanInput = RotatePanInput; + Axes.PinchInput = PinchInput; + Axes.WheelInput = WheelInput; + Axes.MoveKeyInput = MoveKeyInput; + + return Axes; + +}))); +//# sourceMappingURL=axes.pkgd.js.map diff --git a/dist/axes.pkgd.js.map b/dist/axes.pkgd.js.map new file mode 100644 index 00000000..0de21fa8 --- /dev/null +++ b/dist/axes.pkgd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axes.pkgd.js","sources":["../src/browser.ts","../src/const.ts","../src/utils.ts","../src/EventManager.ts","../src/InterruptManager.ts","../src/Coordinate.ts","../src/AxisManager.ts","../src/eventInput/EventInput.ts","../src/eventInput/MouseEventInput.ts","../src/eventInput/TouchEventInput.ts","../src/eventInput/PointerEventInput.ts","../src/eventInput/TouchMouseEventInput.ts","../src/inputType/InputType.ts","../src/InputObserver.ts","../src/animation/AnimationManager.ts","../src/animation/EasingManager.ts","../src/Axes.ts","../src/inputType/PanInput.ts","../src/inputType/RotatePanInput.ts","../src/inputType/PinchInput.ts","../src/inputType/WheelInput.ts","../src/inputType/MoveKeyInput.ts","../src/index.umd.ts"],"sourcesContent":["/* eslint-disable no-new-func, no-nested-ternary */\n\nlet win: any;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {\n navigator: {\n userAgent: \"\",\n },\n };\n} else {\n win = window;\n}\n/* eslint-enable no-new-func, no-nested-ternary */\n\nexport { win as window };\n","export const DIRECTION_NONE = 1;\nexport const DIRECTION_LEFT = 2;\nexport const DIRECTION_RIGHT = 4;\nexport const DIRECTION_HORIZONTAL = 2 | 4;\nexport const DIRECTION_UP = 8;\nexport const DIRECTION_DOWN = 16;\nexport const DIRECTION_VERTICAL = 8 | 16;\nexport const DIRECTION_ALL = 2 | 4 | 8 | 16;\n\nexport const MOUSE_LEFT = \"left\";\nexport const MOUSE_RIGHT = \"right\";\nexport const MOUSE_MIDDLE = \"middle\";\n\nexport const VELOCITY_INTERVAL = 16;\n\nimport getAgent from \"@egjs/agent\";\n\nimport { window } from \"./browser\";\n\nexport const IOS_EDGE_THRESHOLD = 30;\nexport const IS_IOS_SAFARI =\n \"ontouchstart\" in window && getAgent().browser.name === \"safari\";\n\nexport const TRANSFORM = (() => {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n const bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0])\n .style;\n const target = [\n \"transform\",\n \"webkitTransform\",\n \"msTransform\",\n \"mozTransform\",\n ];\n for (let i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n return \"\";\n})();\n\nexport const PREVENT_DRAG_CSSPROPS = {\n \"user-select\": \"none\",\n \"-webkit-user-drag\": \"none\",\n};\n","import { window } from \"./browser\";\nimport { PREVENT_DRAG_CSSPROPS } from \"./const\";\nimport { PanInputOption } from \"./inputType/PanInput\";\nimport { PinchInputOption } from \"./inputType/PinchInput\";\nimport { ObjectInterface } from \"./types\";\nimport {\n DIRECTION_NONE,\n DIRECTION_VERTICAL,\n DIRECTION_HORIZONTAL,\n DIRECTION_ALL,\n} from \"./const\";\n\ndeclare let jQuery: any;\n\nexport const toArray = (nodes: NodeList): HTMLElement[] => {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n const el = [];\n for (let i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n return el;\n};\n\nexport const $ = (param, multi = false) => {\n let el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n const match = param.match(/^<([a-z]+)\\s*([^>]*)>/);\n\n // creating element\n if (match) {\n // HTML\n const dummy = document.createElement(\"div\");\n\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === window) {\n // window\n el = param;\n } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) {\n // HTMLElement, Document\n el = param;\n } else if (\n (\"jQuery\" in window && param instanceof jQuery) ||\n param.constructor.prototype.jquery\n ) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map((v) => $(v));\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n return el;\n};\n\nlet raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame;\nlet caf = window.cancelAnimationFrame || window.webkitCancelAnimationFrame;\nif (raf && !caf) {\n const keyInfo = {};\n const oldraf = raf;\n raf = (callback: FrameRequestCallback) => {\n const wrapCallback = (timestamp: number) => {\n if (keyInfo[key]) {\n callback(timestamp);\n }\n };\n const key = oldraf(wrapCallback);\n keyInfo[key] = true;\n return key;\n };\n caf = (key: number) => {\n delete keyInfo[key];\n };\n} else if (!(raf && caf)) {\n raf = (callback: FrameRequestCallback) => {\n return window.setTimeout(() => {\n callback(\n ((window.performance &&\n window.performance.now &&\n window.performance.now()) as number) || new Date().getTime()\n );\n }, 16);\n };\n caf = window.clearTimeout;\n}\n\n/**\n * A polyfill for the window.requestAnimationFrame() method.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame\n * @private\n */\nexport const requestAnimationFrame = (fp) => {\n return raf(fp);\n};\n/**\n * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method.\n * @param {Number} key −\tThe ID value returned through a call to the requestAnimationFrame() method. requestAnimationFrame() 메서드가 반환한 아이디 값\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame\n * @private\n */\nexport const cancelAnimationFrame = (key) => {\n caf(key);\n};\n\nexport const map = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => U\n): ObjectInterface => {\n const tranformed: ObjectInterface = {};\n\n for (const k in obj) {\n if (k) {\n tranformed[k] = callback(obj[k], k);\n }\n }\n return tranformed;\n};\n\nexport const filter = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n): ObjectInterface => {\n const filtered: ObjectInterface = {};\n\n for (const k in obj) {\n if (k && callback(obj[k], k)) {\n filtered[k] = obj[k];\n }\n }\n return filtered;\n};\nexport const every = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n) => {\n for (const k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n return true;\n};\nexport const equal = (\n target: ObjectInterface,\n base: ObjectInterface\n): boolean => {\n return every(target, (v, k) => v === base[k]);\n};\n\nconst roundNumFunc = {};\n\nexport const roundNumber = (num: number, roundUnit: number) => {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n};\n\nexport const roundNumbers = (\n num: ObjectInterface,\n roundUnit: ObjectInterface | number\n): ObjectInterface => {\n if (!num || !roundUnit) {\n return num;\n }\n return map(num, (value, key) =>\n roundNumber(\n value,\n typeof roundUnit === \"number\" ? roundUnit : roundUnit[key]\n )\n );\n};\n\nexport const getDecimalPlace = (val: number): number => {\n if (!isFinite(val)) {\n return 0;\n }\n\n const v = `${val}`;\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n let p = 0;\n let e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n }\n\n // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n};\n\nexport const inversePow = (n: number) => {\n // replace Math.pow(10, -n) to solve floating point issue.\n // eg. Math.pow(10, -4) => 0.00009999999999999999\n return 1 / Math.pow(10, n);\n};\n\nexport const getRoundFunc = (v: number) => {\n const p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n\n return (n: number) => {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n};\n\nexport const getAngle = (posX: number, posY: number) => {\n return (Math.atan2(posY, posX) * 180) / Math.PI;\n};\n\nexport const isCssPropsFromAxes = (originalCssProps: {\n [key: string]: string;\n}) => {\n let same = true;\n Object.keys(PREVENT_DRAG_CSSPROPS).forEach((prop) => {\n if (\n !originalCssProps ||\n originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]\n ) {\n same = false;\n }\n });\n return same;\n};\n\nexport const setCssProps = (\n element: HTMLElement,\n option: PanInputOption | PinchInputOption,\n direction: number\n): { [key: string]: string } => {\n const touchActionMap = {\n [DIRECTION_NONE]: \"auto\",\n [DIRECTION_ALL]: \"none\",\n [DIRECTION_VERTICAL]: \"pan-x\",\n [DIRECTION_HORIZONTAL]: \"pan-y\",\n };\n const oldCssProps = {};\n if (element && element.style) {\n const touchAction = option.touchAction\n ? option.touchAction\n : touchActionMap[direction];\n const newCssProps = {\n ...PREVENT_DRAG_CSSPROPS,\n \"touch-action\":\n element.style[\"touch-action\"] === \"none\" ? \"none\" : touchAction,\n };\n Object.keys(newCssProps).forEach((prop) => {\n oldCssProps[prop] = element.style[prop];\n element.style[prop] = newCssProps[prop];\n });\n }\n return oldCssProps;\n};\n\nexport const revertCssProps = (\n element: HTMLElement,\n originalCssProps: { [key: string]: string }\n): { [key: string]: string } => {\n if (element && element.style && originalCssProps) {\n Object.keys(originalCssProps).forEach((prop) => {\n element.style[prop] = originalCssProps[prop];\n });\n }\n return;\n};\n","import { ComponentEvent } from \"@egjs/component\";\n\nimport { InputType } from \"./inputType/InputType\";\nimport { Axis } from \"./AxisManager\";\nimport Axes from \"./Axes\";\nimport { roundNumbers } from \"./utils\";\nimport { AnimationParam, OnAnimationStart, OnRelease } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface ChangeEventOption {\n input: InputType;\n event;\n}\n\nexport class EventManager {\n public animationManager: AnimationManager;\n public constructor(private _axes: Axes) {}\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @event Axes#hold\n * @type {object}\n * @property {Object.} pos coordinate 좌표 정보\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"hold\", function(event) {\n * // event.pos\n * // event.input\n * // event.inputEvent\n * // isTrusted\n * });\n * ```\n */\n public hold(pos: Axis, option: ChangeEventOption) {\n const { roundPos } = this._getRoundPos(pos);\n\n this._axes.trigger(\n new ComponentEvent(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true,\n })\n );\n }\n\n /**\n * Specifies the coordinates to move after the 'change' event. It works when the holding value of the change event is true.\n * @ko 'change' 이벤트 이후 이동할 좌표를 지정한다. change이벤트의 holding 값이 true일 경우에 동작한다\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events.\n * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationStart\", function(event) {\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n /**\n * This event is fired when a user release an element on the screen of the device.\n * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트\n * @event Axes#release\n * @type {object}\n * @property {Object.} depaPos The coordinates when releasing an element손을 뗐을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to after releasing an element손을 뗀 뒤에 이동할 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value 손을 뗐을 때의 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'release' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerRelease(param: AnimationParam) {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n this._axes.trigger(\n new ComponentEvent(\"release\", {\n ...param,\n bounceRatio: this._getBounceRatio(roundPos),\n } as OnRelease)\n );\n }\n\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @event Axes#change\n * @type {object}\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value 현재 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.사용자가 기기의 화면을 누르고 있는지 여부\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true 이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * // event.pos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.holding\n * // event.set\n * // event.isTrusted\n *\n * // if you want to change the coordinates to move after the 'change' event.\n * // it works when the holding value of the change event is true.\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n public triggerChange(\n pos: Axis,\n depaPos?: Axis,\n option?: ChangeEventOption,\n holding: boolean = false\n ) {\n const animationManager = this.animationManager;\n const axisManager = animationManager.axisManager;\n const eventInfo = animationManager.getEventInfo();\n const { roundPos, roundDepa } = this._getRoundPos(pos, depaPos);\n const moveTo = axisManager.moveTo(roundPos, roundDepa);\n const inputEvent = option?.event || eventInfo?.event || null;\n const param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n bounceRatio: this._getBounceRatio(moveTo.pos),\n holding,\n inputEvent,\n isTrusted: !!inputEvent,\n input: option?.input || eventInfo?.input || null,\n set: inputEvent ? this._createUserControll(moveTo.pos) : () => {}, // eslint-disable-line @typescript-eslint/no-empty-function\n };\n const event = new ComponentEvent(\"change\", param);\n this._axes.trigger(event);\n\n if (inputEvent) {\n axisManager.set(\n (param.set() as { destPos: Axis; duration: number }).destPos\n );\n }\n\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @event Axes#animationStart\n * @type {object}\n * @property {Object.} depaPos The coordinates when animation starts애니메이션이 시작 되었을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to. If you change this value, you can run the animation이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'animationStart' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerAnimationStart(param: AnimationParam): boolean {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n const event = new ComponentEvent(\n \"animationStart\",\n param as OnAnimationStart\n );\n this._axes.trigger(event);\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#animationEnd\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationEnd\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerAnimationEnd(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"animationEnd\", {\n isTrusted,\n })\n );\n }\n\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#finish\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"finish\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerFinish(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"finish\", {\n isTrusted,\n })\n );\n }\n\n public setAnimationManager(animationManager: AnimationManager) {\n this.animationManager = animationManager;\n }\n\n public destroy() {\n this._axes.off();\n }\n\n private _createUserControll(pos: Axis, duration: number = 0) {\n // to controll\n const userControl = {\n destPos: { ...pos },\n duration,\n };\n return (\n toPos?: Axis,\n userDuration?: number\n ): { destPos: Axis; duration: number } => {\n if (toPos) {\n userControl.destPos = { ...toPos };\n }\n if (userDuration !== undefined) {\n userControl.duration = userDuration;\n }\n return userControl;\n };\n }\n\n private _getRoundPos(pos: Axis, depaPos?: Axis) {\n // round value if round exist\n const roundUnit = this._axes.options.round;\n\n // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit),\n };\n }\n\n private _getBounceRatio(pos: Axis): Axis {\n return this._axes.axisManager.map(pos, (v, opt) => {\n if (v < opt.range[0] && opt.bounce[0] !== 0) {\n return (opt.range[0] - v) / opt.bounce[0];\n } else if (v > opt.range[1] && opt.bounce[1] !== 0) {\n return (v - opt.range[1]) / opt.bounce[1];\n } else {\n return 0;\n }\n });\n }\n}\n","import { AxesOption } from \"./Axes\";\nexport class InterruptManager {\n private _prevented = false; // check whether the animation event was prevented\n public constructor(private _options: AxesOption) {}\n\n public isInterrupting() {\n // when interruptable is 'true', return value is always 'true'.\n return this._options.interruptable || this._prevented;\n }\n\n public isInterrupted() {\n return !this._options.interruptable && this._prevented;\n }\n\n public setInterrupt(prevented) {\n if (!this._options.interruptable) {\n this._prevented = prevented;\n }\n }\n}\n","export const getInsidePosition = (\n destPos: number,\n range: number[],\n circular: boolean[],\n bounce?: number[]\n): number => {\n let toDestPos: number = destPos;\n const targetRange: number[] = [\n circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0],\n circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1],\n ];\n\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n\n return toDestPos;\n};\n\n// determine outside\nexport const isOutside = (pos: number, range: number[]): boolean => {\n return pos < range[0] || pos > range[1];\n};\n\n// determine whether position has reached the maximum moveable area\nexport const isEndofBounce = (\n pos: number,\n range: number[],\n bounce: number[],\n circular: boolean[]\n): boolean => {\n return (\n (!circular[0] && pos === range[0] - bounce[0]) ||\n (!circular[1] && pos === range[1] + bounce[1])\n );\n};\n\nexport const getDuration = (distance: number, deceleration): number => {\n const duration = Math.sqrt((distance / deceleration) * 2);\n\n // when duration is under 100, then value is zero\n return duration < 100 ? 0 : duration;\n};\n\nexport const isCircularable = (\n destPos: number,\n range: number[],\n circular: boolean[]\n): boolean => {\n return (\n (circular[1] && destPos > range[1]) || (circular[0] && destPos < range[0])\n );\n};\n\nexport const getCirculatedPos = (\n pos: number,\n range: number[],\n circular: boolean[]\n): number => {\n let toPos = pos;\n const min = range[0];\n const max = range[1];\n const length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = ((toPos - max) % length) + min;\n }\n if (circular[0] && pos < min) {\n // left\n toPos = ((toPos - min) % length) + max;\n }\n return toPos;\n};\n","import { isOutside, getCirculatedPos } from \"./Coordinate\";\nimport { map, filter, every } from \"./utils\";\nimport { ObjectInterface } from \"./types\";\n\nexport interface Axis {\n [key: string]: number;\n}\n\nexport interface AxisOption {\n range?: number[];\n bounce?: number | number[];\n circular?: boolean | boolean[];\n}\n\nexport class AxisManager {\n private _pos: Axis;\n public constructor(private _axis: ObjectInterface) {\n this._complementOptions();\n this._pos = Object.keys(this._axis).reduce((acc, v) => {\n acc[v] = this._axis[v].range[0];\n return acc;\n }, {});\n }\n\n public getDelta(depaPos: Axis, destPos: Axis): Axis {\n const fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), (v, k) => v - fullDepaPos[k]);\n }\n\n public get(axes?: string[] | Axis): Axis {\n if (axes && Array.isArray(axes)) {\n return axes.reduce((acc, v) => {\n if (v && v in this._pos) {\n acc[v] = this._pos[v];\n }\n return acc;\n }, {});\n } else {\n return { ...this._pos, ...((axes || {}) as Axis) };\n }\n }\n\n public moveTo(pos: Axis, depaPos: Axis = this._pos): { [key: string]: Axis } {\n const delta = map(this._pos, (v, key) => {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n\n this.set(\n this.map(pos, (v, opt) =>\n opt ? getCirculatedPos(v, opt.range, opt.circular as boolean[]) : 0\n )\n );\n return {\n pos: { ...this._pos },\n delta,\n };\n }\n\n public set(pos: Axis) {\n for (const k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n }\n\n public every(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): boolean {\n const axisOptions = this._axis;\n\n return every(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public filter(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): Axis {\n const axisOptions = this._axis;\n\n return filter(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public map(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => U\n ) {\n const axisOptions = this._axis;\n\n return map(pos, (value, key) =>\n callback(value, axisOptions[key], key)\n );\n }\n\n public isOutside(axes?: string[]) {\n return !this.every(\n axes ? this.get(axes) : this._pos,\n (v, opt) => !isOutside(v, opt.range)\n );\n }\n\n public getAxisOptions(key: string) {\n return this._axis[key];\n }\n\n /**\n * set up 'css' expression\n * @private\n */\n private _complementOptions() {\n Object.keys(this._axis).forEach((axis) => {\n this._axis[axis] = {\n ...{\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false],\n },\n ...this._axis[axis],\n };\n\n [\"bounce\", \"circular\"].forEach((v) => {\n const axisOption = this._axis;\n const key = axisOption[axis][v];\n\n if (/string|number|boolean/.test(typeof key)) {\n axisOption[axis][v] = [key, key];\n }\n });\n });\n }\n}\n","import { ExtendedEvent, InputEventType, LatestInterval } from \"../types\";\nimport { getAngle } from \"../utils\";\nimport { window } from \"../browser\";\nimport {\n MOUSE_LEFT,\n MOUSE_MIDDLE,\n MOUSE_RIGHT,\n VELOCITY_INTERVAL,\n} from \"../const\";\n\nexport const SUPPORT_TOUCH = \"ontouchstart\" in window;\nexport const SUPPORT_POINTER = \"PointerEvent\" in window;\nexport const SUPPORT_MSPOINTER = \"MSPointerEvent\" in window;\nexport const SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER;\n\nexport abstract class EventInput {\n public prevEvent: ExtendedEvent;\n private _latestInterval: LatestInterval;\n\n public abstract onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventEnd(event: InputEventType): void;\n\n public abstract onRelease(event: InputEventType): void;\n\n public abstract getTouches(event: InputEventType): number;\n\n protected abstract _getScale(event: InputEventType): number;\n\n protected abstract _getCenter(event: InputEventType): {\n x: number;\n y: number;\n };\n\n protected abstract _getMovement(event: InputEventType): {\n x: number;\n y: number;\n };\n\n public extendEvent(event: InputEventType): ExtendedEvent {\n const prevEvent = this.prevEvent;\n const center = this._getCenter(event);\n const movement = prevEvent ? this._getMovement(event) : { x: 0, y: 0 };\n const scale = prevEvent ? this._getScale(event) : 1;\n const angle = prevEvent\n ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y)\n : 0;\n const deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x;\n const deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y;\n const offsetX = movement.x;\n const offsetY = movement.y;\n const latestInterval = this._latestInterval;\n const timeStamp = Date.now();\n const deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;\n let velocityX = prevEvent ? prevEvent.velocityX : 0;\n let velocityY = prevEvent ? prevEvent.velocityY : 0;\n if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {\n if (latestInterval) {\n [velocityX, velocityY] = [\n (deltaX - latestInterval.deltaX) / deltaTime,\n (deltaY - latestInterval.deltaY) / deltaTime,\n ];\n }\n this._latestInterval = {\n timestamp: timeStamp,\n deltaX,\n deltaY,\n };\n }\n return {\n srcEvent: event,\n scale,\n angle,\n center,\n deltaX,\n deltaY,\n offsetX,\n offsetY,\n velocityX,\n velocityY,\n preventSystemEvent: true,\n };\n }\n\n protected _getDistance(\n start: Touch | PointerEvent,\n end: Touch | PointerEvent\n ): number {\n const x = end.clientX - start.clientX;\n const y = end.clientY - start.clientY;\n return Math.sqrt(x * x + y * y);\n }\n\n protected _getButton(event: InputEventType): string {\n const buttonCodeMap = { 1: MOUSE_LEFT, 2: MOUSE_RIGHT, 4: MOUSE_MIDDLE };\n const button = this._isTouchEvent(event)\n ? MOUSE_LEFT\n : buttonCodeMap[event.buttons];\n return button ? button : null;\n }\n\n protected _isTouchEvent(event: InputEventType): event is TouchEvent {\n return event.type.indexOf(\"touch\") > -1;\n }\n\n protected _isValidButton(button: string, inputButton: string[]): boolean {\n return inputButton.indexOf(button) > -1;\n }\n\n protected _preventMouseButton(event: InputEventType, button: string): void {\n if (button === MOUSE_RIGHT) {\n window.addEventListener(\"contextmenu\", this._stopContextMenu);\n } else if (button === MOUSE_MIDDLE) {\n event.preventDefault();\n }\n }\n\n private _stopContextMenu = (event: InputEventType) => {\n event.preventDefault();\n window.removeEventListener(\"contextmenu\", this._stopContextMenu);\n };\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class MouseEventInput extends EventInput {\n public readonly start = [\"mousedown\"];\n public readonly move = [\"mousemove\"];\n public readonly end = [\"mouseup\"];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(): void {\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n return;\n }\n\n public getTouches(): number {\n return 0;\n }\n\n protected _getScale(): number {\n return 1;\n }\n\n protected _getCenter(event: MouseEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as MouseEvent;\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchEventInput extends EventInput {\n public readonly start = [\"touchstart\"];\n public readonly move = [\"touchmove\"];\n public readonly end = [\"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(event: InputEventType): ExtendedEvent {\n this._baseTouches = (event as TouchEvent).touches;\n return this.extendEvent(event);\n }\n\n public onEventMove(event: InputEventType): ExtendedEvent {\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._baseTouches = (event as TouchEvent).touches;\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return (event as TouchEvent).touches.length;\n }\n\n protected _getScale(event: TouchEvent): number {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n\n protected _getCenter(event: TouchEvent): { x: number; y: number } {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n\n protected _getMovement(event: TouchEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as TouchEvent;\n if (event.touches[0].identifier !== prev.touches[0].identifier) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.touches[0].clientX - prev.touches[0].clientX,\n y: event.touches[0].clientY - prev.touches[0].clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput, SUPPORT_POINTER } from \"./EventInput\";\n\nexport class PointerEventInput extends EventInput {\n public readonly start = SUPPORT_POINTER ? [\"pointerdown\"] : [\"MSPointerDown\"];\n public readonly move = SUPPORT_POINTER ? [\"pointermove\"] : [\"MSPointerMove\"];\n public readonly end = SUPPORT_POINTER\n ? [\"pointerup\", \"pointercancel\"]\n : [\"MSPointerUp\", \"MSPointerCancel\"];\n\n // store first, recent inputs for each event id\n private _firstInputs: PointerEvent[] = [];\n private _recentInputs: PointerEvent[] = [];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._removePointerEvent(event as PointerEvent);\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._firstInputs = [];\n this._recentInputs = [];\n return;\n }\n\n public getTouches(): number {\n return this._recentInputs.length;\n }\n\n protected _getScale(): number {\n if (this._recentInputs.length !== 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(this._recentInputs[0], this._recentInputs[1]) /\n this._getDistance(this._firstInputs[0], this._firstInputs[1])\n );\n }\n\n protected _getCenter(event: PointerEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: PointerEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as PointerEvent;\n if (event.pointerId !== prev.pointerId) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n\n private _updatePointerEvent(event: PointerEvent) {\n let addFlag = false;\n this._recentInputs.forEach((e, i) => {\n if (e.pointerId === event.pointerId) {\n addFlag = true;\n this._recentInputs[i] = event;\n }\n });\n if (!addFlag) {\n this._firstInputs.push(event);\n this._recentInputs.push(event);\n }\n }\n\n private _removePointerEvent(event?: PointerEvent) {\n this._firstInputs = this._firstInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n this._recentInputs = this._recentInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchMouseEventInput extends EventInput {\n public readonly start = [\"mousedown\", \"touchstart\"];\n public readonly move = [\"mousemove\", \"touchmove\"];\n public readonly end = [\"mouseup\", \"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return this._isTouchEvent(event) ? event.touches.length : 0;\n }\n\n protected _getScale(event: MouseEvent | TouchEvent): number {\n if (this._isTouchEvent(event)) {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return 1; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n return this.prevEvent.scale;\n }\n\n protected _getCenter(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n if (this._isTouchEvent(event)) {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n const prev = this.prevEvent.srcEvent;\n const [nextSpot, prevSpot] = [event, prev].map((e) => {\n if (this._isTouchEvent(e)) {\n return {\n id: e.touches[0].identifier,\n x: e.touches[0].clientX,\n y: e.touches[0].clientY,\n };\n }\n return {\n id: null,\n x: e.clientX,\n y: e.clientY,\n };\n });\n return nextSpot.id === prevSpot.id\n ? { x: nextSpot.x - prevSpot.x, y: nextSpot.y - prevSpot.y }\n : { x: 0, y: 0 };\n }\n}\n","import { Axis } from \"../AxisManager\";\nimport { AxesOption } from \"../Axes\";\nimport { ActiveEvent } from \"../types\";\nimport { MouseEventInput } from \"../eventInput/MouseEventInput\";\nimport { TouchEventInput } from \"../eventInput/TouchEventInput\";\nimport { PointerEventInput } from \"../eventInput/PointerEventInput\";\nimport { TouchMouseEventInput } from \"../eventInput/TouchMouseEventInput\";\nimport {\n SUPPORT_POINTER_EVENTS,\n SUPPORT_TOUCH,\n} from \"../eventInput/EventInput\";\n\nexport interface InputType {\n axes: string[];\n element: HTMLElement;\n mapAxes(axes: string[]);\n connect(observer: InputTypeObserver): InputType;\n disconnect();\n destroy();\n enable?();\n disable?();\n isEnable?(): boolean;\n}\n\nexport interface InputTypeObserver {\n options: AxesOption;\n get(inputType: InputType): Axis;\n change(inputType: InputType, event, offset: Axis, useAnimation?: boolean);\n hold(inputType: InputType, event);\n release(\n inputType: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n );\n}\n\nexport const toAxis = (source: string[], offset: number[]): Axis => {\n return offset.reduce((acc, v, i) => {\n if (source[i]) {\n acc[source[i]] = v;\n }\n return acc;\n }, {});\n};\n\nexport const convertInputType = (inputType: string[] = []): ActiveEvent => {\n let hasTouch = false;\n let hasMouse = false;\n let hasPointer = false;\n\n inputType.forEach((v) => {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n if (hasPointer) {\n return new PointerEventInput();\n } else if (hasTouch && hasMouse) {\n return new TouchMouseEventInput();\n } else if (hasTouch) {\n return new TouchEventInput();\n } else if (hasMouse) {\n return new MouseEventInput();\n }\n return null;\n};\n","import { InterruptManager } from \"./InterruptManager\";\nimport { InputType, InputTypeObserver, toAxis } from \"./inputType/InputType\";\nimport { EventManager, ChangeEventOption } from \"./EventManager\";\nimport { AxisManager, Axis } from \"./AxisManager\";\nimport { AxesOption } from \"./Axes\";\nimport {\n isOutside,\n getInsidePosition,\n getCirculatedPos,\n isEndofBounce,\n} from \"./Coordinate\";\nimport { map, equal } from \"./utils\";\nimport { AnimationParam } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport class InputObserver implements InputTypeObserver {\n public options: AxesOption;\n private _interruptManager: InterruptManager;\n private _eventManager: EventManager;\n private _axisManager: AxisManager;\n private _animationManager: AnimationManager;\n private _isOutside = false;\n private _moveDistance: Axis = null;\n private _isStopped = false;\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n animationManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n animationManager: AnimationManager;\n }) {\n this.options = options;\n this._interruptManager = interruptManager;\n this._eventManager = eventManager;\n this._axisManager = axisManager;\n this._animationManager = animationManager;\n }\n\n public get(input: InputType): Axis {\n return this._axisManager.get(input.axes);\n }\n\n public hold(input: InputType, event) {\n if (this._interruptManager.isInterrupted() || !input.axes.length) {\n return;\n }\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n this._isStopped = false;\n this._interruptManager.setInterrupt(true);\n this._animationManager.stopAnimation(changeOption);\n if (!this._moveDistance) {\n this._eventManager.hold(this._axisManager.get(), changeOption);\n }\n this._isOutside = this._axisManager.isOutside(input.axes);\n this._moveDistance = this._axisManager.get(input.axes);\n }\n\n public change(input: InputType, event, offset: Axis, useAnimation?: boolean) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n this._axisManager.every(offset, (v) => v === 0)\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyChanged) {\n return;\n }\n let depaPos: Axis = this._moveDistance || this._axisManager.get(input.axes);\n let destPos: Axis;\n\n // for outside logic\n destPos = map(depaPos, (v, k) => v + (offset[k] || 0));\n if (this._moveDistance) {\n this._moveDistance = this._axisManager.map(\n destPos,\n (v, { circular, range }) =>\n circular && (circular[0] || circular[1])\n ? getCirculatedPos(v, range, circular as boolean[])\n : v\n );\n }\n // from outside to inside\n if (\n this._isOutside &&\n this._axisManager.every(depaPos, (v, opt) => !isOutside(v, opt.range))\n ) {\n this._isOutside = false;\n }\n depaPos = this._atOutside(depaPos);\n destPos = this._atOutside(destPos);\n\n if (!this.options.nested || !this._isEndofAxis(offset, depaPos, destPos)) {\n nativeEvent.__childrenAxesAlreadyChanged = true;\n }\n\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (useAnimation) {\n const duration = this._animationManager.getDuration(destPos, depaPos);\n this._animationManager.animateTo(destPos, duration, changeOption);\n } else {\n const isCanceled = !this._eventManager.triggerChange(\n destPos,\n depaPos,\n changeOption,\n true\n );\n if (isCanceled) {\n this._isStopped = true;\n this._moveDistance = null;\n this._animationManager.finish(false);\n }\n }\n }\n\n public release(\n input: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n ) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n !this._moveDistance\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyReleased) {\n velocity = velocity.map(() => 0);\n }\n const pos: Axis = this._axisManager.get(input.axes);\n const depaPos: Axis = this._axisManager.get();\n const displacement = this._animationManager.getDisplacement(velocity);\n const offset = toAxis(input.axes, displacement);\n let destPos: Axis = this._axisManager.get(\n this._axisManager.map(offset, (v, opt, k) => {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(\n pos[k] + v,\n opt.range,\n opt.circular as boolean[],\n opt.bounce as number[]\n );\n }\n })\n );\n nativeEvent.__childrenAxesAlreadyReleased = true;\n const duration = this._animationManager.getDuration(\n destPos,\n pos,\n inputDuration\n );\n\n if (duration === 0) {\n destPos = { ...depaPos };\n }\n // prepare params\n const param: AnimationParam = {\n depaPos,\n destPos,\n duration,\n delta: this._axisManager.getDelta(depaPos, destPos),\n inputEvent: event,\n input,\n isTrusted: true,\n };\n this._eventManager.triggerRelease(param);\n this._moveDistance = null;\n\n // to contol\n const userWish = this._animationManager.getUserControl(param);\n const isEqual = equal(userWish.destPos, depaPos);\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (isEqual || userWish.duration === 0) {\n if (!isEqual) {\n this._eventManager.triggerChange(\n userWish.destPos,\n depaPos,\n changeOption,\n true\n );\n }\n this._interruptManager.setInterrupt(false);\n if (this._axisManager.isOutside()) {\n this._animationManager.restore(changeOption);\n } else {\n this._eventManager.triggerFinish(true);\n }\n } else {\n this._animationManager.animateTo(\n userWish.destPos,\n userWish.duration,\n changeOption\n );\n }\n }\n\n // when move pointer is held in outside\n private _atOutside(pos: Axis) {\n if (this._isOutside) {\n return this._axisManager.map(pos, (v, opt) => {\n const tn = opt.range[0] - (opt.bounce[0] as number);\n const tx = opt.range[1] + (opt.bounce[1] as number);\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n return this._axisManager.map(pos, (v, opt) => {\n const min = opt.range[0];\n const max = opt.range[1];\n const out = opt.bounce;\n const circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return (\n min - this._animationManager.interpolate(min - v, out[0] as number)\n );\n } else if (v > max) {\n // right\n return (\n max + this._animationManager.interpolate(v - max, out[1] as number)\n );\n }\n return v;\n });\n }\n }\n\n private _isEndofAxis(offset: Axis, depaPos: Axis, destPos: Axis) {\n return this._axisManager.every(\n depaPos,\n (value, option, key) =>\n offset[key] === 0 ||\n (depaPos[key] === destPos[key] &&\n isEndofBounce(\n value,\n option.range,\n option.bounce as number[],\n option.circular as boolean[]\n ))\n );\n }\n}\n","import {\n getInsidePosition,\n isCircularable,\n getCirculatedPos,\n getDuration,\n} from \"../Coordinate\";\nimport { Axis, AxisManager } from \"../AxisManager\";\nimport { InterruptManager } from \"../InterruptManager\";\nimport { EventManager, ChangeEventOption } from \"../EventManager\";\nimport {\n requestAnimationFrame,\n cancelAnimationFrame,\n map,\n every,\n filter,\n equal,\n roundNumber,\n getDecimalPlace,\n inversePow,\n} from \"../utils\";\nimport { AxesOption } from \"../Axes\";\nimport {\n AnimationParam,\n ObjectInterface,\n UpdateAnimationOption,\n} from \"../types\";\n\nexport interface AnimationState {\n pos: Axis;\n easingPer: number;\n finished: boolean;\n}\n\nconst clamp = (value: number, min: number, max: number): number => {\n return Math.max(Math.min(value, max), min);\n};\n\nexport abstract class AnimationManager {\n public interruptManager: InterruptManager;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n protected _options: AxesOption;\n protected _animateParam: AnimationParam;\n private _raf: number;\n\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n }) {\n this._options = options;\n this.interruptManager = interruptManager;\n this.eventManager = eventManager;\n this.axisManager = axisManager;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n public abstract interpolate(displacement: number, threshold: number): number;\n\n public abstract updateAnimation(options: UpdateAnimationOption): void;\n\n protected abstract _initState(info: AnimationParam): AnimationState;\n\n protected abstract _getNextState(prevState: AnimationState): AnimationState;\n\n public getDuration(\n depaPos: Axis,\n destPos: Axis,\n wishDuration?: number\n ): number {\n let duration: number;\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n const durations: Axis = map(destPos, (v, k) =>\n getDuration(Math.abs(v - depaPos[k]), this._options.deceleration)\n );\n duration = Object.keys(durations).reduce(\n (max, v) => Math.max(max, durations[v]),\n -Infinity\n );\n }\n return clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n }\n\n public getDisplacement(velocity: number[]): number[] {\n const totalVelocity = Math.pow(\n velocity.reduce((total, v) => total + v * v, 0),\n 1 / velocity.length\n );\n const duration = Math.abs(totalVelocity / -this._options.deceleration);\n return velocity.map((v) => (v / 2) * duration);\n }\n\n public stopAnimation(option?: ChangeEventOption): void {\n if (this._animateParam) {\n const orgPos: Axis = this.axisManager.get();\n const pos: Axis = this.axisManager.map(orgPos, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n );\n if (!every(pos, (v, k) => orgPos[k] === v)) {\n this.eventManager.triggerChange(pos, orgPos, option, !!option);\n }\n this._animateParam = null;\n if (this._raf) {\n cancelAnimationFrame(this._raf);\n }\n this._raf = null;\n this.eventManager.triggerAnimationEnd(!!option?.event);\n }\n }\n\n public getEventInfo(): ChangeEventOption {\n if (\n this._animateParam &&\n this._animateParam.input &&\n this._animateParam.inputEvent\n ) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent,\n };\n } else {\n return null;\n }\n }\n\n public restore(option: ChangeEventOption): void {\n const pos: Axis = this.axisManager.get();\n const destPos: Axis = this.axisManager.map(pos, (v, opt) =>\n Math.min(opt.range[1], Math.max(opt.range[0], v))\n );\n this.stopAnimation();\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n }\n\n public animationEnd(): void {\n const beforeParam: ChangeEventOption = this.getEventInfo();\n this._animateParam = null;\n\n // for Circular\n const circularTargets = this.axisManager.filter(\n this.axisManager.get(),\n (v, opt) => isCircularable(v, opt.range, opt.circular as boolean[])\n );\n if (Object.keys(circularTargets).length > 0) {\n this.setTo(\n this.axisManager.map(circularTargets, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n )\n );\n }\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerAnimationEnd(!!beforeParam);\n if (this.axisManager.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n }\n\n public finish(isTrusted: boolean): void {\n this._animateParam = null;\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerFinish(isTrusted);\n }\n\n public getUserControl(param: AnimationParam): {\n destPos: Axis;\n duration: number;\n } {\n const userWish = param.setTo();\n userWish.destPos = this.axisManager.get(userWish.destPos);\n userWish.duration = clamp(\n userWish.duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n return userWish;\n }\n\n public animateTo(\n destPos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): void {\n this.stopAnimation();\n const param: AnimationParam = this._createAnimationParam(\n destPos,\n duration,\n option\n );\n const depaPos = { ...param.depaPos };\n const retTrigger = this.eventManager.triggerAnimationStart(param);\n\n // to control\n const userWish = this.getUserControl(param);\n\n // You can't stop the 'animationStart' event when 'circular' is true.\n if (\n !retTrigger &&\n this.axisManager.every(userWish.destPos, (v, opt) =>\n isCircularable(v, opt.range, opt.circular as boolean[])\n )\n ) {\n console.warn(\n \"You can't stop the 'animation' event when 'circular' is true.\"\n );\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n const inputEvent = option?.event || null;\n this._animateLoop(\n {\n depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axisManager.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent,\n input: option?.input || null,\n },\n () => this.animationEnd()\n );\n }\n }\n\n public setTo(pos: Axis, duration: number = 0) {\n const axes: string[] = Object.keys(pos);\n const orgPos: Axis = this.axisManager.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n this.interruptManager.setInterrupt(true);\n let movedPos = filter(pos, (v, k) => orgPos[k] !== v);\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axisManager.map(movedPos, (v, opt) => {\n const { range, circular } = opt;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular as boolean[]);\n }\n });\n\n if (equal(movedPos, orgPos)) {\n return this;\n }\n\n if (duration > 0) {\n this.animateTo(movedPos, duration);\n } else {\n this.stopAnimation();\n this.eventManager.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n }\n\n public setBy(pos: Axis, duration = 0) {\n return this.setTo(\n map(this.axisManager.get(Object.keys(pos)), (v, k) => v + pos[k]),\n duration\n );\n }\n\n private _createAnimationParam(\n pos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): AnimationParam {\n const depaPos: Axis = this.axisManager.get();\n const destPos: Axis = pos;\n const inputEvent = option?.event || null;\n return {\n depaPos,\n destPos,\n duration: clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n ),\n delta: this.axisManager.getDelta(depaPos, destPos),\n inputEvent,\n input: option?.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd,\n };\n }\n\n private _animateLoop(param: AnimationParam, complete: () => void): void {\n if (param.duration) {\n this._animateParam = {\n ...param,\n startTime: new Date().getTime(),\n };\n const originalIntendedPos = map(param.destPos, (v) => v);\n let state = this._initState(this._animateParam);\n\n const loop = () => {\n this._raf = null;\n const animateParam = this._animateParam;\n const nextState = this._getNextState(state);\n const isCanceled = !this.eventManager.triggerChange(\n nextState.pos,\n state.pos\n );\n\n state = nextState;\n\n if (nextState.finished) {\n animateParam.destPos = this._getFinalPos(\n animateParam.destPos,\n originalIntendedPos\n );\n if (\n !equal(\n animateParam.destPos,\n this.axisManager.get(Object.keys(animateParam.destPos))\n )\n ) {\n this.eventManager.triggerChange(\n animateParam.destPos,\n nextState.pos\n );\n }\n complete();\n return;\n } else if (isCanceled) {\n this.finish(false);\n } else {\n this._raf = requestAnimationFrame(loop);\n }\n };\n loop();\n } else {\n this.eventManager.triggerChange(param.destPos);\n complete();\n }\n }\n\n /**\n * Get estimated final value.\n *\n * If destPos is within the 'error range' of the original intended position, the initial intended position is returned.\n * - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100;\n * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos.\n * - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123\n * @param originalIntendedPos\n * @param destPos\n */\n private _getFinalPos(\n destPos: ObjectInterface,\n originalIntendedPos: ObjectInterface\n ): Axis {\n // compare destPos and originalIntendedPos\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const ERROR_LIMIT = 0.000001;\n const finalPos = map(destPos, (value, key) => {\n if (\n value >= originalIntendedPos[key] - ERROR_LIMIT &&\n value <= originalIntendedPos[key] + ERROR_LIMIT\n ) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n const roundUnit = this._getRoundUnit(value, key);\n const result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n }\n\n private _getRoundUnit(val: number, key: string): number {\n const roundUnit = this._options.round; // manual mode\n let minRoundUnit = null; // auto mode\n\n // auto mode\n if (!roundUnit) {\n // Get minimum round unit\n const options = this.axisManager.getAxisOptions(key);\n minRoundUnit = inversePow(\n Math.max(\n getDecimalPlace(options.range[0]),\n getDecimalPlace(options.range[1]),\n getDecimalPlace(val)\n )\n );\n }\n\n return minRoundUnit || roundUnit;\n }\n}\n","import { AxesOption } from \"../Axes\";\nimport { Axis } from \"../AxisManager\";\nimport { getCirculatedPos } from \"../Coordinate\";\nimport { AnimationParam, UpdateAnimationOption } from \"../types\";\nimport { map } from \"../utils\";\n\nimport { AnimationManager, AnimationState } from \"./AnimationManager\";\n\nexport class EasingManager extends AnimationManager {\n protected _useDuration = true;\n protected _options: AxesOption;\n private _durationOffset: number;\n private _initialEasingPer: number;\n private _prevEasingPer: number;\n\n public interpolate(displacement: number, threshold: number): number {\n const initSlope = this._easing(0.00001) / 0.00001;\n return this._easing(displacement / (threshold * initSlope)) * threshold;\n }\n\n public updateAnimation(options: UpdateAnimationOption): void {\n const animateParam = this._animateParam;\n if (!animateParam) {\n return;\n }\n\n const diffTime = new Date().getTime() - animateParam.startTime;\n const pos = options?.destPos || animateParam.destPos;\n const duration = options?.duration || animateParam.duration;\n if (options?.restart || duration <= diffTime) {\n this.setTo(pos, duration - diffTime);\n return;\n }\n if (options?.destPos) {\n const currentPos = this.axisManager.get();\n // When destination is changed, new delta should be calculated as remaining percent.\n // For example, moving x:0, y:0 to x:200, y:200 and it has current easing percent of 92%. coordinate is x:184 and y:184\n // If destination changes to x:300, y:300. xdelta:200, ydelta:200 changes to xdelta:116, ydelta:116 and use remaining easingPer as 100%, not 8% as previous.\n // Therefore, original easingPer by time is kept. And divided by (1 - self._initialEasingPer) which means new total easing percent. Like calculating 8% as 100%.\n this._initialEasingPer = this._prevEasingPer;\n animateParam.delta = this.axisManager.getDelta(currentPos, pos);\n animateParam.destPos = pos;\n }\n if (options?.duration) {\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n // Use durationOffset for keeping animation ratio after duration is changed.\n // newRatio = (diffTime + newDurationOffset) / newDuration = oldRatio\n // newDurationOffset = oldRatio * newDuration - diffTime\n this._durationOffset = ratio * duration - diffTime;\n animateParam.duration = duration;\n }\n }\n\n protected _initState(info: AnimationParam): AnimationState {\n this._initialEasingPer = 0;\n this._prevEasingPer = 0;\n this._durationOffset = 0;\n return {\n pos: info.depaPos,\n easingPer: 0,\n finished: false,\n };\n }\n\n protected _getNextState(prevState: AnimationState): AnimationState {\n const animateParam = this._animateParam;\n const prevPos = prevState.pos;\n const destPos = animateParam.destPos;\n const directions = map(prevPos, (value, key) => {\n return value <= destPos[key] ? 1 : -1;\n });\n const diffTime = new Date().getTime() - animateParam.startTime;\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n const easingPer = this._easing(ratio);\n\n const toPos: Axis = this.axisManager.map(prevPos, (pos, options, key) => {\n const nextPos =\n ratio >= 1\n ? destPos[key]\n : pos +\n (animateParam.delta[key] * (easingPer - this._prevEasingPer)) /\n (1 - this._initialEasingPer);\n\n // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n const circulatedPos = getCirculatedPos(\n nextPos,\n options.range,\n options.circular as boolean[]\n );\n if (nextPos !== circulatedPos) {\n // circular\n const rangeOffset =\n directions[key] * (options.range[1] - options.range[0]);\n\n destPos[key] -= rangeOffset;\n prevPos[key] -= rangeOffset;\n }\n return circulatedPos;\n });\n this._prevEasingPer = easingPer;\n return {\n pos: toPos,\n easingPer,\n finished: easingPer >= 1,\n };\n }\n\n private _easing(p: number): number {\n return p > 1 ? 1 : this._options.easing(p);\n }\n}\n","import Component from \"@egjs/component\";\n\nimport { EventManager } from \"./EventManager\";\nimport { InterruptManager } from \"./InterruptManager\";\nimport { AxisManager, AxisOption, Axis } from \"./AxisManager\";\nimport { InputObserver } from \"./InputObserver\";\nimport {\n TRANSFORM,\n DIRECTION_NONE,\n DIRECTION_LEFT,\n DIRECTION_RIGHT,\n DIRECTION_UP,\n DIRECTION_DOWN,\n DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL,\n DIRECTION_ALL,\n} from \"./const\";\nimport { InputType } from \"./inputType/InputType\";\nimport { AxesEvents, ObjectInterface, UpdateAnimationOption } from \"./types\";\nimport { EasingManager } from \"./animation/EasingManager\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface AxesOption {\n easing?: (x: number) => number;\n maximumDuration?: number;\n minimumDuration?: number;\n deceleration?: number;\n interruptable?: boolean;\n round?: number;\n nested?: boolean;\n}\n\n/**\n * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system.\n * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {Number[]} [range] The coordinate of range 좌표 범위\n * @param {Number} [range[0]=0] The coordinate of the minimum 최소 좌표\n * @param {Number} [range[1]=0] The coordinate of the maximum 최대 좌표\n * @param {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바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @param {Number} [bounce[0]=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @param {Number} [bounce[1]=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @param {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.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @param {Boolean} [circular[0]=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @param {Boolean} [circular[1]=false] Indicates whether to circulate to the coordinate of the maximum 최대 좌표 방향의 순환 여부\n **/\n\n/**\n * @typedef {Object} AxesOption The option object of the eg.Axes module\n * @ko eg.Axes 모듈의 옵션 객체\n * @param {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @param {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @param {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @param {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @param {Boolean} [interruptable=true] Indicates whether an animation is interruptible.\n * - true: It can be paused or stopped by user action or the API.\n * - false: It cannot be paused or stopped by user action or the API while it is running.\n * 진행 중인 애니메이션 중지 가능 여부.\n * - true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다.\n * - false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다\n * @param {Number} [round=null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)\n * [Details](https://github.com/naver/egjs-axes/wiki/round-option)반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95).\n * [상세내용](https://github.com/naver/egjs-axes/wiki/round-option)\n * @param {Boolean} [nested=false] Whether the event propagates to other instances when the coordinates reach the end of the movable area 좌표가 이동 가능한 영역의 끝까지 도달했을 때 다른 인스턴스들로의 이벤트 전파 여부\n **/\n\n/**\n * 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.\n * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다.\n * @extends eg.Component\n *\n * @param {Object.} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {AxesOption} [options={}] The option object of the eg.Axes moduleeg.Axes 모듈의 옵션 객체\n * @param {Object.} [startPos=null] The coordinates to be moved when creating an instance. not triggering change event.인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음.\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n * ```js\n * // 1. Initialize eg.Axes\n * const axes = new eg.Axes({\n *\tsomething1: {\n *\t\trange: [0, 150],\n *\t\tbounce: 50\n *\t},\n *\tsomething2: {\n *\t\trange: [0, 200],\n *\t\tbounce: 100\n *\t},\n *\tsomethingN: {\n *\t\trange: [1, 10],\n *\t}\n * }, {\n * deceleration : 0.0024\n * });\n *\n * // 2. attach event handler\n * axes.on({\n *\t\"hold\" : function(evt) {\n *\t},\n *\t\"release\" : function(evt) {\n *\t},\n *\t\"animationStart\" : function(evt) {\n *\t},\n *\t\"animationEnd\" : function(evt) {\n *\t},\n *\t\"change\" : function(evt) {\n *\t}\n * });\n *\n * // 3. Initialize inputTypes\n * const panInputArea = new eg.Axes.PanInput(\"#area\", {\n *\tscale: [0.5, 1]\n * });\n * const panInputHmove = new eg.Axes.PanInput(\"#hmove\");\n * const panInputVmove = new eg.Axes.PanInput(\"#vmove\");\n * const pinchInputArea = new eg.Axes.PinchInput(\"#area\", {\n *\tscale: 1.5\n * });\n *\n * // 4. Connect eg.Axes and InputTypes\n * // [PanInput] When the mouse or touchscreen is down and moved.\n * // Connect the 'something2' axis to the mouse or touchscreen x position and\n * // connect the 'somethingN' axis to the mouse or touchscreen y position.\n * axes.connect([\"something2\", \"somethingN\"], panInputArea); // or axes.connect(\"something2 somethingN\", panInputArea);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position.\n * axes.connect([\"something1\"], panInputHmove); // or axes.connect(\"something1\", panInputHmove);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position.\n * axes.connect([\"\", \"something2\"], panInputVmove); // or axes.connect(\" something2\", panInputVmove);\n *\n * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something2\", pinchInputArea);\n * ```\n */\nclass Axes extends Component {\n /**\n * @name VERSION\n * @desc Version info string\n * @ko 버전정보 문자열\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.VERSION; // ex) 3.3.3\n * ```\n */\n public static VERSION = \"#__VERSION__#\";\n /* eslint-disable */\n // for tree shaking\n public static PanInput;\n public static PinchInput;\n public static WheelInput;\n public static MoveKeyInput;\n public static RotatePanInput;\n /* eslint-enable */\n\n /**\n * @name TRANSFORM\n * @desc Returns the transform attribute with CSS vendor prefixes.\n * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다.\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n * ```\n */\n public static TRANSFORM = TRANSFORM;\n /**\n * @name DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n public static DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name DIRECTION_UP\n * @constant\n * @type {Number}\n */\n public static DIRECTION_UP = DIRECTION_UP;\n /**\n * @name DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n public static DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_ALL = DIRECTION_ALL;\n\n public options: AxesOption;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n public interruptManager: InterruptManager;\n public animationManager: AnimationManager;\n public inputObserver: InputObserver;\n private _inputs: InputType[] = [];\n\n /**\n *\n */\n public constructor(\n public axis: ObjectInterface = {},\n options: AxesOption = {},\n startPos: Axis = null\n ) {\n super();\n this.options = {\n ...{\n easing: (x) => {\n return 1 - Math.pow(1 - x, 3);\n },\n interruptable: true,\n maximumDuration: Infinity,\n minimumDuration: 0,\n deceleration: 0.0006,\n round: null,\n nested: false,\n },\n ...options,\n };\n\n this.interruptManager = new InterruptManager(this.options);\n this.axisManager = new AxisManager(this.axis);\n this.eventManager = new EventManager(this);\n this.animationManager = new EasingManager(this);\n this.inputObserver = new InputObserver(this);\n this.eventManager.setAnimationManager(this.animationManager);\n if (startPos) {\n this.eventManager.triggerChange(startPos);\n }\n }\n\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @param {(String[]|String)} axes The name of the axis to associate with inputType inputType과 연결할 축의 이름\n * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes eg.Axes의 축과 연결할 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * axes.connect(\"x\", new eg.Axes.PanInput(\"#area1\"))\n * .connect(\"x xOther\", new eg.Axes.PanInput(\"#area2\"))\n * .connect(\" xOther\", new eg.Axes.PanInput(\"#area3\"))\n * .connect([\"x\"], new eg.Axes.PanInput(\"#area4\"))\n * .connect([\"xOther\", \"x\"], new eg.Axes.PanInput(\"#area5\"))\n * .connect([\"\", \"xOther\"], new eg.Axes.PanInput(\"#area6\"));\n * ```\n */\n public connect(axes: string[] | string, inputType: InputType) {\n let mapped: string[];\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n }\n\n // check same instance\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.inputObserver);\n this._inputs.push(inputType);\n return this;\n }\n\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * const input1 = new eg.Axes.PanInput(\"#area1\");\n * const input2 = new eg.Axes.PanInput(\"#area2\");\n * const input3 = new eg.Axes.PanInput(\"#area3\");\n *\n * axes.connect(\"x\", input1);\n * .connect(\"x xOther\", input2)\n * .connect([\"xOther\", \"x\"], input3);\n *\n * axes.disconnect(input1); // disconnects input1\n * axes.disconnect(); // disconnects all of them\n * ```\n */\n public disconnect(inputType?: InputType) {\n if (inputType) {\n const index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach((v) => v.disconnect());\n this._inputs = [];\n }\n return this;\n }\n\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.get(); // {\"x\": 0, \"xOther\": -100, \"zoom\": 50}\n * axes.get([\"x\", \"zoom\"]); // {\"x\": 0, \"zoom\": 50}\n * ```\n */\n public get(axes?: string[]) {\n return this.axisManager.get(axes);\n }\n\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setTo({\"x\": 30, \"zoom\": 60});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setTo({\"x\": 100, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": 60, \"zoom\": 60}\n * ```\n */\n public setTo(pos: Axis, duration = 0) {\n this.animationManager.setTo(pos, duration);\n return this;\n }\n\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setBy({\"x\": 30, \"zoom\": 10});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setBy({\"x\": 70, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": -40, \"zoom\": 60}\n * ```\n */\n public setBy(pos: Axis, duration = 0) {\n this.animationManager.setBy(pos, duration);\n return this;\n }\n\n /**\n * Stop an animation in progress.\n * @ko 재생 중인 애니메이션을 정지한다.\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * });\n *\n * axes.setTo({\"x\": 10}, 1000); // start animatation\n *\n * // after 500 ms\n * axes.stopAnimation(); // stop animation during movement.\n * ```\n */\n public stopAnimation() {\n this.animationManager.stopAnimation();\n return this;\n }\n\n /**\n * Change the destination of an animation in progress.\n * @ko 재생 중인 애니메이션의 목적지와 진행 시간을 변경한다.\n * @param {UpdateAnimationOption} pos The coordinate to move to 이동할 좌표\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 200]\n * },\n * \"y\": {\n * range: [0, 200]\n * }\n * });\n *\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 500 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}}); // animation will end after 500 ms, at {\"x\": 100, \"y\": 100}\n *\n * // after 500 ms\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 700 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}, duration: 1500, restart: true}); // this works same as axes.setTo({\"x\": 100, \"y\": 100}, 800) since restart is true.\n * ```\n */\n public updateAnimation(options: UpdateAnimationOption) {\n this.animationManager.updateAnimation(options);\n return this;\n }\n\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.isBounceArea([\"x\"]);\n * axes.isBounceArea([\"x\", \"zoom\"]);\n * axes.isBounceArea();\n * ```\n */\n public isBounceArea(axes?: string[]) {\n return this.axisManager.isOutside(axes);\n }\n\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n */\n public destroy() {\n this.disconnect();\n this.eventManager.destroy();\n }\n}\n\nexport default Axes;\n","/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport {\n IS_IOS_SAFARI,\n IOS_EDGE_THRESHOLD,\n DIRECTION_NONE,\n DIRECTION_VERTICAL,\n DIRECTION_HORIZONTAL,\n DIRECTION_ALL,\n MOUSE_LEFT,\n} from \"../const\";\nimport { ActiveEvent, InputEventType } from \"../types\";\n\nimport {\n convertInputType,\n InputType,\n InputTypeObserver,\n toAxis,\n} from \"./InputType\";\n\nexport interface PanInputOption {\n inputType?: string[];\n inputButton?: string[];\n scale?: number[];\n thresholdAngle?: number;\n threshold?: number;\n iOSEdgeSwipeThreshold?: number;\n releaseOnScroll?: boolean;\n touchAction?: string;\n}\n\n// get user's direction\nexport const getDirectionByAngle = (\n angle: number,\n thresholdAngle: number\n): number => {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n const toAngle = Math.abs(angle);\n\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle\n ? DIRECTION_VERTICAL\n : DIRECTION_HORIZONTAL;\n};\n\nexport const useDirection = (checkType, direction, userDirection?): boolean => {\n if (userDirection) {\n return !!(\n direction === DIRECTION_ALL ||\n (direction & checkType && userDirection & checkType)\n );\n } else {\n return !!(direction & checkType);\n }\n};\n\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @param {String[]} [inputType=[\"touch\", \"mouse\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - mouse: Mouse\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - mouse: 마우스\n * - pointer: 마우스 및 터치\n * @param {String[]} [inputButton=[\"left\"]] List of buttons to allow input\n * - left: Left mouse button and normal touch\n * - middle: Mouse wheel press\n * - right: Right mouse button 입력을 허용할 버튼 목록\n * - left: 마우스 왼쪽 버튼\n * - middle: 마우스 휠 눌림\n * - right: 마우스 오른쪽 버튼 \n * @param {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] horizontal axis scale 수평축 배율\n * @param {Number} [scale[1]=1] vertical axis scale 수직축 배율\n * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @param {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @param {String} [touchAction=null] Value that overrides the element's \"touch-action\" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다.\n **/\n/**\n * 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.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\n * ```js\n * const pan = new eg.Axes.PanInput(\"#area\", {\n * \t\tinputType: [\"touch\"],\n * \t\tscale: [1, 1.3],\n * });\n *\n * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something2\", \"somethingN\"], pan); // or axes.connect(\"something2 somethingN\", pan);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something1\"], pan); // or axes.connect(\"something1\", pan);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"\", \"something2\"], pan); // or axes.connect(\" something2\", pan);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module eg.Axes.PanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options={}] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n */\nexport class PanInput implements InputType {\n public options: PanInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n protected _observer: InputTypeObserver;\n protected _direction: number;\n protected _enabled = false;\n protected _activeEvent: ActiveEvent = null;\n private _originalCssProps: { [key: string]: string };\n private _atRightEdge = false;\n private _rightEdgeTimer = 0;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n this.element = $(el);\n this.options = {\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n inputButton: [MOUSE_LEFT],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n releaseOnScroll: false,\n touchAction: null,\n ...options,\n };\n this._onPanstart = this._onPanstart.bind(this);\n this._onPanmove = this._onPanmove.bind(this);\n this._onPanend = this._onPanend.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n const useHorizontal = !!axes[0];\n const useVertical = !!axes[1];\n if (useHorizontal && useVertical) {\n this._direction = DIRECTION_ALL;\n } else if (useHorizontal) {\n this._direction = DIRECTION_HORIZONTAL;\n } else if (useVertical) {\n this._direction = DIRECTION_VERTICAL;\n } else {\n this._direction = DIRECTION_NONE;\n }\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n }\n this._attachElementEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n this._direction\n );\n return this;\n }\n\n public disconnect() {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n this._direction = DIRECTION_NONE;\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n protected _onPanstart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n const edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n\n this._observer.hold(this, panEvent);\n this._atRightEdge =\n IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold;\n this._attachWindowEvent(activeEvent);\n activeEvent.prevEvent = panEvent;\n }\n }\n\n protected _onPanmove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n const { iOSEdgeSwipeThreshold, releaseOnScroll } = this.options;\n const userDirection = getDirectionByAngle(\n panEvent.angle,\n this.options.thresholdAngle\n );\n\n if (releaseOnScroll && !panEvent.srcEvent.cancelable) {\n this._onPanend(event);\n return;\n }\n\n if (activeEvent.prevEvent && IS_IOS_SAFARI) {\n const swipeLeftToRight = panEvent.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this._forceRelease();\n return;\n } else if (this._atRightEdge) {\n clearTimeout(this._rightEdgeTimer);\n\n // - is right to left\n const swipeRightToLeft = panEvent.deltaX < -iOSEdgeSwipeThreshold;\n\n if (swipeRightToLeft) {\n this._atRightEdge = false;\n } else {\n // iOS swipe right => left\n this._rightEdgeTimer = window.setTimeout(\n () => this._forceRelease(),\n 100\n );\n }\n }\n }\n const offset: number[] = this._getOffset(\n [panEvent.offsetX, panEvent.offsetY],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection),\n useDirection(DIRECTION_VERTICAL, this._direction, userDirection),\n ]\n );\n const prevent = offset.some((v) => v !== 0);\n\n if (prevent) {\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n }\n panEvent.preventSystemEvent = prevent;\n if (prevent) {\n this._observer.change(this, panEvent, toAxis(this.axes, offset));\n }\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this._enabled || activeEvent.getTouches(event) !== 0) {\n return;\n }\n this._detachWindowEvent(activeEvent);\n clearTimeout(this._rightEdgeTimer);\n const prevEvent = activeEvent.prevEvent;\n const velocity = this._getOffset(\n [\n Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1),\n Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1),\n ],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction),\n useDirection(DIRECTION_VERTICAL, this._direction),\n ]\n );\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, velocity);\n }\n\n protected _attachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.addEventListener(event, this._onPanmove, { passive: false });\n });\n activeEvent?.end.forEach((event) => {\n window.addEventListener(event, this._onPanend, { passive: false });\n });\n }\n\n protected _detachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.removeEventListener(event, this._onPanmove);\n });\n activeEvent?.end.forEach((event) => {\n window.removeEventListener(event, this._onPanend);\n });\n }\n\n protected _getOffset(properties: number[], direction: boolean[]): number[] {\n const offset: number[] = [0, 0];\n const scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n return offset;\n }\n\n private _attachElementEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element?.addEventListener(event, this._onPanstart);\n });\n // adding event listener to element prevents invalid behavior in iOS Safari\n activeEvent.move.forEach((event) => {\n this.element?.addEventListener(event, this._voidFunction);\n });\n }\n\n private _detachElementEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element?.removeEventListener(event, this._onPanstart);\n });\n activeEvent?.move.forEach((event) => {\n this.element?.removeEventListener(event, this._voidFunction);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _forceRelease = () => {\n const activeEvent = this._activeEvent;\n const prevEvent = activeEvent.prevEvent;\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [0, 0]);\n this._detachWindowEvent(activeEvent);\n };\n\n private _voidFunction = () => {};\n}\n","import { ExtendedEvent } from \"../types\";\nimport Axes from \"../Axes\";\nimport { getAngle } from \"../utils\";\n\nimport { toAxis } from \"./InputType\";\nimport { PanInput, PanInputOption } from \"./PanInput\";\n\n/**\n * A module that passes the angle moved by touch to Axes and uses one axis of rotation.\n * [Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.\n * [상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\n * ```js\n * const input = new eg.Axes.RotatePanInput(\"#area\");\n *\n * var axes = new eg.Axes({\n *\t// property name('angle') could be anything you want (eg. x, y, z...)\n * \tangle: {\n * \t\trange: [-180, 180] // from -180deg to 180deg\n * \t}\n * });\n *\n * axes.connect(\"angle\", input)\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n * @extends PanInput\n */\nexport class RotatePanInput extends PanInput {\n private _rotateOrigin: number[];\n private _prevAngle: number;\n private _prevQuadrant: number = null;\n private _lastDiff = 0;\n private _coefficientForDistanceToAngle: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n super(el, options);\n }\n\n public mapAxes(axes: string[]) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n }\n\n protected _onPanstart(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n const rect = this.element.getBoundingClientRect();\n\n this._observer.hold(this, panEvent);\n this._attachWindowEvent(activeEvent);\n // TODO: how to do if element is ellipse not circle.\n this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360\n // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin\n this._rotateOrigin = [\n rect.left + (rect.width - 1) / 2,\n rect.top + (rect.height - 1) / 2,\n ];\n\n // init angle.\n this._prevAngle = null;\n\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanmove(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this.isEnabled()) {\n return;\n }\n const prevEvent = activeEvent.prevEvent;\n this._triggerChange(prevEvent);\n const vx = prevEvent.velocityX;\n const vy = prevEvent.velocityY;\n const velocity =\n Math.sqrt(vx * vx + vy * vy) * (this._lastDiff > 0 ? -1 : 1); // clockwise\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [\n velocity * this._coefficientForDistanceToAngle,\n ]);\n this._detachWindowEvent(activeEvent);\n }\n\n private _triggerChange(event: ExtendedEvent) {\n const { x, y } = this._getPosFromOrigin(event.center.x, event.center.y);\n const angle = getAngle(x, y);\n const positiveAngle = angle < 0 ? 360 + angle : angle;\n const quadrant = this._getQuadrant(event.center.x, event.center.y);\n const diff = this._getDifference(\n this._prevAngle,\n positiveAngle,\n this._prevQuadrant,\n quadrant\n );\n\n this._prevAngle = positiveAngle;\n this._prevQuadrant = quadrant;\n\n if (diff === 0) {\n return;\n }\n\n this._lastDiff = diff;\n this._observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise\n }\n\n private _getDifference(\n prevAngle: number,\n angle: number,\n prevQuadrant: number,\n quadrant: number\n ) {\n let diff: number;\n\n if (prevAngle === null) {\n diff = 0;\n } else if (prevQuadrant === 1 && quadrant === 4) {\n diff = -prevAngle - (360 - angle);\n } else if (prevQuadrant === 4 && quadrant === 1) {\n diff = 360 - prevAngle + angle;\n } else {\n diff = angle - prevAngle;\n }\n\n return diff;\n }\n\n private _getPosFromOrigin(posX: number, posY: number) {\n return {\n x: posX - this._rotateOrigin[0],\n y: this._rotateOrigin[1] - posY,\n };\n }\n\n private _getQuadrant(posX: number, posY: number) {\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n const { x, y } = this._getPosFromOrigin(posX, posY);\n let q = 0;\n\n if (x >= 0 && y >= 0) {\n q = 1;\n } else if (x < 0 && y >= 0) {\n q = 2;\n } else if (x < 0 && y < 0) {\n q = 3;\n } else if (x >= 0 && y < 0) {\n q = 4;\n }\n return q;\n }\n}\n","import { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport { ActiveEvent, InputEventType } from \"../types\";\nimport { DIRECTION_ALL } from \"../const\";\n\nimport {\n toAxis,\n convertInputType,\n InputType,\n InputTypeObserver,\n} from \"./InputType\";\n\nexport interface PinchInputOption {\n scale?: number;\n threshold?: number;\n inputType?: string[];\n touchAction?: string;\n}\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @param {String[]} [inputType=[\"touch\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - pointer: 마우스 및 터치\n * @param {String} [touchAction=\"none\"] Value that overrides the element's \"touch-action\" css property. It is set to \"none\" to prevent scrolling during touch. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 터치 도중 스크롤을 방지하기 위해 \"none\" 으로 설정되어 있다.\n **/\n\n/**\n * 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.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\n * ```js\n * const pinch = new eg.Axes.PinchInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something\", pinch);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module eg.Axes.PinchInput 모듈을 사용할 엘리먼트\n * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput moduleeg.Axes.PinchInput 모듈의 옵션 객체\n */\nexport class PinchInput implements InputType {\n public options: PinchInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _pinchFlag = false;\n private _enabled = false;\n private _originalCssProps: { [key: string]: string };\n private _activeEvent: ActiveEvent = null;\n private _baseValue: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PinchInputOption) {\n this.element = $(el);\n this.options = {\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n touchAction: \"none\",\n ...options,\n };\n this._onPinchStart = this._onPinchStart.bind(this);\n this._onPinchMove = this._onPinchMove.bind(this);\n this._onPinchEnd = this._onPinchEnd.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachEvent();\n }\n this._attachEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n DIRECTION_ALL\n );\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onPinchStart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventStart(event);\n if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) {\n return;\n }\n\n this._baseValue = this._observer.get(this)[this.axes[0]];\n this._observer.hold(this, event);\n this._pinchFlag = true;\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchMove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventMove(event);\n if (\n !pinchEvent ||\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) !== 2\n ) {\n return;\n }\n\n const offset = this._getOffset(\n pinchEvent.scale,\n activeEvent.prevEvent.scale\n );\n this._observer.change(this, event, toAxis(this.axes, [offset]));\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchEnd(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) >= 2\n ) {\n return;\n }\n\n activeEvent.onRelease();\n this._observer.release(this, event, [0], 0);\n this._baseValue = null;\n this._pinchFlag = false;\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element.addEventListener(event, this._onPinchStart, false);\n });\n activeEvent.move.forEach((event) => {\n this.element.addEventListener(event, this._onPinchMove, false);\n });\n activeEvent.end.forEach((event) => {\n this.element.addEventListener(event, this._onPinchEnd, false);\n });\n }\n\n private _detachEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchStart, false);\n });\n activeEvent?.move.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchMove, false);\n });\n activeEvent?.end.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchEnd, false);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _getOffset(pinchScale: number, prev: number = 1): number {\n return this._baseValue * (pinchScale - prev) * this.options.scale;\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport interface WheelInputOption {\n scale?: number;\n releaseDelay?: number;\n useNormalized?: boolean;\n useAnimation?: boolean;\n}\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [releaseDelay=300] Millisecond that trigger release event after last input마지막 입력 이후 release 이벤트가 트리거되기까지의 밀리초\n * @param {Boolean} [useNormalized=true] Whether to calculate scroll speed the same in all browsers모든 브라우저에서 스크롤 속도를 동일하게 처리할지 여부\n * @param {Boolean} [useAnimation=false] Whether to process coordinate changes through the mouse wheel as a continuous animation마우스 휠을 통한 좌표 변화를 연속적인 애니메이션으로 처리할지 여부\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis.\n * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const wheel = new eg.Axes.WheelInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when the mousewheel is moved.\n * axes.connect(\"something\", wheel);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module eg.Axes.WheelInput 모듈을 사용할 엘리먼트\n * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput moduleeg.Axes.WheelInput 모듈의 옵션 객체\n */\nexport class WheelInput implements InputType {\n public options: WheelInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: WheelInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: 1,\n releaseDelay: 300,\n useNormalized: true,\n useAnimation: false,\n },\n ...options,\n };\n this._onWheel = this._onWheel.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onWheel(event: WheelEvent) {\n if (!this._enabled) {\n return;\n }\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n const offset =\n (event.deltaY > 0 ? -1 : 1) *\n this.options.scale *\n (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this._observer.change(\n this,\n event,\n toAxis(this.axes, [offset]),\n this.options.useAnimation\n );\n clearTimeout(this._timer);\n\n this._timer = setTimeout(() => {\n if (this._holding) {\n this._holding = false;\n this._observer.release(this, event, [0]);\n }\n }, this.options.releaseDelay);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"wheel\", this._onWheel);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"wheel\", this._onWheel);\n this._enabled = false;\n this._observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport const KEY_LEFT_ARROW = 37;\nexport const KEY_A = 65;\nexport const KEY_UP_ARROW = 38;\nexport const KEY_W = 87;\nexport const KEY_RIGHT_ARROW = 39;\nexport const KEY_D = 68;\nexport const KEY_DOWN_ARROW = 40;\nexport const KEY_S = 83;\n\n/* eslint-disable */\nconst DIRECTION_REVERSE = -1;\nconst DIRECTION_FORWARD = 1;\nconst DIRECTION_HORIZONTAL = -1;\nconst DIRECTION_VERTICAL = 1;\nconst DELAY = 80;\n/* eslint-enable */\n\nexport interface MoveKeyInputOption {\n scale?: number[];\n}\n\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @param {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @param {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis.\n * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const moveKey = new eg.Axes.MoveKeyInput(\"#area\", {\n * \t\tscale: [1, 1]\n * });\n *\n * // Connect 'x', 'y' axes when the moveKey is pressed.\n * axes.connect([\"x\", \"y\"], moveKey);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트\n * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput moduleeg.Axes.MoveKeyInput 모듈의 옵션 객체\n */\nexport class MoveKeyInput implements InputType {\n public options: MoveKeyInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: MoveKeyInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: [1, 1],\n },\n ...options,\n };\n this._onKeydown = this._onKeydown.bind(this);\n this._onKeyup = this._onKeyup.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n\n // add tabindex=\"0\" to the container for making it focusable\n if (this.element.getAttribute(\"tabindex\") !== \"0\") {\n this.element.setAttribute(\"tabindex\", \"0\");\n }\n\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onKeydown(event: KeyboardEvent) {\n if (!this._enabled) {\n return;\n }\n\n let isMoveKey = true;\n let direction = DIRECTION_FORWARD;\n let move = DIRECTION_HORIZONTAL;\n\n switch (event.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL;\n break;\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL;\n break;\n default:\n isMoveKey = false;\n }\n if (\n (move === DIRECTION_HORIZONTAL && !this.axes[0]) ||\n (move === DIRECTION_VERTICAL && !this.axes[1])\n ) {\n isMoveKey = false;\n }\n if (!isMoveKey) {\n return;\n }\n event.preventDefault();\n const offsets =\n move === DIRECTION_HORIZONTAL\n ? [+this.options.scale[0] * direction, 0]\n : [0, +this.options.scale[1] * direction];\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n clearTimeout(this._timer);\n this._observer.change(this, event, toAxis(this.axes, offsets));\n }\n\n private _onKeyup(event: KeyboardEvent) {\n if (!this._holding) {\n return;\n }\n clearTimeout(this._timer);\n this._timer = setTimeout(() => {\n this._observer.release(this, event, [0, 0]);\n this._holding = false;\n }, DELAY);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"keydown\", this._onKeydown, false);\n this.element.addEventListener(\"keypress\", this._onKeydown, false);\n this.element.addEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"keydown\", this._onKeydown, false);\n this.element.removeEventListener(\"keypress\", this._onKeydown, false);\n this.element.removeEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = false;\n this._observer = null;\n }\n}\n","import Axes from \"./Axes\";\nimport { PanInput } from \"./inputType/PanInput\";\nimport { RotatePanInput } from \"./inputType/RotatePanInput\";\nimport { PinchInput } from \"./inputType/PinchInput\";\nimport { WheelInput } from \"./inputType/WheelInput\";\nimport { MoveKeyInput } from \"./inputType/MoveKeyInput\";\n\nAxes.PanInput = PanInput;\nAxes.RotatePanInput = RotatePanInput;\nAxes.PinchInput = PinchInput;\nAxes.WheelInput = WheelInput;\nAxes.MoveKeyInput = MoveKeyInput;\n\nexport default Axes;\n"],"names":["win","window","navigator","userAgent","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_HORIZONTAL","DIRECTION_UP","DIRECTION_DOWN","DIRECTION_VERTICAL","DIRECTION_ALL","MOUSE_LEFT","MOUSE_RIGHT","MOUSE_MIDDLE","VELOCITY_INTERVAL","IOS_EDGE_THRESHOLD","IS_IOS_SAFARI","getAgent","browser","name","TRANSFORM","document","bodyStyle","head","getElementsByTagName","style","target","i","len","length","PREVENT_DRAG_CSSPROPS","toArray","nodes","el","push","$","param","multi","match","dummy","createElement","innerHTML","childNodes","querySelectorAll","undefined","nodeName","nodeType","jQuery","constructor","prototype","jquery","get","Array","isArray","map","v","raf","requestAnimationFrame","webkitRequestAnimationFrame","caf","cancelAnimationFrame","webkitCancelAnimationFrame","keyInfo_1","oldraf_1","callback","wrapCallback","timestamp","key","setTimeout","performance","now","Date","getTime","clearTimeout","fp","obj","tranformed","k","filter","filtered","every","equal","base","roundNumFunc","roundNumber","num","roundUnit","getRoundFunc","roundNumbers","value","getDecimalPlace","val","isFinite","indexOf","p","e","Math","round","inversePow","n","pow","getAngle","posX","posY","atan2","PI","isCssPropsFromAxes","originalCssProps","same","Object","keys","forEach","prop","setCssProps","element","option","direction","touchActionMap","_a","oldCssProps","touchAction","newCssProps_1","revertCssProps","_axes","pos","roundPos","_getRoundPos","trigger","ComponentEvent","input","inputEvent","event","isTrusted","destPos","depaPos","roundDepa","setTo","_createUserControll","duration","__assign","bounceRatio","_getBounceRatio","holding","animationManager","axisManager","eventInfo","getEventInfo","moveTo","delta","set","isCanceled","off","userControl","toPos","userDuration","options","opt","range","bounce","_options","interruptable","_prevented","prevented","getInsidePosition","circular","toDestPos","targetRange","max","min","isOutside","isEndofBounce","getDuration","distance","deceleration","sqrt","isCircularable","getCirculatedPos","_axis","_complementOptions","_pos","reduce","acc","_this","fullDepaPos","axes","axisOptions","axis","axisOption","test","SUPPORT_TOUCH","SUPPORT_POINTER","SUPPORT_MSPOINTER","SUPPORT_POINTER_EVENTS","preventDefault","removeEventListener","_stopContextMenu","prevEvent","center","_getCenter","movement","_getMovement","x","y","scale","_getScale","angle","deltaX","deltaY","offsetX","offsetY","latestInterval","_latestInterval","timeStamp","deltaTime","velocityX","velocityY","srcEvent","preventSystemEvent","start","end","clientX","clientY","buttonCodeMap","button","_isTouchEvent","buttons","type","inputButton","addEventListener","__extends","_getButton","_isValidButton","_preventMouseButton","extendEvent","prev","EventInput","_baseTouches","touches","_getDistance","identifier","_updatePointerEvent","_removePointerEvent","_firstInputs","_recentInputs","pointerId","addFlag","id","nextSpot","prevSpot","toAxis","source","offset","convertInputType","inputType","hasTouch","hasMouse","hasPointer","PointerEventInput","TouchMouseEventInput","TouchEventInput","MouseEventInput","interruptManager","eventManager","_interruptManager","_eventManager","_axisManager","_animationManager","isInterrupted","changeOption","_isStopped","setInterrupt","stopAnimation","_moveDistance","hold","_isOutside","useAnimation","isInterrupting","nativeEvent","__childrenAxesAlreadyChanged","_atOutside","nested","_isEndofAxis","animateTo","triggerChange","finish","velocity","inputDuration","__childrenAxesAlreadyReleased","displacement","getDisplacement","getDelta","triggerRelease","userWish","getUserControl","isEqual","restore","triggerFinish","tn","tx","out","interpolate","clamp","animationEnd","bind","wishDuration","durations_1","abs","Infinity","minimumDuration","maximumDuration","totalVelocity","total","_animateParam","orgPos_1","_raf","triggerAnimationEnd","beforeParam","circularTargets","_createAnimationParam","retTrigger","triggerAnimationStart","console","warn","_animateLoop","orgPos","movedPos","done","complete","startTime","originalIntendedPos_1","state_1","_initState","loop_1","animateParam","nextState","_getNextState","finished","_getFinalPos","originalIntendedPos","ERROR_LIMIT","finalPos","_getRoundUnit","result","minRoundUnit","getAxisOptions","threshold","initSlope","_easing","diffTime","restart","currentPos","_initialEasingPer","_prevEasingPer","ratio","_durationOffset","info","easingPer","prevState","prevPos","directions","nextPos","circulatedPos","rangeOffset","easing","AnimationManager","startPos","_super","InterruptManager","AxisManager","EventManager","EasingManager","inputObserver","InputObserver","setAnimationManager","mapped","split","concat","_inputs","disconnect","mapAxes","connect","index","splice","setBy","updateAnimation","destroy","Axes","Component","getDirectionByAngle","thresholdAngle","toAngle","useDirection","checkType","userDirection","activeEvent","_activeEvent","onRelease","_observer","release","_detachWindowEvent","iOSEdgeSwipeThreshold","releaseOnScroll","_onPanstart","_onPanmove","_onPanend","useHorizontal","useVertical","_direction","observer","_detachElementEvent","_attachElementEvent","_originalCssProps","_enabled","panEvent","onEventStart","getTouches","cancelable","edgeThreshold","_atRightEdge","innerWidth","_attachWindowEvent","onEventMove","swipeLeftToRight","_forceRelease","_rightEdgeTimer","swipeRightToLeft","_getOffset","prevent","some","stopPropagation","change","onEventEnd","move","passive","properties","_voidFunction","isEnabled","rect","getBoundingClientRect","_coefficientForDistanceToAngle","width","_rotateOrigin","left","top","height","_prevAngle","_triggerChange","vx","vy","_lastDiff","_getPosFromOrigin","positiveAngle","quadrant","_getQuadrant","diff","_getDifference","_prevQuadrant","prevAngle","prevQuadrant","q","PanInput","_onPinchStart","_onPinchMove","_onPinchEnd","_detachEvent","_attachEvent","pinchEvent","_baseValue","_pinchFlag","pinchScale","releaseDelay","useNormalized","_onWheel","_holding","_timer","KEY_LEFT_ARROW","KEY_A","KEY_UP_ARROW","KEY_W","KEY_RIGHT_ARROW","KEY_D","KEY_DOWN_ARROW","KEY_S","DIRECTION_REVERSE","DIRECTION_FORWARD","DELAY","_onKeydown","_onKeyup","getAttribute","setAttribute","isMoveKey","keyCode","offsets","RotatePanInput","PinchInput","WheelInput","MoveKeyInput"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IAEA,IAAIA,GAAJ;;IAEA,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;IACjC;IACAD,EAAAA,GAAG,GAAG;IACJE,IAAAA,SAAS,EAAE;IACTC,MAAAA,SAAS,EAAE;IADF;IADP,GAAN;IAKD,CAPD,MAOO;IACLH,EAAAA,GAAG,GAAGC,MAAN;IACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A6D,KAA7D;IACA,SAAKpX,OAAL,CAAagF,mBAAb,CAAiC,UAAjC,EAA6C,KAAKoS,UAAlD,EAA8D,KAA9D;IACA,SAAKpX,OAAL,CAAagF,mBAAb,CAAiC,OAAjC,EAA0C,KAAKqS,QAA/C,EAAyD,KAAzD;IACA,SAAK3E,QAAL,GAAgB,KAAhB;IACA,SAAKf,SAAL,GAAiB,IAAjB;IACD,GANO;;IAOV,qBAAA;IAAC,GAjKD;;IC1CAX,IAAI,CAAC0E,QAAL,GAAgBA,QAAhB;IACA1E,IAAI,CAAC2G,cAAL,GAAsBA,cAAtB;IACA3G,IAAI,CAAC4G,UAAL,GAAkBA,UAAlB;IACA5G,IAAI,CAAC6G,UAAL,GAAkBA,UAAlB;IACA7G,IAAI,CAAC8G,YAAL,GAAoBA,YAApB;;;;;;;;"} \ No newline at end of file diff --git a/dist/axes.pkgd.min.js b/dist/axes.pkgd.min.js new file mode 100644 index 00000000..2651cce1 --- /dev/null +++ b/dist/axes.pkgd.min.js @@ -0,0 +1,10 @@ +/* +Copyright (c) 2015 NAVER Corp. +name: @egjs/axes +license: MIT +author: NAVER Corp. +repository: https://github.com/naver/egjs-axes +version: 3.3.0 +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t.eg=t.eg||{},t.eg.Axes=e())}(this,function(){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var _=function(){return(_=Object.assign||function(t){for(var e,n=1,i=arguments.length;n=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(){for(var t=[],e=0;e]*)>/)?((n=document.createElement("div")).innerHTML=t,x(n.childNodes)):x(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==r&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in r&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return V(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},W=r.requestAnimationFrame||r.webkitRequestAnimationFrame,H=r.cancelAnimationFrame||r.webkitCancelAnimationFrame;W&&!H?(R={},k=W,W=function(e){var n=k(function(t){R[n]&&e(t)});return R[n]=!0,n},H=function(t){delete R[t]}):W&&H||(W=function(t){return r.setTimeout(function(){t(r.performance&&r.performance.now&&r.performance.now()||(new Date).getTime())},16)},H=r.clearTimeout);function K(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function U(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function q(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function Q(t,n){return q(t,function(t,e){return t===n[e]})}function z(t,e){return ct[e]||(ct[e]=lt(e)),ct[e](t)}function G(t,n){return t&&n?K(t,function(t,e){return z(t,"number"==typeof n?n:n[e])}):t}function Z(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function J(t,e){return 180*Math.atan2(e,t)/Math.PI}function $(e){var n=!0;return Object.keys(N).forEach(function(t){e&&e[t]===N[t]||(n=!1)}),n}function tt(e,t,n){var i,r,s,o=((i={})[1]="auto",i[30]="none",i[L]="pan-x",i[6]="pan-y",i),a={};return e&&e.style&&(r=t.touchAction?t.touchAction:o[n],s=_(_({},N),{"touch-action":"none"===e.style["touch-action"]?"none":r}),Object.keys(s).forEach(function(t){a[t]=e.style[t],e.style[t]=s[t]})),a}function et(e,n){e&&e.style&&n&&Object.keys(n).forEach(function(t){e.style[t]=n[t]})}function nt(t,e,n,i){var r=t,s=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],r=Math.max(s[0],r);return Math.min(s[1],r)}function it(t,e){return te[1]}function rt(t,e,n){return n[1]&&t>e[1]||n[0]&&te.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),dt=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),ft=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return K(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):_(_({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=K(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?st(t,e.range,e.circular):0})),{pos:_({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return q(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return U(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return K(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!it(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var r=this;Object.keys(this._axis).forEach(function(i){r._axis[i]=_({range:[0,100],bounce:[0,0],circular:[!1,!1]},r._axis[i]),["bounce","circular"].forEach(function(t){var e=r._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),_t="ontouchstart"in r,pt="PointerEvent"in r,gt="MSPointerEvent"in r,mt=pt||gt,Et=function(){function t(){var e=this;this._stopContextMenu=function(t){t.preventDefault(),r.removeEventListener("contextmenu",e._stopContextMenu)}}var e=t.prototype;return e.extendEvent=function(t){var e,n=this.prevEvent,i=this._getCenter(t),r=n?this._getMovement(t):{x:0,y:0},s=n?this._getScale(t):1,o=n?J(i.x-n.center.x,i.y-n.center.y):0,a=n?n.deltaX+r.x:r.x,u=n?n.deltaY+r.y:r.y,h=r.x,c=r.y,l=this._latestInterval,v=Date.now(),d=l?v-l.timestamp:0,f=n?n.velocityX:0,_=n?n.velocityY:0;return(!l||16<=d)&&(l&&(f=(e=[(a-l.deltaX)/d,(u-l.deltaY)/d])[0],_=e[1]),this._latestInterval={timestamp:v,deltaX:a,deltaY:u}),{srcEvent:t,scale:s,angle:o,center:i,deltaX:a,deltaY:u,offsetX:h,offsetY:c,velocityX:f,velocityY:_,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},e._getButton=function(t){var e={1:j,2:B,4:Y},n=this._isTouchEvent(t)?j:e[t.buttons];return n||null},e._isTouchEvent=function(t){return-1=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=r._getRoundUnit(t,e);return z(t,n)})},e._getRoundUnit=function(t,e){var n,i,r=this._options.round,s=null;return r||(n=this.axisManager.getAxisOptions(e),i=Math.max(Z(n.range[0]),Z(n.range[1]),Z(t)),s=1/Math.pow(10,i)),s||r},t}()),Tt=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=_({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null,nested:!1},e),i.interruptManager=new dt(i.options),i.axisManager=new ft(i.axis),i.eventManager=new vt(i),i.animationManager=new Pt(i),i.inputObserver=new wt(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}s(t,r);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.3.0",t.TRANSFORM=F,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=L,t.DIRECTION_ALL=30,t}(t),Ot=function(){function t(t,e){var n=this;this.axes=[],this.element=null,this._enabled=!1,this._activeEvent=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this._forceRelease=function(){var t=n._activeEvent,e=t.prevEvent;t.onRelease(),n._observer.release(n,e,[0,0]),n._detachWindowEvent(t)},this._voidFunction=function(){},this.element=V(t),this.options=_({inputType:["touch","mouse","pointer"],inputButton:[j],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1,touchAction:null},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?L:1,this.axes=t},e.connect=function(t){return this._activeEvent&&(this._detachElementEvent(),this._detachWindowEvent(this._activeEvent)),this._attachElementEvent(t),this._originalCssProps=tt(this.element,this.options,this._direction),this},e.disconnect=function(){return this._detachElementEvent(),this._detachWindowEvent(this._activeEvent),$(this._originalCssProps)||et(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n=this._activeEvent,i=n.onEventStart(t,this.options.inputButton);!i||!this._enabled||1window.innerWidth-e,this._attachWindowEvent(n),n.prevEvent=i)},e._onPanmove=function(t){var e=this,n=this._activeEvent,i=n.onEventMove(t,this.options.inputButton);if(i&&this._enabled&&!(1 {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n const el = [];\n for (let i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n return el;\n};\n\nexport const $ = (param, multi = false) => {\n let el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n const match = param.match(/^<([a-z]+)\\s*([^>]*)>/);\n\n // creating element\n if (match) {\n // HTML\n const dummy = document.createElement(\"div\");\n\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === window) {\n // window\n el = param;\n } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) {\n // HTMLElement, Document\n el = param;\n } else if (\n (\"jQuery\" in window && param instanceof jQuery) ||\n param.constructor.prototype.jquery\n ) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map((v) => $(v));\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n return el;\n};\n\nlet raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame;\nlet caf = window.cancelAnimationFrame || window.webkitCancelAnimationFrame;\nif (raf && !caf) {\n const keyInfo = {};\n const oldraf = raf;\n raf = (callback: FrameRequestCallback) => {\n const wrapCallback = (timestamp: number) => {\n if (keyInfo[key]) {\n callback(timestamp);\n }\n };\n const key = oldraf(wrapCallback);\n keyInfo[key] = true;\n return key;\n };\n caf = (key: number) => {\n delete keyInfo[key];\n };\n} else if (!(raf && caf)) {\n raf = (callback: FrameRequestCallback) => {\n return window.setTimeout(() => {\n callback(\n ((window.performance &&\n window.performance.now &&\n window.performance.now()) as number) || new Date().getTime()\n );\n }, 16);\n };\n caf = window.clearTimeout;\n}\n\n/**\n * A polyfill for the window.requestAnimationFrame() method.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame\n * @private\n */\nexport const requestAnimationFrame = (fp) => {\n return raf(fp);\n};\n/**\n * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method.\n * @param {Number} key −\tThe ID value returned through a call to the requestAnimationFrame() method. requestAnimationFrame() 메서드가 반환한 아이디 값\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame\n * @private\n */\nexport const cancelAnimationFrame = (key) => {\n caf(key);\n};\n\nexport const map = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => U\n): ObjectInterface => {\n const tranformed: ObjectInterface = {};\n\n for (const k in obj) {\n if (k) {\n tranformed[k] = callback(obj[k], k);\n }\n }\n return tranformed;\n};\n\nexport const filter = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n): ObjectInterface => {\n const filtered: ObjectInterface = {};\n\n for (const k in obj) {\n if (k && callback(obj[k], k)) {\n filtered[k] = obj[k];\n }\n }\n return filtered;\n};\nexport const every = (\n obj: ObjectInterface,\n callback: (value: T, key: string) => boolean\n) => {\n for (const k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n return true;\n};\nexport const equal = (\n target: ObjectInterface,\n base: ObjectInterface\n): boolean => {\n return every(target, (v, k) => v === base[k]);\n};\n\nconst roundNumFunc = {};\n\nexport const roundNumber = (num: number, roundUnit: number) => {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n};\n\nexport const roundNumbers = (\n num: ObjectInterface,\n roundUnit: ObjectInterface | number\n): ObjectInterface => {\n if (!num || !roundUnit) {\n return num;\n }\n return map(num, (value, key) =>\n roundNumber(\n value,\n typeof roundUnit === \"number\" ? roundUnit : roundUnit[key]\n )\n );\n};\n\nexport const getDecimalPlace = (val: number): number => {\n if (!isFinite(val)) {\n return 0;\n }\n\n const v = `${val}`;\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n let p = 0;\n let e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n }\n\n // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n};\n\nexport const inversePow = (n: number) => {\n // replace Math.pow(10, -n) to solve floating point issue.\n // eg. Math.pow(10, -4) => 0.00009999999999999999\n return 1 / Math.pow(10, n);\n};\n\nexport const getRoundFunc = (v: number) => {\n const p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n\n return (n: number) => {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n};\n\nexport const getAngle = (posX: number, posY: number) => {\n return (Math.atan2(posY, posX) * 180) / Math.PI;\n};\n\nexport const isCssPropsFromAxes = (originalCssProps: {\n [key: string]: string;\n}) => {\n let same = true;\n Object.keys(PREVENT_DRAG_CSSPROPS).forEach((prop) => {\n if (\n !originalCssProps ||\n originalCssProps[prop] !== PREVENT_DRAG_CSSPROPS[prop]\n ) {\n same = false;\n }\n });\n return same;\n};\n\nexport const setCssProps = (\n element: HTMLElement,\n option: PanInputOption | PinchInputOption,\n direction: number\n): { [key: string]: string } => {\n const touchActionMap = {\n [DIRECTION_NONE]: \"auto\",\n [DIRECTION_ALL]: \"none\",\n [DIRECTION_VERTICAL]: \"pan-x\",\n [DIRECTION_HORIZONTAL]: \"pan-y\",\n };\n const oldCssProps = {};\n if (element && element.style) {\n const touchAction = option.touchAction\n ? option.touchAction\n : touchActionMap[direction];\n const newCssProps = {\n ...PREVENT_DRAG_CSSPROPS,\n \"touch-action\":\n element.style[\"touch-action\"] === \"none\" ? \"none\" : touchAction,\n };\n Object.keys(newCssProps).forEach((prop) => {\n oldCssProps[prop] = element.style[prop];\n element.style[prop] = newCssProps[prop];\n });\n }\n return oldCssProps;\n};\n\nexport const revertCssProps = (\n element: HTMLElement,\n originalCssProps: { [key: string]: string }\n): { [key: string]: string } => {\n if (element && element.style && originalCssProps) {\n Object.keys(originalCssProps).forEach((prop) => {\n element.style[prop] = originalCssProps[prop];\n });\n }\n return;\n};\n","export const DIRECTION_NONE = 1;\nexport const DIRECTION_LEFT = 2;\nexport const DIRECTION_RIGHT = 4;\nexport const DIRECTION_HORIZONTAL = 2 | 4;\nexport const DIRECTION_UP = 8;\nexport const DIRECTION_DOWN = 16;\nexport const DIRECTION_VERTICAL = 8 | 16;\nexport const DIRECTION_ALL = 2 | 4 | 8 | 16;\n\nexport const MOUSE_LEFT = \"left\";\nexport const MOUSE_RIGHT = \"right\";\nexport const MOUSE_MIDDLE = \"middle\";\n\nexport const VELOCITY_INTERVAL = 16;\n\nimport getAgent from \"@egjs/agent\";\n\nimport { window } from \"./browser\";\n\nexport const IOS_EDGE_THRESHOLD = 30;\nexport const IS_IOS_SAFARI =\n \"ontouchstart\" in window && getAgent().browser.name === \"safari\";\n\nexport const TRANSFORM = (() => {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n const bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0])\n .style;\n const target = [\n \"transform\",\n \"webkitTransform\",\n \"msTransform\",\n \"mozTransform\",\n ];\n for (let i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n return \"\";\n})();\n\nexport const PREVENT_DRAG_CSSPROPS = {\n \"user-select\": \"none\",\n \"-webkit-user-drag\": \"none\",\n};\n","export const getInsidePosition = (\n destPos: number,\n range: number[],\n circular: boolean[],\n bounce?: number[]\n): number => {\n let toDestPos: number = destPos;\n const targetRange: number[] = [\n circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0],\n circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1],\n ];\n\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n\n return toDestPos;\n};\n\n// determine outside\nexport const isOutside = (pos: number, range: number[]): boolean => {\n return pos < range[0] || pos > range[1];\n};\n\n// determine whether position has reached the maximum moveable area\nexport const isEndofBounce = (\n pos: number,\n range: number[],\n bounce: number[],\n circular: boolean[]\n): boolean => {\n return (\n (!circular[0] && pos === range[0] - bounce[0]) ||\n (!circular[1] && pos === range[1] + bounce[1])\n );\n};\n\nexport const getDuration = (distance: number, deceleration): number => {\n const duration = Math.sqrt((distance / deceleration) * 2);\n\n // when duration is under 100, then value is zero\n return duration < 100 ? 0 : duration;\n};\n\nexport const isCircularable = (\n destPos: number,\n range: number[],\n circular: boolean[]\n): boolean => {\n return (\n (circular[1] && destPos > range[1]) || (circular[0] && destPos < range[0])\n );\n};\n\nexport const getCirculatedPos = (\n pos: number,\n range: number[],\n circular: boolean[]\n): number => {\n let toPos = pos;\n const min = range[0];\n const max = range[1];\n const length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = ((toPos - max) % length) + min;\n }\n if (circular[0] && pos < min) {\n // left\n toPos = ((toPos - min) % length) + max;\n }\n return toPos;\n};\n","import { Axis } from \"../AxisManager\";\nimport { AxesOption } from \"../Axes\";\nimport { ActiveEvent } from \"../types\";\nimport { MouseEventInput } from \"../eventInput/MouseEventInput\";\nimport { TouchEventInput } from \"../eventInput/TouchEventInput\";\nimport { PointerEventInput } from \"../eventInput/PointerEventInput\";\nimport { TouchMouseEventInput } from \"../eventInput/TouchMouseEventInput\";\nimport {\n SUPPORT_POINTER_EVENTS,\n SUPPORT_TOUCH,\n} from \"../eventInput/EventInput\";\n\nexport interface InputType {\n axes: string[];\n element: HTMLElement;\n mapAxes(axes: string[]);\n connect(observer: InputTypeObserver): InputType;\n disconnect();\n destroy();\n enable?();\n disable?();\n isEnable?(): boolean;\n}\n\nexport interface InputTypeObserver {\n options: AxesOption;\n get(inputType: InputType): Axis;\n change(inputType: InputType, event, offset: Axis, useAnimation?: boolean);\n hold(inputType: InputType, event);\n release(\n inputType: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n );\n}\n\nexport const toAxis = (source: string[], offset: number[]): Axis => {\n return offset.reduce((acc, v, i) => {\n if (source[i]) {\n acc[source[i]] = v;\n }\n return acc;\n }, {});\n};\n\nexport const convertInputType = (inputType: string[] = []): ActiveEvent => {\n let hasTouch = false;\n let hasMouse = false;\n let hasPointer = false;\n\n inputType.forEach((v) => {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n if (hasPointer) {\n return new PointerEventInput();\n } else if (hasTouch && hasMouse) {\n return new TouchMouseEventInput();\n } else if (hasTouch) {\n return new TouchEventInput();\n } else if (hasMouse) {\n return new MouseEventInput();\n }\n return null;\n};\n","import {\n getInsidePosition,\n isCircularable,\n getCirculatedPos,\n getDuration,\n} from \"../Coordinate\";\nimport { Axis, AxisManager } from \"../AxisManager\";\nimport { InterruptManager } from \"../InterruptManager\";\nimport { EventManager, ChangeEventOption } from \"../EventManager\";\nimport {\n requestAnimationFrame,\n cancelAnimationFrame,\n map,\n every,\n filter,\n equal,\n roundNumber,\n getDecimalPlace,\n inversePow,\n} from \"../utils\";\nimport { AxesOption } from \"../Axes\";\nimport {\n AnimationParam,\n ObjectInterface,\n UpdateAnimationOption,\n} from \"../types\";\n\nexport interface AnimationState {\n pos: Axis;\n easingPer: number;\n finished: boolean;\n}\n\nconst clamp = (value: number, min: number, max: number): number => {\n return Math.max(Math.min(value, max), min);\n};\n\nexport abstract class AnimationManager {\n public interruptManager: InterruptManager;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n protected _options: AxesOption;\n protected _animateParam: AnimationParam;\n private _raf: number;\n\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n }) {\n this._options = options;\n this.interruptManager = interruptManager;\n this.eventManager = eventManager;\n this.axisManager = axisManager;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n public abstract interpolate(displacement: number, threshold: number): number;\n\n public abstract updateAnimation(options: UpdateAnimationOption): void;\n\n protected abstract _initState(info: AnimationParam): AnimationState;\n\n protected abstract _getNextState(prevState: AnimationState): AnimationState;\n\n public getDuration(\n depaPos: Axis,\n destPos: Axis,\n wishDuration?: number\n ): number {\n let duration: number;\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n const durations: Axis = map(destPos, (v, k) =>\n getDuration(Math.abs(v - depaPos[k]), this._options.deceleration)\n );\n duration = Object.keys(durations).reduce(\n (max, v) => Math.max(max, durations[v]),\n -Infinity\n );\n }\n return clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n }\n\n public getDisplacement(velocity: number[]): number[] {\n const totalVelocity = Math.pow(\n velocity.reduce((total, v) => total + v * v, 0),\n 1 / velocity.length\n );\n const duration = Math.abs(totalVelocity / -this._options.deceleration);\n return velocity.map((v) => (v / 2) * duration);\n }\n\n public stopAnimation(option?: ChangeEventOption): void {\n if (this._animateParam) {\n const orgPos: Axis = this.axisManager.get();\n const pos: Axis = this.axisManager.map(orgPos, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n );\n if (!every(pos, (v, k) => orgPos[k] === v)) {\n this.eventManager.triggerChange(pos, orgPos, option, !!option);\n }\n this._animateParam = null;\n if (this._raf) {\n cancelAnimationFrame(this._raf);\n }\n this._raf = null;\n this.eventManager.triggerAnimationEnd(!!option?.event);\n }\n }\n\n public getEventInfo(): ChangeEventOption {\n if (\n this._animateParam &&\n this._animateParam.input &&\n this._animateParam.inputEvent\n ) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent,\n };\n } else {\n return null;\n }\n }\n\n public restore(option: ChangeEventOption): void {\n const pos: Axis = this.axisManager.get();\n const destPos: Axis = this.axisManager.map(pos, (v, opt) =>\n Math.min(opt.range[1], Math.max(opt.range[0], v))\n );\n this.stopAnimation();\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n }\n\n public animationEnd(): void {\n const beforeParam: ChangeEventOption = this.getEventInfo();\n this._animateParam = null;\n\n // for Circular\n const circularTargets = this.axisManager.filter(\n this.axisManager.get(),\n (v, opt) => isCircularable(v, opt.range, opt.circular as boolean[])\n );\n if (Object.keys(circularTargets).length > 0) {\n this.setTo(\n this.axisManager.map(circularTargets, (v, opt) =>\n getCirculatedPos(v, opt.range, opt.circular as boolean[])\n )\n );\n }\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerAnimationEnd(!!beforeParam);\n if (this.axisManager.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n }\n\n public finish(isTrusted: boolean): void {\n this._animateParam = null;\n this.interruptManager.setInterrupt(false);\n this.eventManager.triggerFinish(isTrusted);\n }\n\n public getUserControl(param: AnimationParam): {\n destPos: Axis;\n duration: number;\n } {\n const userWish = param.setTo();\n userWish.destPos = this.axisManager.get(userWish.destPos);\n userWish.duration = clamp(\n userWish.duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n );\n return userWish;\n }\n\n public animateTo(\n destPos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): void {\n this.stopAnimation();\n const param: AnimationParam = this._createAnimationParam(\n destPos,\n duration,\n option\n );\n const depaPos = { ...param.depaPos };\n const retTrigger = this.eventManager.triggerAnimationStart(param);\n\n // to control\n const userWish = this.getUserControl(param);\n\n // You can't stop the 'animationStart' event when 'circular' is true.\n if (\n !retTrigger &&\n this.axisManager.every(userWish.destPos, (v, opt) =>\n isCircularable(v, opt.range, opt.circular as boolean[])\n )\n ) {\n console.warn(\n \"You can't stop the 'animation' event when 'circular' is true.\"\n );\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n const inputEvent = option?.event || null;\n this._animateLoop(\n {\n depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axisManager.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent,\n input: option?.input || null,\n },\n () => this.animationEnd()\n );\n }\n }\n\n public setTo(pos: Axis, duration: number = 0) {\n const axes: string[] = Object.keys(pos);\n const orgPos: Axis = this.axisManager.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n this.interruptManager.setInterrupt(true);\n let movedPos = filter(pos, (v, k) => orgPos[k] !== v);\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axisManager.map(movedPos, (v, opt) => {\n const { range, circular } = opt;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular as boolean[]);\n }\n });\n\n if (equal(movedPos, orgPos)) {\n return this;\n }\n\n if (duration > 0) {\n this.animateTo(movedPos, duration);\n } else {\n this.stopAnimation();\n this.eventManager.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n }\n\n public setBy(pos: Axis, duration = 0) {\n return this.setTo(\n map(this.axisManager.get(Object.keys(pos)), (v, k) => v + pos[k]),\n duration\n );\n }\n\n private _createAnimationParam(\n pos: Axis,\n duration: number,\n option?: ChangeEventOption\n ): AnimationParam {\n const depaPos: Axis = this.axisManager.get();\n const destPos: Axis = pos;\n const inputEvent = option?.event || null;\n return {\n depaPos,\n destPos,\n duration: clamp(\n duration,\n this._options.minimumDuration,\n this._options.maximumDuration\n ),\n delta: this.axisManager.getDelta(depaPos, destPos),\n inputEvent,\n input: option?.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd,\n };\n }\n\n private _animateLoop(param: AnimationParam, complete: () => void): void {\n if (param.duration) {\n this._animateParam = {\n ...param,\n startTime: new Date().getTime(),\n };\n const originalIntendedPos = map(param.destPos, (v) => v);\n let state = this._initState(this._animateParam);\n\n const loop = () => {\n this._raf = null;\n const animateParam = this._animateParam;\n const nextState = this._getNextState(state);\n const isCanceled = !this.eventManager.triggerChange(\n nextState.pos,\n state.pos\n );\n\n state = nextState;\n\n if (nextState.finished) {\n animateParam.destPos = this._getFinalPos(\n animateParam.destPos,\n originalIntendedPos\n );\n if (\n !equal(\n animateParam.destPos,\n this.axisManager.get(Object.keys(animateParam.destPos))\n )\n ) {\n this.eventManager.triggerChange(\n animateParam.destPos,\n nextState.pos\n );\n }\n complete();\n return;\n } else if (isCanceled) {\n this.finish(false);\n } else {\n this._raf = requestAnimationFrame(loop);\n }\n };\n loop();\n } else {\n this.eventManager.triggerChange(param.destPos);\n complete();\n }\n }\n\n /**\n * Get estimated final value.\n *\n * If destPos is within the 'error range' of the original intended position, the initial intended position is returned.\n * - eg. original intended pos: 100, destPos: 100.0000000004 ==> return 100;\n * If dest Pos is outside the 'range of error' compared to the originally intended pos, it is returned rounded based on the originally intended pos.\n * - eg. original intended pos: 100.123 destPos: 50.12345 => return 50.123\n * @param originalIntendedPos\n * @param destPos\n */\n private _getFinalPos(\n destPos: ObjectInterface,\n originalIntendedPos: ObjectInterface\n ): Axis {\n // compare destPos and originalIntendedPos\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const ERROR_LIMIT = 0.000001;\n const finalPos = map(destPos, (value, key) => {\n if (\n value >= originalIntendedPos[key] - ERROR_LIMIT &&\n value <= originalIntendedPos[key] + ERROR_LIMIT\n ) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n const roundUnit = this._getRoundUnit(value, key);\n const result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n }\n\n private _getRoundUnit(val: number, key: string): number {\n const roundUnit = this._options.round; // manual mode\n let minRoundUnit = null; // auto mode\n\n // auto mode\n if (!roundUnit) {\n // Get minimum round unit\n const options = this.axisManager.getAxisOptions(key);\n minRoundUnit = inversePow(\n Math.max(\n getDecimalPlace(options.range[0]),\n getDecimalPlace(options.range[1]),\n getDecimalPlace(val)\n )\n );\n }\n\n return minRoundUnit || roundUnit;\n }\n}\n","/* eslint-disable @typescript-eslint/no-empty-function */\n\nimport { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport {\n IS_IOS_SAFARI,\n IOS_EDGE_THRESHOLD,\n DIRECTION_NONE,\n DIRECTION_VERTICAL,\n DIRECTION_HORIZONTAL,\n DIRECTION_ALL,\n MOUSE_LEFT,\n} from \"../const\";\nimport { ActiveEvent, InputEventType } from \"../types\";\n\nimport {\n convertInputType,\n InputType,\n InputTypeObserver,\n toAxis,\n} from \"./InputType\";\n\nexport interface PanInputOption {\n inputType?: string[];\n inputButton?: string[];\n scale?: number[];\n thresholdAngle?: number;\n threshold?: number;\n iOSEdgeSwipeThreshold?: number;\n releaseOnScroll?: boolean;\n touchAction?: string;\n}\n\n// get user's direction\nexport const getDirectionByAngle = (\n angle: number,\n thresholdAngle: number\n): number => {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n const toAngle = Math.abs(angle);\n\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle\n ? DIRECTION_VERTICAL\n : DIRECTION_HORIZONTAL;\n};\n\nexport const useDirection = (checkType, direction, userDirection?): boolean => {\n if (userDirection) {\n return !!(\n direction === DIRECTION_ALL ||\n (direction & checkType && userDirection & checkType)\n );\n } else {\n return !!(direction & checkType);\n }\n};\n\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @param {String[]} [inputType=[\"touch\", \"mouse\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - mouse: Mouse\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - mouse: 마우스\n * - pointer: 마우스 및 터치\n * @param {String[]} [inputButton=[\"left\"]] List of buttons to allow input\n * - left: Left mouse button and normal touch\n * - middle: Mouse wheel press\n * - right: Right mouse button 입력을 허용할 버튼 목록\n * - left: 마우스 왼쪽 버튼\n * - middle: 마우스 휠 눌림\n * - right: 마우스 오른쪽 버튼 \n * @param {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] horizontal axis scale 수평축 배율\n * @param {Number} [scale[1]=1] vertical axis scale 수직축 배율\n * @param {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @param {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @param {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @param {String} [touchAction=null] Value that overrides the element's \"touch-action\" css property. If set to null, it is automatically set to prevent scrolling in the direction of the connected axis. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 만약 null로 설정된 경우, 연결된 축 방향으로의 스크롤을 방지하게끔 자동으로 설정된다.\n **/\n/**\n * 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.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\n * ```js\n * const pan = new eg.Axes.PanInput(\"#area\", {\n * \t\tinputType: [\"touch\"],\n * \t\tscale: [1, 1.3],\n * });\n *\n * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something2\", \"somethingN\"], pan); // or axes.connect(\"something2 somethingN\", pan);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved.\n * axes.connect([\"something1\"], pan); // or axes.connect(\"something1\", pan);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved.\n * axes.connect([\"\", \"something2\"], pan); // or axes.connect(\" something2\", pan);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module eg.Axes.PanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options={}] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n */\nexport class PanInput implements InputType {\n public options: PanInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n protected _observer: InputTypeObserver;\n protected _direction: number;\n protected _enabled = false;\n protected _activeEvent: ActiveEvent = null;\n private _originalCssProps: { [key: string]: string };\n private _atRightEdge = false;\n private _rightEdgeTimer = 0;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n this.element = $(el);\n this.options = {\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n inputButton: [MOUSE_LEFT],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n releaseOnScroll: false,\n touchAction: null,\n ...options,\n };\n this._onPanstart = this._onPanstart.bind(this);\n this._onPanmove = this._onPanmove.bind(this);\n this._onPanend = this._onPanend.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n const useHorizontal = !!axes[0];\n const useVertical = !!axes[1];\n if (useHorizontal && useVertical) {\n this._direction = DIRECTION_ALL;\n } else if (useHorizontal) {\n this._direction = DIRECTION_HORIZONTAL;\n } else if (useVertical) {\n this._direction = DIRECTION_VERTICAL;\n } else {\n this._direction = DIRECTION_NONE;\n }\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n }\n this._attachElementEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n this._direction\n );\n return this;\n }\n\n public disconnect() {\n this._detachElementEvent();\n this._detachWindowEvent(this._activeEvent);\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n this._direction = DIRECTION_NONE;\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n protected _onPanstart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n const edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n\n this._observer.hold(this, panEvent);\n this._atRightEdge =\n IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold;\n this._attachWindowEvent(activeEvent);\n activeEvent.prevEvent = panEvent;\n }\n }\n\n protected _onPanmove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) {\n return;\n }\n\n const { iOSEdgeSwipeThreshold, releaseOnScroll } = this.options;\n const userDirection = getDirectionByAngle(\n panEvent.angle,\n this.options.thresholdAngle\n );\n\n if (releaseOnScroll && !panEvent.srcEvent.cancelable) {\n this._onPanend(event);\n return;\n }\n\n if (activeEvent.prevEvent && IS_IOS_SAFARI) {\n const swipeLeftToRight = panEvent.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this._forceRelease();\n return;\n } else if (this._atRightEdge) {\n clearTimeout(this._rightEdgeTimer);\n\n // - is right to left\n const swipeRightToLeft = panEvent.deltaX < -iOSEdgeSwipeThreshold;\n\n if (swipeRightToLeft) {\n this._atRightEdge = false;\n } else {\n // iOS swipe right => left\n this._rightEdgeTimer = window.setTimeout(\n () => this._forceRelease(),\n 100\n );\n }\n }\n }\n const offset: number[] = this._getOffset(\n [panEvent.offsetX, panEvent.offsetY],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection),\n useDirection(DIRECTION_VERTICAL, this._direction, userDirection),\n ]\n );\n const prevent = offset.some((v) => v !== 0);\n\n if (prevent) {\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n }\n panEvent.preventSystemEvent = prevent;\n if (prevent) {\n this._observer.change(this, panEvent, toAxis(this.axes, offset));\n }\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this._enabled || activeEvent.getTouches(event) !== 0) {\n return;\n }\n this._detachWindowEvent(activeEvent);\n clearTimeout(this._rightEdgeTimer);\n const prevEvent = activeEvent.prevEvent;\n const velocity = this._getOffset(\n [\n Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1),\n Math.abs(prevEvent.velocityY) * (prevEvent.offsetY < 0 ? -1 : 1),\n ],\n [\n useDirection(DIRECTION_HORIZONTAL, this._direction),\n useDirection(DIRECTION_VERTICAL, this._direction),\n ]\n );\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, velocity);\n }\n\n protected _attachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.addEventListener(event, this._onPanmove, { passive: false });\n });\n activeEvent?.end.forEach((event) => {\n window.addEventListener(event, this._onPanend, { passive: false });\n });\n }\n\n protected _detachWindowEvent(activeEvent: ActiveEvent) {\n activeEvent?.move.forEach((event) => {\n window.removeEventListener(event, this._onPanmove);\n });\n activeEvent?.end.forEach((event) => {\n window.removeEventListener(event, this._onPanend);\n });\n }\n\n protected _getOffset(properties: number[], direction: boolean[]): number[] {\n const offset: number[] = [0, 0];\n const scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n return offset;\n }\n\n private _attachElementEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element?.addEventListener(event, this._onPanstart);\n });\n // adding event listener to element prevents invalid behavior in iOS Safari\n activeEvent.move.forEach((event) => {\n this.element?.addEventListener(event, this._voidFunction);\n });\n }\n\n private _detachElementEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element?.removeEventListener(event, this._onPanstart);\n });\n activeEvent?.move.forEach((event) => {\n this.element?.removeEventListener(event, this._voidFunction);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _forceRelease = () => {\n const activeEvent = this._activeEvent;\n const prevEvent = activeEvent.prevEvent;\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [0, 0]);\n this._detachWindowEvent(activeEvent);\n };\n\n private _voidFunction = () => {};\n}\n","import { ComponentEvent } from \"@egjs/component\";\n\nimport { InputType } from \"./inputType/InputType\";\nimport { Axis } from \"./AxisManager\";\nimport Axes from \"./Axes\";\nimport { roundNumbers } from \"./utils\";\nimport { AnimationParam, OnAnimationStart, OnRelease } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface ChangeEventOption {\n input: InputType;\n event;\n}\n\nexport class EventManager {\n public animationManager: AnimationManager;\n public constructor(private _axes: Axes) {}\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @event Axes#hold\n * @type {object}\n * @property {Object.} pos coordinate 좌표 정보\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"hold\", function(event) {\n * // event.pos\n * // event.input\n * // event.inputEvent\n * // isTrusted\n * });\n * ```\n */\n public hold(pos: Axis, option: ChangeEventOption) {\n const { roundPos } = this._getRoundPos(pos);\n\n this._axes.trigger(\n new ComponentEvent(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true,\n })\n );\n }\n\n /**\n * Specifies the coordinates to move after the 'change' event. It works when the holding value of the change event is true.\n * @ko 'change' 이벤트 이후 이동할 좌표를 지정한다. change이벤트의 holding 값이 true일 경우에 동작한다\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events.\n * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationStart\", function(event) {\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n /**\n * This event is fired when a user release an element on the screen of the device.\n * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트\n * @event Axes#release\n * @type {object}\n * @property {Object.} depaPos The coordinates when releasing an element손을 뗐을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to after releasing an element손을 뗀 뒤에 이동할 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the coordinates at the time of release are in the bounce area, the current bounce value divided by the maximum bounce value 손을 뗐을 때의 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {Object} input The instance of inputType where the event occurred이벤트가 발생한 inputType 인스턴스\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'release' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerRelease(param: AnimationParam) {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n this._axes.trigger(\n new ComponentEvent(\"release\", {\n ...param,\n bounceRatio: this._getBounceRatio(roundPos),\n } as OnRelease)\n );\n }\n\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @event Axes#change\n * @type {object}\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Object.} bounceRatio If the current coordinates are in the bounce area, the current bounce value divided by the maximum bounce value 현재 좌표가 bounce 영역에 있는 경우 현재 bounce된 값을 최대 bounce 값으로 나눈 수치.\n * @property {Boolean} holding Indicates whether a user holds an element on the screen of the device.사용자가 기기의 화면을 누르고 있는지 여부\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType. If the value is changed by animation, it returns 'null'.inputType으로 부터 받은 이벤트 객체. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {set} set Specifies the coordinates to move after the event. It works when the holding value is true 이벤트 이후 이동할 좌표를 지정한다. holding 값이 true일 경우에 동작한다.\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"change\", function(event) {\n * // event.pos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.holding\n * // event.set\n * // event.isTrusted\n *\n * // if you want to change the coordinates to move after the 'change' event.\n * // it works when the holding value of the change event is true.\n * event.holding && event.set({x: 10});\n * });\n * ```\n */\n public triggerChange(\n pos: Axis,\n depaPos?: Axis,\n option?: ChangeEventOption,\n holding: boolean = false\n ) {\n const animationManager = this.animationManager;\n const axisManager = animationManager.axisManager;\n const eventInfo = animationManager.getEventInfo();\n const { roundPos, roundDepa } = this._getRoundPos(pos, depaPos);\n const moveTo = axisManager.moveTo(roundPos, roundDepa);\n const inputEvent = option?.event || eventInfo?.event || null;\n const param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n bounceRatio: this._getBounceRatio(moveTo.pos),\n holding,\n inputEvent,\n isTrusted: !!inputEvent,\n input: option?.input || eventInfo?.input || null,\n set: inputEvent ? this._createUserControll(moveTo.pos) : () => {}, // eslint-disable-line @typescript-eslint/no-empty-function\n };\n const event = new ComponentEvent(\"change\", param);\n this._axes.trigger(event);\n\n if (inputEvent) {\n axisManager.set(\n (param.set() as { destPos: Axis; duration: number }).destPos\n );\n }\n\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @event Axes#animationStart\n * @type {object}\n * @property {Object.} depaPos The coordinates when animation starts애니메이션이 시작 되었을 때의 좌표 \n * @property {Object.} destPos The coordinates to move to. If you change this value, you can run the animation이동할 좌표. 이값을 변경하여 애니메이션을 동작시킬수 있다\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\n * @property {Number} duration Duration of the animation (unit: ms). If you change this value, you can control the animation duration time.애니메이션 진행 시간(단위: ms). 이값을 변경하여 애니메이션의 이동시간을 조절할 수 있다.\n * @property {Object} input The instance of inputType where the event occurred. If the value is changed by animation, it returns 'null'.이벤트가 발생한 inputType 인스턴스. 애니메이션에 의해 값이 변경될 경우에는 'null'을 반환한다.\n * @property {Object} inputEvent The event object received from inputType inputType으로 부터 받은 이벤트 객체\n * @property {setTo} setTo Specifies the animation coordinates to move after the event 이벤트 이후 이동할 애니메이션 좌표를 지정한다\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"release\", function(event) {\n * // event.depaPos\n * // event.destPos\n * // event.delta\n * // event.input\n * // event.inputEvent\n * // event.setTo\n * // event.isTrusted\n *\n * // if you want to change the animation coordinates to move after the 'animationStart' event.\n * event.setTo({x: 10}, 2000);\n * });\n * ```\n */\n public triggerAnimationStart(param: AnimationParam): boolean {\n const { roundPos, roundDepa } = this._getRoundPos(\n param.destPos,\n param.depaPos\n );\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this._createUserControll(param.destPos, param.duration);\n const event = new ComponentEvent(\n \"animationStart\",\n param as OnAnimationStart\n );\n this._axes.trigger(event);\n return !event.isCanceled();\n }\n\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#animationEnd\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"animationEnd\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerAnimationEnd(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"animationEnd\", {\n isTrusted,\n })\n );\n }\n\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @event Axes#finish\n * @type {object}\n * @property {Boolean} isTrusted Returns true if an event was generated by the user action, or false if it was caused by a script or API call 사용자의 액션에 의해 이벤트가 발생하였으면 true, 스크립트나 API호출에 의해 발생하였을 경우에는 false를 반환한다.\n *\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"zoom\": {\n * range: [50, 30]\n * }\n * }).on(\"finish\", function(event) {\n * // event.isTrusted\n * });\n * ```\n */\n public triggerFinish(isTrusted: boolean = false) {\n this._axes.trigger(\n new ComponentEvent(\"finish\", {\n isTrusted,\n })\n );\n }\n\n public setAnimationManager(animationManager: AnimationManager) {\n this.animationManager = animationManager;\n }\n\n public destroy() {\n this._axes.off();\n }\n\n private _createUserControll(pos: Axis, duration: number = 0) {\n // to controll\n const userControl = {\n destPos: { ...pos },\n duration,\n };\n return (\n toPos?: Axis,\n userDuration?: number\n ): { destPos: Axis; duration: number } => {\n if (toPos) {\n userControl.destPos = { ...toPos };\n }\n if (userDuration !== undefined) {\n userControl.duration = userDuration;\n }\n return userControl;\n };\n }\n\n private _getRoundPos(pos: Axis, depaPos?: Axis) {\n // round value if round exist\n const roundUnit = this._axes.options.round;\n\n // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit),\n };\n }\n\n private _getBounceRatio(pos: Axis): Axis {\n return this._axes.axisManager.map(pos, (v, opt) => {\n if (v < opt.range[0] && opt.bounce[0] !== 0) {\n return (opt.range[0] - v) / opt.bounce[0];\n } else if (v > opt.range[1] && opt.bounce[1] !== 0) {\n return (v - opt.range[1]) / opt.bounce[1];\n } else {\n return 0;\n }\n });\n }\n}\n","import { AxesOption } from \"./Axes\";\nexport class InterruptManager {\n private _prevented = false; // check whether the animation event was prevented\n public constructor(private _options: AxesOption) {}\n\n public isInterrupting() {\n // when interruptable is 'true', return value is always 'true'.\n return this._options.interruptable || this._prevented;\n }\n\n public isInterrupted() {\n return !this._options.interruptable && this._prevented;\n }\n\n public setInterrupt(prevented) {\n if (!this._options.interruptable) {\n this._prevented = prevented;\n }\n }\n}\n","import { isOutside, getCirculatedPos } from \"./Coordinate\";\nimport { map, filter, every } from \"./utils\";\nimport { ObjectInterface } from \"./types\";\n\nexport interface Axis {\n [key: string]: number;\n}\n\nexport interface AxisOption {\n range?: number[];\n bounce?: number | number[];\n circular?: boolean | boolean[];\n}\n\nexport class AxisManager {\n private _pos: Axis;\n public constructor(private _axis: ObjectInterface) {\n this._complementOptions();\n this._pos = Object.keys(this._axis).reduce((acc, v) => {\n acc[v] = this._axis[v].range[0];\n return acc;\n }, {});\n }\n\n public getDelta(depaPos: Axis, destPos: Axis): Axis {\n const fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), (v, k) => v - fullDepaPos[k]);\n }\n\n public get(axes?: string[] | Axis): Axis {\n if (axes && Array.isArray(axes)) {\n return axes.reduce((acc, v) => {\n if (v && v in this._pos) {\n acc[v] = this._pos[v];\n }\n return acc;\n }, {});\n } else {\n return { ...this._pos, ...((axes || {}) as Axis) };\n }\n }\n\n public moveTo(pos: Axis, depaPos: Axis = this._pos): { [key: string]: Axis } {\n const delta = map(this._pos, (v, key) => {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n\n this.set(\n this.map(pos, (v, opt) =>\n opt ? getCirculatedPos(v, opt.range, opt.circular as boolean[]) : 0\n )\n );\n return {\n pos: { ...this._pos },\n delta,\n };\n }\n\n public set(pos: Axis) {\n for (const k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n }\n\n public every(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): boolean {\n const axisOptions = this._axis;\n\n return every(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public filter(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => boolean\n ): Axis {\n const axisOptions = this._axis;\n\n return filter(pos, (value, key) => callback(value, axisOptions[key], key));\n }\n\n public map(\n pos: Axis,\n callback: (value: number, options: AxisOption, key: string) => U\n ) {\n const axisOptions = this._axis;\n\n return map(pos, (value, key) =>\n callback(value, axisOptions[key], key)\n );\n }\n\n public isOutside(axes?: string[]) {\n return !this.every(\n axes ? this.get(axes) : this._pos,\n (v, opt) => !isOutside(v, opt.range)\n );\n }\n\n public getAxisOptions(key: string) {\n return this._axis[key];\n }\n\n /**\n * set up 'css' expression\n * @private\n */\n private _complementOptions() {\n Object.keys(this._axis).forEach((axis) => {\n this._axis[axis] = {\n ...{\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false],\n },\n ...this._axis[axis],\n };\n\n [\"bounce\", \"circular\"].forEach((v) => {\n const axisOption = this._axis;\n const key = axisOption[axis][v];\n\n if (/string|number|boolean/.test(typeof key)) {\n axisOption[axis][v] = [key, key];\n }\n });\n });\n }\n}\n","import { ExtendedEvent, InputEventType, LatestInterval } from \"../types\";\nimport { getAngle } from \"../utils\";\nimport { window } from \"../browser\";\nimport {\n MOUSE_LEFT,\n MOUSE_MIDDLE,\n MOUSE_RIGHT,\n VELOCITY_INTERVAL,\n} from \"../const\";\n\nexport const SUPPORT_TOUCH = \"ontouchstart\" in window;\nexport const SUPPORT_POINTER = \"PointerEvent\" in window;\nexport const SUPPORT_MSPOINTER = \"MSPointerEvent\" in window;\nexport const SUPPORT_POINTER_EVENTS = SUPPORT_POINTER || SUPPORT_MSPOINTER;\n\nexport abstract class EventInput {\n public prevEvent: ExtendedEvent;\n private _latestInterval: LatestInterval;\n\n public abstract onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent;\n\n public abstract onEventEnd(event: InputEventType): void;\n\n public abstract onRelease(event: InputEventType): void;\n\n public abstract getTouches(event: InputEventType): number;\n\n protected abstract _getScale(event: InputEventType): number;\n\n protected abstract _getCenter(event: InputEventType): {\n x: number;\n y: number;\n };\n\n protected abstract _getMovement(event: InputEventType): {\n x: number;\n y: number;\n };\n\n public extendEvent(event: InputEventType): ExtendedEvent {\n const prevEvent = this.prevEvent;\n const center = this._getCenter(event);\n const movement = prevEvent ? this._getMovement(event) : { x: 0, y: 0 };\n const scale = prevEvent ? this._getScale(event) : 1;\n const angle = prevEvent\n ? getAngle(center.x - prevEvent.center.x, center.y - prevEvent.center.y)\n : 0;\n const deltaX = prevEvent ? prevEvent.deltaX + movement.x : movement.x;\n const deltaY = prevEvent ? prevEvent.deltaY + movement.y : movement.y;\n const offsetX = movement.x;\n const offsetY = movement.y;\n const latestInterval = this._latestInterval;\n const timeStamp = Date.now();\n const deltaTime = latestInterval ? timeStamp - latestInterval.timestamp : 0;\n let velocityX = prevEvent ? prevEvent.velocityX : 0;\n let velocityY = prevEvent ? prevEvent.velocityY : 0;\n if (!latestInterval || deltaTime >= VELOCITY_INTERVAL) {\n if (latestInterval) {\n [velocityX, velocityY] = [\n (deltaX - latestInterval.deltaX) / deltaTime,\n (deltaY - latestInterval.deltaY) / deltaTime,\n ];\n }\n this._latestInterval = {\n timestamp: timeStamp,\n deltaX,\n deltaY,\n };\n }\n return {\n srcEvent: event,\n scale,\n angle,\n center,\n deltaX,\n deltaY,\n offsetX,\n offsetY,\n velocityX,\n velocityY,\n preventSystemEvent: true,\n };\n }\n\n protected _getDistance(\n start: Touch | PointerEvent,\n end: Touch | PointerEvent\n ): number {\n const x = end.clientX - start.clientX;\n const y = end.clientY - start.clientY;\n return Math.sqrt(x * x + y * y);\n }\n\n protected _getButton(event: InputEventType): string {\n const buttonCodeMap = { 1: MOUSE_LEFT, 2: MOUSE_RIGHT, 4: MOUSE_MIDDLE };\n const button = this._isTouchEvent(event)\n ? MOUSE_LEFT\n : buttonCodeMap[event.buttons];\n return button ? button : null;\n }\n\n protected _isTouchEvent(event: InputEventType): event is TouchEvent {\n return event.type.indexOf(\"touch\") > -1;\n }\n\n protected _isValidButton(button: string, inputButton: string[]): boolean {\n return inputButton.indexOf(button) > -1;\n }\n\n protected _preventMouseButton(event: InputEventType, button: string): void {\n if (button === MOUSE_RIGHT) {\n window.addEventListener(\"contextmenu\", this._stopContextMenu);\n } else if (button === MOUSE_MIDDLE) {\n event.preventDefault();\n }\n }\n\n private _stopContextMenu = (event: InputEventType) => {\n event.preventDefault();\n window.removeEventListener(\"contextmenu\", this._stopContextMenu);\n };\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class MouseEventInput extends EventInput {\n public readonly start = [\"mousedown\"];\n public readonly move = [\"mousemove\"];\n public readonly end = [\"mouseup\"];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(): void {\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n return;\n }\n\n public getTouches(): number {\n return 0;\n }\n\n protected _getScale(): number {\n return 1;\n }\n\n protected _getCenter(event: MouseEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as MouseEvent;\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchEventInput extends EventInput {\n public readonly start = [\"touchstart\"];\n public readonly move = [\"touchmove\"];\n public readonly end = [\"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(event: InputEventType): ExtendedEvent {\n this._baseTouches = (event as TouchEvent).touches;\n return this.extendEvent(event);\n }\n\n public onEventMove(event: InputEventType): ExtendedEvent {\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._baseTouches = (event as TouchEvent).touches;\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return (event as TouchEvent).touches.length;\n }\n\n protected _getScale(event: TouchEvent): number {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n\n protected _getCenter(event: TouchEvent): { x: number; y: number } {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n\n protected _getMovement(event: TouchEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as TouchEvent;\n if (event.touches[0].identifier !== prev.touches[0].identifier) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.touches[0].clientX - prev.touches[0].clientX,\n y: event.touches[0].clientY - prev.touches[0].clientY,\n };\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput, SUPPORT_POINTER } from \"./EventInput\";\n\nexport class PointerEventInput extends EventInput {\n public readonly start = SUPPORT_POINTER ? [\"pointerdown\"] : [\"MSPointerDown\"];\n public readonly move = SUPPORT_POINTER ? [\"pointermove\"] : [\"MSPointerMove\"];\n public readonly end = SUPPORT_POINTER\n ? [\"pointerup\", \"pointercancel\"]\n : [\"MSPointerUp\", \"MSPointerCancel\"];\n\n // store first, recent inputs for each event id\n private _firstInputs: PointerEvent[] = [];\n private _recentInputs: PointerEvent[] = [];\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n this._updatePointerEvent(event as PointerEvent);\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n this._removePointerEvent(event as PointerEvent);\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._firstInputs = [];\n this._recentInputs = [];\n return;\n }\n\n public getTouches(): number {\n return this._recentInputs.length;\n }\n\n protected _getScale(): number {\n if (this._recentInputs.length !== 2) {\n return null; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(this._recentInputs[0], this._recentInputs[1]) /\n this._getDistance(this._firstInputs[0], this._firstInputs[1])\n );\n }\n\n protected _getCenter(event: PointerEvent): { x: number; y: number } {\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: PointerEvent): { x: number; y: number } {\n const prev = this.prevEvent.srcEvent as PointerEvent;\n if (event.pointerId !== prev.pointerId) {\n return {\n x: 0,\n y: 0,\n };\n }\n return {\n x: event.clientX - prev.clientX,\n y: event.clientY - prev.clientY,\n };\n }\n\n private _updatePointerEvent(event: PointerEvent) {\n let addFlag = false;\n this._recentInputs.forEach((e, i) => {\n if (e.pointerId === event.pointerId) {\n addFlag = true;\n this._recentInputs[i] = event;\n }\n });\n if (!addFlag) {\n this._firstInputs.push(event);\n this._recentInputs.push(event);\n }\n }\n\n private _removePointerEvent(event?: PointerEvent) {\n this._firstInputs = this._firstInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n this._recentInputs = this._recentInputs.filter(\n (x) => x.pointerId !== event.pointerId\n );\n }\n}\n","import { InputEventType, ExtendedEvent } from \"../types\";\n\nimport { EventInput } from \"./EventInput\";\n\nexport class TouchMouseEventInput extends EventInput {\n public readonly start = [\"mousedown\", \"touchstart\"];\n public readonly move = [\"mousemove\", \"touchmove\"];\n public readonly end = [\"mouseup\", \"touchend\", \"touchcancel\"];\n\n private _baseTouches: TouchList;\n\n public onEventStart(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n const button = this._getButton(event);\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n if (inputButton && !this._isValidButton(button, inputButton)) {\n return null;\n }\n this._preventMouseButton(event, button);\n return this.extendEvent(event);\n }\n\n public onEventMove(\n event: InputEventType,\n inputButton?: string[]\n ): ExtendedEvent {\n if (\n inputButton &&\n !this._isValidButton(this._getButton(event), inputButton)\n ) {\n return null;\n }\n return this.extendEvent(event);\n }\n\n public onEventEnd(event: InputEventType): void {\n if (this._isTouchEvent(event)) {\n this._baseTouches = event.touches;\n }\n return;\n }\n\n public onRelease(): void {\n this.prevEvent = null;\n this._baseTouches = null;\n return;\n }\n\n public getTouches(event: InputEventType): number {\n return this._isTouchEvent(event) ? event.touches.length : 0;\n }\n\n protected _getScale(event: MouseEvent | TouchEvent): number {\n if (this._isTouchEvent(event)) {\n if (event.touches.length !== 2 || this._baseTouches.length < 2) {\n return 1; // TODO: consider calculating non-pinch gesture scale\n }\n return (\n this._getDistance(event.touches[0], event.touches[1]) /\n this._getDistance(this._baseTouches[0], this._baseTouches[1])\n );\n }\n return this.prevEvent.scale;\n }\n\n protected _getCenter(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n if (this._isTouchEvent(event)) {\n return {\n x: event.touches[0].clientX,\n y: event.touches[0].clientY,\n };\n }\n return {\n x: event.clientX,\n y: event.clientY,\n };\n }\n\n protected _getMovement(event: MouseEvent | TouchEvent): {\n x: number;\n y: number;\n } {\n const prev = this.prevEvent.srcEvent;\n const [nextSpot, prevSpot] = [event, prev].map((e) => {\n if (this._isTouchEvent(e)) {\n return {\n id: e.touches[0].identifier,\n x: e.touches[0].clientX,\n y: e.touches[0].clientY,\n };\n }\n return {\n id: null,\n x: e.clientX,\n y: e.clientY,\n };\n });\n return nextSpot.id === prevSpot.id\n ? { x: nextSpot.x - prevSpot.x, y: nextSpot.y - prevSpot.y }\n : { x: 0, y: 0 };\n }\n}\n","import { InterruptManager } from \"./InterruptManager\";\nimport { InputType, InputTypeObserver, toAxis } from \"./inputType/InputType\";\nimport { EventManager, ChangeEventOption } from \"./EventManager\";\nimport { AxisManager, Axis } from \"./AxisManager\";\nimport { AxesOption } from \"./Axes\";\nimport {\n isOutside,\n getInsidePosition,\n getCirculatedPos,\n isEndofBounce,\n} from \"./Coordinate\";\nimport { map, equal } from \"./utils\";\nimport { AnimationParam } from \"./types\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport class InputObserver implements InputTypeObserver {\n public options: AxesOption;\n private _interruptManager: InterruptManager;\n private _eventManager: EventManager;\n private _axisManager: AxisManager;\n private _animationManager: AnimationManager;\n private _isOutside = false;\n private _moveDistance: Axis = null;\n private _isStopped = false;\n public constructor({\n options,\n interruptManager,\n eventManager,\n axisManager,\n animationManager,\n }: {\n options: AxesOption;\n interruptManager: InterruptManager;\n eventManager: EventManager;\n axisManager: AxisManager;\n animationManager: AnimationManager;\n }) {\n this.options = options;\n this._interruptManager = interruptManager;\n this._eventManager = eventManager;\n this._axisManager = axisManager;\n this._animationManager = animationManager;\n }\n\n public get(input: InputType): Axis {\n return this._axisManager.get(input.axes);\n }\n\n public hold(input: InputType, event) {\n if (this._interruptManager.isInterrupted() || !input.axes.length) {\n return;\n }\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n this._isStopped = false;\n this._interruptManager.setInterrupt(true);\n this._animationManager.stopAnimation(changeOption);\n if (!this._moveDistance) {\n this._eventManager.hold(this._axisManager.get(), changeOption);\n }\n this._isOutside = this._axisManager.isOutside(input.axes);\n this._moveDistance = this._axisManager.get(input.axes);\n }\n\n public change(input: InputType, event, offset: Axis, useAnimation?: boolean) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n this._axisManager.every(offset, (v) => v === 0)\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyChanged) {\n return;\n }\n let depaPos: Axis = this._moveDistance || this._axisManager.get(input.axes);\n let destPos: Axis;\n\n // for outside logic\n destPos = map(depaPos, (v, k) => v + (offset[k] || 0));\n if (this._moveDistance) {\n this._moveDistance = this._axisManager.map(\n destPos,\n (v, { circular, range }) =>\n circular && (circular[0] || circular[1])\n ? getCirculatedPos(v, range, circular as boolean[])\n : v\n );\n }\n // from outside to inside\n if (\n this._isOutside &&\n this._axisManager.every(depaPos, (v, opt) => !isOutside(v, opt.range))\n ) {\n this._isOutside = false;\n }\n depaPos = this._atOutside(depaPos);\n destPos = this._atOutside(destPos);\n\n if (!this.options.nested || !this._isEndofAxis(offset, depaPos, destPos)) {\n nativeEvent.__childrenAxesAlreadyChanged = true;\n }\n\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (useAnimation) {\n const duration = this._animationManager.getDuration(destPos, depaPos);\n this._animationManager.animateTo(destPos, duration, changeOption);\n } else {\n const isCanceled = !this._eventManager.triggerChange(\n destPos,\n depaPos,\n changeOption,\n true\n );\n if (isCanceled) {\n this._isStopped = true;\n this._moveDistance = null;\n this._animationManager.finish(false);\n }\n }\n }\n\n public release(\n input: InputType,\n event,\n velocity: number[],\n inputDuration?: number\n ) {\n if (\n this._isStopped ||\n !this._interruptManager.isInterrupting() ||\n !this._moveDistance\n ) {\n return;\n }\n const nativeEvent = event.srcEvent ? event.srcEvent : event;\n if (nativeEvent.__childrenAxesAlreadyReleased) {\n velocity = velocity.map(() => 0);\n }\n const pos: Axis = this._axisManager.get(input.axes);\n const depaPos: Axis = this._axisManager.get();\n const displacement = this._animationManager.getDisplacement(velocity);\n const offset = toAxis(input.axes, displacement);\n let destPos: Axis = this._axisManager.get(\n this._axisManager.map(offset, (v, opt, k) => {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(\n pos[k] + v,\n opt.range,\n opt.circular as boolean[],\n opt.bounce as number[]\n );\n }\n })\n );\n nativeEvent.__childrenAxesAlreadyReleased = true;\n const duration = this._animationManager.getDuration(\n destPos,\n pos,\n inputDuration\n );\n\n if (duration === 0) {\n destPos = { ...depaPos };\n }\n // prepare params\n const param: AnimationParam = {\n depaPos,\n destPos,\n duration,\n delta: this._axisManager.getDelta(depaPos, destPos),\n inputEvent: event,\n input,\n isTrusted: true,\n };\n this._eventManager.triggerRelease(param);\n this._moveDistance = null;\n\n // to contol\n const userWish = this._animationManager.getUserControl(param);\n const isEqual = equal(userWish.destPos, depaPos);\n const changeOption: ChangeEventOption = {\n input,\n event,\n };\n if (isEqual || userWish.duration === 0) {\n if (!isEqual) {\n this._eventManager.triggerChange(\n userWish.destPos,\n depaPos,\n changeOption,\n true\n );\n }\n this._interruptManager.setInterrupt(false);\n if (this._axisManager.isOutside()) {\n this._animationManager.restore(changeOption);\n } else {\n this._eventManager.triggerFinish(true);\n }\n } else {\n this._animationManager.animateTo(\n userWish.destPos,\n userWish.duration,\n changeOption\n );\n }\n }\n\n // when move pointer is held in outside\n private _atOutside(pos: Axis) {\n if (this._isOutside) {\n return this._axisManager.map(pos, (v, opt) => {\n const tn = opt.range[0] - (opt.bounce[0] as number);\n const tx = opt.range[1] + (opt.bounce[1] as number);\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n return this._axisManager.map(pos, (v, opt) => {\n const min = opt.range[0];\n const max = opt.range[1];\n const out = opt.bounce;\n const circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return (\n min - this._animationManager.interpolate(min - v, out[0] as number)\n );\n } else if (v > max) {\n // right\n return (\n max + this._animationManager.interpolate(v - max, out[1] as number)\n );\n }\n return v;\n });\n }\n }\n\n private _isEndofAxis(offset: Axis, depaPos: Axis, destPos: Axis) {\n return this._axisManager.every(\n depaPos,\n (value, option, key) =>\n offset[key] === 0 ||\n (depaPos[key] === destPos[key] &&\n isEndofBounce(\n value,\n option.range,\n option.bounce as number[],\n option.circular as boolean[]\n ))\n );\n }\n}\n","import { AxesOption } from \"../Axes\";\nimport { Axis } from \"../AxisManager\";\nimport { getCirculatedPos } from \"../Coordinate\";\nimport { AnimationParam, UpdateAnimationOption } from \"../types\";\nimport { map } from \"../utils\";\n\nimport { AnimationManager, AnimationState } from \"./AnimationManager\";\n\nexport class EasingManager extends AnimationManager {\n protected _useDuration = true;\n protected _options: AxesOption;\n private _durationOffset: number;\n private _initialEasingPer: number;\n private _prevEasingPer: number;\n\n public interpolate(displacement: number, threshold: number): number {\n const initSlope = this._easing(0.00001) / 0.00001;\n return this._easing(displacement / (threshold * initSlope)) * threshold;\n }\n\n public updateAnimation(options: UpdateAnimationOption): void {\n const animateParam = this._animateParam;\n if (!animateParam) {\n return;\n }\n\n const diffTime = new Date().getTime() - animateParam.startTime;\n const pos = options?.destPos || animateParam.destPos;\n const duration = options?.duration || animateParam.duration;\n if (options?.restart || duration <= diffTime) {\n this.setTo(pos, duration - diffTime);\n return;\n }\n if (options?.destPos) {\n const currentPos = this.axisManager.get();\n // When destination is changed, new delta should be calculated as remaining percent.\n // For example, moving x:0, y:0 to x:200, y:200 and it has current easing percent of 92%. coordinate is x:184 and y:184\n // If destination changes to x:300, y:300. xdelta:200, ydelta:200 changes to xdelta:116, ydelta:116 and use remaining easingPer as 100%, not 8% as previous.\n // Therefore, original easingPer by time is kept. And divided by (1 - self._initialEasingPer) which means new total easing percent. Like calculating 8% as 100%.\n this._initialEasingPer = this._prevEasingPer;\n animateParam.delta = this.axisManager.getDelta(currentPos, pos);\n animateParam.destPos = pos;\n }\n if (options?.duration) {\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n // Use durationOffset for keeping animation ratio after duration is changed.\n // newRatio = (diffTime + newDurationOffset) / newDuration = oldRatio\n // newDurationOffset = oldRatio * newDuration - diffTime\n this._durationOffset = ratio * duration - diffTime;\n animateParam.duration = duration;\n }\n }\n\n protected _initState(info: AnimationParam): AnimationState {\n this._initialEasingPer = 0;\n this._prevEasingPer = 0;\n this._durationOffset = 0;\n return {\n pos: info.depaPos,\n easingPer: 0,\n finished: false,\n };\n }\n\n protected _getNextState(prevState: AnimationState): AnimationState {\n const animateParam = this._animateParam;\n const prevPos = prevState.pos;\n const destPos = animateParam.destPos;\n const directions = map(prevPos, (value, key) => {\n return value <= destPos[key] ? 1 : -1;\n });\n const diffTime = new Date().getTime() - animateParam.startTime;\n const ratio = (diffTime + this._durationOffset) / animateParam.duration;\n const easingPer = this._easing(ratio);\n\n const toPos: Axis = this.axisManager.map(prevPos, (pos, options, key) => {\n const nextPos =\n ratio >= 1\n ? destPos[key]\n : pos +\n (animateParam.delta[key] * (easingPer - this._prevEasingPer)) /\n (1 - this._initialEasingPer);\n\n // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n const circulatedPos = getCirculatedPos(\n nextPos,\n options.range,\n options.circular as boolean[]\n );\n if (nextPos !== circulatedPos) {\n // circular\n const rangeOffset =\n directions[key] * (options.range[1] - options.range[0]);\n\n destPos[key] -= rangeOffset;\n prevPos[key] -= rangeOffset;\n }\n return circulatedPos;\n });\n this._prevEasingPer = easingPer;\n return {\n pos: toPos,\n easingPer,\n finished: easingPer >= 1,\n };\n }\n\n private _easing(p: number): number {\n return p > 1 ? 1 : this._options.easing(p);\n }\n}\n","import Component from \"@egjs/component\";\n\nimport { EventManager } from \"./EventManager\";\nimport { InterruptManager } from \"./InterruptManager\";\nimport { AxisManager, AxisOption, Axis } from \"./AxisManager\";\nimport { InputObserver } from \"./InputObserver\";\nimport {\n TRANSFORM,\n DIRECTION_NONE,\n DIRECTION_LEFT,\n DIRECTION_RIGHT,\n DIRECTION_UP,\n DIRECTION_DOWN,\n DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL,\n DIRECTION_ALL,\n} from \"./const\";\nimport { InputType } from \"./inputType/InputType\";\nimport { AxesEvents, ObjectInterface, UpdateAnimationOption } from \"./types\";\nimport { EasingManager } from \"./animation/EasingManager\";\nimport { AnimationManager } from \"./animation/AnimationManager\";\n\nexport interface AxesOption {\n easing?: (x: number) => number;\n maximumDuration?: number;\n minimumDuration?: number;\n deceleration?: number;\n interruptable?: boolean;\n round?: number;\n nested?: boolean;\n}\n\n/**\n * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system.\n * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {Number[]} [range] The coordinate of range 좌표 범위\n * @param {Number} [range[0]=0] The coordinate of the minimum 최소 좌표\n * @param {Number} [range[1]=0] The coordinate of the maximum 최대 좌표\n * @param {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바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @param {Number} [bounce[0]=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @param {Number} [bounce[1]=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @param {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.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @param {Boolean} [circular[0]=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @param {Boolean} [circular[1]=false] Indicates whether to circulate to the coordinate of the maximum 최대 좌표 방향의 순환 여부\n **/\n\n/**\n * @typedef {Object} AxesOption The option object of the eg.Axes module\n * @ko eg.Axes 모듈의 옵션 객체\n * @param {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @param {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @param {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @param {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @param {Boolean} [interruptable=true] Indicates whether an animation is interruptible.\n * - true: It can be paused or stopped by user action or the API.\n * - false: It cannot be paused or stopped by user action or the API while it is running.\n * 진행 중인 애니메이션 중지 가능 여부.\n * - true: 사용자의 동작이나 API로 애니메이션을 중지할 수 있다.\n * - false: 애니메이션이 진행 중일 때는 사용자의 동작이나 API가 적용되지 않는다\n * @param {Number} [round=null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)\n * [Details](https://github.com/naver/egjs-axes/wiki/round-option)반올림 단위. 예를 들어 0.1 은 소숫점 0.1 까지 반올림(6.1234 => 6.1), 5 는 5 단위로 반올림(93 => 95).\n * [상세내용](https://github.com/naver/egjs-axes/wiki/round-option)\n * @param {Boolean} [nested=false] Whether the event propagates to other instances when the coordinates reach the end of the movable area 좌표가 이동 가능한 영역의 끝까지 도달했을 때 다른 인스턴스들로의 이벤트 전파 여부\n **/\n\n/**\n * 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.\n * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다.\n * @extends eg.Component\n *\n * @param {Object.} axis Axis information managed by eg.Axes. The key of the axis specifies the name to use as the logical virtual coordinate system. eg.Axes가 관리하는 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다.\n * @param {AxesOption} [options={}] The option object of the eg.Axes moduleeg.Axes 모듈의 옵션 객체\n * @param {Object.} [startPos=null] The coordinates to be moved when creating an instance. not triggering change event.인스턴스 생성시 이동할 좌표, change 이벤트는 발생하지 않음.\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n * ```js\n * // 1. Initialize eg.Axes\n * const axes = new eg.Axes({\n *\tsomething1: {\n *\t\trange: [0, 150],\n *\t\tbounce: 50\n *\t},\n *\tsomething2: {\n *\t\trange: [0, 200],\n *\t\tbounce: 100\n *\t},\n *\tsomethingN: {\n *\t\trange: [1, 10],\n *\t}\n * }, {\n * deceleration : 0.0024\n * });\n *\n * // 2. attach event handler\n * axes.on({\n *\t\"hold\" : function(evt) {\n *\t},\n *\t\"release\" : function(evt) {\n *\t},\n *\t\"animationStart\" : function(evt) {\n *\t},\n *\t\"animationEnd\" : function(evt) {\n *\t},\n *\t\"change\" : function(evt) {\n *\t}\n * });\n *\n * // 3. Initialize inputTypes\n * const panInputArea = new eg.Axes.PanInput(\"#area\", {\n *\tscale: [0.5, 1]\n * });\n * const panInputHmove = new eg.Axes.PanInput(\"#hmove\");\n * const panInputVmove = new eg.Axes.PanInput(\"#vmove\");\n * const pinchInputArea = new eg.Axes.PinchInput(\"#area\", {\n *\tscale: 1.5\n * });\n *\n * // 4. Connect eg.Axes and InputTypes\n * // [PanInput] When the mouse or touchscreen is down and moved.\n * // Connect the 'something2' axis to the mouse or touchscreen x position and\n * // connect the 'somethingN' axis to the mouse or touchscreen y position.\n * axes.connect([\"something2\", \"somethingN\"], panInputArea); // or axes.connect(\"something2 somethingN\", panInputArea);\n *\n * // Connect only one 'something1' axis to the mouse or touchscreen x position.\n * axes.connect([\"something1\"], panInputHmove); // or axes.connect(\"something1\", panInputHmove);\n *\n * // Connect only one 'something2' axis to the mouse or touchscreen y position.\n * axes.connect([\"\", \"something2\"], panInputVmove); // or axes.connect(\" something2\", panInputVmove);\n *\n * // [PinchInput] Connect 'something2' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something2\", pinchInputArea);\n * ```\n */\nclass Axes extends Component {\n /**\n * @name VERSION\n * @desc Version info string\n * @ko 버전정보 문자열\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.VERSION; // ex) 3.3.3\n * ```\n */\n public static VERSION = \"#__VERSION__#\";\n /* eslint-disable */\n // for tree shaking\n public static PanInput;\n public static PinchInput;\n public static WheelInput;\n public static MoveKeyInput;\n public static RotatePanInput;\n /* eslint-enable */\n\n /**\n * @name TRANSFORM\n * @desc Returns the transform attribute with CSS vendor prefixes.\n * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다.\n *\n * @constant\n * @type {String}\n * @example\n * ```js\n * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n * ```\n */\n public static TRANSFORM = TRANSFORM;\n /**\n * @name DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n public static DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n public static DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name DIRECTION_UP\n * @constant\n * @type {Number}\n */\n public static DIRECTION_UP = DIRECTION_UP;\n /**\n * @name DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n public static DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n public static DIRECTION_ALL = DIRECTION_ALL;\n\n public options: AxesOption;\n public eventManager: EventManager;\n public axisManager: AxisManager;\n public interruptManager: InterruptManager;\n public animationManager: AnimationManager;\n public inputObserver: InputObserver;\n private _inputs: InputType[] = [];\n\n /**\n *\n */\n public constructor(\n public axis: ObjectInterface = {},\n options: AxesOption = {},\n startPos: Axis = null\n ) {\n super();\n this.options = {\n ...{\n easing: (x) => {\n return 1 - Math.pow(1 - x, 3);\n },\n interruptable: true,\n maximumDuration: Infinity,\n minimumDuration: 0,\n deceleration: 0.0006,\n round: null,\n nested: false,\n },\n ...options,\n };\n\n this.interruptManager = new InterruptManager(this.options);\n this.axisManager = new AxisManager(this.axis);\n this.eventManager = new EventManager(this);\n this.animationManager = new EasingManager(this);\n this.inputObserver = new InputObserver(this);\n this.eventManager.setAnimationManager(this.animationManager);\n if (startPos) {\n this.eventManager.triggerChange(startPos);\n }\n }\n\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @param {(String[]|String)} axes The name of the axis to associate with inputType inputType과 연결할 축의 이름\n * @param {Object} inputType The inputType instance to associate with the axis of eg.Axes eg.Axes의 축과 연결할 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * axes.connect(\"x\", new eg.Axes.PanInput(\"#area1\"))\n * .connect(\"x xOther\", new eg.Axes.PanInput(\"#area2\"))\n * .connect(\" xOther\", new eg.Axes.PanInput(\"#area3\"))\n * .connect([\"x\"], new eg.Axes.PanInput(\"#area4\"))\n * .connect([\"xOther\", \"x\"], new eg.Axes.PanInput(\"#area5\"))\n * .connect([\"\", \"xOther\"], new eg.Axes.PanInput(\"#area6\"));\n * ```\n */\n public connect(axes: string[] | string, inputType: InputType) {\n let mapped: string[];\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n }\n\n // check same instance\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.inputObserver);\n this._inputs.push(inputType);\n return this;\n }\n\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * }\n * });\n *\n * const input1 = new eg.Axes.PanInput(\"#area1\");\n * const input2 = new eg.Axes.PanInput(\"#area2\");\n * const input3 = new eg.Axes.PanInput(\"#area3\");\n *\n * axes.connect(\"x\", input1);\n * .connect(\"x xOther\", input2)\n * .connect([\"xOther\", \"x\"], input3);\n *\n * axes.disconnect(input1); // disconnects input1\n * axes.disconnect(); // disconnects all of them\n * ```\n */\n public disconnect(inputType?: InputType) {\n if (inputType) {\n const index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach((v) => v.disconnect());\n this._inputs = [];\n }\n return this;\n }\n\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.get(); // {\"x\": 0, \"xOther\": -100, \"zoom\": 50}\n * axes.get([\"x\", \"zoom\"]); // {\"x\": 0, \"zoom\": 50}\n * ```\n */\n public get(axes?: string[]) {\n return this.axisManager.get(axes);\n }\n\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setTo({\"x\": 30, \"zoom\": 60});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setTo({\"x\": 100, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": 60, \"zoom\": 60}\n * ```\n */\n public setTo(pos: Axis, duration = 0) {\n this.animationManager.setTo(pos, duration);\n return this;\n }\n\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration=0] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.setBy({\"x\": 30, \"zoom\": 10});\n * axes.get(); // {\"x\": 30, \"xOther\": -100, \"zoom\": 60}\n *\n * axes.setBy({\"x\": 70, \"xOther\": 60}, 1000); // animatation\n *\n * // after 1000 ms\n * axes.get(); // {\"x\": 100, \"xOther\": -40, \"zoom\": 60}\n * ```\n */\n public setBy(pos: Axis, duration = 0) {\n this.animationManager.setBy(pos, duration);\n return this;\n }\n\n /**\n * Stop an animation in progress.\n * @ko 재생 중인 애니메이션을 정지한다.\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * });\n *\n * axes.setTo({\"x\": 10}, 1000); // start animatation\n *\n * // after 500 ms\n * axes.stopAnimation(); // stop animation during movement.\n * ```\n */\n public stopAnimation() {\n this.animationManager.stopAnimation();\n return this;\n }\n\n /**\n * Change the destination of an animation in progress.\n * @ko 재생 중인 애니메이션의 목적지와 진행 시간을 변경한다.\n * @param {UpdateAnimationOption} pos The coordinate to move to 이동할 좌표\n * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 200]\n * },\n * \"y\": {\n * range: [0, 200]\n * }\n * });\n *\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 500 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}}); // animation will end after 500 ms, at {\"x\": 100, \"y\": 100}\n *\n * // after 500 ms\n * axes.setTo({\"x\": 50, \"y\": 50}, 1000); // trigger animation by setTo\n *\n * // after 700 ms\n * axes.updateAnimation({destPos: {\"x\": 100, \"y\": 100}, duration: 1500, restart: true}); // this works same as axes.setTo({\"x\": 100, \"y\": 100}, 800) since restart is true.\n * ```\n */\n public updateAnimation(options: UpdateAnimationOption) {\n this.animationManager.updateAnimation(options);\n return this;\n }\n\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\n * ```js\n * const axes = new eg.Axes({\n * \"x\": {\n * range: [0, 100]\n * },\n * \"xOther\": {\n * range: [-100, 100]\n * },\n * \t \"zoom\": {\n * range: [50, 30]\n * }\n * });\n *\n * axes.isBounceArea([\"x\"]);\n * axes.isBounceArea([\"x\", \"zoom\"]);\n * axes.isBounceArea();\n * ```\n */\n public isBounceArea(axes?: string[]) {\n return this.axisManager.isOutside(axes);\n }\n\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n */\n public destroy() {\n this.disconnect();\n this.eventManager.destroy();\n }\n}\n\nexport default Axes;\n","import { ExtendedEvent } from \"../types\";\nimport Axes from \"../Axes\";\nimport { getAngle } from \"../utils\";\n\nimport { toAxis } from \"./InputType\";\nimport { PanInput, PanInputOption } from \"./PanInput\";\n\n/**\n * A module that passes the angle moved by touch to Axes and uses one axis of rotation.\n * [Details](https://github.com/naver/egjs-axes/wiki/RotatePanInput)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.\n * [상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\n * ```js\n * const input = new eg.Axes.RotatePanInput(\"#area\");\n *\n * var axes = new eg.Axes({\n *\t// property name('angle') could be anything you want (eg. x, y, z...)\n * \tangle: {\n * \t\trange: [-180, 180] // from -180deg to 180deg\n * \t}\n * });\n *\n * axes.connect(\"angle\", input)\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.RotatePanInput module eg.Axes.RotatePanInput 모듈을 사용할 엘리먼트\n * @param {PanInputOption} [options] The option object of the eg.Axes.PanInput moduleeg.Axes.PanInput 모듈의 옵션 객체\n * @extends PanInput\n */\nexport class RotatePanInput extends PanInput {\n private _rotateOrigin: number[];\n private _prevAngle: number;\n private _prevQuadrant: number = null;\n private _lastDiff = 0;\n private _coefficientForDistanceToAngle: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PanInputOption) {\n super(el, options);\n }\n\n public mapAxes(axes: string[]) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n }\n\n protected _onPanstart(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventStart(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n const rect = this.element.getBoundingClientRect();\n\n this._observer.hold(this, panEvent);\n this._attachWindowEvent(activeEvent);\n // TODO: how to do if element is ellipse not circle.\n this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360\n // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin\n this._rotateOrigin = [\n rect.left + (rect.width - 1) / 2,\n rect.top + (rect.height - 1) / 2,\n ];\n\n // init angle.\n this._prevAngle = null;\n\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanmove(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n const panEvent = activeEvent.onEventMove(event, this.options.inputButton);\n if (!panEvent || !this.isEnabled()) {\n return;\n }\n\n if (panEvent.srcEvent.cancelable !== false) {\n panEvent.srcEvent.preventDefault();\n }\n panEvent.srcEvent.stopPropagation();\n this._triggerChange(panEvent);\n activeEvent.prevEvent = panEvent;\n }\n\n protected _onPanend(event: MouseEvent) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (!this.isEnabled()) {\n return;\n }\n const prevEvent = activeEvent.prevEvent;\n this._triggerChange(prevEvent);\n const vx = prevEvent.velocityX;\n const vy = prevEvent.velocityY;\n const velocity =\n Math.sqrt(vx * vx + vy * vy) * (this._lastDiff > 0 ? -1 : 1); // clockwise\n activeEvent.onRelease();\n this._observer.release(this, prevEvent, [\n velocity * this._coefficientForDistanceToAngle,\n ]);\n this._detachWindowEvent(activeEvent);\n }\n\n private _triggerChange(event: ExtendedEvent) {\n const { x, y } = this._getPosFromOrigin(event.center.x, event.center.y);\n const angle = getAngle(x, y);\n const positiveAngle = angle < 0 ? 360 + angle : angle;\n const quadrant = this._getQuadrant(event.center.x, event.center.y);\n const diff = this._getDifference(\n this._prevAngle,\n positiveAngle,\n this._prevQuadrant,\n quadrant\n );\n\n this._prevAngle = positiveAngle;\n this._prevQuadrant = quadrant;\n\n if (diff === 0) {\n return;\n }\n\n this._lastDiff = diff;\n this._observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise\n }\n\n private _getDifference(\n prevAngle: number,\n angle: number,\n prevQuadrant: number,\n quadrant: number\n ) {\n let diff: number;\n\n if (prevAngle === null) {\n diff = 0;\n } else if (prevQuadrant === 1 && quadrant === 4) {\n diff = -prevAngle - (360 - angle);\n } else if (prevQuadrant === 4 && quadrant === 1) {\n diff = 360 - prevAngle + angle;\n } else {\n diff = angle - prevAngle;\n }\n\n return diff;\n }\n\n private _getPosFromOrigin(posX: number, posY: number) {\n return {\n x: posX - this._rotateOrigin[0],\n y: this._rotateOrigin[1] - posY,\n };\n }\n\n private _getQuadrant(posX: number, posY: number) {\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n const { x, y } = this._getPosFromOrigin(posX, posY);\n let q = 0;\n\n if (x >= 0 && y >= 0) {\n q = 1;\n } else if (x < 0 && y >= 0) {\n q = 2;\n } else if (x < 0 && y < 0) {\n q = 3;\n } else if (x >= 0 && y < 0) {\n q = 4;\n }\n return q;\n }\n}\n","import { $, isCssPropsFromAxes, setCssProps, revertCssProps } from \"../utils\";\nimport { ActiveEvent, InputEventType } from \"../types\";\nimport { DIRECTION_ALL } from \"../const\";\n\nimport {\n toAxis,\n convertInputType,\n InputType,\n InputTypeObserver,\n} from \"./InputType\";\n\nexport interface PinchInputOption {\n scale?: number;\n threshold?: number;\n inputType?: string[];\n touchAction?: string;\n}\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @param {String[]} [inputType=[\"touch\", \"pointer\"]] Types of input devices\n * - touch: Touch screen\n * - pointer: Mouse and touch 입력 장치 종류\n * - touch: 터치 입력 장치\n * - pointer: 마우스 및 터치\n * @param {String} [touchAction=\"none\"] Value that overrides the element's \"touch-action\" css property. It is set to \"none\" to prevent scrolling during touch. 엘리먼트의 \"touch-action\" CSS 속성을 덮어쓰는 값. 터치 도중 스크롤을 방지하기 위해 \"none\" 으로 설정되어 있다.\n **/\n\n/**\n * 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.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\n * ```js\n * const pinch = new eg.Axes.PinchInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * axes.connect(\"something\", pinch);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module eg.Axes.PinchInput 모듈을 사용할 엘리먼트\n * @param {PinchInputOption} [options] The option object of the eg.Axes.PinchInput moduleeg.Axes.PinchInput 모듈의 옵션 객체\n */\nexport class PinchInput implements InputType {\n public options: PinchInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _pinchFlag = false;\n private _enabled = false;\n private _originalCssProps: { [key: string]: string };\n private _activeEvent: ActiveEvent = null;\n private _baseValue: number;\n\n /**\n *\n */\n public constructor(el: string | HTMLElement, options?: PinchInputOption) {\n this.element = $(el);\n this.options = {\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n touchAction: \"none\",\n ...options,\n };\n this._onPinchStart = this._onPinchStart.bind(this);\n this._onPinchMove = this._onPinchMove.bind(this);\n this._onPinchEnd = this._onPinchEnd.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n if (this._activeEvent) {\n this._detachEvent();\n }\n this._attachEvent(observer);\n this._originalCssProps = setCssProps(\n this.element,\n this.options,\n DIRECTION_ALL\n );\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n if (!isCssPropsFromAxes(this._originalCssProps)) {\n revertCssProps(this.element, this._originalCssProps);\n }\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onPinchStart(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventStart(event);\n if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) {\n return;\n }\n\n this._baseValue = this._observer.get(this)[this.axes[0]];\n this._observer.hold(this, event);\n this._pinchFlag = true;\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchMove(event: InputEventType) {\n const activeEvent = this._activeEvent;\n const pinchEvent = activeEvent.onEventMove(event);\n if (\n !pinchEvent ||\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) !== 2\n ) {\n return;\n }\n\n const offset = this._getOffset(\n pinchEvent.scale,\n activeEvent.prevEvent.scale\n );\n this._observer.change(this, event, toAxis(this.axes, [offset]));\n activeEvent.prevEvent = pinchEvent;\n }\n\n private _onPinchEnd(event: InputEventType) {\n const activeEvent = this._activeEvent;\n activeEvent.onEventEnd(event);\n if (\n !this._pinchFlag ||\n !this._enabled ||\n activeEvent.getTouches(event) >= 2\n ) {\n return;\n }\n\n activeEvent.onRelease();\n this._observer.release(this, event, [0], 0);\n this._baseValue = null;\n this._pinchFlag = false;\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n const activeEvent = convertInputType(this.options.inputType);\n if (!activeEvent) {\n return;\n }\n this._observer = observer;\n this._enabled = true;\n this._activeEvent = activeEvent;\n activeEvent.start.forEach((event) => {\n this.element.addEventListener(event, this._onPinchStart, false);\n });\n activeEvent.move.forEach((event) => {\n this.element.addEventListener(event, this._onPinchMove, false);\n });\n activeEvent.end.forEach((event) => {\n this.element.addEventListener(event, this._onPinchEnd, false);\n });\n }\n\n private _detachEvent() {\n const activeEvent = this._activeEvent;\n activeEvent?.start.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchStart, false);\n });\n activeEvent?.move.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchMove, false);\n });\n activeEvent?.end.forEach((event) => {\n this.element.removeEventListener(event, this._onPinchEnd, false);\n });\n this._enabled = false;\n this._observer = null;\n }\n\n private _getOffset(pinchScale: number, prev: number = 1): number {\n return this._baseValue * (pinchScale - prev) * this.options.scale;\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport interface WheelInputOption {\n scale?: number;\n releaseDelay?: number;\n useNormalized?: boolean;\n useAnimation?: boolean;\n}\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @param {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [releaseDelay=300] Millisecond that trigger release event after last input마지막 입력 이후 release 이벤트가 트리거되기까지의 밀리초\n * @param {Boolean} [useNormalized=true] Whether to calculate scroll speed the same in all browsers모든 브라우저에서 스크롤 속도를 동일하게 처리할지 여부\n * @param {Boolean} [useAnimation=false] Whether to process coordinate changes through the mouse wheel as a continuous animation마우스 휠을 통한 좌표 변화를 연속적인 애니메이션으로 처리할지 여부\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis.\n * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const wheel = new eg.Axes.WheelInput(\"#area\", {\n * \t\tscale: 1\n * });\n *\n * // Connect 'something' axis when the mousewheel is moved.\n * axes.connect(\"something\", wheel);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module eg.Axes.WheelInput 모듈을 사용할 엘리먼트\n * @param {WheelInputOption} [options] The option object of the eg.Axes.WheelInput moduleeg.Axes.WheelInput 모듈의 옵션 객체\n */\nexport class WheelInput implements InputType {\n public options: WheelInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: WheelInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: 1,\n releaseDelay: 300,\n useNormalized: true,\n useAnimation: false,\n },\n ...options,\n };\n this._onWheel = this._onWheel.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onWheel(event: WheelEvent) {\n if (!this._enabled) {\n return;\n }\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n const offset =\n (event.deltaY > 0 ? -1 : 1) *\n this.options.scale *\n (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this._observer.change(\n this,\n event,\n toAxis(this.axes, [offset]),\n this.options.useAnimation\n );\n clearTimeout(this._timer);\n\n this._timer = setTimeout(() => {\n if (this._holding) {\n this._holding = false;\n this._observer.release(this, event, [0]);\n }\n }, this.options.releaseDelay);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"wheel\", this._onWheel);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"wheel\", this._onWheel);\n this._enabled = false;\n this._observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n }\n}\n","import { $ } from \"../utils\";\n\nimport { toAxis, InputType, InputTypeObserver } from \"./InputType\";\n\nexport const KEY_LEFT_ARROW = 37;\nexport const KEY_A = 65;\nexport const KEY_UP_ARROW = 38;\nexport const KEY_W = 87;\nexport const KEY_RIGHT_ARROW = 39;\nexport const KEY_D = 68;\nexport const KEY_DOWN_ARROW = 40;\nexport const KEY_S = 83;\n\n/* eslint-disable */\nconst DIRECTION_REVERSE = -1;\nconst DIRECTION_FORWARD = 1;\nconst DIRECTION_HORIZONTAL = -1;\nconst DIRECTION_VERTICAL = 1;\nconst DELAY = 80;\n/* eslint-enable */\n\nexport interface MoveKeyInputOption {\n scale?: number[];\n}\n\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @param {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @param {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @param {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n **/\n\n/**\n * A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis.\n * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다.\n *\n * @example\n * ```js\n * const moveKey = new eg.Axes.MoveKeyInput(\"#area\", {\n * \t\tscale: [1, 1]\n * });\n *\n * // Connect 'x', 'y' axes when the moveKey is pressed.\n * axes.connect([\"x\", \"y\"], moveKey);\n * ```\n * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module eg.Axes.MoveKeyInput 모듈을 사용할 엘리먼트\n * @param {MoveKeyInputOption} [options] The option object of the eg.Axes.MoveKeyInput moduleeg.Axes.MoveKeyInput 모듈의 옵션 객체\n */\nexport class MoveKeyInput implements InputType {\n public options: MoveKeyInputOption;\n public axes: string[] = [];\n public element: HTMLElement = null;\n private _observer: InputTypeObserver;\n private _enabled = false;\n private _holding = false;\n private _timer: NodeJS.Timeout = null;\n\n /**\n *\n */\n public constructor(el, options?: MoveKeyInputOption) {\n this.element = $(el);\n this.options = {\n ...{\n scale: [1, 1],\n },\n ...options,\n };\n this._onKeydown = this._onKeydown.bind(this);\n this._onKeyup = this._onKeyup.bind(this);\n }\n\n public mapAxes(axes: string[]) {\n this.axes = axes;\n }\n\n public connect(observer: InputTypeObserver): InputType {\n this._detachEvent();\n\n // add tabindex=\"0\" to the container for making it focusable\n if (this.element.getAttribute(\"tabindex\") !== \"0\") {\n this.element.setAttribute(\"tabindex\", \"0\");\n }\n\n this._attachEvent(observer);\n return this;\n }\n\n public disconnect() {\n this._detachEvent();\n return this;\n }\n\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n */\n public destroy() {\n this.disconnect();\n this.element = null;\n }\n\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public enable() {\n this._enabled = true;\n return this;\n }\n\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @return {MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n public disable() {\n this._enabled = false;\n return this;\n }\n\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n public isEnabled() {\n return this._enabled;\n }\n\n private _onKeydown(event: KeyboardEvent) {\n if (!this._enabled) {\n return;\n }\n\n let isMoveKey = true;\n let direction = DIRECTION_FORWARD;\n let move = DIRECTION_HORIZONTAL;\n\n switch (event.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL;\n break;\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL;\n break;\n default:\n isMoveKey = false;\n }\n if (\n (move === DIRECTION_HORIZONTAL && !this.axes[0]) ||\n (move === DIRECTION_VERTICAL && !this.axes[1])\n ) {\n isMoveKey = false;\n }\n if (!isMoveKey) {\n return;\n }\n event.preventDefault();\n const offsets =\n move === DIRECTION_HORIZONTAL\n ? [+this.options.scale[0] * direction, 0]\n : [0, +this.options.scale[1] * direction];\n\n if (!this._holding) {\n this._observer.hold(this, event);\n this._holding = true;\n }\n clearTimeout(this._timer);\n this._observer.change(this, event, toAxis(this.axes, offsets));\n }\n\n private _onKeyup(event: KeyboardEvent) {\n if (!this._holding) {\n return;\n }\n clearTimeout(this._timer);\n this._timer = setTimeout(() => {\n this._observer.release(this, event, [0, 0]);\n this._holding = false;\n }, DELAY);\n }\n\n private _attachEvent(observer: InputTypeObserver) {\n this._observer = observer;\n this.element.addEventListener(\"keydown\", this._onKeydown, false);\n this.element.addEventListener(\"keypress\", this._onKeydown, false);\n this.element.addEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = true;\n }\n\n private _detachEvent() {\n this.element.removeEventListener(\"keydown\", this._onKeydown, false);\n this.element.removeEventListener(\"keypress\", this._onKeydown, false);\n this.element.removeEventListener(\"keyup\", this._onKeyup, false);\n this._enabled = false;\n this._observer = null;\n }\n}\n","import Axes from \"./Axes\";\nimport { PanInput } from \"./inputType/PanInput\";\nimport { RotatePanInput } from \"./inputType/RotatePanInput\";\nimport { PinchInput } from \"./inputType/PinchInput\";\nimport { WheelInput } from \"./inputType/WheelInput\";\nimport { MoveKeyInput } from \"./inputType/MoveKeyInput\";\n\nAxes.PanInput = PanInput;\nAxes.RotatePanInput = RotatePanInput;\nAxes.PinchInput = PinchInput;\nAxes.WheelInput = WheelInput;\nAxes.MoveKeyInput = MoveKeyInput;\n\nexport default Axes;\n"],"names":["win","window","navigator","userAgent","toArray","nodes","el","i","len","length","push","keyInfo_1","oldraf_1","DIRECTION_VERTICAL","MOUSE_LEFT","MOUSE_RIGHT","MOUSE_MIDDLE","IS_IOS_SAFARI","browser","name","TRANSFORM","document","bodyStyle","head","getElementsByTagName","style","target","PREVENT_DRAG_CSSPROPS","$","param","multi","dummy","match","createElement","innerHTML","childNodes","querySelectorAll","undefined","nodeName","nodeType","jQuery","constructor","prototype","jquery","get","Array","isArray","map","v","raf","requestAnimationFrame","webkitRequestAnimationFrame","caf","cancelAnimationFrame","webkitCancelAnimationFrame","callback","key","timestamp","setTimeout","performance","now","Date","getTime","clearTimeout","obj","tranformed","k","filter","filtered","every","equal","base","roundNumber","num","roundUnit","roundNumFunc","getRoundFunc","roundNumbers","value","getDecimalPlace","val","isFinite","indexOf","p","e","Math","round","getAngle","posX","posY","atan2","PI","isCssPropsFromAxes","originalCssProps","same","Object","keys","forEach","prop","setCssProps","element","option","direction","touchAction","newCssProps_1","touchActionMap","_a","oldCssProps","revertCssProps","getInsidePosition","destPos","range","circular","bounce","toDestPos","targetRange","max","min","isOutside","pos","isCircularable","getCirculatedPos","toPos","toAxis","source","offset","reduce","acc","convertInputType","inputType","hasTouch","hasMouse","hasPointer","SUPPORT_TOUCH","SUPPORT_POINTER_EVENTS","PointerEventInput","TouchMouseEventInput","TouchEventInput","MouseEventInput","clamp","useDirection","checkType","userDirection","pow","n","_axes","roundPos","this","_getRoundPos","trigger","ComponentEvent","input","inputEvent","event","isTrusted","depaPos","roundDepa","setTo","_createUserControll","duration","__assign","bounceRatio","_getBounceRatio","holding","animationManager","axisManager","eventInfo","getEventInfo","moveTo","delta","set","isCanceled","off","userControl","userDuration","options","opt","_options","interruptable","_prevented","prevented","_axis","_complementOptions","_pos","_this","fullDepaPos","axes","axisOptions","axis","axisOption","test","SUPPORT_POINTER","SUPPORT_MSPOINTER","preventDefault","removeEventListener","_stopContextMenu","prevEvent","center","_getCenter","movement","_getMovement","x","y","scale","_getScale","angle","deltaX","deltaY","offsetX","offsetY","latestInterval","_latestInterval","timeStamp","deltaTime","velocityX","velocityY","srcEvent","preventSystemEvent","start","end","clientX","clientY","sqrt","buttonCodeMap","button","_isTouchEvent","buttons","type","inputButton","addEventListener","__extends","_getButton","_isValidButton","_preventMouseButton","extendEvent","prev","EventInput","_baseTouches","touches","_getDistance","identifier","_updatePointerEvent","_removePointerEvent","_firstInputs","_recentInputs","pointerId","addFlag","id","nextSpot","prevSpot","interruptManager","eventManager","_interruptManager","_eventManager","_axisManager","_animationManager","changeOption","isInterrupted","_isStopped","setInterrupt","stopAnimation","_moveDistance","hold","_isOutside","useAnimation","nativeEvent","isInterrupting","__childrenAxesAlreadyChanged","_atOutside","nested","_isEndofAxis","getDuration","animateTo","triggerChange","finish","velocity","inputDuration","displacement","userWish","isEqual","__childrenAxesAlreadyReleased","getDisplacement","getDelta","triggerRelease","getUserControl","restore","triggerFinish","tn","tx","out","interpolate","threshold","initSlope","_easing","diffTime","currentPos","ratio","animateParam","_animateParam","startTime","restart","_initialEasingPer","_prevEasingPer","_durationOffset","info","easingPer","finished","prevState","prevPos","directions","rangeOffset","nextPos","circulatedPos","easing","animationEnd","bind","wishDuration","durations_1","distance","abs","deceleration","Infinity","minimumDuration","maximumDuration","totalVelocity","total","orgPos_1","_raf","triggerAnimationEnd","beforeParam","circularTargets","_createAnimationParam","retTrigger","triggerAnimationStart","console","warn","_animateLoop","orgPos","movedPos","done","complete","originalIntendedPos_1","state_1","loop_1","_initState","nextState","_getNextState","_getFinalPos","originalIntendedPos","_getRoundUnit","minRoundUnit","getAxisOptions","startPos","_super","InterruptManager","AxisManager","EventManager","EasingManager","inputObserver","InputObserver","setAnimationManager","mapped","split","concat","_inputs","disconnect","mapAxes","connect","index","splice","setBy","updateAnimation","destroy","Axes","Component","activeEvent","_activeEvent","onRelease","_observer","release","_detachWindowEvent","thresholdAngle","iOSEdgeSwipeThreshold","releaseOnScroll","_onPanstart","_onPanmove","_onPanend","useHorizontal","useVertical","_direction","observer","_detachElementEvent","_attachElementEvent","_originalCssProps","_enabled","edgeThreshold","panEvent","onEventStart","getTouches","cancelable","_atRightEdge","innerWidth","_attachWindowEvent","onEventMove","toAngle","getDirectionByAngle","_forceRelease","_rightEdgeTimer","_getOffset","prevent","some","stopPropagation","change","onEventEnd","move","passive","properties","_voidFunction","DIRECTION_ALL","rect","isEnabled","getBoundingClientRect","_coefficientForDistanceToAngle","width","_rotateOrigin","left","top","height","_prevAngle","_triggerChange","vx","vy","_lastDiff","_getPosFromOrigin","positiveAngle","quadrant","_getQuadrant","diff","_getDifference","_prevQuadrant","prevAngle","prevQuadrant","q","PanInput","_onPinchStart","_onPinchMove","_onPinchEnd","_detachEvent","_attachEvent","pinchEvent","_baseValue","_pinchFlag","pinchScale","releaseDelay","useNormalized","_onWheel","_holding","_timer","_onKeydown","_onKeyup","getAttribute","setAttribute","offsets","isMoveKey","keyCode","RotatePanInput","PinchInput","WheelInput","MoveKeyInput"],"mappings":";;;;;;;;y4CAEIA,6+EAIFA,EAFoB,oBAAXC,OAEH,CACJC,UAAW,CACTC,UAAW,KAITF,g0DCEe,SAAVG,EAAWC,WAGhBC,EAAK,GACFC,EAAI,EAAGC,EAAMH,EAAMI,OAAQF,EAAIC,EAAKD,IAC3CD,EAAGI,KAAKL,EAAME,WAETD,ECrBF,wBDsECK,EACAC,ECjEKC,EAAqB,GAGrBC,EAAa,OACbC,EAAc,QACdC,EAAe,SASfC,EACX,iBAAkBhB,GAAsC,ygCAAjBiB,QAAQC,KAEpCC,EAAa,cACA,oBAAbC,eACF,WAEHC,GAAaD,SAASE,MAAQF,SAASG,qBAAqB,QAAQ,IACvEC,MACGC,EAAS,CACb,YACA,kBACA,cACA,gBAEOnB,EAAI,EAAGC,EAAMkB,EAAOjB,OAAQF,EAAIC,EAAKD,OACxCmB,EAAOnB,KAAMe,SACRI,EAAOnB,SAGX,GAjBiB,GAoBboB,EAAwB,eACpB,2BACM,QDrBVC,EAAI,SAACC,EAAOC,OAWbC,EAGNzB,sBAdmBwB,MAGF,iBAAVD,GAWPvB,EARYuB,EAAMG,MAAM,2BAKlBD,EAAQV,SAASY,cAAc,QAE/BC,UAAYL,EACbzB,EAAQ2B,EAAMI,aAGd/B,EAAQiB,SAASe,iBAAiBP,IAEpCC,IACHxB,EAAkB,GAAbA,EAAGG,OAAcH,EAAG,QAAK+B,IAEvBR,IAAU5B,KAGV4B,EAAMS,UAAgC,IAAnBT,EAAMU,UAAqC,IAAnBV,EAAMU,UAIzD,WAAYtC,GAAU4B,aAAiBW,QACxCX,EAAMY,YAAYC,UAAUC,OAG5BrC,EAAKwB,EAAQD,EAAMzB,UAAYyB,EAAMe,IAAI,GAChCC,MAAMC,QAAQjB,KACvBvB,EAAK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wB,KAAKuC,KAAMoR,kBAGvD,SAAiBrT,cACVN,KAAKqT,WAGVzY,aAAaoF,KAAKsT,aACbA,OAAS/Y,WAAW,WACvB8H,EAAKkM,UAAUC,QAAQnM,EAAM/B,EAAO,CAAC,EAAG,IACxC+B,EAAKgR,UAAW,GA7KR,qBAiLZ,SAAqBlE,QACdZ,UAAYY,OACZlS,QAAQiI,iBAAiB,UAAWlF,KAAKuT,YAAY,QACrDtW,QAAQiI,iBAAiB,WAAYlF,KAAKuT,YAAY,QACtDtW,QAAQiI,iBAAiB,QAASlF,KAAKwT,UAAU,QACjDjE,UAAW,kBAGlB,gBACOtS,QAAQ8F,oBAAoB,UAAW/C,KAAKuT,YAAY,QACxDtW,QAAQ8F,oBAAoB,WAAY/C,KAAKuT,YAAY,QACzDtW,QAAQ8F,oBAAoB,QAAS/C,KAAKwT,UAAU,QACpDjE,UAAW,OACXhB,UAAY,kBCzMrBL,GAAKsE,SAAWA,GAChBtE,GAAK4F,eAAiBA,GACtB5F,GAAK6F,WAAaA,GAClB7F,GAAK8F,WAAaA,GAClB9F,GAAK+F,aAAeA"} \ No newline at end of file diff --git a/package.json b/package.json index ce54aa5c..235c96ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@egjs/axes", - "version": "3.2.2-snapshot", + "version": "3.3.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.", "sideEffects": false, "main": "dist/axes.js",