diff --git a/.gitignore b/.gitignore index da92a6a71..771f6503d 100644 --- a/.gitignore +++ b/.gitignore @@ -206,4 +206,3 @@ report/ temp/ demo/_data/version.yml demo/release/ -dist/ diff --git a/dist/PanoViewer/view360.panoviewer.js b/dist/PanoViewer/view360.panoviewer.js new file mode 100644 index 000000000..a98d9b3d1 --- /dev/null +++ b/dist/PanoViewer/view360.panoviewer.js @@ -0,0 +1,8026 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@egjs/axes'), require('@egjs/component'), require('@egjs/agent'), require('gl-matrix')) : + typeof define === 'function' && define.amd ? define(['exports', '@egjs/axes', '@egjs/component', '@egjs/agent', 'gl-matrix'], factory) : + (factory((global.eg = global.eg || {}, global.eg.view360 = {}),global.eg.Axes,global.eg.Component,global.eg.Agent,global.glMatrix)); +}(this, (function (exports,Axes,Component,Agent,glMatrix) { 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); + } + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var es6Promise = createCommonjsModule(function (module, exports) { + /*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ + + (function (global, factory) { + module.exports = factory(); + }(commonjsGlobal, (function () { + function objectOrFunction(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); + } + + function isFunction(x) { + return typeof x === 'function'; + } + + + + var _isArray = void 0; + if (Array.isArray) { + _isArray = Array.isArray; + } else { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } + + var isArray = _isArray; + + var len = 0; + var vertxNext = void 0; + var customSchedulerFn = void 0; + + var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } + }; + + function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; + } + + function setAsap(asapFn) { + asap = asapFn; + } + + var browserWindow = typeof window !== 'undefined' ? window : undefined; + var browserGlobal = browserWindow || {}; + var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; + var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + + // node + function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; + } + + // vertx + function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); + } + + function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; + } + + // web worker + function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; + } + + function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; + } + + var queue = new Array(1000); + function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; + } + + function attemptVertx() { + try { + var vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } + } + + var scheduleFlush = void 0; + // Decide what async method to use to triggering processing of queued callbacks: + if (isNode) { + scheduleFlush = useNextTick(); + } else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); + } else if (isWorker) { + scheduleFlush = useMessageChannel(); + } else if (browserWindow === undefined && typeof commonjsRequire === 'function') { + scheduleFlush = attemptVertx(); + } else { + scheduleFlush = useSetTimeout(); + } + + function then(onFulfillment, onRejection) { + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + + if (_state) { + var callback = arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + } + + /** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + function resolve$1(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + resolve(promise, object); + return promise; + } + + var PROMISE_ID = Math.random().toString(36).substring(2); + + function noop() {} + + var PENDING = void 0; + var FULFILLED = 1; + var REJECTED = 2; + + function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { + try { + then$$1.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } + } + + function handleForeignThenable(promise, thenable, then$$1) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then$$1, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); + } + + function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return resolve(promise, value); + }, function (reason) { + return reject(promise, reason); + }); + } + } + + function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$1 === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); + } else { + fulfill(promise, maybeThenable); + } + } + } + + function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + var then$$1 = void 0; + try { + then$$1 = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then$$1); + } else { + fulfill(promise, value); + } + } + + function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); + } + + function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } + } + + function reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); + } + + function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } + } + + function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = void 0, + callback = void 0, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = void 0, + error = void 0, + succeeded = true; + + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + + if (promise._state !== PENDING) ; else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } + } + + function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch (e) { + reject(promise, e); + } + } + + var id = 0; + function nextId() { + return id++; + } + + function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; + } + + function validationError() { + return new Error('Array Methods must be provided an Array'); + } + + var Enumerator = function () { + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + + Enumerator.prototype._enumerate = function _enumerate(input) { + for (var i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + }; + + Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { + var c = this._instanceConstructor; + var resolve$$1 = c.resolve; + + + if (resolve$$1 === resolve$1) { + var _then = void 0; + var error = void 0; + var didError = false; + try { + _then = entry.then; + } catch (e) { + didError = true; + error = e; + } + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise$1) { + var promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, _then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$1(entry), i); + } + }; + + Enumerator.prototype._settledAt = function _settledAt(state, i, value) { + var promise = this.promise; + + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + + Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + + return Enumerator; + }(); + + /** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static + */ + function all(entries) { + return new Enumerator(this, entries).promise; + } + + /** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. + */ + function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } + } + + /** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. + */ + function reject$1(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + reject(promise, reason); + return promise; + } + + function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor + */ + + var Promise$1 = function () { + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + Chaining + -------- + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + Assimilation + ------------ + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + If the assimliated promise rejects, then the downstream promise will also reject. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + Simple Example + -------------- + Synchronous Example + ```javascript + let result; + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + Promise Example; + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + Advanced Example + -------------- + Synchronous Example + ```javascript + let author, books; + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + function foundBooks(books) { + } + function failure(reason) { + } + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + Promise Example; + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + + + Promise.prototype.catch = function _catch(onRejection) { + return this.then(null, onRejection); + }; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + Synchronous example: + + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + + Asynchronous example: + + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + + @method finally + @param {Function} callback + @return {Promise} + */ + + + Promise.prototype.finally = function _finally(callback) { + var promise = this; + var constructor = promise.constructor; + + if (isFunction(callback)) { + return promise.then(function (value) { + return constructor.resolve(callback()).then(function () { + return value; + }); + }, function (reason) { + return constructor.resolve(callback()).then(function () { + throw reason; + }); + }); + } + + return promise.then(callback, callback); + }; + + return Promise; + }(); + + Promise$1.prototype.then = then; + Promise$1.all = all; + Promise$1.race = race; + Promise$1.resolve = resolve$1; + Promise$1.reject = reject$1; + Promise$1._setScheduler = setScheduler; + Promise$1._setAsap = setAsap; + Promise$1._asap = asap; + + /*global self*/ + function polyfill() { + var local = void 0; + + if (typeof commonjsGlobal !== 'undefined') { + local = commonjsGlobal; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise$1; + } + + // Strange compat.. + Promise$1.polyfill = polyfill; + Promise$1.Promise = Promise$1; + + return Promise$1; + + }))); + + + + + }); + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + /* eslint-disable no-new-func, no-nested-ternary */ + + var win = typeof window !== "undefined" && window.Math === Math ? window : typeof self !== "undefined" && self.Math === Math ? self : Function("return this")(); + /* eslint-enable no-new-func, no-nested-ternary */ + + var doc = win.document; + var agent = Agent(); + var osName = agent.os.name; + var browserName = agent.browser.name; + var IS_IOS = osName === "ios"; + var IS_SAFARI_ON_DESKTOP = osName === "mac" && browserName === "safari"; + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + win.Float32Array = typeof win.Float32Array !== "undefined" ? win.Float32Array : win.Array; + var Float32Array$1 = win.Float32Array; + var getComputedStyle = win.getComputedStyle; + var userAgent = win.navigator.userAgent; + var SUPPORT_TOUCH = "ontouchstart" in win; + var SUPPORT_DEVICEMOTION = "ondevicemotion" in win; + var DeviceMotionEvent = win.DeviceMotionEvent; + var devicePixelRatio = win.devicePixelRatio; + + var TRANSFORM = function () { + var docStyle = doc.documentElement.style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in docStyle) { + return target[i]; + } + } + + return ""; + }(); // check for will-change support + + + var SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports && win.CSS.supports("will-change", "transform"); + var WEBXR_SUPPORTED = false; + + var checkXRSupport = function checkXRSupport() { + if (!navigator.xr) { + return; + } + + if (navigator.xr.isSessionSupported) { + navigator.xr.isSessionSupported("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } else if (navigator.xr.supportsSession) { + navigator.xr.supportsSession("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } + }; + + /** + * Original Code + * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js + * Math Util + * modified by egjs + */ + + function quatToVec3(quaternion) { + var baseV = glMatrix.vec3.fromValues(0, 0, 1); + glMatrix.vec3.transformQuat(baseV, baseV, quaternion); + return baseV; + } + + function toDegree(a) { + return a * 180 / Math.PI; + } + + var util = {}; + + util.isPowerOfTwo = function (n) { + return n && (n & n - 1) === 0; + }; + + util.extractPitchFromQuat = function (quaternion) { + var baseV = quatToVec3(quaternion); + return -1 * Math.atan2(baseV[1], Math.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2))); + }; + + util.hypot = Math.hypot || function (x, y) { + return Math.sqrt(x * x + y * y); + }; // implement reference + // the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식 + // calculating angle between two vectors : http://darkpgmr.tistory.com/121 + + + var ROTATE_CONSTANT = { + PITCH_DELTA: 1, + YAW_DELTA_BY_ROLL: 2, + YAW_DELTA_BY_YAW: 3 + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = { + targetAxis: [0, 1, 0], + meshPoint: [0, 0, 1] + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = { + targetAxis: [0, 1, 0], + meshPoint: [1, 0, 0] + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = { + targetAxis: [1, 0, 0], + meshPoint: [0, 0, 1] + }; + + function getRotationDelta(prevQ, curQ, rotateKind) { + var targetAxis = glMatrix.vec3.fromValues(ROTATE_CONSTANT[rotateKind].targetAxis[0], ROTATE_CONSTANT[rotateKind].targetAxis[1], ROTATE_CONSTANT[rotateKind].targetAxis[2]); + var meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint; + var prevQuaternion = glMatrix.quat.clone(prevQ); + var curQuaternion = glMatrix.quat.clone(curQ); + glMatrix.quat.normalize(prevQuaternion, prevQuaternion); + glMatrix.quat.normalize(curQuaternion, curQuaternion); + var prevPoint = glMatrix.vec3.fromValues(0, 0, 1); + var curPoint = glMatrix.vec3.fromValues(0, 0, 1); + glMatrix.vec3.transformQuat(prevPoint, prevPoint, prevQuaternion); + glMatrix.vec3.transformQuat(curPoint, curPoint, curQuaternion); + glMatrix.vec3.transformQuat(targetAxis, targetAxis, curQuaternion); + var rotateDistance = glMatrix.vec3.dot(targetAxis, glMatrix.vec3.cross(glMatrix.vec3.create(), prevPoint, curPoint)); + var rotateDirection = rotateDistance > 0 ? 1 : -1; // when counter clock wise, use vec3.fromValues(0,1,0) + // when clock wise, use vec3.fromValues(0,-1,0) + // const meshPoint1 = vec3.fromValues(0, 0, 0); + + var meshPoint2 = glMatrix.vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + var meshPoint3; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + meshPoint3 = glMatrix.vec3.fromValues(0, rotateDirection, 0); + } else { + meshPoint3 = glMatrix.vec3.fromValues(rotateDirection, 0, 0); + } + + glMatrix.vec3.transformQuat(meshPoint2, meshPoint2, curQuaternion); + glMatrix.vec3.transformQuat(meshPoint3, meshPoint3, curQuaternion); + var vecU = meshPoint2; + var vecV = meshPoint3; + var vecN = glMatrix.vec3.create(); + glMatrix.vec3.cross(vecN, vecU, vecV); + glMatrix.vec3.normalize(vecN, vecN); + var coefficientA = vecN[0]; + var coefficientB = vecN[1]; + var coefficientC = vecN[2]; // const coefficientD = -1 * vec3.dot(vecN, meshPoint1); + // a point on the plane + + curPoint = glMatrix.vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + glMatrix.vec3.transformQuat(curPoint, curPoint, curQuaternion); // a point should project on the plane + + prevPoint = glMatrix.vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + glMatrix.vec3.transformQuat(prevPoint, prevPoint, prevQuaternion); // distance between prevPoint and the plane + + var distance = Math.abs(prevPoint[0] * coefficientA + prevPoint[1] * coefficientB + prevPoint[2] * coefficientC); + var projectedPrevPoint = glMatrix.vec3.create(); + glMatrix.vec3.subtract(projectedPrevPoint, prevPoint, glMatrix.vec3.scale(glMatrix.vec3.create(), vecN, distance)); + var trigonometricRatio = (projectedPrevPoint[0] * curPoint[0] + projectedPrevPoint[1] * curPoint[1] + projectedPrevPoint[2] * curPoint[2]) / (glMatrix.vec3.length(projectedPrevPoint) * glMatrix.vec3.length(curPoint)); // defensive block + + trigonometricRatio > 1 && (trigonometricRatio = 1); + var theta = Math.acos(trigonometricRatio); + var crossVec = glMatrix.vec3.cross(glMatrix.vec3.create(), curPoint, projectedPrevPoint); + distance = coefficientA * crossVec[0] + coefficientB * crossVec[1] + coefficientC * crossVec[2]; + var thetaDirection; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + thetaDirection = distance > 0 ? 1 : -1; + } else { + thetaDirection = distance < 0 ? 1 : -1; + } + + var deltaRadian = theta * thetaDirection * rotateDirection; + return toDegree(deltaRadian); + } + + function angleBetweenVec2(v1, v2) { + var det = v1[0] * v2[1] - v2[0] * v1[1]; + var theta = -Math.atan2(det, glMatrix.vec2.dot(v1, v2)); + return theta; + } + + util.yawOffsetBetween = function (viewDir, targetDir) { + var viewDirXZ = glMatrix.vec2.fromValues(viewDir[0], viewDir[2]); + var targetDirXZ = glMatrix.vec2.fromValues(targetDir[0], targetDir[2]); + glMatrix.vec2.normalize(viewDirXZ, viewDirXZ); + glMatrix.vec2.normalize(targetDirXZ, targetDirXZ); + var theta = -angleBetweenVec2(viewDirXZ, targetDirXZ); + return theta; + }; + + util.toDegree = toDegree; + util.getRotationDelta = getRotationDelta; + util.angleBetweenVec2 = angleBetweenVec2; + + function toAxis(source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + } + + /* + * Copyright 2016 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + var MathUtil = window.MathUtil || {}; + + MathUtil.degToRad = Math.PI / 180; + MathUtil.radToDeg = 180 / Math.PI; + + // Some minimal math functionality borrowed from THREE.Math and stripped down + // for the purposes of this library. + + + MathUtil.Vector2 = function ( x, y ) { + this.x = x || 0; + this.y = y || 0; + }; + + MathUtil.Vector2.prototype = { + constructor: MathUtil.Vector2, + + set: function ( x, y ) { + this.x = x; + this.y = y; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + + return this; + }, + + subVectors: function ( a, b ) { + this.x = a.x - b.x; + this.y = a.y - b.y; + + return this; + }, + }; + + MathUtil.Vector3 = function ( x, y, z ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + }; + + MathUtil.Vector3.prototype = { + constructor: MathUtil.Vector3, + + set: function ( x, y, z ) { + this.x = x; + this.y = y; + this.z = z; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + + return this; + }, + + length: function () { + return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); + }, + + normalize: function () { + var scalar = this.length(); + + if ( scalar !== 0 ) { + var invScalar = 1 / scalar; + + this.multiplyScalar(invScalar); + } else { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + multiplyScalar: function ( scalar ) { + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; + }, + + applyQuaternion: function ( q ) { + var x = this.x; + var y = this.y; + var z = this.z; + + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + + // calculate quat * vector + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = - qx * x - qy * y - qz * z; + + // calculate result * inverse quat + this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; + this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; + this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; + + return this; + }, + + dot: function ( v ) { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + crossVectors: function ( a, b ) { + var ax = a.x, ay = a.y, az = a.z; + var bx = b.x, by = b.y, bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + }; + + MathUtil.Quaternion = function ( x, y, z, w ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = ( w !== undefined ) ? w : 1; + }; + + MathUtil.Quaternion.prototype = { + constructor: MathUtil.Quaternion, + + set: function ( x, y, z, w ) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + + return this; + }, + + copy: function ( quaternion ) { + this.x = quaternion.x; + this.y = quaternion.y; + this.z = quaternion.z; + this.w = quaternion.w; + + return this; + }, + + setFromEulerXYZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 + s1 * s2 * c3; + this.w = c1 * c2 * c3 - s1 * s2 * s3; + + return this; + }, + + setFromEulerYXZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 - s1 * s2 * c3; + this.w = c1 * c2 * c3 + s1 * s2 * s3; + + return this; + }, + + setFromAxisAngle: function ( axis, angle ) { + // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm + // assumes axis is normalized + + var halfAngle = angle / 2, s = Math.sin( halfAngle ); + + this.x = axis.x * s; + this.y = axis.y * s; + this.z = axis.z * s; + this.w = Math.cos( halfAngle ); + + return this; + }, + + multiply: function ( q ) { + return this.multiplyQuaternions( this, q ); + }, + + multiplyQuaternions: function ( a, b ) { + // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm + + var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w; + var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w; + + this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; + this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; + this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; + this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; + + return this; + }, + + inverse: function () { + this.x *= -1; + this.y *= -1; + this.z *= -1; + + this.normalize(); + + return this; + }, + + normalize: function () { + var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); + + if ( l === 0 ) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } else { + l = 1 / l; + + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + + return this; + }, + + slerp: function ( qb, t ) { + if ( t === 0 ) return this; + if ( t === 1 ) return this.copy( qb ); + + var x = this.x, y = this.y, z = this.z, w = this.w; + + // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + + var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z; + + if ( cosHalfTheta < 0 ) { + this.w = - qb.w; + this.x = - qb.x; + this.y = - qb.y; + this.z = - qb.z; + + cosHalfTheta = - cosHalfTheta; + } else { + this.copy( qb ); + } + + if ( cosHalfTheta >= 1.0 ) { + this.w = w; + this.x = x; + this.y = y; + this.z = z; + + return this; + } + + var halfTheta = Math.acos( cosHalfTheta ); + var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); + + if ( Math.abs( sinHalfTheta ) < 0.001 ) { + this.w = 0.5 * ( w + this.w ); + this.x = 0.5 * ( x + this.x ); + this.y = 0.5 * ( y + this.y ); + this.z = 0.5 * ( z + this.z ); + + return this; + } + + var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, + ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; + + this.w = ( w * ratioA + this.w * ratioB ); + this.x = ( x * ratioA + this.x * ratioB ); + this.y = ( y * ratioA + this.y * ratioB ); + this.z = ( z * ratioA + this.z * ratioB ); + + return this; + }, + + setFromUnitVectors: function () { + // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final + // assumes direction vectors vFrom and vTo are normalized + + var v1, r; + var EPS = 0.000001; + + return function ( vFrom, vTo ) { + if ( v1 === undefined ) v1 = new MathUtil.Vector3(); + + r = vFrom.dot( vTo ) + 1; + + if ( r < EPS ) { + r = 0; + + if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { + v1.set( - vFrom.y, vFrom.x, 0 ); + } else { + v1.set( 0, - vFrom.z, vFrom.y ); + } + } else { + v1.crossVectors( vFrom, vTo ); + } + + this.x = v1.x; + this.y = v1.y; + this.z = v1.z; + this.w = r; + + this.normalize(); + + return this; + } + }(), + }; + + var mathUtil = MathUtil; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + var Util = window.Util || {}; + + Util.MIN_TIMESTEP = 0.001; + Util.MAX_TIMESTEP = 1; + + Util.base64 = function(mimeType, base64) { + return 'data:' + mimeType + ';base64,' + base64; + }; + + Util.clamp = function(value, min, max) { + return Math.min(Math.max(min, value), max); + }; + + Util.lerp = function(a, b, t) { + return a + ((b - a) * t); + }; + + /** + * Light polyfill for `Promise.race`. Returns + * a promise that resolves when the first promise + * provided resolves. + * + * @param {Array} promises + */ + Util.race = function(promises) { + if (Promise.race) { + return Promise.race(promises); + } + + return new Promise(function (resolve, reject) { + for (var i = 0; i < promises.length; i++) { + promises[i].then(resolve, reject); + } + }); + }; + + Util.isIOS = (function() { + var isIOS = /iPad|iPhone|iPod/.test(navigator.platform); + return function() { + return isIOS; + }; + })(); + + Util.isWebViewAndroid = (function() { + var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 && + navigator.userAgent.indexOf('Android') !== -1 && + navigator.userAgent.indexOf('Chrome') !== -1; + return function() { + return isWebViewAndroid; + }; + })(); + + Util.isSafari = (function() { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + return function() { + return isSafari; + }; + })(); + + Util.isFirefoxAndroid = (function() { + var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 && + navigator.userAgent.indexOf('Android') !== -1; + return function() { + return isFirefoxAndroid; + }; + })(); + + Util.isR7 = (function() { + var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1; + return function() { + return isR7; + }; + })(); + + Util.isLandscapeMode = function() { + var rtn = (window.orientation == 90 || window.orientation == -90); + return Util.isR7() ? !rtn : rtn; + }; + + // Helper method to validate the time steps of sensor timestamps. + Util.isTimestampDeltaValid = function(timestampDeltaS) { + if (isNaN(timestampDeltaS)) { + return false; + } + if (timestampDeltaS <= Util.MIN_TIMESTEP) { + return false; + } + if (timestampDeltaS > Util.MAX_TIMESTEP) { + return false; + } + return true; + }; + + Util.getScreenWidth = function() { + return Math.max(window.screen.width, window.screen.height) * + window.devicePixelRatio; + }; + + Util.getScreenHeight = function() { + return Math.min(window.screen.width, window.screen.height) * + window.devicePixelRatio; + }; + + Util.requestFullscreen = function(element) { + if (Util.isWebViewAndroid()) { + return false; + } + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else { + return false; + } + + return true; + }; + + Util.exitFullscreen = function() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else { + return false; + } + + return true; + }; + + Util.getFullscreenElement = function() { + return document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement; + }; + + Util.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) { + // No error checking for brevity. + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, vertexSource); + gl.compileShader(vertexShader); + + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, fragmentSource); + gl.compileShader(fragmentShader); + + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + + for (var attribName in attribLocationMap) + gl.bindAttribLocation(program, attribLocationMap[attribName], attribName); + + gl.linkProgram(program); + + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + + return program; + }; + + Util.getProgramUniforms = function(gl, program) { + var uniforms = {}; + var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + var uniformName = ''; + for (var i = 0; i < uniformCount; i++) { + var uniformInfo = gl.getActiveUniform(program, i); + uniformName = uniformInfo.name.replace('[0]', ''); + uniforms[uniformName] = gl.getUniformLocation(program, uniformName); + } + return uniforms; + }; + + Util.orthoMatrix = function (out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + }; + + Util.copyArray = function (source, dest) { + for (var i = 0, n = source.length; i < n; i++) { + dest[i] = source[i]; + } + }; + + Util.isMobile = function() { + var check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera); + return check; + }; + + Util.extend = function(dest, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dest[key] = src[key]; + } + } + + return dest; + }; + + Util.safariCssSizeWorkaround = function(canvas) { + // TODO(smus): Remove this workaround when Safari for iOS is fixed. + // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556). + // + // "To the last I grapple with thee; + // from hell's heart I stab at thee; + // for hate's sake I spit my last breath at thee." + // -- Moby Dick, by Herman Melville + if (Util.isIOS()) { + var width = canvas.style.width; + var height = canvas.style.height; + canvas.style.width = (parseInt(width) + 1) + 'px'; + canvas.style.height = (parseInt(height)) + 'px'; + setTimeout(function() { + canvas.style.width = width; + canvas.style.height = height; + }, 100); + } + + // Debug only. + window.Util = Util; + window.canvas = canvas; + }; + + Util.isDebug = function() { + return Util.getQueryParameter('debug'); + }; + + Util.getQueryParameter = function(name) { + var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); + }; + + Util.frameDataFromPose = (function() { + var piOver180 = Math.PI / 180.0; + var rad45 = Math.PI * 0.25; + + // Borrowed from glMatrix. + function mat4_perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45), + downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45), + leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45), + rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; + } + + function mat4_fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; + } + function mat4_translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; + } + function mat4_invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; + } + var defaultOrientation = new Float32Array([0, 0, 0, 1]); + var defaultPosition = new Float32Array([0, 0, 0]); + + function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) { + mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar); + + var orientation = pose.orientation || defaultOrientation; + var position = pose.position || defaultPosition; + + mat4_fromRotationTranslation(view, orientation, position); + if (parameters) + mat4_translate(view, view, parameters.offset); + mat4_invert(view, view); + } + + return function(frameData, pose, vrDisplay) { + if (!frameData || !pose) + return false; + + frameData.pose = pose; + frameData.timestamp = pose.timestamp; + + updateEyeMatrices( + frameData.leftProjectionMatrix, frameData.leftViewMatrix, + pose, vrDisplay.getEyeParameters("left"), vrDisplay); + updateEyeMatrices( + frameData.rightProjectionMatrix, frameData.rightViewMatrix, + pose, vrDisplay.getEyeParameters("right"), vrDisplay); + + return true; + }; + })(); + + Util.isInsideCrossDomainIFrame = function() { + var isFramed = (window.self !== window.top); + var refDomain = Util.getDomainFromUrl(document.referrer); + var thisDomain = Util.getDomainFromUrl(window.location.href); + + return isFramed && (refDomain !== thisDomain); + }; + + // From http://stackoverflow.com/a/23945027. + Util.getDomainFromUrl = function(url) { + var domain; + // Find & remove protocol (http, ftp, etc.) and get domain. + if (url.indexOf("://") > -1) { + domain = url.split('/')[2]; + } + else { + domain = url.split('/')[0]; + } + + //find & remove port number + domain = domain.split(':')[0]; + + return domain; + }; + + var util$1 = Util; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + /** + * Given an orientation and the gyroscope data, predicts the future orientation + * of the head. This makes rendering appear faster. + * + * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf + * + * @param {Number} predictionTimeS time from head movement to the appearance of + * the corresponding image. + */ + function PosePredictor(predictionTimeS) { + this.predictionTimeS = predictionTimeS; + + // The quaternion corresponding to the previous state. + this.previousQ = new mathUtil.Quaternion(); + // Previous time a prediction occurred. + this.previousTimestampS = null; + + // The delta quaternion that adjusts the current pose. + this.deltaQ = new mathUtil.Quaternion(); + // The output quaternion. + this.outQ = new mathUtil.Quaternion(); + } + + PosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) { + if (!this.previousTimestampS) { + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return currentQ; + } + + // Calculate axis and angle based on gyroscope rotation rate data. + var axis = new mathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + + var angularSpeed = gyro.length(); + + // If we're rotating slowly, don't do prediction. + if (angularSpeed < mathUtil.degToRad * 20) { + if (util$1.isDebug()) { + console.log('Moving slowly, at %s deg/s: no prediction', + (mathUtil.radToDeg * angularSpeed).toFixed(1)); + } + this.outQ.copy(currentQ); + this.previousQ.copy(currentQ); + return this.outQ; + } + + // Get the predicted angle based on the time delta and latency. + var deltaT = timestampS - this.previousTimestampS; + var predictAngle = angularSpeed * this.predictionTimeS; + + this.deltaQ.setFromAxisAngle(axis, predictAngle); + this.outQ.copy(this.previousQ); + this.outQ.multiply(this.deltaQ); + + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + + return this.outQ; + }; + + + var posePredictor = PosePredictor; + + /** + * Returns a number value indiciating the version of Chrome being used, + * or otherwise `null` if not on Chrome. + * + * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19 + */ + + /** + * In Chrome m65, `devicemotion` events are broken but subsequently fixed + * in 65.0.3325.148. Since many browsers use Chromium, ensure that + * we scope this detection by branch and build numbers to provide + * a proper fallback. + * https://github.com/immersive-web/webvr-polyfill/issues/307 + */ + + var version = -1; // It should not be null because it will be compared with number + + var branch = null; + var build = null; + var match = /Chrome\/([0-9]+)\.(?:[0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(userAgent); + + if (match) { + version = parseInt(match[1], 10); + branch = match[2]; + build = match[3]; + } + + var CHROME_VERSION = version; + var IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === "3325" && parseInt(build, 10) < 148; + var IS_ANDROID = /Android/i.test(userAgent); + var CONTROL_MODE_VR = 1; + var CONTROL_MODE_YAWPITCH = 2; + var TOUCH_DIRECTION_NONE = 1; + var TOUCH_DIRECTION_YAW = 2; + var TOUCH_DIRECTION_PITCH = 4; + var TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH; + /* Const for MovableCoord */ + + var MC_DECELERATION = 0.0014; + var MC_MAXIMUM_DURATION = 1000; + var MC_BIND_SCALE = [0.20, 0.20]; + var MAX_FIELD_OF_VIEW = 110; + var PAN_SCALE = 320; // const DELTA_THRESHOLD = 0.015; + + var YAW_RANGE_HALF = 180; + var PITCH_RANGE_HALF = 90; + var CIRCULAR_PITCH_RANGE_HALF = 180; + var GYRO_MODE = { + NONE: "none", + YAWPITCH: "yawPitch", + VR: "VR" + }; + + var STILLNESS_THRESHOLD = 200; // millisecond + + var DeviceMotion = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(DeviceMotion, _Component); + + function DeviceMotion() { + var _this; + + _this = _Component.call(this) || this; + _this._onDeviceMotion = _this._onDeviceMotion.bind(_assertThisInitialized(_this)); + _this._onDeviceOrientation = _this._onDeviceOrientation.bind(_assertThisInitialized(_this)); + _this._onChromeWithoutDeviceMotion = _this._onChromeWithoutDeviceMotion.bind(_assertThisInitialized(_this)); + _this.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION; + _this.isAndroid = IS_ANDROID; + _this.stillGyroVec = glMatrix.vec3.create(); + _this.rawGyroVec = glMatrix.vec3.create(); + _this.adjustedGyroVec = glMatrix.vec3.create(); + _this._timer = null; + _this.lastDevicemotionTimestamp = 0; + _this._isEnabled = false; + + _this.enable(); + + return _this; + } + + var _proto = DeviceMotion.prototype; + + _proto._onChromeWithoutDeviceMotion = function _onChromeWithoutDeviceMotion(e) { + var alpha = e.alpha, + beta = e.beta, + gamma = e.gamma; // There is deviceorientation event trigged with empty values + // on Headless Chrome. + + if (alpha === null) { + return; + } // convert to radian + + + alpha = (alpha || 0) * Math.PI / 180; + beta = (beta || 0) * Math.PI / 180; + gamma = (gamma || 0) * Math.PI / 180; + this.trigger("devicemotion", { + inputEvent: { + deviceorientation: { + alpha: alpha, + beta: beta, + gamma: -gamma + } + } + }); + }; + + _proto._onDeviceOrientation = function _onDeviceOrientation() { + var _this2 = this; + + this._timer && clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (new Date().getTime() - _this2.lastDevicemotionTimestamp < STILLNESS_THRESHOLD) { + glMatrix.vec3.copy(_this2.stillGyroVec, _this2.rawGyroVec); + } + }, STILLNESS_THRESHOLD); + }; + + _proto._onDeviceMotion = function _onDeviceMotion(e) { + // desktop chrome triggers devicemotion event with empthy sensor values. + // Those events should ignored. + var isGyroSensorAvailable = !(e.rotationRate.alpha == null); + var isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null); + + if (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) { + return; + } + + var devicemotionEvent = _extends({}, e); + + devicemotionEvent.interval = e.interval; + devicemotionEvent.timeStamp = e.timeStamp; + devicemotionEvent.type = e.type; + devicemotionEvent.rotationRate = { + alpha: e.rotationRate.alpha, + beta: e.rotationRate.beta, + gamma: e.rotationRate.gamma + }; + devicemotionEvent.accelerationIncludingGravity = { + x: e.accelerationIncludingGravity.x, + y: e.accelerationIncludingGravity.y, + z: e.accelerationIncludingGravity.z + }; + devicemotionEvent.acceleration = { + x: e.acceleration.x, + y: e.acceleration.y, + z: e.acceleration.z + }; + + if (this.isAndroid) { + glMatrix.vec3.set(this.rawGyroVec, e.rotationRate.alpha || 0, e.rotationRate.beta || 0, e.rotationRate.gamma || 0); + glMatrix.vec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec); + this.lastDevicemotionTimestamp = new Date().getTime(); + devicemotionEvent.adjustedRotationRate = { + alpha: this.adjustedGyroVec[0], + beta: this.adjustedGyroVec[1], + gamma: this.adjustedGyroVec[2] + }; + } + + this.trigger("devicemotion", { + inputEvent: devicemotionEvent + }); + }; + + _proto.enable = function enable() { + if (this.isAndroid) { + win.addEventListener("deviceorientation", this._onDeviceOrientation); + } + + if (this.isWithoutDeviceMotion) { + win.addEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + } else { + win.addEventListener("devicemotion", this._onDeviceMotion); + } + + this._isEnabled = true; + }; + + _proto.disable = function disable() { + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + win.removeEventListener("devicemotion", this._onDeviceMotion); + this._isEnabled = false; + }; + + return DeviceMotion; + }(Component); + + function SensorSample(sample, timestampS) { + this.set(sample, timestampS); + } + SensorSample.prototype.set = function(sample, timestampS) { + this.sample = sample; + this.timestampS = timestampS; + }; + + SensorSample.prototype.copy = function(sensorSample) { + this.set(sensorSample.sample, sensorSample.timestampS); + }; + + var sensorSample = SensorSample; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + /** + * An implementation of a simple complementary filter, which fuses gyroscope and + * accelerometer data from the 'devicemotion' event. + * + * Accelerometer data is very noisy, but stable over the long term. + * Gyroscope data is smooth, but tends to drift over the long term. + * + * This fusion is relatively simple: + * 1. Get orientation estimates from accelerometer by applying a low-pass filter + * on that data. + * 2. Get orientation estimates from gyroscope by integrating over time. + * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the + * short term. + */ + function ComplementaryFilter(kFilter) { + this.kFilter = kFilter; + + // Raw sensor measurements. + this.currentAccelMeasurement = new sensorSample(); + this.currentGyroMeasurement = new sensorSample(); + this.previousGyroMeasurement = new sensorSample(); + + // Set default look direction to be in the correct direction. + if (util$1.isIOS()) { + this.filterQ = new mathUtil.Quaternion(-1, 0, 0, 1); + } else { + this.filterQ = new mathUtil.Quaternion(1, 0, 0, 1); + } + this.previousFilterQ = new mathUtil.Quaternion(); + this.previousFilterQ.copy(this.filterQ); + + // Orientation based on the accelerometer. + this.accelQ = new mathUtil.Quaternion(); + // Whether or not the orientation has been initialized. + this.isOrientationInitialized = false; + // Running estimate of gravity based on the current orientation. + this.estimatedGravity = new mathUtil.Vector3(); + // Measured gravity based on accelerometer. + this.measuredGravity = new mathUtil.Vector3(); + + // Debug only quaternion of gyro-based orientation. + this.gyroIntegralQ = new mathUtil.Quaternion(); + } + + ComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) { + this.currentAccelMeasurement.set(vector, timestampS); + }; + + ComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) { + this.currentGyroMeasurement.set(vector, timestampS); + + var deltaT = timestampS - this.previousGyroMeasurement.timestampS; + if (util$1.isTimestampDeltaValid(deltaT)) { + this.run_(); + } + + this.previousGyroMeasurement.copy(this.currentGyroMeasurement); + }; + + ComplementaryFilter.prototype.run_ = function() { + + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - + this.previousGyroMeasurement.timestampS; + + // Convert gyro rotation vector to a quaternion delta. + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); + + // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); + + // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + var invFilterQ = new mathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); + + // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + var deltaQ = new mathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); + + if (util$1.isDebug()) { + console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)', + mathUtil.radToDeg * util$1.getQuaternionAngle(deltaQ), + (this.estimatedGravity.x).toFixed(1), + (this.estimatedGravity.y).toFixed(1), + (this.estimatedGravity.z).toFixed(1), + (this.measuredGravity.x).toFixed(1), + (this.measuredGravity.y).toFixed(1), + (this.measuredGravity.z).toFixed(1)); + } + + // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + var targetQ = new mathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); + + // SLERP factor: 0 is pure gyro, 1 is pure accel. + this.filterQ.slerp(targetQ, 1 - this.kFilter); + + this.previousFilterQ.copy(this.filterQ); + }; + + ComplementaryFilter.prototype.getOrientation = function() { + return this.filterQ; + }; + + ComplementaryFilter.prototype.accelToQuaternion_ = function(accel) { + var normAccel = new mathUtil.Vector3(); + normAccel.copy(accel); + normAccel.normalize(); + var quat = new mathUtil.Quaternion(); + quat.setFromUnitVectors(new mathUtil.Vector3(0, 0, -1), normAccel); + quat.inverse(); + return quat; + }; + + ComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) { + // Extract axis and angle from the gyroscope data. + var quat = new mathUtil.Quaternion(); + var axis = new mathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + quat.setFromAxisAngle(axis, gyro.length() * dt); + return quat; + }; + + + var complementaryFilter = ComplementaryFilter; + + complementaryFilter.prototype.run_ = function () { + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - this.previousGyroMeasurement.timestampS; // Convert gyro rotation vector to a quaternion delta. + + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + + var invFilterQ = new mathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + + var deltaQ = new mathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + + var targetQ = new mathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); // SLERP factor: 0 is pure gyro, 1 is pure accel. + + this.filterQ.slerp(targetQ, 1 - this.kFilter); + this.previousFilterQ.copy(this.filterQ); + + if (!this.isFilterQuaternionInitialized) { + this.isFilterQuaternionInitialized = true; + } + }; + + complementaryFilter.prototype.getOrientation = function () { + if (this.isFilterQuaternionInitialized) { + return this.filterQ; + } else { + return null; + } + }; + + var K_FILTER = 0.98; + var PREDICTION_TIME_S = 0.040; + + var FusionPoseSensor = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(FusionPoseSensor, _Component); + + function FusionPoseSensor() { + var _this; + + _this = _Component.call(this) || this; + _this.deviceMotion = new DeviceMotion(); + _this.accelerometer = new mathUtil.Vector3(); + _this.gyroscope = new mathUtil.Vector3(); + _this._onDeviceMotionChange = _this._onDeviceMotionChange.bind(_assertThisInitialized(_this)); + _this._onScreenOrientationChange = _this._onScreenOrientationChange.bind(_assertThisInitialized(_this)); + _this.filter = new complementaryFilter(K_FILTER); + _this.posePredictor = new posePredictor(PREDICTION_TIME_S); + _this.filterToWorldQ = new mathUtil.Quaternion(); + _this.isFirefoxAndroid = util$1.isFirefoxAndroid(); // This includes iPhone & iPad(both desktop and mobile mode) ref #326 + + _this.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP; // Ref https://github.com/immersive-web/cardboard-vr-display/issues/18 + + _this.isChromeUsingDegrees = CHROME_VERSION >= 66; + _this._isEnabled = false; // Set the filter to world transform, depending on OS. + + if (_this.isIOS) { + _this.filterToWorldQ.setFromAxisAngle(new mathUtil.Vector3(1, 0, 0), Math.PI / 2); + } else { + _this.filterToWorldQ.setFromAxisAngle(new mathUtil.Vector3(1, 0, 0), -Math.PI / 2); + } + + _this.inverseWorldToScreenQ = new mathUtil.Quaternion(); + _this.worldToScreenQ = new mathUtil.Quaternion(); + _this.originalPoseAdjustQ = new mathUtil.Quaternion(); + + _this.originalPoseAdjustQ.setFromAxisAngle(new mathUtil.Vector3(0, 0, 1), -win.orientation * Math.PI / 180); + + _this._setScreenTransform(); // Adjust this filter for being in landscape mode. + + + if (util$1.isLandscapeMode()) { + _this.filterToWorldQ.multiply(_this.inverseWorldToScreenQ); + } // Keep track of a reset transform for resetSensor. + + + _this.resetQ = new mathUtil.Quaternion(); + + _this.deviceMotion.on("devicemotion", _this._onDeviceMotionChange); + + _this.enable(); + + return _this; + } + + var _proto = FusionPoseSensor.prototype; + + _proto.enable = function enable() { + if (this.isEnabled()) { + return; + } + + this.deviceMotion.enable(); + this._isEnabled = true; + win.addEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.disable = function disable() { + if (!this.isEnabled()) { + return; + } + + this.deviceMotion.disable(); + this._isEnabled = false; + win.removeEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.isEnabled = function isEnabled() { + return this._isEnabled; + }; + + _proto.destroy = function destroy() { + this.disable(); + this.deviceMotion = null; + }; + + _proto._triggerChange = function _triggerChange() { + var orientation = this.getOrientation(); // if orientation is not prepared. don't trigger change event + + if (!orientation) { + return; + } + + if (!this._prevOrientation) { + this._prevOrientation = orientation; + return; + } + + if (glMatrix.quat.equals(this._prevOrientation, orientation)) { + return; + } + + this.trigger("change", { + quaternion: orientation + }); + }; + + _proto.getOrientation = function getOrientation() { + var _this2 = this; + + var orientation; // Hack around using deviceorientation instead of devicemotion + + if (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) { + this.deviceOrientationFixQ = this.deviceOrientationFixQ || function () { + var y = new mathUtil.Quaternion().setFromAxisAngle(new mathUtil.Vector3(0, 1, 0), -_this2._alpha); + return y; + }(); + + orientation = this._deviceOrientationQ; + var out = new mathUtil.Quaternion(); + out.copy(orientation); + out.multiply(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.worldToScreenQ); + out.multiplyQuaternions(this.deviceOrientationFixQ, out); // return quaternion as glmatrix quaternion object + + var out_ = glMatrix.quat.fromValues(out.x, out.y, out.z, out.w); + return glMatrix.quat.normalize(out_, out_); + } else { + // Convert from filter space to the the same system used by the + // deviceorientation event. + orientation = this.filter.getOrientation(); + + if (!orientation) { + return null; + } + + var _out = this._convertFusionToPredicted(orientation); // return quaternion as glmatrix quaternion object + + + var _out_ = glMatrix.quat.fromValues(_out.x, _out.y, _out.z, _out.w); + + return glMatrix.quat.normalize(_out_, _out_); + } + }; + + _proto._convertFusionToPredicted = function _convertFusionToPredicted(orientation) { + // Predict orientation. + this.predictedQ = this.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS); // Convert to THREE coordinate system: -Z forward, Y up, X right. + + var out = new mathUtil.Quaternion(); + out.copy(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.predictedQ); + out.multiply(this.worldToScreenQ); + return out; + }; + + _proto._onDeviceMotionChange = function _onDeviceMotionChange(_ref) { + var inputEvent = _ref.inputEvent; + var deviceorientation = inputEvent.deviceorientation; + var deviceMotion = inputEvent; + var accGravity = deviceMotion.accelerationIncludingGravity; + var rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate; + var timestampS = deviceMotion.timeStamp / 1000; + + if (deviceorientation) { + if (!this._alpha) { + this._alpha = deviceorientation.alpha; + } + + this._deviceOrientationQ = this._deviceOrientationQ || new mathUtil.Quaternion(); + + this._deviceOrientationQ.setFromEulerYXZ(deviceorientation.beta, deviceorientation.alpha, deviceorientation.gamma); + + this._triggerChange(); + } else { + // Firefox Android timeStamp returns one thousandth of a millisecond. + if (this.isFirefoxAndroid) { + timestampS /= 1000; + } + + this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); + this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); // Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate` + // is reported in degrees, so we first convert to radians. + + if (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) { + this.gyroscope.multiplyScalar(Math.PI / 180); + } + + this.filter.addAccelMeasurement(this.accelerometer, timestampS); + this.filter.addGyroMeasurement(this.gyroscope, timestampS); + + this._triggerChange(); + + this.previousTimestampS = timestampS; + } + }; + + _proto._onScreenOrientationChange = function _onScreenOrientationChange(screenOrientation) { + this._setScreenTransform(win.orientation); + }; + + _proto._setScreenTransform = function _setScreenTransform() { + this.worldToScreenQ.set(0, 0, 0, 1); + var orientation = win.orientation; + + switch (orientation) { + case 0: + break; + + case 90: + case -90: + case 180: + this.worldToScreenQ.setFromAxisAngle(new mathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI); + break; + + default: + break; + } + + this.inverseWorldToScreenQ.copy(this.worldToScreenQ); + this.inverseWorldToScreenQ.inverse(); + }; + + return FusionPoseSensor; + }(Component); + + function getDeltaYaw$1(prvQ, curQ) { + var yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW); + var yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) * Math.sin(util.extractPitchFromQuat(curQ)); + return yawDeltaByRoll + yawDeltaByYaw; + } + + function getDeltaPitch$1(prvQ, curQ) { + var pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA); + return pitchDelta; + } + + var TiltMotionInput = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(TiltMotionInput, _Component); + + function TiltMotionInput(el, options) { + var _this; + + _this = _Component.call(this) || this; + _this.element = el; + _this._prevQuaternion = null; + _this._quaternion = null; + _this.fusionPoseSensor = null; + _this.options = _extends({ + scale: 1, + threshold: 0 + }, options); + _this._onPoseChange = _this._onPoseChange.bind(_assertThisInitialized(_this)); + return _this; + } + + var _proto = TiltMotionInput.prototype; + + _proto.mapAxes = function mapAxes(axes) { + this.axes = axes; + }; + + _proto.connect = function connect(observer) { + if (this.observer) { + return this; + } + + this.observer = observer; + this.fusionPoseSensor = new FusionPoseSensor(); + this.fusionPoseSensor.enable(); + + this._attachEvent(); + + return this; + }; + + _proto.disconnect = function disconnect() { + if (!this.observer) { + return this; + } + + this._dettachEvent(); + + this.fusionPoseSensor.disable(); + this.fusionPoseSensor.destroy(); + this.fusionPoseSensor = null; + this.observer = null; + return this; + }; + + _proto.destroy = function destroy() { + this.disconnect(); + this.element = null; + this.options = null; + this.axes = null; + this._prevQuaternion = null; + this._quaternion = null; + }; + + _proto._onPoseChange = function _onPoseChange(event) { + if (!this._prevQuaternion) { + this._prevQuaternion = glMatrix.quat.clone(event.quaternion); + this._quaternion = glMatrix.quat.clone(event.quaternion); + return; + } + + glMatrix.quat.copy(this._prevQuaternion, this._quaternion); + glMatrix.quat.copy(this._quaternion, event.quaternion); + this.observer.change(this, event, toAxis(this.axes, [getDeltaYaw$1(this._prevQuaternion, this._quaternion), getDeltaPitch$1(this._prevQuaternion, this._quaternion)])); + }; + + _proto._attachEvent = function _attachEvent() { + this.fusionPoseSensor.on("change", this._onPoseChange); + }; + + _proto._dettachEvent = function _dettachEvent() { + this.fusionPoseSensor.off("change", this._onPoseChange); + }; + + return TiltMotionInput; + }(Component); + + var screenRotationAngleInst = null; + var refCount = 0; + + var ScreenRotationAngle = + /*#__PURE__*/ + function () { + function ScreenRotationAngle() { + refCount++; + + if (screenRotationAngleInst) { + return screenRotationAngleInst; + } + /* eslint-disable */ + + + screenRotationAngleInst = this; + /* eslint-enable */ + + this._onDeviceOrientation = this._onDeviceOrientation.bind(this); + this._onOrientationChange = this._onOrientationChange.bind(this); + this._spinR = 0; + this._screenOrientationAngle = 0; + win.addEventListener("deviceorientation", this._onDeviceOrientation); + win.addEventListener("orientationchange", this._onOrientationChange); + } + + var _proto = ScreenRotationAngle.prototype; + + _proto._onDeviceOrientation = function _onDeviceOrientation(e) { + if (e.beta === null || e.gamma === null) { + // (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it. + return; + } // Radian + + + var betaR = glMatrix.glMatrix.toRadian(e.beta); + var gammaR = glMatrix.glMatrix.toRadian(e.gamma); + /* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */ + + this._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR)); + }; + + _proto._onOrientationChange = function _onOrientationChange(e) { + if (win.screen && win.screen.orientation && win.screen.orientation.angle !== undefined) { + this._screenOrientationAngle = screen.orientation.angle; + } else if (win.orientation !== undefined) { + /* iOS */ + this._screenOrientationAngle = win.orientation >= 0 ? win.orientation : 360 + win.orientation; + } + }; + + _proto.getRadian = function getRadian() { + // Join with screen orientation + // this._testVal = this._spinR + ", " + this._screenOrientationAngle + ", " + window.orientation; + return this._spinR + glMatrix.glMatrix.toRadian(this._screenOrientationAngle); + }; + + _proto.unref = function unref() { + if (--refCount > 0) { + return; + } + + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("orientationchange", this._onOrientationChange); + this._spinR = 0; + this._screenOrientationAngle = 0; + /* eslint-disable */ + + screenRotationAngleInst = null; + /* eslint-enable */ + + refCount = 0; + }; + + return ScreenRotationAngle; + }(); + + /** + * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle. + * + * The reason for using this function is that in VR mode, + * the roll angle is adjusted in the direction opposite to the screen rotation angle. + * + * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move. + * @extends PanInput + */ + + var RotationPanInput = + /*#__PURE__*/ + function (_PanInput) { + _inheritsLoose(RotationPanInput, _PanInput); + + /** + * Constructor + * + * @private + * @param {HTMLElement} el target element + * @param {Object} [options] The option object + * @param {Boolean} [options.useRotation] Whether to use rotation(or VR) + */ + function RotationPanInput(el, options) { + var _this; + + _this = _PanInput.call(this, el, options) || this; + _this._useRotation = false; + _this._screenRotationAngle = null; + + _this.setUseRotation(!!(options && options.useRotation)); + + _this._userDirection = Axes.DIRECTION_ALL; + return _this; + } + + var _proto = RotationPanInput.prototype; + + _proto.setUseRotation = function setUseRotation(useRotation) { + this._useRotation = useRotation; + + if (this._screenRotationAngle) { + this._screenRotationAngle.unref(); + + this._screenRotationAngle = null; + } + + if (this._useRotation) { + this._screenRotationAngle = new ScreenRotationAngle(); + } + }; + + _proto.connect = function connect(observer) { + // User intetened direction + this._userDirection = this._direction; // In VR Mode, Use ALL direction if direction is not none + // Because horizontal and vertical is changed dynamically by screen rotation. + // this._direction is used to initialize hammerjs + + if (this._useRotation && this._direction & Axes.DIRECTION_ALL) { + this._direction = Axes.DIRECTION_HORIZONTAL; + } + + _PanInput.prototype.connect.call(this, observer); + }; + + _proto.getOffset = function getOffset(properties, useDirection) { + if (this._useRotation === false) { + return _PanInput.prototype.getOffset.call(this, properties, useDirection); + } + + var offset = _PanInput.prototype.getOffset.call(this, properties, [true, true]); + + var newOffset = [0, 0]; + + var theta = this._screenRotationAngle.getRadian(); + + var cosTheta = Math.cos(theta); + var sinTheta = Math.sin(theta); // RotateZ + + newOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta; + newOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta; // Use only user allowed direction. + + if (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) { + newOffset[0] = 0; + } else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) { + newOffset[1] = 0; + } + + return newOffset; + }; + + _proto.destroy = function destroy() { + if (this._useRotation) { + this._screenRotationAngle && this._screenRotationAngle.unref(); + } + + _PanInput.prototype.destroy.call(this); + }; + + return RotationPanInput; + }(Axes.PanInput); + + var Y_AXIS_VECTOR = glMatrix.vec3.fromValues(0, 1, 0); + + var DeviceQuaternion = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(DeviceQuaternion, _Component); + + function DeviceQuaternion() { + var _this; + + _this = _Component.call(this) || this; + _this._fusionPoseSensor = new FusionPoseSensor(); + _this._quaternion = glMatrix.quat.create(); + + _this._fusionPoseSensor.enable(); + + _this._fusionPoseSensor.on("change", function (e) { + _this._quaternion = e.quaternion; + + _this.trigger("change", { + isTrusted: true + }); + }); + + return _this; + } + + var _proto = DeviceQuaternion.prototype; + + _proto.getCombinedQuaternion = function getCombinedQuaternion(yaw) { + var yawQ = glMatrix.quat.setAxisAngle(glMatrix.quat.create(), Y_AXIS_VECTOR, glMatrix.glMatrix.toRadian(-yaw)); + var conj = glMatrix.quat.conjugate(glMatrix.quat.create(), this._quaternion); // Multiply pitch quaternion -> device quaternion -> yaw quaternion + + var outQ = glMatrix.quat.multiply(glMatrix.quat.create(), conj, yawQ); + return outQ; + }; + + _proto.destroy = function destroy() { + // detach all event handler + this.off(); + + if (this._fusionPoseSensor) { + this._fusionPoseSensor.off(); + + this._fusionPoseSensor.destroy(); + + this._fusionPoseSensor = null; + } + }; + + return DeviceQuaternion; + }(Component); + + var VERSION = "3.3.3"; + + var DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF]; + var DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF]; + var CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF]; + /** + * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates. + * + * @alias eg.YawPitchControl + * @extends eg.Component + * + * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + */ + + var YawPitchControl = + /*#__PURE__*/ + function () { + var YawPitchControl = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(YawPitchControl, _Component); + + // Expose DeviceOrientationControls sub module for test purpose + + /** + * @param {Object} options The option object of the eg.YawPitch module + * @param {Element}[options.element=null] element A base element for the eg.YawPitch module + * @param {Number} [options.yaw=0] initial yaw (degree) + * @param {Number} [options.pitch=0] initial pitch (degree) + * @param {Number} [options.fov=65] initial field of view (degree) + * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown + * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available + * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. + * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move) + * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw + * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch + * @param {Array} [options.fovRange=[30, 110] Range of FOV + * @param {Number} [options.aspectRatio=1] Aspect Ratio + */ + function YawPitchControl(options) { + var _this; + + _this = _Component.call(this) || this; + + var opt = _extends({ + element: null, + yaw: 0, + pitch: 0, + fov: 65, + showPolePoint: false, + useZoom: true, + useKeyboard: true, + gyroMode: GYRO_MODE.YAWPITCH, + touchDirection: TOUCH_DIRECTION_ALL, + yawRange: DEFAULT_YAW_RANGE, + pitchRange: DEFAULT_PITCH_RANGE, + fovRange: [30, 110], + aspectRatio: 1 + /* TODO: Need Mandatory? */ + + }, options); + + _this._element = opt.element; + _this._initialFov = opt.fov; + _this._enabled = false; + _this._isAnimating = false; + _this._deviceQuaternion = null; + + _this._initAxes(opt); + + _this.option(opt); + + return _this; + } + + var _proto = YawPitchControl.prototype; + + _proto._initAxes = function _initAxes(opt) { + var _this2 = this; + + var yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio); + + var pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint); + + var useRotation = opt.gyroMode === GYRO_MODE.VR; + this.axesPanInput = new RotationPanInput(this._element, { + useRotation: useRotation + }); + this.axesWheelInput = new Axes.WheelInput(this._element, { + scale: -4 + }); + this.axesTiltMotionInput = null; + this.axesPinchInput = SUPPORT_TOUCH ? new Axes.PinchInput(this._element, { + scale: -1 + }) : null; + this.axesMoveKeyInput = new Axes.MoveKeyInput(this._element, { + scale: [-6, 6] + }); + this.axes = new Axes({ + yaw: { + range: yRange, + circular: YawPitchControl.isCircular(yRange), + bounce: [0, 0] + }, + pitch: { + range: pRange, + circular: YawPitchControl.isCircular(pRange), + bounce: [0, 0] + }, + fov: { + range: opt.fovRange, + circular: [false, false], + bounce: [0, 0] + } + }, { + deceleration: MC_DECELERATION, + maximumDuration: MC_MAXIMUM_DURATION + }, { + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }).on({ + hold: function hold(evt) { + // Restore maximumDuration not to be spin too mush. + _this2.axes.options.maximumDuration = MC_MAXIMUM_DURATION; + + _this2.trigger("hold", { + isTrusted: evt.isTrusted + }); + }, + change: function change(evt) { + if (evt.delta.fov !== 0) { + _this2._updateControlScale(evt); + + _this2.updatePanScale(); + } + + _this2._triggerChange(evt); + }, + release: function release(evt) { + _this2._triggerChange(evt); + }, + animationStart: function animationStart(evt) {}, + animationEnd: function animationEnd(evt) { + _this2.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + } + /** + * Update Pan Scale + * + * Scale(Sensitivity) values of panning is related with fov and height. + * If at least one of them is changed, this function need to be called. + * @param {*} param + */ + ; + + _proto.updatePanScale = function updatePanScale(param) { + if (param === void 0) { + param = {}; + } + + var fov = this.axes.get().fov; + var areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10); + var scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight; + this.axesPanInput.options.scale = [scale, scale]; + this.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW; + return this; + } + /* + * Override component's option method + * to call method for updating values which is affected by option change. + * + * @param {*} args + */ + ; + + _proto.option = function option() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var argLen = args.length; // Getter + + if (argLen === 0) { + return this._getOptions(); + } else if (argLen === 1 && typeof args[0] === "string") { + return this._getOptions(args[0]); + } // Setter + + + var beforeOptions = _extends({}, this.options); + + var newOptions = {}; + var changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList. + + if (argLen === 1) { + changedKeyList = Object.keys(args[0]); + newOptions = _extends({}, args[0]); + } else if (argLen >= 2) { + changedKeyList.push(args[0]); + newOptions[args[0]] = args[1]; + } + + this._setOptions(this._getValidatedOptions(newOptions)); + + this._applyOptions(changedKeyList, beforeOptions); + + return this; + }; + + _proto._getValidatedOptions = function _getValidatedOptions(newOptions) { + if (newOptions.yawRange) { + newOptions.yawRange = this._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio); + } + + if (newOptions.pitchRange) { + newOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov); + } + + return newOptions; + }; + + _proto._getOptions = function _getOptions(key) { + var value; + + if (typeof key === "string") { + value = this.options[key]; + } else if (arguments.length === 0) { + value = this.options; + } + + return value; + }; + + _proto._setOptions = function _setOptions(options) { + for (var key in options) { + this.options[key] = options[key]; + } + }; + + _proto._applyOptions = function _applyOptions(keys, prevOptions) { + var options = this.options; + var axes = this.axes; + var isVR = options.gyroMode === GYRO_MODE.VR; + var isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH; // If it's VR mode, restrict user interaction to yaw direction only + + var touchDirection = isVR ? TOUCH_DIRECTION_YAW & options.touchDirection : options.touchDirection; // If one of below is changed, call updateControlScale() + + if (keys.some(function (key) { + return key === "showPolePoint" || key === "fov" || key === "aspectRatio" || key === "yawRange" || key === "pitchRange"; + })) { + // If fov is changed, update pan scale + if (keys.indexOf("fov") >= 0) { + axes.setTo({ + "fov": options.fov + }); + this.updatePanScale(); + } + + this._updateControlScale(); + } + + if (keys.some(function (key) { + return key === "fovRange"; + })) { + var fovRange = options.fovRange; + var prevFov = axes.get().fov; + var nextFov = axes.get().fov; + glMatrix.vec2.copy(axes.axis.fov.range, fovRange); + + if (nextFov < fovRange[0]) { + nextFov = fovRange[0]; + } else if (prevFov > fovRange[1]) { + nextFov = fovRange[1]; + } + + if (prevFov !== nextFov) { + axes.setTo({ + fov: nextFov + }, 0); + + this._updateControlScale(); + + this.updatePanScale(); + } + } + + if (keys.some(function (key) { + return key === "gyroMode"; + }) && SUPPORT_DEVICEMOTION) { + // Disconnect first + if (this.axesTiltMotionInput) { + this.axes.disconnect(this.axesTiltMotionInput); + this.axesTiltMotionInput.destroy(); + this.axesTiltMotionInput = null; + } + + if (this._deviceQuaternion) { + this._deviceQuaternion.destroy(); + + this._deviceQuaternion = null; + } + + if (isVR) { + this._initDeviceQuaternion(); + } else if (isYawPitch) { + this.axesTiltMotionInput = new TiltMotionInput(this._element); + this.axes.connect(["yaw", "pitch"], this.axesTiltMotionInput); + } + + this.axesPanInput.setUseRotation(isVR); + } + + if (keys.some(function (key) { + return key === "useKeyboard"; + })) { + var useKeyboard = options.useKeyboard; + + if (useKeyboard) { + axes.connect(["yaw", "pitch"], this.axesMoveKeyInput); + } else { + axes.disconnect(this.axesMoveKeyInput); + } + } + + if (keys.some(function (key) { + return key === "useZoom"; + })) { + var useZoom = options.useZoom; // Disconnect first + + axes.disconnect(this.axesWheelInput); + + if (useZoom) { + axes.connect(["fov"], this.axesWheelInput); + } + } + + this._togglePinchInputByOption(options.touchDirection, options.useZoom); + + if (keys.some(function (key) { + return key === "touchDirection"; + })) { + this._enabled && this._enableTouch(touchDirection); + } + }; + + _proto._togglePinchInputByOption = function _togglePinchInputByOption(touchDirection, useZoom) { + if (this.axesPinchInput) { + // disconnect first + this.axes.disconnect(this.axesPinchInput); // If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll. + + if (useZoom && touchDirection === TOUCH_DIRECTION_ALL && // TODO: Get rid of using private property of axes instance. + this.axes._inputs.indexOf(this.axesPinchInput) === -1) { + this.axes.connect(["fov"], this.axesPinchInput); + } + } + }; + + _proto._enableTouch = function _enableTouch(direction) { + // Disconnect first + this.axesPanInput && this.axes.disconnect(this.axesPanInput); + var yawEnabled = direction & TOUCH_DIRECTION_YAW ? "yaw" : null; + var pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? "pitch" : null; + this.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput); + }; + + _proto._initDeviceQuaternion = function _initDeviceQuaternion() { + var _this3 = this; + + this._deviceQuaternion = new DeviceQuaternion(); + + this._deviceQuaternion.on("change", function (e) { + _this3._triggerChange(e); + }); + }; + + _proto._getValidYawRange = function _getValidYawRange(newYawRange, newFov, newAspectRatio) { + var ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1); + var fov = newFov || this.axes.get().fov; + var horizontalFov = fov * ratio; + var isValid = newYawRange[1] - newYawRange[0] >= horizontalFov; + + if (isValid) { + return newYawRange; + } else { + return this.options.yawRange || DEFAULT_YAW_RANGE; + } + }; + + _proto._getValidPitchRange = function _getValidPitchRange(newPitchRange, newFov) { + var fov = newFov || this.axes.get().fov; + var isValid = newPitchRange[1] - newPitchRange[0] >= fov; + + if (isValid) { + return newPitchRange; + } else { + return this.options.pitchRange || DEFAULT_PITCH_RANGE; + } + }; + + YawPitchControl.isCircular = function isCircular(range) { + return range[1] - range[0] < 360 ? [false, false] : [true, true]; + } + /** + * Update yaw/pitch min/max by 5 factor + * + * 1. showPolePoint + * 2. fov + * 3. yawRange + * 4. pitchRange + * 5. aspectRatio + * + * If one of above is changed, call this function + */ + ; + + _proto._updateControlScale = function _updateControlScale(changeEvt) { + var opt = this.options; + var fov = this.axes.get().fov; + + var pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint); + + var yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio); // TODO: If not changed!? + + + var pos = this.axes.get(); + var y = pos.yaw; + var p = pos.pitch; + glMatrix.vec2.copy(this.axes.axis.yaw.range, yRange); + glMatrix.vec2.copy(this.axes.axis.pitch.range, pRange); + this.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange); + this.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange); + /** + * update yaw/pitch by it's range. + */ + + if (y < yRange[0]) { + y = yRange[0]; + } else if (y > yRange[1]) { + y = yRange[1]; + } + + if (p < pRange[0]) { + p = pRange[0]; + } else if (p > pRange[1]) { + p = pRange[1]; + } + + if (changeEvt) { + changeEvt.set({ + yaw: y, + pitch: p + }); + } + + this.axes.setTo({ + yaw: y, + pitch: p + }, 0); + return this; + }; + + _proto._updatePitchRange = function _updatePitchRange(pitchRange, fov, showPolePoint) { + if (this.options.gyroMode === GYRO_MODE.VR) { + // Circular pitch on VR + return CIRCULAR_PITCH_RANGE; + } + + var verticalAngle = pitchRange[1] - pitchRange[0]; + var halfFov = fov / 2; + var isPanorama = verticalAngle < 180; + + if (showPolePoint && !isPanorama) { + // Use full pinch range + return pitchRange.concat(); + } // Round value as movableCood do. + + + return [pitchRange[0] + halfFov, pitchRange[1] - halfFov]; + }; + + _proto._updateYawRange = function _updateYawRange(yawRange, fov, aspectRatio) { + if (this.options.gyroMode === GYRO_MODE.VR) { + return DEFAULT_YAW_RANGE; + } + + var horizontalAngle = yawRange[1] - yawRange[0]; + /** + * Full 360 Mode + */ + + if (horizontalAngle >= 360) { + // Don't limit yaw range on Full 360 mode. + return yawRange.concat(); + } + /** + * Panorama mode + */ + // Ref : https://github.com/naver/egjs-view360/issues/290 + + + var halfHorizontalFov = util.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.glMatrix.toRadian(fov / 2)))); // Round value as movableCood do. + + return [yawRange[0] + halfHorizontalFov, yawRange[1] - halfHorizontalFov]; + }; + + _proto._triggerChange = function _triggerChange(evt) { + var pos = this.axes.get(); + var opt = this.options; + var event = { + targetElement: opt.element, + isTrusted: evt.isTrusted + }; + event.yaw = pos.yaw; + event.pitch = pos.pitch; + event.fov = pos.fov; + + if (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) { + event.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + } + + this.trigger("change", event); + } // TODO: makes constant to be logic + ; + + YawPitchControl.adjustAspectRatio = function adjustAspectRatio(input) { + var inputRange = [0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670, 0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19, 1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26, 2.30, 2.60, 3.00, 5.00, 6.00]; + var outputRange = [0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710, 0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15, 1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72, 1.82, 1.92, 2.00, 2.24, 2.30]; + var rangeIdx = -1; + + for (var i = 0; i < inputRange.length - 1; i++) { + if (inputRange[i] <= input && inputRange[i + 1] >= input) { + rangeIdx = i; + break; + } + } + + if (rangeIdx === -1) { + if (inputRange[0] > input) { + return outputRange[0]; + } else { + return outputRange[outputRange[0].length - 1]; + } + } + + var inputA = inputRange[rangeIdx]; + var inputB = inputRange[rangeIdx + 1]; + var outputA = outputRange[rangeIdx]; + var outputB = outputRange[rangeIdx + 1]; + return YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA)); + }; + + YawPitchControl.lerp = function lerp(a, b, fraction) { + return a + fraction * (b - a); + } + /** + * Enable YawPitch functionality + * + * @method eg.YawPitch#enable + */ + ; + + _proto.enable = function enable() { + if (this._enabled) { + return this; + } + + this._enabled = true; // touchDirection is decided by parameter is valid string (Ref. Axes.connect) + + this._applyOptions(Object.keys(this.options), this.options); // TODO: Is this code is needed? Check later. + + + this.updatePanScale(); + return this; + } + /** + * Disable YawPitch functionality + * + * @method eg.YawPitch#disable + */ + ; + + _proto.disable = function disable(persistOrientation) { + if (!this._enabled) { + return this; + } // TODO: Check peristOrientation is needed! + + + if (!persistOrientation) { + this._resetOrientation(); + } + + this.axes.disconnect(); + this._enabled = false; + return this; + }; + + _proto._resetOrientation = function _resetOrientation() { + var opt = this.options; + this.axes.setTo({ + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }, 0); + return this; + } + /** + * Set one or more of yaw, pitch, fov + * + * @param {Object} coordinate yaw, pitch, fov + * @param {Number} duration Animation duration. if it is above 0 then it's animated. + */ + ; + + _proto.lookAt = function lookAt(_ref, duration) { + var yaw = _ref.yaw, + pitch = _ref.pitch, + fov = _ref.fov; + var pos = this.axes.get(); + var y = yaw === undefined ? 0 : yaw - pos.yaw; + var p = pitch === undefined ? 0 : pitch - pos.pitch; + var f = fov === undefined ? 0 : fov - pos.fov; // Allow duration of animation to have more than MC_MAXIMUM_DURATION. + + this.axes.options.maximumDuration = Infinity; + this.axes.setBy({ + yaw: y, + pitch: p, + fov: f + }, duration); + }; + + _proto.getYawPitch = function getYawPitch() { + var yawPitch = this.axes.get(); + return { + yaw: yawPitch.yaw, + pitch: yawPitch.pitch + }; + }; + + _proto.getFov = function getFov() { + return this.axes.get().fov; + }; + + _proto.getQuaternion = function getQuaternion() { + var pos = this.axes.get(); + return this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + }; + + _proto.shouldRenderWithQuaternion = function shouldRenderWithQuaternion() { + return this.options.gyroMode === GYRO_MODE.VR; + } + /** + * Destroys objects + */ + ; + + _proto.destroy = function destroy() { + this.axes && this.axes.destroy(); + this.axisPanInput && this.axisPanInput.destroy(); + this.axesWheelInput && this.axesWheelInput.destroy(); + this.axesTiltMotionInput && this.axesTiltMotionInput.destroy(); + this.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy(); + this.axesPinchInput && this.axesPinchInput.destroy(); + this.axesMoveKeyInput && this.axesMoveKeyInput.destroy(); + this._deviceQuaternion && this._deviceQuaternion.destroy(); + }; + + return YawPitchControl; + }(Component); + + YawPitchControl.VERSION = VERSION; + YawPitchControl.CONTROL_MODE_VR = CONTROL_MODE_VR; + YawPitchControl.CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH; + YawPitchControl.TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL; + YawPitchControl.TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW; + YawPitchControl.TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH; + YawPitchControl.TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE; + return YawPitchControl; + }(); + + var _Promise = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var STATUS = { + "NONE": 0, + "LOADING": 1, + "LOADED": 2, + "ERROR": 3 + }; + var EVENT = { + "READYSTATECHANGE": "readystatechange" + }; + + var ImageLoader = + /*#__PURE__*/ + function () { + var ImageLoader = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(ImageLoader, _Component); + + function ImageLoader(image) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + _this._image = null; + _this._onceHandlers = []; + _this._loadStatus = STATUS.NONE; + image && _this.set(image); + return _this; + } + + var _proto = ImageLoader.prototype; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise(function (res, rej) { + if (!_this2._image) { + rej("ImageLoader: image is not defiend"); + } else if (_this2._loadStatus === STATUS.LOADED) { + res(_this2.getElement()); + } else if (_this2._loadStatus === STATUS.LOADING) { + /* Check isMaybeLoaded() first because there may have + posibilities that image already loaded before get is called. + for example calling get on external image onload callback.*/ + if (ImageLoader.isMaybeLoaded(_this2._image)) { + _this2._loadStatus = STATUS.LOADED; + res(_this2.getElement()); + } else { + _this2.on(EVENT.READYSTATECHANGE, function (e) { + if (e.type === STATUS.LOADED) { + res(_this2.getElement()); + } else { + rej("ImageLoader: failed to load images."); + } + }); + } + } else { + rej("ImageLoader: failed to load images"); + } + }); + } + /** + * @param image img element or img url or array of img element or array of img url + */ + ; + + _proto.set = function set(image) { + var _this3 = this; + + this._loadStatus = STATUS.LOADING; + this._image = ImageLoader.createElement(image); + + if (ImageLoader.isMaybeLoaded(this._image)) { + this._loadStatus = STATUS.LOADED; + return; + } + + this.onceLoaded(this._image, function () { + _this3._loadStatus = STATUS.LOADED; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.LOADED + }); + }, function () { + _this3._loadStatus = STATUS.ERROR; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.ERROR + }); + }); + }; + + ImageLoader.createElement = function createElement(image) { + var images = image instanceof Array ? image : [image]; + return images.map(function (img) { + var _img = img; + + if (typeof img === "string") { + _img = new Image(); + _img.crossOrigin = "anonymous"; + _img.src = img; + } + + return _img; + }); + }; + + _proto.getElement = function getElement() { + return this._image.length === 1 ? this._image[0] : this._image; + }; + + ImageLoader.isMaybeLoaded = function isMaybeLoaded(image) { + var result = false; + + if (image instanceof Image) { + result = image.complete && image.naturalWidth !== 0; + } else if (image instanceof Array) { + result = !image.some(function (img) { + return !img.complete || img.naturalWidth === 0; + }); + } + + return result; + }; + + _proto.onceLoaded = function onceLoaded(target, onload, onerror) { + var _this4 = this; + + var targets = target instanceof Array ? target : [target]; + var targetsNotLoaded = targets.filter(function (img) { + return !ImageLoader.isMaybeLoaded(img); + }); + var loadPromises = targetsNotLoaded.map(function (img) { + return new _Promise(function (res, rej) { + _this4._once(img, "load", function () { + return res(img); + }); + + _this4._once(img, "error", function () { + return rej(img); + }); + }); + }); + + _Promise.all(loadPromises).then(function (result) { + return onload(targets.length === 1 ? targets[0] : targets); + }, function (reason) { + return onerror(reason); + }); + }; + + _proto._once = function _once(target, type, listener) { + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + + target.addEventListener(type, fn); + + this._onceHandlers.push({ + target: target, + type: type, + fn: fn + }); + }; + + _proto.getStatus = function getStatus() { + return this._loadStatus; + }; + + _proto.destroy = function destroy() { + this._onceHandlers.forEach(function (handler) { + handler.target.removeEventListener(handler.type, handler.fn); + }); + + this._onceHandlers = []; + this._image.src = ""; + this._image = null; + this._loadStatus = STATUS.NONE; + }; + + return ImageLoader; + }(Component); + + ImageLoader.STATUS = STATUS; + return ImageLoader; + }(); + + var _Promise$1 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + + // import Agent from "@egjs/agent"; + + /* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */ + var READY_STATUS = { + HAVE_NOTHING: 0, + // no information whether or not the audio/video is ready + HAVE_METADATA: 1, + // HAVE_METADATA - metadata for the audio/video is ready + HAVE_CURRENT_DATA: 2, + // data for the current playback position is available, but not enough data to play next frame/millisecond + HAVE_FUTURE_DATA: 3, + // data for the current and at least the next frame is available + HAVE_ENOUGH_DATA: 4, + // enough data available to start playing + // below is custom status for failed to load status + LOADING_FAILED: -1 + }; + var READYSTATECHANGE_EVENT_NAME = {}; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = "loadedmetadata"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = "loadeddata"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = "canplay"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = "canplaythrough"; + + var VideoLoader = + /*#__PURE__*/ + function () { + function VideoLoader(video) { + this._handlers = []; + this._sourceCount = 0; // on iOS safari, 'loadeddata' will not triggered unless the user hits play, + // so used 'loadedmetadata' instead. + + this._thresholdReadyState = READY_STATUS.HAVE_METADATA; + this._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState]; + this._loadStatus = video && video.readyState || READY_STATUS.HAVE_NOTHING; + this._onerror = this._onerror.bind(this); + video && this.set(video); + } + + var _proto = VideoLoader.prototype; + + _proto._onerror = function _onerror() { + this._errorCount++; + + if (this._errorCount >= this._sourceCount) { + this._loadStatus = READY_STATUS.LOADING_FAILED; + + this._detachErrorHandler(this._onerror); + } + } + /** + * + * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src} + */ + ; + + _proto._appendSourceElement = function _appendSourceElement(videoUrl) { + var videoSrc; + var videoType; + + if (typeof videoUrl === "object") { + videoSrc = videoUrl.src; + videoType = videoUrl.type; + } else if (typeof videoUrl === "string") { + videoSrc = videoUrl; + } + + if (!videoSrc) { + return false; + } + + var sourceElement = document.createElement("source"); + sourceElement.src = videoSrc; + videoType && (sourceElement.type = videoType); + + this._video.appendChild(sourceElement); + + return true; + }; + + _proto.set = function set(video) { + var _this = this; + + this._reset(); // reset resources. + + + if (!video) { + return; + } + + if (video instanceof HTMLVideoElement) { + // video tag + this._video = video; + } else if (typeof video === "string" || typeof video === "object") { + // url + this._video = document.createElement("video"); + + this._video.setAttribute("crossorigin", "anonymous"); + + this._video.setAttribute("webkit-playsinline", ""); + + this._video.setAttribute("playsinline", ""); + + if (video instanceof Array) { + video.forEach(function (v) { + return _this._appendSourceElement(v); + }); + } else { + this._appendSourceElement(video); + } + + this._sourceCount = this._video.querySelectorAll("source").length; + + if (this._sourceCount > 0) { + if (this._video.readyState < this._thresholdReadyState) { + this._video.load(); // attach loading error listener + + + this._attachErrorHandler(this._onerror); + } + } else { + this._video = null; + } + } + }; + + _proto._attachErrorHandler = function _attachErrorHandler(handler) { + this._video.addEventListener("error", handler); + + this._sources = this._video.querySelectorAll("source"); + [].forEach.call(this._sources, function (source) { + source.addEventListener("error", handler); + }); + }; + + _proto._detachErrorHandler = function _detachErrorHandler(handler) { + this._video.removeEventListener("error", handler); + + [].forEach.call(this._sources, function (source) { + source.removeEventListener("error", handler); + }); + }; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise$1(function (res, rej) { + if (!_this2._video) { + rej("VideoLoader: video is undefined"); + } else if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + rej("VideoLoader: video source is invalid"); + } else if (_this2._video.readyState >= _this2._thresholdReadyState) { + res(_this2._video); + } else { + // check errorCnt and reject + var rejector = function rejector() { + if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + _this2._detachErrorHandler(rejector); + + rej("VideoLoader: video source is invalid"); + } + }; + + _this2._attachErrorHandler(rejector); + + _this2._once(_this2._thresholdEventName, function () { + return res(_this2._video); + }); + } + }); + }; + + _proto.getElement = function getElement() { + return this._video; + }; + + _proto.destroy = function destroy() { + this._reset(); + }; + + _proto._reset = function _reset() { + var _this3 = this; + + this._handlers.forEach(function (handler) { + _this3._video.removeEventListener(handler.type, handler.fn); + }); + + this._handlers = []; + this._video = null; + this._sourceCount = 0; + this._errorCount = 0; + }; + + _proto._once = function _once(type, listener) { + var target = this._video; + + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + /* By useCapture mode enabled, you can capture the error event being fired on source(child)*/ + + + target.addEventListener(type, fn, true); + + this._handlers.push({ + type: type, + fn: fn + }); + }; + + return VideoLoader; + }(); + + var WEBGL_ERROR_CODE = { + "0": "NO_ERROR", + "1280": "INVALID_ENUM", + "1281": "INVALID_VALUE", + "1282": "INVALID_OPERATION", + "1285": "OUT_OF_MEMORY", + "1286": "INVALID_FRAMEBUFFER_OPERATION", + "37442": "CONTEXT_LOST_WEBGL" + }; + var webglAvailability = null; + var MAX_TEXTURE_SIZE_FOR_TEST = null; + + var WebGLUtils = + /*#__PURE__*/ + function () { + function WebGLUtils() {} + + WebGLUtils.createShader = function createShader(gl, type, source) { + var shader = gl.createShader(type); + gl.shaderSource(shader, source); + gl.compileShader(shader); + var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS); + + if (success) { + return shader; + } else { + // eslint-disable-next-line + console.error(gl.getShaderInfoLog(shader)); + } + + return null; + }; + + WebGLUtils.createProgram = function createProgram(gl, vertexShader, fragmentShader) { + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + gl.linkProgram(program); + gl.detachShader(program, vertexShader); + gl.detachShader(program, fragmentShader); + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + var success = gl.getProgramParameter(program, gl.LINK_STATUS); + + if (success) { + return program; + } + + gl.deleteProgram(program); + return null; + }; + + WebGLUtils.initBuffer = function initBuffer(gl, target + /* bind point */ + , data, itemSize, attr) { + var buffer = gl.createBuffer(); + gl.bindBuffer(target, buffer); + gl.bufferData(target, data, gl.STATIC_DRAW); + + if (buffer) { + buffer.itemSize = itemSize; + buffer.numItems = data.length / itemSize; + } + + if (attr !== undefined) { + gl.enableVertexAttribArray(attr); + gl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0); + } + + return buffer; + }; + + WebGLUtils.getWebglContext = function getWebglContext(canvas, userContextAttributes) { + var webglIdentifiers = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"]; + var context = null; + + var contextAttributes = _extends({ + preserveDrawingBuffer: false, + antialias: false, + xrCompatible: true + }, userContextAttributes); + + function onWebglcontextcreationerror(e) { + return e.statusMessage; + } + + canvas.addEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + + for (var i = 0; i < webglIdentifiers.length; i++) { + try { + context = canvas.getContext(webglIdentifiers[i], contextAttributes); + } catch (t) {} + + if (context) { + break; + } + } + + canvas.removeEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + return context; + }; + + WebGLUtils.createTexture = function createTexture(gl, textureTarget) { + var texture = gl.createTexture(); + gl.bindTexture(textureTarget, texture); + gl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.bindTexture(textureTarget, null); + return texture; + } + /** + * Returns the webgl availability of the current browser. + * @method WebGLUtils#isWebGLAvailable + * @retuen {Boolean} isWebGLAvailable + */ + ; + + WebGLUtils.isWebGLAvailable = function isWebGLAvailable() { + if (webglAvailability === null) { + var canvas = document.createElement("canvas"); + var webglContext = WebGLUtils.getWebglContext(canvas); + webglAvailability = !!webglContext; // webglContext Resource forced collection + + if (webglContext) { + var loseContextExtension = webglContext.getExtension("WEBGL_lose_context"); + loseContextExtension && loseContextExtension.loseContext(); + } + } + + return webglAvailability; + } + /** + * Returns whether webgl is stable in the current browser. + * @method WebGLUtils#isStableWebGL + * @retuen {Boolean} isStableWebGL + */ + ; + + WebGLUtils.isStableWebGL = function isStableWebGL() { + var agentInfo = Agent(); + var isStableWebgl = true; + + if (agentInfo.os.name === "android") { + var version = parseFloat(agentInfo.os.version); + + if (version <= 4.3) { + isStableWebgl = false; + } else if (version === 4.4) { + if (agentInfo.browser.name !== "chrome") { + isStableWebgl = false; + } + } + } + + return isStableWebgl; + }; + + WebGLUtils.getErrorNameFromWebGLErrorCode = function getErrorNameFromWebGLErrorCode(code) { + if (!(code in WEBGL_ERROR_CODE)) { + return "UNKNOWN_ERROR"; + } + + return WEBGL_ERROR_CODE[code]; + } + /** + * This function is wrapper for texImage2D to handle exceptions on texImage2D. + * Purpose is to prevent service from being stopped by script error. + * + * @param {*} gl + * @param {*} target + * @param {*} pixels + */ + ; + + WebGLUtils.texImage2D = function texImage2D(gl, target, pixels) { + try { + gl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + } catch (error) { + /* eslint-disable no-console */ + console.error("WebGLUtils.texImage2D error:", error); + /* eslint-enable no-console */ + } + }; + + WebGLUtils.getMaxTextureSize = function getMaxTextureSize(gl) { + // WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test + return MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE); + }; + + return WebGLUtils; + }(); + + var agent$1 = Agent(); + var isIE11 = agent$1.browser.name === "ie" && agent$1.browser.majorVersion === 11; + var EVENTS = { + ERROR: "error" + }; + /** + * + * Extends Component for firing errors occurs internally. + */ + + var Renderer = + /*#__PURE__*/ + function () { + var Renderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(Renderer, _Component); + + function Renderer() { + var _this; + + _this = _Component.call(this) || this; + _this._forceDimension = null; + _this._pixelCanvas = null; + _this._pixelContext = null; + return _this; + } + + var _proto = Renderer.prototype; + + _proto.render = function render(_ref) { + var gl = _ref.gl, + shaderProgram = _ref.shaderProgram, + indexBuffer = _ref.indexBuffer, + mvMatrix = _ref.mvMatrix, + pMatrix = _ref.pMatrix; + gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix); + gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix); + + if (indexBuffer) { + gl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0); + } + } // Define interface for Renderers + + /** + * Following MUST BE DEFINED on Child of Renderer + * + * DATA + * + * - getVertexPositionData + * - getIndexData + * - getTextureCoordData + * + * SOURCE + * + * - getVertexShaderSource + * - getFragmentShaderSource + * + * TEXTURE + * + * - bindTexture + */ + ; + + _proto.getDimension = function getDimension(pixelSource) { + var width = pixelSource.naturalWidth || pixelSource.videoWidth; + var height = pixelSource.naturalHeight || pixelSource.videoHeight; + return { + width: width, + height: height + }; + } + /** + * Update data used by shader + * - + * + * + * @param {*} param + */ + ; + + _proto.updateShaderData = function updateShaderData(param) {} + /* + * Update following data in implementation layer. + * If the data is not changed, it does not need to implement this function. + * + * - _VERTEX_POSITION_DATA + * - _TEXTURE_COORD_DATA + * - _INDEX_DATA + */ + + /** + * + * @param {HTMLImageElement | HTMLVideoElement} image + * @param {Object = {width, height}} forceDimension Forced dimension to resize + */ + ; + + _proto._initPixelSource = function _initPixelSource(image, forceDimension) { + var isIE11Video = isIE11 && image instanceof HTMLVideoElement; + + if (isIE11Video || forceDimension) { + var _ref2 = forceDimension || this.getDimension(image), + width = _ref2.width, + height = _ref2.height; + + this._pixelCanvas = document.createElement("canvas"); + this._pixelCanvas.width = width; + this._pixelCanvas.height = height; + this._pixelContext = this._pixelCanvas.getContext("2d"); + } + + this._forceDimension = forceDimension; + }; + + _proto._getPixelSource = function _getPixelSource(image) { + if (!this._pixelCanvas) { + return image; + } + /** + * IE11 && Video + * or + * Dimension is forced (Image is larger than texture size.) + */ + + + var contentDimension = this.getDimension(image); + var textureDimension = this._forceDimension || contentDimension; + + if (this._pixelCanvas.width !== textureDimension.width) { + this._pixelCanvas.width = textureDimension.width; + } + + if (this._pixelCanvas.height !== textureDimension.height) { + this._pixelCanvas.height = textureDimension.height; + } + + if (this._forceDimension) { + this._pixelContext.drawImage(image, 0, 0, contentDimension.width, contentDimension.height, 0, 0, textureDimension.width, textureDimension.height); + } else { + this._pixelContext.drawImage(image, 0, 0); + } + + return this._pixelCanvas; + }; + + _proto._extractTileConfig = function _extractTileConfig(imageConfig) { + var tileConfig = Array.isArray(imageConfig.tileConfig) ? imageConfig.tileConfig : Array.apply(void 0, Array(6)).map(function () { + return imageConfig.tileConfig; + }); + tileConfig = tileConfig.map(function (config) { + return _extends({ + flipHorizontal: false, + rotation: 0 + }, config); + }); + return tileConfig; + }; + + _proto._triggerError = function _triggerError(error) { + /* eslint-disable no-console */ + console.error("Renderer Error:", error); + /* eslint-enable no-console */ + + this.trigger(EVENTS.ERROR, { + message: typeof error === "string" ? error : error.message + }); + }; + + return Renderer; + }(Component); + + Renderer.EVENTS = EVENTS; + return Renderer; + }(); + + var CubeRenderer = + /*#__PURE__*/ + function () { + var CubeRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeRenderer, _Renderer); + + function CubeRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + CubeRenderer._VERTEX_POSITION_DATA = CubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // top + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // bottom + 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + return CubeRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + if (CubeRenderer._INDEX_DATA) { + return CubeRenderer._INDEX_DATA; + } + + var indexData = []; + var vertexPositionData = this.getVertexPositionData(); + + for (var i = 0; i < vertexPositionData.length / 3; i += 4) { + indexData.push(i, i + 2, i + 1, i, i + 3, i + 2); + } + + CubeRenderer._INDEX_DATA = indexData; + return indexData; + }; + + CubeRenderer.extractOrder = function extractOrder(imageConfig) { + return imageConfig.order || "RLUDBF"; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var vertexOrder = "BFUDRL"; + var order = CubeRenderer.extractOrder(imageConfig); + var base = this.getVertexPositionData(); + + var tileConfig = this._extractTileConfig(imageConfig); + + var elemSize = 3; + var vertexPerTile = 4; + var textureCoordData = vertexOrder.split("").map(function (face) { + return tileConfig[order.indexOf(face)]; + }).map(function (config, i) { + var rotation = parseInt(config.rotation / 90, 10); + var ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2]; + + for (var r = 0; r < Math.abs(rotation); r++) { + if (config.flipHorizontal && rotation > 0 || !config.flipHorizontal && rotation < 0) { + ordermap_.push(ordermap_.shift()); + } else { + ordermap_.unshift(ordermap_.pop()); + } + } + + var elemPerTile = elemSize * vertexPerTile; + var tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile); + var tileTemp = []; + + for (var j = 0; j < vertexPerTile; j++) { + tileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize); + } + + return tileTemp; + }).join().split(",").map(function (v) { + return parseInt(v, 10); + }); + return textureCoordData; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image, imageConfig) { + var baseOrder = "RLUDBF"; + var order = CubeRenderer.extractOrder(imageConfig); + var orderMap = {}; + order.split("").forEach(function (v, i) { + orderMap[v] = i; + }); + + try { + if (image instanceof Array) { + for (var surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) { + var tileIdx = orderMap[baseOrder[surfaceIdx]]; + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]); + } + } else { + var maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image); + + for (var _surfaceIdx = 0; _surfaceIdx < 6; _surfaceIdx++) { + var _tileIdx = orderMap[baseOrder[_surfaceIdx]]; + var tile = this.extractTileFromImage(image, _tileIdx, maxCubeMapTextureSize); + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + _surfaceIdx, tile); + } + } + } catch (e) { + this._triggerError(e); + } + }; + + _proto.bindTexture = function bindTexture(gl, texture, image, imageConfig) { + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + this.updateTexture(gl, image, imageConfig); + }; + + _proto.getSourceTileSize = function getSourceTileSize(image) { + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var aspectRatio = width / height; + var inputTextureSize; + + if (aspectRatio === 1 / 6) { + inputTextureSize = width; + } else if (aspectRatio === 6) { + inputTextureSize = height; + } else if (aspectRatio === 2 / 3) { + inputTextureSize = width / 2; + } else { + inputTextureSize = width / 3; + } + + return inputTextureSize; + }; + + _proto.extractTileFromImage = function extractTileFromImage(image, tileIdx, outputTextureSize) { + var _this$getDimension2 = this.getDimension(image), + width = _this$getDimension2.width; + + var inputTextureSize = this.getSourceTileSize(image); + var canvas = document.createElement("canvas"); + canvas.width = outputTextureSize; + canvas.height = outputTextureSize; + var context = canvas.getContext("2d"); + var tilePerRow = width / inputTextureSize; + var x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow); + var y = parseInt(tileIdx / tilePerRow, 10) * inputTextureSize; + context.drawImage(image, x, y, inputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize); + return canvas; + }; + + _proto.getMaxCubeMapTextureSize = function getMaxCubeMapTextureSize(gl, image) { + var agent = Agent(); + var maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); + + var _imageWidth = this.getSourceTileSize(image); + + if (agent.browser.name === "ie" && agent.browser.majorVersion === 11) { + if (!util.isPowerOfTwo(_imageWidth)) { + for (var i = 1; i < maxCubeMapTextureSize; i *= 2) { + if (i < _imageWidth) { + continue; + } else { + _imageWidth = i; + break; + } + } + } + } + + if (agent.os.name === "ios") { + var majorVersion = agent.os.majorVersion; // ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다. + + if (majorVersion === 9) { + _imageWidth = 1024; + } // ios 8 의 경우 텍스쳐 최대사이즈는 512 이다. + + + if (majorVersion === 8) { + _imageWidth = 512; + } + } // maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수 + + + return Math.min(maxCubeMapTextureSize, _imageWidth); + }; + + return CubeRenderer; + }(Renderer); + + CubeRenderer._VERTEX_POSITION_DATA = null; + CubeRenderer._INDEX_DATA = null; + return CubeRenderer; + }(); + + var CubeStripRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeStripRenderer, _Renderer); + + function CubeStripRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeStripRenderer.prototype; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"; + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + if (!this._vertices) { + this._vertices = [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // up + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // down + -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + } + + return this._vertices; + }; + + _proto.getIndexData = function getIndexData() { + var _this = this; + + // TODO: 한번만 계산하도록 수정하기 + var indices = function () { + var indexData = []; + + for (var i = 0; i < _this._vertices.length / 3; i += 4) { + indexData.push(i, i + 1, i + 2, i, i + 2, i + 3); + } + + return indexData; + }(); + + return indices; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var _this2 = this; + + // TODO: make it cols, rows as config. + var cols = 3; + var rows = 2; + var order = imageConfig.order || "RLUDFB"; + var coords = []; // 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다. + + for (var r = rows - 1; r >= 0; r--) { + for (var c = 0; c < cols; c++) { + var coord = [c / cols, r / rows, (c + 1) / cols, r / rows, (c + 1) / cols, (r + 1) / rows, c / cols, (r + 1) / rows]; + coords.push(coord); + } + } + + var tileConfigs = this._extractTileConfig(imageConfig); // Transform Coord By Flip & Rotation + + + coords = coords // shrink coord to avoid pixel bleeding + .map(function (coord) { + return _this2._shrinkCoord(coord); + }).map(function (coord, i) { + return _this2._transformCoord(coord, tileConfigs[i]); + }); // vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치 + + return "BFUDRL".split("").map(function (face) { + return order.indexOf(face); + }).map(function (index) { + return coords[index]; + }).reduce(function (acc, val) { + return acc.concat(val); + }, []); + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto._transformCoord = function _transformCoord(coord, tileConfig) { + var newCoord = coord.slice(); + + if (tileConfig.flipHorizontal) { + newCoord = this._flipHorizontalCoord(newCoord); + } + + if (tileConfig.rotation) { + newCoord = this._rotateCoord(newCoord, tileConfig.rotation); + } + + return newCoord; + }; + + _proto._shrinkCoord = function _shrinkCoord(coord) { + var SHRINK_Y = 0.00; + var SHRINK_X = 0.00; + return [coord[0] + SHRINK_X, coord[1] + SHRINK_Y, coord[2] - SHRINK_X, coord[3] + SHRINK_Y, coord[4] - SHRINK_X, coord[5] - SHRINK_Y, coord[6] + SHRINK_X, coord[7] - SHRINK_Y]; + }; + + _proto._rotateCoord = function _rotateCoord(coord, rotationAngle) { + var SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord. + + var shiftCount = parseInt(rotationAngle / 90, 10) % 4; + + if (shiftCount === 0) { + return coord; + } + + var moved; + var rotatedCoord = []; + + if (shiftCount > 0) { + moved = coord.splice(0, shiftCount * SIZE); + rotatedCoord = coord.concat(moved); + } else { + moved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE); + rotatedCoord = moved.concat(coord); + } + + return rotatedCoord; + }; + + _proto._flipHorizontalCoord = function _flipHorizontalCoord(coord) { + return [coord[2], coord[3], coord[0], coord[1], coord[6], coord[7], coord[4], coord[5]]; + }; + + return CubeStripRenderer; + }(Renderer); + + /** + * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide}) + * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고) + * @namespace + * @name GYRO_MODE + * @memberof eg.view360.PanoViewer + */ + /** + * Constant value for errors + * @ko 에러에 대한 상수 값 + * @namespace + * @name ERROR_TYPE + * @memberof eg.view360.PanoViewer + */ + + var ERROR_TYPE = { + /** + * Unsupported device + * @ko 미지원 기기 + * @name INVALID_DEVICE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 10 + */ + INVALID_DEVICE: 10, + + /** + * Webgl not support + * @ko WEBGL 미지원 + * @name NO_WEBGL + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 11 + */ + NO_WEBGL: 11, + + /** + * Failed to load image + * @ko 이미지 로드 실패 + * @name FAIL_IMAGE_LOAD + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 12 + */ + FAIL_IMAGE_LOAD: 12, + + /** + * Failed to bind texture + * @ko 텍스쳐 바인딩 실패 + * @name FAIL_BIND_TEXTURE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 13 + */ + FAIL_BIND_TEXTURE: 13, + + /** + * Only one resource(image or video) should be specified + * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * @name INVALID_RESOURCE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 14 + */ + INVALID_RESOURCE: 14, + + /** + * WebGL context lost occurred + * @ko WebGL context lost 발생 + * @name RENDERING_CONTEXT_LOST + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 15 + */ + RENDERING_CONTEXT_LOST: 15 + }; + /** + * Constant value for events + * @ko 이벤트에 대한 상수 값 + * @namespace + * @name EVENTS + * @memberof eg.view360.PanoViewer + */ + + var EVENTS$1 = { + /** + * Events that is fired when PanoViewer is ready to show image and handle user interaction. + * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트 + * @name READY + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default ready + */ + READY: "ready", + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name VIEW_CHANGE + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default viewChange + */ + VIEW_CHANGE: "viewChange", + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name ANIMATION_END + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default animationEnd + */ + ANIMATION_END: "animationEnd", + + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name ERROR + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default error + */ + ERROR: "error" + }; + /** + * Constant value for projection type + * @ko 프로젝션 타입 대한 상수 값 + * @namespace + * @name PROJECTION_TYPE + * @memberof eg.view360.PanoViewer + */ + + var PROJECTION_TYPE = { + /** + * Constant value for equirectangular type. + * @ko equirectangular 에 대한 상수 값. + * @name EQUIRECTANGULAR + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default equirectangular + */ + EQUIRECTANGULAR: "equirectangular", + + /** + * Constant value for cubemap type. + * @ko cubemap 에 대한 상수 값. + * @name CUBEMAP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubemap + */ + CUBEMAP: "cubemap", + + /** + * Constant value for cubestrip type. + * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC. + * + * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다. + * @name CUBESTRIP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubestrip + */ + CUBESTRIP: "cubestrip", + + /** + * Constant value for PANORAMA type. + * + * PANORAMA is a format for a panorma image which is taken from smartphone. + * + * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다. + * + * @name PANORAMA + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default panorama + */ + PANORAMA: "panorama", + + /** + * Constant value for EQUI_STEREOSCOPY type. + * + * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present. + * + * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다. + * + * @name STEREOSCOPIC_EQUI + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default stereoequi + */ + STEREOSCOPIC_EQUI: "stereoequi" + }; + /** + * A constant value for the format of the stereoscopic equirectangular projection type. + * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값 + * @namespace + * @name STEREO_FORMAT + * @memberof eg.view360.PanoViewer + */ + + var STEREO_FORMAT = { + /** + * A constant value for format of top bottom stereoscopic 360 equirectangular projection. + * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name TOP_BOTTOM + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dv" + */ + TOP_BOTTOM: "3dv", + + /** + * A constant value for format of left right stereoscopic 360 equirectangular projection. + * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name LEFT_RIGHT + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dh" + */ + LEFT_RIGHT: "3dh", + + /** + * A constant value specifying media is not in stereoscopic format. + * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값. + * @name NONE + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "" + */ + NONE: "" + }; + + var latitudeBands = 60; + var longitudeBands = 60; + var radius = 2; + var ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI; + var textureCoordData = []; + var vertexPositionData = []; + var indexData = []; + var latIdx; + var lngIdx; + + for (latIdx = 0; latIdx <= latitudeBands; latIdx++) { + var theta = (latIdx / latitudeBands - 0.5) * Math.PI; + var sinTheta = Math.sin(theta); + var cosTheta = Math.cos(theta); + + for (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) { + var phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN; + var sinPhi = Math.sin(phi); + var cosPhi = Math.cos(phi); + var x = cosPhi * cosTheta; + var y = sinTheta; + var z = sinPhi * cosTheta; + var u = lngIdx / longitudeBands; + var v = latIdx / latitudeBands; + textureCoordData.push(u, v); + vertexPositionData.push(radius * x, radius * y, radius * z); + + if (lngIdx !== longitudeBands && latIdx !== latitudeBands) { + var a = latIdx * (longitudeBands + 1) + lngIdx; + var b = a + longitudeBands + 1; + indexData.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + + var SphereRenderer = + /*#__PURE__*/ + function () { + var SphereRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(SphereRenderer, _Renderer); + + function SphereRenderer(format) { + var _this; + + _this = _Renderer.call(this) || this; + _this._stereoFormat = format; + return _this; + } + + var _proto = SphereRenderer.prototype; + + _proto.render = function render(ctx) { + var gl = ctx.gl, + shaderProgram = ctx.shaderProgram; + var leftEyeScaleOffset; + var rightEyeScaleOffset; + + switch (this._stereoFormat) { + case STEREO_FORMAT.TOP_BOTTOM: + leftEyeScaleOffset = [1, 0.5, 0, 0]; + rightEyeScaleOffset = [1, 0.5, 0, 0.5]; + break; + + case STEREO_FORMAT.LEFT_RIGHT: + leftEyeScaleOffset = [0.5, 1, 0, 0]; + rightEyeScaleOffset = [0.5, 1, 0.5, 0]; + break; + + default: + leftEyeScaleOffset = [1, 1, 0, 0]; + rightEyeScaleOffset = [1, 1, 0, 0]; + } + + var uTexScaleOffset = gl.getUniformLocation(shaderProgram, "uTexScaleOffset"); + gl.uniform4fv(uTexScaleOffset, [].concat(leftEyeScaleOffset, rightEyeScaleOffset)); + + _Renderer.prototype.render.call(this, ctx); + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + return SphereRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return SphereRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return SphereRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + return SphereRenderer; + }(Renderer); + + SphereRenderer._VERTEX_POSITION_DATA = vertexPositionData; + SphereRenderer._TEXTURE_COORD_DATA = textureCoordData; + SphereRenderer._INDEX_DATA = indexData; + return SphereRenderer; + }(); + + var MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6; + var longitudeBands$1 = 60; + var textureCoordData$1 = []; + var vertexPositionData$1 = []; + var indexData$1 = []; + + var CylinderRenderer = + /*#__PURE__*/ + function () { + var CylinderRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CylinderRenderer, _Renderer); + + function CylinderRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CylinderRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + return CylinderRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return CylinderRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return CylinderRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + var resizeDimension; + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device texture limit(" + maxSize + "))"); // Request resizing texture. + + /** + * TODO: Is it need to apply on another projection type? + */ + + + resizeDimension = width > height ? { + width: maxSize, + height: maxSize * height / width + } : { + width: maxSize * width / height, + height: maxSize + }; + } // Pixel Source for IE11 & Video or resizing needed + + + this._initPixelSource(image, resizeDimension); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto.updateShaderData = function updateShaderData(_ref) { + var _ref$imageAspectRatio = _ref.imageAspectRatio, + imageAspectRatio = _ref$imageAspectRatio === void 0 ? MIN_ASPECT_RATIO_FOR_FULL_PANORAMA : _ref$imageAspectRatio; + var lngIdx; + var cylinderMaxRadian; + var halfCylinderY; + var rotated; + var aspectRatio; // Exception case: orientation is rotated. + + if (imageAspectRatio < 1) { + /** + * If rotated is true, we assume that image is rotated counter clockwise. + * TODO: If there's other rotation, it is need to implement by each rotation. + */ + rotated = true; + aspectRatio = 1 / imageAspectRatio; + } else { + rotated = false; + aspectRatio = imageAspectRatio; + } + + if (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) { + var fov = 360 / aspectRatio; + cylinderMaxRadian = 2 * Math.PI; // 360 deg + + halfCylinderY = Math.tan(glMatrix.glMatrix.toRadian(fov / 2)); + } else { + cylinderMaxRadian = aspectRatio; + halfCylinderY = 0.5; // Range of cylinder is [-0.5, 0.5] to make height to 1. + } // intialize shader data before update + + + textureCoordData$1.length = 0; + vertexPositionData$1.length = 0; + indexData$1.length = 0; + var CYLIDER_Y = [-halfCylinderY, halfCylinderY]; + var startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360) + // console.log("cylinderMaxRadian:", glMatrix.toDegree(cylinderMaxRadian), "CYLIDER_Y", CYLIDER_Y, "start angle", glMatrix.toDegree(startAngleForCenterAlign)); + + for (var yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength + /* bottom & top */ + ; yIdx++) { + for (lngIdx = 0; lngIdx <= longitudeBands$1; lngIdx++) { + var angle = startAngleForCenterAlign + lngIdx / longitudeBands$1 * cylinderMaxRadian; + var x = Math.cos(angle); + var y = CYLIDER_Y[yIdx]; + var z = Math.sin(angle); + var u = void 0; + var v = void 0; + + if (rotated) { + // Rotated 90 degree (counter clock wise) + u = 1 - yIdx; // yLength - yIdx; + + v = lngIdx / longitudeBands$1; + } else { + // // Normal case (Not rotated) + u = lngIdx / longitudeBands$1; + v = yIdx; + } + + textureCoordData$1.push(u, v); + vertexPositionData$1.push(x, y, z); + + if (yIdx === 0 && lngIdx < longitudeBands$1) { + var a = lngIdx; + var b = a + longitudeBands$1 + 1; + indexData$1.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + }; + + return CylinderRenderer; + }(Renderer); + + CylinderRenderer._VERTEX_POSITION_DATA = vertexPositionData$1; + CylinderRenderer._TEXTURE_COORD_DATA = textureCoordData$1; + CylinderRenderer._INDEX_DATA = indexData$1; + return CylinderRenderer; + }(); + + var _Promise$2 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var VR_DISPLAY_PRESENT_CHANGE = "vrdisplaypresentchange"; + var DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1]; + var DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1]; + var EYES = { + LEFT: "left", + RIGHT: "right" + }; + + var VRManager = + /*#__PURE__*/ + function () { + var VRManager = + /*#__PURE__*/ + function () { + _createClass(VRManager, [{ + key: "context", + get: function get() { + return this._vrDisplay; + } + }]); + + function VRManager() { + var _this = this; + + this.destroy = function () { + var vrDisplay = _this._vrDisplay; + + _this.removeEndCallback(_this.destroy); + + if (vrDisplay && vrDisplay.isPresenting) { + vrDisplay.exitPresent(); + } + + _this._clear(); + }; + + this._frameData = new window.VRFrameData(); + + this._clear(); + } + + var _proto = VRManager.prototype; + + _proto.canRender = function canRender() { + return Boolean(this._vrDisplay); + }; + + _proto.beforeRender = function beforeRender(gl) { + // Render to the default backbuffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + }; + + _proto.afterRender = function afterRender() { + this._vrDisplay.submitFrame(); + }; + + _proto.getEyeParams = function getEyeParams(gl) { + var display = this._vrDisplay; + var halfWidth = gl.drawingBufferWidth * 0.5; + var height = gl.drawingBufferHeight; + var frameData = this._frameData; + display.getFrameData(frameData); + var leftMVMatrix = frameData.leftViewMatrix; + var rightMVMatrix = frameData.rightViewMatrix; + glMatrix.mat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset); + glMatrix.mat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset); + return [{ + viewport: [0, 0, halfWidth, height], + mvMatrix: leftMVMatrix, + pMatrix: frameData.leftProjectionMatrix + }, { + viewport: [halfWidth, 0, halfWidth, height], + mvMatrix: rightMVMatrix, + pMatrix: frameData.rightProjectionMatrix + }]; + }; + + _proto.isPresenting = function isPresenting() { + return Boolean(this._vrDisplay && this._vrDisplay.isPresenting); + }; + + _proto.addEndCallback = function addEndCallback(callback) { + window.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + window.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.requestPresent = function requestPresent(canvas) { + var _this2 = this; + + return new _Promise$2(function (resolve, reject) { + navigator.getVRDisplays().then(function (displays) { + var vrDisplay = displays.length && displays[0]; + + if (!vrDisplay) { + reject(new Error("No displays available.")); + return; + } + + if (!vrDisplay.capabilities.canPresent) { + reject(new Error("Display lacking capability to present.")); + return; + } + + vrDisplay.requestPresent([{ + source: canvas + }]).then(function () { + var leftEye = vrDisplay.getEyeParameters(EYES.LEFT); + var rightEye = vrDisplay.getEyeParameters(EYES.RIGHT); + canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2; + canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight); + + _this2._setDisplay(vrDisplay); + + resolve(); + }); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setDisplay = function _setDisplay(vrDisplay) { + this._vrDisplay = vrDisplay; + var layers = vrDisplay.getLayers(); + + if (layers.length) { + var layer = layers[0]; + this._leftBounds = layer.leftBounds; + this._rightBounds = layer.rightBounds; + } + + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._vrDisplay = null; + this._leftBounds = DEFAULT_LEFT_BOUNDS; + this._rightBounds = DEFAULT_RIGHT_BOUNDS; + this._yawOffset = 0; + }; + + return VRManager; + }(); + + return VRManager; + }(); + + var XR_REFERENCE_SPACE = "local"; + + var XRManager = + /*#__PURE__*/ + function () { + var XRManager = + /*#__PURE__*/ + function () { + _createClass(XRManager, [{ + key: "context", + get: function get() { + return this._xrSession; + } + }]); + + function XRManager() { + var _this = this; + + this.destroy = function () { + var xrSession = _this._xrSession; + + _this.removeEndCallback(_this.destroy); + + if (xrSession) { + // Capture to avoid errors + xrSession.end().then(function () {}, function () {}); + } + + _this._clear(); + }; + + this._clear(); + } + + var _proto = XRManager.prototype; + + _proto.canRender = function canRender(frame) { + var pose = frame.getViewerPose(this._xrRefSpace); + return Boolean(pose); + }; + + _proto.beforeRender = function beforeRender(gl, frame) { + var session = frame.session; + var baseLayer = session.renderState.baseLayer; + gl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer); + }; + + _proto.afterRender = function afterRender() {}; + + _proto.getEyeParams = function getEyeParams(gl, frame) { + var _this2 = this; + + var session = frame.session; + var pose = frame.getViewerPose(this._xrRefSpace); + + if (!pose) { + // Can't render + return null; + } + + var glLayer = session.renderState.baseLayer; + return pose.views.map(function (view) { + var viewport = glLayer.getViewport(view); + var mvMatrix = view.transform.inverse.matrix; + + if (IS_SAFARI_ON_DESKTOP) { + glMatrix.mat4.rotateX(mvMatrix, mvMatrix, glMatrix.glMatrix.toRadian(180)); + } + + glMatrix.mat4.rotateY(mvMatrix, mvMatrix, _this2._yawOffset); + return { + viewport: [viewport.x, viewport.y, viewport.width, viewport.height], + mvMatrix: mvMatrix, + pMatrix: view.projectionMatrix + }; + }); + }; + + _proto.isPresenting = function isPresenting() { + return this._presenting; + }; + + _proto.addEndCallback = function addEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.addEventListener("end", callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.removeEventListener("end", callback); + }; + + _proto.requestPresent = function requestPresent(canvas, gl) { + var _this3 = this; + + return navigator.xr.requestSession("immersive-vr", { + requiredFeatures: [XR_REFERENCE_SPACE] + }).then(function (session) { + var xrLayer = new window.XRWebGLLayer(session, gl); + session.updateRenderState({ + baseLayer: xrLayer + }); + return session.requestReferenceSpace(XR_REFERENCE_SPACE).then(function (refSpace) { + _this3._setSession(session, xrLayer, refSpace); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setSession = function _setSession(session, xrLayer, refSpace) { + this._xrSession = session; + this._xrLayer = xrLayer; + this._xrRefSpace = refSpace; + this._presenting = true; + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._xrSession = null; + this._xrLayer = null; + this._xrRefSpace = null; + this._presenting = false; + this._yawOffset = 0; + }; + + return XRManager; + }(); + + return XRManager; + }(); + + var WebGLAnimator = + /*#__PURE__*/ + function () { + var WebGLAnimator = + /*#__PURE__*/ + function () { + function WebGLAnimator() { + var _this = this; + + this._onLoop = function () { + _this._callback.apply(_this, arguments); + + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + }; + + this._onLoopNextTick = function () { + var before = performance.now(); + + _this._callback.apply(_this, arguments); + + var diff = performance.now() - before; + + if (_this._rafTimer >= 0) { + clearTimeout(_this._rafTimer); + _this._rafTimer = -1; + } + /** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */ + + + if (diff < 16) { + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + } else { + /** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/ + _this._rafTimer = setTimeout(_this._onLoop, 0); + } + }; + + this._callback = null; + this._context = window; + this._rafId = -1; + this._rafTimer = -1; + } + + var _proto = WebGLAnimator.prototype; + + _proto.setCallback = function setCallback(callback) { + this._callback = callback; + }; + + _proto.setContext = function setContext(context) { + this._context = context; + }; + + _proto.start = function start() { + var context = this._context; + var callback = this._callback; // No context / callback set + + if (!context || !callback) return; // Animation already started + + if (this._rafId >= 0 || this._rafTimer >= 0) return; + + if (IS_SAFARI_ON_DESKTOP) { + this._rafId = context.requestAnimationFrame(this._onLoopNextTick); + } else { + this._rafId = context.requestAnimationFrame(this._onLoop); + } + }; + + _proto.stop = function stop() { + if (this._rafId >= 0) { + this._context.cancelAnimationFrame(this._rafId); + } + + if (this._rafTimer >= 0) { + clearTimeout(this._rafTimer); + } + + this._rafId = -1; + this._rafTimer = -1; + } + /** + * There can be more than 1 argument when we use XRSession's raf + */ + ; + + return WebGLAnimator; + }(); + + return WebGLAnimator; + }(); + + var _Promise$3 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var ImageType = PROJECTION_TYPE; + var DEVICE_PIXEL_RATIO = devicePixelRatio || 1; // DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다. + + if (DEVICE_PIXEL_RATIO > 2) { + DEVICE_PIXEL_RATIO = 2; + } // define custom events name + + /** + * TODO: how to manage events/errortype with PanoViewer + * + * I think renderer events should be seperated from viewer events although it has same name. + */ + + + var EVENTS$2 = { + BIND_TEXTURE: "bindTexture", + IMAGE_LOADED: "imageLoaded", + ERROR: "error", + RENDERING_CONTEXT_LOST: "renderingContextLost", + RENDERING_CONTEXT_RESTORE: "renderingContextRestore" + }; + var ERROR_TYPE$1 = { + INVALID_DEVICE: 10, + NO_WEBGL: 11, + FAIL_IMAGE_LOAD: 12, + RENDERER_ERROR: 13 + }; + + var PanoImageRenderer = + /*#__PURE__*/ + function () { + var PanoImageRenderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoImageRenderer, _Component); + + function PanoImageRenderer(image, width, height, isVideo, sphericalConfig, renderingContextAttributes) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + + _this._renderStereo = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var eyeParams = vr.getEyeParams(gl, frame); + if (!eyeParams) return; + vr.beforeRender(gl, frame); // Render both eyes + + for (var _i = 0, _arr = [0, 1]; _i < _arr.length; _i++) { + var eyeIndex = _arr[_i]; + var eyeParam = eyeParams[eyeIndex]; + _this.mvMatrix = eyeParam.mvMatrix; + _this.pMatrix = eyeParam.pMatrix; + gl.viewport.apply(gl, eyeParam.viewport); + gl.uniform1f(_this.shaderProgram.uEye, eyeIndex); + + _this._bindBuffers(); + + _this._draw(); + } + + vr.afterRender(); + }; + + _this.exitVR = function () { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; + if (!vr) return; + vr.removeEndCallback(_this.exitVR); + vr.destroy(); + _this._vr = null; // Restore canvas & context on iOS + + if (IS_IOS) { + _this._restoreStyle(); + } + + _this.updateViewportDimensions(_this.width, _this.height); + + _this._updateViewport(); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + _this._bindBuffers(); + + _this._shouldForceDraw = true; + animator.stop(); + animator.setContext(window); + animator.setCallback(_this._render.bind(_assertThisInitialized(_this))); + animator.start(); + }; + + _this._onFirstVRFrame = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; // If rendering is not ready, wait for next frame + + if (!vr.canRender(frame)) return; + var minusZDir = glMatrix.vec3.fromValues(0, 0, -1); + var eyeParam = vr.getEyeParams(gl, frame)[0]; // Extract only rotation + + var mvMatrix = glMatrix.mat3.fromMat4(glMatrix.mat3.create(), eyeParam.mvMatrix); + var pMatrix = glMatrix.mat3.fromMat4(glMatrix.mat3.create(), eyeParam.pMatrix); + var mvInv = glMatrix.mat3.invert(glMatrix.mat3.create(), mvMatrix); + var pInv = glMatrix.mat3.invert(glMatrix.mat3.create(), pMatrix); + var viewDir = glMatrix.vec3.transformMat3(glMatrix.vec3.create(), minusZDir, pInv); + glMatrix.vec3.transformMat3(viewDir, viewDir, mvInv); + var yawOffset = util.yawOffsetBetween(viewDir, glMatrix.vec3.fromValues(0, 0, 1)); + + if (yawOffset === 0) { + // If the yawOffset is exactly 0, then device sensor is not ready + // So read it again until it has any value in it + return; + } + + vr.setYawOffset(yawOffset); + animator.setCallback(_this._renderStereo); + }; + + _this.sphericalConfig = sphericalConfig; + _this.fieldOfView = sphericalConfig.fieldOfView; + _this.width = width; + _this.height = height; + _this._lastQuaternion = null; + _this._lastYaw = null; + _this._lastPitch = null; + _this._lastFieldOfView = null; + _this.pMatrix = glMatrix.mat4.create(); + _this.mvMatrix = glMatrix.mat4.create(); // initialzie pMatrix + + glMatrix.mat4.perspective(_this.pMatrix, glMatrix.glMatrix.toRadian(_this.fieldOfView), width / height, 0.1, 100); + _this.textureCoordBuffer = null; + _this.vertexBuffer = null; + _this.indexBuffer = null; + _this.canvas = _this._initCanvas(width, height); + + _this._setDefaultCanvasStyle(); + + _this._wrapper = null; // canvas wrapper + + _this._wrapperOrigStyle = null; + _this._renderingContextAttributes = renderingContextAttributes; + _this._image = null; + _this._imageConfig = null; + _this._imageIsReady = false; + _this._shouldForceDraw = false; + _this._keepUpdate = false; // Flag to specify 'continuous update' on video even when still. + + _this._onContentLoad = _this._onContentLoad.bind(_assertThisInitialized(_this)); + _this._onContentError = _this._onContentError.bind(_assertThisInitialized(_this)); + _this._animator = new WebGLAnimator(); // VR/XR manager + + _this._vr = null; + + if (image) { + _this.setImage({ + image: image, + imageType: sphericalConfig.imageType, + isVideo: isVideo, + cubemapConfig: sphericalConfig.cubemapConfig + }); + } + + return _this; + } // FIXME: Please refactor me to have more loose connection to yawpitchcontrol + + + var _proto = PanoImageRenderer.prototype; + + _proto.setYawPitchControl = function setYawPitchControl(yawPitchControl) { + this._yawPitchControl = yawPitchControl; + }; + + _proto.getContent = function getContent() { + return this._image; + }; + + _proto.setImage = function setImage(_ref) { + var image = _ref.image, + imageType = _ref.imageType, + _ref$isVideo = _ref.isVideo, + isVideo = _ref$isVideo === void 0 ? false : _ref$isVideo, + cubemapConfig = _ref.cubemapConfig; + this._imageIsReady = false; + this._isVideo = isVideo; + this._imageConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only */ + order: imageType === ImageType.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, cubemapConfig); + + this._setImageType(imageType); + + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + if (isVideo) { + this._contentLoader = new VideoLoader(); + this._keepUpdate = true; + } else { + this._contentLoader = new ImageLoader(); + this._keepUpdate = false; + } // img element or img url + + + this._contentLoader.set(image); // 이미지의 사이즈를 캐시한다. + // image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed. + + + this._image = this._contentLoader.getElement(); + return this._contentLoader.get().then(this._onContentLoad, this._onContentError)["catch"](function (e) { + return setTimeout(function () { + throw e; + }); + }); // Prevent exceptions from being isolated in promise chain. + }; + + _proto._setImageType = function _setImageType(imageType) { + var _this2 = this; + + if (!imageType || this._imageType === imageType) { + return; + } + + this._imageType = imageType; + this._isCubeMap = imageType === ImageType.CUBEMAP; + + if (this._renderer) { + this._renderer.off(); + } + + switch (imageType) { + case ImageType.CUBEMAP: + this._renderer = new CubeRenderer(); + break; + + case ImageType.CUBESTRIP: + this._renderer = new CubeStripRenderer(); + break; + + case ImageType.PANORAMA: + this._renderer = new CylinderRenderer(); + break; + + case ImageType.STEREOSCOPIC_EQUI: + this._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat); + break; + + default: + this._renderer = new SphereRenderer(STEREO_FORMAT.NONE); + break; + } + + this._renderer.on(Renderer.EVENTS.ERROR, function (e) { + _this2.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.RENDERER_ERROR, + message: e.message + }); + }); + + this._initWebGL(); + }; + + _proto._initCanvas = function _initCanvas(width, height) { + var canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + this._onWebglcontextlost = this._onWebglcontextlost.bind(this); + this._onWebglcontextrestored = this._onWebglcontextrestored.bind(this); + canvas.addEventListener("webglcontextlost", this._onWebglcontextlost); + canvas.addEventListener("webglcontextrestored", this._onWebglcontextrestored); + return canvas; + }; + + _proto._setDefaultCanvasStyle = function _setDefaultCanvasStyle() { + var canvas = this.canvas; + canvas.style.bottom = 0; + canvas.style.left = 0; + canvas.style.right = 0; + canvas.style.top = 0; + canvas.style.margin = "auto"; + canvas.style.maxHeight = "100%"; + canvas.style.maxWidth = "100%"; + canvas.style.outline = "none"; + canvas.style.position = "absolute"; + }; + + _proto._onContentError = function _onContentError(error) { + this._imageIsReady = false; + this._image = null; + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.FAIL_IMAGE_LOAD, + message: "failed to load image" + }); + return false; + }; + + _proto._triggerContentLoad = function _triggerContentLoad() { + this.trigger(EVENTS$2.IMAGE_LOADED, { + content: this._image, + isVideo: this._isVideo, + projectionType: this._imageType + }); + }; + + _proto._onContentLoad = function _onContentLoad(image) { + this._imageIsReady = true; + + this._triggerContentLoad(); + + return true; + }; + + _proto.isImageLoaded = function isImageLoaded() { + return !!this._image && this._imageIsReady && (!this._isVideo || this._image.readyState >= 2 + /* HAVE_CURRENT_DATA */ + ); + }; + + _proto.bindTexture = function bindTexture() { + var _this3 = this; + + return new _Promise$3(function (res, rej) { + if (!_this3._contentLoader) { + rej("ImageLoader is not initialized"); + return; + } + + _this3._contentLoader.get().then(function () { + _this3._bindTexture(); + }, rej).then(res); + }); + } // 부모 엘리먼트에 canvas 를 붙임 + ; + + _proto.attachTo = function attachTo(parentElement) { + this.detach(); + parentElement.appendChild(this.canvas); + this._wrapper = parentElement; + }; + + _proto.forceContextLoss = function forceContextLoss() { + if (this.hasRenderingContext()) { + var loseContextExtension = this.context.getExtension("WEBGL_lose_context"); + + if (loseContextExtension) { + loseContextExtension.loseContext(); + } + } + } // 부모 엘리먼트에서 canvas 를 제거 + ; + + _proto.detach = function detach() { + if (this.canvas.parentElement) { + this.canvas.parentElement.removeChild(this.canvas); + } + }; + + _proto.destroy = function destroy() { + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + this._animator.stop(); + + this.detach(); + this.forceContextLoss(); + this.off(); + this.canvas.removeEventListener("webglcontextlost", this._onWebglcontextlost); + this.canvas.removeEventListener("webglcontextrestored", this._onWebglcontextrestored); + }; + + _proto.hasRenderingContext = function hasRenderingContext() { + if (!(this.context && !this.context.isContextLost())) { + return false; + } else if (this.context && !this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) { + return false; + } + + return true; + }; + + _proto._initShaderProgram = function _initShaderProgram() { + var gl = this.context; + + if (this.shaderProgram) { + gl.deleteProgram(this.shaderProgram); + this.shaderProgram = null; + } + + var renderer = this._renderer; + var vsSource = renderer.getVertexShaderSource(); + var fsSource = renderer.getFragmentShaderSource(); + var vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource); + var fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource); + var shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader); + + if (!shaderProgram) { + throw new Error("Failed to intialize shaders: " + WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())); + } + + gl.useProgram(shaderProgram); + shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); + gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute); + shaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix"); + shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); + shaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); + shaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); + shaderProgram.uEye = gl.getUniformLocation(shaderProgram, "uEye"); + gl.enableVertexAttribArray(shaderProgram.textureCoordAttribute); // clear buffer + + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); // Use TEXTURE0 + + gl.uniform1i(shaderProgram.samplerUniform, 0); + this.shaderProgram = shaderProgram; + }; + + _proto._onWebglcontextlost = function _onWebglcontextlost(e) { + e.preventDefault(); + this.trigger(EVENTS$2.RENDERING_CONTEXT_LOST); + }; + + _proto._onWebglcontextrestored = function _onWebglcontextrestored(e) { + this._initWebGL(); + + this.trigger(EVENTS$2.RENDERING_CONTEXT_RESTORE); + }; + + _proto.updateFieldOfView = function updateFieldOfView(fieldOfView) { + this.fieldOfView = fieldOfView; + + this._updateViewport(); + }; + + _proto.updateViewportDimensions = function updateViewportDimensions(width, height) { + var viewPortChanged = false; + this.width = width; + this.height = height; + var w = width * DEVICE_PIXEL_RATIO; + var h = height * DEVICE_PIXEL_RATIO; + + if (w !== this.canvas.width) { + this.canvas.width = w; + viewPortChanged = true; + } + + if (h !== this.canvas.height) { + this.canvas.height = h; + viewPortChanged = true; + } + + if (!viewPortChanged) { + return; + } + + this._updateViewport(); + + this._shouldForceDraw = true; + }; + + _proto._updateViewport = function _updateViewport() { + glMatrix.mat4.perspective(this.pMatrix, glMatrix.glMatrix.toRadian(this.fieldOfView), this.canvas.width / this.canvas.height, 0.1, 100); + this.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight); + }; + + _proto._initWebGL = function _initWebGL() { + var gl; // TODO: Following code does need to be executed only if width/height, cubicStrip property is changed. + + try { + this._initRenderingContext(); + + gl = this.context; + this.updateViewportDimensions(this.width, this.height); + + this._initShaderProgram(); + } catch (e) { + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.NO_WEBGL, + message: "no webgl support" + }); + this.destroy(); + console.error(e); // eslint-disable-line no-console + + return; + } // 캔버스를 투명으로 채운다. + + + gl.clearColor(0, 0, 0, 0); + var textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D; + + if (this.texture) { + gl.deleteTexture(this.texture); + } + + this.texture = WebGLUtils.createTexture(gl, textureTarget); + + if (this._imageType === ImageType.CUBESTRIP) { + // TODO: Apply following options on other projection type. + gl.enable(gl.CULL_FACE); // gl.enable(gl.DEPTH_TEST); + } + }; + + _proto._initRenderingContext = function _initRenderingContext() { + if (this.hasRenderingContext()) { + return; + } + + if (!window.WebGLRenderingContext) { + throw new Error("WebGLRenderingContext not available."); + } + + this.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes); + + if (!this.context) { + throw new Error("Failed to acquire 3D rendering context"); + } + }; + + _proto._initBuffers = function _initBuffers() { + var vertexPositionData = this._renderer.getVertexPositionData(); + + var indexData = this._renderer.getIndexData(); + + var textureCoordData = this._renderer.getTextureCoordData(this._imageConfig); + + var gl = this.context; + this.vertexBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3, this.shaderProgram.vertexPositionAttribute); + this.indexBuffer = WebGLUtils.initBuffer(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1); + this.textureCoordBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2, this.shaderProgram.textureCoordAttribute); + + this._bindBuffers(); + }; + + _proto._bindTexture = function _bindTexture() { + // Detect if it is EAC Format while CUBESTRIP mode. + // We assume it is EAC if image is not 3/2 ratio. + if (this._imageType === ImageType.CUBESTRIP) { + var _this$_renderer$getDi = this._renderer.getDimension(this._image), + width = _this$_renderer$getDi.width, + height = _this$_renderer$getDi.height; + + var isEAC = width && height && width / height !== 1.5; + this.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, "uIsEAC"), isEAC); + } else if (this._imageType === ImageType.PANORAMA) { + var _this$_renderer$getDi2 = this._renderer.getDimension(this._image), + _width = _this$_renderer$getDi2.width, + _height = _this$_renderer$getDi2.height; + + var imageAspectRatio = _width && _height && _width / _height; + + this._renderer.updateShaderData({ + imageAspectRatio: imageAspectRatio + }); + } // intialize shader buffers after image is loaded.(by updateShaderData) + // because buffer may be differ by image size.(eg. CylinderRenderer) + + + this._initBuffers(); + + this._renderer.bindTexture(this.context, this.texture, this._image, this._imageConfig); + + this._shouldForceDraw = true; + this.trigger(EVENTS$2.BIND_TEXTURE); + }; + + _proto._updateTexture = function _updateTexture() { + this._renderer.updateTexture(this.context, this._image, this._imageConfig); + }; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + if (doUpdate && this.isImageLoaded() === false) { + // Force to draw a frame after image is loaded on render() + this._shouldForceDraw = true; + } + + this._keepUpdate = doUpdate; + }; + + _proto.startRender = function startRender() { + this._animator.setCallback(this._render.bind(this)); + + this._animator.start(); + }; + + _proto.stopRender = function stopRender() { + this._animator.stop(); + }; + + _proto.renderWithQuaternion = function renderWithQuaternion(quaternion, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastQuaternion && glMatrix.quat.exactEquals(this._lastQuaternion, quaternion) && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // updatefieldOfView only if fieldOfView is changed. + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + this.mvMatrix = glMatrix.mat4.fromQuat(glMatrix.mat4.create(), quaternion); + + this._draw(); + + this._lastQuaternion = glMatrix.quat.clone(quaternion); + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto.renderWithYawPitch = function renderWithYawPitch(yaw, pitch, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastYaw !== null && this._lastYaw === yaw && this._lastPitch !== null && this._lastPitch === pitch && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출 + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + glMatrix.mat4.identity(this.mvMatrix); + glMatrix.mat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.glMatrix.toRadian(pitch)); + glMatrix.mat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.glMatrix.toRadian(yaw)); + + this._draw(); + + this._lastYaw = yaw; + this._lastPitch = pitch; + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto._render = function _render() { + var yawPitchControl = this._yawPitchControl; + var fov = yawPitchControl.getFov(); + + if (yawPitchControl.shouldRenderWithQuaternion()) { + var quaternion = yawPitchControl.getQuaternion(); + this.renderWithQuaternion(quaternion, fov); + } else { + var yawPitch = yawPitchControl.getYawPitch(); + this.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov); + } + }; + + _proto._bindBuffers = function _bindBuffers() { + var gl = this.context; + var program = this.shaderProgram; + var vertexBuffer = this.vertexBuffer; + var textureCoordBuffer = this.textureCoordBuffer; + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + gl.enableVertexAttribArray(program.vertexPositionAttribute); + gl.vertexAttribPointer(program.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer); + gl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer); + gl.enableVertexAttribArray(program.textureCoordAttribute); + gl.vertexAttribPointer(program.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0); + }; + + _proto._draw = function _draw() { + if (this._isVideo && this._keepUpdate) { + this._updateTexture(); + } + + this._renderer.render({ + gl: this.context, + shaderProgram: this.shaderProgram, + indexBuffer: this.indexBuffer, + mvMatrix: this.mvMatrix, + pMatrix: this.pMatrix + }); + } + /** + * Returns projection renderer by each type + */ + ; + + _proto.getProjectionRenderer = function getProjectionRenderer() { + return this._renderer; + } + /** + * @return Promise + */ + ; + + _proto.enterVR = function enterVR() { + var vr = this._vr; + + if (!WEBXR_SUPPORTED && !navigator.getVRDisplays) { + return _Promise$3.reject("VR is not available on this browser."); + } + + if (vr && vr.isPresenting()) { + return _Promise$3.resolve("VR already enabled."); + } + + return this._requestPresent(); + }; + + _proto._requestPresent = function _requestPresent() { + var _this4 = this; + + var gl = this.context; + var canvas = this.canvas; + var animator = this._animator; + this._vr = WEBXR_SUPPORTED ? new XRManager() : new VRManager(); + var vr = this._vr; + animator.stop(); + return new _Promise$3(function (resolve, reject) { + vr.requestPresent(canvas, gl).then(function () { + vr.addEndCallback(_this4.exitVR); + animator.setContext(vr.context); + animator.setCallback(_this4._onFirstVRFrame); + + if (IS_IOS) { + _this4._setWrapperFullscreen(); + } + + _this4._shouldForceDraw = true; + animator.start(); + resolve("success"); + })["catch"](function (e) { + vr.destroy(); + _this4._vr = null; + animator.start(); + reject(e); + }); + }); + }; + + _proto._setWrapperFullscreen = function _setWrapperFullscreen() { + var wrapper = this._wrapper; + if (!wrapper) return; + this._wrapperOrigStyle = wrapper.getAttribute("style"); + var wrapperStyle = wrapper.style; + wrapperStyle.width = "100vw"; + wrapperStyle.height = "100vh"; + wrapperStyle.position = "fixed"; + wrapperStyle.left = "0"; + wrapperStyle.top = "0"; + wrapperStyle.zIndex = "9999"; + }; + + _proto._restoreStyle = function _restoreStyle() { + var wrapper = this._wrapper; + var canvas = this.canvas; + if (!wrapper) return; + + if (this._wrapperOrigStyle) { + wrapper.setAttribute("style", this._wrapperOrigStyle); + } else { + wrapper.removeAttribute("style"); + } + + this._wrapperOrigStyle = null; // Restore canvas style + + canvas.removeAttribute("style"); + + this._setDefaultCanvasStyle(); + }; + + return PanoImageRenderer; + }(Component); + + PanoImageRenderer.EVENTS = EVENTS$2; + PanoImageRenderer.ERROR_TYPE = ERROR_TYPE$1; + return PanoImageRenderer; + }(); + + var _Promise$4 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + + var PanoViewer = + /*#__PURE__*/ + function () { + var PanoViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.PanoViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.PanoViewer + */ + // It should be deprecated! + + /** + * Constant value for touch directions + * @ko 터치 방향에 대한 상수 값. + * @namespace + * @name TOUCH_DIRECTION + * @memberof eg.view360.PanoViewer + */ + + /** + * @classdesc 360 media viewer + * @ko 360 미디어 뷰어 + * @class + * @name eg.view360.PanoViewer + * @extends eg.Component + * + * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트 + * @param {Object} config + * + * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
+ * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다. + * @param {Object} [config.cubemapConfig.order = "RLUDBF"(ProjectionType === CUBEMAP) | "RLUDFB" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서 + * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다. + * @param {String} [config.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
+ * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위) + * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위) + * + * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위) + * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위) + * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위) + * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다 + * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다. + * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키 + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE}
+ * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위 + * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위 + * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위 + * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
+ * + * @example + * // PanoViewer Creation + * // create PanoViewer with option + * var PanoViewer = eg.view360.PanoViewer; + * // Area where the image will be displayed(HTMLElement) + * var container = document.getElementById("myPanoViewer"); + * + * var panoViewer = new PanoViewer(container, { + * // If projectionType is not specified, the default is "equirectangular". + * // Specifies an image of the "equirectangular" type. + * image: "/path/to/image/image.jpg" + *}); + * + * @example + * // Cubemap Config Setting Example + * // For support Youtube EAC projection, You should set cubemapConfig as follows. + * cubemapConfig: { + * order: "LFRDBU", + * tileConfig: [ + * tileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}] + * ] + * } + */ + function PanoViewer(container, options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Component.call(this) || this; // Raises the error event if webgl is not supported. + + if (!WebGLUtils.isWebGLAvailable()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.NO_WEBGL, + message: "no webgl support" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!WebGLUtils.isStableWebGL()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_DEVICE, + message: "blacklisted browser" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!!options.image && !!options.video) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_RESOURCE, + message: "Specifying multi resouces(both image and video) is not valid." + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } // Check XR support at not when imported, but when created. + // This is intended to make polyfills easier to use. + + + checkXRSupport(); + _this._container = container; + _this._image = options.image || options.video; + _this._isVideo = !!options.video; + _this._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + _this._cubemapConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/ + order: _this._projectionType === PROJECTION_TYPE.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, options.cubemapConfig); + _this._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; // If the width and height are not provided, will use the size of the container. + + _this._width = options.width || parseInt(window.getComputedStyle(container).width, 10); + _this._height = options.height || parseInt(window.getComputedStyle(container).height, 10); + /** + * Cache the direction for the performance in renderLoop + * + * This value should be updated by "change" event of YawPitchControl. + */ + + _this._yaw = options.yaw || 0; + _this._pitch = options.pitch || 0; + _this._fov = options.fov || 65; + _this._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH; + _this._quaternion = null; + _this._aspectRatio = _this._height !== 0 ? _this._width / _this._height : 1; + var fovRange = options.fovRange || [30, 110]; + var touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ? options.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL; + + var yawPitchConfig = _extends(options, { + element: container, + yaw: _this._yaw, + pitch: _this._pitch, + fov: _this._fov, + gyroMode: _this._gyroMode, + fovRange: fovRange, + aspectRatio: _this._aspectRatio, + touchDirection: touchDirection + }); + + _this._isReady = false; + + _this._initYawPitchControl(yawPitchConfig); + + _this._initRenderer(_this._yaw, _this._pitch, _this._fov, _this._projectionType, _this._cubemapConfig); + + return _this; + } + /** + * Get the video element that the viewer is currently playing. You can use this for playback. + * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다. + * @method eg.view360.PanoViewer#getVideo + * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement + * @example + * var videoTag = panoViewer.getVideo(); + * videoTag.play(); // play video! + */ + + + var _proto = PanoViewer.prototype; + + _proto.getVideo = function getVideo() { + if (!this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the video information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setVideo + * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정) + * @param {Object} param + * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}("equirectangular")] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setVideo("/path/to/video/video.mp4", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR + * }); + */ + ; + + _proto.setVideo = function setVideo(video, param) { + if (param === void 0) { + param = {}; + } + + if (video) { + this.setImage(video, { + projectionType: param.projectionType, + isVideo: true, + cubemapConfig: param.cubemapConfig, + stereoFormat: param.stereoFormat + }); + } + + return this; + } + /** + * Get the image information that the viewer is currently using. + * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다. + * @method eg.view360.PanoViewer#getImage + * @return {Image} Image Object이미지 객체 + * @example + * var imageObj = panoViewer.getImage(); + */ + ; + + _proto.getImage = function getImage() { + if (this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the image information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setImage + * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.) + * @param {Object} param Additional information이미지 추가 정보 + * @param {String} [param.projectionType="equirectangular"] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setImage("/path/to/image/image.png", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP + * }); + */ + ; + + _proto.setImage = function setImage(image, param) { + if (param === void 0) { + param = {}; + } + + var cubemapConfig = _extends({ + order: "RLUDBF", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, param.cubemapConfig); + + var stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; + var isVideo = !!param.isVideo; + + if (this._image && this._isVideo !== isVideo) { + /* eslint-disable no-console */ + console.warn("Currently not supporting to change content type(Image <--> Video)"); + /* eslint-enable no-console */ + + return this; + } + + if (image) { + this._image = image; + this._isVideo = isVideo; + this._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + this._cubemapConfig = cubemapConfig; + this._stereoFormat = stereoFormat; + + this._deactivate(); + + this._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig); + } + + return this; + } + /** + * Set whether the renderer always updates the texture and renders. + * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다. + * + * @method eg.view360.PanoViewer#keepUpdate + * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다. + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + this._photoSphereRenderer.keepUpdate(doUpdate); + + return this; + } + /** + * Get projection type (equirectangular/cube) + * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다. + * + * @method eg.view360.PanoViewer#getProjectionType + * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE} + */ + ; + + _proto.getProjectionType = function getProjectionType() { + return this._projectionType; + } + /** + * Activate the device's motion sensor, and return the Promise whether the sensor is enabled + * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element. + * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다. + * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * @method eg.view360.PanoViewer#enableSensor + * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다. + */ + ; + + _proto.enableSensor = function enableSensor() { + return new _Promise$4(function (resolve, reject) { + if (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === "function") { + DeviceMotionEvent.requestPermission().then(function (permissionState) { + if (permissionState === "granted") { + resolve(); + } else { + reject(new Error("permission denied")); + } + })["catch"](function (e) { + // This can happen when this method wasn't triggered by user interaction + reject(e); + }); + } else { + resolve(); + } + }); + } + /** + * Disable the device's motion sensor. + * @ko 디바이스의 모션 센서를 비활성화합니다. + * @deprecated + * @method eg.view360.PanoViewer#disableSensor + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.disableSensor = function disableSensor() { + return this; + } + /** + * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred). + * This method must be used in the context of user interaction, like onclick callback on the button element. + * It can be rejected when an enabling device sensor fails or image/video is still loading("ready" event not triggered). + * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다) + * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우("ready"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다. + * @method eg.view360.PanoViewer#enterVR + * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error) + */ + ; + + _proto.enterVR = function enterVR() { + var _this2 = this; + + if (!this._isReady) { + return _Promise$4.reject(new Error("PanoViewer is not ready to show image.")); + } + + return new _Promise$4(function (resolve, reject) { + _this2.enableSensor().then(function () { + return _this2._photoSphereRenderer.enterVR(); + }).then(function (res) { + return resolve(res); + })["catch"](function (e) { + return reject(e); + }); + }); + } + /** + * Exit VR stereo rendering mode. + * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다. + * + * @method eg.view360.PanoViewer#exitVR + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.exitVR = function exitVR() { + this._photoSphereRenderer.exitVR(); + + return this; + } // TODO: Remove parameters as they're just using private values + ; + + _proto._initRenderer = function _initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) { + var _this3 = this; + + this._photoSphereRenderer = new PanoImageRenderer(this._image, this._width, this._height, this._isVideo, { + initialYaw: yaw, + initialPitch: pitch, + fieldOfView: fov, + imageType: projectionType, + cubemapConfig: cubemapConfig, + stereoFormat: this._stereoFormat + }); + + this._photoSphereRenderer.setYawPitchControl(this._yawPitchControl); + + this._bindRendererHandler(); + + this._photoSphereRenderer.bindTexture().then(function () { + return _this3._activate(); + })["catch"](function () { + _this3._triggerEvent(EVENTS$1.ERROR, { + type: ERROR_TYPE.FAIL_BIND_TEXTURE, + message: "failed to bind texture" + }); + }); + } + /** + * update values of YawPitchControl if needed. + * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image. + * + * This function should be called after isReady status is true. + */ + ; + + _proto._updateYawPitchIfNeeded = function _updateYawPitchIfNeeded() { + if (this._projectionType === PanoViewer.ProjectionType.PANORAMA) { + // update fov by aspect ratio + var image = this._photoSphereRenderer.getContent(); + + var imageAspectRatio = image.naturalWidth / image.naturalHeight; + var isCircular; + var yawSize; + var maxFov; // If height is larger than width, then we assume it's rotated by 90 degree. + + if (imageAspectRatio < 1) { + // So inverse the aspect ratio. + imageAspectRatio = 1 / imageAspectRatio; + } + + if (imageAspectRatio < 6) { + yawSize = util.toDegree(imageAspectRatio); + isCircular = false; // 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5 + + maxFov = util.toDegree(Math.atan(0.5)) * 2; + } else { + yawSize = 360; + isCircular = true; + maxFov = 360 / imageAspectRatio; // Make it 5 fixed as axes does. + } // console.log("_updateYawPitchIfNeeded", maxFov, "aspectRatio", image.naturalWidth, image.naturalHeight, "yawSize", yawSize); + + + var minFov = this._yawPitchControl.option("fovRange")[0]; // this option should be called after fov is set. + + + this._yawPitchControl.option({ + "fov": maxFov, + + /* parameter for internal validation for pitchrange */ + "yawRange": [-yawSize / 2, yawSize / 2], + isCircular: isCircular, + "pitchRange": [-maxFov / 2, maxFov / 2], + "fovRange": [minFov, maxFov] + }); + + this.lookAt({ + fov: maxFov + }); + } + }; + + _proto._bindRendererHandler = function _bindRendererHandler() { + var _this4 = this; + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, function (e) { + _this4.trigger(EVENTS$1.ERROR, e); + }); + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, function (e) { + _this4._deactivate(); + + _this4.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.RENDERING_CONTEXT_LOST, + message: "webgl rendering context lost" + }); + }); + }; + + _proto._initYawPitchControl = function _initYawPitchControl(yawPitchConfig) { + var _this5 = this; + + this._yawPitchControl = new YawPitchControl(yawPitchConfig); + + this._yawPitchControl.on(EVENTS$1.ANIMATION_END, function (e) { + _this5._triggerEvent(EVENTS$1.ANIMATION_END, e); + }); + + this._yawPitchControl.on("change", function (e) { + _this5._yaw = e.yaw; + _this5._pitch = e.pitch; + _this5._fov = e.fov; + _this5._quaternion = e.quaternion; + + _this5._triggerEvent(EVENTS$1.VIEW_CHANGE, e); + }); + }; + + _proto._triggerEvent = function _triggerEvent(name, param) { + var evt = param || {}; + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name eg.view360.PanoViewer#error + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.type Error type + * 10: INVALID_DEVICE: Unsupported device + * 11: NO_WEBGL: Webgl not support + * 12, FAIL_IMAGE_LOAD: Failed to load image + * 13: FAIL_BIND_TEXTURE: Failed to bind texture + * 14: INVALID_RESOURCE: Only one resource(image or video) should be specified + * 15: RENDERING_CONTEXT_LOST: WebGL context lost occurred + * 에러 종류 + * 10: INVALID_DEVICE: 미지원 기기 + * 11: NO_WEBGL: WEBGL 미지원 + * 12, FAIL_IMAGE_LOAD: 이미지 로드 실패 + * 13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패 + * 14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * 15: RENDERING_CONTEXT_LOST: WebGL context lost 발생 + * + * @param {String} param.message Error message 에러 메시지 + * @see {@link eg.view360.PanoViewer.ERROR_TYPE} + * @example + * + * viwer.on({ + * "error" : function(evt) { + * // evt.type === 13 + * // evt.message === "failed to bind texture" + * }); + * + * // constant can be used + * viwer.on({ + * eg.view360.PanoViewer.EVENTS.ERROR : function(evt) { + * // evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE + * // evt.message === "failed to bind texture" + * }); + */ + + /** + * Events that is fired when PanoViewer is ready to go. + * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트 + * @name eg.view360.PanoViewer#ready + * @event + * + * @example + * + * viwer.on({ + * "ready" : function(evt) { + * // PanoViewer is ready to show image and handle user interaction. + * }); + */ + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#viewChange + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.yaw yawyaw + * @param {Number} param.pitch pitch pitch + * @param {Number} param.fov Field of view (fov) 화각 + * @example + * + * viwer.on({ + * "viewChange" : function(evt) { + * //evt.yaw, evt.pitch, evt.fov is available. + * }); + */ + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#animationEnd + * @event + * @example + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // animation is ended. + * }); + */ + + return this.trigger(name, evt); + } + /** + * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}. + * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다. + * @method eg.view360.PanoViewer#setUseZoom + * @param {Boolean} useZoom + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseZoom = function setUseZoom(useZoom) { + typeof useZoom === "boolean" && this._yawPitchControl.option("useZoom", useZoom); + return this; + } + /** + * When true, enables the keyboard move key control: awsd, arrow keys + * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키) + * @method eg.view360.PanoViewer#setUseKeyboard + * @param {Boolean} useKeyboard + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseKeyboard = function setUseKeyboard(useKeyboard) { + this._yawPitchControl.option("useKeyboard", useKeyboard); + + return this; + } + /** + * Enables control through device motion. ("none", "yawPitch", "VR") + * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR") + * @method eg.view360.PanoViewer#setGyroMode + * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE} + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setGyroMode("yawPitch"); + * //equivalent + * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH); + */ + ; + + _proto.setGyroMode = function setGyroMode(gyroMode) { + this._yawPitchControl.option("gyroMode", gyroMode); + + return this; + } + /** + * Set the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 설정합니다. + * @method eg.view360.PanoViewer#setFovRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setFovRange([50, 90]); + */ + ; + + _proto.setFovRange = function setFovRange(range) { + this._yawPitchControl.option("fovRange", range); + + return this; + } + /** + * Getting the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 반환합니다. + * @method eg.view360.PanoViewer#getFovRange + * @return {Array} + * @example + * var range = panoViewer.getFovRange(); //[50, 90] + */ + ; + + _proto.getFovRange = function getFovRange() { + return this._yawPitchControl.option("fovRange"); + } + /** + * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size. + * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다. + * @method eg.view360.PanoViewer#updateViewportDimensions + * @param {Object} [size] + * @param {Number} [size.width=width of container] + * @param {Number} [size.height=height of container] + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.updateViewportDimensions = function updateViewportDimensions(size) { + if (size === void 0) { + size = { + width: undefined, + height: undefined + }; + } + + if (!this._isReady) { + return this; + } + + var containerSize; + + if (size.width === undefined || size.height === undefined) { + containerSize = window.getComputedStyle(this._container); + } + + var width = size.width || parseInt(containerSize.width, 10); + var height = size.height || parseInt(containerSize.height, 10); // Skip if viewport is not changed. + + if (width === this._width && height === this._height) { + return this; + } + + this._width = width; + this._height = height; + this._aspectRatio = width / height; + + this._photoSphereRenderer.updateViewportDimensions(width, height); + + this._yawPitchControl.option("aspectRatio", this._aspectRatio); + + this._yawPitchControl.updatePanScale({ + height: height + }); + + this.lookAt({}, 0); + return this; + } + /** + * Get the current field of view(FOV) + * @ko 현재 field of view(FOV) 값을 반환합니다. + * @method eg.view360.PanoViewer#getFov + * @return {Number} + */ + ; + + _proto.getFov = function getFov() { + return this._fov; + } + /** + * Get the horizontal field of view in degree + */ + ; + + _proto._getHFov = function _getHFov() { + return util.toDegree(2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.glMatrix.toRadian(this._fov) / 2))); + } + /** + * Get current yaw value + * @ko 현재 yaw 값을 반환합니다. + * @method eg.view360.PanoViewer#getYaw + * @return {Number} + */ + ; + + _proto.getYaw = function getYaw() { + return this._yaw; + } + /** + * Get current pitch value + * @ko 현재 pitch 값을 반환합니다. + * @method eg.view360.PanoViewer#getPitch + * @return {Number} + */ + ; + + _proto.getPitch = function getPitch() { + return this._pitch; + } + /** + * Get the range of controllable Yaw values + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#getYawRange + * @return {Array} + */ + ; + + _proto.getYawRange = function getYawRange() { + return this._yawPitchControl.option("yawRange"); + } + /** + * Get the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다. + * @method eg.view360.PanoViewer#getPitchRange + * @return {Array} + */ + ; + + _proto.getPitchRange = function getPitchRange() { + return this._yawPitchControl.option("pitchRange"); + } + /** + * Set the range of controllable yaw + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#setYawRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setYawRange([-90, 90]); + */ + ; + + _proto.setYawRange = function setYawRange(yawRange) { + this._yawPitchControl.option("yawRange", yawRange); + + return this; + } + /** + * Set the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 설정합니다. + * @method eg.view360.PanoViewer#setPitchRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setPitchRange([-40, 40]); + */ + ; + + _proto.setPitchRange = function setPitchRange(pitchRange) { + this._yawPitchControl.option("pitchRange", pitchRange); + + return this; + } + /** + * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed. + * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다. + * @method eg.view360.PanoViewer#setShowPolePoint + * @param {Boolean} showPolePoint + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setShowPolePoint = function setShowPolePoint(showPolePoint) { + this._yawPitchControl.option("showPolePoint", showPolePoint); + + return this; + } + /** + * Set a new view by setting camera configuration. Any parameters not specified remain the same. + * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다. + * @method eg.view360.PanoViewer#lookAt + * @param {Object} orientation + * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위) + * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위) + * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위) + * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초) + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * // Change the yaw angle (absolute angle) to 30 degrees for one second. + * panoViewer.lookAt({yaw: 30}, 1000); + */ + ; + + _proto.lookAt = function lookAt(orientation, duration) { + if (!this._isReady) { + return this; + } + + var yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw; + var pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch; + + var pitchRange = this._yawPitchControl.option("pitchRange"); + + var verticalAngleOfImage = pitchRange[1] - pitchRange[0]; + var fov = orientation.fov !== undefined ? orientation.fov : this._fov; + + if (verticalAngleOfImage < fov) { + fov = verticalAngleOfImage; + } + + this._yawPitchControl.lookAt({ + yaw: yaw, + pitch: pitch, + fov: fov + }, duration); + + if (duration === 0) { + this._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov); + } + + return this; + }; + + _proto._activate = function _activate() { + this._photoSphereRenderer.attachTo(this._container); + + this._yawPitchControl.enable(); + + this.updateViewportDimensions(); + this._isReady = true; // update yawPitchControl after isReady status is true. + + this._updateYawPitchIfNeeded(); + + this._triggerEvent(EVENTS$1.READY); + + this._photoSphereRenderer.startRender(); + } + /** + * Destroy webgl context and block user interaction and stop rendering + */ + ; + + _proto._deactivate = function _deactivate() { + if (this._isReady) { + this._photoSphereRenderer.stopRender(); + + this._yawPitchControl.disable(); + + this._isReady = false; + } + + if (this._photoSphereRenderer) { + this._photoSphereRenderer.destroy(); + + this._photoSphereRenderer = null; + } + }; + + PanoViewer._isValidTouchDirection = function _isValidTouchDirection(direction) { + return direction === PanoViewer.TOUCH_DIRECTION.NONE || direction === PanoViewer.TOUCH_DIRECTION.YAW || direction === PanoViewer.TOUCH_DIRECTION.PITCH || direction === PanoViewer.TOUCH_DIRECTION.ALL; + } + /** + * Set touch direction by which user can control. + * @ko 사용자가 조작가능한 터치 방향을 지정합니다. + * @method eg.view360.PanoViewer#setTouchDirection + * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @return {eg.view360.PanoViewer} PanoViewer instance + * @example + * + * panoViewer = new PanoViewer(el); + * // Limit the touch direction to the yaw direction only. + * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW); + */ + ; + + _proto.setTouchDirection = function setTouchDirection(direction) { + if (PanoViewer._isValidTouchDirection(direction)) { + this._yawPitchControl.option("touchDirection", direction); + } + + return this; + } + /** + * Returns touch direction by which user can control + * @ko 사용자가 조작가능한 터치 방향을 반환한다. + * @method eg.view360.PanoViewer#getTouchDirection + * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @example + * + * panoViewer = new PanoViewer(el); + * // Returns the current touch direction. + * var dir = panoViewer.getTouchDirection(); + */ + ; + + _proto.getTouchDirection = function getTouchDirection() { + return this._yawPitchControl.option("touchDirection"); + } + /** + * Destroy viewer. Remove all registered event listeners and remove viewer canvas. + * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다. + * @method eg.view360.PanoViewer#destroy + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.destroy = function destroy() { + this._deactivate(); + + if (this._yawPitchControl) { + this._yawPitchControl.destroy(); + + this._yawPitchControl = null; + } + + return this; + } + /** + * Check whether the current environment can execute PanoViewer + * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다. + * @function isSupported + * @memberof eg.view360.PanoViewer + * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부 + * @static + */ + ; + + PanoViewer.isSupported = function isSupported() { + return WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL(); + } + /** + * Check whether the current environment supports the WebGL + * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다. + * @function isWebGLAvailable + * @memberof eg.view360.PanoViewer + * @return {Boolean} WebGL support WebGL 지원여부 + * @static + */ + ; + + PanoViewer.isWebGLAvailable = function isWebGLAvailable() { + return WebGLUtils.isWebGLAvailable(); + } + /** + * Check whether the current environment supports the gyro sensor. + * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다. + * @function isGyroSensorAvailable + * @memberof eg.view360.PanoViewer + * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수 + * @static + */ + ; + + PanoViewer.isGyroSensorAvailable = function isGyroSensorAvailable(callback) { + if (!DeviceMotionEvent) { + callback && callback(false); + return; + } + + var onDeviceMotionChange; + + function checkGyro() { + return new _Promise$4(function (res, rej) { + onDeviceMotionChange = function onDeviceMotionChange(deviceMotion) { + var isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null); + res(isGyroSensorAvailable); + }; + + window.addEventListener("devicemotion", onDeviceMotionChange); + }); + } + + function timeout() { + return new _Promise$4(function (res, rej) { + setTimeout(function () { + return res(false); + }, 1000); + }); + } + + _Promise$4.race([checkGyro(), timeout()]).then(function (isGyroSensorAvailable) { + window.removeEventListener("devicemotion", onDeviceMotionChange); + callback && callback(isGyroSensorAvailable); + + PanoViewer.isGyroSensorAvailable = function (fb) { + fb && fb(isGyroSensorAvailable); + return isGyroSensorAvailable; + }; + }); + }; + + return PanoViewer; + }(Component); + + PanoViewer.VERSION = VERSION; + PanoViewer.ERROR_TYPE = ERROR_TYPE; + PanoViewer.EVENTS = EVENTS$1; + PanoViewer.PROJECTION_TYPE = PROJECTION_TYPE; + PanoViewer.GYRO_MODE = GYRO_MODE; + PanoViewer.ProjectionType = PROJECTION_TYPE; + PanoViewer.STEREO_FORMAT = STEREO_FORMAT; + PanoViewer.TOUCH_DIRECTION = { + /** + * Constant value for none direction. + * @ko none 방향에 대한 상수 값. + * @name NONE + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 1 + */ + NONE: YawPitchControl.TOUCH_DIRECTION_NONE, + + /** + * Constant value for horizontal(yaw) direction. + * @ko horizontal(yaw) 방향에 대한 상수 값. + * @name YAW + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 6 + */ + YAW: YawPitchControl.TOUCH_DIRECTION_YAW, + + /** + * Constant value for vertical direction. + * @ko vertical(pitch) 방향에 대한 상수 값. + * @name PITCH + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 24 + */ + PITCH: YawPitchControl.TOUCH_DIRECTION_PITCH, + + /** + * Constant value for all direction. + * @ko all 방향에 대한 상수 값. + * @name ALL + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 30 + */ + ALL: YawPitchControl.TOUCH_DIRECTION_ALL + }; + return PanoViewer; + }(); + + exports.PanoViewer = PanoViewer; + exports.VERSION = VERSION; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=view360.panoviewer.js.map diff --git a/dist/PanoViewer/view360.panoviewer.js.map b/dist/PanoViewer/view360.panoviewer.js.map new file mode 100644 index 000000000..1b33c6b30 --- /dev/null +++ b/dist/PanoViewer/view360.panoviewer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.panoviewer.js","sources":["../../node_modules/es6-promise/dist/es6-promise.js","../../src/utils/browser.js","../../src/utils/browserFeature.js","../../src/utils/math-util.js","../../src/YawPitchControl/utils.js","../../node_modules/webvr-polyfill/src/math-util.js","../../node_modules/webvr-polyfill/src/util.js","../../node_modules/webvr-polyfill/src/sensor-fusion/pose-predictor.js","../../src/YawPitchControl/consts.js","../../src/YawPitchControl/input/DeviceMotion.js","../../node_modules/webvr-polyfill/src/sensor-fusion/sensor-sample.js","../../node_modules/webvr-polyfill/src/sensor-fusion/complementary-filter.js","../../src/YawPitchControl/input/ComplementaryFilter.js","../../src/YawPitchControl/input/FusionPoseSensor.js","../../src/YawPitchControl/input/TiltMotionInput.js","../../src/YawPitchControl/ScreenRotationAngle.js","../../src/YawPitchControl/input/RotationPanInput.js","../../src/YawPitchControl/DeviceQuaternion.js","../../src/version.js","../../src/YawPitchControl/YawPitchControl.js","../../src/PanoImageRenderer/ImageLoader.js","../../src/PanoImageRenderer/VideoLoader.js","../../src/PanoImageRenderer/WebGLUtils.js","../../src/PanoImageRenderer/renderer/Renderer.js","../../src/PanoImageRenderer/renderer/CubeRenderer.js","../../src/PanoImageRenderer/renderer/CubeStripRenderer.js","../../src/PanoViewer/consts.js","../../src/PanoImageRenderer/renderer/SphereRenderer.js","../../src/PanoImageRenderer/renderer/CylinderRenderer.js","../../src/PanoImageRenderer/vr/VRManager.js","../../src/PanoImageRenderer/vr/XRManager.js","../../src/PanoImageRenderer/WebGLAnimator.js","../../src/PanoImageRenderer/PanoImageRenderer.js","../../src/PanoViewer/PanoViewer.js"],"sourcesContent":["/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.ES6Promise = factory());\n}(this, (function () { 'use strict';\n\nfunction objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n}\n\nfunction isFunction(x) {\n return typeof x === 'function';\n}\n\n\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve$1(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n try {\n then$$1.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then$$1) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then$$1, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$1) {\n if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$1 === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$1)) {\n handleForeignThenable(promise, maybeThenable, then$$1);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then$$1 = void 0;\n try {\n then$$1 = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then$$1);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n}\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve$$1 = c.resolve;\n\n\n if (resolve$$1 === resolve$1) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise$1) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$1) {\n return resolve$$1(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$1(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject$1(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n//# sourceMappingURL=es6-promise.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","/**\n * Original Code\n * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js\n * Math Util\n * modified by egjs\n */\n/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.2\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n// Some minimal math functionality borrowed from gl-Matrix and stripped down\n// for the purposes of this library.\n\nimport {vec2, vec3, quat} from \"gl-matrix\";\n\nfunction quatToVec3(quaternion) {\n\tconst baseV = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(baseV, baseV, quaternion);\n\treturn baseV;\n}\n\nfunction toDegree(a){\n\treturn a * 180 / Math.PI;\n}\n\nconst util = {};\n\nutil.isPowerOfTwo = function(n) {\n\treturn n && (n & (n - 1)) === 0;\n};\n\nutil.extractPitchFromQuat = function(quaternion) {\n\tconst baseV = quatToVec3(quaternion);\n\n\treturn -1 * Math.atan2(\n\t\tbaseV[1],\n\t\tMath.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2)));\n};\n\nutil.hypot = Math.hypot || function(x, y) {\n\treturn Math.sqrt(x * x + y * y);\n};\n\n// implement reference\n// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식\n// calculating angle between two vectors : http://darkpgmr.tistory.com/121\nconst ROTATE_CONSTANT = {\n\tPITCH_DELTA: 1,\n\tYAW_DELTA_BY_ROLL: 2,\n\tYAW_DELTA_BY_YAW: 3,\n};\n\nROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [0, 0, 1],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [1, 0, 0],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = {\n\ttargetAxis: [1, 0, 0],\n\tmeshPoint: [0, 0, 1],\n};\n\nfunction getRotationDelta(prevQ, curQ, rotateKind) {\n\tconst targetAxis = vec3.fromValues(\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[0],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[1],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[2]\n\t);\n\tconst meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint;\n\n\tconst prevQuaternion = quat.clone(prevQ);\n\tconst curQuaternion = quat.clone(curQ);\n\n\tquat.normalize(prevQuaternion, prevQuaternion);\n\tquat.normalize(curQuaternion, curQuaternion);\n\n\tlet prevPoint = vec3.fromValues(0, 0, 1);\n\tlet curPoint = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\tvec3.transformQuat(targetAxis, targetAxis, curQuaternion);\n\n\tconst rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint));\n\tconst rotateDirection = rotateDistance > 0 ? 1 : -1;\n\n\t// when counter clock wise, use vec3.fromValues(0,1,0)\n\t// when clock wise, use vec3.fromValues(0,-1,0)\n\t// const meshPoint1 = vec3.fromValues(0, 0, 0);\n\tconst meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\n\tlet meshPoint3;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tmeshPoint3 = vec3.fromValues(0, rotateDirection, 0);\n\t} else {\n\t\tmeshPoint3 = vec3.fromValues(rotateDirection, 0, 0);\n\t}\n\n\tvec3.transformQuat(meshPoint2, meshPoint2, curQuaternion);\n\tvec3.transformQuat(meshPoint3, meshPoint3, curQuaternion);\n\n\tconst vecU = meshPoint2;\n\tconst vecV = meshPoint3;\n\tconst vecN = vec3.create();\n\n\tvec3.cross(vecN, vecU, vecV);\n\tvec3.normalize(vecN, vecN);\n\n\tconst coefficientA = vecN[0];\n\tconst coefficientB = vecN[1];\n\tconst coefficientC = vecN[2];\n//\tconst coefficientD = -1 * vec3.dot(vecN, meshPoint1);\n\n\t// a point on the plane\n\tcurPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\n\t// a point should project on the plane\n\tprevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\n\t// distance between prevPoint and the plane\n\tlet distance = Math.abs(\n\t\tprevPoint[0] * coefficientA +\n\t\tprevPoint[1] * coefficientB +\n\t\tprevPoint[2] * coefficientC\n\t);\n\n\tconst projectedPrevPoint = vec3.create();\n\n\tvec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance));\n\n\tlet trigonometricRatio =\n\t\t(projectedPrevPoint[0] * curPoint[0] +\n\t\tprojectedPrevPoint[1] * curPoint[1] +\n\t\tprojectedPrevPoint[2] * curPoint[2]) /\n\t\t(vec3.length(projectedPrevPoint) * vec3.length(curPoint));\n\n\t// defensive block\n\ttrigonometricRatio > 1 && (trigonometricRatio = 1);\n\n\tconst theta = Math.acos(trigonometricRatio);\n\n\tconst crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint);\n\n\tdistance =\n\t\tcoefficientA * crossVec[0] +\n\t\tcoefficientB * crossVec[1] +\n\t\tcoefficientC * crossVec[2];\n\n\tlet thetaDirection;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tthetaDirection = distance > 0 ? 1 : -1;\n\t} else {\n\t\tthetaDirection = distance < 0 ? 1 : -1;\n\t}\n\n\tconst deltaRadian = theta * thetaDirection * rotateDirection;\n\n\treturn toDegree(deltaRadian);\n}\n\nfunction angleBetweenVec2(v1, v2) {\n\tconst det = v1[0] * v2[1] - v2[0] * v1[1];\n\tconst theta = -Math.atan2(det, vec2.dot(v1, v2));\n\treturn theta;\n}\n\nutil.yawOffsetBetween = function(viewDir, targetDir) {\n\tconst viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]);\n\tconst targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]);\n\n\tvec2.normalize(viewDirXZ, viewDirXZ);\n\tvec2.normalize(targetDirXZ, targetDirXZ);\n\n\tconst theta = -angleBetweenVec2(viewDirXZ, targetDirXZ);\n\n\treturn theta;\n}\n\nutil.toDegree = toDegree;\nutil.getRotationDelta = getRotationDelta;\nutil.angleBetweenVec2 = angleBetweenVec2;\n\nexport {\n\tutil,\n\tROTATE_CONSTANT,\n};\n","import {\n\tutil as mathUtil,\n\tROTATE_CONSTANT,\n} from \"../utils/math-util\";\n\nexport function toAxis(source, offset) {\n\treturn offset.reduce((acc, v, i) => {\n\t\tif (source[i]) {\n\t\t\tacc[source[i]] = v;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(mathUtil.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nexport function getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n","/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar MathUtil = window.MathUtil || {};\n\nMathUtil.degToRad = Math.PI / 180;\nMathUtil.radToDeg = 180 / Math.PI;\n\n// Some minimal math functionality borrowed from THREE.Math and stripped down\n// for the purposes of this library.\n\n\nMathUtil.Vector2 = function ( x, y ) {\n this.x = x || 0;\n this.y = y || 0;\n};\n\nMathUtil.Vector2.prototype = {\n constructor: MathUtil.Vector2,\n\n set: function ( x, y ) {\n this.x = x;\n this.y = y;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n\n return this;\n },\n\n subVectors: function ( a, b ) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n\n return this;\n },\n};\n\nMathUtil.Vector3 = function ( x, y, z ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n};\n\nMathUtil.Vector3.prototype = {\n constructor: MathUtil.Vector3,\n\n set: function ( x, y, z ) {\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n\n return this;\n },\n\n length: function () {\n return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n },\n\n normalize: function () {\n var scalar = this.length();\n\n if ( scalar !== 0 ) {\n var invScalar = 1 / scalar;\n\n this.multiplyScalar(invScalar);\n } else {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return this;\n },\n\n multiplyScalar: function ( scalar ) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n },\n\n applyQuaternion: function ( q ) {\n var x = this.x;\n var y = this.y;\n var z = this.z;\n\n var qx = q.x;\n var qy = q.y;\n var qz = q.z;\n var qw = q.w;\n\n // calculate quat * vector\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = - qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n return this;\n },\n\n dot: function ( v ) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n },\n\n crossVectors: function ( a, b ) {\n var ax = a.x, ay = a.y, az = a.z;\n var bx = b.x, by = b.y, bz = b.z;\n\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n\n return this;\n },\n};\n\nMathUtil.Quaternion = function ( x, y, z, w ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = ( w !== undefined ) ? w : 1;\n};\n\nMathUtil.Quaternion.prototype = {\n constructor: MathUtil.Quaternion,\n\n set: function ( x, y, z, w ) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n\n return this;\n },\n\n copy: function ( quaternion ) {\n this.x = quaternion.x;\n this.y = quaternion.y;\n this.z = quaternion.z;\n this.w = quaternion.w;\n\n return this;\n },\n\n setFromEulerXYZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n\n return this;\n },\n\n setFromEulerYXZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n\n return this;\n },\n\n setFromAxisAngle: function ( axis, angle ) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n\n var halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n this.x = axis.x * s;\n this.y = axis.y * s;\n this.z = axis.z * s;\n this.w = Math.cos( halfAngle );\n\n return this;\n },\n\n multiply: function ( q ) {\n return this.multiplyQuaternions( this, q );\n },\n\n multiplyQuaternions: function ( a, b ) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;\n var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;\n\n this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n return this;\n },\n\n inverse: function () {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n\n this.normalize();\n\n return this;\n },\n\n normalize: function () {\n var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n if ( l === 0 ) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 1;\n } else {\n l = 1 / l;\n\n this.x = this.x * l;\n this.y = this.y * l;\n this.z = this.z * l;\n this.w = this.w * l;\n }\n\n return this;\n },\n\n slerp: function ( qb, t ) {\n if ( t === 0 ) return this;\n if ( t === 1 ) return this.copy( qb );\n\n var x = this.x, y = this.y, z = this.z, w = this.w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z;\n\n if ( cosHalfTheta < 0 ) {\n this.w = - qb.w;\n this.x = - qb.x;\n this.y = - qb.y;\n this.z = - qb.z;\n\n cosHalfTheta = - cosHalfTheta;\n } else {\n this.copy( qb );\n }\n\n if ( cosHalfTheta >= 1.0 ) {\n this.w = w;\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n var halfTheta = Math.acos( cosHalfTheta );\n var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\n\n if ( Math.abs( sinHalfTheta ) < 0.001 ) {\n this.w = 0.5 * ( w + this.w );\n this.x = 0.5 * ( x + this.x );\n this.y = 0.5 * ( y + this.y );\n this.z = 0.5 * ( z + this.z );\n\n return this;\n }\n\n var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n this.w = ( w * ratioA + this.w * ratioB );\n this.x = ( x * ratioA + this.x * ratioB );\n this.y = ( y * ratioA + this.y * ratioB );\n this.z = ( z * ratioA + this.z * ratioB );\n\n return this;\n },\n\n setFromUnitVectors: function () {\n // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\n // assumes direction vectors vFrom and vTo are normalized\n\n var v1, r;\n var EPS = 0.000001;\n\n return function ( vFrom, vTo ) {\n if ( v1 === undefined ) v1 = new MathUtil.Vector3();\n\n r = vFrom.dot( vTo ) + 1;\n\n if ( r < EPS ) {\n r = 0;\n\n if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n v1.set( - vFrom.y, vFrom.x, 0 );\n } else {\n v1.set( 0, - vFrom.z, vFrom.y );\n }\n } else {\n v1.crossVectors( vFrom, vTo );\n }\n\n this.x = v1.x;\n this.y = v1.y;\n this.z = v1.z;\n this.w = r;\n\n this.normalize();\n\n return this;\n }\n }(),\n};\n\nmodule.exports = MathUtil;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Util = window.Util || {};\n\nUtil.MIN_TIMESTEP = 0.001;\nUtil.MAX_TIMESTEP = 1;\n\nUtil.base64 = function(mimeType, base64) {\n return 'data:' + mimeType + ';base64,' + base64;\n};\n\nUtil.clamp = function(value, min, max) {\n return Math.min(Math.max(min, value), max);\n};\n\nUtil.lerp = function(a, b, t) {\n return a + ((b - a) * t);\n};\n\n/**\n * Light polyfill for `Promise.race`. Returns\n * a promise that resolves when the first promise\n * provided resolves.\n *\n * @param {Array} promises\n */\nUtil.race = function(promises) {\n if (Promise.race) {\n return Promise.race(promises);\n }\n\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < promises.length; i++) {\n promises[i].then(resolve, reject);\n }\n });\n};\n\nUtil.isIOS = (function() {\n var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);\n return function() {\n return isIOS;\n };\n})();\n\nUtil.isWebViewAndroid = (function() {\n var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1 &&\n navigator.userAgent.indexOf('Chrome') !== -1;\n return function() {\n return isWebViewAndroid;\n };\n})();\n\nUtil.isSafari = (function() {\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n return function() {\n return isSafari;\n };\n})();\n\nUtil.isFirefoxAndroid = (function() {\n var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1;\n return function() {\n return isFirefoxAndroid;\n };\n})();\n\nUtil.isR7 = (function() {\n var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1;\n return function() {\n return isR7;\n };\n})();\n\nUtil.isLandscapeMode = function() {\n var rtn = (window.orientation == 90 || window.orientation == -90);\n return Util.isR7() ? !rtn : rtn;\n};\n\n// Helper method to validate the time steps of sensor timestamps.\nUtil.isTimestampDeltaValid = function(timestampDeltaS) {\n if (isNaN(timestampDeltaS)) {\n return false;\n }\n if (timestampDeltaS <= Util.MIN_TIMESTEP) {\n return false;\n }\n if (timestampDeltaS > Util.MAX_TIMESTEP) {\n return false;\n }\n return true;\n};\n\nUtil.getScreenWidth = function() {\n return Math.max(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.getScreenHeight = function() {\n return Math.min(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.requestFullscreen = function(element) {\n if (Util.isWebViewAndroid()) {\n return false;\n }\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.exitFullscreen = function() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.getFullscreenElement = function() {\n return document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullScreenElement ||\n document.msFullscreenElement;\n};\n\nUtil.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) {\n // No error checking for brevity.\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n for (var attribName in attribLocationMap)\n gl.bindAttribLocation(program, attribLocationMap[attribName], attribName);\n\n gl.linkProgram(program);\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n};\n\nUtil.getProgramUniforms = function(gl, program) {\n var uniforms = {};\n var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n var uniformName = '';\n for (var i = 0; i < uniformCount; i++) {\n var uniformInfo = gl.getActiveUniform(program, i);\n uniformName = uniformInfo.name.replace('[0]', '');\n uniforms[uniformName] = gl.getUniformLocation(program, uniformName);\n }\n return uniforms;\n};\n\nUtil.orthoMatrix = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\nUtil.copyArray = function (source, dest) {\n for (var i = 0, n = source.length; i < n; i++) {\n dest[i] = source[i];\n }\n};\n\nUtil.isMobile = function() {\n var check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);\n return check;\n};\n\nUtil.extend = function(dest, src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n\n return dest;\n}\n\nUtil.safariCssSizeWorkaround = function(canvas) {\n // TODO(smus): Remove this workaround when Safari for iOS is fixed.\n // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556).\n //\n // \"To the last I grapple with thee;\n // from hell's heart I stab at thee;\n // for hate's sake I spit my last breath at thee.\"\n // -- Moby Dick, by Herman Melville\n if (Util.isIOS()) {\n var width = canvas.style.width;\n var height = canvas.style.height;\n canvas.style.width = (parseInt(width) + 1) + 'px';\n canvas.style.height = (parseInt(height)) + 'px';\n setTimeout(function() {\n canvas.style.width = width;\n canvas.style.height = height;\n }, 100);\n }\n\n // Debug only.\n window.Util = Util;\n window.canvas = canvas;\n};\n\nUtil.isDebug = function() {\n return Util.getQueryParameter('debug');\n};\n\nUtil.getQueryParameter = function(name) {\n var name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n results = regex.exec(location.search);\n return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n};\n\nUtil.frameDataFromPose = (function() {\n var piOver180 = Math.PI / 180.0;\n var rad45 = Math.PI * 0.25;\n\n // Borrowed from glMatrix.\n function mat4_perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45),\n downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45),\n leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45),\n rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n\n function mat4_fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n };\n\n function mat4_translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n };\n\n function mat4_invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n };\n\n var defaultOrientation = new Float32Array([0, 0, 0, 1]);\n var defaultPosition = new Float32Array([0, 0, 0]);\n\n function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) {\n mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar);\n\n var orientation = pose.orientation || defaultOrientation;\n var position = pose.position || defaultPosition;\n\n mat4_fromRotationTranslation(view, orientation, position);\n if (parameters)\n mat4_translate(view, view, parameters.offset);\n mat4_invert(view, view);\n }\n\n return function(frameData, pose, vrDisplay) {\n if (!frameData || !pose)\n return false;\n\n frameData.pose = pose;\n frameData.timestamp = pose.timestamp;\n\n updateEyeMatrices(\n frameData.leftProjectionMatrix, frameData.leftViewMatrix,\n pose, vrDisplay.getEyeParameters(\"left\"), vrDisplay);\n updateEyeMatrices(\n frameData.rightProjectionMatrix, frameData.rightViewMatrix,\n pose, vrDisplay.getEyeParameters(\"right\"), vrDisplay);\n\n return true;\n };\n})();\n\nUtil.isInsideCrossDomainIFrame = function() {\n var isFramed = (window.self !== window.top);\n var refDomain = Util.getDomainFromUrl(document.referrer);\n var thisDomain = Util.getDomainFromUrl(window.location.href);\n\n return isFramed && (refDomain !== thisDomain);\n};\n\n// From http://stackoverflow.com/a/23945027.\nUtil.getDomainFromUrl = function(url) {\n var domain;\n // Find & remove protocol (http, ftp, etc.) and get domain.\n if (url.indexOf(\"://\") > -1) {\n domain = url.split('/')[2];\n }\n else {\n domain = url.split('/')[0];\n }\n\n //find & remove port number\n domain = domain.split(':')[0];\n\n return domain;\n}\n\nmodule.exports = Util;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar MathUtil = require('../math-util');\nvar Util = require('../util');\n\n/**\n * Given an orientation and the gyroscope data, predicts the future orientation\n * of the head. This makes rendering appear faster.\n *\n * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf\n *\n * @param {Number} predictionTimeS time from head movement to the appearance of\n * the corresponding image.\n */\nfunction PosePredictor(predictionTimeS) {\n this.predictionTimeS = predictionTimeS;\n\n // The quaternion corresponding to the previous state.\n this.previousQ = new MathUtil.Quaternion();\n // Previous time a prediction occurred.\n this.previousTimestampS = null;\n\n // The delta quaternion that adjusts the current pose.\n this.deltaQ = new MathUtil.Quaternion();\n // The output quaternion.\n this.outQ = new MathUtil.Quaternion();\n}\n\nPosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) {\n if (!this.previousTimestampS) {\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n return currentQ;\n }\n\n // Calculate axis and angle based on gyroscope rotation rate data.\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n\n var angularSpeed = gyro.length();\n\n // If we're rotating slowly, don't do prediction.\n if (angularSpeed < MathUtil.degToRad * 20) {\n if (Util.isDebug()) {\n console.log('Moving slowly, at %s deg/s: no prediction',\n (MathUtil.radToDeg * angularSpeed).toFixed(1));\n }\n this.outQ.copy(currentQ);\n this.previousQ.copy(currentQ);\n return this.outQ;\n }\n\n // Get the predicted angle based on the time delta and latency.\n var deltaT = timestampS - this.previousTimestampS;\n var predictAngle = angularSpeed * this.predictionTimeS;\n\n this.deltaQ.setFromAxisAngle(axis, predictAngle);\n this.outQ.copy(this.previousQ);\n this.outQ.multiply(this.deltaQ);\n\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n\n return this.outQ;\n};\n\n\nmodule.exports = PosePredictor;\n","import {userAgent} from \"../utils/browserFeature\";\n/**\n * Returns a number value indiciating the version of Chrome being used,\n * or otherwise `null` if not on Chrome.\n *\n * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19\n */\n/**\n * In Chrome m65, `devicemotion` events are broken but subsequently fixed\n * in 65.0.3325.148. Since many browsers use Chromium, ensure that\n * we scope this detection by branch and build numbers to provide\n * a proper fallback.\n * https://github.com/immersive-web/webvr-polyfill/issues/307\n */\nlet version = -1; // It should not be null because it will be compared with number\nlet branch = null;\nlet build = null;\n\nconst match = /Chrome\\/([0-9]+)\\.(?:[0-9]*)\\.([0-9]*)\\.([0-9]*)/i.exec(userAgent);\n\nif (match) {\n\tversion = parseInt(match[1], 10);\n\tbranch = match[2];\n\tbuild = match[3];\n}\n\nconst CHROME_VERSION = version;\nconst IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === \"3325\" && parseInt(build, 10) < 148;\nconst IS_ANDROID = /Android/i.test(userAgent);\n\nconst CONTROL_MODE_VR = 1;\nconst CONTROL_MODE_YAWPITCH = 2;\n\nconst TOUCH_DIRECTION_NONE = 1;\nconst TOUCH_DIRECTION_YAW = 2;\nconst TOUCH_DIRECTION_PITCH = 4;\nconst TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH;\n\n/* Const for MovableCoord */\nconst MC_DECELERATION = 0.0014;\nconst MC_MAXIMUM_DURATION = 1000;\nconst MC_BIND_SCALE = [0.20, 0.20];\n\nconst MIN_FIELD_OF_VIEW = 20;\nconst MAX_FIELD_OF_VIEW = 110;\nconst PAN_SCALE = 320;\n\n// const DELTA_THRESHOLD = 0.015;\n// const DELTA_THRESHOLD = 0.09; // Note4\n// const DELTA_THRESHOLD = 0.0825;\n// const DELTA_THRESHOLD = 0.075;\n// const DELTA_THRESHOLD = 0.06;\n// const DELTA_THRESHOLD = 0.045;\nconst DELTA_THRESHOLD = 0.0375; // Note2\n\nconst YAW_RANGE_HALF = 180;\nconst PITCH_RANGE_HALF = 90;\nconst CIRCULAR_PITCH_RANGE_HALF = 180;\nconst PINCH_EVENTS = \"pinchstart pinchmove pinchend\";\n\nconst KEYMAP = {\n\tLEFT_ARROW: 37,\n\tA: 65,\n\tUP_ARROW: 38,\n\tW: 87,\n\tRIGHT_ARROW: 39,\n\tD: 68,\n\tDOWN_ARROW: 40,\n\tS: 83,\n};\n\nconst GYRO_MODE = {\n\tNONE: \"none\",\n\tYAWPITCH: \"yawPitch\",\n\tVR: \"VR\"\n};\n\nexport {\n\tGYRO_MODE,\n\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\n\tTOUCH_DIRECTION_NONE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMIN_FIELD_OF_VIEW,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tDELTA_THRESHOLD,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tPINCH_EVENTS,\n\tKEYMAP,\n\n\tCHROME_VERSION,\n\tIS_CHROME_WITHOUT_DEVICE_MOTION,\n\tIS_ANDROID\n};\n","import Component from \"@egjs/component\";\nimport {vec3} from \"gl-matrix\";\nimport {window} from \"../../utils/browser\";\nimport {IS_CHROME_WITHOUT_DEVICE_MOTION, IS_ANDROID} from \"../consts\";\n\nconst STILLNESS_THRESHOLD = 200; // millisecond\n\nexport default class DeviceMotion extends Component {\n\tconstructor() {\n\t\tsuper();\n\t\tthis._onDeviceMotion = this._onDeviceMotion.bind(this);\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onChromeWithoutDeviceMotion = this._onChromeWithoutDeviceMotion.bind(this);\n\n\t\tthis.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION;\n\t\tthis.isAndroid = IS_ANDROID;\n\n\t\tthis.stillGyroVec = vec3.create();\n\t\tthis.rawGyroVec = vec3.create();\n\t\tthis.adjustedGyroVec = vec3.create();\n\n\t\tthis._timer = null;\n\n\t\tthis.lastDevicemotionTimestamp = 0;\n\t\tthis._isEnabled = false;\n\t\tthis.enable();\n\t}\n\t_onChromeWithoutDeviceMotion(e) {\n\t\tlet {alpha, beta, gamma} = e;\n\n\t\t// There is deviceorientation event trigged with empty values\n\t\t// on Headless Chrome.\n\t\tif (alpha === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// convert to radian\n\t\talpha = (alpha || 0) * Math.PI / 180;\n\t\tbeta = (beta || 0) * Math.PI / 180;\n\t\tgamma = (gamma || 0) * Math.PI / 180;\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: {\n\t\t\t\tdeviceorientation: {\n\t\t\t\t\talpha,\n\t\t\t\t\tbeta,\n\t\t\t\t\tgamma: -gamma\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t_onDeviceOrientation() {\n\t\tthis._timer && clearTimeout(this._timer);\n\t\tthis._timer = setTimeout(() => {\n\t\t\tif ((new Date().getTime() - this.lastDevicemotionTimestamp) < STILLNESS_THRESHOLD) {\n\t\t\t\tvec3.copy(this.stillGyroVec, this.rawGyroVec);\n\t\t\t}\n\t\t}, STILLNESS_THRESHOLD);\n\t}\n\t_onDeviceMotion(e) {\n\t\t// desktop chrome triggers devicemotion event with empthy sensor values.\n\t\t// Those events should ignored.\n\t\tconst isGyroSensorAvailable = !(e.rotationRate.alpha == null);\n\t\tconst isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null);\n\n\t\tif (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst devicemotionEvent = Object.assign({}, e);\n\n\t\tdevicemotionEvent.interval = e.interval;\n\t\tdevicemotionEvent.timeStamp = e.timeStamp;\n\t\tdevicemotionEvent.type = e.type;\n\t\tdevicemotionEvent.rotationRate = {\n\t\t\talpha: e.rotationRate.alpha,\n\t\t\tbeta: e.rotationRate.beta,\n\t\t\tgamma: e.rotationRate.gamma,\n\t\t};\n\t\tdevicemotionEvent.accelerationIncludingGravity = {\n\t\t\tx: e.accelerationIncludingGravity.x,\n\t\t\ty: e.accelerationIncludingGravity.y,\n\t\t\tz: e.accelerationIncludingGravity.z,\n\t\t};\n\t\tdevicemotionEvent.acceleration = {\n\t\t\tx: e.acceleration.x,\n\t\t\ty: e.acceleration.y,\n\t\t\tz: e.acceleration.z,\n\t\t};\n\n\t\tif (this.isAndroid) {\n\t\t\tvec3.set(\n\t\t\t\tthis.rawGyroVec,\n\t\t\t\te.rotationRate.alpha || 0,\n\t\t\t\te.rotationRate.beta || 0,\n\t\t\t\te.rotationRate.gamma || 0);\n\t\t\tvec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec);\n\t\t\tthis.lastDevicemotionTimestamp = new Date().getTime();\n\n\t\t\tdevicemotionEvent.adjustedRotationRate = {\n\t\t\t\talpha: this.adjustedGyroVec[0],\n\t\t\t\tbeta: this.adjustedGyroVec[1],\n\t\t\t\tgamma: this.adjustedGyroVec[2]};\n\t\t}\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: devicemotionEvent\n\t\t});\n\t}\n\tenable() {\n\t\tif (this.isAndroid) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\t}\n\t\tif (this.isWithoutDeviceMotion) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\t} else {\n\t\t\twindow.addEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\t}\n\t\tthis._isEnabled = true;\n\t}\n\tdisable() {\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\twindow.removeEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\tthis._isEnabled = false;\n\t}\n}\n","function SensorSample(sample, timestampS) {\n this.set(sample, timestampS);\n};\n\nSensorSample.prototype.set = function(sample, timestampS) {\n this.sample = sample;\n this.timestampS = timestampS;\n};\n\nSensorSample.prototype.copy = function(sensorSample) {\n this.set(sensorSample.sample, sensorSample.timestampS);\n};\n\nmodule.exports = SensorSample;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar SensorSample = require('./sensor-sample.js');\nvar MathUtil = require('../math-util.js');\nvar Util = require('../util.js');\n\n/**\n * An implementation of a simple complementary filter, which fuses gyroscope and\n * accelerometer data from the 'devicemotion' event.\n *\n * Accelerometer data is very noisy, but stable over the long term.\n * Gyroscope data is smooth, but tends to drift over the long term.\n *\n * This fusion is relatively simple:\n * 1. Get orientation estimates from accelerometer by applying a low-pass filter\n * on that data.\n * 2. Get orientation estimates from gyroscope by integrating over time.\n * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the\n * short term.\n */\nfunction ComplementaryFilter(kFilter) {\n this.kFilter = kFilter;\n\n // Raw sensor measurements.\n this.currentAccelMeasurement = new SensorSample();\n this.currentGyroMeasurement = new SensorSample();\n this.previousGyroMeasurement = new SensorSample();\n\n // Set default look direction to be in the correct direction.\n if (Util.isIOS()) {\n this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1);\n } else {\n this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1);\n }\n this.previousFilterQ = new MathUtil.Quaternion();\n this.previousFilterQ.copy(this.filterQ);\n\n // Orientation based on the accelerometer.\n this.accelQ = new MathUtil.Quaternion();\n // Whether or not the orientation has been initialized.\n this.isOrientationInitialized = false;\n // Running estimate of gravity based on the current orientation.\n this.estimatedGravity = new MathUtil.Vector3();\n // Measured gravity based on accelerometer.\n this.measuredGravity = new MathUtil.Vector3();\n\n // Debug only quaternion of gyro-based orientation.\n this.gyroIntegralQ = new MathUtil.Quaternion();\n}\n\nComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) {\n this.currentAccelMeasurement.set(vector, timestampS);\n};\n\nComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {\n this.currentGyroMeasurement.set(vector, timestampS);\n\n var deltaT = timestampS - this.previousGyroMeasurement.timestampS;\n if (Util.isTimestampDeltaValid(deltaT)) {\n this.run_();\n }\n\n this.previousGyroMeasurement.copy(this.currentGyroMeasurement);\n};\n\nComplementaryFilter.prototype.run_ = function() {\n\n if (!this.isOrientationInitialized) {\n this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n this.previousFilterQ.copy(this.accelQ);\n this.isOrientationInitialized = true;\n return;\n }\n\n var deltaT = this.currentGyroMeasurement.timestampS -\n this.previousGyroMeasurement.timestampS;\n\n // Convert gyro rotation vector to a quaternion delta.\n var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n this.gyroIntegralQ.multiply(gyroDeltaQ);\n\n // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n this.filterQ.copy(this.previousFilterQ);\n this.filterQ.multiply(gyroDeltaQ);\n\n // Calculate the delta between the current estimated gravity and the real\n // gravity vector from accelerometer.\n var invFilterQ = new MathUtil.Quaternion();\n invFilterQ.copy(this.filterQ);\n invFilterQ.inverse();\n\n this.estimatedGravity.set(0, 0, -1);\n this.estimatedGravity.applyQuaternion(invFilterQ);\n this.estimatedGravity.normalize();\n\n this.measuredGravity.copy(this.currentAccelMeasurement.sample);\n this.measuredGravity.normalize();\n\n // Compare estimated gravity with measured gravity, get the delta quaternion\n // between the two.\n var deltaQ = new MathUtil.Quaternion();\n deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n deltaQ.inverse();\n\n if (Util.isDebug()) {\n console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)',\n MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ),\n (this.estimatedGravity.x).toFixed(1),\n (this.estimatedGravity.y).toFixed(1),\n (this.estimatedGravity.z).toFixed(1),\n (this.measuredGravity.x).toFixed(1),\n (this.measuredGravity.y).toFixed(1),\n (this.measuredGravity.z).toFixed(1));\n }\n\n // Calculate the SLERP target: current orientation plus the measured-estimated\n // quaternion delta.\n var targetQ = new MathUtil.Quaternion();\n targetQ.copy(this.filterQ);\n targetQ.multiply(deltaQ);\n\n // SLERP factor: 0 is pure gyro, 1 is pure accel.\n this.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n this.previousFilterQ.copy(this.filterQ);\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n return this.filterQ;\n};\n\nComplementaryFilter.prototype.accelToQuaternion_ = function(accel) {\n var normAccel = new MathUtil.Vector3();\n normAccel.copy(accel);\n normAccel.normalize();\n var quat = new MathUtil.Quaternion();\n quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel);\n quat.inverse();\n return quat;\n};\n\nComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) {\n // Extract axis and angle from the gyroscope data.\n var quat = new MathUtil.Quaternion();\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n quat.setFromAxisAngle(axis, gyro.length() * dt);\n return quat;\n};\n\n\nmodule.exports = ComplementaryFilter;\n","import MathUtil from \"webvr-polyfill/src/math-util\";\nimport ComplementaryFilter from \"webvr-polyfill/src/sensor-fusion/complementary-filter\";\n\nComplementaryFilter.prototype.run_ = function() {\n\tif (!this.isOrientationInitialized) {\n\t\tthis.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n\t\tthis.previousFilterQ.copy(this.accelQ);\n\t\tthis.isOrientationInitialized = true;\n\t\treturn;\n\t}\n\n\tconst deltaT = this.currentGyroMeasurement.timestampS -\n\tthis.previousGyroMeasurement.timestampS;\n\n\t// Convert gyro rotation vector to a quaternion delta.\n\tconst gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n\n\tthis.gyroIntegralQ.multiply(gyroDeltaQ);\n\n\t// filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n\tthis.filterQ.copy(this.previousFilterQ);\n\tthis.filterQ.multiply(gyroDeltaQ);\n\n\t// Calculate the delta between the current estimated gravity and the real\n\t// gravity vector from accelerometer.\n\tconst invFilterQ = new MathUtil.Quaternion();\n\n\tinvFilterQ.copy(this.filterQ);\n\tinvFilterQ.inverse();\n\n\tthis.estimatedGravity.set(0, 0, -1);\n\tthis.estimatedGravity.applyQuaternion(invFilterQ);\n\tthis.estimatedGravity.normalize();\n\n\tthis.measuredGravity.copy(this.currentAccelMeasurement.sample);\n\tthis.measuredGravity.normalize();\n\n\t// Compare estimated gravity with measured gravity, get the delta quaternion\n\t// between the two.\n\tconst deltaQ = new MathUtil.Quaternion();\n\n\tdeltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n\tdeltaQ.inverse();\n\n\t// Calculate the SLERP target: current orientation plus the measured-estimated\n\t// quaternion delta.\n\tconst targetQ = new MathUtil.Quaternion();\n\n\ttargetQ.copy(this.filterQ);\n\ttargetQ.multiply(deltaQ);\n\n\t// SLERP factor: 0 is pure gyro, 1 is pure accel.\n\tthis.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n\tthis.previousFilterQ.copy(this.filterQ);\n\n\tif (!this.isFilterQuaternionInitialized) {\n\t\tthis.isFilterQuaternionInitialized = true;\n\t}\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n\tif (this.isFilterQuaternionInitialized) {\n\t\treturn this.filterQ;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexport default ComplementaryFilter;\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport PosePredictor from \"webvr-polyfill/src/sensor-fusion/pose-predictor\";\nimport MathUtil from \"webvr-polyfill/src/math-util\";\nimport Util from \"webvr-polyfill/src/util\";\nimport {window, IS_IOS, IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\nimport DeviceMotion from \"./DeviceMotion\";\nimport ComplementaryFilter from \"./ComplementaryFilter\";\nimport {CHROME_VERSION} from \"../consts\";\n\nconst K_FILTER = 0.98;\nconst PREDICTION_TIME_S = 0.040;\n\nexport default class FusionPoseSensor extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.deviceMotion = new DeviceMotion();\n\n\t\tthis.accelerometer = new MathUtil.Vector3();\n\t\tthis.gyroscope = new MathUtil.Vector3();\n\n\t\tthis._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);\n\t\tthis._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);\n\n\t\tthis.filter = new ComplementaryFilter(K_FILTER);\n\t\tthis.posePredictor = new PosePredictor(PREDICTION_TIME_S);\n\n\t\tthis.filterToWorldQ = new MathUtil.Quaternion();\n\n\t\tthis.isFirefoxAndroid = Util.isFirefoxAndroid();\n\t\t// This includes iPhone & iPad(both desktop and mobile mode) ref #326\n\t\tthis.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP;\n\n\t\t// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18\n\t\tthis.isChromeUsingDegrees = CHROME_VERSION >= 66;\n\n\t\tthis._isEnabled = false;\n\n\t\t// Set the filter to world transform, depending on OS.\n\t\tif (this.isIOS) {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);\n\t\t} else {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);\n\t\t}\n\n\t\tthis.inverseWorldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.worldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1),\n\t\t\t-window.orientation * Math.PI / 180);\n\n\t\tthis._setScreenTransform();\n\t\t// Adjust this filter for being in landscape mode.\n\t\tif (Util.isLandscapeMode()) {\n\t\t\tthis.filterToWorldQ.multiply(this.inverseWorldToScreenQ);\n\t\t}\n\n\t\t// Keep track of a reset transform for resetSensor.\n\t\tthis.resetQ = new MathUtil.Quaternion();\n\n\t\tthis.deviceMotion.on(\"devicemotion\", this._onDeviceMotionChange);\n\t\tthis.enable();\n\t}\n\tenable() {\n\t\tif (this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.enable();\n\t\tthis._isEnabled = true;\n\t\twindow.addEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tdisable() {\n\t\tif (!this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.disable();\n\t\tthis._isEnabled = false;\n\t\twindow.removeEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tisEnabled() {\n\t\treturn this._isEnabled;\n\t}\n\tdestroy() {\n\t\tthis.disable();\n\t\tthis.deviceMotion = null;\n\t}\n\t_triggerChange() {\n\t\tconst orientation = this.getOrientation();\n\n\t\t// if orientation is not prepared. don't trigger change event\n\t\tif (!orientation) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._prevOrientation) {\n\t\t\tthis._prevOrientation = orientation;\n\t\t\treturn;\n\t\t}\n\n\t\tif (quat.equals(this._prevOrientation, orientation)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.trigger(\"change\", {quaternion: orientation});\n\t}\n\tgetOrientation() {\n\t\tlet orientation;\n\n\t\t// Hack around using deviceorientation instead of devicemotion\n\t\tif (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) {\n\t\t\tthis.deviceOrientationFixQ = this.deviceOrientationFixQ || (() => {\n\t\t\t\tconst y = new MathUtil.Quaternion()\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -this._alpha);\n\n\t\t\t\treturn y;\n\t\t\t})();\n\n\t\t\torientation = this._deviceOrientationQ;\n\t\t\tconst out = new MathUtil.Quaternion();\n\n\t\t\tout.copy(orientation);\n\t\t\tout.multiply(this.filterToWorldQ);\n\t\t\tout.multiply(this.resetQ);\n\t\t\tout.multiply(this.worldToScreenQ);\n\t\t\tout.multiplyQuaternions(this.deviceOrientationFixQ, out);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t} else {\n\t\t\t// Convert from filter space to the the same system used by the\n\t\t\t// deviceorientation event.\n\t\t\torientation = this.filter.getOrientation();\n\n\t\t\tif (!orientation) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst out = this._convertFusionToPredicted(orientation);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t}\n\t}\n\t_convertFusionToPredicted(orientation) {\n\t\t// Predict orientation.\n\t\tthis.predictedQ =\n\t\t\tthis.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS);\n\n\t\t// Convert to THREE coordinate system: -Z forward, Y up, X right.\n\t\tconst out = new MathUtil.Quaternion();\n\n\t\tout.copy(this.filterToWorldQ);\n\t\tout.multiply(this.resetQ);\n\t\tout.multiply(this.predictedQ);\n\t\tout.multiply(this.worldToScreenQ);\n\n\t\treturn out;\n\t}\n\t_onDeviceMotionChange({inputEvent}) {\n\t\tconst deviceorientation = inputEvent.deviceorientation;\n\t\tconst deviceMotion = inputEvent;\n\t\tconst accGravity = deviceMotion.accelerationIncludingGravity;\n\t\tconst rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate;\n\t\tlet timestampS = deviceMotion.timeStamp / 1000;\n\n\t\tif (deviceorientation) {\n\t\t\tif (!this._alpha) {\n\t\t\t\tthis._alpha = deviceorientation.alpha;\n\t\t\t}\n\t\t\tthis._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion();\n\t\t\tthis._deviceOrientationQ.setFromEulerYXZ(\n\t\t\t\tdeviceorientation.beta,\n\t\t\t\tdeviceorientation.alpha,\n\t\t\t\tdeviceorientation.gamma\n\t\t\t);\n\n\t\t\tthis._triggerChange();\n\t\t} else {\n\t\t\t// Firefox Android timeStamp returns one thousandth of a millisecond.\n\t\t\tif (this.isFirefoxAndroid) {\n\t\t\t\ttimestampS /= 1000;\n\t\t\t}\n\n\t\t\tthis.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z);\n\t\t\tthis.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma);\n\n\t\t\t// Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate`\n\t\t\t// is reported in degrees, so we first convert to radians.\n\t\t\tif (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) {\n\t\t\t\tthis.gyroscope.multiplyScalar(Math.PI / 180);\n\t\t\t}\n\n\t\t\tthis.filter.addAccelMeasurement(this.accelerometer, timestampS);\n\t\t\tthis.filter.addGyroMeasurement(this.gyroscope, timestampS);\n\n\t\t\tthis._triggerChange();\n\n\t\t\tthis.previousTimestampS = timestampS;\n\t\t}\n\t}\n\t_onScreenOrientationChange(screenOrientation) {\n\t\tthis._setScreenTransform(window.orientation);\n\t}\n\t_setScreenTransform() {\n\t\tthis.worldToScreenQ.set(0, 0, 0, 1);\n\n\t\tconst orientation = window.orientation;\n\n\t\tswitch (orientation) {\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tcase 90:\n\t\t\tcase -90:\n\t\t\tcase 180:\n\t\t\t\tthis.worldToScreenQ\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.inverseWorldToScreenQ.copy(this.worldToScreenQ);\n\t\tthis.inverseWorldToScreenQ.inverse();\n\t}\n}\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport {toAxis} from \"../utils\";\nimport FusionPoseSensor from \"./FusionPoseSensor\";\nimport {util, ROTATE_CONSTANT} from \"../../utils/math-util\";\n\nfunction getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(util.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nfunction getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n\nexport default class TiltMotionInput extends Component {\n\tconstructor(el, options) {\n\t\tsuper();\n\t\tthis.element = el;\n\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\n\t\tthis.fusionPoseSensor = null;\n\n\t\tthis.options = Object.assign({\n\t\t\tscale: 1,\n\t\t\tthreshold: 0,\n\t\t}, options);\n\n\t\tthis._onPoseChange = this._onPoseChange.bind(this);\n\t}\n\tmapAxes(axes) {\n\t\tthis.axes = axes;\n\t}\n\tconnect(observer) {\n\t\tif (this.observer) {\n\t\t\treturn this;\n\t\t}\n\t\tthis.observer = observer;\n\t\tthis.fusionPoseSensor = new FusionPoseSensor();\n\t\tthis.fusionPoseSensor.enable();\n\t\tthis._attachEvent();\n\t\treturn this;\n\t}\n\tdisconnect() {\n\t\tif (!this.observer) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._dettachEvent();\n\t\tthis.fusionPoseSensor.disable();\n\t\tthis.fusionPoseSensor.destroy();\n\t\tthis.fusionPoseSensor = null;\n\t\tthis.observer = null;\n\t\treturn this;\n\t}\n\tdestroy() {\n\t\tthis.disconnect();\n\t\tthis.element = null;\n\t\tthis.options = null;\n\t\tthis.axes = null;\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\t}\n\t_onPoseChange(event) {\n\t\tif (!this._prevQuaternion) {\n\t\t\tthis._prevQuaternion = quat.clone(event.quaternion);\n\t\t\tthis._quaternion = quat.clone(event.quaternion);\n\t\t\treturn;\n\t\t}\n\n\t\tquat.copy(this._prevQuaternion, this._quaternion);\n\t\tquat.copy(this._quaternion, event.quaternion);\n\n\t\tthis.observer.change(this, event, toAxis(this.axes, [\n\t\t\tgetDeltaYaw(this._prevQuaternion, this._quaternion),\n\t\t\tgetDeltaPitch(this._prevQuaternion, this._quaternion)\n\t\t]));\n\t}\n\t_attachEvent() {\n\t\tthis.fusionPoseSensor.on(\"change\", this._onPoseChange);\n\t}\n\t_dettachEvent() {\n\t\tthis.fusionPoseSensor.off(\"change\", this._onPoseChange);\n\t}\n}\n","import {glMatrix} from \"gl-matrix\";\nimport {window} from \"../utils/browser\";\n\n// Singleton\nlet screenRotationAngleInst = null;\nlet refCount = 0;\n\nexport default class ScreenRotationAngle {\n\tconstructor() {\n\t\trefCount++;\n\n\t\tif (screenRotationAngleInst) {\n\t\t\treturn screenRotationAngleInst;\n\t\t}\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = this;\n\t\t/* eslint-enable */\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onOrientationChange = this._onOrientationChange.bind(this);\n\n\t\tthis._spinR = 0;\n\n\t\tthis._screenOrientationAngle = 0;\n\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.addEventListener(\"orientationchange\", this._onOrientationChange);\n\t}\n\n\t_onDeviceOrientation(e) {\n\t\tif (e.beta === null || e.gamma === null) {\n\t\t\t// (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it.\n\t\t\treturn;\n\t\t}\n\n\t\t// Radian\n\t\tconst betaR = glMatrix.toRadian(e.beta);\n\t\tconst gammaR = glMatrix.toRadian(e.gamma);\n\n\t\t/* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */\n\t\tthis._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR));\n\t}\n\n\t_onOrientationChange(e) {\n\t\tif (window.screen && window.screen.orientation && window.screen.orientation.angle !== undefined) {\n\t\t\tthis._screenOrientationAngle = screen.orientation.angle;\n\t\t} else if (window.orientation !== undefined) {\n\t\t\t/* iOS */\n\t\t\tthis._screenOrientationAngle = window.orientation >= 0 ?\n\t\t\t\twindow.orientation : 360 + window.orientation;\n\t\t}\n\t}\n\n\tgetRadian() {\n\t\t// Join with screen orientation\n\t\t// this._testVal = this._spinR + \", \" + this._screenOrientationAngle + \", \" + window.orientation;\n\t\treturn this._spinR + glMatrix.toRadian(this._screenOrientationAngle);\n\t}\n\n\tunref() {\n\t\tif (--refCount > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"orientationchange\", this._onOrientationChange);\n\n\t\tthis._spinR = 0;\n\t\tthis._screenOrientationAngle = 0;\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = null;\n\t\t/* eslint-enable */\n\t\trefCount = 0;\n\t}\n}\n","import Axes, {PanInput} from \"@egjs/axes\";\nimport ScreenRotationAngle from \"../ScreenRotationAngle\";\n\n/**\n * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle.\n *\n * The reason for using this function is that in VR mode,\n * the roll angle is adjusted in the direction opposite to the screen rotation angle.\n *\n * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.\n * @extends PanInput\n */\nexport default class RotationPanInput extends PanInput {\n\t/**\n\t * Constructor\n\t *\n\t * @private\n\t * @param {HTMLElement} el target element\n\t * @param {Object} [options] The option object\n\t * @param {Boolean} [options.useRotation] Whether to use rotation(or VR)\n\t */\n\tconstructor(el, options) {\n\t\tsuper(el, options);\n\n\t\tthis._useRotation = false;\n\t\tthis._screenRotationAngle = null;\n\n\t\tthis.setUseRotation(!!(options && options.useRotation));\n\n\t\tthis._userDirection = Axes.DIRECTION_ALL;\n\t}\n\n\tsetUseRotation(useRotation) {\n\t\tthis._useRotation = useRotation;\n\n\t\tif (this._screenRotationAngle) {\n\t\t\tthis._screenRotationAngle.unref();\n\t\t\tthis._screenRotationAngle = null;\n\t\t}\n\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle = new ScreenRotationAngle();\n\t\t}\n\t}\n\n\tconnect(observer) {\n\t\t// User intetened direction\n\t\tthis._userDirection = this._direction;\n\n\t\t// In VR Mode, Use ALL direction if direction is not none\n\t\t// Because horizontal and vertical is changed dynamically by screen rotation.\n\t\t// this._direction is used to initialize hammerjs\n\t\tif (this._useRotation && (this._direction & Axes.DIRECTION_ALL)) {\n\t\t\tthis._direction = Axes.DIRECTION_HORIZONTAL;\n\t\t}\n\n\t\tsuper.connect(observer);\n\t}\n\n\tgetOffset(properties, useDirection) {\n\t\tif (this._useRotation === false) {\n\t\t\treturn super.getOffset(properties, useDirection);\n\t\t}\n\n\t\tconst offset = super.getOffset(properties, [true, true]);\n\t\tconst newOffset = [0, 0];\n\n\t\tconst theta = this._screenRotationAngle.getRadian();\n\n\t\tconst cosTheta = Math.cos(theta);\n\t\tconst sinTheta = Math.sin(theta);\n\n\t\t// RotateZ\n\t\tnewOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta;\n\t\tnewOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta;\n\n\t\t// Use only user allowed direction.\n\t\tif (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) {\n\t\t\tnewOffset[0] = 0;\n\t\t} else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) {\n\t\t\tnewOffset[1] = 0;\n\t\t}\n\n\t\treturn newOffset;\n\t}\n\n\tdestroy() {\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle && this._screenRotationAngle.unref();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n\n/**\n * Override getDirectionByAngle to return DIRECTION_ALL\n * Ref: https://github.com/naver/egjs-axes/issues/99\n *\n * But we obey axes's rule. If axes's rule is problem, let's apply following code.\n */\n// PanInput.getDirectionByAngle = function (angle, thresholdAngle) {\n// \treturn DIRECTION_ALL;\n// };\n","import Component from \"@egjs/component\";\nimport {vec3, glMatrix, quat} from \"gl-matrix\";\nimport FusionPoseSensor from \"./input/FusionPoseSensor\";\n\nconst Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0);\n\nexport default class DeviceQuaternion extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._fusionPoseSensor = new FusionPoseSensor();\n\t\tthis._quaternion = quat.create();\n\n\t\tthis._fusionPoseSensor.enable();\n\t\tthis._fusionPoseSensor.on(\"change\", e => {\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis.trigger(\"change\", {isTrusted: true});\n\t\t});\n\t}\n\n\tgetCombinedQuaternion(yaw) {\n\t\tconst yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw));\n\t\tconst conj = quat.conjugate(quat.create(), this._quaternion);\n\t\t// Multiply pitch quaternion -> device quaternion -> yaw quaternion\n\t\tconst outQ = quat.multiply(quat.create(), conj, yawQ);\n\n\t\treturn outQ;\n\t}\n\n\tdestroy() {\n\t\t// detach all event handler\n\t\tthis.off();\n\n\t\tif (this._fusionPoseSensor) {\n\t\t\tthis._fusionPoseSensor.off();\n\t\t\tthis._fusionPoseSensor.destroy();\n\t\t\tthis._fusionPoseSensor = null;\n\t\t}\n\t}\n}\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport Axes, {PinchInput, MoveKeyInput, WheelInput} from \"@egjs/axes\";\nimport {vec2, glMatrix} from \"gl-matrix\";\nimport {getComputedStyle, SUPPORT_TOUCH, SUPPORT_DEVICEMOTION} from \"../utils/browserFeature\";\nimport TiltMotionInput from \"./input/TiltMotionInput\";\nimport RotationPanInput from \"./input/RotationPanInput\";\nimport DeviceQuaternion from \"./DeviceQuaternion\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {\n\tGYRO_MODE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\tTOUCH_DIRECTION_NONE,\n} from \"./consts\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF];\nconst DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF];\nconst CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF];\n\n/**\n * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates.\n *\n * @alias eg.YawPitchControl\n * @extends eg.Component\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n */\nclass YawPitchControl extends Component {\n\tstatic VERSION = VERSION;\n\t// Expose DeviceOrientationControls sub module for test purpose\n\tstatic CONTROL_MODE_VR = CONTROL_MODE_VR;\n\tstatic CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH;\n\tstatic TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL;\n\tstatic TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW;\n\tstatic TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH;\n\tstatic TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE;\n\t/**\n\t * @param {Object} options The option object of the eg.YawPitch module\n\t * @param {Element}[options.element=null] element A base element for the eg.YawPitch module\n\t * @param {Number} [options.yaw=0] initial yaw (degree)\n\t * @param {Number} [options.pitch=0] initial pitch (degree)\n\t * @param {Number} [options.fov=65] initial field of view (degree)\n\t * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown\n\t * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available\n\t * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion.\n\t * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move)\n\t * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw\n\t * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch\n\t * @param {Array} [options.fovRange=[30, 110] Range of FOV\n\t * @param {Number} [options.aspectRatio=1] Aspect Ratio\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\n\t\tconst opt = Object.assign({\n\t\t\telement: null,\n\t\t\tyaw: 0,\n\t\t\tpitch: 0,\n\t\t\tfov: 65,\n\t\t\tshowPolePoint: false,\n\t\t\tuseZoom: true,\n\t\t\tuseKeyboard: true,\n\t\t\tgyroMode: GYRO_MODE.YAWPITCH,\n\t\t\ttouchDirection: TOUCH_DIRECTION_ALL,\n\t\t\tyawRange: DEFAULT_YAW_RANGE,\n\t\t\tpitchRange: DEFAULT_PITCH_RANGE,\n\t\t\tfovRange: [30, 110],\n\t\t\taspectRatio: 1, /* TODO: Need Mandatory? */\n\t\t}, options);\n\n\t\tthis._element = opt.element;\n\t\tthis._initialFov = opt.fov;\n\t\tthis._enabled = false;\n\t\tthis._isAnimating = false;\n\t\tthis._deviceQuaternion = null;\n\n\t\tthis._initAxes(opt);\n\t\tthis.option(opt);\n\t}\n\n\t_initAxes(opt) {\n\t\tconst yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio);\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint);\n\t\tconst useRotation = opt.gyroMode === GYRO_MODE.VR;\n\n\t\tthis.axesPanInput = new RotationPanInput(this._element, {useRotation});\n\t\tthis.axesWheelInput = new WheelInput(this._element, {scale: -4});\n\t\tthis.axesTiltMotionInput = null;\n\t\tthis.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, {scale: -1}) : null;\n\t\tthis.axesMoveKeyInput = new MoveKeyInput(this._element, {scale: [-6, 6]});\n\n\t\tthis.axes = new Axes({\n\t\t\tyaw: {\n\t\t\t\trange: yRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(yRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tpitch: {\n\t\t\t\trange: pRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(pRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tfov: {\n\t\t\t\trange: opt.fovRange,\n\t\t\t\tcircular: [false, false],\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t}, {\n\t\t\tdeceleration: MC_DECELERATION,\n\t\t\tmaximumDuration: MC_MAXIMUM_DURATION\n\t\t}, {\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov\n\t\t}).on({\n\t\t\thold: evt => {\n\t\t\t\t// Restore maximumDuration not to be spin too mush.\n\t\t\t\tthis.axes.options.maximumDuration = MC_MAXIMUM_DURATION;\n\n\t\t\t\tthis.trigger(\"hold\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t\tchange: evt => {\n\t\t\t\tif (evt.delta.fov !== 0) {\n\t\t\t\t\tthis._updateControlScale(evt);\n\t\t\t\t\tthis.updatePanScale();\n\t\t\t\t}\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\trelease: evt => {\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\tanimationStart: evt => {\n\t\t\t},\n\t\t\tanimationEnd: evt => {\n\t\t\t\tthis.trigger(\"animationEnd\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Update Pan Scale\n\t *\n\t * Scale(Sensitivity) values of panning is related with fov and height.\n\t * If at least one of them is changed, this function need to be called.\n\t * @param {*} param\n\t */\n\tupdatePanScale(param = {}) {\n\t\tconst fov = this.axes.get().fov;\n\t\tconst areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);\n\t\tconst scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight;\n\n\t\tthis.axesPanInput.options.scale = [scale, scale];\n\t\tthis.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW;\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * Override component's option method\n\t * to call method for updating values which is affected by option change.\n\t *\n\t * @param {*} args\n\t */\n\toption(...args) {\n\t\tconst argLen = args.length;\n\n\t\t// Getter\n\t\tif (argLen === 0) {\n\t\t\treturn this._getOptions();\n\t\t} else if (argLen === 1 && typeof args[0] === \"string\") {\n\t\t\treturn this._getOptions(args[0]);\n\t\t}\n\n\t\t// Setter\n\t\tconst beforeOptions = Object.assign({}, this.options);\n\t\tlet newOptions = {};\n\t\tlet changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList.\n\n\t\tif (argLen === 1) {\n\t\t\tchangedKeyList = Object.keys(args[0]);\n\t\t\tnewOptions = Object.assign({}, args[0]);\n\t\t} else if (argLen >= 2) {\n\t\t\tchangedKeyList.push(args[0]);\n\t\t\tnewOptions[args[0]] = args[1];\n\t\t}\n\n\t\tthis._setOptions(this._getValidatedOptions(newOptions));\n\t\tthis._applyOptions(changedKeyList, beforeOptions);\n\t\treturn this;\n\t}\n\n\t_getValidatedOptions(newOptions) {\n\t\tif (newOptions.yawRange) {\n\t\t\tnewOptions.yawRange =\n\t\t\t\tthis._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio);\n\t\t}\n\t\tif (newOptions.pitchRange) {\n\t\t\tnewOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov);\n\t\t}\n\t\treturn newOptions;\n\t}\n\n\t_getOptions(key) {\n\t\tlet value;\n\n\t\tif (typeof key === \"string\") {\n\t\t\tvalue = this.options[key];\n\t\t} else if (arguments.length === 0) {\n\t\t\tvalue = this.options;\n\t\t}\n\t\treturn value;\n\t}\n\n\t_setOptions(options) {\n\t\tfor (const key in options) {\n\t\t\tthis.options[key] = options[key];\n\t\t}\n\t}\n\n\t_applyOptions(keys, prevOptions) {\n\t\tconst options = this.options;\n\t\tconst axes = this.axes;\n\t\tconst isVR = options.gyroMode === GYRO_MODE.VR;\n\t\tconst isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH;\n\t\t// If it's VR mode, restrict user interaction to yaw direction only\n\t\tconst touchDirection = isVR ?\n\t\t\t(TOUCH_DIRECTION_YAW & options.touchDirection) :\n\t\t\toptions.touchDirection;\n\n\t\t// If one of below is changed, call updateControlScale()\n\t\tif (keys.some(key =>\n\t\t\tkey === \"showPolePoint\" || key === \"fov\" || key === \"aspectRatio\" ||\n\t\t\tkey === \"yawRange\" || key === \"pitchRange\"\n\t\t)) {\n\t\t\t// If fov is changed, update pan scale\n\t\t\tif (keys.indexOf(\"fov\") >= 0) {\n\t\t\t\taxes.setTo({\"fov\": options.fov});\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\n\t\t\tthis._updateControlScale();\n\t\t}\n\n\t\tif (keys.some(key => key === \"fovRange\")) {\n\t\t\tconst fovRange = options.fovRange;\n\t\t\tconst prevFov = axes.get().fov;\n\t\t\tlet nextFov = axes.get().fov;\n\n\t\t\tvec2.copy(axes.axis.fov.range, fovRange);\n\n\t\t\tif (nextFov < fovRange[0]) {\n\t\t\t\tnextFov = fovRange[0];\n\t\t\t} else if (prevFov > fovRange[1]) {\n\t\t\t\tnextFov = fovRange[1];\n\t\t\t}\n\n\t\t\tif (prevFov !== nextFov) {\n\t\t\t\taxes.setTo({\n\t\t\t\t\tfov: nextFov\n\t\t\t\t}, 0);\n\t\t\t\tthis._updateControlScale();\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"gyroMode\") && SUPPORT_DEVICEMOTION) {\n\t\t\t// Disconnect first\n\t\t\tif (this.axesTiltMotionInput) {\n\t\t\t\tthis.axes.disconnect(this.axesTiltMotionInput);\n\t\t\t\tthis.axesTiltMotionInput.destroy();\n\t\t\t\tthis.axesTiltMotionInput = null;\n\t\t\t}\n\n\t\t\tif (this._deviceQuaternion) {\n\t\t\t\tthis._deviceQuaternion.destroy();\n\t\t\t\tthis._deviceQuaternion = null;\n\t\t\t}\n\n\t\t\tif (isVR) {\n\t\t\t\tthis._initDeviceQuaternion();\n\t\t\t} else if (isYawPitch) {\n\t\t\t\tthis.axesTiltMotionInput = new TiltMotionInput(this._element);\n\t\t\t\tthis.axes.connect([\"yaw\", \"pitch\"], this.axesTiltMotionInput);\n\t\t\t}\n\n\t\t\tthis.axesPanInput.setUseRotation(isVR);\n\t\t}\n\n\t\tif (keys.some(key => key === \"useKeyboard\")) {\n\t\t\tconst useKeyboard = options.useKeyboard;\n\n\t\t\tif (useKeyboard) {\n\t\t\t\taxes.connect([\"yaw\", \"pitch\"], this.axesMoveKeyInput);\n\t\t\t} else {\n\t\t\t\taxes.disconnect(this.axesMoveKeyInput);\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"useZoom\")) {\n\t\t\tconst useZoom = options.useZoom;\n\n\t\t\t// Disconnect first\n\t\t\taxes.disconnect(this.axesWheelInput);\n\t\t\tif (useZoom) {\n\t\t\t\taxes.connect([\"fov\"], this.axesWheelInput);\n\t\t\t}\n\t\t}\n\n\t\tthis._togglePinchInputByOption(options.touchDirection, options.useZoom);\n\n\t\tif (keys.some(key => key === \"touchDirection\")) {\n\t\t\tthis._enabled && this._enableTouch(touchDirection);\n\t\t}\n\t}\n\n\t_togglePinchInputByOption(touchDirection, useZoom) {\n\t\tif (this.axesPinchInput) {\n\t\t\t// disconnect first\n\t\t\tthis.axes.disconnect(this.axesPinchInput);\n\n\t\t\t// If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll.\n\t\t\tif (\n\t\t\t\tuseZoom &&\n\t\t\t\ttouchDirection === TOUCH_DIRECTION_ALL &&\n\t\t\t\t// TODO: Get rid of using private property of axes instance.\n\t\t\t\tthis.axes._inputs.indexOf(this.axesPinchInput) === -1\n\t\t\t) {\n\t\t\t\tthis.axes.connect([\"fov\"], this.axesPinchInput);\n\t\t\t}\n\t\t}\n\t}\n\n\t_enableTouch(direction) {\n\t\t// Disconnect first\n\t\tthis.axesPanInput && this.axes.disconnect(this.axesPanInput);\n\n\t\tconst yawEnabled = direction & TOUCH_DIRECTION_YAW ? \"yaw\" : null;\n\t\tconst pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? \"pitch\" : null;\n\n\t\tthis.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput);\n\t}\n\n\t_initDeviceQuaternion() {\n\t\tthis._deviceQuaternion = new DeviceQuaternion();\n\t\tthis._deviceQuaternion.on(\"change\", e => {\n\t\t\tthis._triggerChange(e);\n\t\t});\n\t}\n\n\t_getValidYawRange(newYawRange, newFov, newAspectRatio) {\n\t\tconst ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1);\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst horizontalFov = fov * ratio;\n\t\tconst isValid = newYawRange[1] - newYawRange[0] >= horizontalFov;\n\n\t\tif (isValid) {\n\t\t\treturn newYawRange;\n\t\t} else {\n\t\t\treturn this.options.yawRange || DEFAULT_YAW_RANGE;\n\t\t}\n\t}\n\n\t_getValidPitchRange(newPitchRange, newFov) {\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst isValid = newPitchRange[1] - newPitchRange[0] >= fov;\n\n\t\tif (isValid) {\n\t\t\treturn newPitchRange;\n\t\t} else {\n\t\t\treturn this.options.pitchRange || DEFAULT_PITCH_RANGE;\n\t\t}\n\t}\n\n\tstatic isCircular(range) {\n\t\treturn range[1] - range[0] < 360 ? [false, false] : [true, true];\n\t}\n\n\t/**\n\t * Update yaw/pitch min/max by 5 factor\n\t *\n\t * 1. showPolePoint\n\t * 2. fov\n\t * 3. yawRange\n\t * 4. pitchRange\n\t * 5. aspectRatio\n\t *\n\t * If one of above is changed, call this function\n\t */\n\t_updateControlScale(changeEvt) {\n\t\tconst opt = this.options;\n\t\tconst fov = this.axes.get().fov;\n\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint);\n\t\tconst yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio);\n\n\t\t// TODO: If not changed!?\n\t\tconst pos = this.axes.get();\n\t\tlet y = pos.yaw;\n\t\tlet p = pos.pitch;\n\n\t\tvec2.copy(this.axes.axis.yaw.range, yRange);\n\t\tvec2.copy(this.axes.axis.pitch.range, pRange);\n\t\tthis.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange);\n\t\tthis.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange);\n\n\t\t/**\n\t\t * update yaw/pitch by it's range.\n\t\t */\n\t\tif (y < yRange[0]) {\n\t\t\ty = yRange[0];\n\t\t} else if (y > yRange[1]) {\n\t\t\ty = yRange[1];\n\t\t}\n\n\t\tif (p < pRange[0]) {\n\t\t\tp = pRange[0];\n\t\t} else if (p > pRange[1]) {\n\t\t\tp = pRange[1];\n\t\t}\n\n\t\tif (changeEvt) {\n\t\t\tchangeEvt.set({\n\t\t\t\tyaw: y,\n\t\t\t\tpitch: p,\n\t\t\t});\n\t\t}\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\t_updatePitchRange(pitchRange, fov, showPolePoint) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\t// Circular pitch on VR\n\t\t\treturn CIRCULAR_PITCH_RANGE;\n\t\t}\n\n\t\tconst verticalAngle = pitchRange[1] - pitchRange[0];\n\t\tconst halfFov = fov / 2;\n\t\tconst isPanorama = verticalAngle < 180;\n\n\t\tif (showPolePoint && !isPanorama) {\n\t\t\t// Use full pinch range\n\t\t\treturn pitchRange.concat();\n\t\t}\n\n\t\t// Round value as movableCood do.\n\t\treturn [pitchRange[0] + halfFov, pitchRange[1] - halfFov];\n\t}\n\n\t_updateYawRange(yawRange, fov, aspectRatio) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\treturn DEFAULT_YAW_RANGE;\n\t\t}\n\n\t\tconst horizontalAngle = yawRange[1] - yawRange[0];\n\n\t\t/**\n\t\t * Full 360 Mode\n\t\t */\n\t\tif (horizontalAngle >= 360) {\n\t\t\t// Don't limit yaw range on Full 360 mode.\n\t\t\treturn yawRange.concat();\n\t\t}\n\n\t\t/**\n\t\t * Panorama mode\n\t\t */\n\t\t// Ref : https://github.com/naver/egjs-view360/issues/290\n\t\tconst halfHorizontalFov =\n\t\t\tmathUtil.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2))));\n\n\t\t// Round value as movableCood do.\n\t\treturn [\n\t\t\tyawRange[0] + halfHorizontalFov,\n\t\t\tyawRange[1] - halfHorizontalFov\n\t\t];\n\t}\n\n\t_triggerChange(evt) {\n\t\tconst pos = this.axes.get();\n\t\tconst opt = this.options;\n\t\tconst event = {\n\t\t\ttargetElement: opt.element,\n\t\t\tisTrusted: evt.isTrusted,\n\t\t};\n\n\t\tevent.yaw = pos.yaw;\n\t\tevent.pitch = pos.pitch;\n\t\tevent.fov = pos.fov;\n\n\t\tif (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) {\n\t\t\tevent.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t\t}\n\t\tthis.trigger(\"change\", event);\n\t}\n\n\t// TODO: makes constant to be logic\n\tstatic adjustAspectRatio(input) {\n\t\tconst inputRange = [\n\t\t\t0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670,\n\t\t\t0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19,\n\t\t\t1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26,\n\t\t\t2.30, 2.60, 3.00, 5.00, 6.00\n\t\t];\n\t\tconst outputRange = [\n\t\t\t0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710,\n\t\t\t0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15,\n\t\t\t1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72,\n\t\t\t1.82, 1.92, 2.00, 2.24, 2.30\n\t\t];\n\n\t\tlet rangeIdx = -1;\n\n\t\tfor (let i = 0; i < inputRange.length - 1; i++) {\n\t\t\tif (inputRange[i] <= input && inputRange[i + 1] >= input) {\n\t\t\t\trangeIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (rangeIdx === -1) {\n\t\t\tif (inputRange[0] > input) {\n\t\t\t\treturn outputRange[0];\n\t\t\t} else {\n\t\t\t\treturn outputRange[outputRange[0].length - 1];\n\t\t\t}\n\t\t}\n\n\t\tconst inputA = inputRange[rangeIdx];\n\t\tconst inputB = inputRange[rangeIdx + 1];\n\t\tconst outputA = outputRange[rangeIdx];\n\t\tconst outputB = outputRange[rangeIdx + 1];\n\n\t\treturn YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA));\n\t}\n\n\tstatic lerp(a, b, fraction) {\n\t\treturn a + fraction * (b - a);\n\t}\n\n\t/**\n\t * Enable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#enable\n\t */\n\tenable() {\n\t\tif (this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._enabled = true;\n\n\t\t// touchDirection is decided by parameter is valid string (Ref. Axes.connect)\n\t\tthis._applyOptions(Object.keys(this.options), this.options);\n\n\t\t// TODO: Is this code is needed? Check later.\n\t\tthis.updatePanScale();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Disable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#disable\n\t */\n\tdisable(persistOrientation) {\n\t\tif (!this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// TODO: Check peristOrientation is needed!\n\t\tif (!persistOrientation) {\n\t\t\tthis._resetOrientation();\n\t\t}\n\t\tthis.axes.disconnect();\n\t\tthis._enabled = false;\n\t\treturn this;\n\t}\n\n\t_resetOrientation() {\n\t\tconst opt = this.options;\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Set one or more of yaw, pitch, fov\n\t *\n\t * @param {Object} coordinate yaw, pitch, fov\n\t * @param {Number} duration Animation duration. if it is above 0 then it's animated.\n\t */\n\tlookAt({yaw, pitch, fov}, duration) {\n\t\tconst pos = this.axes.get();\n\n\t\tconst y = yaw === undefined ? 0 : yaw - pos.yaw;\n\t\tconst p = pitch === undefined ? 0 : pitch - pos.pitch;\n\t\tconst f = fov === undefined ? 0 : fov - pos.fov;\n\n\t\t// Allow duration of animation to have more than MC_MAXIMUM_DURATION.\n\t\tthis.axes.options.maximumDuration = Infinity;\n\n\t\tthis.axes.setBy({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t\tfov: f\n\t\t}, duration);\n\t}\n\n\tgetYawPitch() {\n\t\tconst yawPitch = this.axes.get();\n\n\t\treturn {\n\t\t\tyaw: yawPitch.yaw,\n\t\t\tpitch: yawPitch.pitch,\n\t\t};\n\t}\n\n\tgetFov() {\n\t\treturn this.axes.get().fov;\n\t}\n\n\tgetQuaternion() {\n\t\tconst pos = this.axes.get();\n\n\t\treturn this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t}\n\n\tshouldRenderWithQuaternion() {\n\t\treturn this.options.gyroMode === GYRO_MODE.VR;\n\t}\n\n\t/**\n\t * Destroys objects\n\t */\n\tdestroy() {\n\t\tthis.axes && this.axes.destroy();\n\t\tthis.axisPanInput && this.axisPanInput.destroy();\n\t\tthis.axesWheelInput && this.axesWheelInput.destroy();\n\t\tthis.axesTiltMotionInput && this.axesTiltMotionInput.destroy();\n\t\tthis.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy();\n\t\tthis.axesPinchInput && this.axesPinchInput.destroy();\n\t\tthis.axesMoveKeyInput && this.axesMoveKeyInput.destroy();\n\t\tthis._deviceQuaternion && this._deviceQuaternion.destroy();\n\t}\n}\n\nexport default YawPitchControl;\n","import Component from \"@egjs/component\";\n\nconst STATUS = {\n\t\"NONE\": 0,\n\t\"LOADING\": 1,\n\t\"LOADED\": 2,\n\t\"ERROR\": 3\n};\n\nconst EVENT = {\n\t\"READYSTATECHANGE\": \"readystatechange\"\n};\n\nclass ImageLoader extends Component {\n\tstatic STATUS = STATUS;\n\tconstructor(image) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis._image = null;\n\t\tthis._onceHandlers = [];\n\t\tthis._loadStatus = STATUS.NONE;\n\n\t\timage && this.set(image);\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._image) {\n\t\t\t\trej(\"ImageLoader: image is not defiend\");\n\t\t\t} else if (this._loadStatus === STATUS.LOADED) {\n\t\t\t\tres(this.getElement());\n\t\t\t} else if (this._loadStatus === STATUS.LOADING) {\n\t\t\t\t/* Check isMaybeLoaded() first because there may have\n\t\t\t\t\tposibilities that image already loaded before get is called.\n\t\t\t\t\tfor example calling get on external image onload callback.*/\n\t\t\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\t\tres(this.getElement());\n\t\t\t\t} else {\n\t\t\t\t\tthis.on(EVENT.READYSTATECHANGE, e => {\n\t\t\t\t\t\tif (e.type === STATUS.LOADED) {\n\t\t\t\t\t\t\tres(this.getElement());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trej(\"ImageLoader: failed to load images.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trej(\"ImageLoader: failed to load images\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param image img element or img url or array of img element or array of img url\n\t */\n\tset(image) {\n\t\tthis._loadStatus = STATUS.LOADING;\n\n\t\tthis._image = ImageLoader.createElement(image);\n\n\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.onceLoaded(\n\t\t\tthis._image,\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.LOADED\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.ERROR;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.ERROR\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tstatic createElement(image) {\n\t\tconst images = image instanceof Array ? image : [image];\n\n\t\treturn images.map(img => {\n\t\t\tlet _img = img;\n\n\t\t\tif (typeof img === \"string\") {\n\t\t\t\t_img = new Image();\n\t\t\t\t_img.crossOrigin = \"anonymous\";\n\t\t\t\t_img.src = img;\n\t\t\t}\n\t\t\treturn _img;\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._image.length === 1 ? this._image[0] : this._image;\n\t}\n\n\tstatic isMaybeLoaded(image) {\n\t\tlet result = false;\n\n\t\tif (image instanceof Image) {\n\t\t\tresult = image.complete && image.naturalWidth !== 0;\n\t\t} else if (image instanceof Array) {\n\t\t\tresult = !image.some(img => !img.complete || img.naturalWidth === 0);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonceLoaded(target, onload, onerror) {\n\t\tconst targets = target instanceof Array ? target : [target];\n\t\tconst targetsNotLoaded = targets.filter(img => !ImageLoader.isMaybeLoaded(img));\n\t\tconst loadPromises = targetsNotLoaded.map(img => new Promise((res, rej) => {\n\t\t\tthis._once(img, \"load\", () => (res(img)));\n\t\t\tthis._once(img, \"error\", () => (rej(img)));\n\t\t}));\n\n\t\tPromise.all(loadPromises).then(\n\t\t\tresult => (onload(targets.length === 1 ? targets[0] : targets)),\n\t\t\treason => (onerror(reason))\n\t\t);\n\t}\n\n\t_once(target, type, listener) {\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\ttarget.addEventListener(type, fn);\n\t\tthis._onceHandlers.push({target, type, fn});\n\t}\n\n\tgetStatus() {\n\t\treturn this._loadStatus;\n\t}\n\n\tdestroy() {\n\t\tthis._onceHandlers.forEach(handler => {\n\t\t\thandler.target.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._onceHandlers = [];\n\t\tthis._image.src = \"\";\n\t\tthis._image = null;\n\t\tthis._loadStatus = STATUS.NONE;\n\t}\n}\n\nexport default ImageLoader;\n","// import Agent from \"@egjs/agent\";\n\n/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */\nconst READY_STATUS = {\n\tHAVE_NOTHING: 0, // no information whether or not the audio/video is ready\n\tHAVE_METADATA: 1, // HAVE_METADATA - metadata for the audio/video is ready\n\tHAVE_CURRENT_DATA: 2, // data for the current playback position is available, but not enough data to play next frame/millisecond\n\tHAVE_FUTURE_DATA: 3, // data for the current and at least the next frame is available\n\tHAVE_ENOUGH_DATA: 4, // enough data available to start playing\n\t// below is custom status for failed to load status\n\tLOADING_FAILED: -1\n};\n\nconst READYSTATECHANGE_EVENT_NAME = {};\n\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = \"loadedmetadata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = \"loadeddata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = \"canplay\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = \"canplaythrough\";\n\nexport default class VideoLoader {\n\tconstructor(video) {\n\t\tthis._handlers = [];\n\t\tthis._sourceCount = 0;\n\n\t\t// on iOS safari, 'loadeddata' will not triggered unless the user hits play,\n\t\t// so used 'loadedmetadata' instead.\n\t\tthis._thresholdReadyState = READY_STATUS.HAVE_METADATA;\n\t\tthis._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState];\n\n\t\tthis._loadStatus = (video && video.readyState) || READY_STATUS.HAVE_NOTHING;\n\n\t\tthis._onerror = this._onerror.bind(this);\n\n\t\tvideo && this.set(video);\n\t}\n\n\t_onerror() {\n\t\tthis._errorCount++;\n\t\tif (this._errorCount >= this._sourceCount) {\n\t\t\tthis._loadStatus = READY_STATUS.LOADING_FAILED;\n\t\t\tthis._detachErrorHandler(this._onerror);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src}\n\t */\n\t_appendSourceElement(videoUrl) {\n\t\tlet videoSrc;\n\t\tlet videoType;\n\n\t\tif (typeof videoUrl === \"object\") {\n\t\t\tvideoSrc = videoUrl.src;\n\t\t\tvideoType = videoUrl.type;\n\t\t} else if (typeof videoUrl === \"string\") {\n\t\t\tvideoSrc = videoUrl;\n\t\t}\n\n\t\tif (!videoSrc) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst sourceElement = document.createElement(\"source\");\n\n\t\tsourceElement.src = videoSrc;\n\t\tvideoType && (sourceElement.type = videoType);\n\n\t\tthis._video.appendChild(sourceElement);\n\t\treturn true;\n\t}\n\n\tset(video) {\n\t\tthis._reset(); // reset resources.\n\n\t\tif (!video) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (video instanceof HTMLVideoElement) {\n\t\t\t// video tag\n\t\t\tthis._video = video;\n\t\t} else if (typeof video === \"string\" || typeof video === \"object\") {\n\t\t\t// url\n\t\t\tthis._video = document.createElement(\"video\");\n\t\t\tthis._video.setAttribute(\"crossorigin\", \"anonymous\");\n\t\t\tthis._video.setAttribute(\"webkit-playsinline\", \"\");\n\t\t\tthis._video.setAttribute(\"playsinline\", \"\");\n\n\t\t\tif (video instanceof Array) {\n\t\t\t\tvideo.forEach(v => this._appendSourceElement(v));\n\t\t\t} else {\n\t\t\t\tthis._appendSourceElement(video);\n\t\t\t}\n\n\t\t\tthis._sourceCount = this._video.querySelectorAll(\"source\").length;\n\n\t\t\tif (this._sourceCount > 0) {\n\t\t\t\tif (this._video.readyState < this._thresholdReadyState) {\n\t\t\t\t\tthis._video.load();\n\t\t\t\t\t// attach loading error listener\n\t\t\t\t\tthis._attachErrorHandler(this._onerror);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._video = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t_attachErrorHandler(handler) {\n\t\tthis._video.addEventListener(\"error\", handler);\n\t\tthis._sources = this._video.querySelectorAll(\"source\");\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.addEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\t_detachErrorHandler(handler) {\n\t\tthis._video.removeEventListener(\"error\", handler);\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.removeEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._video) {\n\t\t\t\trej(\"VideoLoader: video is undefined\");\n\t\t\t} else if (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t} else if (this._video.readyState >= this._thresholdReadyState) {\n\t\t\t\tres(this._video);\n\t\t\t} else {\n\t\t\t\t// check errorCnt and reject\n\t\t\t\tconst rejector = () => {\n\t\t\t\t\tif (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\t\t\tthis._detachErrorHandler(rejector);\n\t\t\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis._attachErrorHandler(rejector);\n\t\t\t\tthis._once(this._thresholdEventName, () => res(this._video));\n\t\t\t}\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._video;\n\t}\n\n\tdestroy() {\n\t\tthis._reset();\n\t}\n\n\t_reset() {\n\t\tthis._handlers.forEach(handler => {\n\t\t\tthis._video.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._handlers = [];\n\t\tthis._video = null;\n\n\t\tthis._sourceCount = 0;\n\t\tthis._errorCount = 0;\n\t}\n\n\t_once(type, listener) {\n\t\tconst target = this._video;\n\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\t/* By useCapture mode enabled, you can capture the error event being fired on source(child)*/\n\t\ttarget.addEventListener(type, fn, true);\n\t\tthis._handlers.push({type, fn});\n\t}\n}\n","import agent from \"@egjs/agent\";\n\nconst WEBGL_ERROR_CODE = {\n\t\"0\": \"NO_ERROR\",\n\t\"1280\": \"INVALID_ENUM\",\n\t\"1281\": \"INVALID_VALUE\",\n\t\"1282\": \"INVALID_OPERATION\",\n\t\"1285\": \"OUT_OF_MEMORY\",\n\t\"1286\": \"INVALID_FRAMEBUFFER_OPERATION\",\n\t\"37442\": \"CONTEXT_LOST_WEBGL\"\n};\n\nlet webglAvailability = null;\nlet MAX_TEXTURE_SIZE_FOR_TEST = null;\n\nexport default class WebGLUtils {\n\tstatic createShader(gl, type, source) {\n\t\tconst shader = gl.createShader(type);\n\n\t\tgl.shaderSource(shader, source);\n\t\tgl.compileShader(shader);\n\t\tconst success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n\t\tif (success) {\n\t\t\treturn shader;\n\t\t} else {\n\t\t\t// eslint-disable-next-line\n\t\t\tconsole.error(gl.getShaderInfoLog(shader));\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic createProgram(gl, vertexShader, fragmentShader) {\n\t\tconst program = gl.createProgram();\n\n\t\tgl.attachShader(program, vertexShader);\n\t\tgl.attachShader(program, fragmentShader);\n\t\tgl.linkProgram(program);\n\n\t\tgl.detachShader(program, vertexShader);\n\t\tgl.detachShader(program, fragmentShader);\n\t\tgl.deleteShader(vertexShader);\n\t\tgl.deleteShader(fragmentShader);\n\n\t\tconst success = gl.getProgramParameter(program, gl.LINK_STATUS);\n\n\t\tif (success) {\n\t\t\treturn program;\n\t\t}\n\n\t\tgl.deleteProgram(program);\n\t\treturn null;\n\t}\n\n\tstatic initBuffer(gl, target /* bind point */, data, itemSize, attr) {\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer(target, buffer);\n\t\tgl.bufferData(target, data, gl.STATIC_DRAW);\n\n\t\tif (buffer) {\n\t\t\tbuffer.itemSize = itemSize;\n\t\t\tbuffer.numItems = data.length / itemSize;\n\t\t}\n\n\t\tif (attr !== undefined) {\n\t\t\tgl.enableVertexAttribArray(attr);\n\t\t\tgl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\tstatic getWebglContext(canvas, userContextAttributes) {\n\t\tconst webglIdentifiers = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n\t\tlet context = null;\n\t\tconst contextAttributes = Object.assign({\n\t\t\tpreserveDrawingBuffer: false,\n\t\t\tantialias: false,\n\t\t\txrCompatible: true\n\t\t}, userContextAttributes);\n\n\t\tfunction onWebglcontextcreationerror(e) {\n\t\t\treturn e.statusMessage;\n\t\t}\n\n\t\tcanvas.addEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\tfor (let i = 0; i < webglIdentifiers.length; i++) {\n\t\t\ttry {\n\t\t\t\tcontext = canvas.getContext(webglIdentifiers[i], contextAttributes);\n\t\t\t} catch (t) {}\n\t\t\tif (context) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcanvas.removeEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\treturn context;\n\t}\n\n\tstatic createTexture(gl, textureTarget) {\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture(textureTarget, texture);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(textureTarget, null);\n\n\t\treturn texture;\n\t}\n\n\t/**\n\t * Returns the webgl availability of the current browser.\n\t * @method WebGLUtils#isWebGLAvailable\n\t * @retuen {Boolean} isWebGLAvailable\n\t */\n\tstatic isWebGLAvailable() {\n\t\tif (webglAvailability === null) {\n\t\t\tconst canvas = document.createElement(\"canvas\");\n\t\t\tconst webglContext = WebGLUtils.getWebglContext(canvas);\n\n\t\t\twebglAvailability = !!webglContext;\n\n\t\t\t// webglContext Resource forced collection\n\t\t\tif (webglContext) {\n\t\t\t\tconst loseContextExtension = webglContext.getExtension(\"WEBGL_lose_context\");\n\n\t\t\t\tloseContextExtension && loseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t\treturn webglAvailability;\n\t}\n\n\t/**\n\t * Returns whether webgl is stable in the current browser.\n\t * @method WebGLUtils#isStableWebGL\n\t * @retuen {Boolean} isStableWebGL\n\t */\n\tstatic isStableWebGL() {\n\t\tconst agentInfo = agent();\n\t\tlet isStableWebgl = true;\n\n\t\tif (agentInfo.os.name === \"android\") {\n\t\t\tconst version = parseFloat(agentInfo.os.version);\n\n\t\t\tif (version <= 4.3) {\n\t\t\t\tisStableWebgl = false;\n\t\t\t} else if (version === 4.4) {\n\t\t\t\tif (agentInfo.browser.name !== \"chrome\") {\n\t\t\t\t\tisStableWebgl = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isStableWebgl;\n\t}\n\n\tstatic getErrorNameFromWebGLErrorCode(code) {\n\t\tif (!(code in WEBGL_ERROR_CODE)) {\n\t\t\treturn \"UNKNOWN_ERROR\";\n\t\t}\n\n\t\treturn WEBGL_ERROR_CODE[code];\n\t}\n\n\n\t/**\n\t * This function is wrapper for texImage2D to handle exceptions on texImage2D.\n\t * Purpose is to prevent service from being stopped by script error.\n\t *\n\t * @param {*} gl\n\t * @param {*} target\n\t * @param {*} pixels\n\t */\n\tstatic texImage2D(gl, target, pixels) {\n\t\ttry {\n\t\t\tgl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\t\t} catch (error) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.error(\"WebGLUtils.texImage2D error:\", error);\n\t\t\t/* eslint-enable no-console */\n\t\t}\n\t}\n\n\tstatic getMaxTextureSize(gl) {\n\t\t// WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test\n\t\treturn MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\t}\n}\n\n/**\n * This function should not be used in service code. It's provided only for test purpose.\n * It should be set to null or 0 when test is done.\n *\n * @param {Number} size\n */\nfunction setMaxTextureSizeForTestOnlyPurpose(size) {\n\tMAX_TEXTURE_SIZE_FOR_TEST = size;\n}\n\nexport {\n\tsetMaxTextureSizeForTestOnlyPurpose\n};\n","import Component from \"@egjs/component\";\nimport Agent from \"@egjs/agent\";\n\nconst agent = Agent();\nconst isIE11 = agent.browser.name === \"ie\" && agent.browser.majorVersion === 11;\n\nconst EVENTS = {\n\tERROR: \"error\"\n};\n\n/**\n *\n * Extends Component for firing errors occurs internally.\n */\nclass Renderer extends Component {\n\tstatic EVENTS = EVENTS;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._forceDimension = null;\n\t\tthis._pixelCanvas = null;\n\t\tthis._pixelContext = null;\n\t}\n\n\trender({gl, shaderProgram, indexBuffer, mvMatrix, pMatrix}) {\n\t\tgl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n\t\tgl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n\n\t\tif (indexBuffer) {\n\t\t\tgl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n\t\t}\n\t}\n\n\t// Define interface for Renderers\n\t/**\n\t * Following MUST BE DEFINED on Child of Renderer\n\t *\n\t * DATA\n\t *\n\t * - getVertexPositionData\n\t * - getIndexData\n\t * - getTextureCoordData\n\t *\n\t * SOURCE\n\t *\n\t * - getVertexShaderSource\n\t * - getFragmentShaderSource\n\t *\n\t * TEXTURE\n\t *\n\t * - bindTexture\n\t */\n\tgetDimension(pixelSource) {\n\t\tconst width = pixelSource.naturalWidth || pixelSource.videoWidth;\n\t\tconst height = pixelSource.naturalHeight || pixelSource.videoHeight;\n\n\t\treturn {width, height};\n\t}\n\n\t/**\n\t * Update data used by shader\n\t * \t-\n\t *\n\t *\n\t * @param {*} param\n\t */\n\tupdateShaderData(param) {\n\t\t/*\n\t\t* Update following data in implementation layer.\n\t\t* If the data is not changed, it does not need to implement this function.\n\t\t*\n\t\t* - _VERTEX_POSITION_DATA\n\t\t* - _TEXTURE_COORD_DATA\n\t\t* - _INDEX_DATA\n\t\t*/\n\t}\n\n\t/**\n\t *\n\t * @param {HTMLImageElement | HTMLVideoElement} image\n\t * @param {Object = {width, height}} forceDimension Forced dimension to resize\n\t */\n\t_initPixelSource(image, forceDimension) {\n\t\tconst isIE11Video = isIE11 && (image instanceof HTMLVideoElement);\n\n\t\tif (isIE11Video || forceDimension) {\n\t\t\tconst {width, height} = forceDimension || this.getDimension(image);\n\n\t\t\tthis._pixelCanvas = document.createElement(\"canvas\");\n\t\t\tthis._pixelCanvas.width = width;\n\t\t\tthis._pixelCanvas.height = height;\n\t\t\tthis._pixelContext = this._pixelCanvas.getContext(\"2d\");\n\t\t}\n\t\tthis._forceDimension = forceDimension;\n\t}\n\n\t_getPixelSource(image) {\n\t\tif (!this._pixelCanvas) {\n\t\t\treturn image;\n\t\t}\n\n\t\t/**\n\t\t * IE11 && Video\n\t\t * or\n\t\t * Dimension is forced (Image is larger than texture size.)\n\t\t */\n\t\tconst contentDimension = this.getDimension(image);\n\t\tconst textureDimension = this._forceDimension || contentDimension;\n\n\t\tif (this._pixelCanvas.width !== textureDimension.width) {\n\t\t\tthis._pixelCanvas.width = textureDimension.width;\n\t\t}\n\n\t\tif (this._pixelCanvas.height !== textureDimension.height) {\n\t\t\tthis._pixelCanvas.height = textureDimension.height;\n\t\t}\n\n\t\tif (this._forceDimension) {\n\t\t\tthis._pixelContext.drawImage(image,\n\t\t\t\t0, 0, contentDimension.width, contentDimension.height,\n\t\t\t\t0, 0, textureDimension.width, textureDimension.height);\n\t\t} else {\n\t\t\tthis._pixelContext.drawImage(image, 0, 0);\n\t\t}\n\n\t\treturn this._pixelCanvas;\n\t}\n\n\t_extractTileConfig(imageConfig) {\n\t\tlet tileConfig =\n\t\t\tArray.isArray(imageConfig.tileConfig) ?\n\t\t\t\timageConfig.tileConfig : Array(...Array(6)).map(() => imageConfig.tileConfig);\n\n\t\ttileConfig = tileConfig.map(\n\t\t\tconfig => Object.assign({\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}, config)\n\t\t);\n\n\t\treturn tileConfig;\n\t}\n\n\t_triggerError(error) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.error(\"Renderer Error:\", error);\n\t\t/* eslint-enable no-console */\n\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\tmessage: typeof error === \"string\" ? error : error.message\n\t\t});\n\t}\n}\n\nexport default Renderer;\n","import Agent from \"@egjs/agent\";\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {util as mathUtil} from \"../../utils/math-util.js\";\n\nclass CubeRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = null;\n\tstatic _INDEX_DATA = null;\n\tgetVertexPositionData() {\n\t\tCubeRenderer._VERTEX_POSITION_DATA =\n\t\t\tCubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// top\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// bottom\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\n\t\treturn CubeRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\tif (CubeRenderer._INDEX_DATA) {\n\t\t\treturn CubeRenderer._INDEX_DATA;\n\t\t}\n\n\t\tconst indexData = [];\n\t\tconst vertexPositionData = this.getVertexPositionData();\n\n\t\tfor (let i = 0; i < (vertexPositionData.length / 3); i += 4) {\n\t\t\tindexData.push(\n\t\t\t\ti,\n\t\t\t\ti + 2,\n\t\t\t\ti + 1,\n\t\t\t\ti,\n\t\t\t\ti + 3,\n\t\t\t\ti + 2\n\t\t\t);\n\t\t}\n\n\t\tCubeRenderer._INDEX_DATA = indexData;\n\t\treturn indexData;\n\t}\n\n\tstatic extractOrder(imageConfig) {\n\t\treturn imageConfig.order || \"RLUDBF\";\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\tconst vertexOrder = \"BFUDRL\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst base = this.getVertexPositionData();\n\t\tconst tileConfig = this._extractTileConfig(imageConfig);\n\t\tconst elemSize = 3;\n\t\tconst vertexPerTile = 4;\n\t\tconst textureCoordData =\n\t\t\tvertexOrder.split(\"\")\n\t\t\t\t.map(face => tileConfig[order.indexOf(face)])\n\t\t\t\t.map((config, i) => {\n\t\t\t\t\tconst rotation = parseInt(config.rotation / 90, 10);\n\t\t\t\t\tconst ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2];\n\n\t\t\t\t\tfor (let r = 0; r < Math.abs(rotation); r++) {\n\t\t\t\t\t\tif ((config.flipHorizontal && rotation > 0) ||\n\t\t\t\t\t\t\t(!config.flipHorizontal && rotation < 0)) {\n\t\t\t\t\t\t\tordermap_.push(ordermap_.shift());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tordermap_.unshift(ordermap_.pop());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst elemPerTile = elemSize * vertexPerTile;\n\t\t\t\t\tconst tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile);\n\t\t\t\t\tconst tileTemp = [];\n\n\t\t\t\t\tfor (let j = 0; j < vertexPerTile; j++) {\n\t\t\t\t\t\ttileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize);\n\t\t\t\t\t}\n\t\t\t\t\treturn tileTemp;\n\t\t\t\t})\n\t\t\t\t.join()\n\t\t\t\t.split(\",\")\n\t\t\t\t.map(v => parseInt(v, 10));\n\n\t\treturn textureCoordData;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}`;\n\t}\n\n\tupdateTexture(gl, image, imageConfig) {\n\t\tconst baseOrder = \"RLUDBF\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst orderMap = {};\n\n\t\torder.split(\"\").forEach((v, i) => {\n\t\t\torderMap[v] = i;\n\t\t});\n\n\t\ttry {\n\t\t\tif (image instanceof Array) {\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image);\n\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\t\t\t\t\tconst tile = this.extractTileFromImage(\n\t\t\t\t\t\timage, tileIdx, maxCubeMapTextureSize\n\t\t\t\t\t);\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, tile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis._triggerError(e);\n\t\t}\n\t}\n\n\tbindTexture(gl, texture, image, imageConfig) {\n\t\tgl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\t\tthis.updateTexture(gl, image, imageConfig);\n\t}\n\n\tgetSourceTileSize(image) {\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst aspectRatio = width / height;\n\t\tlet inputTextureSize;\n\n\t\tif (aspectRatio === 1 / 6) {\n\t\t\tinputTextureSize = width;\n\t\t} else if (aspectRatio === 6) {\n\t\t\tinputTextureSize = height;\n\t\t} else if (aspectRatio === 2 / 3) {\n\t\t\tinputTextureSize = width / 2;\n\t\t} else {\n\t\t\tinputTextureSize = width / 3;\n\t\t}\n\t\treturn inputTextureSize;\n\t}\n\n\textractTileFromImage(image, tileIdx, outputTextureSize) {\n\t\tconst {width} = this.getDimension(image);\n\t\tconst inputTextureSize = this.getSourceTileSize(image);\n\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = outputTextureSize;\n\t\tcanvas.height = outputTextureSize;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tconst tilePerRow = width / inputTextureSize;\n\n\t\tconst x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow);\n\t\tconst y = parseInt(tileIdx / tilePerRow, 10) * (inputTextureSize);\n\n\t\tcontext.drawImage(\n\t\t\timage, x, y,\n\t\t\tinputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize\n\t\t);\n\t\treturn canvas;\n\t}\n\n\tgetMaxCubeMapTextureSize(gl, image) {\n\t\tconst agent = Agent();\n\t\tconst maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n\t\tlet _imageWidth = this.getSourceTileSize(image);\n\n\t\tif (agent.browser.name === \"ie\" && agent.browser.majorVersion === 11) {\n\t\t\tif (!mathUtil.isPowerOfTwo(_imageWidth)) {\n\t\t\t\tfor (let i = 1; i < maxCubeMapTextureSize; i *= 2) {\n\t\t\t\t\tif (i < _imageWidth) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_imageWidth = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (agent.os.name === \"ios\") {\n\t\t\tconst majorVersion = agent.os.majorVersion;\n\n\t\t\t// ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다.\n\t\t\tif (majorVersion === 9) {\n\t\t\t\t_imageWidth = 1024;\n\t\t\t}\n\t\t\t// ios 8 의 경우 텍스쳐 최대사이즈는 512 이다.\n\t\t\tif (majorVersion === 8) {\n\t\t\t\t_imageWidth = 512;\n\t\t\t}\n\t\t}\n\t\t// maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수\n\t\treturn Math.min(maxCubeMapTextureSize, _imageWidth);\n\t}\n}\n\nexport default CubeRenderer;\n","\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\n\nexport default class CubeStripRenderer extends Renderer {\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}`;\n\t}\n\n\tgetVertexPositionData() {\n\t\tif (!this._vertices) {\n\t\t\tthis._vertices = [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// up\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// down\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\t\t}\n\n\t\treturn this._vertices;\n\t}\n\n\tgetIndexData() {\n\t\t// TODO: 한번만 계산하도록 수정하기\n\t\tconst indices = (() => {\n\t\t\tconst indexData = [];\n\n\t\t\tfor (let i = 0; i < (this._vertices.length / 3); i += 4) {\n\t\t\t\tindexData.push(\n\t\t\t\t\ti,\n\t\t\t\t\ti + 1,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti + 3\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn indexData;\n\t\t})();\n\n\t\treturn indices;\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\t// TODO: make it cols, rows as config.\n\t\tconst cols = 3;\n\t\tconst rows = 2;\n\t\tconst order = imageConfig.order || \"RLUDFB\";\n\t\tlet coords = [];\n\n\t\t// 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다.\n\t\tfor (let r = rows - 1; r >= 0; r--) {\n\t\t\tfor (let c = 0; c < cols; c++) {\n\t\t\t\tconst coord = [\n\t\t\t\t\tc / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, (r + 1) / rows,\n\t\t\t\t\tc / cols, (r + 1) / rows\n\t\t\t\t];\n\n\t\t\t\tcoords.push(coord);\n\t\t\t}\n\t\t}\n\n\t\tconst tileConfigs = this._extractTileConfig(imageConfig);\n\n\t\t// Transform Coord By Flip & Rotation\n\t\tcoords = coords\n\t\t// shrink coord to avoid pixel bleeding\n\t\t\t.map(coord => this._shrinkCoord(coord))\n\t\t\t.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));\n\n\t\t// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치\n\t\treturn \"BFUDRL\".split(\"\")\n\t\t\t.map(face => order.indexOf(face))\n\t\t\t.map(index => coords[index])\n\t\t\t.reduce((acc, val) => acc.concat(val), []);\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\t_transformCoord(coord, tileConfig) {\n\t\tlet newCoord = coord.slice();\n\n\t\tif (tileConfig.flipHorizontal) {\n\t\t\tnewCoord = this._flipHorizontalCoord(newCoord);\n\t\t}\n\n\t\tif (tileConfig.rotation) {\n\t\t\tnewCoord = this._rotateCoord(newCoord, tileConfig.rotation);\n\t\t}\n\n\t\treturn newCoord;\n\t}\n\n\t_shrinkCoord(coord) {\n\t\tconst SHRINK_Y = 0.00;\n\t\tconst SHRINK_X = 0.00;\n\n\t\treturn [\n\t\t\tcoord[0] + SHRINK_X, coord[1] + SHRINK_Y,\n\t\t\tcoord[2] - SHRINK_X, coord[3] + SHRINK_Y,\n\t\t\tcoord[4] - SHRINK_X, coord[5] - SHRINK_Y,\n\t\t\tcoord[6] + SHRINK_X, coord[7] - SHRINK_Y\n\t\t];\n\t}\n\n\t_rotateCoord(coord, rotationAngle) {\n\t\tconst SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord.\n\t\tconst shiftCount = parseInt(rotationAngle / 90, 10) % 4;\n\n\t\tif (shiftCount === 0) {\n\t\t\treturn coord;\n\t\t}\n\n\t\tlet moved;\n\t\tlet rotatedCoord = [];\n\n\t\tif (shiftCount > 0) {\n\t\t\tmoved = coord.splice(0, shiftCount * SIZE);\n\t\t\trotatedCoord = coord.concat(moved);\n\t\t} else {\n\t\t\tmoved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE);\n\t\t\trotatedCoord = moved.concat(coord);\n\t\t}\n\n\t\treturn rotatedCoord;\n\t}\n\n\t_flipHorizontalCoord(coord) {\n\t\treturn [\n\t\t\tcoord[2], coord[3],\n\t\t\tcoord[0], coord[1],\n\t\t\tcoord[6], coord[7],\n\t\t\tcoord[4], coord[5]\n\t\t];\n\t}\n}\n","/**\n * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide})\n * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고)\n * @namespace\n * @name GYRO_MODE\n * @memberof eg.view360.PanoViewer\n */\n/**\n * Disable gyro\n * @ko gyro 비활성화\n * @name NONE\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"none\"\n */\n/**\n * YawPitch Mode\n * @ko YawPitch Mode\n * @name YAWPITCH\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"yawPitch\"\n */\n/**\n * VR Mode\n * @ko VR Mode\n * @name VR\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"VR\"\n */\nimport {GYRO_MODE} from \"../YawPitchControl/consts\";\n\n/**\n * Constant value for errors\n * @ko 에러에 대한 상수 값\n * @namespace\n * @name ERROR_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst ERROR_TYPE = {\n\t/**\n\t * Unsupported device\n\t * @ko 미지원 기기\n\t * @name INVALID_DEVICE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 10\n\t */\n\tINVALID_DEVICE: 10,\n\t/**\n\t * Webgl not support\n\t * @ko WEBGL 미지원\n\t * @name NO_WEBGL\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 11\n\t */\n\tNO_WEBGL: 11,\n\t/**\n\t * Failed to load image\n\t * @ko 이미지 로드 실패\n\t * @name FAIL_IMAGE_LOAD\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 12\n\t */\n\tFAIL_IMAGE_LOAD: 12,\n\t/**\n\t * Failed to bind texture\n\t * @ko 텍스쳐 바인딩 실패\n\t * @name FAIL_BIND_TEXTURE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 13\n\t */\n\tFAIL_BIND_TEXTURE: 13,\n\t/**\n\t * Only one resource(image or video) should be specified\n\t * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t * @name INVALID_RESOURCE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 14\n\t */\n\tINVALID_RESOURCE: 14,\n\t/**\n\t * WebGL context lost occurred\n\t * @ko WebGL context lost 발생\n\t * @name RENDERING_CONTEXT_LOST\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 15\n\t */\n\tRENDERING_CONTEXT_LOST: 15,\n};\n\n/**\n * Constant value for events\n * @ko 이벤트에 대한 상수 값\n * @namespace\n * @name EVENTS\n * @memberof eg.view360.PanoViewer\n */\nconst EVENTS = {\n\t/**\n\t * Events that is fired when PanoViewer is ready to show image and handle user interaction.\n\t * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트\n\t * @name READY\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default ready\n\t */\n\tREADY: \"ready\",\n\t/**\n\t * Events that is fired when direction or fov is changed.\n\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t * @name VIEW_CHANGE\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default viewChange\n\t */\n\tVIEW_CHANGE: \"viewChange\",\n\t/**\n\t * Events that is fired when animation which is triggered by inertia is ended.\n\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t * @name ANIMATION_END\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default animationEnd\n\t */\n\tANIMATION_END: \"animationEnd\",\n\t/**\n\t * Events that is fired when error occurs\n\t * @ko 에러 발생 시 발생하는 이벤트\n\t * @name ERROR\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default error\n\t */\n\tERROR: \"error\"\n};\n\n/**\n * Constant value for projection type\n * @ko 프로젝션 타입 대한 상수 값\n * @namespace\n * @name PROJECTION_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst PROJECTION_TYPE = {\n\t/**\n\t * Constant value for equirectangular type.\n\t * @ko equirectangular 에 대한 상수 값.\n\t * @name EQUIRECTANGULAR\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default equirectangular\n\t */\n\tEQUIRECTANGULAR: \"equirectangular\",\n\t/**\n\t * Constant value for cubemap type.\n\t * @ko cubemap 에 대한 상수 값.\n\t * @name CUBEMAP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubemap\n\t */\n\tCUBEMAP: \"cubemap\",\n\t/**\n\t * Constant value for cubestrip type.\n\t * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC.\n\t *\n\t * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다.\n\t * @name CUBESTRIP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubestrip\n\t */\n\tCUBESTRIP: \"cubestrip\",\n\t/**\n\t * Constant value for PANORAMA type.\n\t *\n\t * PANORAMA is a format for a panorma image which is taken from smartphone.\n\t *\n\t * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다.\n\t *\n\t * @name PANORAMA\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default panorama\n\t */\n\tPANORAMA: \"panorama\",\n\t/**\n\t * Constant value for EQUI_STEREOSCOPY type.\n\t *\n\t * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present.\n\t *\n\t * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다.\n\t *\n\t * @name STEREOSCOPIC_EQUI\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default stereoequi\n\t */\n\tSTEREOSCOPIC_EQUI: \"stereoequi\",\n};\n\n/**\n * A constant value for the format of the stereoscopic equirectangular projection type.\n * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값\n * @namespace\n * @name STEREO_FORMAT\n * @memberof eg.view360.PanoViewer\n */\nconst STEREO_FORMAT = {\n\t/**\n\t * A constant value for format of top bottom stereoscopic 360 equirectangular projection.\n\t * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name TOP_BOTTOM\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dv\"\n\t */\n\tTOP_BOTTOM: \"3dv\",\n\t/**\n\t * A constant value for format of left right stereoscopic 360 equirectangular projection.\n\t * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name LEFT_RIGHT\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dh\"\n\t */\n\tLEFT_RIGHT: \"3dh\",\n\t/**\n\t * A constant value specifying media is not in stereoscopic format.\n\t * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값.\n\t * @name NONE\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"\"\n\t */\n\tNONE: \"\",\n};\n\nexport {\n\tGYRO_MODE,\n\tEVENTS,\n\tERROR_TYPE,\n\tPROJECTION_TYPE,\n\tSTEREO_FORMAT\n};\n","import Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {STEREO_FORMAT} from \"../../PanoViewer/consts\";\n\nconst latitudeBands = 60;\nconst longitudeBands = 60;\nconst radius = 2;\nconst ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\nlet latIdx;\nlet lngIdx;\n\nfor (latIdx = 0; latIdx <= latitudeBands; latIdx++) {\n\tconst theta = (latIdx / latitudeBands - 0.5) * Math.PI;\n\tconst sinTheta = Math.sin(theta);\n\tconst cosTheta = Math.cos(theta);\n\n\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\tconst phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN;\n\t\tconst sinPhi = Math.sin(phi);\n\t\tconst cosPhi = Math.cos(phi);\n\t\tconst x = cosPhi * cosTheta;\n\t\tconst y = sinTheta;\n\t\tconst z = sinPhi * cosTheta;\n\t\tconst u = lngIdx / longitudeBands;\n\t\tconst v = latIdx / latitudeBands;\n\n\t\ttextureCoordData.push(u, v);\n\t\tvertexPositionData.push(radius * x, radius * y, radius * z);\n\n\t\tif (lngIdx !== longitudeBands && latIdx !== latitudeBands) {\n\t\t\tconst a = latIdx * (longitudeBands + 1) + lngIdx;\n\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t}\n\t}\n}\n\nclass SphereRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tconstructor(format) {\n\t\tsuper();\n\n\t\tthis._stereoFormat = format;\n\t}\n\n\trender(ctx) {\n\t\tconst {gl, shaderProgram} = ctx;\n\n\t\tlet leftEyeScaleOffset;\n\t\tlet rightEyeScaleOffset;\n\n\t\tswitch (this._stereoFormat) {\n\t\t\tcase STEREO_FORMAT.TOP_BOTTOM:\n\t\t\t\tleftEyeScaleOffset = [1, 0.5, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 0.5, 0, 0.5];\n\t\t\t\tbreak;\n\t\t\tcase STEREO_FORMAT.LEFT_RIGHT:\n\t\t\t\tleftEyeScaleOffset = [0.5, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [0.5, 1, 0.5, 0];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tleftEyeScaleOffset = [1, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 1, 0, 0];\n\t\t}\n\n\t\tconst uTexScaleOffset = gl.getUniformLocation(shaderProgram, \"uTexScaleOffset\");\n\n\t\tgl.uniform4fv(uTexScaleOffset, [...leftEyeScaleOffset, ...rightEyeScaleOffset]);\n\n\t\tsuper.render(ctx);\n\t}\n\n\tgetVertexPositionData() {\n\t\treturn SphereRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn SphereRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn SphereRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n}\n\nexport default SphereRenderer;\n","import {glMatrix} from \"gl-matrix\";\nimport Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\n\n// const latitudeBands = 60;\nconst MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6;\nconst longitudeBands = 60;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\n\nclass CylinderRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tgetVertexPositionData() {\n\t\treturn CylinderRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn CylinderRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn CylinderRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\t\tlet resizeDimension;\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device texture limit(${maxSize}))`);\n\n\t\t\t// Request resizing texture.\n\t\t\t/**\n\t\t\t * TODO: Is it need to apply on another projection type?\n\t\t\t */\n\t\t\tresizeDimension = width > height ?\n\t\t\t\t{width: maxSize, height: maxSize * height / width} :\n\t\t\t\t{width: maxSize * width / height, height: maxSize};\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video or resizing needed\n\t\tthis._initPixelSource(image, resizeDimension);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\tupdateShaderData({imageAspectRatio = MIN_ASPECT_RATIO_FOR_FULL_PANORAMA}) {\n\t\tlet lngIdx;\n\t\tlet cylinderMaxRadian;\n\t\tlet halfCylinderY;\n\t\tlet rotated;\n\t\tlet aspectRatio;\n\n\t\t// Exception case: orientation is rotated.\n\t\tif (imageAspectRatio < 1) {\n\t\t\t/**\n\t\t\t * If rotated is true, we assume that image is rotated counter clockwise.\n\t\t\t * TODO: If there's other rotation, it is need to implement by each rotation.\n\t\t\t */\n\t\t\trotated = true;\n\t\t\taspectRatio = 1 / imageAspectRatio;\n\t\t} else {\n\t\t\trotated = false;\n\t\t\taspectRatio = imageAspectRatio;\n\t\t}\n\n\t\tif (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) {\n\t\t\tconst fov = 360 / aspectRatio;\n\n\t\t\tcylinderMaxRadian = 2 * Math.PI; // 360 deg\n\t\t\thalfCylinderY = Math.tan(glMatrix.toRadian(fov / 2));\n\t\t} else {\n\t\t\tcylinderMaxRadian = aspectRatio;\n\t\t\thalfCylinderY = 0.5;// Range of cylinder is [-0.5, 0.5] to make height to 1.\n\t\t}\n\n\t\t// intialize shader data before update\n\t\ttextureCoordData.length = 0;\n\t\tvertexPositionData.length = 0;\n\t\tindexData.length = 0;\n\n\t\tconst CYLIDER_Y = [-halfCylinderY, halfCylinderY];\n\t\tconst startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360)\n\n\t\t// console.log(\"cylinderMaxRadian:\", glMatrix.toDegree(cylinderMaxRadian), \"CYLIDER_Y\", CYLIDER_Y, \"start angle\", glMatrix.toDegree(startAngleForCenterAlign));\n\t\tfor (let yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength/* bottom & top */; yIdx++) {\n\t\t\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\t\t\tconst angle = startAngleForCenterAlign + (lngIdx / longitudeBands * cylinderMaxRadian);\n\t\t\t\tconst x = Math.cos(angle);\n\t\t\t\tconst y = CYLIDER_Y[yIdx];\n\t\t\t\tconst z = Math.sin(angle);\n\t\t\t\tlet u;\n\t\t\t\tlet v;\n\n\t\t\t\tif (rotated) {\n\t\t\t\t\t// Rotated 90 degree (counter clock wise)\n\t\t\t\t\tu = 1 - yIdx; // yLength - yIdx;\n\t\t\t\t\tv = lngIdx / longitudeBands;\n\t\t\t\t} else {\n\t\t\t\t// \t// Normal case (Not rotated)\n\t\t\t\t\tu = lngIdx / longitudeBands;\n\t\t\t\t\tv = yIdx;\n\t\t\t\t}\n\n\t\t\t\ttextureCoordData.push(u, v);\n\t\t\t\tvertexPositionData.push(x, y, z);\n\n\t\t\t\tif (yIdx === 0 && lngIdx < longitudeBands) {\n\t\t\t\t\tconst a = lngIdx;\n\t\t\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default CylinderRenderer;\n","import {mat4} from \"gl-matrix\";\n\nconst VR_DISPLAY_PRESENT_CHANGE = \"vrdisplaypresentchange\";\nconst DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1];\nconst DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1];\nconst EYES = {\n\tLEFT: \"left\",\n\tRIGHT: \"right\"\n};\n\nclass VRManager {\n\tget context() { return this._vrDisplay; }\n\n\tconstructor() {\n\t\tthis._frameData = new window.VRFrameData();\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst vrDisplay = this._vrDisplay;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (vrDisplay && vrDisplay.isPresenting) {\n\t\t\tvrDisplay.exitPresent();\n\t\t}\n\n\t\tthis._clear();\n\t}\n\n\tcanRender() {\n\t\treturn Boolean(this._vrDisplay);\n\t}\n\n\tbeforeRender(gl) {\n\t\t// Render to the default backbuffer\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t}\n\n\tafterRender() {\n\t\tthis._vrDisplay.submitFrame();\n\t}\n\n\tgetEyeParams(gl) {\n\t\tconst display = this._vrDisplay;\n\t\tconst halfWidth = gl.drawingBufferWidth * 0.5;\n\t\tconst height = gl.drawingBufferHeight;\n\t\tconst frameData = this._frameData;\n\n\t\tdisplay.getFrameData(frameData);\n\n\t\tconst leftMVMatrix = frameData.leftViewMatrix;\n\t\tconst rightMVMatrix = frameData.rightViewMatrix;\n\n\t\tmat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset);\n\t\tmat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tviewport: [0, 0, halfWidth, height],\n\t\t\t\tmvMatrix: leftMVMatrix,\n\t\t\t\tpMatrix: frameData.leftProjectionMatrix,\n\t\t\t},\n\t\t\t{\n\t\t\t\tviewport: [halfWidth, 0, halfWidth, height],\n\t\t\t\tmvMatrix: rightMVMatrix,\n\t\t\t\tpMatrix: frameData.rightProjectionMatrix,\n\t\t\t}\n\t\t];\n\t}\n\n\tisPresenting() {\n\t\treturn Boolean(this._vrDisplay && this._vrDisplay.isPresenting);\n\t}\n\n\taddEndCallback(callback) {\n\t\twindow.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\twindow.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\trequestPresent(canvas) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tnavigator.getVRDisplays().then(displays => {\n\t\t\t\tconst vrDisplay = displays.length && displays[0];\n\n\t\t\t\tif (!vrDisplay) {\n\t\t\t\t\treject(new Error(\"No displays available.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!vrDisplay.capabilities.canPresent) {\n\t\t\t\t\treject(new Error(\"Display lacking capability to present.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvrDisplay.requestPresent([{source: canvas}]).then(() => {\n\t\t\t\t\tconst leftEye = vrDisplay.getEyeParameters(EYES.LEFT);\n\t\t\t\t\tconst rightEye = vrDisplay.getEyeParameters(EYES.RIGHT);\n\n\t\t\t\t\tcanvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;\n\t\t\t\t\tcanvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);\n\n\t\t\t\t\tthis._setDisplay(vrDisplay);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setDisplay(vrDisplay) {\n\t\tthis._vrDisplay = vrDisplay;\n\n\t\tconst layers = vrDisplay.getLayers();\n\n\t\tif (layers.length) {\n\t\t\tconst layer = layers[0];\n\n\t\t\tthis._leftBounds = layer.leftBounds;\n\t\t\tthis._rightBounds = layer.rightBounds;\n\t\t}\n\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._vrDisplay = null;\n\t\tthis._leftBounds = DEFAULT_LEFT_BOUNDS;\n\t\tthis._rightBounds = DEFAULT_RIGHT_BOUNDS;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default VRManager;\n","import {mat4, glMatrix} from \"gl-matrix\";\nimport {IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\n\nconst XR_REFERENCE_SPACE = \"local\";\n\nclass XRManager {\n\tget context() { return this._xrSession; }\n\n\tconstructor() {\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst xrSession = this._xrSession;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (xrSession) {\n\t\t\t// Capture to avoid errors\n\t\t\txrSession.end().then(() => {}, () => {});\n\t\t}\n\t\tthis._clear();\n\t}\n\n\tcanRender(frame) {\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\treturn Boolean(pose);\n\t}\n\n\tbeforeRender(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst baseLayer = session.renderState.baseLayer;\n\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer);\n\t}\n\n\tafterRender() {}\n\n\tgetEyeParams(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\tif (!pose) {\n\t\t\t// Can't render\n\t\t\treturn null;\n\t\t}\n\n\t\tconst glLayer = session.renderState.baseLayer;\n\n\t\treturn pose.views.map(view => {\n\t\t\tconst viewport = glLayer.getViewport(view);\n\t\t\tconst mvMatrix = view.transform.inverse.matrix;\n\n\t\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\t\tmat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180));\n\t\t\t}\n\n\t\t\tmat4.rotateY(mvMatrix, mvMatrix, this._yawOffset);\n\n\t\t\treturn {\n\t\t\t\tviewport: [viewport.x, viewport.y, viewport.width, viewport.height],\n\t\t\t\tmvMatrix,\n\t\t\t\tpMatrix: view.projectionMatrix\n\t\t\t};\n\t\t});\n\t}\n\n\tisPresenting() {\n\t\treturn this._presenting;\n\t}\n\n\taddEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.addEventListener(\"end\", callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.removeEventListener(\"end\", callback);\n\t}\n\n\trequestPresent(canvas, gl) {\n\t\treturn navigator.xr.requestSession(\"immersive-vr\", {\n\t\t\trequiredFeatures: [XR_REFERENCE_SPACE],\n\t\t}).then(session => {\n\t\t\tconst xrLayer = new window.XRWebGLLayer(session, gl);\n\n\t\t\tsession.updateRenderState({baseLayer: xrLayer});\n\t\t\treturn session.requestReferenceSpace(XR_REFERENCE_SPACE)\n\t\t\t\t.then(refSpace => {\n\t\t\t\t\tthis._setSession(session, xrLayer, refSpace);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setSession(session, xrLayer, refSpace) {\n\t\tthis._xrSession = session;\n\t\tthis._xrLayer = xrLayer;\n\t\tthis._xrRefSpace = refSpace;\n\t\tthis._presenting = true;\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._xrSession = null;\n\t\tthis._xrLayer = null;\n\t\tthis._xrRefSpace = null;\n\t\tthis._presenting = false;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default XRManager;\n","import {IS_SAFARI_ON_DESKTOP} from \"../utils/browser\";\n\nclass WebGLAnimator {\n\tconstructor() {\n\t\tthis._callback = null;\n\t\tthis._context = window;\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\tsetCallback(callback) {\n\t\tthis._callback = callback;\n\t}\n\n\tsetContext(context) {\n\t\tthis._context = context;\n\t}\n\n\tstart() {\n\t\tconst context = this._context;\n\t\tconst callback = this._callback;\n\n\t\t// No context / callback set\n\t\tif (!context || !callback) return;\n\t\t// Animation already started\n\t\tif (this._rafId >= 0 || this._rafTimer >= 0) return;\n\n\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoopNextTick);\n\t\t} else {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoop);\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this._rafId >= 0) {\n\t\t\tthis._context.cancelAnimationFrame(this._rafId);\n\t\t}\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t}\n\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\t/**\n\t * There can be more than 1 argument when we use XRSession's raf\n\t */\n\t_onLoop = (...args) => {\n\t\tthis._callback(...args);\n\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t}\n\n\t/**\n\t * MacOS X Safari Bug Fix\n\t * This code guarantees that rendering should be occurred.\n\t *\n\t * In MacOS X(10.14.2), Safari (12.0.2)\n\t * The requestAnimationFrame(RAF) callback is called just after previous RAF callback without term\n\t * only if requestAnimationFrame is called for next frame while updating frame is delayed (~over 2ms)\n\t * So browser cannot render the frame and may be freezing.\n\t */\n\t_onLoopNextTick = (...args) => {\n\t\tconst before = performance.now();\n\n\t\tthis._callback(...args);\n\n\t\tconst diff = performance.now() - before;\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t\tthis._rafTimer = -1;\n\t\t}\n\n\t\t/** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */\n\t\tif (diff < 16) {\n\t\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t\t} else {\n\t\t\t/** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/\n\t\t\tthis._rafTimer = setTimeout(this._onLoop, 0);\n\t\t}\n\t}\n}\n\nexport default WebGLAnimator;\n","import Component from \"@egjs/component\";\nimport {glMatrix, vec3, mat3, mat4, quat} from \"gl-matrix\";\nimport ImageLoader from \"./ImageLoader\";\nimport VideoLoader from \"./VideoLoader\";\nimport WebGLUtils from \"./WebGLUtils\";\nimport Renderer from \"./renderer/Renderer\";\nimport CubeRenderer from \"./renderer/CubeRenderer\";\nimport CubeStripRenderer from \"./renderer/CubeStripRenderer\";\nimport SphereRenderer from \"./renderer/SphereRenderer\";\nimport CylinderRenderer from \"./renderer/CylinderRenderer\";\nimport VRManager from \"./vr/VRManager\";\nimport XRManager from \"./vr/XRManager\";\nimport WebGLAnimator from \"./WebGLAnimator\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {devicePixelRatio, WEBXR_SUPPORTED} from \"../utils/browserFeature\";\nimport {PROJECTION_TYPE, STEREO_FORMAT} from \"../PanoViewer/consts\";\nimport {IS_IOS} from \"../utils/browser\";\n\nconst ImageType = PROJECTION_TYPE;\n\nlet DEVICE_PIXEL_RATIO = devicePixelRatio || 1;\n\n// DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다.\nif (DEVICE_PIXEL_RATIO > 2) {\n\tDEVICE_PIXEL_RATIO = 2;\n}\n\n// define custom events name\n/**\n * TODO: how to manage events/errortype with PanoViewer\n *\n * I think renderer events should be seperated from viewer events although it has same name.\n */\nconst EVENTS = {\n\tBIND_TEXTURE: \"bindTexture\",\n\tIMAGE_LOADED: \"imageLoaded\",\n\tERROR: \"error\",\n\tRENDERING_CONTEXT_LOST: \"renderingContextLost\",\n\tRENDERING_CONTEXT_RESTORE: \"renderingContextRestore\",\n};\n\nconst ERROR_TYPE = {\n\tINVALID_DEVICE: 10,\n\tNO_WEBGL: 11,\n\tFAIL_IMAGE_LOAD: 12,\n\tRENDERER_ERROR: 13\n};\n\nclass PanoImageRenderer extends Component {\n\tstatic EVENTS = EVENTS;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\n\tconstructor(\n\t\timage, width, height, isVideo, sphericalConfig, renderingContextAttributes\n\t) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis.sphericalConfig = sphericalConfig;\n\t\tthis.fieldOfView = sphericalConfig.fieldOfView;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tthis._lastQuaternion = null;\n\t\tthis._lastYaw = null;\n\t\tthis._lastPitch = null;\n\t\tthis._lastFieldOfView = null;\n\n\t\tthis.pMatrix = mat4.create();\n\t\tthis.mvMatrix = mat4.create();\n\n\t\t// initialzie pMatrix\n\t\tmat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), width / height, 0.1, 100);\n\n\t\tthis.textureCoordBuffer = null;\n\t\tthis.vertexBuffer = null;\n\t\tthis.indexBuffer = null;\n\n\t\tthis.canvas = this._initCanvas(width, height);\n\t\tthis._setDefaultCanvasStyle();\n\t\tthis._wrapper = null; // canvas wrapper\n\t\tthis._wrapperOrigStyle = null;\n\n\t\tthis._renderingContextAttributes = renderingContextAttributes;\n\t\tthis._image = null;\n\t\tthis._imageConfig = null;\n\t\tthis._imageIsReady = false;\n\t\tthis._shouldForceDraw = false;\n\t\tthis._keepUpdate = false; // Flag to specify 'continuous update' on video even when still.\n\n\t\tthis._onContentLoad = this._onContentLoad.bind(this);\n\t\tthis._onContentError = \tthis._onContentError.bind(this);\n\n\t\tthis._animator = new WebGLAnimator();\n\n\t\t// VR/XR manager\n\t\tthis._vr = null;\n\n\t\tif (image) {\n\t\t\tthis.setImage({\n\t\t\t\timage,\n\t\t\t\timageType: sphericalConfig.imageType,\n\t\t\t\tisVideo,\n\t\t\t\tcubemapConfig: sphericalConfig.cubemapConfig\n\t\t\t});\n\t\t}\n\t}\n\n\t// FIXME: Please refactor me to have more loose connection to yawpitchcontrol\n\tsetYawPitchControl(yawPitchControl) {\n\t\tthis._yawPitchControl = yawPitchControl;\n\t}\n\n\tgetContent() {\n\t\treturn this._image;\n\t}\n\n\tsetImage({image, imageType, isVideo = false, cubemapConfig}) {\n\t\tthis._imageIsReady = false;\n\t\tthis._isVideo = isVideo;\n\t\tthis._imageConfig = Object.assign(\n\t\t\t{\n\t\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only */\n\t\t\t\torder: (imageType === ImageType.CUBEMAP) ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\t\ttileConfig: {\n\t\t\t\t\tflipHorizontal: false,\n\t\t\t\t\trotation: 0\n\t\t\t\t}\n\t\t\t},\n\t\t\tcubemapConfig\n\t\t);\n\t\tthis._setImageType(imageType);\n\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tif (isVideo) {\n\t\t\tthis._contentLoader = new VideoLoader();\n\t\t\tthis._keepUpdate = true;\n\t\t} else {\n\t\t\tthis._contentLoader = new ImageLoader();\n\t\t\tthis._keepUpdate = false;\n\t\t}\n\n\t\t// img element or img url\n\t\tthis._contentLoader.set(image);\n\n\t\t// 이미지의 사이즈를 캐시한다.\n\t\t// image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed.\n\t\tthis._image = this._contentLoader.getElement();\n\n\t\treturn this._contentLoader.get()\n\t\t\t.then(this._onContentLoad, this._onContentError)\n\t\t\t.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.\n\t}\n\n\t_setImageType(imageType) {\n\t\tif (!imageType || this._imageType === imageType) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._imageType = imageType;\n\t\tthis._isCubeMap = imageType === ImageType.CUBEMAP;\n\n\t\tif (this._renderer) {\n\t\t\tthis._renderer.off();\n\t\t}\n\n\t\tswitch (imageType) {\n\t\t\tcase ImageType.CUBEMAP:\n\t\t\t\tthis._renderer = new CubeRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.CUBESTRIP:\n\t\t\t\tthis._renderer = new CubeStripRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.PANORAMA:\n\t\t\t\tthis._renderer = new CylinderRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.STEREOSCOPIC_EQUI:\n\t\t\t\tthis._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis._renderer = new SphereRenderer(STEREO_FORMAT.NONE);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis._renderer.on(Renderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERER_ERROR,\n\t\t\t\tmessage: e.message\n\t\t\t});\n\t\t});\n\n\t\tthis._initWebGL();\n\t}\n\n\t_initCanvas(width, height) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\n\t\tthis._onWebglcontextlost = this._onWebglcontextlost.bind(this);\n\t\tthis._onWebglcontextrestored = this._onWebglcontextrestored.bind(this);\n\n\t\tcanvas.addEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tcanvas.addEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\n\t\treturn canvas;\n\t}\n\n\t_setDefaultCanvasStyle() {\n\t\tconst canvas = this.canvas;\n\n\t\tcanvas.style.bottom = 0;\n\t\tcanvas.style.left = 0;\n\t\tcanvas.style.right = 0;\n\t\tcanvas.style.top = 0;\n\t\tcanvas.style.margin = \"auto\";\n\t\tcanvas.style.maxHeight = \"100%\";\n\t\tcanvas.style.maxWidth = \"100%\";\n\t\tcanvas.style.outline = \"none\";\n\t\tcanvas.style.position = \"absolute\";\n\t}\n\n\t_onContentError(error) {\n\t\tthis._imageIsReady = false;\n\t\tthis._image = null;\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\ttype: ERROR_TYPE.FAIL_IMAGE_LOAD,\n\t\t\tmessage: \"failed to load image\"\n\t\t});\n\n\t\treturn false;\n\t}\n\n\t_triggerContentLoad() {\n\t\tthis.trigger(EVENTS.IMAGE_LOADED, {\n\t\t\tcontent: this._image,\n\t\t\tisVideo: this._isVideo,\n\t\t\tprojectionType: this._imageType\n\t\t});\n\t}\n\t_onContentLoad(image) {\n\t\tthis._imageIsReady = true;\n\n\t\tthis._triggerContentLoad();\n\t\treturn true;\n\t}\n\n\tisImageLoaded() {\n\t\treturn !!this._image && this._imageIsReady &&\n\t\t\t(!this._isVideo || this._image.readyState >= 2 /* HAVE_CURRENT_DATA */);\n\t}\n\n\tbindTexture() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._contentLoader) {\n\t\t\t\trej(\"ImageLoader is not initialized\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._contentLoader.get()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis._bindTexture();\n\t\t\t\t}, rej)\n\t\t\t\t.then(res);\n\t\t});\n\t}\n\n\t// 부모 엘리먼트에 canvas 를 붙임\n\tattachTo(parentElement) {\n\t\tthis.detach();\n\t\tparentElement.appendChild(this.canvas);\n\t\tthis._wrapper = parentElement;\n\t}\n\n\tforceContextLoss() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\tconst loseContextExtension = this.context.getExtension(\"WEBGL_lose_context\");\n\n\t\t\tif (loseContextExtension) {\n\t\t\t\tloseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t}\n\n\t// 부모 엘리먼트에서 canvas 를 제거\n\tdetach() {\n\t\tif (this.canvas.parentElement) {\n\t\t\tthis.canvas.parentElement.removeChild(this.canvas);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tthis._animator.stop();\n\t\tthis.detach();\n\t\tthis.forceContextLoss();\n\n\t\tthis.off();\n\n\t\tthis.canvas.removeEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tthis.canvas.removeEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\t}\n\n\thasRenderingContext() {\n\t\tif (!(this.context && !this.context.isContextLost())) {\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tthis.context &&\n\t\t\t!this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t_initShaderProgram() {\n\t\tconst gl = this.context;\n\n\t\tif (this.shaderProgram) {\n\t\t\tgl.deleteProgram(this.shaderProgram);\n\t\t\tthis.shaderProgram = null;\n\t\t}\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst vsSource = renderer.getVertexShaderSource();\n\t\tconst fsSource = renderer.getFragmentShaderSource();\n\n\t\tconst vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource);\n\t\tconst fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource);\n\n\t\tconst shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader);\n\n\t\tif (!shaderProgram) {\n\t\t\tthrow new Error(`Failed to intialize shaders: ${WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())}`);\n\t\t}\n\n\t\tgl.useProgram(shaderProgram);\n\t\tshaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\");\n\t\tgl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);\n\t\tshaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, \"uPMatrix\");\n\t\tshaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, \"uMVMatrix\");\n\t\tshaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, \"uSampler\");\n\t\tshaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, \"aTextureCoord\");\n\t\tshaderProgram.uEye = gl.getUniformLocation(shaderProgram, \"uEye\");\n\n\t\tgl.enableVertexAttribArray(shaderProgram.textureCoordAttribute);\n\n\t\t// clear buffer\n\t\tgl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n\t\t// Use TEXTURE0\n\t\tgl.uniform1i(shaderProgram.samplerUniform, 0);\n\n\t\tthis.shaderProgram = shaderProgram;\n\t}\n\n\t_onWebglcontextlost(e) {\n\t\te.preventDefault();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_LOST);\n\t}\n\n\t_onWebglcontextrestored(e) {\n\t\tthis._initWebGL();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_RESTORE);\n\t}\n\n\tupdateFieldOfView(fieldOfView) {\n\t\tthis.fieldOfView = fieldOfView;\n\t\tthis._updateViewport();\n\t}\n\n\tupdateViewportDimensions(width, height) {\n\t\tlet viewPortChanged = false;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tconst w = width * DEVICE_PIXEL_RATIO;\n\t\tconst h = height * DEVICE_PIXEL_RATIO;\n\n\t\tif (w !== this.canvas.width) {\n\t\t\tthis.canvas.width = w;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (h !== this.canvas.height) {\n\t\t\tthis.canvas.height = h;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (!viewPortChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._updateViewport();\n\t\tthis._shouldForceDraw = true;\n\t}\n\n\t_updateViewport() {\n\t\tmat4.perspective(\n\t\t\tthis.pMatrix,\n\t\t\tglMatrix.toRadian(this.fieldOfView),\n\t\t\tthis.canvas.width / this.canvas.height,\n\t\t\t0.1,\n\t\t\t100);\n\n\t\tthis.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight);\n\t}\n\n\t_initWebGL() {\n\t\tlet gl;\n\n\t\t// TODO: Following code does need to be executed only if width/height, cubicStrip property is changed.\n\t\ttry {\n\t\t\tthis._initRenderingContext();\n\t\t\tgl = this.context;\n\n\t\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\t\tthis._initShaderProgram();\n\t\t} catch (e) {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\tmessage: \"no webgl support\"\n\t\t\t});\n\t\t\tthis.destroy();\n\t\t\tconsole.error(e); // eslint-disable-line no-console\n\t\t\treturn;\n\t\t}\n\t\t// 캔버스를 투명으로 채운다.\n\t\tgl.clearColor(0, 0, 0, 0);\n\t\tconst textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n\n\t\tif (this.texture) {\n\t\t\tgl.deleteTexture(this.texture);\n\t\t}\n\n\t\tthis.texture = WebGLUtils.createTexture(gl, textureTarget);\n\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\t// TODO: Apply following options on other projection type.\n\t\t\tgl.enable(gl.CULL_FACE);\n\t\t\t// gl.enable(gl.DEPTH_TEST);\n\t\t}\n\t}\n\n\t_initRenderingContext() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!window.WebGLRenderingContext) {\n\t\t\tthrow new Error(\"WebGLRenderingContext not available.\");\n\t\t}\n\n\t\tthis.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes);\n\n\t\tif (!this.context) {\n\t\t\tthrow new Error(\"Failed to acquire 3D rendering context\");\n\t\t}\n\t}\n\n\t_initBuffers() {\n\t\tconst vertexPositionData = this._renderer.getVertexPositionData();\n\t\tconst indexData = this._renderer.getIndexData();\n\t\tconst textureCoordData = this._renderer.getTextureCoordData(this._imageConfig);\n\t\tconst gl = this.context;\n\n\t\tthis.vertexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3,\n\t\t\tthis.shaderProgram.vertexPositionAttribute);\n\n\t\tthis.indexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1);\n\n\t\tthis.textureCoordBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2,\n\t\t\tthis.shaderProgram.textureCoordAttribute);\n\n\t\tthis._bindBuffers();\n\t}\n\n\t_bindTexture() {\n\t\t// Detect if it is EAC Format while CUBESTRIP mode.\n\t\t// We assume it is EAC if image is not 3/2 ratio.\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst isEAC = width && height && width / height !== 1.5;\n\n\t\t\tthis.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, \"uIsEAC\"), isEAC);\n\t\t} else if (this._imageType === ImageType.PANORAMA) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst imageAspectRatio = width && height && width / height;\n\n\t\t\tthis._renderer.updateShaderData({imageAspectRatio});\n\t\t}\n\n\t\t// intialize shader buffers after image is loaded.(by updateShaderData)\n\t\t// because buffer may be differ by image size.(eg. CylinderRenderer)\n\t\tthis._initBuffers();\n\n\t\tthis._renderer.bindTexture(\n\t\t\tthis.context,\n\t\t\tthis.texture,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t\tthis._shouldForceDraw = true;\n\n\t\tthis.trigger(EVENTS.BIND_TEXTURE);\n\t}\n\n\t_updateTexture() {\n\t\tthis._renderer.updateTexture(\n\t\t\tthis.context,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t}\n\n\tkeepUpdate(doUpdate) {\n\t\tif (doUpdate && this.isImageLoaded() === false) {\n\t\t\t// Force to draw a frame after image is loaded on render()\n\t\t\tthis._shouldForceDraw = true;\n\t\t}\n\n\t\tthis._keepUpdate = doUpdate;\n\t}\n\n\tstartRender() {\n\t\tthis._animator.setCallback(this._render.bind(this));\n\t\tthis._animator.start();\n\t}\n\n\tstopRender() {\n\t\tthis._animator.stop();\n\t}\n\n\trenderWithQuaternion(quaternion, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\tthis._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) &&\n\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// updatefieldOfView only if fieldOfView is changed.\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tthis.mvMatrix = mat4.fromQuat(mat4.create(), quaternion);\n\n\t\tthis._draw();\n\n\t\tthis._lastQuaternion = quat.clone(quaternion);\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\trenderWithYawPitch(yaw, pitch, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\t\tthis._lastYaw !== null && this._lastYaw === yaw &&\n\t\t\t\tthis._lastPitch !== null && this._lastPitch === pitch &&\n\t\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch));\n\t\tmat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw));\n\n\t\tthis._draw();\n\n\t\tthis._lastYaw = yaw;\n\t\tthis._lastPitch = pitch;\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\t_render() {\n\t\tconst yawPitchControl = this._yawPitchControl;\n\t\tconst fov = yawPitchControl.getFov();\n\n\t\tif (yawPitchControl.shouldRenderWithQuaternion()) {\n\t\t\tconst quaternion = yawPitchControl.getQuaternion();\n\n\t\t\tthis.renderWithQuaternion(quaternion, fov);\n\t\t} else {\n\t\t\tconst yawPitch = yawPitchControl.getYawPitch();\n\n\t\t\tthis.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov);\n\t\t}\n\t}\n\n\t_renderStereo = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\n\t\tconst eyeParams = vr.getEyeParams(gl, frame);\n\n\t\tif (!eyeParams) return;\n\n\t\tvr.beforeRender(gl, frame);\n\n\t\t// Render both eyes\n\t\tfor (const eyeIndex of [0, 1]) {\n\t\t\tconst eyeParam = eyeParams[eyeIndex];\n\n\t\t\tthis.mvMatrix = eyeParam.mvMatrix;\n\t\t\tthis.pMatrix = eyeParam.pMatrix;\n\n\t\t\tgl.viewport(...eyeParam.viewport);\n\t\t\tgl.uniform1f(this.shaderProgram.uEye, eyeIndex);\n\n\t\t\tthis._bindBuffers();\n\t\t\tthis._draw();\n\t\t}\n\n\t\tvr.afterRender();\n\t}\n\n\t_bindBuffers() {\n\t\tconst gl = this.context;\n\t\tconst program = this.shaderProgram;\n\n\t\tconst vertexBuffer = this.vertexBuffer;\n\t\tconst textureCoordBuffer = this.textureCoordBuffer;\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\t\tgl.enableVertexAttribArray(program.vertexPositionAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\n\t\tgl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\t\tgl.enableVertexAttribArray(program.textureCoordAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\t}\n\n\t_draw() {\n\t\tif (this._isVideo && this._keepUpdate) {\n\t\t\tthis._updateTexture();\n\t\t}\n\n\t\tthis._renderer.render({\n\t\t\tgl: this.context,\n\t\t\tshaderProgram: this.shaderProgram,\n\t\t\tindexBuffer: this.indexBuffer,\n\t\t\tmvMatrix: this.mvMatrix,\n\t\t\tpMatrix: this.pMatrix,\n\t\t});\n\t}\n\n\t/**\n\t * Returns projection renderer by each type\n\t */\n\tgetProjectionRenderer() {\n\t\treturn this._renderer;\n\t}\n\n\t/**\n\t * @return Promise\n\t */\n\tenterVR() {\n\t\tconst vr = this._vr;\n\n\t\tif (!WEBXR_SUPPORTED && !navigator.getVRDisplays) {\n\t\t\treturn Promise.reject(\"VR is not available on this browser.\");\n\t\t}\n\t\tif (vr && vr.isPresenting()) {\n\t\t\treturn Promise.resolve(\"VR already enabled.\");\n\t\t}\n\n\t\treturn this._requestPresent();\n\t}\n\n\texitVR = () => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\tif (!vr) return;\n\n\t\tvr.removeEndCallback(this.exitVR);\n\t\tvr.destroy();\n\t\tthis._vr = null;\n\n\t\t// Restore canvas & context on iOS\n\t\tif (IS_IOS) {\n\t\t\tthis._restoreStyle();\n\t\t}\n\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\tthis._updateViewport();\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t\tthis._bindBuffers();\n\t\tthis._shouldForceDraw = true;\n\n\t\tanimator.stop();\n\t\tanimator.setContext(window);\n\t\tanimator.setCallback(this._render.bind(this));\n\t\tanimator.start();\n\t}\n\n\t_requestPresent() {\n\t\tconst gl = this.context;\n\t\tconst canvas = this.canvas;\n\t\tconst animator = this._animator;\n\n\t\tthis._vr = WEBXR_SUPPORTED ?\n\t\t\tnew XRManager() :\n\t\t\tnew VRManager();\n\n\t\tconst vr = this._vr;\n\n\t\tanimator.stop();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvr.requestPresent(canvas, gl)\n\t\t\t\t.then(() => {\n\t\t\t\t\tvr.addEndCallback(this.exitVR);\n\t\t\t\t\tanimator.setContext(vr.context);\n\t\t\t\t\tanimator.setCallback(this._onFirstVRFrame);\n\n\t\t\t\t\tif (IS_IOS) {\n\t\t\t\t\t\tthis._setWrapperFullscreen();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shouldForceDraw = true;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\tresolve(\"success\");\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tvr.destroy();\n\t\t\t\t\tthis._vr = null;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t});\n\t}\n\n\t_onFirstVRFrame = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\t// If rendering is not ready, wait for next frame\n\t\tif (!vr.canRender(frame)) return;\n\n\t\tconst minusZDir = vec3.fromValues(0, 0, -1);\n\t\tconst eyeParam = vr.getEyeParams(gl, frame)[0];\n\t\t// Extract only rotation\n\t\tconst mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix);\n\t\tconst pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix);\n\n\t\tconst mvInv = mat3.invert(mat3.create(), mvMatrix);\n\t\tconst pInv = mat3.invert(mat3.create(), pMatrix);\n\t\tconst viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv);\n\n\t\tvec3.transformMat3(viewDir, viewDir, mvInv);\n\n\t\tconst yawOffset = mathUtil.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1));\n\n\t\tif (yawOffset === 0) {\n\t\t\t// If the yawOffset is exactly 0, then device sensor is not ready\n\t\t\t// So read it again until it has any value in it\n\t\t\treturn;\n\t\t}\n\n\t\tvr.setYawOffset(yawOffset);\n\t\tanimator.setCallback(this._renderStereo);\n\t}\n\n\t_setWrapperFullscreen() {\n\t\tconst wrapper = this._wrapper;\n\n\t\tif (!wrapper) return;\n\n\t\tthis._wrapperOrigStyle = wrapper.getAttribute(\"style\");\n\t\tconst wrapperStyle = wrapper.style;\n\n\t\twrapperStyle.width = \"100vw\";\n\t\twrapperStyle.height = \"100vh\";\n\t\twrapperStyle.position = \"fixed\";\n\t\twrapperStyle.left = \"0\";\n\t\twrapperStyle.top = \"0\";\n\t\twrapperStyle.zIndex = \"9999\";\n\t}\n\n\t_restoreStyle() {\n\t\tconst wrapper = this._wrapper;\n\t\tconst canvas = this.canvas;\n\n\t\tif (!wrapper) return;\n\n\t\tif (this._wrapperOrigStyle) {\n\t\t\twrapper.setAttribute(\"style\", this._wrapperOrigStyle);\n\t\t} else {\n\t\t\twrapper.removeAttribute(\"style\");\n\t\t}\n\n\t\tthis._wrapperOrigStyle = null;\n\n\t\t// Restore canvas style\n\t\tcanvas.removeAttribute(\"style\");\n\t\tthis._setDefaultCanvasStyle();\n\t}\n}\n\nexport default PanoImageRenderer;\n","import Component from \"@egjs/component\";\nimport {glMatrix} from \"gl-matrix\";\nimport {\n\tDeviceMotionEvent, checkXRSupport\n} from \"../utils/browserFeature\";\n\nimport YawPitchControl from \"../YawPitchControl/YawPitchControl\";\nimport PanoImageRenderer from \"../PanoImageRenderer/PanoImageRenderer\";\nimport WebGLUtils from \"../PanoImageRenderer/WebGLUtils\";\nimport {ERROR_TYPE, EVENTS, GYRO_MODE, PROJECTION_TYPE, STEREO_FORMAT} from \"./consts\";\nimport {util as mathUtil} from \"../utils/math-util.js\";\nimport {VERSION} from \"../version\";\n\nclass PanoViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.PanoViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic VERSION = VERSION;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\tstatic EVENTS = EVENTS;\n\tstatic PROJECTION_TYPE = PROJECTION_TYPE;\n\tstatic GYRO_MODE = GYRO_MODE;\n\t// It should be deprecated!\n\tstatic ProjectionType = PROJECTION_TYPE;\n\tstatic STEREO_FORMAT = STEREO_FORMAT;\n\t/**\n\t * Constant value for touch directions\n\t * @ko 터치 방향에 대한 상수 값.\n\t * @namespace\n\t * @name TOUCH_DIRECTION\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic TOUCH_DIRECTION = {\n\t\t/**\n\t\t * Constant value for none direction.\n\t\t * @ko none 방향에 대한 상수 값.\n\t\t * @name NONE\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 1\n\t\t */\n\t\tNONE: YawPitchControl.TOUCH_DIRECTION_NONE,\n\t\t/**\n\t\t * Constant value for horizontal(yaw) direction.\n\t\t * @ko horizontal(yaw) 방향에 대한 상수 값.\n\t\t * @name YAW\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 6\n\t\t */\n\t\tYAW: YawPitchControl.TOUCH_DIRECTION_YAW,\n\t\t/**\n\t\t * Constant value for vertical direction.\n\t\t * @ko vertical(pitch) 방향에 대한 상수 값.\n\t\t * @name PITCH\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 24\n\t\t */\n\t\tPITCH: YawPitchControl.TOUCH_DIRECTION_PITCH,\n\t\t/**\n\t\t * Constant value for all direction.\n\t\t * @ko all 방향에 대한 상수 값.\n\t\t * @name ALL\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 30\n\t\t */\n\t\tALL: YawPitchControl.TOUCH_DIRECTION_ALL\n\t};\n\n\t/**\n\t * @classdesc 360 media viewer\n\t * @ko 360 미디어 뷰어\n\t * @class\n\t * @name eg.view360.PanoViewer\n\t * @extends eg.Component\n\t *\n\t * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트\n\t * @param {Object} config\n\t *\n\t * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
\n\t * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.\n\t * @param {Object} [config.cubemapConfig.order = \"RLUDBF\"(ProjectionType === CUBEMAP) | \"RLUDFB\" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서\n\t * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.\n\t * @param {String} [config.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
\n\t * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위)\n\t * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위)\n\t *\n\t * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위)\n\t * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위)\n\t * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위)\n\t * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다\n\t * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다.\n\t * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE}
\n\t * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위\n\t * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위\n\t * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위\n\t * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
\n\t *\n\t * @example\n\t * // PanoViewer Creation\n\t * // create PanoViewer with option\n\t * var PanoViewer = eg.view360.PanoViewer;\n\t * // Area where the image will be displayed(HTMLElement)\n\t * var container = document.getElementById(\"myPanoViewer\");\n\t *\n\t * var panoViewer = new PanoViewer(container, {\n\t * // If projectionType is not specified, the default is \"equirectangular\".\n\t * // Specifies an image of the \"equirectangular\" type.\n\t * image: \"/path/to/image/image.jpg\"\n\t *});\n\t *\n\t * @example\n\t * // Cubemap Config Setting Example\n\t * // For support Youtube EAC projection, You should set cubemapConfig as follows.\n\t * cubemapConfig: {\n\t * \torder: \"LFRDBU\",\n\t * \ttileConfig: [\n\t * \t\ttileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}]\n\t * \t]\n\t * }\n\t */\n\tconstructor(container, options = {}) {\n\t\tsuper();\n\n\t\t// Raises the error event if webgl is not supported.\n\t\tif (!WebGLUtils.isWebGLAvailable()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\t\tmessage: \"no webgl support\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!WebGLUtils.isStableWebGL()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_DEVICE,\n\t\t\t\t\tmessage: \"blacklisted browser\"\n\t\t\t\t});\n\t\t\t}, 0);\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!!options.image && !!options.video) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_RESOURCE,\n\t\t\t\t\tmessage: \"Specifying multi resouces(both image and video) is not valid.\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\t// Check XR support at not when imported, but when created.\n\t\t// This is intended to make polyfills easier to use.\n\t\tcheckXRSupport();\n\n\t\tthis._container = container;\n\t\tthis._image = options.image || options.video;\n\t\tthis._isVideo = !!options.video;\n\t\tthis._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\tthis._cubemapConfig = Object.assign({\n\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/\n\t\t\torder: this._projectionType === PROJECTION_TYPE.CUBEMAP ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, options.cubemapConfig);\n\t\tthis._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\n\t\t// If the width and height are not provided, will use the size of the container.\n\t\tthis._width = options.width || parseInt(window.getComputedStyle(container).width, 10);\n\t\tthis._height = options.height || parseInt(window.getComputedStyle(container).height, 10);\n\n\t\t/**\n\t\t * Cache the direction for the performance in renderLoop\n\t\t *\n\t\t * This value should be updated by \"change\" event of YawPitchControl.\n\t\t */\n\t\tthis._yaw = options.yaw || 0;\n\t\tthis._pitch = options.pitch || 0;\n\t\tthis._fov = options.fov || 65;\n\n\t\tthis._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH;\n\t\tthis._quaternion = null;\n\n\t\tthis._aspectRatio = this._height !== 0 ? this._width / this._height : 1;\n\t\tconst fovRange = options.fovRange || [30, 110];\n\t\tconst touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ?\n\t\t\toptions.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL;\n\t\tconst yawPitchConfig = Object.assign(options, {\n\t\t\telement: container,\n\t\t\tyaw: this._yaw,\n\t\t\tpitch: this._pitch,\n\t\t\tfov: this._fov,\n\t\t\tgyroMode: this._gyroMode,\n\t\t\tfovRange,\n\t\t\taspectRatio: this._aspectRatio,\n\t\t\ttouchDirection\n\t\t});\n\n\t\tthis._isReady = false;\n\n\t\tthis._initYawPitchControl(yawPitchConfig);\n\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t}\n\n\t/**\n\t * Get the video element that the viewer is currently playing. You can use this for playback.\n\t * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다.\n\t * @method eg.view360.PanoViewer#getVideo\n\t * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement\n\t * @example\n\t * var videoTag = panoViewer.getVideo();\n\t * videoTag.play(); // play video!\n\t */\n\tgetVideo() {\n\t\tif (!this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the video information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setVideo\n\t * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정)\n\t * @param {Object} param\n\t * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}(\"equirectangular\")] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setVideo(\"/path/to/video/video.mp4\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR\n\t * });\n\t */\n\tsetVideo(video, param = {}) {\n\t\tif (video) {\n\t\t\tthis.setImage(video, {\n\t\t\t\tprojectionType: param.projectionType,\n\t\t\t\tisVideo: true,\n\t\t\t\tcubemapConfig: param.cubemapConfig,\n\t\t\t\tstereoFormat: param.stereoFormat\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the image information that the viewer is currently using.\n\t * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다.\n\t * @method eg.view360.PanoViewer#getImage\n\t * @return {Image} Image Object이미지 객체\n\t * @example\n\t * var imageObj = panoViewer.getImage();\n\t */\n\tgetImage() {\n\t\tif (this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the image information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setImage\n\t * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.)\n\t * @param {Object} param Additional information이미지 추가 정보\n\t * @param {String} [param.projectionType=\"equirectangular\"] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setImage(\"/path/to/image/image.png\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP\n\t * });\n\t */\n\tsetImage(image, param = {}) {\n\t\tconst cubemapConfig = Object.assign({\n\t\t\torder: \"RLUDBF\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, param.cubemapConfig);\n\t\tconst stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\t\tconst isVideo = !!(param.isVideo);\n\n\t\tif (this._image && this._isVideo !== isVideo) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.warn(\"Currently not supporting to change content type(Image <--> Video)\");\n\t\t\t/* eslint-enable no-console */\n\t\t\treturn this;\n\t\t}\n\n\t\tif (image) {\n\t\t\tthis._image = image;\n\t\t\tthis._isVideo = isVideo;\n\t\t\tthis._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\t\tthis._cubemapConfig = cubemapConfig;\n\t\t\tthis._stereoFormat = stereoFormat;\n\n\t\t\tthis._deactivate();\n\t\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set whether the renderer always updates the texture and renders.\n\t * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다.\n\t *\n\t * @method eg.view360.PanoViewer#keepUpdate\n\t * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다.\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tkeepUpdate(doUpdate) {\n\t\tthis._photoSphereRenderer.keepUpdate(doUpdate);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get projection type (equirectangular/cube)\n\t * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#getProjectionType\n\t * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE}\n\t */\n\tgetProjectionType() {\n\t\treturn this._projectionType;\n\t}\n\n\t/**\n\t * Activate the device's motion sensor, and return the Promise whether the sensor is enabled\n\t * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element.\n\t * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다.\n\t * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * @method eg.view360.PanoViewer#enableSensor\n\t * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다.\n\t */\n\tenableSensor() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\") {\n\t\t\t\tDeviceMotionEvent.requestPermission().then(permissionState => {\n\t\t\t\t\tif (permissionState === \"granted\") {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(new Error(\"permission denied\"));\n\t\t\t\t\t}\n\t\t\t\t}).catch(e => {\n\t\t\t\t\t// This can happen when this method wasn't triggered by user interaction\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disable the device's motion sensor.\n\t * @ko 디바이스의 모션 센서를 비활성화합니다.\n\t * @deprecated\n\t * @method eg.view360.PanoViewer#disableSensor\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdisableSensor() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred).\n\t * This method must be used in the context of user interaction, like onclick callback on the button element.\n\t * It can be rejected when an enabling device sensor fails or image/video is still loading(\"ready\" event not triggered).\n\t * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다)\n\t * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우(\"ready\"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다.\n\t * @method eg.view360.PanoViewer#enterVR\n\t * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error)\n\t */\n\tenterVR() {\n\t\tif (!this._isReady) {\n\t\t\treturn Promise.reject(new Error(\"PanoViewer is not ready to show image.\"));\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.enableSensor()\n\t\t\t\t.then(() => this._photoSphereRenderer.enterVR())\n\t\t\t\t.then(res => resolve(res))\n\t\t\t\t.catch(e => reject(e));\n\t\t});\n\t}\n\n\t/**\n\t * Exit VR stereo rendering mode.\n\t * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#exitVR\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\texitVR() {\n\t\tthis._photoSphereRenderer.exitVR();\n\t\treturn this;\n\t}\n\n\t// TODO: Remove parameters as they're just using private values\n\t_initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) {\n\t\tthis._photoSphereRenderer = new PanoImageRenderer(\n\t\t\tthis._image,\n\t\t\tthis._width,\n\t\t\tthis._height,\n\t\t\tthis._isVideo,\n\t\t\t{\n\t\t\t\tinitialYaw: yaw,\n\t\t\t\tinitialPitch: pitch,\n\t\t\t\tfieldOfView: fov,\n\t\t\t\timageType: projectionType,\n\t\t\t\tcubemapConfig,\n\t\t\t\tstereoFormat: this._stereoFormat\n\t\t\t},\n\t\t);\n\t\tthis._photoSphereRenderer.setYawPitchControl(this._yawPitchControl);\n\n\t\tthis._bindRendererHandler();\n\n\t\tthis._photoSphereRenderer\n\t\t\t.bindTexture()\n\t\t\t.then(() => this._activate())\n\t\t\t.catch(() => {\n\t\t\t\tthis._triggerEvent(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.FAIL_BIND_TEXTURE,\n\t\t\t\t\tmessage: \"failed to bind texture\"\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * update values of YawPitchControl if needed.\n\t * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image.\n\t *\n\t * This function should be called after isReady status is true.\n\t */\n\t_updateYawPitchIfNeeded() {\n\t\tif (this._projectionType === PanoViewer.ProjectionType.PANORAMA) {\n\t\t\t// update fov by aspect ratio\n\t\t\tconst image = this._photoSphereRenderer.getContent();\n\t\t\tlet imageAspectRatio = image.naturalWidth / image.naturalHeight;\n\t\t\tlet isCircular;\n\t\t\tlet yawSize;\n\t\t\tlet maxFov;\n\n\t\t\t// If height is larger than width, then we assume it's rotated by 90 degree.\n\t\t\tif (imageAspectRatio < 1) {\n\t\t\t\t// So inverse the aspect ratio.\n\t\t\t\timageAspectRatio = 1 / imageAspectRatio;\n\t\t\t}\n\n\t\t\tif (imageAspectRatio < 6) {\n\t\t\t\tyawSize = mathUtil.toDegree(imageAspectRatio);\n\t\t\t\tisCircular = false;\n\t\t\t\t// 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5\n\t\t\t\tmaxFov = mathUtil.toDegree(Math.atan(0.5)) * 2;\n\t\t\t} else {\n\t\t\t\tyawSize = 360;\n\t\t\t\tisCircular = true;\n\t\t\t\tmaxFov = (360 / imageAspectRatio); // Make it 5 fixed as axes does.\n\t\t\t}\n\n\t\t\t// console.log(\"_updateYawPitchIfNeeded\", maxFov, \"aspectRatio\", image.naturalWidth, image.naturalHeight, \"yawSize\", yawSize);\n\t\t\tconst minFov = (this._yawPitchControl.option(\"fovRange\"))[0];\n\n\t\t\t// this option should be called after fov is set.\n\t\t\tthis._yawPitchControl.option({\n\t\t\t\t\"fov\": maxFov, /* parameter for internal validation for pitchrange */\n\t\t\t\t\"yawRange\": [-yawSize / 2, yawSize / 2],\n\t\t\t\tisCircular,\n\t\t\t\t\"pitchRange\": [-maxFov / 2, maxFov / 2],\n\t\t\t\t\"fovRange\": [minFov, maxFov]\n\t\t\t});\n\t\t\tthis.lookAt({fov: maxFov});\n\t\t}\n\t}\n\n\t_bindRendererHandler() {\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, e);\n\t\t});\n\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, e => {\n\t\t\tthis._deactivate();\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERING_CONTEXT_LOST,\n\t\t\t\tmessage: \"webgl rendering context lost\"\n\t\t\t});\n\t\t});\n\t}\n\n\t_initYawPitchControl(yawPitchConfig) {\n\t\tthis._yawPitchControl = new YawPitchControl(yawPitchConfig);\n\n\t\tthis._yawPitchControl.on(EVENTS.ANIMATION_END, e => {\n\t\t\tthis._triggerEvent(EVENTS.ANIMATION_END, e);\n\t\t});\n\n\t\tthis._yawPitchControl.on(\"change\", e => {\n\t\t\tthis._yaw = e.yaw;\n\t\t\tthis._pitch = e.pitch;\n\t\t\tthis._fov = e.fov;\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis._triggerEvent(EVENTS.VIEW_CHANGE, e);\n\t\t});\n\t}\n\n\t_triggerEvent(name, param) {\n\t\tconst evt = param || {};\n\n\t\t/**\n\t\t * Events that is fired when error occurs\n\t\t * @ko 에러 발생 시 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#error\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.type Error type\n\t\t * \t\t10: INVALID_DEVICE: Unsupported device\n\t\t * \t\t11: NO_WEBGL: Webgl not support\n\t\t * \t\t12, FAIL_IMAGE_LOAD: Failed to load image\n\t\t * \t\t13: FAIL_BIND_TEXTURE: Failed to bind texture\n\t\t * \t\t14: INVALID_RESOURCE: Only one resource(image or video) should be specified\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost occurred\n\t\t * 에러 종류\n\t\t * \t\t10: INVALID_DEVICE: 미지원 기기\n\t\t * \t\t11: NO_WEBGL: WEBGL 미지원\n\t\t * \t\t12, FAIL_IMAGE_LOAD: 이미지 로드 실패\n\t\t * \t\t13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패\n\t\t * \t\t14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost 발생\n\t\t * \n\t\t * @param {String} param.message Error message 에러 메시지\n\t\t * @see {@link eg.view360.PanoViewer.ERROR_TYPE}\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"error\" : function(evt) {\n\t\t *\t\t// evt.type === 13\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t *\n\t\t * // constant can be used\n\t\t * viwer.on({\n\t\t *\teg.view360.PanoViewer.EVENTS.ERROR : function(evt) {\n\t\t *\t\t// evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when PanoViewer is ready to go.\n\t\t * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#ready\n\t\t * @event\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"ready\" : function(evt) {\n\t\t *\t\t// PanoViewer is ready to show image and handle user interaction.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when direction or fov is changed.\n\t\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#viewChange\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.yaw yawyaw\n\t\t * @param {Number} param.pitch pitch pitch\n\t\t * @param {Number} param.fov Field of view (fov) 화각\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"viewChange\" : function(evt) {\n\t\t *\t\t//evt.yaw, evt.pitch, evt.fov is available.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when animation which is triggered by inertia is ended.\n\t\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#animationEnd\n\t\t * @event\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"animationEnd\" : function(evt) {\n\t\t *\t\t// animation is ended.\n\t\t * });\n\t\t */\n\t\treturn this.trigger(name, evt);\n\t}\n\n\t/**\n\t * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}.\n\t * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다.\n\t * @method eg.view360.PanoViewer#setUseZoom\n\t * @param {Boolean} useZoom\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseZoom(useZoom) {\n\t\ttypeof useZoom === \"boolean\" && this._yawPitchControl.option(\"useZoom\", useZoom);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * When true, enables the keyboard move key control: awsd, arrow keys\n\t * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키)\n\t * @method eg.view360.PanoViewer#setUseKeyboard\n\t * @param {Boolean} useKeyboard\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseKeyboard(useKeyboard) {\n\t\tthis._yawPitchControl.option(\"useKeyboard\", useKeyboard);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")\n\t * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")\n\t * @method eg.view360.PanoViewer#setGyroMode\n\t * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE}\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setGyroMode(\"yawPitch\");\n\t * //equivalent\n\t * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH);\n\t */\n\tsetGyroMode(gyroMode) {\n\t\tthis._yawPitchControl.option(\"gyroMode\", gyroMode);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setFovRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setFovRange([50, 90]);\n\t */\n\tsetFovRange(range) {\n\t\tthis._yawPitchControl.option(\"fovRange\", range);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Getting the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFovRange\n\t * @return {Array}\n\t * @example\n\t * var range = panoViewer.getFovRange(); //[50, 90]\n\t */\n\tgetFovRange() {\n\t\treturn this._yawPitchControl.option(\"fovRange\");\n\t}\n\n\t/**\n\t * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size.\n\t * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다.\n\t * @method eg.view360.PanoViewer#updateViewportDimensions\n\t * @param {Object} [size]\n\t * @param {Number} [size.width=width of container]\n\t * @param {Number} [size.height=height of container]\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tupdateViewportDimensions(size = {width: undefined, height: undefined}) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet containerSize;\n\n\t\tif (size.width === undefined || size.height === undefined) {\n\t\t\tcontainerSize = window.getComputedStyle(this._container);\n\t\t}\n\n\t\tconst width = size.width || parseInt(containerSize.width, 10);\n\t\tconst height = size.height || parseInt(containerSize.height, 10);\n\n\t\t// Skip if viewport is not changed.\n\t\tif (width === this._width && height === this._height) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tthis._aspectRatio = width / height;\n\t\tthis._photoSphereRenderer.updateViewportDimensions(width, height);\n\t\tthis._yawPitchControl.option(\"aspectRatio\", this._aspectRatio);\n\t\tthis._yawPitchControl.updatePanScale({height});\n\n\t\tthis.lookAt({}, 0);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the current field of view(FOV)\n\t * @ko 현재 field of view(FOV) 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFov\n\t * @return {Number}\n\t */\n\tgetFov() {\n\t\treturn this._fov;\n\t}\n\n\t/**\n\t * Get the horizontal field of view in degree\n\t */\n\t_getHFov() {\n\t\treturn mathUtil.toDegree(\n\t\t\t2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2)));\n\t}\n\n\t/**\n\t * Get current yaw value\n\t * @ko 현재 yaw 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYaw\n\t * @return {Number}\n\t */\n\tgetYaw() {\n\t\treturn this._yaw;\n\t}\n\n\t/**\n\t * Get current pitch value\n\t * @ko 현재 pitch 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getPitch\n\t * @return {Number}\n\t */\n\tgetPitch() {\n\t\treturn this._pitch;\n\t}\n\n\t/**\n\t * Get the range of controllable Yaw values\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYawRange\n\t * @return {Array}\n\t */\n\tgetYawRange() {\n\t\treturn this._yawPitchControl.option(\"yawRange\");\n\t}\n\n\t/**\n\t * Get the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다.\n\t * @method eg.view360.PanoViewer#getPitchRange\n\t * @return {Array}\n\t */\n\tgetPitchRange() {\n\t\treturn this._yawPitchControl.option(\"pitchRange\");\n\t}\n\n\t/**\n\t * Set the range of controllable yaw\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#setYawRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setYawRange([-90, 90]);\n\t */\n\tsetYawRange(yawRange) {\n\t\tthis._yawPitchControl.option(\"yawRange\", yawRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setPitchRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setPitchRange([-40, 40]);\n\t */\n\tsetPitchRange(pitchRange) {\n\t\tthis._yawPitchControl.option(\"pitchRange\", pitchRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed.\n\t * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다.\n\t * @method eg.view360.PanoViewer#setShowPolePoint\n\t * @param {Boolean} showPolePoint\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetShowPolePoint(showPolePoint) {\n\t\tthis._yawPitchControl.option(\"showPolePoint\", showPolePoint);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a new view by setting camera configuration. Any parameters not specified remain the same.\n\t * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다.\n\t * @method eg.view360.PanoViewer#lookAt\n\t * @param {Object} orientation\n\t * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위)\n\t * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위)\n\t * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위)\n\t * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초)\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * // Change the yaw angle (absolute angle) to 30 degrees for one second.\n\t * panoViewer.lookAt({yaw: 30}, 1000);\n\t */\n\tlookAt(orientation, duration) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw;\n\t\tconst pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch;\n\t\tconst pitchRange = this._yawPitchControl.option(\"pitchRange\");\n\t\tconst verticalAngleOfImage = pitchRange[1] - pitchRange[0];\n\t\tlet fov = orientation.fov !== undefined ? orientation.fov : this._fov;\n\n\t\tif (verticalAngleOfImage < fov) {\n\t\t\tfov = verticalAngleOfImage;\n\t\t}\n\n\t\tthis._yawPitchControl.lookAt({yaw, pitch, fov}, duration);\n\n\t\tif (duration === 0) {\n\t\t\tthis._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_activate() {\n\t\tthis._photoSphereRenderer.attachTo(this._container);\n\t\tthis._yawPitchControl.enable();\n\n\t\tthis.updateViewportDimensions();\n\n\t\tthis._isReady = true;\n\n\t\t// update yawPitchControl after isReady status is true.\n\t\tthis._updateYawPitchIfNeeded();\n\n\t\tthis._triggerEvent(EVENTS.READY);\n\t\tthis._photoSphereRenderer.startRender();\n\t}\n\n\t/**\n\t * Destroy webgl context and block user interaction and stop rendering\n\t */\n\t_deactivate() {\n\t\tif (this._isReady) {\n\t\t\tthis._photoSphereRenderer.stopRender();\n\t\t\tthis._yawPitchControl.disable();\n\t\t\tthis._isReady = false;\n\t\t}\n\n\t\tif (this._photoSphereRenderer) {\n\t\t\tthis._photoSphereRenderer.destroy();\n\t\t\tthis._photoSphereRenderer = null;\n\t\t}\n\t}\n\n\tstatic _isValidTouchDirection(direction) {\n\t\treturn direction === PanoViewer.TOUCH_DIRECTION.NONE ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.YAW ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.PITCH ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.ALL;\n\t}\n\n\t/**\n\t * Set touch direction by which user can control.\n\t * @ko 사용자가 조작가능한 터치 방향을 지정합니다.\n\t * @method eg.view360.PanoViewer#setTouchDirection\n\t * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @return {eg.view360.PanoViewer} PanoViewer instance\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Limit the touch direction to the yaw direction only.\n\t * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW);\n\t */\n\tsetTouchDirection(direction) {\n\t\tif (PanoViewer._isValidTouchDirection(direction)) {\n\t\t\tthis._yawPitchControl.option(\"touchDirection\", direction);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns touch direction by which user can control\n\t * @ko 사용자가 조작가능한 터치 방향을 반환한다.\n\t * @method eg.view360.PanoViewer#getTouchDirection\n\t * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Returns the current touch direction.\n\t * var dir = panoViewer.getTouchDirection();\n\t */\n\tgetTouchDirection() {\n\t\treturn this._yawPitchControl.option(\"touchDirection\");\n\t}\n\n\t/**\n\t * Destroy viewer. Remove all registered event listeners and remove viewer canvas.\n\t * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다.\n\t * @method eg.view360.PanoViewer#destroy\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdestroy() {\n\t\tthis._deactivate();\n\n\t\tif (this._yawPitchControl) {\n\t\t\tthis._yawPitchControl.destroy();\n\t\t\tthis._yawPitchControl = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check whether the current environment can execute PanoViewer\n\t * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다.\n\t * @function isSupported\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부\n\t * @static\n\t */\n\tstatic isSupported() {\n\t\treturn WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the WebGL\n\t * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다.\n\t * @function isWebGLAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} WebGL support WebGL 지원여부\n\t * @static\n\t */\n\tstatic isWebGLAvailable() {\n\t\treturn WebGLUtils.isWebGLAvailable();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the gyro sensor.\n\t * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다.\n\t * @function isGyroSensorAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수\n\t * @static\n\t */\n\tstatic isGyroSensorAvailable(callback) {\n\t\tif (!DeviceMotionEvent) {\n\t\t\tcallback && callback(false);\n\t\t\treturn;\n\t\t}\n\n\t\tlet onDeviceMotionChange;\n\n\t\tfunction checkGyro() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tonDeviceMotionChange = function(deviceMotion) {\n\t\t\t\t\tconst isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null);\n\n\t\t\t\t\tres(isGyroSensorAvailable);\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener(\"devicemotion\", onDeviceMotionChange);\n\t\t\t});\n\t\t}\n\n\t\tfunction timeout() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tsetTimeout(() => res(false), 1000);\n\t\t\t});\n\t\t}\n\n\t\tPromise.race([checkGyro(), timeout()]).then(isGyroSensorAvailable => {\n\t\t\twindow.removeEventListener(\"devicemotion\", onDeviceMotionChange);\n\n\t\t\tcallback && callback(isGyroSensorAvailable);\n\n\t\t\tPanoViewer.isGyroSensorAvailable = function(fb) {\n\t\t\t\tfb && fb(isGyroSensorAvailable);\n\t\t\t\treturn isGyroSensorAvailable;\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport default PanoViewer;\n"],"names":["this","require","global","win","window","Math","self","Function","doc","document","agent","getAgent","osName","os","name","browserName","browser","IS_IOS","IS_SAFARI_ON_DESKTOP","Float32Array","Array","getComputedStyle","userAgent","navigator","SUPPORT_TOUCH","SUPPORT_DEVICEMOTION","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","i","len","length","SUPPORT_WILLCHANGE","CSS","supports","WEBXR_SUPPORTED","checkXRSupport","xr","isSessionSupported","then","res","supportsSession","quatToVec3","quaternion","baseV","vec3","fromValues","transformQuat","toDegree","a","PI","util","isPowerOfTwo","n","extractPitchFromQuat","atan2","sqrt","pow","hypot","x","y","ROTATE_CONSTANT","PITCH_DELTA","YAW_DELTA_BY_ROLL","YAW_DELTA_BY_YAW","targetAxis","meshPoint","getRotationDelta","prevQ","curQ","rotateKind","prevQuaternion","quat","clone","curQuaternion","normalize","prevPoint","curPoint","rotateDistance","dot","cross","create","rotateDirection","meshPoint2","meshPoint3","vecU","vecV","vecN","coefficientA","coefficientB","coefficientC","distance","abs","projectedPrevPoint","subtract","scale","trigonometricRatio","theta","acos","crossVec","thetaDirection","deltaRadian","angleBetweenVec2","v1","v2","det","vec2","yawOffsetBetween","viewDir","targetDir","viewDirXZ","targetDirXZ","toAxis","source","offset","reduce","acc","v","MathUtil","Util","version","branch","build","match","exec","parseInt","CHROME_VERSION","IS_CHROME_WITHOUT_DEVICE_MOTION","IS_ANDROID","test","CONTROL_MODE_VR","CONTROL_MODE_YAWPITCH","TOUCH_DIRECTION_NONE","TOUCH_DIRECTION_YAW","TOUCH_DIRECTION_PITCH","TOUCH_DIRECTION_ALL","MC_DECELERATION","MC_MAXIMUM_DURATION","MC_BIND_SCALE","MAX_FIELD_OF_VIEW","PAN_SCALE","YAW_RANGE_HALF","PITCH_RANGE_HALF","CIRCULAR_PITCH_RANGE_HALF","GYRO_MODE","NONE","YAWPITCH","VR","STILLNESS_THRESHOLD","DeviceMotion","_onDeviceMotion","bind","_onDeviceOrientation","_onChromeWithoutDeviceMotion","isWithoutDeviceMotion","isAndroid","stillGyroVec","rawGyroVec","adjustedGyroVec","_timer","lastDevicemotionTimestamp","_isEnabled","enable","e","alpha","beta","gamma","trigger","inputEvent","deviceorientation","clearTimeout","setTimeout","Date","getTime","copy","isGyroSensorAvailable","rotationRate","isGravitySensorAvailable","accelerationIncludingGravity","interval","devicemotionEvent","timeStamp","type","z","acceleration","set","adjustedRotationRate","addEventListener","disable","removeEventListener","Component","SensorSample","ComplementaryFilter","prototype","run_","isOrientationInitialized","accelQ","accelToQuaternion_","currentAccelMeasurement","sample","previousFilterQ","deltaT","currentGyroMeasurement","timestampS","previousGyroMeasurement","gyroDeltaQ","gyroToQuaternionDelta_","gyroIntegralQ","multiply","filterQ","invFilterQ","Quaternion","inverse","estimatedGravity","applyQuaternion","measuredGravity","deltaQ","setFromUnitVectors","targetQ","slerp","kFilter","isFilterQuaternionInitialized","getOrientation","K_FILTER","PREDICTION_TIME_S","FusionPoseSensor","deviceMotion","accelerometer","Vector3","gyroscope","_onDeviceMotionChange","_onScreenOrientationChange","filter","posePredictor","PosePredictor","filterToWorldQ","isFirefoxAndroid","isIOS","isChromeUsingDegrees","setFromAxisAngle","inverseWorldToScreenQ","worldToScreenQ","originalPoseAdjustQ","orientation","_setScreenTransform","isLandscapeMode","resetQ","on","isEnabled","destroy","_triggerChange","_prevOrientation","equals","_deviceOrientationQ","deviceOrientationFixQ","_alpha","out","multiplyQuaternions","out_","w","_convertFusionToPredicted","predictedQ","getPrediction","previousTimestampS","accGravity","rotRate","setFromEulerYXZ","multiplyScalar","addAccelMeasurement","addGyroMeasurement","screenOrientation","getDeltaYaw","prvQ","yawDeltaByYaw","yawDeltaByRoll","sin","getDeltaPitch","pitchDelta","TiltMotionInput","el","options","element","_prevQuaternion","_quaternion","fusionPoseSensor","threshold","_onPoseChange","mapAxes","axes","connect","observer","_attachEvent","disconnect","_dettachEvent","event","change","off","screenRotationAngleInst","refCount","ScreenRotationAngle","_onOrientationChange","_spinR","_screenOrientationAngle","betaR","glMatrix","toRadian","gammaR","cos","screen","angle","undefined","getRadian","unref","RotationPanInput","_useRotation","_screenRotationAngle","setUseRotation","useRotation","_userDirection","Axes","DIRECTION_ALL","_direction","DIRECTION_HORIZONTAL","getOffset","properties","useDirection","newOffset","cosTheta","sinTheta","DIRECTION_VERTICAL","PanInput","Y_AXIS_VECTOR","DeviceQuaternion","_fusionPoseSensor","isTrusted","getCombinedQuaternion","yaw","yawQ","setAxisAngle","conj","conjugate","outQ","VERSION","DEFAULT_YAW_RANGE","DEFAULT_PITCH_RANGE","CIRCULAR_PITCH_RANGE","YawPitchControl","opt","pitch","fov","showPolePoint","useZoom","useKeyboard","gyroMode","touchDirection","yawRange","pitchRange","fovRange","aspectRatio","_element","_initialFov","_enabled","_isAnimating","_deviceQuaternion","_initAxes","option","yRange","_updateYawRange","pRange","_updatePitchRange","axesPanInput","axesWheelInput","WheelInput","axesTiltMotionInput","axesPinchInput","PinchInput","axesMoveKeyInput","MoveKeyInput","range","circular","isCircular","bounce","deceleration","maximumDuration","hold","evt","delta","_updateControlScale","updatePanScale","release","animationStart","animationEnd","param","get","areaHeight","height","args","argLen","_getOptions","beforeOptions","newOptions","changedKeyList","Object","keys","push","_setOptions","_getValidatedOptions","_applyOptions","_getValidYawRange","_getValidPitchRange","key","value","arguments","prevOptions","isVR","isYawPitch","some","indexOf","setTo","prevFov","nextFov","axis","_initDeviceQuaternion","_togglePinchInputByOption","_enableTouch","_inputs","direction","yawEnabled","pitchEnabled","newYawRange","newFov","newAspectRatio","ratio","adjustAspectRatio","horizontalFov","isValid","newPitchRange","changeEvt","pos","p","verticalAngle","halfFov","isPanorama","concat","horizontalAngle","halfHorizontalFov","mathUtil","tan","targetElement","input","inputRange","outputRange","rangeIdx","inputA","inputB","outputA","outputB","lerp","b","fraction","persistOrientation","_resetOrientation","lookAt","duration","f","Infinity","setBy","getYawPitch","yawPitch","getFov","getQuaternion","shouldRenderWithQuaternion","axisPanInput","axesDeviceOrientationInput","STATUS","EVENT","ImageLoader","image","_image","_onceHandlers","_loadStatus","rej","LOADED","getElement","LOADING","isMaybeLoaded","READYSTATECHANGE","createElement","onceLoaded","ERROR","images","map","img","_img","Image","crossOrigin","src","result","complete","naturalWidth","onload","onerror","targets","targetsNotLoaded","loadPromises","_once","all","reason","listener","fn","getStatus","forEach","handler","READY_STATUS","HAVE_NOTHING","HAVE_METADATA","HAVE_CURRENT_DATA","HAVE_FUTURE_DATA","HAVE_ENOUGH_DATA","LOADING_FAILED","READYSTATECHANGE_EVENT_NAME","VideoLoader","video","_handlers","_sourceCount","_thresholdReadyState","_thresholdEventName","readyState","_onerror","_errorCount","_detachErrorHandler","_appendSourceElement","videoUrl","videoSrc","videoType","sourceElement","_video","appendChild","_reset","HTMLVideoElement","setAttribute","querySelectorAll","load","_attachErrorHandler","_sources","call","rejector","WEBGL_ERROR_CODE","webglAvailability","MAX_TEXTURE_SIZE_FOR_TEST","WebGLUtils","createShader","gl","shader","shaderSource","compileShader","success","getShaderParameter","COMPILE_STATUS","console","error","getShaderInfoLog","createProgram","vertexShader","fragmentShader","program","attachShader","linkProgram","detachShader","deleteShader","getProgramParameter","LINK_STATUS","deleteProgram","initBuffer","data","itemSize","attr","buffer","createBuffer","bindBuffer","bufferData","STATIC_DRAW","numItems","enableVertexAttribArray","vertexAttribPointer","FLOAT","getWebglContext","canvas","userContextAttributes","webglIdentifiers","context","contextAttributes","preserveDrawingBuffer","antialias","xrCompatible","onWebglcontextcreationerror","statusMessage","getContext","t","createTexture","textureTarget","texture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","isWebGLAvailable","webglContext","loseContextExtension","getExtension","loseContext","isStableWebGL","agentInfo","isStableWebgl","parseFloat","getErrorNameFromWebGLErrorCode","code","texImage2D","pixels","RGBA","UNSIGNED_BYTE","getMaxTextureSize","getParameter","MAX_TEXTURE_SIZE","Agent","isIE11","majorVersion","EVENTS","Renderer","_forceDimension","_pixelCanvas","_pixelContext","render","shaderProgram","indexBuffer","mvMatrix","pMatrix","uniformMatrix4fv","pMatrixUniform","mvMatrixUniform","drawElements","TRIANGLES","UNSIGNED_SHORT","getDimension","pixelSource","width","videoWidth","naturalHeight","videoHeight","updateShaderData","_initPixelSource","forceDimension","isIE11Video","_getPixelSource","contentDimension","textureDimension","drawImage","_extractTileConfig","imageConfig","tileConfig","isArray","config","flipHorizontal","rotation","_triggerError","message","CubeRenderer","getVertexPositionData","_VERTEX_POSITION_DATA","getIndexData","_INDEX_DATA","indexData","vertexPositionData","extractOrder","order","getTextureCoordData","vertexOrder","base","elemSize","vertexPerTile","textureCoordData","split","face","ordermap_","r","shift","unshift","pop","elemPerTile","tileVertex","slice","tileTemp","j","splice","join","getVertexShaderSource","getFragmentShaderSource","updateTexture","baseOrder","orderMap","surfaceIdx","tileIdx","TEXTURE_CUBE_MAP_POSITIVE_X","maxCubeMapTextureSize","getMaxCubeMapTextureSize","tile","extractTileFromImage","TEXTURE_CUBE_MAP","getSourceTileSize","inputTextureSize","outputTextureSize","tilePerRow","MAX_CUBE_MAP_TEXTURE_SIZE","_imageWidth","min","CubeStripRenderer","_vertices","indices","cols","rows","coords","c","coord","tileConfigs","_shrinkCoord","_transformCoord","index","val","TEXTURE_2D","size","max","maxSize","activeTexture","TEXTURE0","pixelStorei","UNPACK_FLIP_Y_WEBGL","newCoord","_flipHorizontalCoord","_rotateCoord","SHRINK_Y","SHRINK_X","rotationAngle","SIZE","shiftCount","moved","rotatedCoord","ERROR_TYPE","INVALID_DEVICE","NO_WEBGL","FAIL_IMAGE_LOAD","FAIL_BIND_TEXTURE","INVALID_RESOURCE","RENDERING_CONTEXT_LOST","READY","VIEW_CHANGE","ANIMATION_END","PROJECTION_TYPE","EQUIRECTANGULAR","CUBEMAP","CUBESTRIP","PANORAMA","STEREOSCOPIC_EQUI","STEREO_FORMAT","TOP_BOTTOM","LEFT_RIGHT","latitudeBands","longitudeBands","radius","ANGLE_CORRECTION_FOR_CENTER_ALIGN","latIdx","lngIdx","phi","sinPhi","cosPhi","u","SphereRenderer","format","_stereoFormat","ctx","leftEyeScaleOffset","rightEyeScaleOffset","uTexScaleOffset","getUniformLocation","uniform4fv","_TEXTURE_COORD_DATA","MIN_ASPECT_RATIO_FOR_FULL_PANORAMA","CylinderRenderer","resizeDimension","imageAspectRatio","cylinderMaxRadian","halfCylinderY","rotated","CYLIDER_Y","startAngleForCenterAlign","yIdx","yLength","VR_DISPLAY_PRESENT_CHANGE","DEFAULT_LEFT_BOUNDS","DEFAULT_RIGHT_BOUNDS","EYES","LEFT","RIGHT","VRManager","_vrDisplay","vrDisplay","removeEndCallback","isPresenting","exitPresent","_clear","_frameData","VRFrameData","canRender","Boolean","beforeRender","bindFramebuffer","FRAMEBUFFER","afterRender","submitFrame","getEyeParams","display","halfWidth","drawingBufferWidth","drawingBufferHeight","frameData","getFrameData","leftMVMatrix","leftViewMatrix","rightMVMatrix","rightViewMatrix","mat4","rotateY","_yawOffset","viewport","leftProjectionMatrix","rightProjectionMatrix","addEndCallback","callback","requestPresent","resolve","reject","getVRDisplays","displays","Error","capabilities","canPresent","leftEye","getEyeParameters","rightEye","renderWidth","renderHeight","_setDisplay","setYawOffset","layers","getLayers","layer","_leftBounds","leftBounds","_rightBounds","rightBounds","XR_REFERENCE_SPACE","XRManager","_xrSession","xrSession","end","frame","pose","getViewerPose","_xrRefSpace","session","baseLayer","renderState","framebuffer","glLayer","views","view","getViewport","transform","matrix","rotateX","projectionMatrix","_presenting","requestSession","requiredFeatures","xrLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","refSpace","_setSession","_xrLayer","WebGLAnimator","_onLoop","_callback","_rafId","_context","requestAnimationFrame","_onLoopNextTick","before","performance","now","diff","_rafTimer","setCallback","setContext","start","stop","cancelAnimationFrame","ImageType","DEVICE_PIXEL_RATIO","BIND_TEXTURE","IMAGE_LOADED","RENDERING_CONTEXT_RESTORE","RENDERER_ERROR","PanoImageRenderer","isVideo","sphericalConfig","renderingContextAttributes","_renderStereo","time","vr","_vr","eyeParams","eyeIndex","eyeParam","uniform1f","uEye","_bindBuffers","_draw","exitVR","animator","_animator","_restoreStyle","updateViewportDimensions","_updateViewport","_shouldForceDraw","_render","_onFirstVRFrame","minusZDir","mat3","fromMat4","mvInv","invert","pInv","transformMat3","yawOffset","fieldOfView","_lastQuaternion","_lastYaw","_lastPitch","_lastFieldOfView","perspective","textureCoordBuffer","vertexBuffer","_initCanvas","_setDefaultCanvasStyle","_wrapper","_wrapperOrigStyle","_renderingContextAttributes","_imageConfig","_imageIsReady","_keepUpdate","_onContentLoad","_onContentError","setImage","imageType","cubemapConfig","setYawPitchControl","yawPitchControl","_yawPitchControl","getContent","_isVideo","_setImageType","_contentLoader","_imageType","_isCubeMap","_renderer","stereoFormat","_initWebGL","_onWebglcontextlost","_onWebglcontextrestored","bottom","left","right","top","margin","maxHeight","maxWidth","outline","position","_triggerContentLoad","content","projectionType","isImageLoaded","_bindTexture","attachTo","parentElement","detach","forceContextLoss","hasRenderingContext","removeChild","isContextLost","_initShaderProgram","renderer","vsSource","fsSource","VERTEX_SHADER","FRAGMENT_SHADER","getError","useProgram","vertexPositionAttribute","getAttribLocation","samplerUniform","textureCoordAttribute","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","uniform1i","preventDefault","updateFieldOfView","viewPortChanged","h","_initRenderingContext","clearColor","deleteTexture","CULL_FACE","WebGLRenderingContext","_initBuffers","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","Uint16Array","isEAC","_updateTexture","keepUpdate","doUpdate","startRender","stopRender","renderWithQuaternion","exactEquals","fromQuat","renderWithYawPitch","identity","getProjectionRenderer","enterVR","_Promise","_requestPresent","_setWrapperFullscreen","wrapper","getAttribute","wrapperStyle","zIndex","removeAttribute","PanoViewer","container","_container","_projectionType","_cubemapConfig","_width","_height","_yaw","_pitch","_fov","_gyroMode","_aspectRatio","_isValidTouchDirection","yawPitchConfig","_isReady","_initYawPitchControl","_initRenderer","getVideo","_photoSphereRenderer","setVideo","getImage","warn","_deactivate","getProjectionType","enableSensor","requestPermission","permissionState","disableSensor","initialYaw","initialPitch","_bindRendererHandler","_activate","_triggerEvent","_updateYawPitchIfNeeded","ProjectionType","yawSize","maxFov","atan","minFov","setUseZoom","setUseKeyboard","setGyroMode","setFovRange","getFovRange","containerSize","_getHFov","getYaw","getPitch","getYawRange","getPitchRange","setYawRange","setPitchRange","setShowPolePoint","verticalAngleOfImage","TOUCH_DIRECTION","YAW","PITCH","ALL","setTouchDirection","getTouchDirection","isSupported","onDeviceMotionChange","checkGyro","timeout","race","fb"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;EAQA,CAAC,UAAU,MAAM,EAAE,OAAO,EAAE;GAC3B,AAA+D,cAAc,GAAG,OAAO,EAAE,AAE1D,CAAC;GAChC,CAACA,cAAI,GAAG,YAAY;EAErB,SAAS,gBAAgB,CAAC,CAAC,EAAE;IAC3B,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CAAC,CAAC;GACjE;;EAED,SAAS,UAAU,CAAC,CAAC,EAAE;IACrB,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC;GAChC;;;;EAID,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC;EACtB,IAAI,KAAK,CAAC,OAAO,EAAE;IACjB,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC;GAC1B,MAAM;IACL,QAAQ,GAAG,UAAU,CAAC,EAAE;MACtB,OAAO,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC;KAC/D,CAAC;GACH;;EAED,IAAI,OAAO,GAAG,QAAQ,CAAC;;EAEvB,IAAI,GAAG,GAAG,C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EyM,eAAe,CAACtN,oBAVE;;EAWxB;;;;;;;;;EASAm9B,IAAAA,GAAG,EAAE7vB,eAAe,CAACrN,mBApBG;;EAqBxB;;;;;;;;;EASAm9B,IAAAA,KAAK,EAAE9vB,eAAe,CAACpN,qBA9BC;;EA+BxB;;;;;;;;;EASAm9B,IAAAA,GAAG,EAAE/vB,eAAe,CAACnN;EAxCG;WA1BpBy5B;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/PanoViewer/view360.panoviewer.min.js b/dist/PanoViewer/view360.panoviewer.min.js new file mode 100644 index 000000000..d9cc7d60d --- /dev/null +++ b/dist/PanoViewer/view360.panoviewer.min.js @@ -0,0 +1,9 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@egjs/axes"),require("@egjs/component"),require("@egjs/agent"),require("gl-matrix")):"function"==typeof define&&define.amd?define(["exports","@egjs/axes","@egjs/component","@egjs/agent","gl-matrix"],e):e((t.eg=t.eg||{},t.eg.view360={}),t.eg.Axes,t.eg.Component,t.eg.Agent,t.glMatrix)}(this,function(t,h,e,s,R){"use strict";function n(t,e){for(var i=0;iMath.abs(t.z)?S.set(-t.y,t.x,0):S.set(0,-t.z,t.y)):S.crossVectors(t,e),this.x=S.x,this.y=S.y,this.z=S.z,this.w=O,this.normalize(),this}};var M,V,L,F,N,Ot,Dt,Mt,Vt,Q=D,U=window.Util||{};function z(t,e,i,n,r){var o,a,s,u,h,c,l,d,f,_;o=t,a=n?n.fieldOfView:null,s=r.depthNear,u=r.depthFar,h=Math.tan(a?a.upDegrees*Ot:Dt),c=Math.tan(a?a.downDegrees*Ot:Dt),l=Math.tan(a?a.leftDegrees*Ot:Dt),d=Math.tan(a?a.rightDegrees*Ot:Dt),f=2/(l+d),_=2/(h+c),o[0]=f,o[1]=0,o[2]=0,o[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5],at=$[6],st=$[7],ut=$[8],ht=$[9],ct=$[10],lt=$[11],dt=$[12],ft=$[13],_t=$[14],vt=$[15],(It=(pt=tt*ot-et*rt)*(At=ct*vt-lt*_t)-(gt=tt*at-it*rt)*(Ct=ht*vt-lt*ft)+(mt=tt*st-nt*rt)*(bt=ht*_t-ct*ft)+(yt=et*at-it*ot)*(Tt=ut*vt-lt*dt)-(xt=et*st-nt*ot)*(Rt=ut*_t-ct*dt)+(wt=it*st-nt*at)*(Et=ut*ft-ht*dt))&&(It=1/It,J[0]=(ot*At-at*Ct+st*bt)*It,J[1]=(it*Ct-et*At-nt*bt)*It,J[2]=(ft*wt-_t*xt+vt*yt)*It,J[3]=(ct*xt-ht*wt-lt*yt)*It,J[4]=(at*Tt-rt*At-st*Rt)*It,J[5]=(tt*At-it*Tt+nt*Rt)*It,J[6]=(_t*mt-dt*wt-vt*gt)*It,J[7]=(ut*wt-ct*mt+lt*gt)*It,J[8]=(rt*Ct-ot*Tt+st*Et)*It,J[9]=(et*Tt-tt*Ct-nt*Et)*It,J[10]=(dt*xt-ft*mt+vt*pt)*It,J[11]=(ht*mt-ut*xt-lt*pt)*It,J[12]=(ot*Rt-rt*bt-at*Et)*It,J[13]=(tt*bt-et*Rt+it*Et)*It,J[14]=(ft*gt-dt*yt-_t*pt)*It,J[15]=(ut*yt-ht*gt+ct*pt)*It)}U.MIN_TIMESTEP=.001,U.MAX_TIMESTEP=1,U.base64=function(t,e){return"data:"+t+";base64,"+e},U.clamp=function(t,e,i){return Math.min(Math.max(e,t),i)},U.lerp=function(t,e,i){return t+(e-t)*i},U.race=function(n){return Promise.race?Promise.race(n):new Promise(function(t,e){for(var i=0;iU.MAX_TIMESTEP))},U.getScreenWidth=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},U.getScreenHeight=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},U.requestFullscreen=function(t){if(U.isWebViewAndroid())return!1;if(t.requestFullscreen)t.requestFullscreen();else if(t.webkitRequestFullscreen)t.webkitRequestFullscreen();else if(t.mozRequestFullScreen)t.mozRequestFullScreen();else{if(!t.msRequestFullscreen)return!1;t.msRequestFullscreen()}return!0},U.exitFullscreen=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},U.getFullscreenElement=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},U.linkProgram=function(t,e,i,n){var r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);var o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,i),t.compileShader(o);var a=t.createProgram();for(var s in t.attachShader(a,r),t.attachShader(a,o),n)t.bindAttribLocation(a,n[s],s);return t.linkProgram(a),t.deleteShader(r),t.deleteShader(o),a},U.getProgramUniforms=function(t,e){for(var i={},n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r="",o=0;oa[1]&&(u=a[1]),s!==u&&(i.setTo({fov:u},0),this._updateControlScale(),this.updatePanScale())}t.some(function(t){return"gyroMode"===t})&&w&&(this.axesTiltMotionInput&&(this.axes.disconnect(this.axesTiltMotionInput),this.axesTiltMotionInput.destroy(),this.axesTiltMotionInput=null),this._deviceQuaternion&&(this._deviceQuaternion.destroy(),this._deviceQuaternion=null),n?this._initDeviceQuaternion():r&&(this.axesTiltMotionInput=new st(this._element),this.axes.connect(["yaw","pitch"],this.axesTiltMotionInput)),this.axesPanInput.setUseRotation(n)),t.some(function(t){return"useKeyboard"===t})&&(e.useKeyboard?i.connect(["yaw","pitch"],this.axesMoveKeyInput):i.disconnect(this.axesMoveKeyInput));if(t.some(function(t){return"useZoom"===t})){var h=e.useZoom;i.disconnect(this.axesWheelInput),h&&i.connect(["fov"],this.axesWheelInput)}this._togglePinchInputByOption(e.touchDirection,e.useZoom),t.some(function(t){return"touchDirection"===t})&&this._enabled&&this._enableTouch(o)},t._togglePinchInputByOption=function(t,e){this.axesPinchInput&&(this.axes.disconnect(this.axesPinchInput),e&&6===t&&-1===this.axes._inputs.indexOf(this.axesPinchInput)&&this.axes.connect(["fov"],this.axesPinchInput))},t._enableTouch=function(t){this.axesPanInput&&this.axes.disconnect(this.axesPanInput);var e=2&t?"yaw":null,i=4&t?"pitch":null;this.axes.connect([e,i],this.axesPanInput)},t._initDeviceQuaternion=function(){var e=this;this._deviceQuaternion=new ft,this._deviceQuaternion.on("change",function(t){e._triggerChange(t)})},t._getValidYawRange=function(t,e,i){var n=u.adjustAspectRatio(i||this.options.aspectRatio||1),r=(e||this.axes.get().fov)*n;return t[1]-t[0]>=r?t:this.options.yawRange||vt},t._getValidPitchRange=function(t,e){var i=e||this.axes.get().fov;return t[1]-t[0]>=i?t:this.options.pitchRange||pt},u.isCircular=function(t){return t[1]-t[0]<360?[!1,!1]:[!0,!0]},t._updateControlScale=function(t){var e=this.options,i=this.axes.get().fov,n=this._updatePitchRange(e.pitchRange,i,e.showPolePoint),r=this._updateYawRange(e.yawRange,i,e.aspectRatio),o=this.axes.get(),a=o.yaw,s=o.pitch;return R.vec2.copy(this.axes.axis.yaw.range,r),R.vec2.copy(this.axes.axis.pitch.range,n),this.axes.axis.yaw.circular=u.isCircular(r),this.axes.axis.pitch.circular=u.isCircular(n),ar[1]&&(a=r[1]),sn[1]&&(s=n[1]),t&&t.set({yaw:a,pitch:s}),this.axes.setTo({yaw:a,pitch:s},0),this},t._updatePitchRange=function(t,e,i){if(this.options.gyroMode===J.VR)return gt;var n=t[1]-t[0],r=e/2;return i&&!(n<180)?t.concat():[t[0]+r,t[1]-r]},t._updateYawRange=function(t,e,i){if(this.options.gyroMode===J.VR)return vt;if(360<=t[1]-t[0])return t.concat();var n=A.toDegree(Math.atan2(i,1/Math.tan(R.glMatrix.toRadian(e/2))));return[t[0]+n,t[1]-n]},t._triggerChange=function(t){var e=this.axes.get(),i=this.options,n={targetElement:i.element,isTrusted:t.isTrusted};n.yaw=e.yaw,n.pitch=e.pitch,n.fov=e.fov,i.gyroMode===J.VR&&this._deviceQuaternion&&(n.quaternion=this._deviceQuaternion.getCombinedQuaternion(e.yaw)),this.trigger("change",n)},u.adjustAspectRatio=function(t){for(var e=[.52,.54,.563,.57,.584,.59,.609,.67,.702,.72,.76,.78,.82,.92,.97,1,1.07,1.14,1.19,1.25,1.32,1.38,1.4,1.43,1.53,1.62,1.76,1.77,1.86,1.96,2.26,2.3,2.6,3,5,6],i=[.51,.54,.606,.56,.628,.63,.647,.71,.736,.757,.78,.77,.8,.89,.975,1,1.07,1.1,1.15,1.18,1.22,1.27,1.3,1.33,1.39,1.45,1.54,1.55,1.58,1.62,1.72,1.82,1.92,2,2.24,2.3],n=-1,r=0;r=this._sourceCount&&(this._loadStatus=Pt,this._detachErrorHandler(this._onerror))},e._appendSourceElement=function(t){var e,i;if("object"==typeof t?(e=t.src,i=t.type):"string"==typeof t&&(e=t),!e)return!1;var n=document.createElement("source");return n.src=e,i&&(n.type=i),this._video.appendChild(n),!0},e.set=function(t){var e=this;this._reset(),t&&(t instanceof HTMLVideoElement?this._video=t:"string"!=typeof t&&"object"!=typeof t||(this._video=document.createElement("video"),this._video.setAttribute("crossorigin","anonymous"),this._video.setAttribute("webkit-playsinline",""),this._video.setAttribute("playsinline",""),t instanceof Array?t.forEach(function(t){return e._appendSourceElement(t)}):this._appendSourceElement(t),this._sourceCount=this._video.querySelectorAll("source").length,0=i._thresholdReadyState)t(i._video);else{i._attachErrorHandler(function t(){i._loadStatus===Pt&&(i._detachErrorHandler(t),e("VideoLoader: video source is invalid"))}),i._once(i._thresholdEventName,function(){return t(i._video)})}else e("VideoLoader: video is undefined")})},e.getElement=function(){return this._video},e.destroy=function(){this._reset()},e._reset=function(){var e=this;this._handlers.forEach(function(t){e._video.removeEventListener(t.type,t.fn)}),this._handlers=[],this._video=null,this._sourceCount=0,this._errorCount=0},e._once=function(e,i){function n(t){r.removeEventListener(e,n),i(t)}var r=this._video;r.addEventListener(e,n,!0),this._handlers.push({type:e,fn:n})},t}(),Qt={0:"NO_ERROR",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",37442:"CONTEXT_LOST_WEBGL"},Ut=null,zt=function(){function n(){}return n.createShader=function(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:(console.error(t.getShaderInfoLog(n)),null)},n.createProgram=function(t,e,i){var n=t.createProgram();return t.attachShader(n,e),t.attachShader(n,i),t.linkProgram(n),t.detachShader(n,e),t.detachShader(n,i),t.deleteShader(e),t.deleteShader(i),t.getProgramParameter(n,t.LINK_STATUS)?n:(t.deleteProgram(n),null)},n.initBuffer=function(t,e,i,n,r){var o=t.createBuffer();return t.bindBuffer(e,o),t.bufferData(e,i,t.STATIC_DRAW),o&&(o.itemSize=n,o.numItems=i.length/n),void 0!==r&&(t.enableVertexAttribArray(r),t.vertexAttribPointer(r,o.itemSize,t.FLOAT,!1,0,0)),o},n.getWebglContext=function(t,e){var i=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=null,r=c({preserveDrawingBuffer:!1,antialias:!1,xrCompatible:!0},e);function o(t){return t.statusMessage}t.addEventListener("webglcontextcreationerror",o);for(var a=0;a= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"},i.getVertexPositionData=function(){return this._vertices||(this._vertices=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1]),this._vertices},i.getIndexData=function(){var i=this;return function(){for(var t=[],e=0;e postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n//# sourceMappingURL=es6-promise.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","/**\n * Original Code\n * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js\n * Math Util\n * modified by egjs\n */\n/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.2\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n// Some minimal math functionality borrowed from gl-Matrix and stripped down\n// for the purposes of this library.\n\nimport {vec2, vec3, quat} from \"gl-matrix\";\n\nfunction quatToVec3(quaternion) {\n\tconst baseV = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(baseV, baseV, quaternion);\n\treturn baseV;\n}\n\nfunction toDegree(a){\n\treturn a * 180 / Math.PI;\n}\n\nconst util = {};\n\nutil.isPowerOfTwo = function(n) {\n\treturn n && (n & (n - 1)) === 0;\n};\n\nutil.extractPitchFromQuat = function(quaternion) {\n\tconst baseV = quatToVec3(quaternion);\n\n\treturn -1 * Math.atan2(\n\t\tbaseV[1],\n\t\tMath.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2)));\n};\n\nutil.hypot = Math.hypot || function(x, y) {\n\treturn Math.sqrt(x * x + y * y);\n};\n\n// implement reference\n// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식\n// calculating angle between two vectors : http://darkpgmr.tistory.com/121\nconst ROTATE_CONSTANT = {\n\tPITCH_DELTA: 1,\n\tYAW_DELTA_BY_ROLL: 2,\n\tYAW_DELTA_BY_YAW: 3,\n};\n\nROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [0, 0, 1],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [1, 0, 0],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = {\n\ttargetAxis: [1, 0, 0],\n\tmeshPoint: [0, 0, 1],\n};\n\nfunction getRotationDelta(prevQ, curQ, rotateKind) {\n\tconst targetAxis = vec3.fromValues(\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[0],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[1],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[2]\n\t);\n\tconst meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint;\n\n\tconst prevQuaternion = quat.clone(prevQ);\n\tconst curQuaternion = quat.clone(curQ);\n\n\tquat.normalize(prevQuaternion, prevQuaternion);\n\tquat.normalize(curQuaternion, curQuaternion);\n\n\tlet prevPoint = vec3.fromValues(0, 0, 1);\n\tlet curPoint = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\tvec3.transformQuat(targetAxis, targetAxis, curQuaternion);\n\n\tconst rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint));\n\tconst rotateDirection = rotateDistance > 0 ? 1 : -1;\n\n\t// when counter clock wise, use vec3.fromValues(0,1,0)\n\t// when clock wise, use vec3.fromValues(0,-1,0)\n\t// const meshPoint1 = vec3.fromValues(0, 0, 0);\n\tconst meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\n\tlet meshPoint3;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tmeshPoint3 = vec3.fromValues(0, rotateDirection, 0);\n\t} else {\n\t\tmeshPoint3 = vec3.fromValues(rotateDirection, 0, 0);\n\t}\n\n\tvec3.transformQuat(meshPoint2, meshPoint2, curQuaternion);\n\tvec3.transformQuat(meshPoint3, meshPoint3, curQuaternion);\n\n\tconst vecU = meshPoint2;\n\tconst vecV = meshPoint3;\n\tconst vecN = vec3.create();\n\n\tvec3.cross(vecN, vecU, vecV);\n\tvec3.normalize(vecN, vecN);\n\n\tconst coefficientA = vecN[0];\n\tconst coefficientB = vecN[1];\n\tconst coefficientC = vecN[2];\n//\tconst coefficientD = -1 * vec3.dot(vecN, meshPoint1);\n\n\t// a point on the plane\n\tcurPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\n\t// a point should project on the plane\n\tprevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\n\t// distance between prevPoint and the plane\n\tlet distance = Math.abs(\n\t\tprevPoint[0] * coefficientA +\n\t\tprevPoint[1] * coefficientB +\n\t\tprevPoint[2] * coefficientC\n\t);\n\n\tconst projectedPrevPoint = vec3.create();\n\n\tvec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance));\n\n\tlet trigonometricRatio =\n\t\t(projectedPrevPoint[0] * curPoint[0] +\n\t\tprojectedPrevPoint[1] * curPoint[1] +\n\t\tprojectedPrevPoint[2] * curPoint[2]) /\n\t\t(vec3.length(projectedPrevPoint) * vec3.length(curPoint));\n\n\t// defensive block\n\ttrigonometricRatio > 1 && (trigonometricRatio = 1);\n\n\tconst theta = Math.acos(trigonometricRatio);\n\n\tconst crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint);\n\n\tdistance =\n\t\tcoefficientA * crossVec[0] +\n\t\tcoefficientB * crossVec[1] +\n\t\tcoefficientC * crossVec[2];\n\n\tlet thetaDirection;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tthetaDirection = distance > 0 ? 1 : -1;\n\t} else {\n\t\tthetaDirection = distance < 0 ? 1 : -1;\n\t}\n\n\tconst deltaRadian = theta * thetaDirection * rotateDirection;\n\n\treturn toDegree(deltaRadian);\n}\n\nfunction angleBetweenVec2(v1, v2) {\n\tconst det = v1[0] * v2[1] - v2[0] * v1[1];\n\tconst theta = -Math.atan2(det, vec2.dot(v1, v2));\n\treturn theta;\n}\n\nutil.yawOffsetBetween = function(viewDir, targetDir) {\n\tconst viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]);\n\tconst targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]);\n\n\tvec2.normalize(viewDirXZ, viewDirXZ);\n\tvec2.normalize(targetDirXZ, targetDirXZ);\n\n\tconst theta = -angleBetweenVec2(viewDirXZ, targetDirXZ);\n\n\treturn theta;\n}\n\nutil.toDegree = toDegree;\nutil.getRotationDelta = getRotationDelta;\nutil.angleBetweenVec2 = angleBetweenVec2;\n\nexport {\n\tutil,\n\tROTATE_CONSTANT,\n};\n","/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar MathUtil = window.MathUtil || {};\n\nMathUtil.degToRad = Math.PI / 180;\nMathUtil.radToDeg = 180 / Math.PI;\n\n// Some minimal math functionality borrowed from THREE.Math and stripped down\n// for the purposes of this library.\n\n\nMathUtil.Vector2 = function ( x, y ) {\n this.x = x || 0;\n this.y = y || 0;\n};\n\nMathUtil.Vector2.prototype = {\n constructor: MathUtil.Vector2,\n\n set: function ( x, y ) {\n this.x = x;\n this.y = y;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n\n return this;\n },\n\n subVectors: function ( a, b ) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n\n return this;\n },\n};\n\nMathUtil.Vector3 = function ( x, y, z ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n};\n\nMathUtil.Vector3.prototype = {\n constructor: MathUtil.Vector3,\n\n set: function ( x, y, z ) {\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n\n return this;\n },\n\n length: function () {\n return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n },\n\n normalize: function () {\n var scalar = this.length();\n\n if ( scalar !== 0 ) {\n var invScalar = 1 / scalar;\n\n this.multiplyScalar(invScalar);\n } else {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return this;\n },\n\n multiplyScalar: function ( scalar ) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n },\n\n applyQuaternion: function ( q ) {\n var x = this.x;\n var y = this.y;\n var z = this.z;\n\n var qx = q.x;\n var qy = q.y;\n var qz = q.z;\n var qw = q.w;\n\n // calculate quat * vector\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = - qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n return this;\n },\n\n dot: function ( v ) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n },\n\n crossVectors: function ( a, b ) {\n var ax = a.x, ay = a.y, az = a.z;\n var bx = b.x, by = b.y, bz = b.z;\n\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n\n return this;\n },\n};\n\nMathUtil.Quaternion = function ( x, y, z, w ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = ( w !== undefined ) ? w : 1;\n};\n\nMathUtil.Quaternion.prototype = {\n constructor: MathUtil.Quaternion,\n\n set: function ( x, y, z, w ) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n\n return this;\n },\n\n copy: function ( quaternion ) {\n this.x = quaternion.x;\n this.y = quaternion.y;\n this.z = quaternion.z;\n this.w = quaternion.w;\n\n return this;\n },\n\n setFromEulerXYZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n\n return this;\n },\n\n setFromEulerYXZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n\n return this;\n },\n\n setFromAxisAngle: function ( axis, angle ) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n\n var halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n this.x = axis.x * s;\n this.y = axis.y * s;\n this.z = axis.z * s;\n this.w = Math.cos( halfAngle );\n\n return this;\n },\n\n multiply: function ( q ) {\n return this.multiplyQuaternions( this, q );\n },\n\n multiplyQuaternions: function ( a, b ) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;\n var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;\n\n this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n return this;\n },\n\n inverse: function () {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n\n this.normalize();\n\n return this;\n },\n\n normalize: function () {\n var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n if ( l === 0 ) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 1;\n } else {\n l = 1 / l;\n\n this.x = this.x * l;\n this.y = this.y * l;\n this.z = this.z * l;\n this.w = this.w * l;\n }\n\n return this;\n },\n\n slerp: function ( qb, t ) {\n if ( t === 0 ) return this;\n if ( t === 1 ) return this.copy( qb );\n\n var x = this.x, y = this.y, z = this.z, w = this.w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z;\n\n if ( cosHalfTheta < 0 ) {\n this.w = - qb.w;\n this.x = - qb.x;\n this.y = - qb.y;\n this.z = - qb.z;\n\n cosHalfTheta = - cosHalfTheta;\n } else {\n this.copy( qb );\n }\n\n if ( cosHalfTheta >= 1.0 ) {\n this.w = w;\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n var halfTheta = Math.acos( cosHalfTheta );\n var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\n\n if ( Math.abs( sinHalfTheta ) < 0.001 ) {\n this.w = 0.5 * ( w + this.w );\n this.x = 0.5 * ( x + this.x );\n this.y = 0.5 * ( y + this.y );\n this.z = 0.5 * ( z + this.z );\n\n return this;\n }\n\n var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n this.w = ( w * ratioA + this.w * ratioB );\n this.x = ( x * ratioA + this.x * ratioB );\n this.y = ( y * ratioA + this.y * ratioB );\n this.z = ( z * ratioA + this.z * ratioB );\n\n return this;\n },\n\n setFromUnitVectors: function () {\n // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\n // assumes direction vectors vFrom and vTo are normalized\n\n var v1, r;\n var EPS = 0.000001;\n\n return function ( vFrom, vTo ) {\n if ( v1 === undefined ) v1 = new MathUtil.Vector3();\n\n r = vFrom.dot( vTo ) + 1;\n\n if ( r < EPS ) {\n r = 0;\n\n if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n v1.set( - vFrom.y, vFrom.x, 0 );\n } else {\n v1.set( 0, - vFrom.z, vFrom.y );\n }\n } else {\n v1.crossVectors( vFrom, vTo );\n }\n\n this.x = v1.x;\n this.y = v1.y;\n this.z = v1.z;\n this.w = r;\n\n this.normalize();\n\n return this;\n }\n }(),\n};\n\nmodule.exports = MathUtil;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Util = window.Util || {};\n\nUtil.MIN_TIMESTEP = 0.001;\nUtil.MAX_TIMESTEP = 1;\n\nUtil.base64 = function(mimeType, base64) {\n return 'data:' + mimeType + ';base64,' + base64;\n};\n\nUtil.clamp = function(value, min, max) {\n return Math.min(Math.max(min, value), max);\n};\n\nUtil.lerp = function(a, b, t) {\n return a + ((b - a) * t);\n};\n\n/**\n * Light polyfill for `Promise.race`. Returns\n * a promise that resolves when the first promise\n * provided resolves.\n *\n * @param {Array} promises\n */\nUtil.race = function(promises) {\n if (Promise.race) {\n return Promise.race(promises);\n }\n\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < promises.length; i++) {\n promises[i].then(resolve, reject);\n }\n });\n};\n\nUtil.isIOS = (function() {\n var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);\n return function() {\n return isIOS;\n };\n})();\n\nUtil.isWebViewAndroid = (function() {\n var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1 &&\n navigator.userAgent.indexOf('Chrome') !== -1;\n return function() {\n return isWebViewAndroid;\n };\n})();\n\nUtil.isSafari = (function() {\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n return function() {\n return isSafari;\n };\n})();\n\nUtil.isFirefoxAndroid = (function() {\n var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1;\n return function() {\n return isFirefoxAndroid;\n };\n})();\n\nUtil.isR7 = (function() {\n var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1;\n return function() {\n return isR7;\n };\n})();\n\nUtil.isLandscapeMode = function() {\n var rtn = (window.orientation == 90 || window.orientation == -90);\n return Util.isR7() ? !rtn : rtn;\n};\n\n// Helper method to validate the time steps of sensor timestamps.\nUtil.isTimestampDeltaValid = function(timestampDeltaS) {\n if (isNaN(timestampDeltaS)) {\n return false;\n }\n if (timestampDeltaS <= Util.MIN_TIMESTEP) {\n return false;\n }\n if (timestampDeltaS > Util.MAX_TIMESTEP) {\n return false;\n }\n return true;\n};\n\nUtil.getScreenWidth = function() {\n return Math.max(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.getScreenHeight = function() {\n return Math.min(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.requestFullscreen = function(element) {\n if (Util.isWebViewAndroid()) {\n return false;\n }\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.exitFullscreen = function() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.getFullscreenElement = function() {\n return document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullScreenElement ||\n document.msFullscreenElement;\n};\n\nUtil.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) {\n // No error checking for brevity.\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n for (var attribName in attribLocationMap)\n gl.bindAttribLocation(program, attribLocationMap[attribName], attribName);\n\n gl.linkProgram(program);\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n};\n\nUtil.getProgramUniforms = function(gl, program) {\n var uniforms = {};\n var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n var uniformName = '';\n for (var i = 0; i < uniformCount; i++) {\n var uniformInfo = gl.getActiveUniform(program, i);\n uniformName = uniformInfo.name.replace('[0]', '');\n uniforms[uniformName] = gl.getUniformLocation(program, uniformName);\n }\n return uniforms;\n};\n\nUtil.orthoMatrix = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\nUtil.copyArray = function (source, dest) {\n for (var i = 0, n = source.length; i < n; i++) {\n dest[i] = source[i];\n }\n};\n\nUtil.isMobile = function() {\n var check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);\n return check;\n};\n\nUtil.extend = function(dest, src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n\n return dest;\n}\n\nUtil.safariCssSizeWorkaround = function(canvas) {\n // TODO(smus): Remove this workaround when Safari for iOS is fixed.\n // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556).\n //\n // \"To the last I grapple with thee;\n // from hell's heart I stab at thee;\n // for hate's sake I spit my last breath at thee.\"\n // -- Moby Dick, by Herman Melville\n if (Util.isIOS()) {\n var width = canvas.style.width;\n var height = canvas.style.height;\n canvas.style.width = (parseInt(width) + 1) + 'px';\n canvas.style.height = (parseInt(height)) + 'px';\n setTimeout(function() {\n canvas.style.width = width;\n canvas.style.height = height;\n }, 100);\n }\n\n // Debug only.\n window.Util = Util;\n window.canvas = canvas;\n};\n\nUtil.isDebug = function() {\n return Util.getQueryParameter('debug');\n};\n\nUtil.getQueryParameter = function(name) {\n var name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n results = regex.exec(location.search);\n return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n};\n\nUtil.frameDataFromPose = (function() {\n var piOver180 = Math.PI / 180.0;\n var rad45 = Math.PI * 0.25;\n\n // Borrowed from glMatrix.\n function mat4_perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45),\n downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45),\n leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45),\n rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n\n function mat4_fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n };\n\n function mat4_translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n };\n\n function mat4_invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n };\n\n var defaultOrientation = new Float32Array([0, 0, 0, 1]);\n var defaultPosition = new Float32Array([0, 0, 0]);\n\n function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) {\n mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar);\n\n var orientation = pose.orientation || defaultOrientation;\n var position = pose.position || defaultPosition;\n\n mat4_fromRotationTranslation(view, orientation, position);\n if (parameters)\n mat4_translate(view, view, parameters.offset);\n mat4_invert(view, view);\n }\n\n return function(frameData, pose, vrDisplay) {\n if (!frameData || !pose)\n return false;\n\n frameData.pose = pose;\n frameData.timestamp = pose.timestamp;\n\n updateEyeMatrices(\n frameData.leftProjectionMatrix, frameData.leftViewMatrix,\n pose, vrDisplay.getEyeParameters(\"left\"), vrDisplay);\n updateEyeMatrices(\n frameData.rightProjectionMatrix, frameData.rightViewMatrix,\n pose, vrDisplay.getEyeParameters(\"right\"), vrDisplay);\n\n return true;\n };\n})();\n\nUtil.isInsideCrossDomainIFrame = function() {\n var isFramed = (window.self !== window.top);\n var refDomain = Util.getDomainFromUrl(document.referrer);\n var thisDomain = Util.getDomainFromUrl(window.location.href);\n\n return isFramed && (refDomain !== thisDomain);\n};\n\n// From http://stackoverflow.com/a/23945027.\nUtil.getDomainFromUrl = function(url) {\n var domain;\n // Find & remove protocol (http, ftp, etc.) and get domain.\n if (url.indexOf(\"://\") > -1) {\n domain = url.split('/')[2];\n }\n else {\n domain = url.split('/')[0];\n }\n\n //find & remove port number\n domain = domain.split(':')[0];\n\n return domain;\n}\n\nmodule.exports = Util;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar MathUtil = require('../math-util');\nvar Util = require('../util');\n\n/**\n * Given an orientation and the gyroscope data, predicts the future orientation\n * of the head. This makes rendering appear faster.\n *\n * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf\n *\n * @param {Number} predictionTimeS time from head movement to the appearance of\n * the corresponding image.\n */\nfunction PosePredictor(predictionTimeS) {\n this.predictionTimeS = predictionTimeS;\n\n // The quaternion corresponding to the previous state.\n this.previousQ = new MathUtil.Quaternion();\n // Previous time a prediction occurred.\n this.previousTimestampS = null;\n\n // The delta quaternion that adjusts the current pose.\n this.deltaQ = new MathUtil.Quaternion();\n // The output quaternion.\n this.outQ = new MathUtil.Quaternion();\n}\n\nPosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) {\n if (!this.previousTimestampS) {\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n return currentQ;\n }\n\n // Calculate axis and angle based on gyroscope rotation rate data.\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n\n var angularSpeed = gyro.length();\n\n // If we're rotating slowly, don't do prediction.\n if (angularSpeed < MathUtil.degToRad * 20) {\n if (Util.isDebug()) {\n console.log('Moving slowly, at %s deg/s: no prediction',\n (MathUtil.radToDeg * angularSpeed).toFixed(1));\n }\n this.outQ.copy(currentQ);\n this.previousQ.copy(currentQ);\n return this.outQ;\n }\n\n // Get the predicted angle based on the time delta and latency.\n var deltaT = timestampS - this.previousTimestampS;\n var predictAngle = angularSpeed * this.predictionTimeS;\n\n this.deltaQ.setFromAxisAngle(axis, predictAngle);\n this.outQ.copy(this.previousQ);\n this.outQ.multiply(this.deltaQ);\n\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n\n return this.outQ;\n};\n\n\nmodule.exports = PosePredictor;\n","import {userAgent} from \"../utils/browserFeature\";\n/**\n * Returns a number value indiciating the version of Chrome being used,\n * or otherwise `null` if not on Chrome.\n *\n * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19\n */\n/**\n * In Chrome m65, `devicemotion` events are broken but subsequently fixed\n * in 65.0.3325.148. Since many browsers use Chromium, ensure that\n * we scope this detection by branch and build numbers to provide\n * a proper fallback.\n * https://github.com/immersive-web/webvr-polyfill/issues/307\n */\nlet version = -1; // It should not be null because it will be compared with number\nlet branch = null;\nlet build = null;\n\nconst match = /Chrome\\/([0-9]+)\\.(?:[0-9]*)\\.([0-9]*)\\.([0-9]*)/i.exec(userAgent);\n\nif (match) {\n\tversion = parseInt(match[1], 10);\n\tbranch = match[2];\n\tbuild = match[3];\n}\n\nconst CHROME_VERSION = version;\nconst IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === \"3325\" && parseInt(build, 10) < 148;\nconst IS_ANDROID = /Android/i.test(userAgent);\n\nconst CONTROL_MODE_VR = 1;\nconst CONTROL_MODE_YAWPITCH = 2;\n\nconst TOUCH_DIRECTION_NONE = 1;\nconst TOUCH_DIRECTION_YAW = 2;\nconst TOUCH_DIRECTION_PITCH = 4;\nconst TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH;\n\n/* Const for MovableCoord */\nconst MC_DECELERATION = 0.0014;\nconst MC_MAXIMUM_DURATION = 1000;\nconst MC_BIND_SCALE = [0.20, 0.20];\n\nconst MIN_FIELD_OF_VIEW = 20;\nconst MAX_FIELD_OF_VIEW = 110;\nconst PAN_SCALE = 320;\n\n// const DELTA_THRESHOLD = 0.015;\n// const DELTA_THRESHOLD = 0.09; // Note4\n// const DELTA_THRESHOLD = 0.0825;\n// const DELTA_THRESHOLD = 0.075;\n// const DELTA_THRESHOLD = 0.06;\n// const DELTA_THRESHOLD = 0.045;\nconst DELTA_THRESHOLD = 0.0375; // Note2\n\nconst YAW_RANGE_HALF = 180;\nconst PITCH_RANGE_HALF = 90;\nconst CIRCULAR_PITCH_RANGE_HALF = 180;\nconst PINCH_EVENTS = \"pinchstart pinchmove pinchend\";\n\nconst KEYMAP = {\n\tLEFT_ARROW: 37,\n\tA: 65,\n\tUP_ARROW: 38,\n\tW: 87,\n\tRIGHT_ARROW: 39,\n\tD: 68,\n\tDOWN_ARROW: 40,\n\tS: 83,\n};\n\nconst GYRO_MODE = {\n\tNONE: \"none\",\n\tYAWPITCH: \"yawPitch\",\n\tVR: \"VR\"\n};\n\nexport {\n\tGYRO_MODE,\n\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\n\tTOUCH_DIRECTION_NONE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMIN_FIELD_OF_VIEW,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tDELTA_THRESHOLD,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tPINCH_EVENTS,\n\tKEYMAP,\n\n\tCHROME_VERSION,\n\tIS_CHROME_WITHOUT_DEVICE_MOTION,\n\tIS_ANDROID\n};\n","import Component from \"@egjs/component\";\nimport {vec3} from \"gl-matrix\";\nimport {window} from \"../../utils/browser\";\nimport {IS_CHROME_WITHOUT_DEVICE_MOTION, IS_ANDROID} from \"../consts\";\n\nconst STILLNESS_THRESHOLD = 200; // millisecond\n\nexport default class DeviceMotion extends Component {\n\tconstructor() {\n\t\tsuper();\n\t\tthis._onDeviceMotion = this._onDeviceMotion.bind(this);\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onChromeWithoutDeviceMotion = this._onChromeWithoutDeviceMotion.bind(this);\n\n\t\tthis.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION;\n\t\tthis.isAndroid = IS_ANDROID;\n\n\t\tthis.stillGyroVec = vec3.create();\n\t\tthis.rawGyroVec = vec3.create();\n\t\tthis.adjustedGyroVec = vec3.create();\n\n\t\tthis._timer = null;\n\n\t\tthis.lastDevicemotionTimestamp = 0;\n\t\tthis._isEnabled = false;\n\t\tthis.enable();\n\t}\n\t_onChromeWithoutDeviceMotion(e) {\n\t\tlet {alpha, beta, gamma} = e;\n\n\t\t// There is deviceorientation event trigged with empty values\n\t\t// on Headless Chrome.\n\t\tif (alpha === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// convert to radian\n\t\talpha = (alpha || 0) * Math.PI / 180;\n\t\tbeta = (beta || 0) * Math.PI / 180;\n\t\tgamma = (gamma || 0) * Math.PI / 180;\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: {\n\t\t\t\tdeviceorientation: {\n\t\t\t\t\talpha,\n\t\t\t\t\tbeta,\n\t\t\t\t\tgamma: -gamma\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t_onDeviceOrientation() {\n\t\tthis._timer && clearTimeout(this._timer);\n\t\tthis._timer = setTimeout(() => {\n\t\t\tif ((new Date().getTime() - this.lastDevicemotionTimestamp) < STILLNESS_THRESHOLD) {\n\t\t\t\tvec3.copy(this.stillGyroVec, this.rawGyroVec);\n\t\t\t}\n\t\t}, STILLNESS_THRESHOLD);\n\t}\n\t_onDeviceMotion(e) {\n\t\t// desktop chrome triggers devicemotion event with empthy sensor values.\n\t\t// Those events should ignored.\n\t\tconst isGyroSensorAvailable = !(e.rotationRate.alpha == null);\n\t\tconst isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null);\n\n\t\tif (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst devicemotionEvent = Object.assign({}, e);\n\n\t\tdevicemotionEvent.interval = e.interval;\n\t\tdevicemotionEvent.timeStamp = e.timeStamp;\n\t\tdevicemotionEvent.type = e.type;\n\t\tdevicemotionEvent.rotationRate = {\n\t\t\talpha: e.rotationRate.alpha,\n\t\t\tbeta: e.rotationRate.beta,\n\t\t\tgamma: e.rotationRate.gamma,\n\t\t};\n\t\tdevicemotionEvent.accelerationIncludingGravity = {\n\t\t\tx: e.accelerationIncludingGravity.x,\n\t\t\ty: e.accelerationIncludingGravity.y,\n\t\t\tz: e.accelerationIncludingGravity.z,\n\t\t};\n\t\tdevicemotionEvent.acceleration = {\n\t\t\tx: e.acceleration.x,\n\t\t\ty: e.acceleration.y,\n\t\t\tz: e.acceleration.z,\n\t\t};\n\n\t\tif (this.isAndroid) {\n\t\t\tvec3.set(\n\t\t\t\tthis.rawGyroVec,\n\t\t\t\te.rotationRate.alpha || 0,\n\t\t\t\te.rotationRate.beta || 0,\n\t\t\t\te.rotationRate.gamma || 0);\n\t\t\tvec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec);\n\t\t\tthis.lastDevicemotionTimestamp = new Date().getTime();\n\n\t\t\tdevicemotionEvent.adjustedRotationRate = {\n\t\t\t\talpha: this.adjustedGyroVec[0],\n\t\t\t\tbeta: this.adjustedGyroVec[1],\n\t\t\t\tgamma: this.adjustedGyroVec[2]};\n\t\t}\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: devicemotionEvent\n\t\t});\n\t}\n\tenable() {\n\t\tif (this.isAndroid) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\t}\n\t\tif (this.isWithoutDeviceMotion) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\t} else {\n\t\t\twindow.addEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\t}\n\t\tthis._isEnabled = true;\n\t}\n\tdisable() {\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\twindow.removeEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\tthis._isEnabled = false;\n\t}\n}\n","function SensorSample(sample, timestampS) {\n this.set(sample, timestampS);\n};\n\nSensorSample.prototype.set = function(sample, timestampS) {\n this.sample = sample;\n this.timestampS = timestampS;\n};\n\nSensorSample.prototype.copy = function(sensorSample) {\n this.set(sensorSample.sample, sensorSample.timestampS);\n};\n\nmodule.exports = SensorSample;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar SensorSample = require('./sensor-sample.js');\nvar MathUtil = require('../math-util.js');\nvar Util = require('../util.js');\n\n/**\n * An implementation of a simple complementary filter, which fuses gyroscope and\n * accelerometer data from the 'devicemotion' event.\n *\n * Accelerometer data is very noisy, but stable over the long term.\n * Gyroscope data is smooth, but tends to drift over the long term.\n *\n * This fusion is relatively simple:\n * 1. Get orientation estimates from accelerometer by applying a low-pass filter\n * on that data.\n * 2. Get orientation estimates from gyroscope by integrating over time.\n * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the\n * short term.\n */\nfunction ComplementaryFilter(kFilter) {\n this.kFilter = kFilter;\n\n // Raw sensor measurements.\n this.currentAccelMeasurement = new SensorSample();\n this.currentGyroMeasurement = new SensorSample();\n this.previousGyroMeasurement = new SensorSample();\n\n // Set default look direction to be in the correct direction.\n if (Util.isIOS()) {\n this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1);\n } else {\n this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1);\n }\n this.previousFilterQ = new MathUtil.Quaternion();\n this.previousFilterQ.copy(this.filterQ);\n\n // Orientation based on the accelerometer.\n this.accelQ = new MathUtil.Quaternion();\n // Whether or not the orientation has been initialized.\n this.isOrientationInitialized = false;\n // Running estimate of gravity based on the current orientation.\n this.estimatedGravity = new MathUtil.Vector3();\n // Measured gravity based on accelerometer.\n this.measuredGravity = new MathUtil.Vector3();\n\n // Debug only quaternion of gyro-based orientation.\n this.gyroIntegralQ = new MathUtil.Quaternion();\n}\n\nComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) {\n this.currentAccelMeasurement.set(vector, timestampS);\n};\n\nComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {\n this.currentGyroMeasurement.set(vector, timestampS);\n\n var deltaT = timestampS - this.previousGyroMeasurement.timestampS;\n if (Util.isTimestampDeltaValid(deltaT)) {\n this.run_();\n }\n\n this.previousGyroMeasurement.copy(this.currentGyroMeasurement);\n};\n\nComplementaryFilter.prototype.run_ = function() {\n\n if (!this.isOrientationInitialized) {\n this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n this.previousFilterQ.copy(this.accelQ);\n this.isOrientationInitialized = true;\n return;\n }\n\n var deltaT = this.currentGyroMeasurement.timestampS -\n this.previousGyroMeasurement.timestampS;\n\n // Convert gyro rotation vector to a quaternion delta.\n var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n this.gyroIntegralQ.multiply(gyroDeltaQ);\n\n // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n this.filterQ.copy(this.previousFilterQ);\n this.filterQ.multiply(gyroDeltaQ);\n\n // Calculate the delta between the current estimated gravity and the real\n // gravity vector from accelerometer.\n var invFilterQ = new MathUtil.Quaternion();\n invFilterQ.copy(this.filterQ);\n invFilterQ.inverse();\n\n this.estimatedGravity.set(0, 0, -1);\n this.estimatedGravity.applyQuaternion(invFilterQ);\n this.estimatedGravity.normalize();\n\n this.measuredGravity.copy(this.currentAccelMeasurement.sample);\n this.measuredGravity.normalize();\n\n // Compare estimated gravity with measured gravity, get the delta quaternion\n // between the two.\n var deltaQ = new MathUtil.Quaternion();\n deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n deltaQ.inverse();\n\n if (Util.isDebug()) {\n console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)',\n MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ),\n (this.estimatedGravity.x).toFixed(1),\n (this.estimatedGravity.y).toFixed(1),\n (this.estimatedGravity.z).toFixed(1),\n (this.measuredGravity.x).toFixed(1),\n (this.measuredGravity.y).toFixed(1),\n (this.measuredGravity.z).toFixed(1));\n }\n\n // Calculate the SLERP target: current orientation plus the measured-estimated\n // quaternion delta.\n var targetQ = new MathUtil.Quaternion();\n targetQ.copy(this.filterQ);\n targetQ.multiply(deltaQ);\n\n // SLERP factor: 0 is pure gyro, 1 is pure accel.\n this.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n this.previousFilterQ.copy(this.filterQ);\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n return this.filterQ;\n};\n\nComplementaryFilter.prototype.accelToQuaternion_ = function(accel) {\n var normAccel = new MathUtil.Vector3();\n normAccel.copy(accel);\n normAccel.normalize();\n var quat = new MathUtil.Quaternion();\n quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel);\n quat.inverse();\n return quat;\n};\n\nComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) {\n // Extract axis and angle from the gyroscope data.\n var quat = new MathUtil.Quaternion();\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n quat.setFromAxisAngle(axis, gyro.length() * dt);\n return quat;\n};\n\n\nmodule.exports = ComplementaryFilter;\n","import MathUtil from \"webvr-polyfill/src/math-util\";\nimport ComplementaryFilter from \"webvr-polyfill/src/sensor-fusion/complementary-filter\";\n\nComplementaryFilter.prototype.run_ = function() {\n\tif (!this.isOrientationInitialized) {\n\t\tthis.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n\t\tthis.previousFilterQ.copy(this.accelQ);\n\t\tthis.isOrientationInitialized = true;\n\t\treturn;\n\t}\n\n\tconst deltaT = this.currentGyroMeasurement.timestampS -\n\tthis.previousGyroMeasurement.timestampS;\n\n\t// Convert gyro rotation vector to a quaternion delta.\n\tconst gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n\n\tthis.gyroIntegralQ.multiply(gyroDeltaQ);\n\n\t// filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n\tthis.filterQ.copy(this.previousFilterQ);\n\tthis.filterQ.multiply(gyroDeltaQ);\n\n\t// Calculate the delta between the current estimated gravity and the real\n\t// gravity vector from accelerometer.\n\tconst invFilterQ = new MathUtil.Quaternion();\n\n\tinvFilterQ.copy(this.filterQ);\n\tinvFilterQ.inverse();\n\n\tthis.estimatedGravity.set(0, 0, -1);\n\tthis.estimatedGravity.applyQuaternion(invFilterQ);\n\tthis.estimatedGravity.normalize();\n\n\tthis.measuredGravity.copy(this.currentAccelMeasurement.sample);\n\tthis.measuredGravity.normalize();\n\n\t// Compare estimated gravity with measured gravity, get the delta quaternion\n\t// between the two.\n\tconst deltaQ = new MathUtil.Quaternion();\n\n\tdeltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n\tdeltaQ.inverse();\n\n\t// Calculate the SLERP target: current orientation plus the measured-estimated\n\t// quaternion delta.\n\tconst targetQ = new MathUtil.Quaternion();\n\n\ttargetQ.copy(this.filterQ);\n\ttargetQ.multiply(deltaQ);\n\n\t// SLERP factor: 0 is pure gyro, 1 is pure accel.\n\tthis.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n\tthis.previousFilterQ.copy(this.filterQ);\n\n\tif (!this.isFilterQuaternionInitialized) {\n\t\tthis.isFilterQuaternionInitialized = true;\n\t}\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n\tif (this.isFilterQuaternionInitialized) {\n\t\treturn this.filterQ;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexport default ComplementaryFilter;\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport PosePredictor from \"webvr-polyfill/src/sensor-fusion/pose-predictor\";\nimport MathUtil from \"webvr-polyfill/src/math-util\";\nimport Util from \"webvr-polyfill/src/util\";\nimport {window, IS_IOS, IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\nimport DeviceMotion from \"./DeviceMotion\";\nimport ComplementaryFilter from \"./ComplementaryFilter\";\nimport {CHROME_VERSION} from \"../consts\";\n\nconst K_FILTER = 0.98;\nconst PREDICTION_TIME_S = 0.040;\n\nexport default class FusionPoseSensor extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.deviceMotion = new DeviceMotion();\n\n\t\tthis.accelerometer = new MathUtil.Vector3();\n\t\tthis.gyroscope = new MathUtil.Vector3();\n\n\t\tthis._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);\n\t\tthis._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);\n\n\t\tthis.filter = new ComplementaryFilter(K_FILTER);\n\t\tthis.posePredictor = new PosePredictor(PREDICTION_TIME_S);\n\n\t\tthis.filterToWorldQ = new MathUtil.Quaternion();\n\n\t\tthis.isFirefoxAndroid = Util.isFirefoxAndroid();\n\t\t// This includes iPhone & iPad(both desktop and mobile mode) ref #326\n\t\tthis.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP;\n\n\t\t// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18\n\t\tthis.isChromeUsingDegrees = CHROME_VERSION >= 66;\n\n\t\tthis._isEnabled = false;\n\n\t\t// Set the filter to world transform, depending on OS.\n\t\tif (this.isIOS) {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);\n\t\t} else {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);\n\t\t}\n\n\t\tthis.inverseWorldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.worldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1),\n\t\t\t-window.orientation * Math.PI / 180);\n\n\t\tthis._setScreenTransform();\n\t\t// Adjust this filter for being in landscape mode.\n\t\tif (Util.isLandscapeMode()) {\n\t\t\tthis.filterToWorldQ.multiply(this.inverseWorldToScreenQ);\n\t\t}\n\n\t\t// Keep track of a reset transform for resetSensor.\n\t\tthis.resetQ = new MathUtil.Quaternion();\n\n\t\tthis.deviceMotion.on(\"devicemotion\", this._onDeviceMotionChange);\n\t\tthis.enable();\n\t}\n\tenable() {\n\t\tif (this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.enable();\n\t\tthis._isEnabled = true;\n\t\twindow.addEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tdisable() {\n\t\tif (!this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.disable();\n\t\tthis._isEnabled = false;\n\t\twindow.removeEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tisEnabled() {\n\t\treturn this._isEnabled;\n\t}\n\tdestroy() {\n\t\tthis.disable();\n\t\tthis.deviceMotion = null;\n\t}\n\t_triggerChange() {\n\t\tconst orientation = this.getOrientation();\n\n\t\t// if orientation is not prepared. don't trigger change event\n\t\tif (!orientation) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._prevOrientation) {\n\t\t\tthis._prevOrientation = orientation;\n\t\t\treturn;\n\t\t}\n\n\t\tif (quat.equals(this._prevOrientation, orientation)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.trigger(\"change\", {quaternion: orientation});\n\t}\n\tgetOrientation() {\n\t\tlet orientation;\n\n\t\t// Hack around using deviceorientation instead of devicemotion\n\t\tif (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) {\n\t\t\tthis.deviceOrientationFixQ = this.deviceOrientationFixQ || (() => {\n\t\t\t\tconst y = new MathUtil.Quaternion()\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -this._alpha);\n\n\t\t\t\treturn y;\n\t\t\t})();\n\n\t\t\torientation = this._deviceOrientationQ;\n\t\t\tconst out = new MathUtil.Quaternion();\n\n\t\t\tout.copy(orientation);\n\t\t\tout.multiply(this.filterToWorldQ);\n\t\t\tout.multiply(this.resetQ);\n\t\t\tout.multiply(this.worldToScreenQ);\n\t\t\tout.multiplyQuaternions(this.deviceOrientationFixQ, out);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t} else {\n\t\t\t// Convert from filter space to the the same system used by the\n\t\t\t// deviceorientation event.\n\t\t\torientation = this.filter.getOrientation();\n\n\t\t\tif (!orientation) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst out = this._convertFusionToPredicted(orientation);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t}\n\t}\n\t_convertFusionToPredicted(orientation) {\n\t\t// Predict orientation.\n\t\tthis.predictedQ =\n\t\t\tthis.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS);\n\n\t\t// Convert to THREE coordinate system: -Z forward, Y up, X right.\n\t\tconst out = new MathUtil.Quaternion();\n\n\t\tout.copy(this.filterToWorldQ);\n\t\tout.multiply(this.resetQ);\n\t\tout.multiply(this.predictedQ);\n\t\tout.multiply(this.worldToScreenQ);\n\n\t\treturn out;\n\t}\n\t_onDeviceMotionChange({inputEvent}) {\n\t\tconst deviceorientation = inputEvent.deviceorientation;\n\t\tconst deviceMotion = inputEvent;\n\t\tconst accGravity = deviceMotion.accelerationIncludingGravity;\n\t\tconst rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate;\n\t\tlet timestampS = deviceMotion.timeStamp / 1000;\n\n\t\tif (deviceorientation) {\n\t\t\tif (!this._alpha) {\n\t\t\t\tthis._alpha = deviceorientation.alpha;\n\t\t\t}\n\t\t\tthis._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion();\n\t\t\tthis._deviceOrientationQ.setFromEulerYXZ(\n\t\t\t\tdeviceorientation.beta,\n\t\t\t\tdeviceorientation.alpha,\n\t\t\t\tdeviceorientation.gamma\n\t\t\t);\n\n\t\t\tthis._triggerChange();\n\t\t} else {\n\t\t\t// Firefox Android timeStamp returns one thousandth of a millisecond.\n\t\t\tif (this.isFirefoxAndroid) {\n\t\t\t\ttimestampS /= 1000;\n\t\t\t}\n\n\t\t\tthis.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z);\n\t\t\tthis.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma);\n\n\t\t\t// Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate`\n\t\t\t// is reported in degrees, so we first convert to radians.\n\t\t\tif (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) {\n\t\t\t\tthis.gyroscope.multiplyScalar(Math.PI / 180);\n\t\t\t}\n\n\t\t\tthis.filter.addAccelMeasurement(this.accelerometer, timestampS);\n\t\t\tthis.filter.addGyroMeasurement(this.gyroscope, timestampS);\n\n\t\t\tthis._triggerChange();\n\n\t\t\tthis.previousTimestampS = timestampS;\n\t\t}\n\t}\n\t_onScreenOrientationChange(screenOrientation) {\n\t\tthis._setScreenTransform(window.orientation);\n\t}\n\t_setScreenTransform() {\n\t\tthis.worldToScreenQ.set(0, 0, 0, 1);\n\n\t\tconst orientation = window.orientation;\n\n\t\tswitch (orientation) {\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tcase 90:\n\t\t\tcase -90:\n\t\t\tcase 180:\n\t\t\t\tthis.worldToScreenQ\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.inverseWorldToScreenQ.copy(this.worldToScreenQ);\n\t\tthis.inverseWorldToScreenQ.inverse();\n\t}\n}\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport {toAxis} from \"../utils\";\nimport FusionPoseSensor from \"./FusionPoseSensor\";\nimport {util, ROTATE_CONSTANT} from \"../../utils/math-util\";\n\nfunction getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(util.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nfunction getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n\nexport default class TiltMotionInput extends Component {\n\tconstructor(el, options) {\n\t\tsuper();\n\t\tthis.element = el;\n\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\n\t\tthis.fusionPoseSensor = null;\n\n\t\tthis.options = Object.assign({\n\t\t\tscale: 1,\n\t\t\tthreshold: 0,\n\t\t}, options);\n\n\t\tthis._onPoseChange = this._onPoseChange.bind(this);\n\t}\n\tmapAxes(axes) {\n\t\tthis.axes = axes;\n\t}\n\tconnect(observer) {\n\t\tif (this.observer) {\n\t\t\treturn this;\n\t\t}\n\t\tthis.observer = observer;\n\t\tthis.fusionPoseSensor = new FusionPoseSensor();\n\t\tthis.fusionPoseSensor.enable();\n\t\tthis._attachEvent();\n\t\treturn this;\n\t}\n\tdisconnect() {\n\t\tif (!this.observer) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._dettachEvent();\n\t\tthis.fusionPoseSensor.disable();\n\t\tthis.fusionPoseSensor.destroy();\n\t\tthis.fusionPoseSensor = null;\n\t\tthis.observer = null;\n\t\treturn this;\n\t}\n\tdestroy() {\n\t\tthis.disconnect();\n\t\tthis.element = null;\n\t\tthis.options = null;\n\t\tthis.axes = null;\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\t}\n\t_onPoseChange(event) {\n\t\tif (!this._prevQuaternion) {\n\t\t\tthis._prevQuaternion = quat.clone(event.quaternion);\n\t\t\tthis._quaternion = quat.clone(event.quaternion);\n\t\t\treturn;\n\t\t}\n\n\t\tquat.copy(this._prevQuaternion, this._quaternion);\n\t\tquat.copy(this._quaternion, event.quaternion);\n\n\t\tthis.observer.change(this, event, toAxis(this.axes, [\n\t\t\tgetDeltaYaw(this._prevQuaternion, this._quaternion),\n\t\t\tgetDeltaPitch(this._prevQuaternion, this._quaternion)\n\t\t]));\n\t}\n\t_attachEvent() {\n\t\tthis.fusionPoseSensor.on(\"change\", this._onPoseChange);\n\t}\n\t_dettachEvent() {\n\t\tthis.fusionPoseSensor.off(\"change\", this._onPoseChange);\n\t}\n}\n","import {\n\tutil as mathUtil,\n\tROTATE_CONSTANT,\n} from \"../utils/math-util\";\n\nexport function toAxis(source, offset) {\n\treturn offset.reduce((acc, v, i) => {\n\t\tif (source[i]) {\n\t\t\tacc[source[i]] = v;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(mathUtil.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nexport function getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n","import {glMatrix} from \"gl-matrix\";\nimport {window} from \"../utils/browser\";\n\n// Singleton\nlet screenRotationAngleInst = null;\nlet refCount = 0;\n\nexport default class ScreenRotationAngle {\n\tconstructor() {\n\t\trefCount++;\n\n\t\tif (screenRotationAngleInst) {\n\t\t\treturn screenRotationAngleInst;\n\t\t}\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = this;\n\t\t/* eslint-enable */\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onOrientationChange = this._onOrientationChange.bind(this);\n\n\t\tthis._spinR = 0;\n\n\t\tthis._screenOrientationAngle = 0;\n\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.addEventListener(\"orientationchange\", this._onOrientationChange);\n\t}\n\n\t_onDeviceOrientation(e) {\n\t\tif (e.beta === null || e.gamma === null) {\n\t\t\t// (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it.\n\t\t\treturn;\n\t\t}\n\n\t\t// Radian\n\t\tconst betaR = glMatrix.toRadian(e.beta);\n\t\tconst gammaR = glMatrix.toRadian(e.gamma);\n\n\t\t/* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */\n\t\tthis._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR));\n\t}\n\n\t_onOrientationChange(e) {\n\t\tif (window.screen && window.screen.orientation && window.screen.orientation.angle !== undefined) {\n\t\t\tthis._screenOrientationAngle = screen.orientation.angle;\n\t\t} else if (window.orientation !== undefined) {\n\t\t\t/* iOS */\n\t\t\tthis._screenOrientationAngle = window.orientation >= 0 ?\n\t\t\t\twindow.orientation : 360 + window.orientation;\n\t\t}\n\t}\n\n\tgetRadian() {\n\t\t// Join with screen orientation\n\t\t// this._testVal = this._spinR + \", \" + this._screenOrientationAngle + \", \" + window.orientation;\n\t\treturn this._spinR + glMatrix.toRadian(this._screenOrientationAngle);\n\t}\n\n\tunref() {\n\t\tif (--refCount > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"orientationchange\", this._onOrientationChange);\n\n\t\tthis._spinR = 0;\n\t\tthis._screenOrientationAngle = 0;\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = null;\n\t\t/* eslint-enable */\n\t\trefCount = 0;\n\t}\n}\n","import Axes, {PanInput} from \"@egjs/axes\";\nimport ScreenRotationAngle from \"../ScreenRotationAngle\";\n\n/**\n * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle.\n *\n * The reason for using this function is that in VR mode,\n * the roll angle is adjusted in the direction opposite to the screen rotation angle.\n *\n * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.\n * @extends PanInput\n */\nexport default class RotationPanInput extends PanInput {\n\t/**\n\t * Constructor\n\t *\n\t * @private\n\t * @param {HTMLElement} el target element\n\t * @param {Object} [options] The option object\n\t * @param {Boolean} [options.useRotation] Whether to use rotation(or VR)\n\t */\n\tconstructor(el, options) {\n\t\tsuper(el, options);\n\n\t\tthis._useRotation = false;\n\t\tthis._screenRotationAngle = null;\n\n\t\tthis.setUseRotation(!!(options && options.useRotation));\n\n\t\tthis._userDirection = Axes.DIRECTION_ALL;\n\t}\n\n\tsetUseRotation(useRotation) {\n\t\tthis._useRotation = useRotation;\n\n\t\tif (this._screenRotationAngle) {\n\t\t\tthis._screenRotationAngle.unref();\n\t\t\tthis._screenRotationAngle = null;\n\t\t}\n\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle = new ScreenRotationAngle();\n\t\t}\n\t}\n\n\tconnect(observer) {\n\t\t// User intetened direction\n\t\tthis._userDirection = this._direction;\n\n\t\t// In VR Mode, Use ALL direction if direction is not none\n\t\t// Because horizontal and vertical is changed dynamically by screen rotation.\n\t\t// this._direction is used to initialize hammerjs\n\t\tif (this._useRotation && (this._direction & Axes.DIRECTION_ALL)) {\n\t\t\tthis._direction = Axes.DIRECTION_HORIZONTAL;\n\t\t}\n\n\t\tsuper.connect(observer);\n\t}\n\n\tgetOffset(properties, useDirection) {\n\t\tif (this._useRotation === false) {\n\t\t\treturn super.getOffset(properties, useDirection);\n\t\t}\n\n\t\tconst offset = super.getOffset(properties, [true, true]);\n\t\tconst newOffset = [0, 0];\n\n\t\tconst theta = this._screenRotationAngle.getRadian();\n\n\t\tconst cosTheta = Math.cos(theta);\n\t\tconst sinTheta = Math.sin(theta);\n\n\t\t// RotateZ\n\t\tnewOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta;\n\t\tnewOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta;\n\n\t\t// Use only user allowed direction.\n\t\tif (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) {\n\t\t\tnewOffset[0] = 0;\n\t\t} else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) {\n\t\t\tnewOffset[1] = 0;\n\t\t}\n\n\t\treturn newOffset;\n\t}\n\n\tdestroy() {\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle && this._screenRotationAngle.unref();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n\n/**\n * Override getDirectionByAngle to return DIRECTION_ALL\n * Ref: https://github.com/naver/egjs-axes/issues/99\n *\n * But we obey axes's rule. If axes's rule is problem, let's apply following code.\n */\n// PanInput.getDirectionByAngle = function (angle, thresholdAngle) {\n// \treturn DIRECTION_ALL;\n// };\n","import Component from \"@egjs/component\";\nimport {vec3, glMatrix, quat} from \"gl-matrix\";\nimport FusionPoseSensor from \"./input/FusionPoseSensor\";\n\nconst Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0);\n\nexport default class DeviceQuaternion extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._fusionPoseSensor = new FusionPoseSensor();\n\t\tthis._quaternion = quat.create();\n\n\t\tthis._fusionPoseSensor.enable();\n\t\tthis._fusionPoseSensor.on(\"change\", e => {\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis.trigger(\"change\", {isTrusted: true});\n\t\t});\n\t}\n\n\tgetCombinedQuaternion(yaw) {\n\t\tconst yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw));\n\t\tconst conj = quat.conjugate(quat.create(), this._quaternion);\n\t\t// Multiply pitch quaternion -> device quaternion -> yaw quaternion\n\t\tconst outQ = quat.multiply(quat.create(), conj, yawQ);\n\n\t\treturn outQ;\n\t}\n\n\tdestroy() {\n\t\t// detach all event handler\n\t\tthis.off();\n\n\t\tif (this._fusionPoseSensor) {\n\t\t\tthis._fusionPoseSensor.off();\n\t\t\tthis._fusionPoseSensor.destroy();\n\t\t\tthis._fusionPoseSensor = null;\n\t\t}\n\t}\n}\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport Axes, {PinchInput, MoveKeyInput, WheelInput} from \"@egjs/axes\";\nimport {vec2, glMatrix} from \"gl-matrix\";\nimport {getComputedStyle, SUPPORT_TOUCH, SUPPORT_DEVICEMOTION} from \"../utils/browserFeature\";\nimport TiltMotionInput from \"./input/TiltMotionInput\";\nimport RotationPanInput from \"./input/RotationPanInput\";\nimport DeviceQuaternion from \"./DeviceQuaternion\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {\n\tGYRO_MODE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\tTOUCH_DIRECTION_NONE,\n} from \"./consts\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF];\nconst DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF];\nconst CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF];\n\n/**\n * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates.\n *\n * @alias eg.YawPitchControl\n * @extends eg.Component\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n */\nclass YawPitchControl extends Component {\n\tstatic VERSION = VERSION;\n\t// Expose DeviceOrientationControls sub module for test purpose\n\tstatic CONTROL_MODE_VR = CONTROL_MODE_VR;\n\tstatic CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH;\n\tstatic TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL;\n\tstatic TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW;\n\tstatic TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH;\n\tstatic TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE;\n\t/**\n\t * @param {Object} options The option object of the eg.YawPitch module\n\t * @param {Element}[options.element=null] element A base element for the eg.YawPitch module\n\t * @param {Number} [options.yaw=0] initial yaw (degree)\n\t * @param {Number} [options.pitch=0] initial pitch (degree)\n\t * @param {Number} [options.fov=65] initial field of view (degree)\n\t * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown\n\t * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available\n\t * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion.\n\t * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move)\n\t * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw\n\t * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch\n\t * @param {Array} [options.fovRange=[30, 110] Range of FOV\n\t * @param {Number} [options.aspectRatio=1] Aspect Ratio\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\n\t\tconst opt = Object.assign({\n\t\t\telement: null,\n\t\t\tyaw: 0,\n\t\t\tpitch: 0,\n\t\t\tfov: 65,\n\t\t\tshowPolePoint: false,\n\t\t\tuseZoom: true,\n\t\t\tuseKeyboard: true,\n\t\t\tgyroMode: GYRO_MODE.YAWPITCH,\n\t\t\ttouchDirection: TOUCH_DIRECTION_ALL,\n\t\t\tyawRange: DEFAULT_YAW_RANGE,\n\t\t\tpitchRange: DEFAULT_PITCH_RANGE,\n\t\t\tfovRange: [30, 110],\n\t\t\taspectRatio: 1, /* TODO: Need Mandatory? */\n\t\t}, options);\n\n\t\tthis._element = opt.element;\n\t\tthis._initialFov = opt.fov;\n\t\tthis._enabled = false;\n\t\tthis._isAnimating = false;\n\t\tthis._deviceQuaternion = null;\n\n\t\tthis._initAxes(opt);\n\t\tthis.option(opt);\n\t}\n\n\t_initAxes(opt) {\n\t\tconst yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio);\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint);\n\t\tconst useRotation = opt.gyroMode === GYRO_MODE.VR;\n\n\t\tthis.axesPanInput = new RotationPanInput(this._element, {useRotation});\n\t\tthis.axesWheelInput = new WheelInput(this._element, {scale: -4});\n\t\tthis.axesTiltMotionInput = null;\n\t\tthis.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, {scale: -1}) : null;\n\t\tthis.axesMoveKeyInput = new MoveKeyInput(this._element, {scale: [-6, 6]});\n\n\t\tthis.axes = new Axes({\n\t\t\tyaw: {\n\t\t\t\trange: yRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(yRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tpitch: {\n\t\t\t\trange: pRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(pRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tfov: {\n\t\t\t\trange: opt.fovRange,\n\t\t\t\tcircular: [false, false],\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t}, {\n\t\t\tdeceleration: MC_DECELERATION,\n\t\t\tmaximumDuration: MC_MAXIMUM_DURATION\n\t\t}, {\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov\n\t\t}).on({\n\t\t\thold: evt => {\n\t\t\t\t// Restore maximumDuration not to be spin too mush.\n\t\t\t\tthis.axes.options.maximumDuration = MC_MAXIMUM_DURATION;\n\n\t\t\t\tthis.trigger(\"hold\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t\tchange: evt => {\n\t\t\t\tif (evt.delta.fov !== 0) {\n\t\t\t\t\tthis._updateControlScale(evt);\n\t\t\t\t\tthis.updatePanScale();\n\t\t\t\t}\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\trelease: evt => {\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\tanimationStart: evt => {\n\t\t\t},\n\t\t\tanimationEnd: evt => {\n\t\t\t\tthis.trigger(\"animationEnd\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Update Pan Scale\n\t *\n\t * Scale(Sensitivity) values of panning is related with fov and height.\n\t * If at least one of them is changed, this function need to be called.\n\t * @param {*} param\n\t */\n\tupdatePanScale(param = {}) {\n\t\tconst fov = this.axes.get().fov;\n\t\tconst areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);\n\t\tconst scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight;\n\n\t\tthis.axesPanInput.options.scale = [scale, scale];\n\t\tthis.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW;\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * Override component's option method\n\t * to call method for updating values which is affected by option change.\n\t *\n\t * @param {*} args\n\t */\n\toption(...args) {\n\t\tconst argLen = args.length;\n\n\t\t// Getter\n\t\tif (argLen === 0) {\n\t\t\treturn this._getOptions();\n\t\t} else if (argLen === 1 && typeof args[0] === \"string\") {\n\t\t\treturn this._getOptions(args[0]);\n\t\t}\n\n\t\t// Setter\n\t\tconst beforeOptions = Object.assign({}, this.options);\n\t\tlet newOptions = {};\n\t\tlet changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList.\n\n\t\tif (argLen === 1) {\n\t\t\tchangedKeyList = Object.keys(args[0]);\n\t\t\tnewOptions = Object.assign({}, args[0]);\n\t\t} else if (argLen >= 2) {\n\t\t\tchangedKeyList.push(args[0]);\n\t\t\tnewOptions[args[0]] = args[1];\n\t\t}\n\n\t\tthis._setOptions(this._getValidatedOptions(newOptions));\n\t\tthis._applyOptions(changedKeyList, beforeOptions);\n\t\treturn this;\n\t}\n\n\t_getValidatedOptions(newOptions) {\n\t\tif (newOptions.yawRange) {\n\t\t\tnewOptions.yawRange =\n\t\t\t\tthis._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio);\n\t\t}\n\t\tif (newOptions.pitchRange) {\n\t\t\tnewOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov);\n\t\t}\n\t\treturn newOptions;\n\t}\n\n\t_getOptions(key) {\n\t\tlet value;\n\n\t\tif (typeof key === \"string\") {\n\t\t\tvalue = this.options[key];\n\t\t} else if (arguments.length === 0) {\n\t\t\tvalue = this.options;\n\t\t}\n\t\treturn value;\n\t}\n\n\t_setOptions(options) {\n\t\tfor (const key in options) {\n\t\t\tthis.options[key] = options[key];\n\t\t}\n\t}\n\n\t_applyOptions(keys, prevOptions) {\n\t\tconst options = this.options;\n\t\tconst axes = this.axes;\n\t\tconst isVR = options.gyroMode === GYRO_MODE.VR;\n\t\tconst isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH;\n\t\t// If it's VR mode, restrict user interaction to yaw direction only\n\t\tconst touchDirection = isVR ?\n\t\t\t(TOUCH_DIRECTION_YAW & options.touchDirection) :\n\t\t\toptions.touchDirection;\n\n\t\t// If one of below is changed, call updateControlScale()\n\t\tif (keys.some(key =>\n\t\t\tkey === \"showPolePoint\" || key === \"fov\" || key === \"aspectRatio\" ||\n\t\t\tkey === \"yawRange\" || key === \"pitchRange\"\n\t\t)) {\n\t\t\t// If fov is changed, update pan scale\n\t\t\tif (keys.indexOf(\"fov\") >= 0) {\n\t\t\t\taxes.setTo({\"fov\": options.fov});\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\n\t\t\tthis._updateControlScale();\n\t\t}\n\n\t\tif (keys.some(key => key === \"fovRange\")) {\n\t\t\tconst fovRange = options.fovRange;\n\t\t\tconst prevFov = axes.get().fov;\n\t\t\tlet nextFov = axes.get().fov;\n\n\t\t\tvec2.copy(axes.axis.fov.range, fovRange);\n\n\t\t\tif (nextFov < fovRange[0]) {\n\t\t\t\tnextFov = fovRange[0];\n\t\t\t} else if (prevFov > fovRange[1]) {\n\t\t\t\tnextFov = fovRange[1];\n\t\t\t}\n\n\t\t\tif (prevFov !== nextFov) {\n\t\t\t\taxes.setTo({\n\t\t\t\t\tfov: nextFov\n\t\t\t\t}, 0);\n\t\t\t\tthis._updateControlScale();\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"gyroMode\") && SUPPORT_DEVICEMOTION) {\n\t\t\t// Disconnect first\n\t\t\tif (this.axesTiltMotionInput) {\n\t\t\t\tthis.axes.disconnect(this.axesTiltMotionInput);\n\t\t\t\tthis.axesTiltMotionInput.destroy();\n\t\t\t\tthis.axesTiltMotionInput = null;\n\t\t\t}\n\n\t\t\tif (this._deviceQuaternion) {\n\t\t\t\tthis._deviceQuaternion.destroy();\n\t\t\t\tthis._deviceQuaternion = null;\n\t\t\t}\n\n\t\t\tif (isVR) {\n\t\t\t\tthis._initDeviceQuaternion();\n\t\t\t} else if (isYawPitch) {\n\t\t\t\tthis.axesTiltMotionInput = new TiltMotionInput(this._element);\n\t\t\t\tthis.axes.connect([\"yaw\", \"pitch\"], this.axesTiltMotionInput);\n\t\t\t}\n\n\t\t\tthis.axesPanInput.setUseRotation(isVR);\n\t\t}\n\n\t\tif (keys.some(key => key === \"useKeyboard\")) {\n\t\t\tconst useKeyboard = options.useKeyboard;\n\n\t\t\tif (useKeyboard) {\n\t\t\t\taxes.connect([\"yaw\", \"pitch\"], this.axesMoveKeyInput);\n\t\t\t} else {\n\t\t\t\taxes.disconnect(this.axesMoveKeyInput);\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"useZoom\")) {\n\t\t\tconst useZoom = options.useZoom;\n\n\t\t\t// Disconnect first\n\t\t\taxes.disconnect(this.axesWheelInput);\n\t\t\tif (useZoom) {\n\t\t\t\taxes.connect([\"fov\"], this.axesWheelInput);\n\t\t\t}\n\t\t}\n\n\t\tthis._togglePinchInputByOption(options.touchDirection, options.useZoom);\n\n\t\tif (keys.some(key => key === \"touchDirection\")) {\n\t\t\tthis._enabled && this._enableTouch(touchDirection);\n\t\t}\n\t}\n\n\t_togglePinchInputByOption(touchDirection, useZoom) {\n\t\tif (this.axesPinchInput) {\n\t\t\t// disconnect first\n\t\t\tthis.axes.disconnect(this.axesPinchInput);\n\n\t\t\t// If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll.\n\t\t\tif (\n\t\t\t\tuseZoom &&\n\t\t\t\ttouchDirection === TOUCH_DIRECTION_ALL &&\n\t\t\t\t// TODO: Get rid of using private property of axes instance.\n\t\t\t\tthis.axes._inputs.indexOf(this.axesPinchInput) === -1\n\t\t\t) {\n\t\t\t\tthis.axes.connect([\"fov\"], this.axesPinchInput);\n\t\t\t}\n\t\t}\n\t}\n\n\t_enableTouch(direction) {\n\t\t// Disconnect first\n\t\tthis.axesPanInput && this.axes.disconnect(this.axesPanInput);\n\n\t\tconst yawEnabled = direction & TOUCH_DIRECTION_YAW ? \"yaw\" : null;\n\t\tconst pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? \"pitch\" : null;\n\n\t\tthis.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput);\n\t}\n\n\t_initDeviceQuaternion() {\n\t\tthis._deviceQuaternion = new DeviceQuaternion();\n\t\tthis._deviceQuaternion.on(\"change\", e => {\n\t\t\tthis._triggerChange(e);\n\t\t});\n\t}\n\n\t_getValidYawRange(newYawRange, newFov, newAspectRatio) {\n\t\tconst ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1);\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst horizontalFov = fov * ratio;\n\t\tconst isValid = newYawRange[1] - newYawRange[0] >= horizontalFov;\n\n\t\tif (isValid) {\n\t\t\treturn newYawRange;\n\t\t} else {\n\t\t\treturn this.options.yawRange || DEFAULT_YAW_RANGE;\n\t\t}\n\t}\n\n\t_getValidPitchRange(newPitchRange, newFov) {\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst isValid = newPitchRange[1] - newPitchRange[0] >= fov;\n\n\t\tif (isValid) {\n\t\t\treturn newPitchRange;\n\t\t} else {\n\t\t\treturn this.options.pitchRange || DEFAULT_PITCH_RANGE;\n\t\t}\n\t}\n\n\tstatic isCircular(range) {\n\t\treturn range[1] - range[0] < 360 ? [false, false] : [true, true];\n\t}\n\n\t/**\n\t * Update yaw/pitch min/max by 5 factor\n\t *\n\t * 1. showPolePoint\n\t * 2. fov\n\t * 3. yawRange\n\t * 4. pitchRange\n\t * 5. aspectRatio\n\t *\n\t * If one of above is changed, call this function\n\t */\n\t_updateControlScale(changeEvt) {\n\t\tconst opt = this.options;\n\t\tconst fov = this.axes.get().fov;\n\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint);\n\t\tconst yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio);\n\n\t\t// TODO: If not changed!?\n\t\tconst pos = this.axes.get();\n\t\tlet y = pos.yaw;\n\t\tlet p = pos.pitch;\n\n\t\tvec2.copy(this.axes.axis.yaw.range, yRange);\n\t\tvec2.copy(this.axes.axis.pitch.range, pRange);\n\t\tthis.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange);\n\t\tthis.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange);\n\n\t\t/**\n\t\t * update yaw/pitch by it's range.\n\t\t */\n\t\tif (y < yRange[0]) {\n\t\t\ty = yRange[0];\n\t\t} else if (y > yRange[1]) {\n\t\t\ty = yRange[1];\n\t\t}\n\n\t\tif (p < pRange[0]) {\n\t\t\tp = pRange[0];\n\t\t} else if (p > pRange[1]) {\n\t\t\tp = pRange[1];\n\t\t}\n\n\t\tif (changeEvt) {\n\t\t\tchangeEvt.set({\n\t\t\t\tyaw: y,\n\t\t\t\tpitch: p,\n\t\t\t});\n\t\t}\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\t_updatePitchRange(pitchRange, fov, showPolePoint) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\t// Circular pitch on VR\n\t\t\treturn CIRCULAR_PITCH_RANGE;\n\t\t}\n\n\t\tconst verticalAngle = pitchRange[1] - pitchRange[0];\n\t\tconst halfFov = fov / 2;\n\t\tconst isPanorama = verticalAngle < 180;\n\n\t\tif (showPolePoint && !isPanorama) {\n\t\t\t// Use full pinch range\n\t\t\treturn pitchRange.concat();\n\t\t}\n\n\t\t// Round value as movableCood do.\n\t\treturn [pitchRange[0] + halfFov, pitchRange[1] - halfFov];\n\t}\n\n\t_updateYawRange(yawRange, fov, aspectRatio) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\treturn DEFAULT_YAW_RANGE;\n\t\t}\n\n\t\tconst horizontalAngle = yawRange[1] - yawRange[0];\n\n\t\t/**\n\t\t * Full 360 Mode\n\t\t */\n\t\tif (horizontalAngle >= 360) {\n\t\t\t// Don't limit yaw range on Full 360 mode.\n\t\t\treturn yawRange.concat();\n\t\t}\n\n\t\t/**\n\t\t * Panorama mode\n\t\t */\n\t\t// Ref : https://github.com/naver/egjs-view360/issues/290\n\t\tconst halfHorizontalFov =\n\t\t\tmathUtil.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2))));\n\n\t\t// Round value as movableCood do.\n\t\treturn [\n\t\t\tyawRange[0] + halfHorizontalFov,\n\t\t\tyawRange[1] - halfHorizontalFov\n\t\t];\n\t}\n\n\t_triggerChange(evt) {\n\t\tconst pos = this.axes.get();\n\t\tconst opt = this.options;\n\t\tconst event = {\n\t\t\ttargetElement: opt.element,\n\t\t\tisTrusted: evt.isTrusted,\n\t\t};\n\n\t\tevent.yaw = pos.yaw;\n\t\tevent.pitch = pos.pitch;\n\t\tevent.fov = pos.fov;\n\n\t\tif (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) {\n\t\t\tevent.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t\t}\n\t\tthis.trigger(\"change\", event);\n\t}\n\n\t// TODO: makes constant to be logic\n\tstatic adjustAspectRatio(input) {\n\t\tconst inputRange = [\n\t\t\t0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670,\n\t\t\t0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19,\n\t\t\t1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26,\n\t\t\t2.30, 2.60, 3.00, 5.00, 6.00\n\t\t];\n\t\tconst outputRange = [\n\t\t\t0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710,\n\t\t\t0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15,\n\t\t\t1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72,\n\t\t\t1.82, 1.92, 2.00, 2.24, 2.30\n\t\t];\n\n\t\tlet rangeIdx = -1;\n\n\t\tfor (let i = 0; i < inputRange.length - 1; i++) {\n\t\t\tif (inputRange[i] <= input && inputRange[i + 1] >= input) {\n\t\t\t\trangeIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (rangeIdx === -1) {\n\t\t\tif (inputRange[0] > input) {\n\t\t\t\treturn outputRange[0];\n\t\t\t} else {\n\t\t\t\treturn outputRange[outputRange[0].length - 1];\n\t\t\t}\n\t\t}\n\n\t\tconst inputA = inputRange[rangeIdx];\n\t\tconst inputB = inputRange[rangeIdx + 1];\n\t\tconst outputA = outputRange[rangeIdx];\n\t\tconst outputB = outputRange[rangeIdx + 1];\n\n\t\treturn YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA));\n\t}\n\n\tstatic lerp(a, b, fraction) {\n\t\treturn a + fraction * (b - a);\n\t}\n\n\t/**\n\t * Enable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#enable\n\t */\n\tenable() {\n\t\tif (this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._enabled = true;\n\n\t\t// touchDirection is decided by parameter is valid string (Ref. Axes.connect)\n\t\tthis._applyOptions(Object.keys(this.options), this.options);\n\n\t\t// TODO: Is this code is needed? Check later.\n\t\tthis.updatePanScale();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Disable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#disable\n\t */\n\tdisable(persistOrientation) {\n\t\tif (!this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// TODO: Check peristOrientation is needed!\n\t\tif (!persistOrientation) {\n\t\t\tthis._resetOrientation();\n\t\t}\n\t\tthis.axes.disconnect();\n\t\tthis._enabled = false;\n\t\treturn this;\n\t}\n\n\t_resetOrientation() {\n\t\tconst opt = this.options;\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Set one or more of yaw, pitch, fov\n\t *\n\t * @param {Object} coordinate yaw, pitch, fov\n\t * @param {Number} duration Animation duration. if it is above 0 then it's animated.\n\t */\n\tlookAt({yaw, pitch, fov}, duration) {\n\t\tconst pos = this.axes.get();\n\n\t\tconst y = yaw === undefined ? 0 : yaw - pos.yaw;\n\t\tconst p = pitch === undefined ? 0 : pitch - pos.pitch;\n\t\tconst f = fov === undefined ? 0 : fov - pos.fov;\n\n\t\t// Allow duration of animation to have more than MC_MAXIMUM_DURATION.\n\t\tthis.axes.options.maximumDuration = Infinity;\n\n\t\tthis.axes.setBy({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t\tfov: f\n\t\t}, duration);\n\t}\n\n\tgetYawPitch() {\n\t\tconst yawPitch = this.axes.get();\n\n\t\treturn {\n\t\t\tyaw: yawPitch.yaw,\n\t\t\tpitch: yawPitch.pitch,\n\t\t};\n\t}\n\n\tgetFov() {\n\t\treturn this.axes.get().fov;\n\t}\n\n\tgetQuaternion() {\n\t\tconst pos = this.axes.get();\n\n\t\treturn this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t}\n\n\tshouldRenderWithQuaternion() {\n\t\treturn this.options.gyroMode === GYRO_MODE.VR;\n\t}\n\n\t/**\n\t * Destroys objects\n\t */\n\tdestroy() {\n\t\tthis.axes && this.axes.destroy();\n\t\tthis.axisPanInput && this.axisPanInput.destroy();\n\t\tthis.axesWheelInput && this.axesWheelInput.destroy();\n\t\tthis.axesTiltMotionInput && this.axesTiltMotionInput.destroy();\n\t\tthis.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy();\n\t\tthis.axesPinchInput && this.axesPinchInput.destroy();\n\t\tthis.axesMoveKeyInput && this.axesMoveKeyInput.destroy();\n\t\tthis._deviceQuaternion && this._deviceQuaternion.destroy();\n\t}\n}\n\nexport default YawPitchControl;\n","import Component from \"@egjs/component\";\n\nconst STATUS = {\n\t\"NONE\": 0,\n\t\"LOADING\": 1,\n\t\"LOADED\": 2,\n\t\"ERROR\": 3\n};\n\nconst EVENT = {\n\t\"READYSTATECHANGE\": \"readystatechange\"\n};\n\nclass ImageLoader extends Component {\n\tstatic STATUS = STATUS;\n\tconstructor(image) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis._image = null;\n\t\tthis._onceHandlers = [];\n\t\tthis._loadStatus = STATUS.NONE;\n\n\t\timage && this.set(image);\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._image) {\n\t\t\t\trej(\"ImageLoader: image is not defiend\");\n\t\t\t} else if (this._loadStatus === STATUS.LOADED) {\n\t\t\t\tres(this.getElement());\n\t\t\t} else if (this._loadStatus === STATUS.LOADING) {\n\t\t\t\t/* Check isMaybeLoaded() first because there may have\n\t\t\t\t\tposibilities that image already loaded before get is called.\n\t\t\t\t\tfor example calling get on external image onload callback.*/\n\t\t\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\t\tres(this.getElement());\n\t\t\t\t} else {\n\t\t\t\t\tthis.on(EVENT.READYSTATECHANGE, e => {\n\t\t\t\t\t\tif (e.type === STATUS.LOADED) {\n\t\t\t\t\t\t\tres(this.getElement());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trej(\"ImageLoader: failed to load images.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trej(\"ImageLoader: failed to load images\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param image img element or img url or array of img element or array of img url\n\t */\n\tset(image) {\n\t\tthis._loadStatus = STATUS.LOADING;\n\n\t\tthis._image = ImageLoader.createElement(image);\n\n\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.onceLoaded(\n\t\t\tthis._image,\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.LOADED\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.ERROR;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.ERROR\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tstatic createElement(image) {\n\t\tconst images = image instanceof Array ? image : [image];\n\n\t\treturn images.map(img => {\n\t\t\tlet _img = img;\n\n\t\t\tif (typeof img === \"string\") {\n\t\t\t\t_img = new Image();\n\t\t\t\t_img.crossOrigin = \"anonymous\";\n\t\t\t\t_img.src = img;\n\t\t\t}\n\t\t\treturn _img;\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._image.length === 1 ? this._image[0] : this._image;\n\t}\n\n\tstatic isMaybeLoaded(image) {\n\t\tlet result = false;\n\n\t\tif (image instanceof Image) {\n\t\t\tresult = image.complete && image.naturalWidth !== 0;\n\t\t} else if (image instanceof Array) {\n\t\t\tresult = !image.some(img => !img.complete || img.naturalWidth === 0);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonceLoaded(target, onload, onerror) {\n\t\tconst targets = target instanceof Array ? target : [target];\n\t\tconst targetsNotLoaded = targets.filter(img => !ImageLoader.isMaybeLoaded(img));\n\t\tconst loadPromises = targetsNotLoaded.map(img => new Promise((res, rej) => {\n\t\t\tthis._once(img, \"load\", () => (res(img)));\n\t\t\tthis._once(img, \"error\", () => (rej(img)));\n\t\t}));\n\n\t\tPromise.all(loadPromises).then(\n\t\t\tresult => (onload(targets.length === 1 ? targets[0] : targets)),\n\t\t\treason => (onerror(reason))\n\t\t);\n\t}\n\n\t_once(target, type, listener) {\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\ttarget.addEventListener(type, fn);\n\t\tthis._onceHandlers.push({target, type, fn});\n\t}\n\n\tgetStatus() {\n\t\treturn this._loadStatus;\n\t}\n\n\tdestroy() {\n\t\tthis._onceHandlers.forEach(handler => {\n\t\t\thandler.target.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._onceHandlers = [];\n\t\tthis._image.src = \"\";\n\t\tthis._image = null;\n\t\tthis._loadStatus = STATUS.NONE;\n\t}\n}\n\nexport default ImageLoader;\n","// import Agent from \"@egjs/agent\";\n\n/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */\nconst READY_STATUS = {\n\tHAVE_NOTHING: 0, // no information whether or not the audio/video is ready\n\tHAVE_METADATA: 1, // HAVE_METADATA - metadata for the audio/video is ready\n\tHAVE_CURRENT_DATA: 2, // data for the current playback position is available, but not enough data to play next frame/millisecond\n\tHAVE_FUTURE_DATA: 3, // data for the current and at least the next frame is available\n\tHAVE_ENOUGH_DATA: 4, // enough data available to start playing\n\t// below is custom status for failed to load status\n\tLOADING_FAILED: -1\n};\n\nconst READYSTATECHANGE_EVENT_NAME = {};\n\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = \"loadedmetadata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = \"loadeddata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = \"canplay\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = \"canplaythrough\";\n\nexport default class VideoLoader {\n\tconstructor(video) {\n\t\tthis._handlers = [];\n\t\tthis._sourceCount = 0;\n\n\t\t// on iOS safari, 'loadeddata' will not triggered unless the user hits play,\n\t\t// so used 'loadedmetadata' instead.\n\t\tthis._thresholdReadyState = READY_STATUS.HAVE_METADATA;\n\t\tthis._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState];\n\n\t\tthis._loadStatus = (video && video.readyState) || READY_STATUS.HAVE_NOTHING;\n\n\t\tthis._onerror = this._onerror.bind(this);\n\n\t\tvideo && this.set(video);\n\t}\n\n\t_onerror() {\n\t\tthis._errorCount++;\n\t\tif (this._errorCount >= this._sourceCount) {\n\t\t\tthis._loadStatus = READY_STATUS.LOADING_FAILED;\n\t\t\tthis._detachErrorHandler(this._onerror);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src}\n\t */\n\t_appendSourceElement(videoUrl) {\n\t\tlet videoSrc;\n\t\tlet videoType;\n\n\t\tif (typeof videoUrl === \"object\") {\n\t\t\tvideoSrc = videoUrl.src;\n\t\t\tvideoType = videoUrl.type;\n\t\t} else if (typeof videoUrl === \"string\") {\n\t\t\tvideoSrc = videoUrl;\n\t\t}\n\n\t\tif (!videoSrc) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst sourceElement = document.createElement(\"source\");\n\n\t\tsourceElement.src = videoSrc;\n\t\tvideoType && (sourceElement.type = videoType);\n\n\t\tthis._video.appendChild(sourceElement);\n\t\treturn true;\n\t}\n\n\tset(video) {\n\t\tthis._reset(); // reset resources.\n\n\t\tif (!video) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (video instanceof HTMLVideoElement) {\n\t\t\t// video tag\n\t\t\tthis._video = video;\n\t\t} else if (typeof video === \"string\" || typeof video === \"object\") {\n\t\t\t// url\n\t\t\tthis._video = document.createElement(\"video\");\n\t\t\tthis._video.setAttribute(\"crossorigin\", \"anonymous\");\n\t\t\tthis._video.setAttribute(\"webkit-playsinline\", \"\");\n\t\t\tthis._video.setAttribute(\"playsinline\", \"\");\n\n\t\t\tif (video instanceof Array) {\n\t\t\t\tvideo.forEach(v => this._appendSourceElement(v));\n\t\t\t} else {\n\t\t\t\tthis._appendSourceElement(video);\n\t\t\t}\n\n\t\t\tthis._sourceCount = this._video.querySelectorAll(\"source\").length;\n\n\t\t\tif (this._sourceCount > 0) {\n\t\t\t\tif (this._video.readyState < this._thresholdReadyState) {\n\t\t\t\t\tthis._video.load();\n\t\t\t\t\t// attach loading error listener\n\t\t\t\t\tthis._attachErrorHandler(this._onerror);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._video = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t_attachErrorHandler(handler) {\n\t\tthis._video.addEventListener(\"error\", handler);\n\t\tthis._sources = this._video.querySelectorAll(\"source\");\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.addEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\t_detachErrorHandler(handler) {\n\t\tthis._video.removeEventListener(\"error\", handler);\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.removeEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._video) {\n\t\t\t\trej(\"VideoLoader: video is undefined\");\n\t\t\t} else if (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t} else if (this._video.readyState >= this._thresholdReadyState) {\n\t\t\t\tres(this._video);\n\t\t\t} else {\n\t\t\t\t// check errorCnt and reject\n\t\t\t\tconst rejector = () => {\n\t\t\t\t\tif (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\t\t\tthis._detachErrorHandler(rejector);\n\t\t\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis._attachErrorHandler(rejector);\n\t\t\t\tthis._once(this._thresholdEventName, () => res(this._video));\n\t\t\t}\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._video;\n\t}\n\n\tdestroy() {\n\t\tthis._reset();\n\t}\n\n\t_reset() {\n\t\tthis._handlers.forEach(handler => {\n\t\t\tthis._video.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._handlers = [];\n\t\tthis._video = null;\n\n\t\tthis._sourceCount = 0;\n\t\tthis._errorCount = 0;\n\t}\n\n\t_once(type, listener) {\n\t\tconst target = this._video;\n\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\t/* By useCapture mode enabled, you can capture the error event being fired on source(child)*/\n\t\ttarget.addEventListener(type, fn, true);\n\t\tthis._handlers.push({type, fn});\n\t}\n}\n","import Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {STEREO_FORMAT} from \"../../PanoViewer/consts\";\n\nconst latitudeBands = 60;\nconst longitudeBands = 60;\nconst radius = 2;\nconst ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\nlet latIdx;\nlet lngIdx;\n\nfor (latIdx = 0; latIdx <= latitudeBands; latIdx++) {\n\tconst theta = (latIdx / latitudeBands - 0.5) * Math.PI;\n\tconst sinTheta = Math.sin(theta);\n\tconst cosTheta = Math.cos(theta);\n\n\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\tconst phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN;\n\t\tconst sinPhi = Math.sin(phi);\n\t\tconst cosPhi = Math.cos(phi);\n\t\tconst x = cosPhi * cosTheta;\n\t\tconst y = sinTheta;\n\t\tconst z = sinPhi * cosTheta;\n\t\tconst u = lngIdx / longitudeBands;\n\t\tconst v = latIdx / latitudeBands;\n\n\t\ttextureCoordData.push(u, v);\n\t\tvertexPositionData.push(radius * x, radius * y, radius * z);\n\n\t\tif (lngIdx !== longitudeBands && latIdx !== latitudeBands) {\n\t\t\tconst a = latIdx * (longitudeBands + 1) + lngIdx;\n\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t}\n\t}\n}\n\nclass SphereRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tconstructor(format) {\n\t\tsuper();\n\n\t\tthis._stereoFormat = format;\n\t}\n\n\trender(ctx) {\n\t\tconst {gl, shaderProgram} = ctx;\n\n\t\tlet leftEyeScaleOffset;\n\t\tlet rightEyeScaleOffset;\n\n\t\tswitch (this._stereoFormat) {\n\t\t\tcase STEREO_FORMAT.TOP_BOTTOM:\n\t\t\t\tleftEyeScaleOffset = [1, 0.5, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 0.5, 0, 0.5];\n\t\t\t\tbreak;\n\t\t\tcase STEREO_FORMAT.LEFT_RIGHT:\n\t\t\t\tleftEyeScaleOffset = [0.5, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [0.5, 1, 0.5, 0];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tleftEyeScaleOffset = [1, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 1, 0, 0];\n\t\t}\n\n\t\tconst uTexScaleOffset = gl.getUniformLocation(shaderProgram, \"uTexScaleOffset\");\n\n\t\tgl.uniform4fv(uTexScaleOffset, [...leftEyeScaleOffset, ...rightEyeScaleOffset]);\n\n\t\tsuper.render(ctx);\n\t}\n\n\tgetVertexPositionData() {\n\t\treturn SphereRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn SphereRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn SphereRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n}\n\nexport default SphereRenderer;\n","import agent from \"@egjs/agent\";\n\nconst WEBGL_ERROR_CODE = {\n\t\"0\": \"NO_ERROR\",\n\t\"1280\": \"INVALID_ENUM\",\n\t\"1281\": \"INVALID_VALUE\",\n\t\"1282\": \"INVALID_OPERATION\",\n\t\"1285\": \"OUT_OF_MEMORY\",\n\t\"1286\": \"INVALID_FRAMEBUFFER_OPERATION\",\n\t\"37442\": \"CONTEXT_LOST_WEBGL\"\n};\n\nlet webglAvailability = null;\nlet MAX_TEXTURE_SIZE_FOR_TEST = null;\n\nexport default class WebGLUtils {\n\tstatic createShader(gl, type, source) {\n\t\tconst shader = gl.createShader(type);\n\n\t\tgl.shaderSource(shader, source);\n\t\tgl.compileShader(shader);\n\t\tconst success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n\t\tif (success) {\n\t\t\treturn shader;\n\t\t} else {\n\t\t\t// eslint-disable-next-line\n\t\t\tconsole.error(gl.getShaderInfoLog(shader));\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic createProgram(gl, vertexShader, fragmentShader) {\n\t\tconst program = gl.createProgram();\n\n\t\tgl.attachShader(program, vertexShader);\n\t\tgl.attachShader(program, fragmentShader);\n\t\tgl.linkProgram(program);\n\n\t\tgl.detachShader(program, vertexShader);\n\t\tgl.detachShader(program, fragmentShader);\n\t\tgl.deleteShader(vertexShader);\n\t\tgl.deleteShader(fragmentShader);\n\n\t\tconst success = gl.getProgramParameter(program, gl.LINK_STATUS);\n\n\t\tif (success) {\n\t\t\treturn program;\n\t\t}\n\n\t\tgl.deleteProgram(program);\n\t\treturn null;\n\t}\n\n\tstatic initBuffer(gl, target /* bind point */, data, itemSize, attr) {\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer(target, buffer);\n\t\tgl.bufferData(target, data, gl.STATIC_DRAW);\n\n\t\tif (buffer) {\n\t\t\tbuffer.itemSize = itemSize;\n\t\t\tbuffer.numItems = data.length / itemSize;\n\t\t}\n\n\t\tif (attr !== undefined) {\n\t\t\tgl.enableVertexAttribArray(attr);\n\t\t\tgl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\tstatic getWebglContext(canvas, userContextAttributes) {\n\t\tconst webglIdentifiers = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n\t\tlet context = null;\n\t\tconst contextAttributes = Object.assign({\n\t\t\tpreserveDrawingBuffer: false,\n\t\t\tantialias: false,\n\t\t\txrCompatible: true\n\t\t}, userContextAttributes);\n\n\t\tfunction onWebglcontextcreationerror(e) {\n\t\t\treturn e.statusMessage;\n\t\t}\n\n\t\tcanvas.addEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\tfor (let i = 0; i < webglIdentifiers.length; i++) {\n\t\t\ttry {\n\t\t\t\tcontext = canvas.getContext(webglIdentifiers[i], contextAttributes);\n\t\t\t} catch (t) {}\n\t\t\tif (context) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcanvas.removeEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\treturn context;\n\t}\n\n\tstatic createTexture(gl, textureTarget) {\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture(textureTarget, texture);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(textureTarget, null);\n\n\t\treturn texture;\n\t}\n\n\t/**\n\t * Returns the webgl availability of the current browser.\n\t * @method WebGLUtils#isWebGLAvailable\n\t * @retuen {Boolean} isWebGLAvailable\n\t */\n\tstatic isWebGLAvailable() {\n\t\tif (webglAvailability === null) {\n\t\t\tconst canvas = document.createElement(\"canvas\");\n\t\t\tconst webglContext = WebGLUtils.getWebglContext(canvas);\n\n\t\t\twebglAvailability = !!webglContext;\n\n\t\t\t// webglContext Resource forced collection\n\t\t\tif (webglContext) {\n\t\t\t\tconst loseContextExtension = webglContext.getExtension(\"WEBGL_lose_context\");\n\n\t\t\t\tloseContextExtension && loseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t\treturn webglAvailability;\n\t}\n\n\t/**\n\t * Returns whether webgl is stable in the current browser.\n\t * @method WebGLUtils#isStableWebGL\n\t * @retuen {Boolean} isStableWebGL\n\t */\n\tstatic isStableWebGL() {\n\t\tconst agentInfo = agent();\n\t\tlet isStableWebgl = true;\n\n\t\tif (agentInfo.os.name === \"android\") {\n\t\t\tconst version = parseFloat(agentInfo.os.version);\n\n\t\t\tif (version <= 4.3) {\n\t\t\t\tisStableWebgl = false;\n\t\t\t} else if (version === 4.4) {\n\t\t\t\tif (agentInfo.browser.name !== \"chrome\") {\n\t\t\t\t\tisStableWebgl = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isStableWebgl;\n\t}\n\n\tstatic getErrorNameFromWebGLErrorCode(code) {\n\t\tif (!(code in WEBGL_ERROR_CODE)) {\n\t\t\treturn \"UNKNOWN_ERROR\";\n\t\t}\n\n\t\treturn WEBGL_ERROR_CODE[code];\n\t}\n\n\n\t/**\n\t * This function is wrapper for texImage2D to handle exceptions on texImage2D.\n\t * Purpose is to prevent service from being stopped by script error.\n\t *\n\t * @param {*} gl\n\t * @param {*} target\n\t * @param {*} pixels\n\t */\n\tstatic texImage2D(gl, target, pixels) {\n\t\ttry {\n\t\t\tgl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\t\t} catch (error) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.error(\"WebGLUtils.texImage2D error:\", error);\n\t\t\t/* eslint-enable no-console */\n\t\t}\n\t}\n\n\tstatic getMaxTextureSize(gl) {\n\t\t// WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test\n\t\treturn MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\t}\n}\n\n/**\n * This function should not be used in service code. It's provided only for test purpose.\n * It should be set to null or 0 when test is done.\n *\n * @param {Number} size\n */\nfunction setMaxTextureSizeForTestOnlyPurpose(size) {\n\tMAX_TEXTURE_SIZE_FOR_TEST = size;\n}\n\nexport {\n\tsetMaxTextureSizeForTestOnlyPurpose\n};\n","import Component from \"@egjs/component\";\nimport Agent from \"@egjs/agent\";\n\nconst agent = Agent();\nconst isIE11 = agent.browser.name === \"ie\" && agent.browser.majorVersion === 11;\n\nconst EVENTS = {\n\tERROR: \"error\"\n};\n\n/**\n *\n * Extends Component for firing errors occurs internally.\n */\nclass Renderer extends Component {\n\tstatic EVENTS = EVENTS;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._forceDimension = null;\n\t\tthis._pixelCanvas = null;\n\t\tthis._pixelContext = null;\n\t}\n\n\trender({gl, shaderProgram, indexBuffer, mvMatrix, pMatrix}) {\n\t\tgl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n\t\tgl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n\n\t\tif (indexBuffer) {\n\t\t\tgl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n\t\t}\n\t}\n\n\t// Define interface for Renderers\n\t/**\n\t * Following MUST BE DEFINED on Child of Renderer\n\t *\n\t * DATA\n\t *\n\t * - getVertexPositionData\n\t * - getIndexData\n\t * - getTextureCoordData\n\t *\n\t * SOURCE\n\t *\n\t * - getVertexShaderSource\n\t * - getFragmentShaderSource\n\t *\n\t * TEXTURE\n\t *\n\t * - bindTexture\n\t */\n\tgetDimension(pixelSource) {\n\t\tconst width = pixelSource.naturalWidth || pixelSource.videoWidth;\n\t\tconst height = pixelSource.naturalHeight || pixelSource.videoHeight;\n\n\t\treturn {width, height};\n\t}\n\n\t/**\n\t * Update data used by shader\n\t * \t-\n\t *\n\t *\n\t * @param {*} param\n\t */\n\tupdateShaderData(param) {\n\t\t/*\n\t\t* Update following data in implementation layer.\n\t\t* If the data is not changed, it does not need to implement this function.\n\t\t*\n\t\t* - _VERTEX_POSITION_DATA\n\t\t* - _TEXTURE_COORD_DATA\n\t\t* - _INDEX_DATA\n\t\t*/\n\t}\n\n\t/**\n\t *\n\t * @param {HTMLImageElement | HTMLVideoElement} image\n\t * @param {Object = {width, height}} forceDimension Forced dimension to resize\n\t */\n\t_initPixelSource(image, forceDimension) {\n\t\tconst isIE11Video = isIE11 && (image instanceof HTMLVideoElement);\n\n\t\tif (isIE11Video || forceDimension) {\n\t\t\tconst {width, height} = forceDimension || this.getDimension(image);\n\n\t\t\tthis._pixelCanvas = document.createElement(\"canvas\");\n\t\t\tthis._pixelCanvas.width = width;\n\t\t\tthis._pixelCanvas.height = height;\n\t\t\tthis._pixelContext = this._pixelCanvas.getContext(\"2d\");\n\t\t}\n\t\tthis._forceDimension = forceDimension;\n\t}\n\n\t_getPixelSource(image) {\n\t\tif (!this._pixelCanvas) {\n\t\t\treturn image;\n\t\t}\n\n\t\t/**\n\t\t * IE11 && Video\n\t\t * or\n\t\t * Dimension is forced (Image is larger than texture size.)\n\t\t */\n\t\tconst contentDimension = this.getDimension(image);\n\t\tconst textureDimension = this._forceDimension || contentDimension;\n\n\t\tif (this._pixelCanvas.width !== textureDimension.width) {\n\t\t\tthis._pixelCanvas.width = textureDimension.width;\n\t\t}\n\n\t\tif (this._pixelCanvas.height !== textureDimension.height) {\n\t\t\tthis._pixelCanvas.height = textureDimension.height;\n\t\t}\n\n\t\tif (this._forceDimension) {\n\t\t\tthis._pixelContext.drawImage(image,\n\t\t\t\t0, 0, contentDimension.width, contentDimension.height,\n\t\t\t\t0, 0, textureDimension.width, textureDimension.height);\n\t\t} else {\n\t\t\tthis._pixelContext.drawImage(image, 0, 0);\n\t\t}\n\n\t\treturn this._pixelCanvas;\n\t}\n\n\t_extractTileConfig(imageConfig) {\n\t\tlet tileConfig =\n\t\t\tArray.isArray(imageConfig.tileConfig) ?\n\t\t\t\timageConfig.tileConfig : Array(...Array(6)).map(() => imageConfig.tileConfig);\n\n\t\ttileConfig = tileConfig.map(\n\t\t\tconfig => Object.assign({\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}, config)\n\t\t);\n\n\t\treturn tileConfig;\n\t}\n\n\t_triggerError(error) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.error(\"Renderer Error:\", error);\n\t\t/* eslint-enable no-console */\n\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\tmessage: typeof error === \"string\" ? error : error.message\n\t\t});\n\t}\n}\n\nexport default Renderer;\n","import Agent from \"@egjs/agent\";\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {util as mathUtil} from \"../../utils/math-util.js\";\n\nclass CubeRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = null;\n\tstatic _INDEX_DATA = null;\n\tgetVertexPositionData() {\n\t\tCubeRenderer._VERTEX_POSITION_DATA =\n\t\t\tCubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// top\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// bottom\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\n\t\treturn CubeRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\tif (CubeRenderer._INDEX_DATA) {\n\t\t\treturn CubeRenderer._INDEX_DATA;\n\t\t}\n\n\t\tconst indexData = [];\n\t\tconst vertexPositionData = this.getVertexPositionData();\n\n\t\tfor (let i = 0; i < (vertexPositionData.length / 3); i += 4) {\n\t\t\tindexData.push(\n\t\t\t\ti,\n\t\t\t\ti + 2,\n\t\t\t\ti + 1,\n\t\t\t\ti,\n\t\t\t\ti + 3,\n\t\t\t\ti + 2\n\t\t\t);\n\t\t}\n\n\t\tCubeRenderer._INDEX_DATA = indexData;\n\t\treturn indexData;\n\t}\n\n\tstatic extractOrder(imageConfig) {\n\t\treturn imageConfig.order || \"RLUDBF\";\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\tconst vertexOrder = \"BFUDRL\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst base = this.getVertexPositionData();\n\t\tconst tileConfig = this._extractTileConfig(imageConfig);\n\t\tconst elemSize = 3;\n\t\tconst vertexPerTile = 4;\n\t\tconst textureCoordData =\n\t\t\tvertexOrder.split(\"\")\n\t\t\t\t.map(face => tileConfig[order.indexOf(face)])\n\t\t\t\t.map((config, i) => {\n\t\t\t\t\tconst rotation = parseInt(config.rotation / 90, 10);\n\t\t\t\t\tconst ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2];\n\n\t\t\t\t\tfor (let r = 0; r < Math.abs(rotation); r++) {\n\t\t\t\t\t\tif ((config.flipHorizontal && rotation > 0) ||\n\t\t\t\t\t\t\t(!config.flipHorizontal && rotation < 0)) {\n\t\t\t\t\t\t\tordermap_.push(ordermap_.shift());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tordermap_.unshift(ordermap_.pop());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst elemPerTile = elemSize * vertexPerTile;\n\t\t\t\t\tconst tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile);\n\t\t\t\t\tconst tileTemp = [];\n\n\t\t\t\t\tfor (let j = 0; j < vertexPerTile; j++) {\n\t\t\t\t\t\ttileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize);\n\t\t\t\t\t}\n\t\t\t\t\treturn tileTemp;\n\t\t\t\t})\n\t\t\t\t.join()\n\t\t\t\t.split(\",\")\n\t\t\t\t.map(v => parseInt(v, 10));\n\n\t\treturn textureCoordData;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}`;\n\t}\n\n\tupdateTexture(gl, image, imageConfig) {\n\t\tconst baseOrder = \"RLUDBF\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst orderMap = {};\n\n\t\torder.split(\"\").forEach((v, i) => {\n\t\t\torderMap[v] = i;\n\t\t});\n\n\t\ttry {\n\t\t\tif (image instanceof Array) {\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image);\n\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\t\t\t\t\tconst tile = this.extractTileFromImage(\n\t\t\t\t\t\timage, tileIdx, maxCubeMapTextureSize\n\t\t\t\t\t);\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, tile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis._triggerError(e);\n\t\t}\n\t}\n\n\tbindTexture(gl, texture, image, imageConfig) {\n\t\tgl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\t\tthis.updateTexture(gl, image, imageConfig);\n\t}\n\n\tgetSourceTileSize(image) {\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst aspectRatio = width / height;\n\t\tlet inputTextureSize;\n\n\t\tif (aspectRatio === 1 / 6) {\n\t\t\tinputTextureSize = width;\n\t\t} else if (aspectRatio === 6) {\n\t\t\tinputTextureSize = height;\n\t\t} else if (aspectRatio === 2 / 3) {\n\t\t\tinputTextureSize = width / 2;\n\t\t} else {\n\t\t\tinputTextureSize = width / 3;\n\t\t}\n\t\treturn inputTextureSize;\n\t}\n\n\textractTileFromImage(image, tileIdx, outputTextureSize) {\n\t\tconst {width} = this.getDimension(image);\n\t\tconst inputTextureSize = this.getSourceTileSize(image);\n\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = outputTextureSize;\n\t\tcanvas.height = outputTextureSize;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tconst tilePerRow = width / inputTextureSize;\n\n\t\tconst x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow);\n\t\tconst y = parseInt(tileIdx / tilePerRow, 10) * (inputTextureSize);\n\n\t\tcontext.drawImage(\n\t\t\timage, x, y,\n\t\t\tinputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize\n\t\t);\n\t\treturn canvas;\n\t}\n\n\tgetMaxCubeMapTextureSize(gl, image) {\n\t\tconst agent = Agent();\n\t\tconst maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n\t\tlet _imageWidth = this.getSourceTileSize(image);\n\n\t\tif (agent.browser.name === \"ie\" && agent.browser.majorVersion === 11) {\n\t\t\tif (!mathUtil.isPowerOfTwo(_imageWidth)) {\n\t\t\t\tfor (let i = 1; i < maxCubeMapTextureSize; i *= 2) {\n\t\t\t\t\tif (i < _imageWidth) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_imageWidth = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (agent.os.name === \"ios\") {\n\t\t\tconst majorVersion = agent.os.majorVersion;\n\n\t\t\t// ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다.\n\t\t\tif (majorVersion === 9) {\n\t\t\t\t_imageWidth = 1024;\n\t\t\t}\n\t\t\t// ios 8 의 경우 텍스쳐 최대사이즈는 512 이다.\n\t\t\tif (majorVersion === 8) {\n\t\t\t\t_imageWidth = 512;\n\t\t\t}\n\t\t}\n\t\t// maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수\n\t\treturn Math.min(maxCubeMapTextureSize, _imageWidth);\n\t}\n}\n\nexport default CubeRenderer;\n","\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\n\nexport default class CubeStripRenderer extends Renderer {\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}`;\n\t}\n\n\tgetVertexPositionData() {\n\t\tif (!this._vertices) {\n\t\t\tthis._vertices = [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// up\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// down\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\t\t}\n\n\t\treturn this._vertices;\n\t}\n\n\tgetIndexData() {\n\t\t// TODO: 한번만 계산하도록 수정하기\n\t\tconst indices = (() => {\n\t\t\tconst indexData = [];\n\n\t\t\tfor (let i = 0; i < (this._vertices.length / 3); i += 4) {\n\t\t\t\tindexData.push(\n\t\t\t\t\ti,\n\t\t\t\t\ti + 1,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti + 3\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn indexData;\n\t\t})();\n\n\t\treturn indices;\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\t// TODO: make it cols, rows as config.\n\t\tconst cols = 3;\n\t\tconst rows = 2;\n\t\tconst order = imageConfig.order || \"RLUDFB\";\n\t\tlet coords = [];\n\n\t\t// 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다.\n\t\tfor (let r = rows - 1; r >= 0; r--) {\n\t\t\tfor (let c = 0; c < cols; c++) {\n\t\t\t\tconst coord = [\n\t\t\t\t\tc / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, (r + 1) / rows,\n\t\t\t\t\tc / cols, (r + 1) / rows\n\t\t\t\t];\n\n\t\t\t\tcoords.push(coord);\n\t\t\t}\n\t\t}\n\n\t\tconst tileConfigs = this._extractTileConfig(imageConfig);\n\n\t\t// Transform Coord By Flip & Rotation\n\t\tcoords = coords\n\t\t// shrink coord to avoid pixel bleeding\n\t\t\t.map(coord => this._shrinkCoord(coord))\n\t\t\t.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));\n\n\t\t// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치\n\t\treturn \"BFUDRL\".split(\"\")\n\t\t\t.map(face => order.indexOf(face))\n\t\t\t.map(index => coords[index])\n\t\t\t.reduce((acc, val) => acc.concat(val), []);\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\t_transformCoord(coord, tileConfig) {\n\t\tlet newCoord = coord.slice();\n\n\t\tif (tileConfig.flipHorizontal) {\n\t\t\tnewCoord = this._flipHorizontalCoord(newCoord);\n\t\t}\n\n\t\tif (tileConfig.rotation) {\n\t\t\tnewCoord = this._rotateCoord(newCoord, tileConfig.rotation);\n\t\t}\n\n\t\treturn newCoord;\n\t}\n\n\t_shrinkCoord(coord) {\n\t\tconst SHRINK_Y = 0.00;\n\t\tconst SHRINK_X = 0.00;\n\n\t\treturn [\n\t\t\tcoord[0] + SHRINK_X, coord[1] + SHRINK_Y,\n\t\t\tcoord[2] - SHRINK_X, coord[3] + SHRINK_Y,\n\t\t\tcoord[4] - SHRINK_X, coord[5] - SHRINK_Y,\n\t\t\tcoord[6] + SHRINK_X, coord[7] - SHRINK_Y\n\t\t];\n\t}\n\n\t_rotateCoord(coord, rotationAngle) {\n\t\tconst SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord.\n\t\tconst shiftCount = parseInt(rotationAngle / 90, 10) % 4;\n\n\t\tif (shiftCount === 0) {\n\t\t\treturn coord;\n\t\t}\n\n\t\tlet moved;\n\t\tlet rotatedCoord = [];\n\n\t\tif (shiftCount > 0) {\n\t\t\tmoved = coord.splice(0, shiftCount * SIZE);\n\t\t\trotatedCoord = coord.concat(moved);\n\t\t} else {\n\t\t\tmoved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE);\n\t\t\trotatedCoord = moved.concat(coord);\n\t\t}\n\n\t\treturn rotatedCoord;\n\t}\n\n\t_flipHorizontalCoord(coord) {\n\t\treturn [\n\t\t\tcoord[2], coord[3],\n\t\t\tcoord[0], coord[1],\n\t\t\tcoord[6], coord[7],\n\t\t\tcoord[4], coord[5]\n\t\t];\n\t}\n}\n","/**\n * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide})\n * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고)\n * @namespace\n * @name GYRO_MODE\n * @memberof eg.view360.PanoViewer\n */\n/**\n * Disable gyro\n * @ko gyro 비활성화\n * @name NONE\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"none\"\n */\n/**\n * YawPitch Mode\n * @ko YawPitch Mode\n * @name YAWPITCH\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"yawPitch\"\n */\n/**\n * VR Mode\n * @ko VR Mode\n * @name VR\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"VR\"\n */\nimport {GYRO_MODE} from \"../YawPitchControl/consts\";\n\n/**\n * Constant value for errors\n * @ko 에러에 대한 상수 값\n * @namespace\n * @name ERROR_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst ERROR_TYPE = {\n\t/**\n\t * Unsupported device\n\t * @ko 미지원 기기\n\t * @name INVALID_DEVICE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 10\n\t */\n\tINVALID_DEVICE: 10,\n\t/**\n\t * Webgl not support\n\t * @ko WEBGL 미지원\n\t * @name NO_WEBGL\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 11\n\t */\n\tNO_WEBGL: 11,\n\t/**\n\t * Failed to load image\n\t * @ko 이미지 로드 실패\n\t * @name FAIL_IMAGE_LOAD\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 12\n\t */\n\tFAIL_IMAGE_LOAD: 12,\n\t/**\n\t * Failed to bind texture\n\t * @ko 텍스쳐 바인딩 실패\n\t * @name FAIL_BIND_TEXTURE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 13\n\t */\n\tFAIL_BIND_TEXTURE: 13,\n\t/**\n\t * Only one resource(image or video) should be specified\n\t * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t * @name INVALID_RESOURCE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 14\n\t */\n\tINVALID_RESOURCE: 14,\n\t/**\n\t * WebGL context lost occurred\n\t * @ko WebGL context lost 발생\n\t * @name RENDERING_CONTEXT_LOST\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 15\n\t */\n\tRENDERING_CONTEXT_LOST: 15,\n};\n\n/**\n * Constant value for events\n * @ko 이벤트에 대한 상수 값\n * @namespace\n * @name EVENTS\n * @memberof eg.view360.PanoViewer\n */\nconst EVENTS = {\n\t/**\n\t * Events that is fired when PanoViewer is ready to show image and handle user interaction.\n\t * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트\n\t * @name READY\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default ready\n\t */\n\tREADY: \"ready\",\n\t/**\n\t * Events that is fired when direction or fov is changed.\n\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t * @name VIEW_CHANGE\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default viewChange\n\t */\n\tVIEW_CHANGE: \"viewChange\",\n\t/**\n\t * Events that is fired when animation which is triggered by inertia is ended.\n\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t * @name ANIMATION_END\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default animationEnd\n\t */\n\tANIMATION_END: \"animationEnd\",\n\t/**\n\t * Events that is fired when error occurs\n\t * @ko 에러 발생 시 발생하는 이벤트\n\t * @name ERROR\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default error\n\t */\n\tERROR: \"error\"\n};\n\n/**\n * Constant value for projection type\n * @ko 프로젝션 타입 대한 상수 값\n * @namespace\n * @name PROJECTION_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst PROJECTION_TYPE = {\n\t/**\n\t * Constant value for equirectangular type.\n\t * @ko equirectangular 에 대한 상수 값.\n\t * @name EQUIRECTANGULAR\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default equirectangular\n\t */\n\tEQUIRECTANGULAR: \"equirectangular\",\n\t/**\n\t * Constant value for cubemap type.\n\t * @ko cubemap 에 대한 상수 값.\n\t * @name CUBEMAP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubemap\n\t */\n\tCUBEMAP: \"cubemap\",\n\t/**\n\t * Constant value for cubestrip type.\n\t * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC.\n\t *\n\t * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다.\n\t * @name CUBESTRIP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubestrip\n\t */\n\tCUBESTRIP: \"cubestrip\",\n\t/**\n\t * Constant value for PANORAMA type.\n\t *\n\t * PANORAMA is a format for a panorma image which is taken from smartphone.\n\t *\n\t * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다.\n\t *\n\t * @name PANORAMA\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default panorama\n\t */\n\tPANORAMA: \"panorama\",\n\t/**\n\t * Constant value for EQUI_STEREOSCOPY type.\n\t *\n\t * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present.\n\t *\n\t * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다.\n\t *\n\t * @name STEREOSCOPIC_EQUI\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default stereoequi\n\t */\n\tSTEREOSCOPIC_EQUI: \"stereoequi\",\n};\n\n/**\n * A constant value for the format of the stereoscopic equirectangular projection type.\n * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값\n * @namespace\n * @name STEREO_FORMAT\n * @memberof eg.view360.PanoViewer\n */\nconst STEREO_FORMAT = {\n\t/**\n\t * A constant value for format of top bottom stereoscopic 360 equirectangular projection.\n\t * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name TOP_BOTTOM\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dv\"\n\t */\n\tTOP_BOTTOM: \"3dv\",\n\t/**\n\t * A constant value for format of left right stereoscopic 360 equirectangular projection.\n\t * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name LEFT_RIGHT\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dh\"\n\t */\n\tLEFT_RIGHT: \"3dh\",\n\t/**\n\t * A constant value specifying media is not in stereoscopic format.\n\t * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값.\n\t * @name NONE\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"\"\n\t */\n\tNONE: \"\",\n};\n\nexport {\n\tGYRO_MODE,\n\tEVENTS,\n\tERROR_TYPE,\n\tPROJECTION_TYPE,\n\tSTEREO_FORMAT\n};\n","import {glMatrix} from \"gl-matrix\";\nimport Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\n\n// const latitudeBands = 60;\nconst MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6;\nconst longitudeBands = 60;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\n\nclass CylinderRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tgetVertexPositionData() {\n\t\treturn CylinderRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn CylinderRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn CylinderRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\t\tlet resizeDimension;\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device texture limit(${maxSize}))`);\n\n\t\t\t// Request resizing texture.\n\t\t\t/**\n\t\t\t * TODO: Is it need to apply on another projection type?\n\t\t\t */\n\t\t\tresizeDimension = width > height ?\n\t\t\t\t{width: maxSize, height: maxSize * height / width} :\n\t\t\t\t{width: maxSize * width / height, height: maxSize};\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video or resizing needed\n\t\tthis._initPixelSource(image, resizeDimension);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\tupdateShaderData({imageAspectRatio = MIN_ASPECT_RATIO_FOR_FULL_PANORAMA}) {\n\t\tlet lngIdx;\n\t\tlet cylinderMaxRadian;\n\t\tlet halfCylinderY;\n\t\tlet rotated;\n\t\tlet aspectRatio;\n\n\t\t// Exception case: orientation is rotated.\n\t\tif (imageAspectRatio < 1) {\n\t\t\t/**\n\t\t\t * If rotated is true, we assume that image is rotated counter clockwise.\n\t\t\t * TODO: If there's other rotation, it is need to implement by each rotation.\n\t\t\t */\n\t\t\trotated = true;\n\t\t\taspectRatio = 1 / imageAspectRatio;\n\t\t} else {\n\t\t\trotated = false;\n\t\t\taspectRatio = imageAspectRatio;\n\t\t}\n\n\t\tif (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) {\n\t\t\tconst fov = 360 / aspectRatio;\n\n\t\t\tcylinderMaxRadian = 2 * Math.PI; // 360 deg\n\t\t\thalfCylinderY = Math.tan(glMatrix.toRadian(fov / 2));\n\t\t} else {\n\t\t\tcylinderMaxRadian = aspectRatio;\n\t\t\thalfCylinderY = 0.5;// Range of cylinder is [-0.5, 0.5] to make height to 1.\n\t\t}\n\n\t\t// intialize shader data before update\n\t\ttextureCoordData.length = 0;\n\t\tvertexPositionData.length = 0;\n\t\tindexData.length = 0;\n\n\t\tconst CYLIDER_Y = [-halfCylinderY, halfCylinderY];\n\t\tconst startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360)\n\n\t\t// console.log(\"cylinderMaxRadian:\", glMatrix.toDegree(cylinderMaxRadian), \"CYLIDER_Y\", CYLIDER_Y, \"start angle\", glMatrix.toDegree(startAngleForCenterAlign));\n\t\tfor (let yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength/* bottom & top */; yIdx++) {\n\t\t\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\t\t\tconst angle = startAngleForCenterAlign + (lngIdx / longitudeBands * cylinderMaxRadian);\n\t\t\t\tconst x = Math.cos(angle);\n\t\t\t\tconst y = CYLIDER_Y[yIdx];\n\t\t\t\tconst z = Math.sin(angle);\n\t\t\t\tlet u;\n\t\t\t\tlet v;\n\n\t\t\t\tif (rotated) {\n\t\t\t\t\t// Rotated 90 degree (counter clock wise)\n\t\t\t\t\tu = 1 - yIdx; // yLength - yIdx;\n\t\t\t\t\tv = lngIdx / longitudeBands;\n\t\t\t\t} else {\n\t\t\t\t// \t// Normal case (Not rotated)\n\t\t\t\t\tu = lngIdx / longitudeBands;\n\t\t\t\t\tv = yIdx;\n\t\t\t\t}\n\n\t\t\t\ttextureCoordData.push(u, v);\n\t\t\t\tvertexPositionData.push(x, y, z);\n\n\t\t\t\tif (yIdx === 0 && lngIdx < longitudeBands) {\n\t\t\t\t\tconst a = lngIdx;\n\t\t\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default CylinderRenderer;\n","import {mat4} from \"gl-matrix\";\n\nconst VR_DISPLAY_PRESENT_CHANGE = \"vrdisplaypresentchange\";\nconst DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1];\nconst DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1];\nconst EYES = {\n\tLEFT: \"left\",\n\tRIGHT: \"right\"\n};\n\nclass VRManager {\n\tget context() { return this._vrDisplay; }\n\n\tconstructor() {\n\t\tthis._frameData = new window.VRFrameData();\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst vrDisplay = this._vrDisplay;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (vrDisplay && vrDisplay.isPresenting) {\n\t\t\tvrDisplay.exitPresent();\n\t\t}\n\n\t\tthis._clear();\n\t}\n\n\tcanRender() {\n\t\treturn Boolean(this._vrDisplay);\n\t}\n\n\tbeforeRender(gl) {\n\t\t// Render to the default backbuffer\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t}\n\n\tafterRender() {\n\t\tthis._vrDisplay.submitFrame();\n\t}\n\n\tgetEyeParams(gl) {\n\t\tconst display = this._vrDisplay;\n\t\tconst halfWidth = gl.drawingBufferWidth * 0.5;\n\t\tconst height = gl.drawingBufferHeight;\n\t\tconst frameData = this._frameData;\n\n\t\tdisplay.getFrameData(frameData);\n\n\t\tconst leftMVMatrix = frameData.leftViewMatrix;\n\t\tconst rightMVMatrix = frameData.rightViewMatrix;\n\n\t\tmat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset);\n\t\tmat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tviewport: [0, 0, halfWidth, height],\n\t\t\t\tmvMatrix: leftMVMatrix,\n\t\t\t\tpMatrix: frameData.leftProjectionMatrix,\n\t\t\t},\n\t\t\t{\n\t\t\t\tviewport: [halfWidth, 0, halfWidth, height],\n\t\t\t\tmvMatrix: rightMVMatrix,\n\t\t\t\tpMatrix: frameData.rightProjectionMatrix,\n\t\t\t}\n\t\t];\n\t}\n\n\tisPresenting() {\n\t\treturn Boolean(this._vrDisplay && this._vrDisplay.isPresenting);\n\t}\n\n\taddEndCallback(callback) {\n\t\twindow.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\twindow.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\trequestPresent(canvas) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tnavigator.getVRDisplays().then(displays => {\n\t\t\t\tconst vrDisplay = displays.length && displays[0];\n\n\t\t\t\tif (!vrDisplay) {\n\t\t\t\t\treject(new Error(\"No displays available.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!vrDisplay.capabilities.canPresent) {\n\t\t\t\t\treject(new Error(\"Display lacking capability to present.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvrDisplay.requestPresent([{source: canvas}]).then(() => {\n\t\t\t\t\tconst leftEye = vrDisplay.getEyeParameters(EYES.LEFT);\n\t\t\t\t\tconst rightEye = vrDisplay.getEyeParameters(EYES.RIGHT);\n\n\t\t\t\t\tcanvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;\n\t\t\t\t\tcanvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);\n\n\t\t\t\t\tthis._setDisplay(vrDisplay);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setDisplay(vrDisplay) {\n\t\tthis._vrDisplay = vrDisplay;\n\n\t\tconst layers = vrDisplay.getLayers();\n\n\t\tif (layers.length) {\n\t\t\tconst layer = layers[0];\n\n\t\t\tthis._leftBounds = layer.leftBounds;\n\t\t\tthis._rightBounds = layer.rightBounds;\n\t\t}\n\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._vrDisplay = null;\n\t\tthis._leftBounds = DEFAULT_LEFT_BOUNDS;\n\t\tthis._rightBounds = DEFAULT_RIGHT_BOUNDS;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default VRManager;\n","import {mat4, glMatrix} from \"gl-matrix\";\nimport {IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\n\nconst XR_REFERENCE_SPACE = \"local\";\n\nclass XRManager {\n\tget context() { return this._xrSession; }\n\n\tconstructor() {\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst xrSession = this._xrSession;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (xrSession) {\n\t\t\t// Capture to avoid errors\n\t\t\txrSession.end().then(() => {}, () => {});\n\t\t}\n\t\tthis._clear();\n\t}\n\n\tcanRender(frame) {\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\treturn Boolean(pose);\n\t}\n\n\tbeforeRender(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst baseLayer = session.renderState.baseLayer;\n\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer);\n\t}\n\n\tafterRender() {}\n\n\tgetEyeParams(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\tif (!pose) {\n\t\t\t// Can't render\n\t\t\treturn null;\n\t\t}\n\n\t\tconst glLayer = session.renderState.baseLayer;\n\n\t\treturn pose.views.map(view => {\n\t\t\tconst viewport = glLayer.getViewport(view);\n\t\t\tconst mvMatrix = view.transform.inverse.matrix;\n\n\t\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\t\tmat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180));\n\t\t\t}\n\n\t\t\tmat4.rotateY(mvMatrix, mvMatrix, this._yawOffset);\n\n\t\t\treturn {\n\t\t\t\tviewport: [viewport.x, viewport.y, viewport.width, viewport.height],\n\t\t\t\tmvMatrix,\n\t\t\t\tpMatrix: view.projectionMatrix\n\t\t\t};\n\t\t});\n\t}\n\n\tisPresenting() {\n\t\treturn this._presenting;\n\t}\n\n\taddEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.addEventListener(\"end\", callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.removeEventListener(\"end\", callback);\n\t}\n\n\trequestPresent(canvas, gl) {\n\t\treturn navigator.xr.requestSession(\"immersive-vr\", {\n\t\t\trequiredFeatures: [XR_REFERENCE_SPACE],\n\t\t}).then(session => {\n\t\t\tconst xrLayer = new window.XRWebGLLayer(session, gl);\n\n\t\t\tsession.updateRenderState({baseLayer: xrLayer});\n\t\t\treturn session.requestReferenceSpace(XR_REFERENCE_SPACE)\n\t\t\t\t.then(refSpace => {\n\t\t\t\t\tthis._setSession(session, xrLayer, refSpace);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setSession(session, xrLayer, refSpace) {\n\t\tthis._xrSession = session;\n\t\tthis._xrLayer = xrLayer;\n\t\tthis._xrRefSpace = refSpace;\n\t\tthis._presenting = true;\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._xrSession = null;\n\t\tthis._xrLayer = null;\n\t\tthis._xrRefSpace = null;\n\t\tthis._presenting = false;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default XRManager;\n","import {IS_SAFARI_ON_DESKTOP} from \"../utils/browser\";\n\nclass WebGLAnimator {\n\tconstructor() {\n\t\tthis._callback = null;\n\t\tthis._context = window;\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\tsetCallback(callback) {\n\t\tthis._callback = callback;\n\t}\n\n\tsetContext(context) {\n\t\tthis._context = context;\n\t}\n\n\tstart() {\n\t\tconst context = this._context;\n\t\tconst callback = this._callback;\n\n\t\t// No context / callback set\n\t\tif (!context || !callback) return;\n\t\t// Animation already started\n\t\tif (this._rafId >= 0 || this._rafTimer >= 0) return;\n\n\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoopNextTick);\n\t\t} else {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoop);\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this._rafId >= 0) {\n\t\t\tthis._context.cancelAnimationFrame(this._rafId);\n\t\t}\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t}\n\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\t/**\n\t * There can be more than 1 argument when we use XRSession's raf\n\t */\n\t_onLoop = (...args) => {\n\t\tthis._callback(...args);\n\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t}\n\n\t/**\n\t * MacOS X Safari Bug Fix\n\t * This code guarantees that rendering should be occurred.\n\t *\n\t * In MacOS X(10.14.2), Safari (12.0.2)\n\t * The requestAnimationFrame(RAF) callback is called just after previous RAF callback without term\n\t * only if requestAnimationFrame is called for next frame while updating frame is delayed (~over 2ms)\n\t * So browser cannot render the frame and may be freezing.\n\t */\n\t_onLoopNextTick = (...args) => {\n\t\tconst before = performance.now();\n\n\t\tthis._callback(...args);\n\n\t\tconst diff = performance.now() - before;\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t\tthis._rafTimer = -1;\n\t\t}\n\n\t\t/** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */\n\t\tif (diff < 16) {\n\t\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t\t} else {\n\t\t\t/** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/\n\t\t\tthis._rafTimer = setTimeout(this._onLoop, 0);\n\t\t}\n\t}\n}\n\nexport default WebGLAnimator;\n","import Component from \"@egjs/component\";\nimport {glMatrix, vec3, mat3, mat4, quat} from \"gl-matrix\";\nimport ImageLoader from \"./ImageLoader\";\nimport VideoLoader from \"./VideoLoader\";\nimport WebGLUtils from \"./WebGLUtils\";\nimport Renderer from \"./renderer/Renderer\";\nimport CubeRenderer from \"./renderer/CubeRenderer\";\nimport CubeStripRenderer from \"./renderer/CubeStripRenderer\";\nimport SphereRenderer from \"./renderer/SphereRenderer\";\nimport CylinderRenderer from \"./renderer/CylinderRenderer\";\nimport VRManager from \"./vr/VRManager\";\nimport XRManager from \"./vr/XRManager\";\nimport WebGLAnimator from \"./WebGLAnimator\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {devicePixelRatio, WEBXR_SUPPORTED} from \"../utils/browserFeature\";\nimport {PROJECTION_TYPE, STEREO_FORMAT} from \"../PanoViewer/consts\";\nimport {IS_IOS} from \"../utils/browser\";\n\nconst ImageType = PROJECTION_TYPE;\n\nlet DEVICE_PIXEL_RATIO = devicePixelRatio || 1;\n\n// DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다.\nif (DEVICE_PIXEL_RATIO > 2) {\n\tDEVICE_PIXEL_RATIO = 2;\n}\n\n// define custom events name\n/**\n * TODO: how to manage events/errortype with PanoViewer\n *\n * I think renderer events should be seperated from viewer events although it has same name.\n */\nconst EVENTS = {\n\tBIND_TEXTURE: \"bindTexture\",\n\tIMAGE_LOADED: \"imageLoaded\",\n\tERROR: \"error\",\n\tRENDERING_CONTEXT_LOST: \"renderingContextLost\",\n\tRENDERING_CONTEXT_RESTORE: \"renderingContextRestore\",\n};\n\nconst ERROR_TYPE = {\n\tINVALID_DEVICE: 10,\n\tNO_WEBGL: 11,\n\tFAIL_IMAGE_LOAD: 12,\n\tRENDERER_ERROR: 13\n};\n\nclass PanoImageRenderer extends Component {\n\tstatic EVENTS = EVENTS;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\n\tconstructor(\n\t\timage, width, height, isVideo, sphericalConfig, renderingContextAttributes\n\t) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis.sphericalConfig = sphericalConfig;\n\t\tthis.fieldOfView = sphericalConfig.fieldOfView;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tthis._lastQuaternion = null;\n\t\tthis._lastYaw = null;\n\t\tthis._lastPitch = null;\n\t\tthis._lastFieldOfView = null;\n\n\t\tthis.pMatrix = mat4.create();\n\t\tthis.mvMatrix = mat4.create();\n\n\t\t// initialzie pMatrix\n\t\tmat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), width / height, 0.1, 100);\n\n\t\tthis.textureCoordBuffer = null;\n\t\tthis.vertexBuffer = null;\n\t\tthis.indexBuffer = null;\n\n\t\tthis.canvas = this._initCanvas(width, height);\n\t\tthis._setDefaultCanvasStyle();\n\t\tthis._wrapper = null; // canvas wrapper\n\t\tthis._wrapperOrigStyle = null;\n\n\t\tthis._renderingContextAttributes = renderingContextAttributes;\n\t\tthis._image = null;\n\t\tthis._imageConfig = null;\n\t\tthis._imageIsReady = false;\n\t\tthis._shouldForceDraw = false;\n\t\tthis._keepUpdate = false; // Flag to specify 'continuous update' on video even when still.\n\n\t\tthis._onContentLoad = this._onContentLoad.bind(this);\n\t\tthis._onContentError = \tthis._onContentError.bind(this);\n\n\t\tthis._animator = new WebGLAnimator();\n\n\t\t// VR/XR manager\n\t\tthis._vr = null;\n\n\t\tif (image) {\n\t\t\tthis.setImage({\n\t\t\t\timage,\n\t\t\t\timageType: sphericalConfig.imageType,\n\t\t\t\tisVideo,\n\t\t\t\tcubemapConfig: sphericalConfig.cubemapConfig\n\t\t\t});\n\t\t}\n\t}\n\n\t// FIXME: Please refactor me to have more loose connection to yawpitchcontrol\n\tsetYawPitchControl(yawPitchControl) {\n\t\tthis._yawPitchControl = yawPitchControl;\n\t}\n\n\tgetContent() {\n\t\treturn this._image;\n\t}\n\n\tsetImage({image, imageType, isVideo = false, cubemapConfig}) {\n\t\tthis._imageIsReady = false;\n\t\tthis._isVideo = isVideo;\n\t\tthis._imageConfig = Object.assign(\n\t\t\t{\n\t\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only */\n\t\t\t\torder: (imageType === ImageType.CUBEMAP) ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\t\ttileConfig: {\n\t\t\t\t\tflipHorizontal: false,\n\t\t\t\t\trotation: 0\n\t\t\t\t}\n\t\t\t},\n\t\t\tcubemapConfig\n\t\t);\n\t\tthis._setImageType(imageType);\n\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tif (isVideo) {\n\t\t\tthis._contentLoader = new VideoLoader();\n\t\t\tthis._keepUpdate = true;\n\t\t} else {\n\t\t\tthis._contentLoader = new ImageLoader();\n\t\t\tthis._keepUpdate = false;\n\t\t}\n\n\t\t// img element or img url\n\t\tthis._contentLoader.set(image);\n\n\t\t// 이미지의 사이즈를 캐시한다.\n\t\t// image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed.\n\t\tthis._image = this._contentLoader.getElement();\n\n\t\treturn this._contentLoader.get()\n\t\t\t.then(this._onContentLoad, this._onContentError)\n\t\t\t.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.\n\t}\n\n\t_setImageType(imageType) {\n\t\tif (!imageType || this._imageType === imageType) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._imageType = imageType;\n\t\tthis._isCubeMap = imageType === ImageType.CUBEMAP;\n\n\t\tif (this._renderer) {\n\t\t\tthis._renderer.off();\n\t\t}\n\n\t\tswitch (imageType) {\n\t\t\tcase ImageType.CUBEMAP:\n\t\t\t\tthis._renderer = new CubeRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.CUBESTRIP:\n\t\t\t\tthis._renderer = new CubeStripRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.PANORAMA:\n\t\t\t\tthis._renderer = new CylinderRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.STEREOSCOPIC_EQUI:\n\t\t\t\tthis._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis._renderer = new SphereRenderer(STEREO_FORMAT.NONE);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis._renderer.on(Renderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERER_ERROR,\n\t\t\t\tmessage: e.message\n\t\t\t});\n\t\t});\n\n\t\tthis._initWebGL();\n\t}\n\n\t_initCanvas(width, height) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\n\t\tthis._onWebglcontextlost = this._onWebglcontextlost.bind(this);\n\t\tthis._onWebglcontextrestored = this._onWebglcontextrestored.bind(this);\n\n\t\tcanvas.addEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tcanvas.addEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\n\t\treturn canvas;\n\t}\n\n\t_setDefaultCanvasStyle() {\n\t\tconst canvas = this.canvas;\n\n\t\tcanvas.style.bottom = 0;\n\t\tcanvas.style.left = 0;\n\t\tcanvas.style.right = 0;\n\t\tcanvas.style.top = 0;\n\t\tcanvas.style.margin = \"auto\";\n\t\tcanvas.style.maxHeight = \"100%\";\n\t\tcanvas.style.maxWidth = \"100%\";\n\t\tcanvas.style.outline = \"none\";\n\t\tcanvas.style.position = \"absolute\";\n\t}\n\n\t_onContentError(error) {\n\t\tthis._imageIsReady = false;\n\t\tthis._image = null;\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\ttype: ERROR_TYPE.FAIL_IMAGE_LOAD,\n\t\t\tmessage: \"failed to load image\"\n\t\t});\n\n\t\treturn false;\n\t}\n\n\t_triggerContentLoad() {\n\t\tthis.trigger(EVENTS.IMAGE_LOADED, {\n\t\t\tcontent: this._image,\n\t\t\tisVideo: this._isVideo,\n\t\t\tprojectionType: this._imageType\n\t\t});\n\t}\n\t_onContentLoad(image) {\n\t\tthis._imageIsReady = true;\n\n\t\tthis._triggerContentLoad();\n\t\treturn true;\n\t}\n\n\tisImageLoaded() {\n\t\treturn !!this._image && this._imageIsReady &&\n\t\t\t(!this._isVideo || this._image.readyState >= 2 /* HAVE_CURRENT_DATA */);\n\t}\n\n\tbindTexture() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._contentLoader) {\n\t\t\t\trej(\"ImageLoader is not initialized\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._contentLoader.get()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis._bindTexture();\n\t\t\t\t}, rej)\n\t\t\t\t.then(res);\n\t\t});\n\t}\n\n\t// 부모 엘리먼트에 canvas 를 붙임\n\tattachTo(parentElement) {\n\t\tthis.detach();\n\t\tparentElement.appendChild(this.canvas);\n\t\tthis._wrapper = parentElement;\n\t}\n\n\tforceContextLoss() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\tconst loseContextExtension = this.context.getExtension(\"WEBGL_lose_context\");\n\n\t\t\tif (loseContextExtension) {\n\t\t\t\tloseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t}\n\n\t// 부모 엘리먼트에서 canvas 를 제거\n\tdetach() {\n\t\tif (this.canvas.parentElement) {\n\t\t\tthis.canvas.parentElement.removeChild(this.canvas);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tthis._animator.stop();\n\t\tthis.detach();\n\t\tthis.forceContextLoss();\n\n\t\tthis.off();\n\n\t\tthis.canvas.removeEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tthis.canvas.removeEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\t}\n\n\thasRenderingContext() {\n\t\tif (!(this.context && !this.context.isContextLost())) {\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tthis.context &&\n\t\t\t!this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t_initShaderProgram() {\n\t\tconst gl = this.context;\n\n\t\tif (this.shaderProgram) {\n\t\t\tgl.deleteProgram(this.shaderProgram);\n\t\t\tthis.shaderProgram = null;\n\t\t}\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst vsSource = renderer.getVertexShaderSource();\n\t\tconst fsSource = renderer.getFragmentShaderSource();\n\n\t\tconst vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource);\n\t\tconst fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource);\n\n\t\tconst shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader);\n\n\t\tif (!shaderProgram) {\n\t\t\tthrow new Error(`Failed to intialize shaders: ${WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())}`);\n\t\t}\n\n\t\tgl.useProgram(shaderProgram);\n\t\tshaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\");\n\t\tgl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);\n\t\tshaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, \"uPMatrix\");\n\t\tshaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, \"uMVMatrix\");\n\t\tshaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, \"uSampler\");\n\t\tshaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, \"aTextureCoord\");\n\t\tshaderProgram.uEye = gl.getUniformLocation(shaderProgram, \"uEye\");\n\n\t\tgl.enableVertexAttribArray(shaderProgram.textureCoordAttribute);\n\n\t\t// clear buffer\n\t\tgl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n\t\t// Use TEXTURE0\n\t\tgl.uniform1i(shaderProgram.samplerUniform, 0);\n\n\t\tthis.shaderProgram = shaderProgram;\n\t}\n\n\t_onWebglcontextlost(e) {\n\t\te.preventDefault();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_LOST);\n\t}\n\n\t_onWebglcontextrestored(e) {\n\t\tthis._initWebGL();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_RESTORE);\n\t}\n\n\tupdateFieldOfView(fieldOfView) {\n\t\tthis.fieldOfView = fieldOfView;\n\t\tthis._updateViewport();\n\t}\n\n\tupdateViewportDimensions(width, height) {\n\t\tlet viewPortChanged = false;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tconst w = width * DEVICE_PIXEL_RATIO;\n\t\tconst h = height * DEVICE_PIXEL_RATIO;\n\n\t\tif (w !== this.canvas.width) {\n\t\t\tthis.canvas.width = w;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (h !== this.canvas.height) {\n\t\t\tthis.canvas.height = h;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (!viewPortChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._updateViewport();\n\t\tthis._shouldForceDraw = true;\n\t}\n\n\t_updateViewport() {\n\t\tmat4.perspective(\n\t\t\tthis.pMatrix,\n\t\t\tglMatrix.toRadian(this.fieldOfView),\n\t\t\tthis.canvas.width / this.canvas.height,\n\t\t\t0.1,\n\t\t\t100);\n\n\t\tthis.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight);\n\t}\n\n\t_initWebGL() {\n\t\tlet gl;\n\n\t\t// TODO: Following code does need to be executed only if width/height, cubicStrip property is changed.\n\t\ttry {\n\t\t\tthis._initRenderingContext();\n\t\t\tgl = this.context;\n\n\t\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\t\tthis._initShaderProgram();\n\t\t} catch (e) {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\tmessage: \"no webgl support\"\n\t\t\t});\n\t\t\tthis.destroy();\n\t\t\tconsole.error(e); // eslint-disable-line no-console\n\t\t\treturn;\n\t\t}\n\t\t// 캔버스를 투명으로 채운다.\n\t\tgl.clearColor(0, 0, 0, 0);\n\t\tconst textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n\n\t\tif (this.texture) {\n\t\t\tgl.deleteTexture(this.texture);\n\t\t}\n\n\t\tthis.texture = WebGLUtils.createTexture(gl, textureTarget);\n\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\t// TODO: Apply following options on other projection type.\n\t\t\tgl.enable(gl.CULL_FACE);\n\t\t\t// gl.enable(gl.DEPTH_TEST);\n\t\t}\n\t}\n\n\t_initRenderingContext() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!window.WebGLRenderingContext) {\n\t\t\tthrow new Error(\"WebGLRenderingContext not available.\");\n\t\t}\n\n\t\tthis.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes);\n\n\t\tif (!this.context) {\n\t\t\tthrow new Error(\"Failed to acquire 3D rendering context\");\n\t\t}\n\t}\n\n\t_initBuffers() {\n\t\tconst vertexPositionData = this._renderer.getVertexPositionData();\n\t\tconst indexData = this._renderer.getIndexData();\n\t\tconst textureCoordData = this._renderer.getTextureCoordData(this._imageConfig);\n\t\tconst gl = this.context;\n\n\t\tthis.vertexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3,\n\t\t\tthis.shaderProgram.vertexPositionAttribute);\n\n\t\tthis.indexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1);\n\n\t\tthis.textureCoordBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2,\n\t\t\tthis.shaderProgram.textureCoordAttribute);\n\n\t\tthis._bindBuffers();\n\t}\n\n\t_bindTexture() {\n\t\t// Detect if it is EAC Format while CUBESTRIP mode.\n\t\t// We assume it is EAC if image is not 3/2 ratio.\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst isEAC = width && height && width / height !== 1.5;\n\n\t\t\tthis.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, \"uIsEAC\"), isEAC);\n\t\t} else if (this._imageType === ImageType.PANORAMA) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst imageAspectRatio = width && height && width / height;\n\n\t\t\tthis._renderer.updateShaderData({imageAspectRatio});\n\t\t}\n\n\t\t// intialize shader buffers after image is loaded.(by updateShaderData)\n\t\t// because buffer may be differ by image size.(eg. CylinderRenderer)\n\t\tthis._initBuffers();\n\n\t\tthis._renderer.bindTexture(\n\t\t\tthis.context,\n\t\t\tthis.texture,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t\tthis._shouldForceDraw = true;\n\n\t\tthis.trigger(EVENTS.BIND_TEXTURE);\n\t}\n\n\t_updateTexture() {\n\t\tthis._renderer.updateTexture(\n\t\t\tthis.context,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t}\n\n\tkeepUpdate(doUpdate) {\n\t\tif (doUpdate && this.isImageLoaded() === false) {\n\t\t\t// Force to draw a frame after image is loaded on render()\n\t\t\tthis._shouldForceDraw = true;\n\t\t}\n\n\t\tthis._keepUpdate = doUpdate;\n\t}\n\n\tstartRender() {\n\t\tthis._animator.setCallback(this._render.bind(this));\n\t\tthis._animator.start();\n\t}\n\n\tstopRender() {\n\t\tthis._animator.stop();\n\t}\n\n\trenderWithQuaternion(quaternion, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\tthis._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) &&\n\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// updatefieldOfView only if fieldOfView is changed.\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tthis.mvMatrix = mat4.fromQuat(mat4.create(), quaternion);\n\n\t\tthis._draw();\n\n\t\tthis._lastQuaternion = quat.clone(quaternion);\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\trenderWithYawPitch(yaw, pitch, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\t\tthis._lastYaw !== null && this._lastYaw === yaw &&\n\t\t\t\tthis._lastPitch !== null && this._lastPitch === pitch &&\n\t\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch));\n\t\tmat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw));\n\n\t\tthis._draw();\n\n\t\tthis._lastYaw = yaw;\n\t\tthis._lastPitch = pitch;\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\t_render() {\n\t\tconst yawPitchControl = this._yawPitchControl;\n\t\tconst fov = yawPitchControl.getFov();\n\n\t\tif (yawPitchControl.shouldRenderWithQuaternion()) {\n\t\t\tconst quaternion = yawPitchControl.getQuaternion();\n\n\t\t\tthis.renderWithQuaternion(quaternion, fov);\n\t\t} else {\n\t\t\tconst yawPitch = yawPitchControl.getYawPitch();\n\n\t\t\tthis.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov);\n\t\t}\n\t}\n\n\t_renderStereo = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\n\t\tconst eyeParams = vr.getEyeParams(gl, frame);\n\n\t\tif (!eyeParams) return;\n\n\t\tvr.beforeRender(gl, frame);\n\n\t\t// Render both eyes\n\t\tfor (const eyeIndex of [0, 1]) {\n\t\t\tconst eyeParam = eyeParams[eyeIndex];\n\n\t\t\tthis.mvMatrix = eyeParam.mvMatrix;\n\t\t\tthis.pMatrix = eyeParam.pMatrix;\n\n\t\t\tgl.viewport(...eyeParam.viewport);\n\t\t\tgl.uniform1f(this.shaderProgram.uEye, eyeIndex);\n\n\t\t\tthis._bindBuffers();\n\t\t\tthis._draw();\n\t\t}\n\n\t\tvr.afterRender();\n\t}\n\n\t_bindBuffers() {\n\t\tconst gl = this.context;\n\t\tconst program = this.shaderProgram;\n\n\t\tconst vertexBuffer = this.vertexBuffer;\n\t\tconst textureCoordBuffer = this.textureCoordBuffer;\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\t\tgl.enableVertexAttribArray(program.vertexPositionAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\n\t\tgl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\t\tgl.enableVertexAttribArray(program.textureCoordAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\t}\n\n\t_draw() {\n\t\tif (this._isVideo && this._keepUpdate) {\n\t\t\tthis._updateTexture();\n\t\t}\n\n\t\tthis._renderer.render({\n\t\t\tgl: this.context,\n\t\t\tshaderProgram: this.shaderProgram,\n\t\t\tindexBuffer: this.indexBuffer,\n\t\t\tmvMatrix: this.mvMatrix,\n\t\t\tpMatrix: this.pMatrix,\n\t\t});\n\t}\n\n\t/**\n\t * Returns projection renderer by each type\n\t */\n\tgetProjectionRenderer() {\n\t\treturn this._renderer;\n\t}\n\n\t/**\n\t * @return Promise\n\t */\n\tenterVR() {\n\t\tconst vr = this._vr;\n\n\t\tif (!WEBXR_SUPPORTED && !navigator.getVRDisplays) {\n\t\t\treturn Promise.reject(\"VR is not available on this browser.\");\n\t\t}\n\t\tif (vr && vr.isPresenting()) {\n\t\t\treturn Promise.resolve(\"VR already enabled.\");\n\t\t}\n\n\t\treturn this._requestPresent();\n\t}\n\n\texitVR = () => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\tif (!vr) return;\n\n\t\tvr.removeEndCallback(this.exitVR);\n\t\tvr.destroy();\n\t\tthis._vr = null;\n\n\t\t// Restore canvas & context on iOS\n\t\tif (IS_IOS) {\n\t\t\tthis._restoreStyle();\n\t\t}\n\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\tthis._updateViewport();\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t\tthis._bindBuffers();\n\t\tthis._shouldForceDraw = true;\n\n\t\tanimator.stop();\n\t\tanimator.setContext(window);\n\t\tanimator.setCallback(this._render.bind(this));\n\t\tanimator.start();\n\t}\n\n\t_requestPresent() {\n\t\tconst gl = this.context;\n\t\tconst canvas = this.canvas;\n\t\tconst animator = this._animator;\n\n\t\tthis._vr = WEBXR_SUPPORTED ?\n\t\t\tnew XRManager() :\n\t\t\tnew VRManager();\n\n\t\tconst vr = this._vr;\n\n\t\tanimator.stop();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvr.requestPresent(canvas, gl)\n\t\t\t\t.then(() => {\n\t\t\t\t\tvr.addEndCallback(this.exitVR);\n\t\t\t\t\tanimator.setContext(vr.context);\n\t\t\t\t\tanimator.setCallback(this._onFirstVRFrame);\n\n\t\t\t\t\tif (IS_IOS) {\n\t\t\t\t\t\tthis._setWrapperFullscreen();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shouldForceDraw = true;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\tresolve(\"success\");\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tvr.destroy();\n\t\t\t\t\tthis._vr = null;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t});\n\t}\n\n\t_onFirstVRFrame = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\t// If rendering is not ready, wait for next frame\n\t\tif (!vr.canRender(frame)) return;\n\n\t\tconst minusZDir = vec3.fromValues(0, 0, -1);\n\t\tconst eyeParam = vr.getEyeParams(gl, frame)[0];\n\t\t// Extract only rotation\n\t\tconst mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix);\n\t\tconst pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix);\n\n\t\tconst mvInv = mat3.invert(mat3.create(), mvMatrix);\n\t\tconst pInv = mat3.invert(mat3.create(), pMatrix);\n\t\tconst viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv);\n\n\t\tvec3.transformMat3(viewDir, viewDir, mvInv);\n\n\t\tconst yawOffset = mathUtil.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1));\n\n\t\tif (yawOffset === 0) {\n\t\t\t// If the yawOffset is exactly 0, then device sensor is not ready\n\t\t\t// So read it again until it has any value in it\n\t\t\treturn;\n\t\t}\n\n\t\tvr.setYawOffset(yawOffset);\n\t\tanimator.setCallback(this._renderStereo);\n\t}\n\n\t_setWrapperFullscreen() {\n\t\tconst wrapper = this._wrapper;\n\n\t\tif (!wrapper) return;\n\n\t\tthis._wrapperOrigStyle = wrapper.getAttribute(\"style\");\n\t\tconst wrapperStyle = wrapper.style;\n\n\t\twrapperStyle.width = \"100vw\";\n\t\twrapperStyle.height = \"100vh\";\n\t\twrapperStyle.position = \"fixed\";\n\t\twrapperStyle.left = \"0\";\n\t\twrapperStyle.top = \"0\";\n\t\twrapperStyle.zIndex = \"9999\";\n\t}\n\n\t_restoreStyle() {\n\t\tconst wrapper = this._wrapper;\n\t\tconst canvas = this.canvas;\n\n\t\tif (!wrapper) return;\n\n\t\tif (this._wrapperOrigStyle) {\n\t\t\twrapper.setAttribute(\"style\", this._wrapperOrigStyle);\n\t\t} else {\n\t\t\twrapper.removeAttribute(\"style\");\n\t\t}\n\n\t\tthis._wrapperOrigStyle = null;\n\n\t\t// Restore canvas style\n\t\tcanvas.removeAttribute(\"style\");\n\t\tthis._setDefaultCanvasStyle();\n\t}\n}\n\nexport default PanoImageRenderer;\n","import Component from \"@egjs/component\";\nimport {glMatrix} from \"gl-matrix\";\nimport {\n\tDeviceMotionEvent, checkXRSupport\n} from \"../utils/browserFeature\";\n\nimport YawPitchControl from \"../YawPitchControl/YawPitchControl\";\nimport PanoImageRenderer from \"../PanoImageRenderer/PanoImageRenderer\";\nimport WebGLUtils from \"../PanoImageRenderer/WebGLUtils\";\nimport {ERROR_TYPE, EVENTS, GYRO_MODE, PROJECTION_TYPE, STEREO_FORMAT} from \"./consts\";\nimport {util as mathUtil} from \"../utils/math-util.js\";\nimport {VERSION} from \"../version\";\n\nclass PanoViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.PanoViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic VERSION = VERSION;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\tstatic EVENTS = EVENTS;\n\tstatic PROJECTION_TYPE = PROJECTION_TYPE;\n\tstatic GYRO_MODE = GYRO_MODE;\n\t// It should be deprecated!\n\tstatic ProjectionType = PROJECTION_TYPE;\n\tstatic STEREO_FORMAT = STEREO_FORMAT;\n\t/**\n\t * Constant value for touch directions\n\t * @ko 터치 방향에 대한 상수 값.\n\t * @namespace\n\t * @name TOUCH_DIRECTION\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic TOUCH_DIRECTION = {\n\t\t/**\n\t\t * Constant value for none direction.\n\t\t * @ko none 방향에 대한 상수 값.\n\t\t * @name NONE\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 1\n\t\t */\n\t\tNONE: YawPitchControl.TOUCH_DIRECTION_NONE,\n\t\t/**\n\t\t * Constant value for horizontal(yaw) direction.\n\t\t * @ko horizontal(yaw) 방향에 대한 상수 값.\n\t\t * @name YAW\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 6\n\t\t */\n\t\tYAW: YawPitchControl.TOUCH_DIRECTION_YAW,\n\t\t/**\n\t\t * Constant value for vertical direction.\n\t\t * @ko vertical(pitch) 방향에 대한 상수 값.\n\t\t * @name PITCH\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 24\n\t\t */\n\t\tPITCH: YawPitchControl.TOUCH_DIRECTION_PITCH,\n\t\t/**\n\t\t * Constant value for all direction.\n\t\t * @ko all 방향에 대한 상수 값.\n\t\t * @name ALL\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 30\n\t\t */\n\t\tALL: YawPitchControl.TOUCH_DIRECTION_ALL\n\t};\n\n\t/**\n\t * @classdesc 360 media viewer\n\t * @ko 360 미디어 뷰어\n\t * @class\n\t * @name eg.view360.PanoViewer\n\t * @extends eg.Component\n\t *\n\t * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트\n\t * @param {Object} config\n\t *\n\t * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
\n\t * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.\n\t * @param {Object} [config.cubemapConfig.order = \"RLUDBF\"(ProjectionType === CUBEMAP) | \"RLUDFB\" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서\n\t * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.\n\t * @param {String} [config.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
\n\t * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위)\n\t * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위)\n\t *\n\t * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위)\n\t * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위)\n\t * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위)\n\t * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다\n\t * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다.\n\t * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE}
\n\t * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위\n\t * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위\n\t * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위\n\t * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
\n\t *\n\t * @example\n\t * // PanoViewer Creation\n\t * // create PanoViewer with option\n\t * var PanoViewer = eg.view360.PanoViewer;\n\t * // Area where the image will be displayed(HTMLElement)\n\t * var container = document.getElementById(\"myPanoViewer\");\n\t *\n\t * var panoViewer = new PanoViewer(container, {\n\t * // If projectionType is not specified, the default is \"equirectangular\".\n\t * // Specifies an image of the \"equirectangular\" type.\n\t * image: \"/path/to/image/image.jpg\"\n\t *});\n\t *\n\t * @example\n\t * // Cubemap Config Setting Example\n\t * // For support Youtube EAC projection, You should set cubemapConfig as follows.\n\t * cubemapConfig: {\n\t * \torder: \"LFRDBU\",\n\t * \ttileConfig: [\n\t * \t\ttileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}]\n\t * \t]\n\t * }\n\t */\n\tconstructor(container, options = {}) {\n\t\tsuper();\n\n\t\t// Raises the error event if webgl is not supported.\n\t\tif (!WebGLUtils.isWebGLAvailable()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\t\tmessage: \"no webgl support\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!WebGLUtils.isStableWebGL()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_DEVICE,\n\t\t\t\t\tmessage: \"blacklisted browser\"\n\t\t\t\t});\n\t\t\t}, 0);\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!!options.image && !!options.video) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_RESOURCE,\n\t\t\t\t\tmessage: \"Specifying multi resouces(both image and video) is not valid.\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\t// Check XR support at not when imported, but when created.\n\t\t// This is intended to make polyfills easier to use.\n\t\tcheckXRSupport();\n\n\t\tthis._container = container;\n\t\tthis._image = options.image || options.video;\n\t\tthis._isVideo = !!options.video;\n\t\tthis._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\tthis._cubemapConfig = Object.assign({\n\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/\n\t\t\torder: this._projectionType === PROJECTION_TYPE.CUBEMAP ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, options.cubemapConfig);\n\t\tthis._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\n\t\t// If the width and height are not provided, will use the size of the container.\n\t\tthis._width = options.width || parseInt(window.getComputedStyle(container).width, 10);\n\t\tthis._height = options.height || parseInt(window.getComputedStyle(container).height, 10);\n\n\t\t/**\n\t\t * Cache the direction for the performance in renderLoop\n\t\t *\n\t\t * This value should be updated by \"change\" event of YawPitchControl.\n\t\t */\n\t\tthis._yaw = options.yaw || 0;\n\t\tthis._pitch = options.pitch || 0;\n\t\tthis._fov = options.fov || 65;\n\n\t\tthis._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH;\n\t\tthis._quaternion = null;\n\n\t\tthis._aspectRatio = this._height !== 0 ? this._width / this._height : 1;\n\t\tconst fovRange = options.fovRange || [30, 110];\n\t\tconst touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ?\n\t\t\toptions.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL;\n\t\tconst yawPitchConfig = Object.assign(options, {\n\t\t\telement: container,\n\t\t\tyaw: this._yaw,\n\t\t\tpitch: this._pitch,\n\t\t\tfov: this._fov,\n\t\t\tgyroMode: this._gyroMode,\n\t\t\tfovRange,\n\t\t\taspectRatio: this._aspectRatio,\n\t\t\ttouchDirection\n\t\t});\n\n\t\tthis._isReady = false;\n\n\t\tthis._initYawPitchControl(yawPitchConfig);\n\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t}\n\n\t/**\n\t * Get the video element that the viewer is currently playing. You can use this for playback.\n\t * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다.\n\t * @method eg.view360.PanoViewer#getVideo\n\t * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement\n\t * @example\n\t * var videoTag = panoViewer.getVideo();\n\t * videoTag.play(); // play video!\n\t */\n\tgetVideo() {\n\t\tif (!this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the video information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setVideo\n\t * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정)\n\t * @param {Object} param\n\t * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}(\"equirectangular\")] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setVideo(\"/path/to/video/video.mp4\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR\n\t * });\n\t */\n\tsetVideo(video, param = {}) {\n\t\tif (video) {\n\t\t\tthis.setImage(video, {\n\t\t\t\tprojectionType: param.projectionType,\n\t\t\t\tisVideo: true,\n\t\t\t\tcubemapConfig: param.cubemapConfig,\n\t\t\t\tstereoFormat: param.stereoFormat\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the image information that the viewer is currently using.\n\t * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다.\n\t * @method eg.view360.PanoViewer#getImage\n\t * @return {Image} Image Object이미지 객체\n\t * @example\n\t * var imageObj = panoViewer.getImage();\n\t */\n\tgetImage() {\n\t\tif (this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the image information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setImage\n\t * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.)\n\t * @param {Object} param Additional information이미지 추가 정보\n\t * @param {String} [param.projectionType=\"equirectangular\"] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setImage(\"/path/to/image/image.png\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP\n\t * });\n\t */\n\tsetImage(image, param = {}) {\n\t\tconst cubemapConfig = Object.assign({\n\t\t\torder: \"RLUDBF\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, param.cubemapConfig);\n\t\tconst stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\t\tconst isVideo = !!(param.isVideo);\n\n\t\tif (this._image && this._isVideo !== isVideo) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.warn(\"Currently not supporting to change content type(Image <--> Video)\");\n\t\t\t/* eslint-enable no-console */\n\t\t\treturn this;\n\t\t}\n\n\t\tif (image) {\n\t\t\tthis._image = image;\n\t\t\tthis._isVideo = isVideo;\n\t\t\tthis._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\t\tthis._cubemapConfig = cubemapConfig;\n\t\t\tthis._stereoFormat = stereoFormat;\n\n\t\t\tthis._deactivate();\n\t\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set whether the renderer always updates the texture and renders.\n\t * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다.\n\t *\n\t * @method eg.view360.PanoViewer#keepUpdate\n\t * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다.\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tkeepUpdate(doUpdate) {\n\t\tthis._photoSphereRenderer.keepUpdate(doUpdate);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get projection type (equirectangular/cube)\n\t * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#getProjectionType\n\t * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE}\n\t */\n\tgetProjectionType() {\n\t\treturn this._projectionType;\n\t}\n\n\t/**\n\t * Activate the device's motion sensor, and return the Promise whether the sensor is enabled\n\t * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element.\n\t * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다.\n\t * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * @method eg.view360.PanoViewer#enableSensor\n\t * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다.\n\t */\n\tenableSensor() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\") {\n\t\t\t\tDeviceMotionEvent.requestPermission().then(permissionState => {\n\t\t\t\t\tif (permissionState === \"granted\") {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(new Error(\"permission denied\"));\n\t\t\t\t\t}\n\t\t\t\t}).catch(e => {\n\t\t\t\t\t// This can happen when this method wasn't triggered by user interaction\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disable the device's motion sensor.\n\t * @ko 디바이스의 모션 센서를 비활성화합니다.\n\t * @deprecated\n\t * @method eg.view360.PanoViewer#disableSensor\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdisableSensor() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred).\n\t * This method must be used in the context of user interaction, like onclick callback on the button element.\n\t * It can be rejected when an enabling device sensor fails or image/video is still loading(\"ready\" event not triggered).\n\t * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다)\n\t * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우(\"ready\"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다.\n\t * @method eg.view360.PanoViewer#enterVR\n\t * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error)\n\t */\n\tenterVR() {\n\t\tif (!this._isReady) {\n\t\t\treturn Promise.reject(new Error(\"PanoViewer is not ready to show image.\"));\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.enableSensor()\n\t\t\t\t.then(() => this._photoSphereRenderer.enterVR())\n\t\t\t\t.then(res => resolve(res))\n\t\t\t\t.catch(e => reject(e));\n\t\t});\n\t}\n\n\t/**\n\t * Exit VR stereo rendering mode.\n\t * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#exitVR\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\texitVR() {\n\t\tthis._photoSphereRenderer.exitVR();\n\t\treturn this;\n\t}\n\n\t// TODO: Remove parameters as they're just using private values\n\t_initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) {\n\t\tthis._photoSphereRenderer = new PanoImageRenderer(\n\t\t\tthis._image,\n\t\t\tthis._width,\n\t\t\tthis._height,\n\t\t\tthis._isVideo,\n\t\t\t{\n\t\t\t\tinitialYaw: yaw,\n\t\t\t\tinitialPitch: pitch,\n\t\t\t\tfieldOfView: fov,\n\t\t\t\timageType: projectionType,\n\t\t\t\tcubemapConfig,\n\t\t\t\tstereoFormat: this._stereoFormat\n\t\t\t},\n\t\t);\n\t\tthis._photoSphereRenderer.setYawPitchControl(this._yawPitchControl);\n\n\t\tthis._bindRendererHandler();\n\n\t\tthis._photoSphereRenderer\n\t\t\t.bindTexture()\n\t\t\t.then(() => this._activate())\n\t\t\t.catch(() => {\n\t\t\t\tthis._triggerEvent(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.FAIL_BIND_TEXTURE,\n\t\t\t\t\tmessage: \"failed to bind texture\"\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * update values of YawPitchControl if needed.\n\t * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image.\n\t *\n\t * This function should be called after isReady status is true.\n\t */\n\t_updateYawPitchIfNeeded() {\n\t\tif (this._projectionType === PanoViewer.ProjectionType.PANORAMA) {\n\t\t\t// update fov by aspect ratio\n\t\t\tconst image = this._photoSphereRenderer.getContent();\n\t\t\tlet imageAspectRatio = image.naturalWidth / image.naturalHeight;\n\t\t\tlet isCircular;\n\t\t\tlet yawSize;\n\t\t\tlet maxFov;\n\n\t\t\t// If height is larger than width, then we assume it's rotated by 90 degree.\n\t\t\tif (imageAspectRatio < 1) {\n\t\t\t\t// So inverse the aspect ratio.\n\t\t\t\timageAspectRatio = 1 / imageAspectRatio;\n\t\t\t}\n\n\t\t\tif (imageAspectRatio < 6) {\n\t\t\t\tyawSize = mathUtil.toDegree(imageAspectRatio);\n\t\t\t\tisCircular = false;\n\t\t\t\t// 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5\n\t\t\t\tmaxFov = mathUtil.toDegree(Math.atan(0.5)) * 2;\n\t\t\t} else {\n\t\t\t\tyawSize = 360;\n\t\t\t\tisCircular = true;\n\t\t\t\tmaxFov = (360 / imageAspectRatio); // Make it 5 fixed as axes does.\n\t\t\t}\n\n\t\t\t// console.log(\"_updateYawPitchIfNeeded\", maxFov, \"aspectRatio\", image.naturalWidth, image.naturalHeight, \"yawSize\", yawSize);\n\t\t\tconst minFov = (this._yawPitchControl.option(\"fovRange\"))[0];\n\n\t\t\t// this option should be called after fov is set.\n\t\t\tthis._yawPitchControl.option({\n\t\t\t\t\"fov\": maxFov, /* parameter for internal validation for pitchrange */\n\t\t\t\t\"yawRange\": [-yawSize / 2, yawSize / 2],\n\t\t\t\tisCircular,\n\t\t\t\t\"pitchRange\": [-maxFov / 2, maxFov / 2],\n\t\t\t\t\"fovRange\": [minFov, maxFov]\n\t\t\t});\n\t\t\tthis.lookAt({fov: maxFov});\n\t\t}\n\t}\n\n\t_bindRendererHandler() {\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, e);\n\t\t});\n\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, e => {\n\t\t\tthis._deactivate();\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERING_CONTEXT_LOST,\n\t\t\t\tmessage: \"webgl rendering context lost\"\n\t\t\t});\n\t\t});\n\t}\n\n\t_initYawPitchControl(yawPitchConfig) {\n\t\tthis._yawPitchControl = new YawPitchControl(yawPitchConfig);\n\n\t\tthis._yawPitchControl.on(EVENTS.ANIMATION_END, e => {\n\t\t\tthis._triggerEvent(EVENTS.ANIMATION_END, e);\n\t\t});\n\n\t\tthis._yawPitchControl.on(\"change\", e => {\n\t\t\tthis._yaw = e.yaw;\n\t\t\tthis._pitch = e.pitch;\n\t\t\tthis._fov = e.fov;\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis._triggerEvent(EVENTS.VIEW_CHANGE, e);\n\t\t});\n\t}\n\n\t_triggerEvent(name, param) {\n\t\tconst evt = param || {};\n\n\t\t/**\n\t\t * Events that is fired when error occurs\n\t\t * @ko 에러 발생 시 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#error\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.type Error type\n\t\t * \t\t10: INVALID_DEVICE: Unsupported device\n\t\t * \t\t11: NO_WEBGL: Webgl not support\n\t\t * \t\t12, FAIL_IMAGE_LOAD: Failed to load image\n\t\t * \t\t13: FAIL_BIND_TEXTURE: Failed to bind texture\n\t\t * \t\t14: INVALID_RESOURCE: Only one resource(image or video) should be specified\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost occurred\n\t\t * 에러 종류\n\t\t * \t\t10: INVALID_DEVICE: 미지원 기기\n\t\t * \t\t11: NO_WEBGL: WEBGL 미지원\n\t\t * \t\t12, FAIL_IMAGE_LOAD: 이미지 로드 실패\n\t\t * \t\t13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패\n\t\t * \t\t14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost 발생\n\t\t * \n\t\t * @param {String} param.message Error message 에러 메시지\n\t\t * @see {@link eg.view360.PanoViewer.ERROR_TYPE}\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"error\" : function(evt) {\n\t\t *\t\t// evt.type === 13\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t *\n\t\t * // constant can be used\n\t\t * viwer.on({\n\t\t *\teg.view360.PanoViewer.EVENTS.ERROR : function(evt) {\n\t\t *\t\t// evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when PanoViewer is ready to go.\n\t\t * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#ready\n\t\t * @event\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"ready\" : function(evt) {\n\t\t *\t\t// PanoViewer is ready to show image and handle user interaction.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when direction or fov is changed.\n\t\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#viewChange\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.yaw yawyaw\n\t\t * @param {Number} param.pitch pitch pitch\n\t\t * @param {Number} param.fov Field of view (fov) 화각\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"viewChange\" : function(evt) {\n\t\t *\t\t//evt.yaw, evt.pitch, evt.fov is available.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when animation which is triggered by inertia is ended.\n\t\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#animationEnd\n\t\t * @event\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"animationEnd\" : function(evt) {\n\t\t *\t\t// animation is ended.\n\t\t * });\n\t\t */\n\t\treturn this.trigger(name, evt);\n\t}\n\n\t/**\n\t * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}.\n\t * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다.\n\t * @method eg.view360.PanoViewer#setUseZoom\n\t * @param {Boolean} useZoom\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseZoom(useZoom) {\n\t\ttypeof useZoom === \"boolean\" && this._yawPitchControl.option(\"useZoom\", useZoom);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * When true, enables the keyboard move key control: awsd, arrow keys\n\t * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키)\n\t * @method eg.view360.PanoViewer#setUseKeyboard\n\t * @param {Boolean} useKeyboard\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseKeyboard(useKeyboard) {\n\t\tthis._yawPitchControl.option(\"useKeyboard\", useKeyboard);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")\n\t * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")\n\t * @method eg.view360.PanoViewer#setGyroMode\n\t * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE}\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setGyroMode(\"yawPitch\");\n\t * //equivalent\n\t * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH);\n\t */\n\tsetGyroMode(gyroMode) {\n\t\tthis._yawPitchControl.option(\"gyroMode\", gyroMode);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setFovRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setFovRange([50, 90]);\n\t */\n\tsetFovRange(range) {\n\t\tthis._yawPitchControl.option(\"fovRange\", range);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Getting the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFovRange\n\t * @return {Array}\n\t * @example\n\t * var range = panoViewer.getFovRange(); //[50, 90]\n\t */\n\tgetFovRange() {\n\t\treturn this._yawPitchControl.option(\"fovRange\");\n\t}\n\n\t/**\n\t * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size.\n\t * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다.\n\t * @method eg.view360.PanoViewer#updateViewportDimensions\n\t * @param {Object} [size]\n\t * @param {Number} [size.width=width of container]\n\t * @param {Number} [size.height=height of container]\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tupdateViewportDimensions(size = {width: undefined, height: undefined}) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet containerSize;\n\n\t\tif (size.width === undefined || size.height === undefined) {\n\t\t\tcontainerSize = window.getComputedStyle(this._container);\n\t\t}\n\n\t\tconst width = size.width || parseInt(containerSize.width, 10);\n\t\tconst height = size.height || parseInt(containerSize.height, 10);\n\n\t\t// Skip if viewport is not changed.\n\t\tif (width === this._width && height === this._height) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tthis._aspectRatio = width / height;\n\t\tthis._photoSphereRenderer.updateViewportDimensions(width, height);\n\t\tthis._yawPitchControl.option(\"aspectRatio\", this._aspectRatio);\n\t\tthis._yawPitchControl.updatePanScale({height});\n\n\t\tthis.lookAt({}, 0);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the current field of view(FOV)\n\t * @ko 현재 field of view(FOV) 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFov\n\t * @return {Number}\n\t */\n\tgetFov() {\n\t\treturn this._fov;\n\t}\n\n\t/**\n\t * Get the horizontal field of view in degree\n\t */\n\t_getHFov() {\n\t\treturn mathUtil.toDegree(\n\t\t\t2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2)));\n\t}\n\n\t/**\n\t * Get current yaw value\n\t * @ko 현재 yaw 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYaw\n\t * @return {Number}\n\t */\n\tgetYaw() {\n\t\treturn this._yaw;\n\t}\n\n\t/**\n\t * Get current pitch value\n\t * @ko 현재 pitch 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getPitch\n\t * @return {Number}\n\t */\n\tgetPitch() {\n\t\treturn this._pitch;\n\t}\n\n\t/**\n\t * Get the range of controllable Yaw values\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYawRange\n\t * @return {Array}\n\t */\n\tgetYawRange() {\n\t\treturn this._yawPitchControl.option(\"yawRange\");\n\t}\n\n\t/**\n\t * Get the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다.\n\t * @method eg.view360.PanoViewer#getPitchRange\n\t * @return {Array}\n\t */\n\tgetPitchRange() {\n\t\treturn this._yawPitchControl.option(\"pitchRange\");\n\t}\n\n\t/**\n\t * Set the range of controllable yaw\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#setYawRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setYawRange([-90, 90]);\n\t */\n\tsetYawRange(yawRange) {\n\t\tthis._yawPitchControl.option(\"yawRange\", yawRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setPitchRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setPitchRange([-40, 40]);\n\t */\n\tsetPitchRange(pitchRange) {\n\t\tthis._yawPitchControl.option(\"pitchRange\", pitchRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed.\n\t * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다.\n\t * @method eg.view360.PanoViewer#setShowPolePoint\n\t * @param {Boolean} showPolePoint\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetShowPolePoint(showPolePoint) {\n\t\tthis._yawPitchControl.option(\"showPolePoint\", showPolePoint);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a new view by setting camera configuration. Any parameters not specified remain the same.\n\t * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다.\n\t * @method eg.view360.PanoViewer#lookAt\n\t * @param {Object} orientation\n\t * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위)\n\t * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위)\n\t * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위)\n\t * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초)\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * // Change the yaw angle (absolute angle) to 30 degrees for one second.\n\t * panoViewer.lookAt({yaw: 30}, 1000);\n\t */\n\tlookAt(orientation, duration) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw;\n\t\tconst pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch;\n\t\tconst pitchRange = this._yawPitchControl.option(\"pitchRange\");\n\t\tconst verticalAngleOfImage = pitchRange[1] - pitchRange[0];\n\t\tlet fov = orientation.fov !== undefined ? orientation.fov : this._fov;\n\n\t\tif (verticalAngleOfImage < fov) {\n\t\t\tfov = verticalAngleOfImage;\n\t\t}\n\n\t\tthis._yawPitchControl.lookAt({yaw, pitch, fov}, duration);\n\n\t\tif (duration === 0) {\n\t\t\tthis._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_activate() {\n\t\tthis._photoSphereRenderer.attachTo(this._container);\n\t\tthis._yawPitchControl.enable();\n\n\t\tthis.updateViewportDimensions();\n\n\t\tthis._isReady = true;\n\n\t\t// update yawPitchControl after isReady status is true.\n\t\tthis._updateYawPitchIfNeeded();\n\n\t\tthis._triggerEvent(EVENTS.READY);\n\t\tthis._photoSphereRenderer.startRender();\n\t}\n\n\t/**\n\t * Destroy webgl context and block user interaction and stop rendering\n\t */\n\t_deactivate() {\n\t\tif (this._isReady) {\n\t\t\tthis._photoSphereRenderer.stopRender();\n\t\t\tthis._yawPitchControl.disable();\n\t\t\tthis._isReady = false;\n\t\t}\n\n\t\tif (this._photoSphereRenderer) {\n\t\t\tthis._photoSphereRenderer.destroy();\n\t\t\tthis._photoSphereRenderer = null;\n\t\t}\n\t}\n\n\tstatic _isValidTouchDirection(direction) {\n\t\treturn direction === PanoViewer.TOUCH_DIRECTION.NONE ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.YAW ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.PITCH ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.ALL;\n\t}\n\n\t/**\n\t * Set touch direction by which user can control.\n\t * @ko 사용자가 조작가능한 터치 방향을 지정합니다.\n\t * @method eg.view360.PanoViewer#setTouchDirection\n\t * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @return {eg.view360.PanoViewer} PanoViewer instance\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Limit the touch direction to the yaw direction only.\n\t * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW);\n\t */\n\tsetTouchDirection(direction) {\n\t\tif (PanoViewer._isValidTouchDirection(direction)) {\n\t\t\tthis._yawPitchControl.option(\"touchDirection\", direction);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns touch direction by which user can control\n\t * @ko 사용자가 조작가능한 터치 방향을 반환한다.\n\t * @method eg.view360.PanoViewer#getTouchDirection\n\t * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Returns the current touch direction.\n\t * var dir = panoViewer.getTouchDirection();\n\t */\n\tgetTouchDirection() {\n\t\treturn this._yawPitchControl.option(\"touchDirection\");\n\t}\n\n\t/**\n\t * Destroy viewer. Remove all registered event listeners and remove viewer canvas.\n\t * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다.\n\t * @method eg.view360.PanoViewer#destroy\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdestroy() {\n\t\tthis._deactivate();\n\n\t\tif (this._yawPitchControl) {\n\t\t\tthis._yawPitchControl.destroy();\n\t\t\tthis._yawPitchControl = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check whether the current environment can execute PanoViewer\n\t * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다.\n\t * @function isSupported\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부\n\t * @static\n\t */\n\tstatic isSupported() {\n\t\treturn WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the WebGL\n\t * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다.\n\t * @function isWebGLAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} WebGL support WebGL 지원여부\n\t * @static\n\t */\n\tstatic isWebGLAvailable() {\n\t\treturn WebGLUtils.isWebGLAvailable();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the gyro sensor.\n\t * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다.\n\t * @function isGyroSensorAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수\n\t * @static\n\t */\n\tstatic isGyroSensorAvailable(callback) {\n\t\tif (!DeviceMotionEvent) {\n\t\t\tcallback && callback(false);\n\t\t\treturn;\n\t\t}\n\n\t\tlet onDeviceMotionChange;\n\n\t\tfunction checkGyro() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tonDeviceMotionChange = function(deviceMotion) {\n\t\t\t\t\tconst isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null);\n\n\t\t\t\t\tres(isGyroSensorAvailable);\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener(\"devicemotion\", onDeviceMotionChange);\n\t\t\t});\n\t\t}\n\n\t\tfunction timeout() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tsetTimeout(() => res(false), 1000);\n\t\t\t});\n\t\t}\n\n\t\tPromise.race([checkGyro(), timeout()]).then(isGyroSensorAvailable => {\n\t\t\twindow.removeEventListener(\"devicemotion\", onDeviceMotionChange);\n\n\t\t\tcallback && callback(isGyroSensorAvailable);\n\n\t\t\tPanoViewer.isGyroSensorAvailable = function(fb) {\n\t\t\t\tfb && fb(isGyroSensorAvailable);\n\t\t\t\treturn isGyroSensorAvailable;\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport default PanoViewer;\n"],"names":["module","objectOrFunction","x","type","isFunction","_isArray","Array","isArray","Object","prototype","toString","call","len","vertxNext","customSchedulerFn","asap","callback","arg","queue","flush","scheduleFlush","setScheduler","scheduleFn","setAsap","asapFn","browserWindow","window","undefined","browserGlobal","BrowserMutationObserver","MutationObserver","WebKitMutationObserver","isNode","self","process","isWorker","Uint8ClampedArray","importScripts","MessageChannel","useNextTick","nextTick","useVertxTimer","useSetTimeout","useMutationObserver","iterations","observer","node","document","createTextNode","observe","characterData","data","useMessageChannel","channel","port1","onmessage","port2","postMessage","globalSetTimeout","setTimeout","i","attemptVertx","vertx","Function","require","runOnLoop","runOnContext","e","then","onFulfillment","onRejection","parent","this","child","constructor","noop","PROMISE_ID","makePromise","_state","arguments","invokeCallback","_result","subscribe","resolve$1","object","Constructor","promise","resolve","Math","random","substring","PENDING","FULFILLED","REJECTED","selfFulfillment","TypeError","cannotReturnOwn","tryThen","then$$1","value","fulfillmentHandler","rejectionHandler","handleForeignThenable","thenable","sealed","error","fulfill","reason","reject","_label","handleOwnThenable","handleMaybeThenable","maybeThenable","publishRejection","_onerror","publish","_subscribers","length","subscribers","settled","detail","hasCallback","succeeded","initializePromise","resolver","resolvePromise","rejectPromise","id","nextId","validationError","Error","Enumerator","input","_instanceConstructor","_remaining","_enumerate","_eachEntry","entry","c","resolve$$1","_then","didError","_settledAt","Promise$1","_willSettleAt","state","enumerator","all","entries","race","_","reject$1","needsResolver","needsNew","Promise","catch","_catch","finally","_finally","polyfill","local","global","P","promiseToString","cast","_setScheduler","_setAsap","_asap","factory","win","doc","agent","getAgent","osName","os","name","browserName","browser","IS_IOS","IS_SAFARI_ON_DESKTOP","Float32Array","getComputedStyle","userAgent","navigator","SUPPORT_TOUCH","SUPPORT_DEVICEMOTION","DeviceMotionEvent","devicePixelRatio","WEBXR_SUPPORTED","docStyle","documentElement","style","target","CSS","supports","toDegree","a","PI","util","n","extractPitchFromQuat","quaternion","baseV","vec3","fromValues","transformQuat","atan2","sqrt","pow","hypot","y","ROTATE_CONSTANT","PITCH_DELTA","YAW_DELTA_BY_ROLL","YAW_DELTA_BY_YAW","angleBetweenVec2","v1","v2","det","vec2","dot","targetAxis","meshPoint","yawOffsetBetween","viewDir","targetDir","viewDirXZ","targetDirXZ","normalize","getRotationDelta","prevQ","curQ","rotateKind","prevQuaternion","quat","clone","curQuaternion","prevPoint","curPoint","meshPoint3","rotateDirection","cross","create","meshPoint2","vecU","vecV","vecN","coefficientA","coefficientB","coefficientC","distance","abs","projectedPrevPoint","subtract","scale","trigonometricRatio","theta","acos","crossVec","r","MathUtil","degToRad","radToDeg","Vector2","set","copy","v","subVectors","b","Vector3","z","scalar","invScalar","multiplyScalar","applyQuaternion","q","qx","qy","qz","qw","w","ix","iy","iz","iw","crossVectors","ax","ay","az","bx","by","bz","Quaternion","setFromEulerXYZ","c1","cos","c2","c3","s1","sin","s2","s3","setFromEulerYXZ","setFromAxisAngle","axis","angle","halfAngle","s","multiply","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","inverse","l","slerp","qb","t","cosHalfTheta","halfTheta","sinHalfTheta","ratioA","ratioB","setFromUnitVectors","vFrom","vTo","isIOS","isWebViewAndroid","isSafari","isFirefoxAndroid","isR7","piOver180","rad45","defaultOrientation","defaultPosition","Util","updateEyeMatrices","projection","view","pose","parameters","vrDisplay","out","fov","near","far","upTan","downTan","leftTan","rightTan","xScale","yScale","fieldOfView","depthNear","depthFar","tan","upDegrees","downDegrees","leftDegrees","rightDegrees","x2","y2","z2","xx","xy","xz","yy","yz","zz","wx","wy","wz","a00","a01","a02","a03","a10","a11","a12","a13","a20","a21","a22","a23","a30","a31","a32","a33","b00","b01","b02","b03","b04","b05","b06","b07","b08","b09","b10","b11","orientation","position","offset","MIN_TIMESTEP","MAX_TIMESTEP","base64","mimeType","clamp","min","max","lerp","promises","test","platform","indexOf","isLandscapeMode","rtn","isTimestampDeltaValid","timestampDeltaS","isNaN","getScreenWidth","screen","width","height","getScreenHeight","requestFullscreen","element","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen","exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen","getFullscreenElement","fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement","linkProgram","gl","vertexSource","fragmentSource","attribLocationMap","vertexShader","createShader","VERTEX_SHADER","shaderSource","compileShader","fragmentShader","FRAGMENT_SHADER","program","createProgram","attribName","attachShader","bindAttribLocation","deleteShader","getProgramUniforms","uniforms","uniformCount","getProgramParameter","ACTIVE_UNIFORMS","uniformName","getActiveUniform","replace","getUniformLocation","orthoMatrix","left","right","bottom","top","lr","bt","nf","copyArray","source","dest","isMobile","check","vendor","opera","substr","extend","src","key","hasOwnProperty","safariCssSizeWorkaround","canvas","parseInt","isDebug","getQueryParameter","results","RegExp","exec","location","search","decodeURIComponent","frameDataFromPose","frameData","timestamp","leftProjectionMatrix","leftViewMatrix","getEyeParameters","rightProjectionMatrix","rightViewMatrix","isInsideCrossDomainIFrame","isFramed","refDomain","getDomainFromUrl","referrer","thisDomain","href","url","split","PosePredictor","predictionTimeS","previousQ","previousTimestampS","deltaQ","outQ","getPrediction","currentQ","gyro","timestampS","angularSpeed","console","log","toFixed","predictAngle","version","branch","build","match","CHROME_VERSION","IS_CHROME_WITHOUT_DEVICE_MOTION","IS_ANDROID","MC_BIND_SCALE","GYRO_MODE","NONE","YAWPITCH","VR","DeviceMotion","_onDeviceMotion","_this","bind","_onDeviceOrientation","_onChromeWithoutDeviceMotion","isWithoutDeviceMotion","isAndroid","stillGyroVec","rawGyroVec","adjustedGyroVec","_timer","lastDevicemotionTimestamp","_isEnabled","enable","alpha","beta","gamma","trigger","inputEvent","deviceorientation","clearTimeout","Date","getTime","_this2","isGyroSensorAvailable","rotationRate","isGravitySensorAvailable","accelerationIncludingGravity","interval","devicemotionEvent","_extends","timeStamp","acceleration","adjustedRotationRate","addEventListener","disable","removeEventListener","Component","SensorSample","sample","sensorSample","ComplementaryFilter","kFilter","currentAccelMeasurement","currentGyroMeasurement","previousGyroMeasurement","filterQ","previousFilterQ","accelQ","isOrientationInitialized","estimatedGravity","measuredGravity","gyroIntegralQ","addAccelMeasurement","vector","addGyroMeasurement","deltaT","run_","accelToQuaternion_","gyroDeltaQ","gyroToQuaternionDelta_","invFilterQ","getQuaternionAngle","targetQ","getOrientation","accel","normAccel","dt","isFilterQuaternionInitialized","FusionPoseSensor","deviceMotion","accelerometer","gyroscope","_onDeviceMotionChange","_onScreenOrientationChange","filter","posePredictor","filterToWorldQ","isChromeUsingDegrees","inverseWorldToScreenQ","worldToScreenQ","originalPoseAdjustQ","_setScreenTransform","resetQ","on","isEnabled","destroy","_triggerChange","_prevOrientation","equals","_deviceOrientationQ","deviceOrientationFixQ","_alpha","out_","_convertFusionToPredicted","predictedQ","accGravity","rotRate","TiltMotionInput","el","options","_prevQuaternion","_quaternion","fusionPoseSensor","threshold","_onPoseChange","mapAxes","axes","connect","_attachEvent","disconnect","_dettachEvent","event","prvQ","yawDeltaByYaw","change","reduce","acc","off","screenRotationAngleInst","refCount","ScreenRotationAngle","_onOrientationChange","_spinR","_screenOrientationAngle","betaR","glMatrix","toRadian","gammaR","getRadian","unref","RotationPanInput","_useRotation","_screenRotationAngle","setUseRotation","useRotation","_userDirection","Axes","DIRECTION_ALL","_direction","DIRECTION_HORIZONTAL","getOffset","properties","useDirection","newOffset","cosTheta","sinTheta","DIRECTION_VERTICAL","PanInput","Y_AXIS_VECTOR","DeviceQuaternion","_fusionPoseSensor","isTrusted","getCombinedQuaternion","yaw","yawQ","setAxisAngle","conj","conjugate","VERSION","DEFAULT_YAW_RANGE","DEFAULT_PITCH_RANGE","CIRCULAR_PITCH_RANGE","YawPitchControl","opt","pitch","showPolePoint","useZoom","useKeyboard","gyroMode","touchDirection","TOUCH_DIRECTION_YAW","yawRange","pitchRange","fovRange","aspectRatio","_element","_initialFov","_enabled","_isAnimating","_deviceQuaternion","_initAxes","option","yRange","_updateYawRange","pRange","_updatePitchRange","axesPanInput","axesWheelInput","WheelInput","axesTiltMotionInput","axesPinchInput","PinchInput","axesMoveKeyInput","MoveKeyInput","range","circular","isCircular","bounce","deceleration","maximumDuration","hold","evt","delta","_updateControlScale","updatePanScale","release","animationStart","animationEnd","param","get","areaHeight","args","argLen","_getOptions","beforeOptions","newOptions","changedKeyList","keys","push","_setOptions","_getValidatedOptions","_applyOptions","_getValidYawRange","_getValidPitchRange","isVR","isYawPitch","some","setTo","prevFov","nextFov","_initDeviceQuaternion","_togglePinchInputByOption","_enableTouch","_inputs","direction","yawEnabled","pitchEnabled","_this3","newYawRange","newFov","newAspectRatio","ratio","adjustAspectRatio","horizontalFov","newPitchRange","changeEvt","pos","p","verticalAngle","halfFov","concat","halfHorizontalFov","mathUtil","targetElement","inputRange","outputRange","rangeIdx","inputA","fraction","persistOrientation","_resetOrientation","lookAt","duration","f","Infinity","setBy","getYawPitch","yawPitch","getFov","getQuaternion","shouldRenderWithQuaternion","axisPanInput","axesDeviceOrientationInput","CONTROL_MODE_VR","CONTROL_MODE_YAWPITCH","TOUCH_DIRECTION_ALL","TOUCH_DIRECTION_PITCH","TOUCH_DIRECTION_NONE","STATUS","EVENT","ImageLoader","image","_image","_onceHandlers","_loadStatus","res","rej","LOADED","getElement","LOADING","isMaybeLoaded","createElement","onceLoaded","ERROR","map","img","_img","Image","crossOrigin","result","complete","naturalWidth","onload","onerror","targets","loadPromises","_this4","_once","listener","fn","getStatus","forEach","handler","READY_STATUS","READYSTATECHANGE_EVENT_NAME","latIdx","lngIdx","VideoLoader","video","_handlers","_sourceCount","_thresholdReadyState","_thresholdEventName","readyState","_errorCount","_detachErrorHandler","_appendSourceElement","videoUrl","videoSrc","videoType","sourceElement","_video","appendChild","_reset","HTMLVideoElement","setAttribute","querySelectorAll","load","_attachErrorHandler","_sources","rejector","WEBGL_ERROR_CODE","webglAvailability","WebGLUtils","shader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","detachShader","LINK_STATUS","deleteProgram","initBuffer","itemSize","attr","buffer","createBuffer","bindBuffer","bufferData","STATIC_DRAW","numItems","enableVertexAttribArray","vertexAttribPointer","FLOAT","getWebglContext","userContextAttributes","webglIdentifiers","context","contextAttributes","preserveDrawingBuffer","antialias","xrCompatible","onWebglcontextcreationerror","statusMessage","getContext","createTexture","textureTarget","texture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","isWebGLAvailable","webglContext","loseContextExtension","getExtension","loseContext","isStableWebGL","agentInfo","isStableWebgl","parseFloat","getErrorNameFromWebGLErrorCode","code","texImage2D","pixels","RGBA","UNSIGNED_BYTE","getMaxTextureSize","getParameter","MAX_TEXTURE_SIZE","Agent","isIE11","majorVersion","EVENTS","Renderer","_forceDimension","_pixelCanvas","_pixelContext","render","shaderProgram","indexBuffer","mvMatrix","pMatrix","uniformMatrix4fv","pMatrixUniform","mvMatrixUniform","drawElements","TRIANGLES","UNSIGNED_SHORT","getDimension","pixelSource","videoWidth","naturalHeight","videoHeight","updateShaderData","_initPixelSource","forceDimension","_getPixelSource","contentDimension","textureDimension","drawImage","_extractTileConfig","imageConfig","tileConfig","config","flipHorizontal","rotation","_triggerError","message","CubeRenderer","getVertexPositionData","_VERTEX_POSITION_DATA","getIndexData","_INDEX_DATA","indexData","vertexPositionData","extractOrder","order","getTextureCoordData","base","face","ordermap_","shift","unshift","pop","tileVertex","slice","elemSize","tileTemp","j","splice","join","getVertexShaderSource","getFragmentShaderSource","updateTexture","orderMap","surfaceIdx","tileIdx","TEXTURE_CUBE_MAP_POSITIVE_X","maxCubeMapTextureSize","getMaxCubeMapTextureSize","tile","extractTileFromImage","TEXTURE_CUBE_MAP","getSourceTileSize","outputTextureSize","inputTextureSize","tilePerRow","MAX_CUBE_MAP_TEXTURE_SIZE","_imageWidth","isPowerOfTwo","CubeStripRenderer","_vertices","coords","rows","coord","tileConfigs","_shrinkCoord","_transformCoord","index","val","TEXTURE_2D","size","maxSize","activeTexture","TEXTURE0","pixelStorei","UNPACK_FLIP_Y_WEBGL","newCoord","_flipHorizontalCoord","_rotateCoord","rotationAngle","moved","shiftCount","ERROR_TYPE","INVALID_DEVICE","NO_WEBGL","FAIL_IMAGE_LOAD","FAIL_BIND_TEXTURE","INVALID_RESOURCE","RENDERING_CONTEXT_LOST","READY","VIEW_CHANGE","ANIMATION_END","PROJECTION_TYPE","EQUIRECTANGULAR","CUBEMAP","CUBESTRIP","PANORAMA","STEREOSCOPIC_EQUI","STEREO_FORMAT","TOP_BOTTOM","LEFT_RIGHT","ANGLE_CORRECTION_FOR_CENTER_ALIGN","textureCoordData","phi","sinPhi","u","SphereRenderer","format","_stereoFormat","ctx","leftEyeScaleOffset","rightEyeScaleOffset","uTexScaleOffset","uniform4fv","_TEXTURE_COORD_DATA","CylinderRenderer","resizeDimension","cylinderMaxRadian","halfCylinderY","rotated","imageAspectRatio","CYLIDER_Y","startAngleForCenterAlign","yIdx","yLength","VR_DISPLAY_PRESENT_CHANGE","DEFAULT_LEFT_BOUNDS","DEFAULT_RIGHT_BOUNDS","EYES","VRManager","_vrDisplay","removeEndCallback","isPresenting","exitPresent","_clear","_frameData","VRFrameData","canRender","Boolean","beforeRender","bindFramebuffer","FRAMEBUFFER","afterRender","submitFrame","getEyeParams","display","halfWidth","drawingBufferWidth","drawingBufferHeight","getFrameData","leftMVMatrix","rightMVMatrix","mat4","rotateY","_yawOffset","viewport","addEndCallback","requestPresent","getVRDisplays","displays","capabilities","canPresent","leftEye","rightEye","renderWidth","renderHeight","_setDisplay","setYawOffset","layers","getLayers","layer","_leftBounds","leftBounds","_rightBounds","rightBounds","XRManager","xrSession","_xrSession","end","frame","getViewerPose","_xrRefSpace","baseLayer","session","renderState","framebuffer","glLayer","views","getViewport","transform","matrix","rotateX","projectionMatrix","_presenting","xr","requestSession","requiredFeatures","xrLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","refSpace","_setSession","_xrLayer","WebGLAnimator","_onLoop","_callback","_rafId","_context","requestAnimationFrame","_onLoopNextTick","before","performance","now","diff","_rafTimer","setCallback","setContext","start","stop","cancelAnimationFrame","ImageType","DEVICE_PIXEL_RATIO","BIND_TEXTURE","IMAGE_LOADED","RENDERING_CONTEXT_RESTORE","RENDERER_ERROR","PanoImageRenderer","isVideo","sphericalConfig","renderingContextAttributes","_renderStereo","time","vr","_vr","eyeParams","eyeIndex","eyeParam","uniform1f","uEye","_bindBuffers","_draw","exitVR","animator","_animator","_restoreStyle","updateViewportDimensions","_updateViewport","_shouldForceDraw","_render","_onFirstVRFrame","minusZDir","mat3","fromMat4","mvInv","invert","pInv","transformMat3","yawOffset","_lastQuaternion","_lastYaw","_lastPitch","_lastFieldOfView","perspective","textureCoordBuffer","vertexBuffer","_initCanvas","_setDefaultCanvasStyle","_wrapper","_wrapperOrigStyle","_renderingContextAttributes","_imageConfig","_imageIsReady","_keepUpdate","_onContentLoad","_onContentError","setImage","imageType","cubemapConfig","setYawPitchControl","yawPitchControl","_yawPitchControl","getContent","_isVideo","_setImageType","_contentLoader","_imageType","_isCubeMap","_renderer","stereoFormat","_initWebGL","_onWebglcontextlost","_onWebglcontextrestored","margin","maxHeight","maxWidth","outline","_triggerContentLoad","content","projectionType","isImageLoaded","_bindTexture","attachTo","parentElement","detach","forceContextLoss","hasRenderingContext","removeChild","isContextLost","_initShaderProgram","renderer","vsSource","fsSource","getError","useProgram","vertexPositionAttribute","getAttribLocation","samplerUniform","textureCoordAttribute","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","uniform1i","preventDefault","updateFieldOfView","viewPortChanged","h","_initRenderingContext","clearColor","deleteTexture","CULL_FACE","WebGLRenderingContext","_initBuffers","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","Uint16Array","isEAC","_updateTexture","keepUpdate","doUpdate","startRender","stopRender","renderWithQuaternion","exactEquals","fromQuat","renderWithYawPitch","identity","getProjectionRenderer","enterVR","_Promise","_requestPresent","_setWrapperFullscreen","wrapper","getAttribute","wrapperStyle","zIndex","removeAttribute","PanoViewer","container","isSessionSupported","supportsSession","_container","_projectionType","_cubemapConfig","_width","_height","_yaw","_pitch","_fov","_gyroMode","_aspectRatio","_isValidTouchDirection","yawPitchConfig","_isReady","_initYawPitchControl","_initRenderer","getVideo","_photoSphereRenderer","setVideo","getImage","warn","_deactivate","getProjectionType","enableSensor","requestPermission","permissionState","disableSensor","initialYaw","initialPitch","_bindRendererHandler","_activate","_triggerEvent","_updateYawPitchIfNeeded","ProjectionType","yawSize","maxFov","atan","minFov","_this5","setUseZoom","setUseKeyboard","setGyroMode","setFovRange","getFovRange","containerSize","_getHFov","getYaw","getPitch","getYawRange","getPitchRange","setYawRange","setPitchRange","setShowPolePoint","verticalAngleOfImage","TOUCH_DIRECTION","YAW","PITCH","ALL","setTouchDirection","getTouchDirection","isSupported","onDeviceMotionChange","fb"],"mappings":";;;;;;;uzCASgEA,qBAKhE,SAASC,EAAiBC,GACxB,IAAIC,SAAcD,EAClB,OAAOA,IAAM,OAASC,IAAS,UAAYA,IAAS,YAGtD,SAASC,EAAWF,GAClB,cAAcA,IAAM,WAKtB,IAAIG,OAAgB,EACpB,GAAIC,MAAMC,QAAS,CACjBF,EAAWC,MAAMC,YACZ,CACLF,EAAW,SAAUH,GACnB,OAAOM,OAAOC,UAAUC,SAASC,KAAKT,KAAO,kBAIjD,IAAIK,EAAUF,EAEVO,EAAM,EACNC,OAAiB,EACjBC,OAAyB,EAEzBC,EAAO,SAASA,EAAKC,EAAUC,GACjCC,EAAMN,GAAOI,EACbE,EAAMN,EAAM,GAAKK,EACjBL,GAAO,EACP,GAAIA,IAAQ,EAAG,CAIb,GAAIE,EAAmB,CACrBA,EAAkBK,OACb,CACLC,OAKN,SAASC,EAAaC,GACpBR,EAAoBQ,EAGtB,SAASC,EAAQC,GACfT,EAAOS,EAGT,IAAIC,SAAuBC,SAAW,YAAcA,OAASC,UACzDC,EAAgBH,GAAiB,GACjCI,EAA0BD,EAAcE,kBAAoBF,EAAcG,uBAC1EC,SAAgBC,OAAS,oBAAsBC,UAAY,aAAe,GAAGxB,SAASC,KAAKuB,WAAa,mBAGxGC,SAAkBC,oBAAsB,oBAAsBC,gBAAkB,oBAAsBC,iBAAmB,YAG7H,SAASC,IAGP,OAAO,WACL,OAAOL,QAAQM,SAASrB,IAK5B,SAASsB,IACP,UAAW5B,IAAc,YAAa,CACpC,OAAO,WACLA,EAAUM,IAId,OAAOuB,IAGT,SAASC,IACP,IAAIC,EAAa,EACjB,IAAIC,EAAW,IAAIhB,EAAwBV,GAC3C,IAAI2B,EAAOC,SAASC,eAAe,IACnCH,EAASI,QAAQH,EAAM,CAAEI,cAAe,OAExC,OAAO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wB,SAASyzB,UAC3CA,GAAMA,EAAGzzB,GACFA,KA/BR3iB,GAAYA,GAAS,OAx9BCwjB,UAAnB2uB,EAWEjnB,QAAUA,GAXZinB,EAYEpR,WAAaA,GAZfoR,EAaEzX,OAASA,GAbXyX,EAcE1Q,gBAAkBA,GAdpB0Q,EAeErxB,UAAYA,EAfdqxB,EAiBEoC,eAAiB9S,GAjBnB0Q,EAkBEpQ,cAAgBA,GAlBlBoQ,EA0BEyD,gBAAkB,CAUxB70B,KAAMuK,GAAgBmH,qBAUtBojB,IAAKvqB,GAAgBQ,oBAUrBgqB,MAAOxqB,GAAgBkH,sBAUvBujB,IAAKzqB,GAAgBiH,qBAlEjB4f"} \ No newline at end of file diff --git a/dist/PanoViewer/view360.panoviewer.pkgd.js b/dist/PanoViewer/view360.panoviewer.pkgd.js new file mode 100644 index 000000000..eca6da4a5 --- /dev/null +++ b/dist/PanoViewer/view360.panoviewer.pkgd.js @@ -0,0 +1,16210 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +All-in-one packaged file for ease use of '@egjs/view360' with below dependencies. +- @egjs/agent ^2.2.1, @egjs/axes ^2.7.1, @egjs/component ^2.1.2, es6-promise ^4.2.5, gl-matrix ^3.1.0, motion-sensors-polyfill ^0.3.1, webvr-polyfill ^0.9.41 +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.eg = global.eg || {}, global.eg.view360 = {}))); +}(this, (function (exports) { 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); + } + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var es6Promise = createCommonjsModule(function (module, exports) { + /*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ + + (function (global, factory) { + module.exports = factory(); + }(commonjsGlobal, (function () { + function objectOrFunction(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); + } + + function isFunction(x) { + return typeof x === 'function'; + } + + + + var _isArray = void 0; + if (Array.isArray) { + _isArray = Array.isArray; + } else { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } + + var isArray = _isArray; + + var len = 0; + var vertxNext = void 0; + var customSchedulerFn = void 0; + + var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } + }; + + function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; + } + + function setAsap(asapFn) { + asap = asapFn; + } + + var browserWindow = typeof window !== 'undefined' ? window : undefined; + var browserGlobal = browserWindow || {}; + var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; + var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + + // node + function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; + } + + // vertx + function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); + } + + function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; + } + + // web worker + function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; + } + + function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; + } + + var queue = new Array(1000); + function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; + } + + function attemptVertx() { + try { + var vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } + } + + var scheduleFlush = void 0; + // Decide what async method to use to triggering processing of queued callbacks: + if (isNode) { + scheduleFlush = useNextTick(); + } else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); + } else if (isWorker) { + scheduleFlush = useMessageChannel(); + } else if (browserWindow === undefined && typeof commonjsRequire === 'function') { + scheduleFlush = attemptVertx(); + } else { + scheduleFlush = useSetTimeout(); + } + + function then(onFulfillment, onRejection) { + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + + if (_state) { + var callback = arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + } + + /** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + function resolve$1(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + resolve(promise, object); + return promise; + } + + var PROMISE_ID = Math.random().toString(36).substring(2); + + function noop() {} + + var PENDING = void 0; + var FULFILLED = 1; + var REJECTED = 2; + + function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { + try { + then$$1.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } + } + + function handleForeignThenable(promise, thenable, then$$1) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then$$1, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); + } + + function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return resolve(promise, value); + }, function (reason) { + return reject(promise, reason); + }); + } + } + + function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$1 === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); + } else { + fulfill(promise, maybeThenable); + } + } + } + + function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + var then$$1 = void 0; + try { + then$$1 = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then$$1); + } else { + fulfill(promise, value); + } + } + + function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); + } + + function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } + } + + function reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); + } + + function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } + } + + function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = void 0, + callback = void 0, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = void 0, + error = void 0, + succeeded = true; + + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + + if (promise._state !== PENDING) ; else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } + } + + function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch (e) { + reject(promise, e); + } + } + + var id = 0; + function nextId() { + return id++; + } + + function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; + } + + function validationError() { + return new Error('Array Methods must be provided an Array'); + } + + var Enumerator = function () { + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + + Enumerator.prototype._enumerate = function _enumerate(input) { + for (var i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + }; + + Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { + var c = this._instanceConstructor; + var resolve$$1 = c.resolve; + + + if (resolve$$1 === resolve$1) { + var _then = void 0; + var error = void 0; + var didError = false; + try { + _then = entry.then; + } catch (e) { + didError = true; + error = e; + } + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise$1) { + var promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, _then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$1(entry), i); + } + }; + + Enumerator.prototype._settledAt = function _settledAt(state, i, value) { + var promise = this.promise; + + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + + Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + + return Enumerator; + }(); + + /** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static + */ + function all(entries) { + return new Enumerator(this, entries).promise; + } + + /** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. + */ + function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } + } + + /** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. + */ + function reject$1(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + reject(promise, reason); + return promise; + } + + function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor + */ + + var Promise$1 = function () { + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + Chaining + -------- + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + Assimilation + ------------ + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + If the assimliated promise rejects, then the downstream promise will also reject. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + Simple Example + -------------- + Synchronous Example + ```javascript + let result; + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + Promise Example; + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + Advanced Example + -------------- + Synchronous Example + ```javascript + let author, books; + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + function foundBooks(books) { + } + function failure(reason) { + } + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + Promise Example; + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + + + Promise.prototype.catch = function _catch(onRejection) { + return this.then(null, onRejection); + }; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + Synchronous example: + + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + + Asynchronous example: + + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + + @method finally + @param {Function} callback + @return {Promise} + */ + + + Promise.prototype.finally = function _finally(callback) { + var promise = this; + var constructor = promise.constructor; + + if (isFunction(callback)) { + return promise.then(function (value) { + return constructor.resolve(callback()).then(function () { + return value; + }); + }, function (reason) { + return constructor.resolve(callback()).then(function () { + throw reason; + }); + }); + } + + return promise.then(callback, callback); + }; + + return Promise; + }(); + + Promise$1.prototype.then = then; + Promise$1.all = all; + Promise$1.race = race; + Promise$1.resolve = resolve$1; + Promise$1.reject = reject$1; + Promise$1._setScheduler = setScheduler; + Promise$1._setAsap = setAsap; + Promise$1._asap = asap; + + /*global self*/ + function polyfill() { + var local = void 0; + + if (typeof commonjsGlobal !== 'undefined') { + local = commonjsGlobal; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise$1; + } + + // Strange compat.. + Promise$1.polyfill = polyfill; + Promise$1.Promise = Promise$1; + + return Promise$1; + + }))); + + + + + }); + + /* + Copyright (c) 2017 NAVER Corp. + @egjs/component project is licensed under the MIT license + + @egjs/component JavaScript library + https://naver.github.io/egjs-component + + @version 2.1.2 + */ + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + function isUndefined(value) { + return typeof value === "undefined"; + } + /** + * A class used to manage events in a component + * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스 + * @alias eg.Component + */ + + + var Component = + /*#__PURE__*/ + function () { + var Component = + /*#__PURE__*/ + function () { + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.Component.VERSION; // ex) 2.0.0 + * @memberof eg.Component + */ + + /** + * @support {"ie": "7+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.1+ (except 3.x)"} + */ + function Component() { + this._eventHandler = {}; + this.options = {}; + } + /** + * Triggers a custom event. + * @ko 커스텀 이벤트를 발생시킨다 + * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름 + * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터 + * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고 + * @example + class Some extends eg.Component { + 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. + } + }); + some.on("hi", (e) => { + // `currentTarget` is component instance. + console.log(some === e.currentTarget); // true + }); + // 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 trigger(eventName, customEvent) { + if (customEvent === void 0) { + customEvent = {}; + } + + var handlerList = this._eventHandler[eventName] || []; + var hasHandlerList = handlerList.length > 0; + + if (!hasHandlerList) { + return true; + } // If detach method call in handler in first time then handler list calls. + + + handlerList = handlerList.concat(); + customEvent.eventType = eventName; + var isCanceled = false; + var arg = [customEvent]; + var i = 0; + + customEvent.stop = function () { + isCanceled = true; + }; + + customEvent.currentTarget = this; + + for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + restParam[_key - 2] = arguments[_key]; + } + + if (restParam.length >= 1) { + arg = arg.concat(restParam); + } + + for (i = 0; handlerList[i]; i++) { + handlerList[i].apply(this, arg); + } + + return !isCanceled; + }; + /** + * Executed event just one time. + * @ko 이벤트가 한번만 실행된다. + * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름 + * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + alert("hi"); + } + thing() { + this.once("hi", this.hi); + } + } + var some = new Some(); + some.thing(); + some.trigger("hi"); + // fire alert("hi"); + some.trigger("hi"); + // Nothing happens + */ + + + _proto.once = function once(eventName, handlerToAttach) { + if (typeof eventName === "object" && isUndefined(handlerToAttach)) { + var eventHash = eventName; + var i; + + for (i in eventHash) { + this.once(i, eventHash[i]); + } + + return this; + } else if (typeof eventName === "string" && typeof handlerToAttach === "function") { + var self = this; + this.on(eventName, function listener() { + for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + arg[_key2] = arguments[_key2]; + } + + handlerToAttach.apply(self, arg); + self.off(eventName, listener); + }); + } + + 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 + class Some extends eg.Component { + some() { + this.hasOn("hi");// check hi event. + } + } + */ + + + _proto.hasOn = function hasOn(eventName) { + return !!this._eventHandler[eventName]; + }; + /** + * Attaches an event to a component. + * @ko 컴포넌트에 이벤트를 등록한다. + * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름 + * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + console.log("hi"); + } + some() { + this.on("hi",this.hi); //attach event + } + } + */ + + + _proto.on = function on(eventName, handlerToAttach) { + if (typeof eventName === "object" && isUndefined(handlerToAttach)) { + var eventHash = eventName; + var name; + + for (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. + * @ko 컴포넌트에 등록된 이벤트를 해제한다 + * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름 + * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + console.log("hi"); + } + some() { + this.off("hi",this.hi); //detach event + } + } + */ + + + _proto.off = function off(eventName, handlerToDetach) { + // All event detach. + if (isUndefined(eventName)) { + this._eventHandler = {}; + return this; + } // All handler of specific event detach. + + + if (isUndefined(handlerToDetach)) { + if (typeof eventName === "string") { + this._eventHandler[eventName] = undefined; + return this; + } else { + var eventHash = eventName; + var name; + + for (name in eventHash) { + this.off(name, eventHash[name]); + } + + return this; + } + } // The handler of specific event detach. + + + var handlerList = this._eventHandler[eventName]; + + if (handlerList) { + var k; + var handlerFunction; + + for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) { + if (handlerFunction === handlerToDetach) { + handlerList = handlerList.splice(k, 1); + break; + } + } + } + + return this; + }; + + return Component; + }(); + + Component.VERSION = "2.1.2"; + return Component; + }(); + + /** + * Common utilities + * @module glMatrix + */ + // Configuration Constants + var EPSILON = 0.000001; + var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; + var degree = Math.PI / 180; + /** + * Convert Degree To Radian + * + * @param {Number} a Angle in Degrees + */ + + function toRadian(a) { + return a * degree; + } + if (!Math.hypot) Math.hypot = function () { + var y = 0, + i = arguments.length; + + while (i--) { + y += arguments[i] * arguments[i]; + } + + return Math.sqrt(y); + }; + + /** + * 3x3 Matrix + * @module mat3 + */ + + /** + * Creates a new identity mat3 + * + * @returns {mat3} a new 3x3 matrix + */ + + function create$2() { + var out = new ARRAY_TYPE(9); + + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + } + + out[0] = 1; + out[4] = 1; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param {mat3} out the receiving 3x3 matrix + * @param {mat4} a the source 4x4 matrix + * @returns {mat3} out + */ + + function fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Inverts a mat3 + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the source matrix + * @returns {mat3} out + */ + + function invert$2(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2]; + var a10 = a[3], + a11 = a[4], + a12 = a[5]; + var a20 = a[6], + a21 = a[7], + a22 = a[8]; + var b01 = a22 * a11 - a12 * a21; + var b11 = -a22 * a10 + a12 * a20; + var b21 = a21 * a10 - a11 * a20; // Calculate the determinant + + var det = a00 * b01 + a01 * b11 + a02 * b21; + + if (!det) { + return null; + } + + det = 1.0 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + + /** + * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied. + * @module mat4 + */ + + /** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ + + function create$3() { + var out = new ARRAY_TYPE(16); + + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + } + + out[0] = 1; + out[5] = 1; + out[10] = 1; + out[15] = 1; + return out; + } + /** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ + + function identity$3(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + + function rotateX(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + if (a !== out) { + // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } // Perform axis-specific matrix multiplication + + + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + + function rotateY(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + if (a !== out) { + // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } // Perform axis-specific matrix multiplication + + + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Quaternion to create matrix from + * + * @returns {mat4} out + */ + + function fromQuat$1(out, q) { + var x = q[0], + y = q[1], + z = q[2], + w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum, can be null or Infinity + * @returns {mat4} out + */ + + function perspective(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2), + nf; + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + + if (far != null && far !== Infinity) { + nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + + return out; + } + + /** + * 3 Dimensional Vector + * @module vec3 + */ + + /** + * Creates a new, empty vec3 + * + * @returns {vec3} a new 3D vector + */ + + function create$4() { + var out = new ARRAY_TYPE(3); + + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + + return out; + } + /** + * Calculates the length of a vec3 + * + * @param {vec3} a vector to calculate length of + * @returns {Number} length of a + */ + + function length(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return Math.hypot(x, y, z); + } + /** + * Creates a new vec3 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @returns {vec3} a new 3D vector + */ + + function fromValues$4(x, y, z) { + var out = new ARRAY_TYPE(3); + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Copy the values from one vec3 to another + * + * @param {vec3} out the receiving vector + * @param {vec3} a the source vector + * @returns {vec3} out + */ + + function copy$4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * + * @param {vec3} out the receiving vector + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @returns {vec3} out + */ + + function set$5(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Subtracts vector b from vector a + * + * @param {vec3} out the receiving vector + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @returns {vec3} out + */ + + function subtract$4(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Scales a vec3 by a scalar number + * + * @param {vec3} out the receiving vector + * @param {vec3} a the vector to scale + * @param {Number} b amount to scale the vector by + * @returns {vec3} out + */ + + function scale$4(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + return out; + } + /** + * Normalize a vec3 + * + * @param {vec3} out the receiving vector + * @param {vec3} a vector to normalize + * @returns {vec3} out + */ + + function normalize(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var len = x * x + y * y + z * z; + + if (len > 0) { + //TODO: evaluate use of glm_invsqrt here? + len = 1 / Math.sqrt(len); + } + + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @returns {Number} dot product of a and b + */ + + function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * + * @param {vec3} out the receiving vector + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @returns {vec3} out + */ + + function cross(out, a, b) { + var ax = a[0], + ay = a[1], + az = a[2]; + var bx = b[0], + by = b[1], + bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Transforms the vec3 with a mat3. + * + * @param {vec3} out the receiving vector + * @param {vec3} a the vector to transform + * @param {mat3} m the 3x3 matrix to transform with + * @returns {vec3} out + */ + + function transformMat3(out, a, m) { + var x = a[0], + y = a[1], + z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * + * @param {vec3} out the receiving vector + * @param {vec3} a the vector to transform + * @param {quat} q quaternion to transform with + * @returns {vec3} out + */ + + function transformQuat(out, a, q) { + // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed + var qx = q[0], + qy = q[1], + qz = q[2], + qw = q[3]; + var x = a[0], + y = a[1], + z = a[2]; // var qvec = [qx, qy, qz]; + // var uv = vec3.cross([], qvec, a); + + var uvx = qy * z - qz * y, + uvy = qz * x - qx * z, + uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); + + var uuvx = qy * uvz - qz * uvy, + uuvy = qz * uvx - qx * uvz, + uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); + + var w2 = qw * 2; + uvx *= w2; + uvy *= w2; + uvz *= w2; // vec3.scale(uuv, uuv, 2); + + uuvx *= 2; + uuvy *= 2; + uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); + + out[0] = x + uvx + uuvx; + out[1] = y + uvy + uuvy; + out[2] = z + uvz + uuvz; + return out; + } + /** + * Alias for {@link vec3.length} + * @function + */ + + var len = length; + /** + * Perform some operation over an array of vec3s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + + var forEach = function () { + var vec = create$4(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + + if (!stride) { + stride = 3; + } + + if (!offset) { + offset = 0; + } + + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + vec[2] = a[i + 2]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + a[i + 2] = vec[2]; + } + + return a; + }; + }(); + + /** + * 4 Dimensional Vector + * @module vec4 + */ + + /** + * Creates a new, empty vec4 + * + * @returns {vec4} a new 4D vector + */ + + function create$5() { + var out = new ARRAY_TYPE(4); + + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + } + + return out; + } + /** + * Creates a new vec4 initialized with values from an existing vector + * + * @param {vec4} a vector to clone + * @returns {vec4} a new 4D vector + */ + + function clone$5(a) { + var out = new ARRAY_TYPE(4); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a new vec4 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {vec4} a new 4D vector + */ + + function fromValues$5(x, y, z, w) { + var out = new ARRAY_TYPE(4); + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Copy the values from one vec4 to another + * + * @param {vec4} out the receiving vector + * @param {vec4} a the source vector + * @returns {vec4} out + */ + + function copy$5(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Normalize a vec4 + * + * @param {vec4} out the receiving vector + * @param {vec4} a vector to normalize + * @returns {vec4} out + */ + + function normalize$1(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + var len = x * x + y * y + z * z + w * w; + + if (len > 0) { + len = 1 / Math.sqrt(len); + } + + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {vec4} a The first vector. + * @param {vec4} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + + function exactEquals$5(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {vec4} a The first vector. + * @param {vec4} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + + function equals$6(a, b) { + var a0 = a[0], + a1 = a[1], + a2 = a[2], + a3 = a[3]; + var b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)); + } + /** + * Perform some operation over an array of vec4s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + + var forEach$1 = function () { + var vec = create$5(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + + if (!stride) { + stride = 4; + } + + if (!offset) { + offset = 0; + } + + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + vec[2] = a[i + 2]; + vec[3] = a[i + 3]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + a[i + 2] = vec[2]; + a[i + 3] = vec[3]; + } + + return a; + }; + }(); + + /** + * Quaternion + * @module quat + */ + + /** + * Creates a new identity quat + * + * @returns {quat} a new quaternion + */ + + function create$6() { + var out = new ARRAY_TYPE(4); + + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * + * @param {quat} out the receiving quaternion + * @param {vec3} axis the axis around which to rotate + * @param {Number} rad the angle in radians + * @returns {quat} out + **/ + + function setAxisAngle(out, axis, rad) { + rad = rad * 0.5; + var s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Multiplies two quat's + * + * @param {quat} out the receiving quaternion + * @param {quat} a the first operand + * @param {quat} b the second operand + * @returns {quat} out + */ + + function multiply$6(out, a, b) { + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * + * @param {quat} out the receiving quaternion + * @param {quat} a the first operand + * @param {quat} b the second operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {quat} out + */ + + function slerp(out, a, b, t) { + // benchmarks: + // http://jsperf.com/quaternion-slerp-implementations + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + var omega, cosom, sinom, scale0, scale1; // calc cosine + + cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) + + if (cosom < 0.0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } // calculate coefficients + + + if (1.0 - cosom > EPSILON) { + // standard case (slerp) + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1.0 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + // "from" and "to" quaternions are very close + // ... so we can do a linear interpolation + scale0 = 1.0 - t; + scale1 = t; + } // calculate final values + + + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * + * @param {quat} out the receiving quaternion + * @param {quat} a quat to calculate conjugate of + * @returns {quat} out + */ + + function conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to renormalize the quaternion yourself where necessary. + * + * @param {quat} out the receiving quaternion + * @param {mat3} m rotation matrix + * @returns {quat} out + * @function + */ + + function fromMat3(out, m) { + // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes + // article "Quaternion Calculus and Fast Animation". + var fTrace = m[0] + m[4] + m[8]; + var fRoot; + + if (fTrace > 0.0) { + // |w| > 1/2, may as well choose w > 1/2 + fRoot = Math.sqrt(fTrace + 1.0); // 2w + + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; // 1/(4w) + + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + // |w| <= 1/2 + var i = 0; + if (m[4] > m[0]) i = 1; + if (m[8] > m[i * 3 + i]) i = 2; + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + + return out; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * + * @param {quat} a quaternion to clone + * @returns {quat} a new quaternion + * @function + */ + + var clone$6 = clone$5; + /** + * Creates a new quat initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {quat} a new quaternion + * @function + */ + + var fromValues$6 = fromValues$5; + /** + * Copy the values from one quat to another + * + * @param {quat} out the receiving quaternion + * @param {quat} a the source quaternion + * @returns {quat} out + * @function + */ + + var copy$6 = copy$5; + /** + * Normalize a quat + * + * @param {quat} out the receiving quaternion + * @param {quat} a quaternion to normalize + * @returns {quat} out + * @function + */ + + var normalize$2 = normalize$1; + /** + * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===) + * + * @param {quat} a The first quaternion. + * @param {quat} b The second quaternion. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + + var exactEquals$6 = exactEquals$5; + /** + * Returns whether or not the quaternions have approximately the same elements in the same position. + * + * @param {quat} a The first vector. + * @param {quat} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + + var equals$7 = equals$6; + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param {quat} out the receiving quaternion. + * @param {vec3} a the initial vector + * @param {vec3} b the destination vector + * @returns {quat} out + */ + + var rotationTo = function () { + var tmpvec3 = create$4(); + var xUnitVec3 = fromValues$4(1, 0, 0); + var yUnitVec3 = fromValues$4(0, 1, 0); + return function (out, a, b) { + var dot$$1 = dot(a, b); + + if (dot$$1 < -0.999999) { + cross(tmpvec3, xUnitVec3, a); + if (len(tmpvec3) < 0.000001) cross(tmpvec3, yUnitVec3, a); + normalize(tmpvec3, tmpvec3); + setAxisAngle(out, tmpvec3, Math.PI); + return out; + } else if (dot$$1 > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + cross(tmpvec3, a, b); + out[0] = tmpvec3[0]; + out[1] = tmpvec3[1]; + out[2] = tmpvec3[2]; + out[3] = 1 + dot$$1; + return normalize$2(out, out); + } + }; + }(); + /** + * Performs a spherical linear interpolation with two control points + * + * @param {quat} out the receiving quaternion + * @param {quat} a the first operand + * @param {quat} b the second operand + * @param {quat} c the third operand + * @param {quat} d the fourth operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {quat} out + */ + + var sqlerp = function () { + var temp1 = create$6(); + var temp2 = create$6(); + return function (out, a, b, c, d, t) { + slerp(temp1, a, d, t); + slerp(temp2, b, c, t); + slerp(out, temp1, temp2, 2 * t * (1 - t)); + return out; + }; + }(); + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param {vec3} view the vector representing the viewing direction + * @param {vec3} right the vector representing the local "right" direction + * @param {vec3} up the vector representing the local "up" direction + * @returns {quat} out + */ + + var setAxes = function () { + var matr = create$2(); + return function (out, view, right, up) { + matr[0] = right[0]; + matr[3] = right[1]; + matr[6] = right[2]; + matr[1] = up[0]; + matr[4] = up[1]; + matr[7] = up[2]; + matr[2] = -view[0]; + matr[5] = -view[1]; + matr[8] = -view[2]; + return normalize$2(out, fromMat3(out, matr)); + }; + }(); + + /** + * 2 Dimensional Vector + * @module vec2 + */ + + /** + * Creates a new, empty vec2 + * + * @returns {vec2} a new 2D vector + */ + + function create$8() { + var out = new ARRAY_TYPE(2); + + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + } + + return out; + } + /** + * Creates a new vec2 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @returns {vec2} a new 2D vector + */ + + function fromValues$8(x, y) { + var out = new ARRAY_TYPE(2); + out[0] = x; + out[1] = y; + return out; + } + /** + * Copy the values from one vec2 to another + * + * @param {vec2} out the receiving vector + * @param {vec2} a the source vector + * @returns {vec2} out + */ + + function copy$8(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Normalize a vec2 + * + * @param {vec2} out the receiving vector + * @param {vec2} a vector to normalize + * @returns {vec2} out + */ + + function normalize$4(out, a) { + var x = a[0], + y = a[1]; + var len = x * x + y * y; + + if (len > 0) { + //TODO: evaluate use of glm_invsqrt here? + len = 1 / Math.sqrt(len); + } + + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two vec2's + * + * @param {vec2} a the first operand + * @param {vec2} b the second operand + * @returns {Number} dot product of a and b + */ + + function dot$4(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Perform some operation over an array of vec2s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + + var forEach$2 = function () { + var vec = create$8(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + + if (!stride) { + stride = 2; + } + + if (!offset) { + offset = 0; + } + + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + } + + return a; + }; + }(); + + /* + 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); + } + } + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + /* eslint-disable no-new-func, no-nested-ternary */ + + var win = typeof window !== "undefined" && window.Math === Math ? window : typeof self !== "undefined" && self.Math === Math ? self : Function("return this")(); + /* eslint-enable no-new-func, no-nested-ternary */ + + var doc = win.document; + var agent$1 = agent(); + var osName = agent$1.os.name; + var browserName = agent$1.browser.name; + var IS_IOS = osName === "ios"; + var IS_SAFARI_ON_DESKTOP = osName === "mac" && browserName === "safari"; + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + win.Float32Array = typeof win.Float32Array !== "undefined" ? win.Float32Array : win.Array; + var Float32Array$1 = win.Float32Array; + var getComputedStyle = win.getComputedStyle; + var userAgent = win.navigator.userAgent; + var SUPPORT_TOUCH = "ontouchstart" in win; + var SUPPORT_DEVICEMOTION = "ondevicemotion" in win; + var DeviceMotionEvent = win.DeviceMotionEvent; + var devicePixelRatio = win.devicePixelRatio; + + var TRANSFORM = function () { + var docStyle = doc.documentElement.style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in docStyle) { + return target[i]; + } + } + + return ""; + }(); // check for will-change support + + + var SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports && win.CSS.supports("will-change", "transform"); + var WEBXR_SUPPORTED = false; + + var checkXRSupport = function checkXRSupport() { + if (!navigator.xr) { + return; + } + + if (navigator.xr.isSessionSupported) { + navigator.xr.isSessionSupported("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } else if (navigator.xr.supportsSession) { + navigator.xr.supportsSession("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } + }; + + /*! Hammer.JS - v2.0.17-rc - 2019-12-16 + * http://naver.github.io/egjs + * + * Forked By Naver egjs + * Copyright (c) hammerjs + * Licensed under the MIT license */ + function _extends$1() { + _extends$1 = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends$1.apply(this, arguments); + } + + function _inheritsLoose$1(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized$1(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + /** + * @private + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} target + * @param {...Object} objects_to_assign + * @returns {Object} target + */ + var assign; + + if (typeof Object.assign !== 'function') { + assign = function assign(target) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + + return output; + }; + } else { + assign = Object.assign; + } + + var assign$1 = assign; + + var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; + var TEST_ELEMENT = typeof document === "undefined" ? { + style: {} + } : document.createElement('div'); + var TYPE_FUNCTION = 'function'; + var round$3 = Math.round, + abs = Math.abs; + var now = Date.now; + + /** + * @private + * get the prefixed property + * @param {Object} obj + * @param {String} property + * @returns {String|Undefined} prefixed + */ + + function prefixed(obj, property) { + var prefix; + var prop; + var camelProp = property[0].toUpperCase() + property.slice(1); + var i = 0; + + while (i < VENDOR_PREFIXES.length) { + prefix = VENDOR_PREFIXES[i]; + prop = prefix ? prefix + camelProp : property; + + if (prop in obj) { + return prop; + } + + i++; + } + + return undefined; + } + + /* eslint-disable no-new-func, no-nested-ternary */ + var win$1; + + if (typeof window === "undefined") { + // window is undefined in node.js + win$1 = {}; + } else { + win$1 = window; + } + + var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); + var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; + function getTouchActionProps() { + if (!NATIVE_TOUCH_ACTION) { + return false; + } + + var touchMap = {}; + var cssSupports = win$1.CSS && win$1.CSS.supports; + ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) { + // If css.supports is not supported but there is native touch-action assume it supports + // all values. This is the case for IE 10 and 11. + return touchMap[val] = cssSupports ? win$1.CSS.supports('touch-action', val) : true; + }); + return touchMap; + } + + var TOUCH_ACTION_COMPUTE = 'compute'; + var TOUCH_ACTION_AUTO = 'auto'; + var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented + + var TOUCH_ACTION_NONE = 'none'; + var TOUCH_ACTION_PAN_X = 'pan-x'; + var TOUCH_ACTION_PAN_Y = 'pan-y'; + var TOUCH_ACTION_MAP = getTouchActionProps(); + + var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; + var SUPPORT_TOUCH$1 = 'ontouchstart' in win$1; + var SUPPORT_POINTER_EVENTS = prefixed(win$1, 'PointerEvent') !== undefined; + var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH$1 && MOBILE_REGEX.test(navigator.userAgent); + var INPUT_TYPE_TOUCH = 'touch'; + var INPUT_TYPE_PEN = 'pen'; + var INPUT_TYPE_MOUSE = 'mouse'; + var INPUT_TYPE_KINECT = 'kinect'; + var COMPUTE_INTERVAL = 25; + var INPUT_START = 1; + var INPUT_MOVE = 2; + var INPUT_END = 4; + var INPUT_CANCEL = 8; + var DIRECTION_NONE = 1; + var DIRECTION_LEFT = 2; + var DIRECTION_RIGHT = 4; + var DIRECTION_UP = 8; + var DIRECTION_DOWN = 16; + var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; + var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; + var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; + var PROPS_XY = ['x', 'y']; + var PROPS_CLIENT_XY = ['clientX', 'clientY']; + + /** + * @private + * walk objects and arrays + * @param {Object} obj + * @param {Function} iterator + * @param {Object} context + */ + function each(obj, iterator, context) { + var i; + + if (!obj) { + return; + } + + if (obj.forEach) { + obj.forEach(iterator, context); + } else if (obj.length !== undefined) { + i = 0; + + while (i < obj.length) { + iterator.call(context, obj[i], i, obj); + i++; + } + } else { + for (i in obj) { + obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); + } + } + } + + /** + * @private + * let a boolean value also be a function that must return a boolean + * this first item in args will be used as the context + * @param {Boolean|Function} val + * @param {Array} [args] + * @returns {Boolean} + */ + + function boolOrFn(val, args) { + if (typeof val === TYPE_FUNCTION) { + return val.apply(args ? args[0] || undefined : undefined, args); + } + + return val; + } + + /** + * @private + * small indexOf wrapper + * @param {String} str + * @param {String} find + * @returns {Boolean} found + */ + function inStr(str, find) { + return str.indexOf(find) > -1; + } + + /** + * @private + * when the touchActions are collected they are not a valid value, so we need to clean things up. * + * @param {String} actions + * @returns {*} + */ + + function cleanTouchActions(actions) { + // none + if (inStr(actions, TOUCH_ACTION_NONE)) { + return TOUCH_ACTION_NONE; + } + + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers + // for different directions, e.g. horizontal pan but vertical swipe?) + // we need none (as otherwise with pan-x pan-y combined none of these + // recognizers will work, since the browser would handle all panning + + if (hasPanX && hasPanY) { + return TOUCH_ACTION_NONE; + } // pan-x OR pan-y + + + if (hasPanX || hasPanY) { + return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; + } // manipulation + + + if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { + return TOUCH_ACTION_MANIPULATION; + } + + return TOUCH_ACTION_AUTO; + } + + /** + * @private + * Touch Action + * sets the touchAction property or uses the js alternative + * @param {Manager} manager + * @param {String} value + * @constructor + */ + + var TouchAction = + /*#__PURE__*/ + function () { + function TouchAction(manager, value) { + this.manager = manager; + this.set(value); + } + /** + * @private + * set the touchAction value on the element or enable the polyfill + * @param {String} value + */ + + + var _proto = TouchAction.prototype; + + _proto.set = function set(value) { + // find out the touch-action by the event handlers + if (value === TOUCH_ACTION_COMPUTE) { + value = this.compute(); + } + + if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { + this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; + } + + this.actions = value.toLowerCase().trim(); + }; + /** + * @private + * just re-set the touchAction value + */ + + + _proto.update = function update() { + this.set(this.manager.options.touchAction); + }; + /** + * @private + * compute the value for the touchAction property based on the recognizer's settings + * @returns {String} value + */ + + + _proto.compute = function compute() { + var actions = []; + each(this.manager.recognizers, function (recognizer) { + if (boolOrFn(recognizer.options.enable, [recognizer])) { + actions = actions.concat(recognizer.getTouchAction()); + } + }); + return cleanTouchActions(actions.join(' ')); + }; + /** + * @private + * this method is called on each input cycle and provides the preventing of the browser behavior + * @param {Object} input + */ + + + _proto.preventDefaults = function preventDefaults(input) { + var srcEvent = input.srcEvent; + var direction = input.offsetDirection; // if the touch action did prevented once this session + + if (this.manager.session.prevented) { + srcEvent.preventDefault(); + return; + } + + var actions = this.actions; + var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; + + if (hasNone) { + // do not prevent defaults if this is a tap gesture + var isTapPointer = input.pointers.length === 1; + var isTapMovement = input.distance < 2; + var isTapTouchTime = input.deltaTime < 250; + + if (isTapPointer && isTapMovement && isTapTouchTime) { + return; + } + } + + if (hasPanX && hasPanY) { + // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent + return; + } + + if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) { + return this.preventSrc(srcEvent); + } + }; + /** + * @private + * call preventDefault to prevent the browser's default behavior (scrolling in most cases) + * @param {Object} srcEvent + */ + + + _proto.preventSrc = function preventSrc(srcEvent) { + this.manager.session.prevented = true; + srcEvent.preventDefault(); + }; + + return TouchAction; + }(); + + /** + * @private + * find if a node is in the given parent + * @method hasParent + * @param {HTMLElement} node + * @param {HTMLElement} parent + * @return {Boolean} found + */ + function hasParent(node, parent) { + while (node) { + if (node === parent) { + return true; + } + + node = node.parentNode; + } + + return false; + } + + /** + * @private + * get the center of all the pointers + * @param {Array} pointers + * @return {Object} center contains `x` and `y` properties + */ + + function getCenter(pointers) { + var pointersLength = pointers.length; // no need to loop when only one touch + + if (pointersLength === 1) { + return { + x: round$3(pointers[0].clientX), + y: round$3(pointers[0].clientY) + }; + } + + var x = 0; + var y = 0; + var i = 0; + + while (i < pointersLength) { + x += pointers[i].clientX; + y += pointers[i].clientY; + i++; + } + + return { + x: round$3(x / pointersLength), + y: round$3(y / pointersLength) + }; + } + + /** + * @private + * create a simple clone from the input used for storage of firstInput and firstMultiple + * @param {Object} input + * @returns {Object} clonedInputData + */ + + function simpleCloneInputData(input) { + // make a simple copy of the pointers because we will get a reference if we don't + // we only need clientXY for the calculations + var pointers = []; + var i = 0; + + while (i < input.pointers.length) { + pointers[i] = { + clientX: round$3(input.pointers[i].clientX), + clientY: round$3(input.pointers[i].clientY) + }; + i++; + } + + return { + timeStamp: now(), + pointers: pointers, + center: getCenter(pointers), + deltaX: input.deltaX, + deltaY: input.deltaY + }; + } + + /** + * @private + * calculate the absolute distance between two points + * @param {Object} p1 {x, y} + * @param {Object} p2 {x, y} + * @param {Array} [props] containing x and y keys + * @return {Number} distance + */ + + function getDistance(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + + var x = p2[props[0]] - p1[props[0]]; + var y = p2[props[1]] - p1[props[1]]; + return Math.sqrt(x * x + y * y); + } + + /** + * @private + * calculate the angle between two coordinates + * @param {Object} p1 + * @param {Object} p2 + * @param {Array} [props] containing x and y keys + * @return {Number} angle + */ + + function getAngle$1(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + + var x = p2[props[0]] - p1[props[0]]; + var y = p2[props[1]] - p1[props[1]]; + return Math.atan2(y, x) * 180 / Math.PI; + } + + /** + * @private + * get the direction between two points + * @param {Number} x + * @param {Number} y + * @return {Number} direction + */ + + function getDirection(x, y) { + if (x === y) { + return DIRECTION_NONE; + } + + if (abs(x) >= abs(y)) { + return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + + return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; + } + + function computeDeltaXY(session, input) { + var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session; + // jscs throwing error on defalut destructured values and without defaults tests fail + + var offset = session.offsetDelta || {}; + var prevDelta = session.prevDelta || {}; + var prevInput = session.prevInput || {}; + + if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { + prevDelta = session.prevDelta = { + x: prevInput.deltaX || 0, + y: prevInput.deltaY || 0 + }; + offset = session.offsetDelta = { + x: center.x, + y: center.y + }; + } + + input.deltaX = prevDelta.x + (center.x - offset.x); + input.deltaY = prevDelta.y + (center.y - offset.y); + } + + /** + * @private + * calculate the velocity between two points. unit is in px per ms. + * @param {Number} deltaTime + * @param {Number} x + * @param {Number} y + * @return {Object} velocity `x` and `y` + */ + function getVelocity(deltaTime, x, y) { + return { + x: x / deltaTime || 0, + y: y / deltaTime || 0 + }; + } + + /** + * @private + * calculate the scale factor between two pointersets + * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} scale + */ + + function getScale(start, end) { + return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); + } + + /** + * @private + * calculate the rotation degrees between two pointersets + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} rotation + */ + + function getRotation$1(start, end) { + return getAngle$1(end[1], end[0], PROPS_CLIENT_XY) + getAngle$1(start[1], start[0], PROPS_CLIENT_XY); + } + + /** + * @private + * velocity is calculated every x ms + * @param {Object} session + * @param {Object} input + */ + + function computeIntervalInputData(session, input) { + var last = session.lastInterval || input; + var deltaTime = input.timeStamp - last.timeStamp; + var velocity; + var velocityX; + var velocityY; + var direction; + + if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { + var deltaX = input.deltaX - last.deltaX; + var deltaY = input.deltaY - last.deltaY; + var v = getVelocity(deltaTime, deltaX, deltaY); + velocityX = v.x; + velocityY = v.y; + velocity = abs(v.x) > abs(v.y) ? v.x : v.y; + direction = getDirection(deltaX, deltaY); + session.lastInterval = input; + } else { + // use latest velocity info if it doesn't overtake a minimum period + velocity = last.velocity; + velocityX = last.velocityX; + velocityY = last.velocityY; + direction = last.direction; + } + + input.velocity = velocity; + input.velocityX = velocityX; + input.velocityY = velocityY; + input.direction = direction; + } + + /** + * @private + * extend the data with some usable properties like scale, rotate, velocity etc + * @param {Object} manager + * @param {Object} input + */ + + function computeInputData(manager, input) { + var session = manager.session; + var pointers = input.pointers; + var pointersLength = pointers.length; // store the first input to calculate the distance and direction + + if (!session.firstInput) { + session.firstInput = simpleCloneInputData(input); + } // to compute scale and rotation we need to store the multiple touches + + + if (pointersLength > 1 && !session.firstMultiple) { + session.firstMultiple = simpleCloneInputData(input); + } else if (pointersLength === 1) { + session.firstMultiple = false; + } + + var firstInput = session.firstInput, + firstMultiple = session.firstMultiple; + var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; + var center = input.center = getCenter(pointers); + input.timeStamp = now(); + input.deltaTime = input.timeStamp - firstInput.timeStamp; + input.angle = getAngle$1(offsetCenter, center); + input.distance = getDistance(offsetCenter, center); + computeDeltaXY(session, input); + input.offsetDirection = getDirection(input.deltaX, input.deltaY); + var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); + input.overallVelocityX = overallVelocity.x; + input.overallVelocityY = overallVelocity.y; + input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y; + input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; + input.rotation = firstMultiple ? getRotation$1(firstMultiple.pointers, pointers) : 0; + input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers; + computeIntervalInputData(session, input); // find the correct target + + var target = manager.element; + var srcEvent = input.srcEvent; + var srcEventTarget; + + if (srcEvent.composedPath) { + srcEventTarget = srcEvent.composedPath()[0]; + } else if (srcEvent.path) { + srcEventTarget = srcEvent.path[0]; + } else { + srcEventTarget = srcEvent.target; + } + + if (hasParent(srcEventTarget, target)) { + target = srcEventTarget; + } + + input.target = target; + } + + /** + * @private + * handle input events + * @param {Manager} manager + * @param {String} eventType + * @param {Object} input + */ + + function inputHandler(manager, eventType, input) { + var pointersLen = input.pointers.length; + var changedPointersLen = input.changedPointers.length; + var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0; + var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0; + input.isFirst = !!isFirst; + input.isFinal = !!isFinal; + + if (isFirst) { + manager.session = {}; + } // source event is the normalized value of the domEvents + // like 'touchstart, mouseup, pointerdown' + + + input.eventType = eventType; // compute scale, rotation etc + + computeInputData(manager, input); // emit secret event + + manager.emit('hammer.input', input); + manager.recognize(input); + manager.session.prevInput = input; + } + + /** + * @private + * split string on whitespace + * @param {String} str + * @returns {Array} words + */ + function splitStr(str) { + return str.trim().split(/\s+/g); + } + + /** + * @private + * addEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ + + function addEventListeners(target, types, handler) { + each(splitStr(types), function (type) { + target.addEventListener(type, handler, false); + }); + } + + /** + * @private + * removeEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ + + function removeEventListeners(target, types, handler) { + each(splitStr(types), function (type) { + target.removeEventListener(type, handler, false); + }); + } + + /** + * @private + * get the window object of an element + * @param {HTMLElement} element + * @returns {DocumentView|Window} + */ + function getWindowForElement(element) { + var doc = element.ownerDocument || element; + return doc.defaultView || doc.parentWindow || window; + } + + /** + * @private + * create new input type manager + * @param {Manager} manager + * @param {Function} callback + * @returns {Input} + * @constructor + */ + + var Input = + /*#__PURE__*/ + function () { + function Input(manager, callback) { + var self = this; + this.manager = manager; + this.callback = callback; + this.element = manager.element; + this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager, + // so when disabled the input events are completely bypassed. + + this.domHandler = function (ev) { + if (boolOrFn(manager.options.enable, [manager])) { + self.handler(ev); + } + }; + + this.init(); + } + /** + * @private + * should handle the inputEvent data and trigger the callback + * @virtual + */ + + + var _proto = Input.prototype; + + _proto.handler = function handler() {}; + /** + * @private + * bind the events + */ + + + _proto.init = function init() { + this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }; + /** + * @private + * unbind the events + */ + + + _proto.destroy = function destroy() { + this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }; + + return Input; + }(); + + /** + * @private + * find if a array contains the object using indexOf or a simple polyFill + * @param {Array} src + * @param {String} find + * @param {String} [findByKey] + * @return {Boolean|Number} false when not found, or the index + */ + function inArray(src, find, findByKey) { + if (src.indexOf && !findByKey) { + return src.indexOf(find); + } else { + var i = 0; + + while (i < src.length) { + if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) { + // do not use === here, test fails + return i; + } + + i++; + } + + return -1; + } + } + + var POINTER_INPUT_MAP = { + pointerdown: INPUT_START, + pointermove: INPUT_MOVE, + pointerup: INPUT_END, + pointercancel: INPUT_CANCEL, + pointerout: INPUT_CANCEL + }; // in IE10 the pointer types is defined as an enum + + var IE10_POINTER_TYPE_ENUM = { + 2: INPUT_TYPE_TOUCH, + 3: INPUT_TYPE_PEN, + 4: INPUT_TYPE_MOUSE, + 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 + + }; + var POINTER_ELEMENT_EVENTS = 'pointerdown'; + var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive + + if (win$1.MSPointerEvent && !win$1.PointerEvent) { + POINTER_ELEMENT_EVENTS = 'MSPointerDown'; + POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; + } + /** + * @private + * Pointer events input + * @constructor + * @extends Input + */ + + + var PointerEventInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(PointerEventInput, _Input); + + function PointerEventInput() { + var _this; + + var proto = PointerEventInput.prototype; + proto.evEl = POINTER_ELEMENT_EVENTS; + proto.evWin = POINTER_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.store = _this.manager.session.pointerEvents = []; + return _this; + } + /** + * @private + * handle mouse events + * @param {Object} ev + */ + + + var _proto = PointerEventInput.prototype; + + _proto.handler = function handler(ev) { + var store = this.store; + var removePointer = false; + var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); + var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; + var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; + var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store + + var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down + + if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { + if (storeIndex < 0) { + store.push(ev); + storeIndex = store.length - 1; + } + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + removePointer = true; + } // it not found, so the pointer hasn't been down (so it's probably a hover) + + + if (storeIndex < 0) { + return; + } // update the event in the store + + + store[storeIndex] = ev; + this.callback(this.manager, eventType, { + pointers: store, + changedPointers: [ev], + pointerType: pointerType, + srcEvent: ev + }); + + if (removePointer) { + // remove from the store + store.splice(storeIndex, 1); + } + }; + + return PointerEventInput; + }(Input); + + /** + * @private + * convert array-like objects to real arrays + * @param {Object} obj + * @returns {Array} + */ + function toArray(obj) { + return Array.prototype.slice.call(obj, 0); + } + + /** + * @private + * unique array with objects based on a key (like 'id') or just by the array's value + * @param {Array} src [{id:1},{id:2},{id:1}] + * @param {String} [key] + * @param {Boolean} [sort=False] + * @returns {Array} [{id:1},{id:2}] + */ + + function uniqueArray(src, key, sort) { + var results = []; + var values = []; + var i = 0; + + while (i < src.length) { + var val = key ? src[i][key] : src[i]; + + if (inArray(values, val) < 0) { + results.push(src[i]); + } + + values[i] = val; + i++; + } + + if (sort) { + if (!key) { + results = results.sort(); + } else { + results = results.sort(function (a, b) { + return a[key] > b[key]; + }); + } + } + + return results; + } + + var TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL + }; + var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; + /** + * @private + * Multi-user touch events input + * @constructor + * @extends Input + */ + + var TouchInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(TouchInput, _Input); + + function TouchInput() { + var _this; + + TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS; + + return _this; + } + + var _proto = TouchInput.prototype; + + _proto.handler = function handler(ev) { + var type = TOUCH_INPUT_MAP[ev.type]; + var touches = getTouches.call(this, ev, type); + + if (!touches) { + return; + } + + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + }; + + return TouchInput; + }(Input); + + function getTouches(ev, type) { + var allTouches = toArray(ev.touches); + var targetIds = this.targetIds; // when there is only one touch, the process can be simplified + + if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { + targetIds[allTouches[0].identifier] = true; + return [allTouches, allTouches]; + } + + var i; + var targetTouches; + var changedTouches = toArray(ev.changedTouches); + var changedTargetTouches = []; + var target = this.target; // get target touches from touches + + targetTouches = allTouches.filter(function (touch) { + return hasParent(touch.target, target); + }); // collect touches + + if (type === INPUT_START) { + i = 0; + + while (i < targetTouches.length) { + targetIds[targetTouches[i].identifier] = true; + i++; + } + } // filter changed touches to only contain touches that exist in the collected target ids + + + i = 0; + + while (i < changedTouches.length) { + if (targetIds[changedTouches[i].identifier]) { + changedTargetTouches.push(changedTouches[i]); + } // cleanup removed touches + + + if (type & (INPUT_END | INPUT_CANCEL)) { + delete targetIds[changedTouches[i].identifier]; + } + + i++; + } + + if (!changedTargetTouches.length) { + return; + } + + return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' + uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches]; + } + + var MOUSE_INPUT_MAP = { + mousedown: INPUT_START, + mousemove: INPUT_MOVE, + mouseup: INPUT_END + }; + var MOUSE_ELEMENT_EVENTS = 'mousedown'; + var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; + /** + * @private + * Mouse events input + * @constructor + * @extends Input + */ + + var MouseInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(MouseInput, _Input); + + function MouseInput() { + var _this; + + var proto = MouseInput.prototype; + proto.evEl = MOUSE_ELEMENT_EVENTS; + proto.evWin = MOUSE_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.pressed = false; // mousedown state + + return _this; + } + /** + * @private + * handle mouse events + * @param {Object} ev + */ + + + var _proto = MouseInput.prototype; + + _proto.handler = function handler(ev) { + var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down + + if (eventType & INPUT_START && ev.button === 0) { + this.pressed = true; + } + + if (eventType & INPUT_MOVE && ev.which !== 1) { + eventType = INPUT_END; + } // mouse must be down + + + if (!this.pressed) { + return; + } + + if (eventType & INPUT_END) { + this.pressed = false; + } + + this.callback(this.manager, eventType, { + pointers: [ev], + changedPointers: [ev], + pointerType: INPUT_TYPE_MOUSE, + srcEvent: ev + }); + }; + + return MouseInput; + }(Input); + + /** + * @private + * Combined touch and mouse input + * + * Touch has a higher priority then mouse, and while touching no mouse events are allowed. + * This because touch devices also emit mouse events while doing a touch. + * + * @constructor + * @extends Input + */ + + var DEDUP_TIMEOUT = 2500; + var DEDUP_DISTANCE = 25; + + function setLastTouch(eventData) { + var _eventData$changedPoi = eventData.changedPointers, + touch = _eventData$changedPoi[0]; + + if (touch.identifier === this.primaryTouch) { + var lastTouch = { + x: touch.clientX, + y: touch.clientY + }; + var lts = this.lastTouches; + this.lastTouches.push(lastTouch); + + var removeLastTouch = function removeLastTouch() { + var i = lts.indexOf(lastTouch); + + if (i > -1) { + lts.splice(i, 1); + } + }; + + setTimeout(removeLastTouch, DEDUP_TIMEOUT); + } + } + + function recordTouches(eventType, eventData) { + if (eventType & INPUT_START) { + this.primaryTouch = eventData.changedPointers[0].identifier; + setLastTouch.call(this, eventData); + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + setLastTouch.call(this, eventData); + } + } + + function isSyntheticEvent(eventData) { + var x = eventData.srcEvent.clientX; + var y = eventData.srcEvent.clientY; + + for (var i = 0; i < this.lastTouches.length; i++) { + var t = this.lastTouches[i]; + var dx = Math.abs(x - t.x); + var dy = Math.abs(y - t.y); + + if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { + return true; + } + } + + return false; + } + + var TouchMouseInput = + /*#__PURE__*/ + function () { + var TouchMouseInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(TouchMouseInput, _Input); + + function TouchMouseInput(_manager, callback) { + var _this; + + _this = _Input.call(this, _manager, callback) || this; + + _this.handler = function (manager, inputEvent, inputData) { + var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH; + var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE; + + if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { + return; + } // when we're in a touch event, record touches to de-dupe synthetic mouse event + + + if (isTouch) { + recordTouches.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputEvent, inputData); + } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputData)) { + return; + } + + _this.callback(manager, inputEvent, inputData); + }; + + _this.touch = new TouchInput(_this.manager, _this.handler); + _this.mouse = new MouseInput(_this.manager, _this.handler); + _this.primaryTouch = null; + _this.lastTouches = []; + return _this; + } + /** + * @private + * handle mouse and touch events + * @param {Hammer} manager + * @param {String} inputEvent + * @param {Object} inputData + */ + + + var _proto = TouchMouseInput.prototype; + + /** + * @private + * remove the event listeners + */ + _proto.destroy = function destroy() { + this.touch.destroy(); + this.mouse.destroy(); + }; + + return TouchMouseInput; + }(Input); + + return TouchMouseInput; + }(); + + /** + * @private + * create new input type manager + * called by the Manager constructor + * @param {Hammer} manager + * @returns {Input} + */ + + function createInputInstance(manager) { + var Type; // let inputClass = manager.options.inputClass; + + var inputClass = manager.options.inputClass; + + if (inputClass) { + Type = inputClass; + } else if (SUPPORT_POINTER_EVENTS) { + Type = PointerEventInput; + } else if (SUPPORT_ONLY_TOUCH) { + Type = TouchInput; + } else if (!SUPPORT_TOUCH$1) { + Type = MouseInput; + } else { + Type = TouchMouseInput; + } + + return new Type(manager, inputHandler); + } + + /** + * @private + * if the argument is an array, we want to execute the fn on each entry + * if it aint an array we don't want to do a thing. + * this is used by all the methods that accept a single and array argument. + * @param {*|Array} arg + * @param {String} fn + * @param {Object} [context] + * @returns {Boolean} + */ + + function invokeArrayArg(arg, fn, context) { + if (Array.isArray(arg)) { + each(arg, context[fn], context); + return true; + } + + return false; + } + + var STATE_POSSIBLE = 1; + var STATE_BEGAN = 2; + var STATE_CHANGED = 4; + var STATE_ENDED = 8; + var STATE_RECOGNIZED = STATE_ENDED; + var STATE_CANCELLED = 16; + var STATE_FAILED = 32; + + /** + * @private + * get a unique id + * @returns {number} uniqueId + */ + var _uniqueId = 1; + function uniqueId() { + return _uniqueId++; + } + + /** + * @private + * get a recognizer by name if it is bound to a manager + * @param {Recognizer|String} otherRecognizer + * @param {Recognizer} recognizer + * @returns {Recognizer} + */ + function getRecognizerByNameIfManager(otherRecognizer, recognizer) { + var manager = recognizer.manager; + + if (manager) { + return manager.get(otherRecognizer); + } + + return otherRecognizer; + } + + /** + * @private + * get a usable string, used as event postfix + * @param {constant} state + * @returns {String} state + */ + + function stateStr(state) { + if (state & STATE_CANCELLED) { + return 'cancel'; + } else if (state & STATE_ENDED) { + return 'end'; + } else if (state & STATE_CHANGED) { + return 'move'; + } else if (state & STATE_BEGAN) { + return 'start'; + } + + return ''; + } + + /** + * @private + * Recognizer flow explained; * + * All recognizers have the initial state of POSSIBLE when a input session starts. + * The definition of a input session is from the first input until the last input, with all it's movement in it. * + * Example session for mouse-input: mousedown -> mousemove -> mouseup + * + * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed + * which determines with state it should be. + * + * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to + * POSSIBLE to give it another change on the next cycle. + * + * Possible + * | + * +-----+---------------+ + * | | + * +-----+-----+ | + * | | | + * Failed Cancelled | + * +-------+------+ + * | | + * Recognized Began + * | + * Changed + * | + * Ended/Recognized + */ + + /** + * @private + * Recognizer + * Every recognizer needs to extend from this class. + * @constructor + * @param {Object} options + */ + + var Recognizer = + /*#__PURE__*/ + function () { + function Recognizer(options) { + if (options === void 0) { + options = {}; + } + + this.options = _extends$1({ + enable: true + }, options); + this.id = uniqueId(); + this.manager = null; // default is enable true + + this.state = STATE_POSSIBLE; + this.simultaneous = {}; + this.requireFail = []; + } + /** + * @private + * set options + * @param {Object} options + * @return {Recognizer} + */ + + + var _proto = Recognizer.prototype; + + _proto.set = function set(options) { + assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state + + this.manager && this.manager.touchAction.update(); + return this; + }; + /** + * @private + * recognize simultaneous with an other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.recognizeWith = function recognizeWith(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { + return this; + } + + var simultaneous = this.simultaneous; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + + if (!simultaneous[otherRecognizer.id]) { + simultaneous[otherRecognizer.id] = otherRecognizer; + otherRecognizer.recognizeWith(this); + } + + return this; + }; + /** + * @private + * drop the simultaneous link. it doesnt remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { + return this; + } + + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + delete this.simultaneous[otherRecognizer.id]; + return this; + }; + /** + * @private + * recognizer can only run when an other is failing + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.requireFailure = function requireFailure(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { + return this; + } + + var requireFail = this.requireFail; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + + if (inArray(requireFail, otherRecognizer) === -1) { + requireFail.push(otherRecognizer); + otherRecognizer.requireFailure(this); + } + + return this; + }; + /** + * @private + * drop the requireFailure link. it does not remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { + return this; + } + + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + var index = inArray(this.requireFail, otherRecognizer); + + if (index > -1) { + this.requireFail.splice(index, 1); + } + + return this; + }; + /** + * @private + * has require failures boolean + * @returns {boolean} + */ + + + _proto.hasRequireFailures = function hasRequireFailures() { + return this.requireFail.length > 0; + }; + /** + * @private + * if the recognizer can recognize simultaneous with an other recognizer + * @param {Recognizer} otherRecognizer + * @returns {Boolean} + */ + + + _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) { + return !!this.simultaneous[otherRecognizer.id]; + }; + /** + * @private + * You should use `tryEmit` instead of `emit` directly to check + * that all the needed recognizers has failed before emitting. + * @param {Object} input + */ + + + _proto.emit = function emit(input) { + var self = this; + var state = this.state; + + function emit(event) { + self.manager.emit(event, input); + } // 'panstart' and 'panmove' + + + if (state < STATE_ENDED) { + emit(self.options.event + stateStr(state)); + } + + emit(self.options.event); // simple 'eventName' events + + if (input.additionalEvent) { + // additional event(panleft, panright, pinchin, pinchout...) + emit(input.additionalEvent); + } // panend and pancancel + + + if (state >= STATE_ENDED) { + emit(self.options.event + stateStr(state)); + } + }; + /** + * @private + * Check that all the require failure recognizers has failed, + * if true, it emits a gesture event, + * otherwise, setup the state to FAILED. + * @param {Object} input + */ + + + _proto.tryEmit = function tryEmit(input) { + if (this.canEmit()) { + return this.emit(input); + } // it's failing anyway + + + this.state = STATE_FAILED; + }; + /** + * @private + * can we emit? + * @returns {boolean} + */ + + + _proto.canEmit = function canEmit() { + var i = 0; + + while (i < this.requireFail.length) { + if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { + return false; + } + + i++; + } + + return true; + }; + /** + * @private + * update the recognizer + * @param {Object} inputData + */ + + + _proto.recognize = function recognize(inputData) { + // make a new copy of the inputData + // so we can change the inputData without messing up the other recognizers + var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing? + + if (!boolOrFn(this.options.enable, [this, inputDataClone])) { + this.reset(); + this.state = STATE_FAILED; + return; + } // reset when we've reached the end + + + if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { + this.state = STATE_POSSIBLE; + } + + this.state = this.process(inputDataClone); // the recognizer has recognized a gesture + // so trigger an event + + if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { + this.tryEmit(inputDataClone); + } + }; + /** + * @private + * return the state of the recognizer + * the actual recognizing happens in this method + * @virtual + * @param {Object} inputData + * @returns {constant} STATE + */ + + /* jshint ignore:start */ + + + _proto.process = function process(inputData) {}; + /* jshint ignore:end */ + + /** + * @private + * return the preferred touch-action + * @virtual + * @returns {Array} + */ + + + _proto.getTouchAction = function getTouchAction() {}; + /** + * @private + * called when the gesture isn't allowed to recognize + * like when another is being recognized or it is disabled + * @virtual + */ + + + _proto.reset = function reset() {}; + + return Recognizer; + }(); + + /** + * @private + * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur + * between the given interval and position. The delay option can be used to recognize multi-taps without firing + * a single tap. + * + * The eventData from the emitted event contains the property `tapCount`, which contains the amount of + * multi-taps being recognized. + * @constructor + * @extends Recognizer + */ + + var TapRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(TapRecognizer, _Recognizer); + + function TapRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Recognizer.call(this, _extends$1({ + event: 'tap', + pointers: 1, + taps: 1, + interval: 300, + // max time between the multi-tap taps + time: 250, + // max time of the pointer to be down (like finger on the screen) + threshold: 9, + // a minimal movement is ok, but keep it low + posThreshold: 10 + }, options)) || this; // previous time and center, + // used for tap counting + + _this.pTime = false; + _this.pCenter = false; + _this._timer = null; + _this._input = null; + _this.count = 0; + return _this; + } + + var _proto = TapRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_MANIPULATION]; + }; + + _proto.process = function process(input) { + var _this2 = this; + + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTouchTime = input.deltaTime < options.time; + this.reset(); + + if (input.eventType & INPUT_START && this.count === 0) { + return this.failTimeout(); + } // we only allow little movement + // and we've reached an end event, so a tap is possible + + + if (validMovement && validTouchTime && validPointers) { + if (input.eventType !== INPUT_END) { + return this.failTimeout(); + } + + var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true; + var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; + this.pTime = input.timeStamp; + this.pCenter = input.center; + + if (!validMultiTap || !validInterval) { + this.count = 1; + } else { + this.count += 1; + } + + this._input = input; // if tap count matches we have recognized it, + // else it has began recognizing... + + var tapCount = this.count % options.taps; + + if (tapCount === 0) { + // no failing requirements, immediately trigger the tap event + // or wait as long as the multitap interval to trigger + if (!this.hasRequireFailures()) { + return STATE_RECOGNIZED; + } else { + this._timer = setTimeout(function () { + _this2.state = STATE_RECOGNIZED; + + _this2.tryEmit(); + }, options.interval); + return STATE_BEGAN; + } + } + } + + return STATE_FAILED; + }; + + _proto.failTimeout = function failTimeout() { + var _this3 = this; + + this._timer = setTimeout(function () { + _this3.state = STATE_FAILED; + }, this.options.interval); + return STATE_FAILED; + }; + + _proto.reset = function reset() { + clearTimeout(this._timer); + }; + + _proto.emit = function emit() { + if (this.state === STATE_RECOGNIZED) { + this._input.tapCount = this.count; + this.manager.emit(this.options.event, this._input); + } + }; + + return TapRecognizer; + }(Recognizer); + + /** + * @private + * This recognizer is just used as a base for the simple attribute recognizers. + * @constructor + * @extends Recognizer + */ + + var AttrRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(AttrRecognizer, _Recognizer); + + function AttrRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _Recognizer.call(this, _extends$1({ + pointers: 1 + }, options)) || this; + } + /** + * @private + * Used to check if it the recognizer receives valid input, like input.distance > 10. + * @memberof AttrRecognizer + * @param {Object} input + * @returns {Boolean} recognized + */ + + + var _proto = AttrRecognizer.prototype; + + _proto.attrTest = function attrTest(input) { + var optionPointers = this.options.pointers; + return optionPointers === 0 || input.pointers.length === optionPointers; + }; + /** + * @private + * Process the input and return the state for the recognizer + * @memberof AttrRecognizer + * @param {Object} input + * @returns {*} State + */ + + + _proto.process = function process(input) { + var state = this.state; + var eventType = input.eventType; + var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); + var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED + + if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { + return state | STATE_CANCELLED; + } else if (isRecognized || isValid) { + if (eventType & INPUT_END) { + return state | STATE_ENDED; + } else if (!(state & STATE_BEGAN)) { + return STATE_BEGAN; + } + + return state | STATE_CHANGED; + } + + return STATE_FAILED; + }; + + return AttrRecognizer; + }(Recognizer); + + /** + * @private + * direction cons to string + * @param {constant} direction + * @returns {String} + */ + + function directionStr(direction) { + if (direction === DIRECTION_DOWN) { + return 'down'; + } else if (direction === DIRECTION_UP) { + return 'up'; + } else if (direction === DIRECTION_LEFT) { + return 'left'; + } else if (direction === DIRECTION_RIGHT) { + return 'right'; + } + + return ''; + } + + /** + * @private + * Pan + * Recognized when the pointer is down and moved in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ + + var PanRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(PanRecognizer, _AttrRecognizer); + + function PanRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _AttrRecognizer.call(this, _extends$1({ + event: 'pan', + threshold: 10, + pointers: 1, + direction: DIRECTION_ALL + }, options)) || this; + _this.pX = null; + _this.pY = null; + return _this; + } + + var _proto = PanRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + var direction = this.options.direction; + var actions = []; + + if (direction & DIRECTION_HORIZONTAL) { + actions.push(TOUCH_ACTION_PAN_Y); + } + + if (direction & DIRECTION_VERTICAL) { + actions.push(TOUCH_ACTION_PAN_X); + } + + return actions; + }; + + _proto.directionTest = function directionTest(input) { + var options = this.options; + var hasMoved = true; + var distance = input.distance; + var direction = input.direction; + var x = input.deltaX; + var y = input.deltaY; // lock to axis? + + if (!(direction & options.direction)) { + if (options.direction & DIRECTION_HORIZONTAL) { + direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + hasMoved = x !== this.pX; + distance = Math.abs(input.deltaX); + } else { + direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN; + hasMoved = y !== this.pY; + distance = Math.abs(input.deltaY); + } + } + + input.direction = direction; + return hasMoved && distance > options.threshold && direction & options.direction; + }; + + _proto.attrTest = function attrTest(input) { + return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call + this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input)); + }; + + _proto.emit = function emit(input) { + this.pX = input.deltaX; + this.pY = input.deltaY; + var direction = directionStr(input.direction); + + if (direction) { + input.additionalEvent = this.options.event + direction; + } + + _AttrRecognizer.prototype.emit.call(this, input); + }; + + return PanRecognizer; + }(AttrRecognizer); + + /** + * @private + * Swipe + * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ + + var SwipeRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(SwipeRecognizer, _AttrRecognizer); + + function SwipeRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'swipe', + threshold: 10, + velocity: 0.3, + direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, + pointers: 1 + }, options)) || this; + } + + var _proto = SwipeRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return PanRecognizer.prototype.getTouchAction.call(this); + }; + + _proto.attrTest = function attrTest(input) { + var direction = this.options.direction; + var velocity; + + if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { + velocity = input.overallVelocity; + } else if (direction & DIRECTION_HORIZONTAL) { + velocity = input.overallVelocityX; + } else if (direction & DIRECTION_VERTICAL) { + velocity = input.overallVelocityY; + } + + return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END; + }; + + _proto.emit = function emit(input) { + var direction = directionStr(input.offsetDirection); + + if (direction) { + this.manager.emit(this.options.event + direction, input); + } + + this.manager.emit(this.options.event, input); + }; + + return SwipeRecognizer; + }(AttrRecognizer); + + /** + * @private + * Pinch + * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). + * @constructor + * @extends AttrRecognizer + */ + + var PinchRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(PinchRecognizer, _AttrRecognizer); + + function PinchRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'pinch', + threshold: 0, + pointers: 2 + }, options)) || this; + } + + var _proto = PinchRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_NONE]; + }; + + _proto.attrTest = function attrTest(input) { + return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); + }; + + _proto.emit = function emit(input) { + if (input.scale !== 1) { + var inOut = input.scale < 1 ? 'in' : 'out'; + input.additionalEvent = this.options.event + inOut; + } + + _AttrRecognizer.prototype.emit.call(this, input); + }; + + return PinchRecognizer; + }(AttrRecognizer); + + /** + * @private + * Rotate + * Recognized when two or more pointer are moving in a circular motion. + * @constructor + * @extends AttrRecognizer + */ + + var RotateRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(RotateRecognizer, _AttrRecognizer); + + function RotateRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'rotate', + threshold: 0, + pointers: 2 + }, options)) || this; + } + + var _proto = RotateRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_NONE]; + }; + + _proto.attrTest = function attrTest(input) { + return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); + }; + + return RotateRecognizer; + }(AttrRecognizer); + + /** + * @private + * Press + * Recognized when the pointer is down for x ms without any movement. + * @constructor + * @extends Recognizer + */ + + var PressRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(PressRecognizer, _Recognizer); + + function PressRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Recognizer.call(this, _extends$1({ + event: 'press', + pointers: 1, + time: 251, + // minimal time of the pointer to be pressed + threshold: 9 + }, options)) || this; + _this._timer = null; + _this._input = null; + return _this; + } + + var _proto = PressRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_AUTO]; + }; + + _proto.process = function process(input) { + var _this2 = this; + + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTime = input.deltaTime > options.time; + this._input = input; // we only allow little movement + // and we've reached an end event, so a tap is possible + + if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) { + this.reset(); + } else if (input.eventType & INPUT_START) { + this.reset(); + this._timer = setTimeout(function () { + _this2.state = STATE_RECOGNIZED; + + _this2.tryEmit(); + }, options.time); + } else if (input.eventType & INPUT_END) { + return STATE_RECOGNIZED; + } + + return STATE_FAILED; + }; + + _proto.reset = function reset() { + clearTimeout(this._timer); + }; + + _proto.emit = function emit(input) { + if (this.state !== STATE_RECOGNIZED) { + return; + } + + if (input && input.eventType & INPUT_END) { + this.manager.emit(this.options.event + "up", input); + } else { + this._input.timeStamp = now(); + this.manager.emit(this.options.event, this._input); + } + }; + + return PressRecognizer; + }(Recognizer); + + var defaults = { + /** + * @private + * set if DOM events are being triggered. + * But this is slower and unused by simple implementations, so disabled by default. + * @type {Boolean} + * @default false + */ + domEvents: false, + + /** + * @private + * The value for the touchAction property/fallback. + * When set to `compute` it will magically set the correct value based on the added recognizers. + * @type {String} + * @default compute + */ + touchAction: TOUCH_ACTION_COMPUTE, + + /** + * @private + * @type {Boolean} + * @default true + */ + enable: true, + + /** + * @private + * EXPERIMENTAL FEATURE -- can be removed/changed + * Change the parent input target element. + * If Null, then it is being set the to main element. + * @type {Null|EventTarget} + * @default null + */ + inputTarget: null, + + /** + * @private + * force an input class + * @type {Null|Function} + * @default null + */ + inputClass: null, + + /** + * @private + * Some CSS properties can be used to improve the working of Hammer. + * Add them to this method and they will be set when creating a new Manager. + * @namespace + */ + cssProps: { + /** + * @private + * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userSelect: "none", + + /** + * @private + * Disable the Windows Phone grippers when pressing an element. + * @type {String} + * @default 'none' + */ + touchSelect: "none", + + /** + * @private + * Disables the default callout shown when you touch and hold a touch target. + * On iOS, when you touch and hold a touch target such as a link, Safari displays + * a callout containing information about the link. This property allows you to disable that callout. + * @type {String} + * @default 'none' + */ + touchCallout: "none", + + /** + * @private + * Specifies whether zooming is enabled. Used by IE10> + * @type {String} + * @default 'none' + */ + contentZooming: "none", + + /** + * @private + * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userDrag: "none", + + /** + * @private + * Overrides the highlight color shown when the user taps a link or a JavaScript + * clickable element in iOS. This property obeys the alpha value, if specified. + * @type {String} + * @default 'rgba(0,0,0,0)' + */ + tapHighlightColor: "rgba(0,0,0,0)" + } + }; + /** + * @private + * Default recognizer setup when calling `Hammer()` + * When creating a new Manager these will be skipped. + * This is separated with other defaults because of tree-shaking. + * @type {Array} + */ + + var preset = [[RotateRecognizer, { + enable: false + }], [PinchRecognizer, { + enable: false + }, ['rotate']], [SwipeRecognizer, { + direction: DIRECTION_HORIZONTAL + }], [PanRecognizer, { + direction: DIRECTION_HORIZONTAL + }, ['swipe']], [TapRecognizer], [TapRecognizer, { + event: 'doubletap', + taps: 2 + }, ['tap']], [PressRecognizer]]; + + var STOP = 1; + var FORCED_STOP = 2; + /** + * @private + * add/remove the css properties as defined in manager.options.cssProps + * @param {Manager} manager + * @param {Boolean} add + */ + + function toggleCssProps(manager, add) { + var element = manager.element; + + if (!element.style) { + return; + } + + var prop; + each(manager.options.cssProps, function (value, name) { + prop = prefixed(element.style, name); + + if (add) { + manager.oldCssProps[prop] = element.style[prop]; + element.style[prop] = value; + } else { + element.style[prop] = manager.oldCssProps[prop] || ""; + } + }); + + if (!add) { + manager.oldCssProps = {}; + } + } + /** + * @private + * trigger dom event + * @param {String} event + * @param {Object} data + */ + + + function triggerDomEvent(event, data) { + var gestureEvent = document.createEvent("Event"); + gestureEvent.initEvent(event, true, true); + gestureEvent.gesture = data; + data.target.dispatchEvent(gestureEvent); + } + /** + * @private + * Manager + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ + + + var Manager = + /*#__PURE__*/ + function () { + function Manager(element, options) { + var _this = this; + + this.options = assign$1({}, defaults, options || {}); + this.options.inputTarget = this.options.inputTarget || element; + this.handlers = {}; + this.session = {}; + this.recognizers = []; + this.oldCssProps = {}; + this.element = element; + this.input = createInputInstance(this); + this.touchAction = new TouchAction(this, this.options.touchAction); + toggleCssProps(this, true); + each(this.options.recognizers, function (item) { + var recognizer = _this.add(new item[0](item[1])); + + item[2] && recognizer.recognizeWith(item[2]); + item[3] && recognizer.requireFailure(item[3]); + }, this); + } + /** + * @private + * set options + * @param {Object} options + * @returns {Manager} + */ + + + var _proto = Manager.prototype; + + _proto.set = function set(options) { + assign$1(this.options, options); // Options that need a little more setup + + if (options.touchAction) { + this.touchAction.update(); + } + + if (options.inputTarget) { + // Clean up existing event listeners and reinitialize + this.input.destroy(); + this.input.target = options.inputTarget; + this.input.init(); + } + + return this; + }; + /** + * @private + * stop recognizing for this session. + * This session will be discarded, when a new [input]start event is fired. + * When forced, the recognizer cycle is stopped immediately. + * @param {Boolean} [force] + */ + + + _proto.stop = function stop(force) { + this.session.stopped = force ? FORCED_STOP : STOP; + }; + /** + * @private + * run the recognizers! + * called by the inputHandler function on every movement of the pointers (touches) + * it walks through all the recognizers and tries to detect the gesture that is being made + * @param {Object} inputData + */ + + + _proto.recognize = function recognize(inputData) { + var session = this.session; + + if (session.stopped) { + return; + } // run the touch-action polyfill + + + this.touchAction.preventDefaults(inputData); + var recognizer; + var recognizers = this.recognizers; // this holds the recognizer that is being recognized. + // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED + // if no recognizer is detecting a thing, it is set to `null` + + var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized + // or when we're in a new session + + if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) { + session.curRecognizer = null; + curRecognizer = null; + } + + var i = 0; + + while (i < recognizers.length) { + recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one. + // 1. allow if the session is NOT forced stopped (see the .stop() method) + // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one + // that is being recognized. + // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. + // this can be setup with the `recognizeWith()` method on the recognizer. + + if (session.stopped !== FORCED_STOP && ( // 1 + !curRecognizer || recognizer === curRecognizer || // 2 + recognizer.canRecognizeWith(curRecognizer))) { + // 3 + recognizer.recognize(inputData); + } else { + recognizer.reset(); + } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the + // current active recognizer. but only if we don't already have an active recognizer + + + if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { + session.curRecognizer = recognizer; + curRecognizer = recognizer; + } + + i++; + } + }; + /** + * @private + * get a recognizer by its event name. + * @param {Recognizer|String} recognizer + * @returns {Recognizer|Null} + */ + + + _proto.get = function get(recognizer) { + if (recognizer instanceof Recognizer) { + return recognizer; + } + + var recognizers = this.recognizers; + + for (var i = 0; i < recognizers.length; i++) { + if (recognizers[i].options.event === recognizer) { + return recognizers[i]; + } + } + + return null; + }; + /** + * @private add a recognizer to the manager + * existing recognizers with the same event name will be removed + * @param {Recognizer} recognizer + * @returns {Recognizer|Manager} + */ + + + _proto.add = function add(recognizer) { + if (invokeArrayArg(recognizer, "add", this)) { + return this; + } // remove existing + + + var existing = this.get(recognizer.options.event); + + if (existing) { + this.remove(existing); + } + + this.recognizers.push(recognizer); + recognizer.manager = this; + this.touchAction.update(); + return recognizer; + }; + /** + * @private + * remove a recognizer by name or instance + * @param {Recognizer|String} recognizer + * @returns {Manager} + */ + + + _proto.remove = function remove(recognizer) { + if (invokeArrayArg(recognizer, "remove", this)) { + return this; + } + + var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists + + if (recognizer) { + var recognizers = this.recognizers; + var index = inArray(recognizers, targetRecognizer); + + if (index !== -1) { + recognizers.splice(index, 1); + this.touchAction.update(); + } + } + + return this; + }; + /** + * @private + * bind event + * @param {String} events + * @param {Function} handler + * @returns {EventEmitter} this + */ + + + _proto.on = function on(events, handler) { + if (events === undefined || handler === undefined) { + return this; + } + + var handlers = this.handlers; + each(splitStr(events), function (event) { + handlers[event] = handlers[event] || []; + handlers[event].push(handler); + }); + return this; + }; + /** + * @private unbind event, leave emit blank to remove all handlers + * @param {String} events + * @param {Function} [handler] + * @returns {EventEmitter} this + */ + + + _proto.off = function off(events, handler) { + if (events === undefined) { + return this; + } + + var handlers = this.handlers; + each(splitStr(events), function (event) { + if (!handler) { + delete handlers[event]; + } else { + handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); + } + }); + return this; + }; + /** + * @private emit event to the listeners + * @param {String} event + * @param {Object} data + */ + + + _proto.emit = function emit(event, data) { + // we also want to trigger dom events + if (this.options.domEvents) { + triggerDomEvent(event, data); + } // no handlers, so skip it all + + + var handlers = this.handlers[event] && this.handlers[event].slice(); + + if (!handlers || !handlers.length) { + return; + } + + data.type = event; + + data.preventDefault = function () { + data.srcEvent.preventDefault(); + }; + + var i = 0; + + while (i < handlers.length) { + handlers[i](data); + i++; + } + }; + /** + * @private + * destroy the manager and unbinds all events + * it doesn't unbind dom events, that is the user own responsibility + */ + + + _proto.destroy = function destroy() { + this.element && toggleCssProps(this, false); + this.handlers = {}; + this.session = {}; + this.input.destroy(); + this.element = null; + }; + + return Manager; + }(); + + var SINGLE_TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL + }; + var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; + var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; + /** + * @private + * Touch events input + * @constructor + * @extends Input + */ + + var SingleTouchInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(SingleTouchInput, _Input); + + function SingleTouchInput() { + var _this; + + var proto = SingleTouchInput.prototype; + proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS; + proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.started = false; + return _this; + } + + var _proto = SingleTouchInput.prototype; + + _proto.handler = function handler(ev) { + var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events? + + if (type === INPUT_START) { + this.started = true; + } + + if (!this.started) { + return; + } + + var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state + + if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { + this.started = false; + } + + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + }; + + return SingleTouchInput; + }(Input); + + function normalizeSingleTouches(ev, type) { + var all = toArray(ev.touches); + var changed = toArray(ev.changedTouches); + + if (type & (INPUT_END | INPUT_CANCEL)) { + all = uniqueArray(all.concat(changed), 'identifier', true); + } + + return [all, changed]; + } + + /** + * @private + * wrap a method with a deprecation warning and stack trace + * @param {Function} method + * @param {String} name + * @param {String} message + * @returns {Function} A new function wrapping the supplied method. + */ + function deprecate(method, name, message) { + var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n"; + return function () { + var e = new Error('get-stack-trace'); + var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; + var log = window.console && (window.console.warn || window.console.log); + + if (log) { + log.call(window.console, deprecationMessage, stack); + } + + return method.apply(this, arguments); + }; + } + + /** + * @private + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} dest + * @param {Object} src + * @param {Boolean} [merge=false] + * @returns {Object} dest + */ + + var extend = deprecate(function (dest, src, merge) { + var keys = Object.keys(src); + var i = 0; + + while (i < keys.length) { + if (!merge || merge && dest[keys[i]] === undefined) { + dest[keys[i]] = src[keys[i]]; + } + + i++; + } + + return dest; + }, 'extend', 'Use `assign`.'); + + /** + * @private + * merge the values from src in the dest. + * means that properties that exist in dest will not be overwritten by src + * @param {Object} dest + * @param {Object} src + * @returns {Object} dest + */ + + var merge = deprecate(function (dest, src) { + return extend(dest, src, true); + }, 'merge', 'Use `assign`.'); + + /** + * @private + * simple class inheritance + * @param {Function} child + * @param {Function} base + * @param {Object} [properties] + */ + + function inherit(child, base, properties) { + var baseP = base.prototype; + var childP; + childP = child.prototype = Object.create(baseP); + childP.constructor = child; + childP._super = baseP; + + if (properties) { + assign$1(childP, properties); + } + } + + /** + * @private + * simple function bind + * @param {Function} fn + * @param {Object} context + * @returns {Function} + */ + function bindFn(fn, context) { + return function boundFn() { + return fn.apply(context, arguments); + }; + } + + /** + * @private + * Simple way to create a manager with a default set of recognizers. + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ + + var Hammer = + /*#__PURE__*/ + function () { + var Hammer = + /** + * @private + * @const {string} + */ + function Hammer(element, options) { + if (options === void 0) { + options = {}; + } + + return new Manager(element, _extends$1({ + recognizers: preset.concat() + }, options)); + }; + + Hammer.VERSION = "2.0.17-rc"; + Hammer.DIRECTION_ALL = DIRECTION_ALL; + Hammer.DIRECTION_DOWN = DIRECTION_DOWN; + Hammer.DIRECTION_LEFT = DIRECTION_LEFT; + Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT; + Hammer.DIRECTION_UP = DIRECTION_UP; + Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + Hammer.DIRECTION_NONE = DIRECTION_NONE; + Hammer.DIRECTION_DOWN = DIRECTION_DOWN; + Hammer.INPUT_START = INPUT_START; + Hammer.INPUT_MOVE = INPUT_MOVE; + Hammer.INPUT_END = INPUT_END; + Hammer.INPUT_CANCEL = INPUT_CANCEL; + Hammer.STATE_POSSIBLE = STATE_POSSIBLE; + Hammer.STATE_BEGAN = STATE_BEGAN; + Hammer.STATE_CHANGED = STATE_CHANGED; + Hammer.STATE_ENDED = STATE_ENDED; + Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED; + Hammer.STATE_CANCELLED = STATE_CANCELLED; + Hammer.STATE_FAILED = STATE_FAILED; + Hammer.Manager = Manager; + Hammer.Input = Input; + Hammer.TouchAction = TouchAction; + Hammer.TouchInput = TouchInput; + Hammer.MouseInput = MouseInput; + Hammer.PointerEventInput = PointerEventInput; + Hammer.TouchMouseInput = TouchMouseInput; + Hammer.SingleTouchInput = SingleTouchInput; + Hammer.Recognizer = Recognizer; + Hammer.AttrRecognizer = AttrRecognizer; + Hammer.Tap = TapRecognizer; + Hammer.Pan = PanRecognizer; + Hammer.Swipe = SwipeRecognizer; + Hammer.Pinch = PinchRecognizer; + Hammer.Rotate = RotateRecognizer; + Hammer.Press = PressRecognizer; + Hammer.on = addEventListeners; + Hammer.off = removeEventListeners; + Hammer.each = each; + Hammer.merge = merge; + Hammer.extend = extend; + Hammer.bindFn = bindFn; + Hammer.assign = assign$1; + Hammer.inherit = inherit; + Hammer.bindFn = bindFn; + Hammer.prefixed = prefixed; + Hammer.toArray = toArray; + Hammer.inArray = inArray; + Hammer.uniqueArray = uniqueArray; + Hammer.splitStr = splitStr; + Hammer.boolOrFn = boolOrFn; + Hammer.hasParent = hasParent; + Hammer.addEventListeners = addEventListeners; + Hammer.removeEventListeners = removeEventListeners; + Hammer.defaults = assign$1({}, defaults, { + preset: preset + }); + return Hammer; + }(); + + /* + 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$1(arr, callback) { + var length = arr.length; + + for (var i = 0; i < length; ++i) { + if (callback(arr[i], i)) { + return true; + } + } + + return false; + } + function find$1(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$1(agent) { + var userAgent = agent; + + if (typeof userAgent === "undefined") { + if (typeof navigator === "undefined" || !navigator) { + return ""; + } + + userAgent = navigator.userAgent || ""; + } + + return userAgent.toLowerCase(); + } + function execRegExp$1(pattern, text) { + try { + return new RegExp(pattern, "g").exec(text); + } catch (e) { + return null; + } + } + function hasUserAgentData$1() { + 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$1(versionTest, userAgent) { + var result = execRegExp$1("(" + versionTest + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", userAgent); + return result ? result[3] : ""; + } + function convertVersion$1(text) { + return text.replace(/_/g, "."); + } + function findPreset$1(presets, userAgent) { + var userPreset = null; + var version = "-1"; + some$1(presets, function (preset) { + var result = execRegExp$1("(" + 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$1(preset.versionTest.toLowerCase(), userAgent) || version; + } + + version = convertVersion$1(version); + return true; + }); + return { + preset: userPreset, + version: version + }; + } + function findBrand$1(brands, preset) { + return find$1(brands, function (_a) { + var brand = _a.brand; + return execRegExp$1("" + preset.test, brand.toLowerCase()); + }); + } + + var BROWSER_PRESETS$1 = [{ + 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$1 = [{ + 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$1 = [{ + test: "applewebkit", + id: "webkit" + }]; + var WEBVIEW_PRESETS$1 = [{ + test: "(?=(iphone|ipad))(?!(.*version))", + id: "webview" + }, { + test: "(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))", + id: "webview" + }, { + // test webview + test: "webview", + id: "webview" + }]; + var OS_PRESETS$1 = [{ + 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$1(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$1(WEBVIEW_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }), + chromium: some$1(CHROMIUM_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }) + }; + var os = { + name: "unknown", + version: "-1", + majorVersion: -1 + }; + browser.webkit = !browser.chromium && some$1(WEBKIT_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }); + + if (osData) { + var platform_1 = osData.platform.toLowerCase(); + var result = find$1(OS_PRESETS$1, function (preset) { + return new RegExp("" + preset.test, "g").exec(platform_1); + }); + os.name = result ? result.id : platform_1; + os.version = osData.platformVersion; + } + + some$1(BROWSER_PRESETS$1, function (preset) { + var result = findBrand$1(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$1(os.version); + browser.version = convertVersion$1(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$1(userAgent) { + var nextAgent = getUserAgent$1(userAgent); + var isMobile = !!/mobi/g.exec(nextAgent); + var browser = { + name: "unknown", + version: "-1", + majorVersion: -1, + webview: !!findPreset$1(WEBVIEW_PRESETS$1, nextAgent).preset, + chromium: !!findPreset$1(CHROMIUM_PRESETS$1, nextAgent).preset, + webkit: false + }; + var os = { + name: "unknown", + version: "-1", + majorVersion: -1 + }; + + var _a = findPreset$1(BROWSER_PRESETS$1, nextAgent), + browserPreset = _a.preset, + browserVersion = _a.version; + + var _b = findPreset$1(OS_PRESETS$1, nextAgent), + osPreset = _b.preset, + osVersion = _b.version; + + browser.webkit = !browser.chromium && !!findPreset$1(WEBKIT_PRESETS$1, 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$2(userAgent) { + if (typeof userAgent === "undefined" && hasUserAgentData$1()) { + return parseUserAgentData$1(); + } else { + return parseUserAgent$1(userAgent); + } + } + + /* + Copyright (c) 2017 NAVER Corp. + @egjs/axes project is licensed under the MIT license + + @egjs/axes JavaScript library + https://github.com/naver/egjs-axes + + @version 2.7.1 + */ + + /*! ***************************************************************************** + 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); + }; + + function getInsidePosition(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 + + function isOutside(pos, range) { + return pos < range[0] || pos > range[1]; + } + function getDuration(distance, deceleration) { + var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero + + return duration < 100 ? 0 : duration; + } + function isCircularable(destPos, range, circular) { + return circular[1] && destPos > range[1] || circular[0] && destPos < range[0]; + } + function getCirculatedPos(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; + } + + /* eslint-disable no-new-func, no-nested-ternary */ + var win$2; + + if (typeof window === "undefined") { + // window is undefined in node.js + win$2 = { + navigator: { + userAgent: "" + } + }; + } else { + win$2 = window; + } + + function toArray$1(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; + } + 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$1(dummy.childNodes); + } else { + // Selector + el = toArray$1(document.querySelectorAll(param)); + } + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } else if (param === win$2) { + // window + el = param; + } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) { + // HTMLElement, Document + el = param; + } else if ("jQuery" in win$2 && 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$2.requestAnimationFrame || win$2.webkitRequestAnimationFrame; + var caf = win$2.cancelAnimationFrame || win$2.webkitCancelAnimationFrame; + + if (raf && !caf) { + var keyInfo_1 = {}; + var oldraf_1 = raf; + + raf = function (callback) { + function wrapCallback(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$2.setTimeout(function () { + callback(win$2.performance && win$2.performance.now && win$2.performance.now() || new Date().getTime()); + }, 16); + }; + + caf = win$2.clearTimeout; + } + /** + * A polyfill for the window.requestAnimationFrame() method. + * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame + * @private + */ + + + function requestAnimationFrame(fp) { + return raf(fp); + } + /** + * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method. + * @param {Number} key − The ID value returned through a call to the requestAnimationFrame() method. requestAnimationFrame() 메서드가 반환한 아이디 값 + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame + * @private + */ + + function cancelAnimationFrame(key) { + caf(key); + } + function map(obj, callback) { + var tranformed = {}; + + for (var k in obj) { + k && (tranformed[k] = callback(obj[k], k)); + } + + return tranformed; + } + function filter(obj, callback) { + var filtered = {}; + + for (var k in obj) { + k && callback(obj[k], k) && (filtered[k] = obj[k]); + } + + return filtered; + } + function every(obj, callback) { + for (var k in obj) { + if (k && !callback(obj[k], k)) { + return false; + } + } + + return true; + } + function equal(target, base) { + return every(target, function (v, k) { + return v === base[k]; + }); + } + var roundNumFunc = {}; + function roundNumber(num, roundUnit) { + // Cache for performance + if (!roundNumFunc[roundUnit]) { + roundNumFunc[roundUnit] = getRoundFunc(roundUnit); + } + + return roundNumFunc[roundUnit](num); + } + function roundNumbers(num, roundUnit) { + if (!num || !roundUnit) { + return num; + } + + var isNumber = typeof roundUnit === "number"; + return map(num, function (value, key) { + return roundNumber(value, isNumber ? roundUnit : roundUnit[key]); + }); + } + function getDecimalPlace(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; + } + function inversePow(n) { + // replace Math.pow(10, -n) to solve floating point issue. + // eg. Math.pow(10, -4) => 0.00009999999999999999 + return 1 / Math.pow(10, n); + } + function getRoundFunc(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; + }; + } + + function minMax(value, min, max) { + return Math.max(Math.min(value, max), min); + } + + var AnimationManager = + /*#__PURE__*/ + function () { + function AnimationManager(_a) { + var options = _a.options, + itm = _a.itm, + em = _a.em, + axm = _a.axm; + this.options = options; + this.itm = itm; + this.em = em; + this.axm = axm; + 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 minMax(duration, this.options.minimumDuration, this.options.maximumDuration); + }; + + __proto.createAnimationParam = function (pos, duration, option) { + var depaPos = this.axm.get(); + var destPos = pos; + var inputEvent = option && option.event || null; + return { + depaPos: depaPos, + destPos: destPos, + duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration), + delta: this.axm.getDelta(depaPos, destPos), + inputEvent: inputEvent, + input: option && option.input || null, + isTrusted: !!inputEvent, + done: this.animationEnd + }; + }; + + __proto.grab = function (axes, option) { + if (this._animateParam && axes.length) { + var orgPos_1 = this.axm.get(axes); + var pos = this.axm.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.em.triggerChange(pos, false, orgPos_1, option, !!option); + } + + this._animateParam = null; + this._raf && cancelAnimationFrame(this._raf); + this._raf = null; + this.em.triggerAnimationEnd(!!(option && 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.axm.get(); + var destPos = this.axm.map(pos, function (v, opt) { + return Math.min(opt.range[1], Math.max(opt.range[0], v)); + }); + this.animateTo(destPos, this.getDuration(pos, destPos), option); + }; + + __proto.animationEnd = function () { + var beforeParam = this.getEventInfo(); + this._animateParam = null; // for Circular + + var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + }); + Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + })); + this.itm.setInterrupt(false); + this.em.triggerAnimationEnd(!!beforeParam); + + if (this.axm.isOutside()) { + this.restore(beforeParam); + } else { + this.finish(!!beforeParam); + } + }; + + __proto.finish = function (isTrusted) { + this._animateParam = null; + this.itm.setInterrupt(false); + this.em.triggerFinish(isTrusted); + }; + + __proto.animateLoop = function (param, complete) { + if (param.duration) { + this._animateParam = __assign({}, param); + var info_1 = this._animateParam; + var self_1 = this; + var destPos_1 = info_1.destPos; + var prevPos_1 = info_1.depaPos; + var prevEasingPer_1 = 0; + var directions_1 = map(prevPos_1, function (value, key) { + return value <= destPos_1[key] ? 1 : -1; + }); + var originalIntendedPos_1 = map(destPos_1, function (v) { + return v; + }); + var prevTime_1 = new Date().getTime(); + info_1.startTime = prevTime_1; + + (function loop() { + self_1._raf = null; + var currentTime = new Date().getTime(); + var ratio = (currentTime - info_1.startTime) / param.duration; + var easingPer = self_1.easing(ratio); + var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) { + var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved. + // Recalculate the remaining distance. + // Fix the bouncing phenomenon by changing the range. + + var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular); + + if (nextPos !== circulatedPos) { + // circular + var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]); + destPos_1[key] -= rangeOffset; + prevPos_1[key] -= rangeOffset; + } + + return circulatedPos; + }); + var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1); + prevPos_1 = toPos; + prevTime_1 = currentTime; + prevEasingPer_1 = easingPer; + + if (easingPer >= 1) { + destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1); + + if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) { + self_1.em.triggerChange(destPos_1, true, prevPos_1); + } + + complete(); + return; + } else if (isCanceled) { + self_1.finish(false); + } else { + // animationEnd + self_1._raf = requestAnimationFrame(loop); + } + })(); + } else { + this.em.triggerChange(param.destPos, true); + 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 + + + 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.axm.getAxisOptions(key); + minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val))); + } + + return minRoundUnit || roundUnit; + }; + + __proto.getUserControll = function (param) { + var userWish = param.setTo(); + userWish.destPos = this.axm.get(userWish.destPos); + userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration); + return userWish; + }; + + __proto.animateTo = function (destPos, duration, option) { + var _this = this; + + var param = this.createAnimationParam(destPos, duration, option); + + var depaPos = __assign({}, param.depaPos); + + var retTrigger = this.em.triggerAnimationStart(param); // to control + + var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true. + + if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + })) { + console.warn("You can't stop the 'animation' event when 'circular' is true."); + } + + if (retTrigger && !equal(userWish.destPos, depaPos)) { + var inputEvent = option && option.event || null; + this.animateLoop({ + depaPos: depaPos, + destPos: userWish.destPos, + duration: userWish.duration, + delta: this.axm.getDelta(depaPos, userWish.destPos), + isTrusted: !!inputEvent, + inputEvent: inputEvent, + input: option && option.input || null + }, function () { + return _this.animationEnd(); + }); + } + }; + + __proto.easing = function (p) { + return p > 1 ? 1 : this.options.easing(p); + }; + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + var axes = Object.keys(pos); + this.grab(axes); + var orgPos = this.axm.get(axes); + + if (equal(pos, orgPos)) { + return this; + } + + this.itm.setInterrupt(true); + var movedPos = filter(pos, function (v, k) { + return orgPos[k] !== v; + }); + + if (!Object.keys(movedPos).length) { + return this; + } + + movedPos = this.axm.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.em.triggerChange(movedPos); + this.finish(false); + } + + return this; + }; + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) { + return v + pos[k]; + }), duration); + }; + + return AnimationManager; + }(); + + 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 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 + * @name eg.Axes#hold + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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.triggerHold = function (pos, option) { + var roundPos = this.getRoundPos(pos).roundPos; + this.axes.trigger("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일 경우에 동작한다 + * @name set + * @function + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("change", function(event) { + * event.holding && event.set({x: 10}); + * }); + */ + + /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events. + * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다. + * @name setTo + * @function + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("animationStart", function(event) { + * event.setTo({x: 10}, 2000); + * }); + */ + + /** + * This event is fired when a user release an element on the screen of the device. + * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 + * @name eg.Axes#release + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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} 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 + * 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("release", param); + }; + /** + * This event is fired when coordinate changes. + * @ko 좌표가 변경됐을 때 발생하는 이벤트 + * @name eg.Axes#change + * @event + * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체 + * @property {Object.} pos The coordinate 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @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 + * 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, isAccurate, depaPos, option, holding) { + if (holding === void 0) { + holding = false; + } + + var am = this.am; + var axm = am.axm; + var eventInfo = am.getEventInfo(); + + var _a = this.getRoundPos(pos, depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + var moveTo = axm.moveTo(roundPos, roundDepa); + var inputEvent = option && option.event || eventInfo && eventInfo.event || null; + var param = { + pos: moveTo.pos, + delta: moveTo.delta, + holding: holding, + inputEvent: inputEvent, + isTrusted: !!inputEvent, + input: option && option.input || eventInfo && eventInfo.input || null, + set: inputEvent ? this.createUserControll(moveTo.pos) : function () {} + }; + var result = this.axes.trigger("change", param); + inputEvent && axm.set(param.set()["destPos"]); + return result; + }; + /** + * This event is fired when animation starts. + * @ko 에니메이션이 시작할 때 발생한다. + * @name eg.Axes#animationStart + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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); + return this.axes.trigger("animationStart", param); + }; + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생한다. + * @name eg.Axes#animationEnd + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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("animationEnd", { + isTrusted: isTrusted + }); + }; + /** + * This event is fired when all actions have been completed. + * @ko 에니메이션이 끝났을 때 발생한다. + * @name eg.Axes#finish + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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("finish", { + isTrusted: isTrusted + }); + }; + + __proto.createUserControll = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } // to controll + + + var userControl = { + destPos: __assign({}, pos), + duration: duration + }; + return function (toPos, userDuration) { + toPos && (userControl.destPos = __assign({}, toPos)); + userDuration !== undefined && (userControl.duration = userDuration); + return userControl; + }; + }; + + __proto.setAnimationManager = function (am) { + this.am = am; + }; + + __proto.destroy = function () { + this.axes.off(); + }; + + __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) + }; + }; + + 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) { + !this.options.interruptable && (this._prevented = prevented); + }; + + return InterruptManager; + }(); + + var AxisManager = + /*#__PURE__*/ + function () { + function AxisManager(axis, options) { + var _this = this; + + this.axis = axis; + this.options = options; + + this._complementOptions(); + + this._pos = Object.keys(this.axis).reduce(function (acc, v) { + acc[v] = _this.axis[v].range[0]; + return acc; + }, {}); + } + /** + * set up 'css' expression + * @private + */ + + + var __proto = AxisManager.prototype; + + __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]; + } + }); + }); + }; + + __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({}, 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]; + }; + + return AxisManager; + }(); + + var InputObserver = + /*#__PURE__*/ + function () { + function InputObserver(_a) { + var options = _a.options, + itm = _a.itm, + em = _a.em, + axm = _a.axm, + am = _a.am; + this.isOutside = false; + this.moveDistance = null; + this.isStopped = false; + this.options = options; + this.itm = itm; + this.em = em; + this.axm = axm; + this.am = am; + } // when move pointer is held in outside + + + var __proto = InputObserver.prototype; + + __proto.atOutside = function (pos) { + var _this = this; + + if (this.isOutside) { + return this.axm.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 { + // when start pointer is held in inside + // get a initialization slope value to prevent smooth animation. + var initSlope_1 = this.am.easing(0.00001) / 0.00001; + return this.axm.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.am.easing((min - v) / (out[0] * initSlope_1)) * out[0]; + } else if (v > max) { + // right + return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1]; + } + + return v; + }); + } + }; + + __proto.get = function (input) { + return this.axm.get(input.axes); + }; + + __proto.hold = function (input, event) { + if (this.itm.isInterrupted() || !input.axes.length) { + return; + } + + var changeOption = { + input: input, + event: event + }; + this.isStopped = false; + this.itm.setInterrupt(true); + this.am.grab(input.axes, changeOption); + !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption); + this.isOutside = this.axm.isOutside(input.axes); + this.moveDistance = this.axm.get(input.axes); + }; + + __proto.change = function (input, event, offset) { + if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) { + return v === 0; + })) { + return; + } + + var depaPos = this.moveDistance || this.axm.get(input.axes); + var destPos; // for outside logic + + destPos = map(depaPos, function (v, k) { + return v + (offset[k] || 0); + }); + this.moveDistance && (this.moveDistance = destPos); // from outside to inside + + if (this.isOutside && this.axm.every(depaPos, function (v, opt) { + return !isOutside(v, opt.range); + })) { + this.isOutside = false; + } + + depaPos = this.atOutside(depaPos); + destPos = this.atOutside(destPos); + var isCanceled = !this.em.triggerChange(destPos, false, depaPos, { + input: input, + event: event + }, true); + + if (isCanceled) { + this.isStopped = true; + this.moveDistance = null; + this.am.finish(false); + } + }; + + __proto.release = function (input, event, offset, inputDuration) { + if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) { + return; + } + + var pos = this.axm.get(input.axes); + var depaPos = this.axm.get(); + var destPos = this.axm.get(this.axm.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); + } + })); + var duration = this.am.getDuration(destPos, pos, inputDuration); + + if (duration === 0) { + destPos = __assign({}, depaPos); + } // prepare params + + + var param = { + depaPos: depaPos, + destPos: destPos, + duration: duration, + delta: this.axm.getDelta(depaPos, destPos), + inputEvent: event, + input: input, + isTrusted: true + }; + this.em.triggerRelease(param); + this.moveDistance = null; // to contol + + var userWish = this.am.getUserControll(param); + var isEqual = equal(userWish.destPos, depaPos); + var changeOption = { + input: input, + event: event + }; + + if (isEqual || userWish.duration === 0) { + !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true); + this.itm.setInterrupt(false); + + if (this.axm.isOutside()) { + this.am.restore(changeOption); + } else { + this.em.triggerFinish(true); + } + } else { + this.am.animateTo(userWish.destPos, userWish.duration, changeOption); + } + }; + + return InputObserver; + }(); + + // export const DIRECTION_NONE = 1; + var IOS_EDGE_THRESHOLD = 30; + var IS_IOS_SAFARI = "ontouchstart" in win$2 && agent$2().browser.name === "safari"; + var TRANSFORM$1 = 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 ""; + }(); + + /** + * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. + * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @property {Number[]} [range] The coordinate of range 좌표 범위 + * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표 + * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표 + * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다 + * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기 + * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기 + * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to "true" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다 + * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부 + * @property {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 모듈의 옵션 객체 + * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수 + * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간 + * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간 + * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다 + * @property {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가 적용되지 않는다
+ * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
+ **/ + + /** + * @class eg.Axes + * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions. + * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다. + * @extends eg.Component + * + * @param {Object.} 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] 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 + * + * // 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 = {}; + } + + var _this = _super.call(this) || this; + + _this.axis = axis; + _this._inputs = []; + _this.options = __assign({ + easing: function easeOutCubic(x) { + return 1 - Math.pow(1 - x, 3); + }, + interruptable: true, + maximumDuration: Infinity, + minimumDuration: 0, + deceleration: 0.0006, + round: null + }, options); + _this.itm = new InterruptManager(_this.options); + _this.axm = new AxisManager(_this.axis, _this.options); + _this.em = new EventManager(_this); + _this.am = new AnimationManager(_this); + _this.io = new InputObserver(_this); + + _this.em.setAnimationManager(_this.am); + + startPos && _this.em.triggerChange(startPos); + return _this; + } + /** + * Connect the axis of eg.Axes to the inputType. + * @ko eg.Axes의 축과 inputType을 연결한다 + * @method eg.Axes#connect + * @param {(String[]|String)} axes The name of the axis to associate with inputType 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 + * 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); + } // check same element in hammer type for share + + + if ("hammer" in inputType) { + var targets = this._inputs.filter(function (v) { + return v.hammer && v.element === inputType.element; + }); + + if (targets.length) { + inputType.hammer = targets[0].hammer; + } + } + + inputType.mapAxes(mapped); + inputType.connect(this.io); + + this._inputs.push(inputType); + + return this; + }; + /** + * Disconnect the axis of eg.Axes from the inputType. + * @ko eg.Axes의 축과 inputType의 연결을 끊는다. + * @method eg.Axes#disconnect + * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * } + * }); + * + * const input1 = new eg.Axes.PanInput("#area1"); + * const input2 = new eg.Axes.PanInput("#area2"); + * const input3 = new eg.Axes.PanInput("#area3"); + * + * axes.connect("x", input1); + * .connect("x xOther", input2) + * .connect(["xOther", "x"], input3); + * + * axes.disconnect(input1); // disconnects input1 + * axes.disconnect(); // disconnects all of them + */ + + + __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 좌표의 현재 위치를 반환한다 + * @method eg.Axes#get + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Object.} Axis coordinate information 축 좌표 정보 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }); + * + * axes.get(); // {"x": 0, "xOther": -100, "zoom": 50} + * axes.get(["x", "zoom"]); // {"x": 0, "zoom": 50} + */ + + + __proto.get = function (axes) { + return this.axm.get(axes); + }; + /** + * Moves an axis to specific coordinates. + * @ko 좌표를 이동한다. + * @method eg.Axes#setTo + * @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 + * 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.am.setTo(pos, duration); + return this; + }; + /** + * Moves an axis from the current coordinates to specific coordinates. + * @ko 현재 좌표를 기준으로 좌표를 이동한다. + * @method eg.Axes#setBy + * @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 + * 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.am.setBy(pos, duration); + return this; + }; + /** + * Returns whether there is a coordinate in the bounce area of ​​the target axis. + * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다 + * @method eg.Axes#isBounceArea + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }); + * + * axes.isBounceArea(["x"]); + * axes.isBounceArea(["x", "zoom"]); + * axes.isBounceArea(); + */ + + + __proto.isBounceArea = function (axes) { + return this.axm.isOutside(axes); + }; + /** + * Destroys properties, and events used in a module and disconnect all connections to inputTypes. + * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다. + * @method eg.Axes#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + this.em.destroy(); + }; + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.Axes.VERSION; // ex) 3.3.3 + * @memberof eg.Axes + */ + + + Axes.VERSION = "2.7.1"; + /** + * @name eg.Axes.TRANSFORM + * @desc Returns the transform attribute with CSS vendor prefixes. + * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다. + * + * @constant + * @type {String} + * @example + * eg.Axes.TRANSFORM; // "transform" or "webkitTransform" + */ + + Axes.TRANSFORM = TRANSFORM$1; + /** + * @name eg.Axes.DIRECTION_NONE + * @constant + * @type {Number} + */ + + Axes.DIRECTION_NONE = DIRECTION_NONE; + /** + * @name eg.Axes.DIRECTION_LEFT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_LEFT = DIRECTION_LEFT; + /** + * @name eg.Axes.DIRECTION_RIGHT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_RIGHT = DIRECTION_RIGHT; + /** + * @name eg.Axes.DIRECTION_UP + * @constant + * @type {Number} + */ + + Axes.DIRECTION_UP = DIRECTION_UP; + /** + * @name eg.Axes.DIRECTION_DOWN + * @constant + * @type {Number} + */ + + Axes.DIRECTION_DOWN = DIRECTION_DOWN; + /** + * @name eg.Axes.DIRECTION_HORIZONTAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + /** + * @name eg.Axes.DIRECTION_VERTICAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + /** + * @name eg.Axes.DIRECTION_ALL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_ALL = DIRECTION_ALL; + return Axes; + }(Component); + + var SUPPORT_POINTER_EVENTS$1 = "PointerEvent" in win$2 || "MSPointerEvent" in win$2; + var SUPPORT_TOUCH$2 = ("ontouchstart" in win$2); + var UNIQUEKEY = "_EGJS_AXES_INPUTTYPE_"; + function toAxis(source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + } + function createHammer(element, options) { + try { + // create Hammer + return new Manager(element, __assign({}, options)); + } catch (e) { + return null; + } + } + function convertInputType(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$2; + break; + + case "pointer": + hasPointer = SUPPORT_POINTER_EVENTS$1; + // no default + } + }); + + if (hasPointer) { + return PointerEventInput; + } else if (hasTouch && hasMouse) { + return TouchMouseInput; + } else if (hasTouch) { + return TouchInput; + } else if (hasMouse) { + return MouseInput; + } + + return null; + } + + function getDirectionByAngle(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; + } + function getNextOffset(speeds, deceleration) { + var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]); + var duration = Math.abs(normalSpeed / -deceleration); + return [speeds[0] / 2 * duration, speeds[1] / 2 * duration]; + } + function useDirection(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 모듈의 옵션 객체 + * @property {String[]} [inputType=["touch","mouse", "pointer"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
+ * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율 + * @property {Number} [scale.1=1] vertical axis scale 수직축 배율 + * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90) + * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리 + * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px) + * @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager Hammer.Manager의 옵션 + **/ + + /** + * @class eg.Axes.PanInput + * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes. + * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다. + * + * @example + * const pan = new eg.Axes.PanInput("#area", { + * inputType: ["touch"], + * scale: [1, 1.3], + * }); + * + * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. + * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. + * axes.connect(["something2", "somethingN"], pan); // or axes.connect("something2 somethingN", pan); + * + * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. + * axes.connect(["something1"], pan); // or axes.connect("something1", pan); + * + * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. + * axes.connect(["", "something2"], pan); // or axes.connect(" something2", pan); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module 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) { + this.axes = []; + this.hammer = null; + this.element = null; + this.panRecognizer = null; + this.isRightEdge = false; + this.rightEdgeTimer = 0; + this.panFlag = false; + /** + * Hammer helps you add support for touch gestures to your page + * + * @external Hammer + * @see {@link http://hammerjs.github.io|Hammer.JS} + * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents} + * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS + */ + + if (typeof Manager === "undefined") { + throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/"); + } + + this.element = $(el); + this.options = __assign({ + inputType: ["touch", "mouse", "pointer"], + scale: [1, 1], + thresholdAngle: 45, + threshold: 0, + iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD, + hammerManagerOptions: { + // css properties were removed due to usablility issue + // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html + cssProps: { + userSelect: "none", + touchSelect: "none", + touchCallout: "none", + userDrag: "none" + } + } + }, options); + this.onHammerInput = this.onHammerInput.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) { + var hammerOption = { + direction: this._direction, + threshold: this.options.threshold + }; + + if (this.hammer) { + // for sharing hammer instance. + // hammer remove previous PanRecognizer. + this.removeRecognizer(); + this.dettachEvent(); + } else { + var keyValue = this.element[UNIQUEKEY]; + + if (!keyValue) { + keyValue = String(Math.round(Math.random() * new Date().getTime())); + } + + var inputClass = convertInputType(this.options.inputType); + + if (!inputClass) { + throw new Error("Wrong inputType parameter!"); + } + + this.hammer = createHammer(this.element, __assign({ + inputClass: inputClass + }, this.options.hammerManagerOptions)); + this.element[UNIQUEKEY] = keyValue; + } + + this.panRecognizer = new PanRecognizer(hammerOption); + this.hammer.add(this.panRecognizer); + this.attachEvent(observer); + return this; + }; + + __proto.disconnect = function () { + this.removeRecognizer(); + + if (this.hammer) { + this.dettachEvent(); + } + + this._direction = DIRECTION_NONE; + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.PanInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + + if (this.hammer && this.hammer.recognizers.length === 0) { + this.hammer.destroy(); + } + + delete this.element[UNIQUEKEY]; + this.element = null; + this.hammer = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.PanInput#enable + * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this.hammer && (this.hammer.get("pan").options.enable = true); + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.PanInput#disable + * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this.hammer && (this.hammer.get("pan").options.enable = false); + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.PanInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return !!(this.hammer && this.hammer.get("pan").options.enable); + }; + + __proto.removeRecognizer = function () { + if (this.hammer && this.panRecognizer) { + this.hammer.remove(this.panRecognizer); + this.panRecognizer = null; + } + }; + + __proto.onHammerInput = function (event) { + if (this.isEnable()) { + if (event.isFirst) { + this.panFlag = false; + + if (event.srcEvent.cancelable !== false) { + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + this.observer.hold(this, event); + this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold; + this.panFlag = true; + } + } else if (event.isFinal) { + this.onPanend(event); + } + } + }; + + __proto.onPanmove = function (event) { + var _this = this; + + if (!this.panFlag) { + return; + } + + var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start + + var prevInput = this.hammer.session.prevInput; + + if (prevInput && IS_IOS_SAFARI) { + var swipeLeftToRight = event.center.x < 0; + + if (swipeLeftToRight) { + // iOS swipe left => right + this.onPanend(__assign({}, prevInput, { + velocityX: 0, + velocityY: 0, + offsetX: 0, + offsetY: 0 + })); + return; + } else if (this.isRightEdge) { + clearTimeout(this.rightEdgeTimer); // - is right to left + + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + var swipeRightToLeft = event.deltaX < -edgeThreshold; + + if (swipeRightToLeft) { + this.isRightEdge = false; + } else { + // iOS swipe right => left + this.rightEdgeTimer = window.setTimeout(function () { + _this.onPanend(__assign({}, prevInput, { + velocityX: 0, + velocityY: 0, + offsetX: 0, + offsetY: 0 + })); + }, 100); + } + } + } + /* eslint-disable no-param-reassign */ + + + if (prevInput) { + event.offsetX = event.deltaX - prevInput.deltaX; + event.offsetY = event.deltaY - prevInput.deltaY; + } else { + event.offsetX = 0; + event.offsetY = 0; + } + + var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]); + var prevent = offset.some(function (v) { + return v !== 0; + }); + + if (prevent) { + var srcEvent = event.srcEvent; + + if (srcEvent.cancelable !== false) { + srcEvent.preventDefault(); + } + + srcEvent.stopPropagation(); + } + + event.preventSystemEvent = prevent; + prevent && this.observer.change(this, event, toAxis(this.axes, offset)); + }; + + __proto.onPanend = function (event) { + if (!this.panFlag) { + return; + } + + clearTimeout(this.rightEdgeTimer); + this.panFlag = false; + var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]); + offset = getNextOffset(offset, this.observer.options.deceleration); + this.observer.release(this, event, toAxis(this.axes, offset)); + }; + + __proto.attachEvent = function (observer) { + this.observer = observer; + this.hammer.on("hammer.input", this.onHammerInput).on("panstart panmove", this.onPanmove); + }; + + __proto.dettachEvent = function () { + this.hammer.off("hammer.input", this.onHammerInput).off("panstart panmove", this.onPanmove); + this.observer = null; + }; + + __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; + }; + + return PanInput; + }(); + + /** + * @class eg.Axes.RotatePanInput + * @classdesc 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 + * 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 eg.Axes.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.onHammerInput = function (event) { + if (this.isEnable()) { + if (event.isFirst) { + this.observer.hold(this, event); + this.onPanstart(event); + } else if (event.isFinal) { + this.onPanend(event); + } + } + }; + + __proto.onPanstart = function (event) { + var rect = this.element.getBoundingClientRect(); + /** + * Responsive + */ + // TODO: how to do if element is ellipse not circle. + + this.coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360 + // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin + + this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle. + + this.prevAngle = null; + this.triggerChange(event); + }; + + __proto.onPanmove = function (event) { + this.triggerChange(event); + }; + + __proto.onPanend = function (event) { + this.triggerChange(event); + this.triggerAnimation(event); + }; + + __proto.triggerChange = function (event) { + var angle = this.getAngle(event.center.x, event.center.y); + var quadrant = this.getQuadrant(event.center.x, event.center.y); + var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant); + this.prevAngle = angle; + this.prevQuadrant = quadrant; + + if (diff === 0) { + return; + } + + this.lastDiff = diff; + this.observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise + }; + + __proto.triggerAnimation = function (event) { + var vx = event.velocityX; + var vy = event.velocityY; + var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise + + var duration = Math.abs(velocity / -this.observer.options.deceleration); + var distance = velocity / 2 * duration; + this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle])); + }; + + __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.getAngle = function (posX, posY) { + var _a = this.getPosFromOrigin(posX, posY), + x = _a.x, + y = _a.y; + + var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y); + + return angle < 0 ? 360 + angle : angle; + }; + /** + * Quadrant + * y(+) + * | + * 2 | 1 + * --------------->x(+) + * 3 | 4 + * | + */ + + + __proto.getQuadrant = function (posX, posY) { + 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 모듈의 옵션 객체 + * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @property {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율 + * @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager Hammer.Manager의 옵션 + **/ + + /** + * @class eg.Axes.PinchInput + * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis. + * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. + * @example + * const pinch = new eg.Axes.PinchInput("#area", { + * scale: 1 + * }); + * + * // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). + * axes.connect("something", pinch); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module 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.hammer = null; + this.element = null; + this._base = null; + this._prev = null; + this.pinchRecognizer = null; + /** + * Hammer helps you add support for touch gestures to your page + * + * @external Hammer + * @see {@link http://hammerjs.github.io|Hammer.JS} + * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents} + * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS + */ + + if (typeof Manager === "undefined") { + throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/"); + } + + this.element = $(el); + this.options = __assign({ + scale: 1, + threshold: 0, + inputType: ["touch", "pointer"], + hammerManagerOptions: { + // css properties were removed due to usablility issue + // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html + cssProps: { + userSelect: "none", + touchSelect: "none", + touchCallout: "none", + userDrag: "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) { + var hammerOption = { + threshold: this.options.threshold + }; + + if (this.hammer) { + // for sharing hammer instance. + // hammer remove previous PinchRecognizer. + this.removeRecognizer(); + this.dettachEvent(); + } else { + var keyValue = this.element[UNIQUEKEY]; + + if (!keyValue) { + keyValue = String(Math.round(Math.random() * new Date().getTime())); + } + + var inputClass = convertInputType(this.options.inputType); + + if (!inputClass) { + throw new Error("Wrong inputType parameter!"); + } + + this.hammer = createHammer(this.element, __assign({ + inputClass: inputClass + }, this.options.hammerManagerOptions)); + this.element[UNIQUEKEY] = keyValue; + } + + this.pinchRecognizer = new PinchRecognizer(hammerOption); + this.hammer.add(this.pinchRecognizer); + this.attachEvent(observer); + return this; + }; + + __proto.disconnect = function () { + this.removeRecognizer(); + + if (this.hammer) { + this.hammer.remove(this.pinchRecognizer); + this.pinchRecognizer = null; + this.dettachEvent(); + } + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.PinchInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + + if (this.hammer && this.hammer.recognizers.length === 0) { + this.hammer.destroy(); + } + + delete this.element[UNIQUEKEY]; + this.element = null; + this.hammer = null; + }; + + __proto.removeRecognizer = function () { + if (this.hammer && this.pinchRecognizer) { + this.hammer.remove(this.pinchRecognizer); + this.pinchRecognizer = null; + } + }; + + __proto.onPinchStart = function (event) { + this._base = this.observer.get(this)[this.axes[0]]; + var offset = this.getOffset(event.scale); + this.observer.hold(this, event); + this.observer.change(this, event, toAxis(this.axes, [offset])); + this._prev = event.scale; + }; + + __proto.onPinchMove = function (event) { + var offset = this.getOffset(event.scale, this._prev); + this.observer.change(this, event, toAxis(this.axes, [offset])); + this._prev = event.scale; + }; + + __proto.onPinchEnd = function (event) { + var offset = this.getOffset(event.scale, this._prev); + this.observer.change(this, event, toAxis(this.axes, [offset])); + this.observer.release(this, event, toAxis(this.axes, [0]), 0); + this._base = null; + this._prev = null; + }; + + __proto.getOffset = function (pinchScale, prev) { + if (prev === void 0) { + prev = 1; + } + + return this._base * (pinchScale - prev) * this.options.scale; + }; + + __proto.attachEvent = function (observer) { + this.observer = observer; + this.hammer.on("pinchstart", this.onPinchStart).on("pinchmove", this.onPinchMove).on("pinchend", this.onPinchEnd); + }; + + __proto.dettachEvent = function () { + this.hammer.off("pinchstart", this.onPinchStart).off("pinchmove", this.onPinchMove).off("pinchend", this.onPinchEnd); + this.observer = null; + this._prev = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.PinchInput#enable + * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this.hammer && (this.hammer.get("pinch").options.enable = true); + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.PinchInput#disable + * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this.hammer && (this.hammer.get("pinch").options.enable = false); + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.PinchInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return !!(this.hammer && this.hammer.get("pinch").options.enable); + }; + + return PinchInput; + }(); + + /** + * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module + * @ko eg.Axes.WheelInput 모듈의 옵션 객체 + * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + **/ + + /** + * @class eg.Axes.WheelInput + * @classdesc A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis. + * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. + * + * @example + * const wheel = new eg.Axes.WheelInput("#area", { + * scale: 1 + * }); + * + * // Connect 'something' axis when the mousewheel is moved. + * axes.connect("something", wheel); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module 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._isEnabled = false; + this._isHolded = false; + this._timer = null; + this.element = $(el); + this.options = __assign({ + scale: 1, + useNormalized: true + }, options); + this.onWheel = this.onWheel.bind(this); + } + + var __proto = WheelInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + this.dettachEvent(); + this.attachEvent(observer); + return this; + }; + + __proto.disconnect = function () { + this.dettachEvent(); + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.WheelInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + + __proto.onWheel = function (event) { + var _this = this; + + if (!this._isEnabled) { + return; + } + + event.preventDefault(); + + if (event.deltaY === 0) { + return; + } + + if (!this._isHolded) { + this.observer.hold(this, event); + this._isHolded = 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])); + clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (_this._isHolded) { + _this._isHolded = false; + + _this.observer.release(_this, event, toAxis(_this.axes, [0])); + } + }, 50); + }; + + __proto.attachEvent = function (observer) { + this.observer = observer; + this.element.addEventListener("wheel", this.onWheel); + this._isEnabled = true; + }; + + __proto.dettachEvent = function () { + this.element.removeEventListener("wheel", this.onWheel); + this._isEnabled = false; + this.observer = null; + + if (this._timer) { + clearTimeout(this._timer); + this._timer = null; + } + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.WheelInput#enable + * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._isEnabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.WheelInput#disable + * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._isEnabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.WheelInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return this._isEnabled; + }; + + 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; + 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 모듈의 옵션 객체 + * @property {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @property {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율 + * @property {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율 + **/ + + /** + * @class eg.Axes.MoveKeyInput + * @classdesc A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis. + * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다. + * + * @example + * const moveKey = new eg.Axes.MoveKeyInput("#area", { + * scale: [1, 1] + * }); + * + * // Connect 'x', 'y' axes when the moveKey is pressed. + * axes.connect(["x", "y"], moveKey); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module 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._isEnabled = false; + this._isHolded = 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.dettachEvent(); // 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.dettachEvent(); + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.MoveKeyInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + + __proto.onKeydown = function (e) { + if (!this._isEnabled) { + return; + } + + var isMoveKey = true; + var direction = DIRECTION_FORWARD; + var move = DIRECTION_HORIZONTAL$1; + + switch (e.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; + } + + var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction]; + + if (!this._isHolded) { + this.observer.hold(this, event); + this._isHolded = true; + } + + clearTimeout(this._timer); + this.observer.change(this, event, toAxis(this.axes, offsets)); + }; + + __proto.onKeyup = function (e) { + var _this = this; + + if (!this._isHolded) { + return; + } + + clearTimeout(this._timer); + this._timer = setTimeout(function () { + _this.observer.release(_this, e, toAxis(_this.axes, [0, 0])); + + _this._isHolded = 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._isEnabled = true; + }; + + __proto.dettachEvent = function () { + this.element.removeEventListener("keydown", this.onKeydown, false); + this.element.removeEventListener("keypress", this.onKeydown, false); + this.element.removeEventListener("keyup", this.onKeyup, false); + this._isEnabled = false; + this.observer = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.MoveKeyInput#enable + * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._isEnabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.MoveKeyInput#disable + * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._isEnabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.MoveKeyInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return this._isEnabled; + }; + + return MoveKeyInput; + }(); + + /** + * Original Code + * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js + * Math Util + * modified by egjs + */ + + function quatToVec3(quaternion) { + var baseV = fromValues$4(0, 0, 1); + transformQuat(baseV, baseV, quaternion); + return baseV; + } + + function toDegree(a) { + return a * 180 / Math.PI; + } + + var util = {}; + + util.isPowerOfTwo = function (n) { + return n && (n & n - 1) === 0; + }; + + util.extractPitchFromQuat = function (quaternion) { + var baseV = quatToVec3(quaternion); + return -1 * Math.atan2(baseV[1], Math.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2))); + }; + + util.hypot = Math.hypot || function (x, y) { + return Math.sqrt(x * x + y * y); + }; // implement reference + // the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식 + // calculating angle between two vectors : http://darkpgmr.tistory.com/121 + + + var ROTATE_CONSTANT = { + PITCH_DELTA: 1, + YAW_DELTA_BY_ROLL: 2, + YAW_DELTA_BY_YAW: 3 + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = { + targetAxis: [0, 1, 0], + meshPoint: [0, 0, 1] + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = { + targetAxis: [0, 1, 0], + meshPoint: [1, 0, 0] + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = { + targetAxis: [1, 0, 0], + meshPoint: [0, 0, 1] + }; + + function getRotationDelta(prevQ, curQ, rotateKind) { + var targetAxis = fromValues$4(ROTATE_CONSTANT[rotateKind].targetAxis[0], ROTATE_CONSTANT[rotateKind].targetAxis[1], ROTATE_CONSTANT[rotateKind].targetAxis[2]); + var meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint; + var prevQuaternion = clone$6(prevQ); + var curQuaternion = clone$6(curQ); + normalize$2(prevQuaternion, prevQuaternion); + normalize$2(curQuaternion, curQuaternion); + var prevPoint = fromValues$4(0, 0, 1); + var curPoint = fromValues$4(0, 0, 1); + transformQuat(prevPoint, prevPoint, prevQuaternion); + transformQuat(curPoint, curPoint, curQuaternion); + transformQuat(targetAxis, targetAxis, curQuaternion); + var rotateDistance = dot(targetAxis, cross(create$4(), prevPoint, curPoint)); + var rotateDirection = rotateDistance > 0 ? 1 : -1; // when counter clock wise, use vec3.fromValues(0,1,0) + // when clock wise, use vec3.fromValues(0,-1,0) + // const meshPoint1 = vec3.fromValues(0, 0, 0); + + var meshPoint2 = fromValues$4(meshPoint[0], meshPoint[1], meshPoint[2]); + var meshPoint3; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + meshPoint3 = fromValues$4(0, rotateDirection, 0); + } else { + meshPoint3 = fromValues$4(rotateDirection, 0, 0); + } + + transformQuat(meshPoint2, meshPoint2, curQuaternion); + transformQuat(meshPoint3, meshPoint3, curQuaternion); + var vecU = meshPoint2; + var vecV = meshPoint3; + var vecN = create$4(); + cross(vecN, vecU, vecV); + normalize(vecN, vecN); + var coefficientA = vecN[0]; + var coefficientB = vecN[1]; + var coefficientC = vecN[2]; // const coefficientD = -1 * vec3.dot(vecN, meshPoint1); + // a point on the plane + + curPoint = fromValues$4(meshPoint[0], meshPoint[1], meshPoint[2]); + transformQuat(curPoint, curPoint, curQuaternion); // a point should project on the plane + + prevPoint = fromValues$4(meshPoint[0], meshPoint[1], meshPoint[2]); + transformQuat(prevPoint, prevPoint, prevQuaternion); // distance between prevPoint and the plane + + var distance$$1 = Math.abs(prevPoint[0] * coefficientA + prevPoint[1] * coefficientB + prevPoint[2] * coefficientC); + var projectedPrevPoint = create$4(); + subtract$4(projectedPrevPoint, prevPoint, scale$4(create$4(), vecN, distance$$1)); + var trigonometricRatio = (projectedPrevPoint[0] * curPoint[0] + projectedPrevPoint[1] * curPoint[1] + projectedPrevPoint[2] * curPoint[2]) / (length(projectedPrevPoint) * length(curPoint)); // defensive block + + trigonometricRatio > 1 && (trigonometricRatio = 1); + var theta = Math.acos(trigonometricRatio); + var crossVec = cross(create$4(), curPoint, projectedPrevPoint); + distance$$1 = coefficientA * crossVec[0] + coefficientB * crossVec[1] + coefficientC * crossVec[2]; + var thetaDirection; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + thetaDirection = distance$$1 > 0 ? 1 : -1; + } else { + thetaDirection = distance$$1 < 0 ? 1 : -1; + } + + var deltaRadian = theta * thetaDirection * rotateDirection; + return toDegree(deltaRadian); + } + + function angleBetweenVec2(v1, v2) { + var det = v1[0] * v2[1] - v2[0] * v1[1]; + var theta = -Math.atan2(det, dot$4(v1, v2)); + return theta; + } + + util.yawOffsetBetween = function (viewDir, targetDir) { + var viewDirXZ = fromValues$8(viewDir[0], viewDir[2]); + var targetDirXZ = fromValues$8(targetDir[0], targetDir[2]); + normalize$4(viewDirXZ, viewDirXZ); + normalize$4(targetDirXZ, targetDirXZ); + var theta = -angleBetweenVec2(viewDirXZ, targetDirXZ); + return theta; + }; + + util.toDegree = toDegree; + util.getRotationDelta = getRotationDelta; + util.angleBetweenVec2 = angleBetweenVec2; + + function toAxis$1(source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + } + + /* + * Copyright 2016 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + var MathUtil = window.MathUtil || {}; + + MathUtil.degToRad = Math.PI / 180; + MathUtil.radToDeg = 180 / Math.PI; + + // Some minimal math functionality borrowed from THREE.Math and stripped down + // for the purposes of this library. + + + MathUtil.Vector2 = function ( x, y ) { + this.x = x || 0; + this.y = y || 0; + }; + + MathUtil.Vector2.prototype = { + constructor: MathUtil.Vector2, + + set: function ( x, y ) { + this.x = x; + this.y = y; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + + return this; + }, + + subVectors: function ( a, b ) { + this.x = a.x - b.x; + this.y = a.y - b.y; + + return this; + }, + }; + + MathUtil.Vector3 = function ( x, y, z ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + }; + + MathUtil.Vector3.prototype = { + constructor: MathUtil.Vector3, + + set: function ( x, y, z ) { + this.x = x; + this.y = y; + this.z = z; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + + return this; + }, + + length: function () { + return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); + }, + + normalize: function () { + var scalar = this.length(); + + if ( scalar !== 0 ) { + var invScalar = 1 / scalar; + + this.multiplyScalar(invScalar); + } else { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + multiplyScalar: function ( scalar ) { + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; + }, + + applyQuaternion: function ( q ) { + var x = this.x; + var y = this.y; + var z = this.z; + + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + + // calculate quat * vector + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = - qx * x - qy * y - qz * z; + + // calculate result * inverse quat + this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; + this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; + this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; + + return this; + }, + + dot: function ( v ) { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + crossVectors: function ( a, b ) { + var ax = a.x, ay = a.y, az = a.z; + var bx = b.x, by = b.y, bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + }; + + MathUtil.Quaternion = function ( x, y, z, w ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = ( w !== undefined ) ? w : 1; + }; + + MathUtil.Quaternion.prototype = { + constructor: MathUtil.Quaternion, + + set: function ( x, y, z, w ) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + + return this; + }, + + copy: function ( quaternion ) { + this.x = quaternion.x; + this.y = quaternion.y; + this.z = quaternion.z; + this.w = quaternion.w; + + return this; + }, + + setFromEulerXYZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 + s1 * s2 * c3; + this.w = c1 * c2 * c3 - s1 * s2 * s3; + + return this; + }, + + setFromEulerYXZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 - s1 * s2 * c3; + this.w = c1 * c2 * c3 + s1 * s2 * s3; + + return this; + }, + + setFromAxisAngle: function ( axis, angle ) { + // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm + // assumes axis is normalized + + var halfAngle = angle / 2, s = Math.sin( halfAngle ); + + this.x = axis.x * s; + this.y = axis.y * s; + this.z = axis.z * s; + this.w = Math.cos( halfAngle ); + + return this; + }, + + multiply: function ( q ) { + return this.multiplyQuaternions( this, q ); + }, + + multiplyQuaternions: function ( a, b ) { + // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm + + var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w; + var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w; + + this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; + this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; + this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; + this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; + + return this; + }, + + inverse: function () { + this.x *= -1; + this.y *= -1; + this.z *= -1; + + this.normalize(); + + return this; + }, + + normalize: function () { + var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); + + if ( l === 0 ) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } else { + l = 1 / l; + + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + + return this; + }, + + slerp: function ( qb, t ) { + if ( t === 0 ) return this; + if ( t === 1 ) return this.copy( qb ); + + var x = this.x, y = this.y, z = this.z, w = this.w; + + // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + + var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z; + + if ( cosHalfTheta < 0 ) { + this.w = - qb.w; + this.x = - qb.x; + this.y = - qb.y; + this.z = - qb.z; + + cosHalfTheta = - cosHalfTheta; + } else { + this.copy( qb ); + } + + if ( cosHalfTheta >= 1.0 ) { + this.w = w; + this.x = x; + this.y = y; + this.z = z; + + return this; + } + + var halfTheta = Math.acos( cosHalfTheta ); + var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); + + if ( Math.abs( sinHalfTheta ) < 0.001 ) { + this.w = 0.5 * ( w + this.w ); + this.x = 0.5 * ( x + this.x ); + this.y = 0.5 * ( y + this.y ); + this.z = 0.5 * ( z + this.z ); + + return this; + } + + var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, + ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; + + this.w = ( w * ratioA + this.w * ratioB ); + this.x = ( x * ratioA + this.x * ratioB ); + this.y = ( y * ratioA + this.y * ratioB ); + this.z = ( z * ratioA + this.z * ratioB ); + + return this; + }, + + setFromUnitVectors: function () { + // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final + // assumes direction vectors vFrom and vTo are normalized + + var v1, r; + var EPS = 0.000001; + + return function ( vFrom, vTo ) { + if ( v1 === undefined ) v1 = new MathUtil.Vector3(); + + r = vFrom.dot( vTo ) + 1; + + if ( r < EPS ) { + r = 0; + + if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { + v1.set( - vFrom.y, vFrom.x, 0 ); + } else { + v1.set( 0, - vFrom.z, vFrom.y ); + } + } else { + v1.crossVectors( vFrom, vTo ); + } + + this.x = v1.x; + this.y = v1.y; + this.z = v1.z; + this.w = r; + + this.normalize(); + + return this; + } + }(), + }; + + var mathUtil = MathUtil; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + var Util = window.Util || {}; + + Util.MIN_TIMESTEP = 0.001; + Util.MAX_TIMESTEP = 1; + + Util.base64 = function(mimeType, base64) { + return 'data:' + mimeType + ';base64,' + base64; + }; + + Util.clamp = function(value, min, max) { + return Math.min(Math.max(min, value), max); + }; + + Util.lerp = function(a, b, t) { + return a + ((b - a) * t); + }; + + /** + * Light polyfill for `Promise.race`. Returns + * a promise that resolves when the first promise + * provided resolves. + * + * @param {Array} promises + */ + Util.race = function(promises) { + if (Promise.race) { + return Promise.race(promises); + } + + return new Promise(function (resolve, reject) { + for (var i = 0; i < promises.length; i++) { + promises[i].then(resolve, reject); + } + }); + }; + + Util.isIOS = (function() { + var isIOS = /iPad|iPhone|iPod/.test(navigator.platform); + return function() { + return isIOS; + }; + })(); + + Util.isWebViewAndroid = (function() { + var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 && + navigator.userAgent.indexOf('Android') !== -1 && + navigator.userAgent.indexOf('Chrome') !== -1; + return function() { + return isWebViewAndroid; + }; + })(); + + Util.isSafari = (function() { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + return function() { + return isSafari; + }; + })(); + + Util.isFirefoxAndroid = (function() { + var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 && + navigator.userAgent.indexOf('Android') !== -1; + return function() { + return isFirefoxAndroid; + }; + })(); + + Util.isR7 = (function() { + var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1; + return function() { + return isR7; + }; + })(); + + Util.isLandscapeMode = function() { + var rtn = (window.orientation == 90 || window.orientation == -90); + return Util.isR7() ? !rtn : rtn; + }; + + // Helper method to validate the time steps of sensor timestamps. + Util.isTimestampDeltaValid = function(timestampDeltaS) { + if (isNaN(timestampDeltaS)) { + return false; + } + if (timestampDeltaS <= Util.MIN_TIMESTEP) { + return false; + } + if (timestampDeltaS > Util.MAX_TIMESTEP) { + return false; + } + return true; + }; + + Util.getScreenWidth = function() { + return Math.max(window.screen.width, window.screen.height) * + window.devicePixelRatio; + }; + + Util.getScreenHeight = function() { + return Math.min(window.screen.width, window.screen.height) * + window.devicePixelRatio; + }; + + Util.requestFullscreen = function(element) { + if (Util.isWebViewAndroid()) { + return false; + } + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else { + return false; + } + + return true; + }; + + Util.exitFullscreen = function() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else { + return false; + } + + return true; + }; + + Util.getFullscreenElement = function() { + return document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement; + }; + + Util.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) { + // No error checking for brevity. + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, vertexSource); + gl.compileShader(vertexShader); + + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, fragmentSource); + gl.compileShader(fragmentShader); + + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + + for (var attribName in attribLocationMap) + gl.bindAttribLocation(program, attribLocationMap[attribName], attribName); + + gl.linkProgram(program); + + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + + return program; + }; + + Util.getProgramUniforms = function(gl, program) { + var uniforms = {}; + var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + var uniformName = ''; + for (var i = 0; i < uniformCount; i++) { + var uniformInfo = gl.getActiveUniform(program, i); + uniformName = uniformInfo.name.replace('[0]', ''); + uniforms[uniformName] = gl.getUniformLocation(program, uniformName); + } + return uniforms; + }; + + Util.orthoMatrix = function (out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + }; + + Util.copyArray = function (source, dest) { + for (var i = 0, n = source.length; i < n; i++) { + dest[i] = source[i]; + } + }; + + Util.isMobile = function() { + var check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera); + return check; + }; + + Util.extend = function(dest, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dest[key] = src[key]; + } + } + + return dest; + }; + + Util.safariCssSizeWorkaround = function(canvas) { + // TODO(smus): Remove this workaround when Safari for iOS is fixed. + // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556). + // + // "To the last I grapple with thee; + // from hell's heart I stab at thee; + // for hate's sake I spit my last breath at thee." + // -- Moby Dick, by Herman Melville + if (Util.isIOS()) { + var width = canvas.style.width; + var height = canvas.style.height; + canvas.style.width = (parseInt(width) + 1) + 'px'; + canvas.style.height = (parseInt(height)) + 'px'; + setTimeout(function() { + canvas.style.width = width; + canvas.style.height = height; + }, 100); + } + + // Debug only. + window.Util = Util; + window.canvas = canvas; + }; + + Util.isDebug = function() { + return Util.getQueryParameter('debug'); + }; + + Util.getQueryParameter = function(name) { + var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); + }; + + Util.frameDataFromPose = (function() { + var piOver180 = Math.PI / 180.0; + var rad45 = Math.PI * 0.25; + + // Borrowed from glMatrix. + function mat4_perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45), + downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45), + leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45), + rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; + } + + function mat4_fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; + } + function mat4_translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; + } + function mat4_invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; + } + var defaultOrientation = new Float32Array([0, 0, 0, 1]); + var defaultPosition = new Float32Array([0, 0, 0]); + + function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) { + mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar); + + var orientation = pose.orientation || defaultOrientation; + var position = pose.position || defaultPosition; + + mat4_fromRotationTranslation(view, orientation, position); + if (parameters) + mat4_translate(view, view, parameters.offset); + mat4_invert(view, view); + } + + return function(frameData, pose, vrDisplay) { + if (!frameData || !pose) + return false; + + frameData.pose = pose; + frameData.timestamp = pose.timestamp; + + updateEyeMatrices( + frameData.leftProjectionMatrix, frameData.leftViewMatrix, + pose, vrDisplay.getEyeParameters("left"), vrDisplay); + updateEyeMatrices( + frameData.rightProjectionMatrix, frameData.rightViewMatrix, + pose, vrDisplay.getEyeParameters("right"), vrDisplay); + + return true; + }; + })(); + + Util.isInsideCrossDomainIFrame = function() { + var isFramed = (window.self !== window.top); + var refDomain = Util.getDomainFromUrl(document.referrer); + var thisDomain = Util.getDomainFromUrl(window.location.href); + + return isFramed && (refDomain !== thisDomain); + }; + + // From http://stackoverflow.com/a/23945027. + Util.getDomainFromUrl = function(url) { + var domain; + // Find & remove protocol (http, ftp, etc.) and get domain. + if (url.indexOf("://") > -1) { + domain = url.split('/')[2]; + } + else { + domain = url.split('/')[0]; + } + + //find & remove port number + domain = domain.split(':')[0]; + + return domain; + }; + + var util$1 = Util; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + /** + * Given an orientation and the gyroscope data, predicts the future orientation + * of the head. This makes rendering appear faster. + * + * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf + * + * @param {Number} predictionTimeS time from head movement to the appearance of + * the corresponding image. + */ + function PosePredictor(predictionTimeS) { + this.predictionTimeS = predictionTimeS; + + // The quaternion corresponding to the previous state. + this.previousQ = new mathUtil.Quaternion(); + // Previous time a prediction occurred. + this.previousTimestampS = null; + + // The delta quaternion that adjusts the current pose. + this.deltaQ = new mathUtil.Quaternion(); + // The output quaternion. + this.outQ = new mathUtil.Quaternion(); + } + + PosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) { + if (!this.previousTimestampS) { + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return currentQ; + } + + // Calculate axis and angle based on gyroscope rotation rate data. + var axis = new mathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + + var angularSpeed = gyro.length(); + + // If we're rotating slowly, don't do prediction. + if (angularSpeed < mathUtil.degToRad * 20) { + if (util$1.isDebug()) { + console.log('Moving slowly, at %s deg/s: no prediction', + (mathUtil.radToDeg * angularSpeed).toFixed(1)); + } + this.outQ.copy(currentQ); + this.previousQ.copy(currentQ); + return this.outQ; + } + + // Get the predicted angle based on the time delta and latency. + var deltaT = timestampS - this.previousTimestampS; + var predictAngle = angularSpeed * this.predictionTimeS; + + this.deltaQ.setFromAxisAngle(axis, predictAngle); + this.outQ.copy(this.previousQ); + this.outQ.multiply(this.deltaQ); + + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + + return this.outQ; + }; + + + var posePredictor = PosePredictor; + + /** + * Returns a number value indiciating the version of Chrome being used, + * or otherwise `null` if not on Chrome. + * + * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19 + */ + + /** + * In Chrome m65, `devicemotion` events are broken but subsequently fixed + * in 65.0.3325.148. Since many browsers use Chromium, ensure that + * we scope this detection by branch and build numbers to provide + * a proper fallback. + * https://github.com/immersive-web/webvr-polyfill/issues/307 + */ + + var version = -1; // It should not be null because it will be compared with number + + var branch = null; + var build = null; + var match = /Chrome\/([0-9]+)\.(?:[0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(userAgent); + + if (match) { + version = parseInt(match[1], 10); + branch = match[2]; + build = match[3]; + } + + var CHROME_VERSION = version; + var IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === "3325" && parseInt(build, 10) < 148; + var IS_ANDROID = /Android/i.test(userAgent); + var CONTROL_MODE_VR = 1; + var CONTROL_MODE_YAWPITCH = 2; + var TOUCH_DIRECTION_NONE = 1; + var TOUCH_DIRECTION_YAW = 2; + var TOUCH_DIRECTION_PITCH = 4; + var TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH; + /* Const for MovableCoord */ + + var MC_DECELERATION = 0.0014; + var MC_MAXIMUM_DURATION = 1000; + var MC_BIND_SCALE = [0.20, 0.20]; + var MAX_FIELD_OF_VIEW = 110; + var PAN_SCALE = 320; // const DELTA_THRESHOLD = 0.015; + + var YAW_RANGE_HALF = 180; + var PITCH_RANGE_HALF = 90; + var CIRCULAR_PITCH_RANGE_HALF = 180; + var GYRO_MODE = { + NONE: "none", + YAWPITCH: "yawPitch", + VR: "VR" + }; + + var STILLNESS_THRESHOLD = 200; // millisecond + + var DeviceMotion = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(DeviceMotion, _Component); + + function DeviceMotion() { + var _this; + + _this = _Component.call(this) || this; + _this._onDeviceMotion = _this._onDeviceMotion.bind(_assertThisInitialized(_this)); + _this._onDeviceOrientation = _this._onDeviceOrientation.bind(_assertThisInitialized(_this)); + _this._onChromeWithoutDeviceMotion = _this._onChromeWithoutDeviceMotion.bind(_assertThisInitialized(_this)); + _this.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION; + _this.isAndroid = IS_ANDROID; + _this.stillGyroVec = create$4(); + _this.rawGyroVec = create$4(); + _this.adjustedGyroVec = create$4(); + _this._timer = null; + _this.lastDevicemotionTimestamp = 0; + _this._isEnabled = false; + + _this.enable(); + + return _this; + } + + var _proto = DeviceMotion.prototype; + + _proto._onChromeWithoutDeviceMotion = function _onChromeWithoutDeviceMotion(e) { + var alpha = e.alpha, + beta = e.beta, + gamma = e.gamma; // There is deviceorientation event trigged with empty values + // on Headless Chrome. + + if (alpha === null) { + return; + } // convert to radian + + + alpha = (alpha || 0) * Math.PI / 180; + beta = (beta || 0) * Math.PI / 180; + gamma = (gamma || 0) * Math.PI / 180; + this.trigger("devicemotion", { + inputEvent: { + deviceorientation: { + alpha: alpha, + beta: beta, + gamma: -gamma + } + } + }); + }; + + _proto._onDeviceOrientation = function _onDeviceOrientation() { + var _this2 = this; + + this._timer && clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (new Date().getTime() - _this2.lastDevicemotionTimestamp < STILLNESS_THRESHOLD) { + copy$4(_this2.stillGyroVec, _this2.rawGyroVec); + } + }, STILLNESS_THRESHOLD); + }; + + _proto._onDeviceMotion = function _onDeviceMotion(e) { + // desktop chrome triggers devicemotion event with empthy sensor values. + // Those events should ignored. + var isGyroSensorAvailable = !(e.rotationRate.alpha == null); + var isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null); + + if (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) { + return; + } + + var devicemotionEvent = _extends({}, e); + + devicemotionEvent.interval = e.interval; + devicemotionEvent.timeStamp = e.timeStamp; + devicemotionEvent.type = e.type; + devicemotionEvent.rotationRate = { + alpha: e.rotationRate.alpha, + beta: e.rotationRate.beta, + gamma: e.rotationRate.gamma + }; + devicemotionEvent.accelerationIncludingGravity = { + x: e.accelerationIncludingGravity.x, + y: e.accelerationIncludingGravity.y, + z: e.accelerationIncludingGravity.z + }; + devicemotionEvent.acceleration = { + x: e.acceleration.x, + y: e.acceleration.y, + z: e.acceleration.z + }; + + if (this.isAndroid) { + set$5(this.rawGyroVec, e.rotationRate.alpha || 0, e.rotationRate.beta || 0, e.rotationRate.gamma || 0); + subtract$4(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec); + this.lastDevicemotionTimestamp = new Date().getTime(); + devicemotionEvent.adjustedRotationRate = { + alpha: this.adjustedGyroVec[0], + beta: this.adjustedGyroVec[1], + gamma: this.adjustedGyroVec[2] + }; + } + + this.trigger("devicemotion", { + inputEvent: devicemotionEvent + }); + }; + + _proto.enable = function enable() { + if (this.isAndroid) { + win.addEventListener("deviceorientation", this._onDeviceOrientation); + } + + if (this.isWithoutDeviceMotion) { + win.addEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + } else { + win.addEventListener("devicemotion", this._onDeviceMotion); + } + + this._isEnabled = true; + }; + + _proto.disable = function disable() { + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + win.removeEventListener("devicemotion", this._onDeviceMotion); + this._isEnabled = false; + }; + + return DeviceMotion; + }(Component); + + function SensorSample(sample, timestampS) { + this.set(sample, timestampS); + } + SensorSample.prototype.set = function(sample, timestampS) { + this.sample = sample; + this.timestampS = timestampS; + }; + + SensorSample.prototype.copy = function(sensorSample) { + this.set(sensorSample.sample, sensorSample.timestampS); + }; + + var sensorSample = SensorSample; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + /** + * An implementation of a simple complementary filter, which fuses gyroscope and + * accelerometer data from the 'devicemotion' event. + * + * Accelerometer data is very noisy, but stable over the long term. + * Gyroscope data is smooth, but tends to drift over the long term. + * + * This fusion is relatively simple: + * 1. Get orientation estimates from accelerometer by applying a low-pass filter + * on that data. + * 2. Get orientation estimates from gyroscope by integrating over time. + * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the + * short term. + */ + function ComplementaryFilter(kFilter) { + this.kFilter = kFilter; + + // Raw sensor measurements. + this.currentAccelMeasurement = new sensorSample(); + this.currentGyroMeasurement = new sensorSample(); + this.previousGyroMeasurement = new sensorSample(); + + // Set default look direction to be in the correct direction. + if (util$1.isIOS()) { + this.filterQ = new mathUtil.Quaternion(-1, 0, 0, 1); + } else { + this.filterQ = new mathUtil.Quaternion(1, 0, 0, 1); + } + this.previousFilterQ = new mathUtil.Quaternion(); + this.previousFilterQ.copy(this.filterQ); + + // Orientation based on the accelerometer. + this.accelQ = new mathUtil.Quaternion(); + // Whether or not the orientation has been initialized. + this.isOrientationInitialized = false; + // Running estimate of gravity based on the current orientation. + this.estimatedGravity = new mathUtil.Vector3(); + // Measured gravity based on accelerometer. + this.measuredGravity = new mathUtil.Vector3(); + + // Debug only quaternion of gyro-based orientation. + this.gyroIntegralQ = new mathUtil.Quaternion(); + } + + ComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) { + this.currentAccelMeasurement.set(vector, timestampS); + }; + + ComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) { + this.currentGyroMeasurement.set(vector, timestampS); + + var deltaT = timestampS - this.previousGyroMeasurement.timestampS; + if (util$1.isTimestampDeltaValid(deltaT)) { + this.run_(); + } + + this.previousGyroMeasurement.copy(this.currentGyroMeasurement); + }; + + ComplementaryFilter.prototype.run_ = function() { + + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - + this.previousGyroMeasurement.timestampS; + + // Convert gyro rotation vector to a quaternion delta. + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); + + // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); + + // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + var invFilterQ = new mathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); + + // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + var deltaQ = new mathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); + + if (util$1.isDebug()) { + console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)', + mathUtil.radToDeg * util$1.getQuaternionAngle(deltaQ), + (this.estimatedGravity.x).toFixed(1), + (this.estimatedGravity.y).toFixed(1), + (this.estimatedGravity.z).toFixed(1), + (this.measuredGravity.x).toFixed(1), + (this.measuredGravity.y).toFixed(1), + (this.measuredGravity.z).toFixed(1)); + } + + // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + var targetQ = new mathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); + + // SLERP factor: 0 is pure gyro, 1 is pure accel. + this.filterQ.slerp(targetQ, 1 - this.kFilter); + + this.previousFilterQ.copy(this.filterQ); + }; + + ComplementaryFilter.prototype.getOrientation = function() { + return this.filterQ; + }; + + ComplementaryFilter.prototype.accelToQuaternion_ = function(accel) { + var normAccel = new mathUtil.Vector3(); + normAccel.copy(accel); + normAccel.normalize(); + var quat = new mathUtil.Quaternion(); + quat.setFromUnitVectors(new mathUtil.Vector3(0, 0, -1), normAccel); + quat.inverse(); + return quat; + }; + + ComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) { + // Extract axis and angle from the gyroscope data. + var quat = new mathUtil.Quaternion(); + var axis = new mathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + quat.setFromAxisAngle(axis, gyro.length() * dt); + return quat; + }; + + + var complementaryFilter = ComplementaryFilter; + + complementaryFilter.prototype.run_ = function () { + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - this.previousGyroMeasurement.timestampS; // Convert gyro rotation vector to a quaternion delta. + + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + + var invFilterQ = new mathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + + var deltaQ = new mathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + + var targetQ = new mathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); // SLERP factor: 0 is pure gyro, 1 is pure accel. + + this.filterQ.slerp(targetQ, 1 - this.kFilter); + this.previousFilterQ.copy(this.filterQ); + + if (!this.isFilterQuaternionInitialized) { + this.isFilterQuaternionInitialized = true; + } + }; + + complementaryFilter.prototype.getOrientation = function () { + if (this.isFilterQuaternionInitialized) { + return this.filterQ; + } else { + return null; + } + }; + + var K_FILTER = 0.98; + var PREDICTION_TIME_S = 0.040; + + var FusionPoseSensor = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(FusionPoseSensor, _Component); + + function FusionPoseSensor() { + var _this; + + _this = _Component.call(this) || this; + _this.deviceMotion = new DeviceMotion(); + _this.accelerometer = new mathUtil.Vector3(); + _this.gyroscope = new mathUtil.Vector3(); + _this._onDeviceMotionChange = _this._onDeviceMotionChange.bind(_assertThisInitialized(_this)); + _this._onScreenOrientationChange = _this._onScreenOrientationChange.bind(_assertThisInitialized(_this)); + _this.filter = new complementaryFilter(K_FILTER); + _this.posePredictor = new posePredictor(PREDICTION_TIME_S); + _this.filterToWorldQ = new mathUtil.Quaternion(); + _this.isFirefoxAndroid = util$1.isFirefoxAndroid(); // This includes iPhone & iPad(both desktop and mobile mode) ref #326 + + _this.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP; // Ref https://github.com/immersive-web/cardboard-vr-display/issues/18 + + _this.isChromeUsingDegrees = CHROME_VERSION >= 66; + _this._isEnabled = false; // Set the filter to world transform, depending on OS. + + if (_this.isIOS) { + _this.filterToWorldQ.setFromAxisAngle(new mathUtil.Vector3(1, 0, 0), Math.PI / 2); + } else { + _this.filterToWorldQ.setFromAxisAngle(new mathUtil.Vector3(1, 0, 0), -Math.PI / 2); + } + + _this.inverseWorldToScreenQ = new mathUtil.Quaternion(); + _this.worldToScreenQ = new mathUtil.Quaternion(); + _this.originalPoseAdjustQ = new mathUtil.Quaternion(); + + _this.originalPoseAdjustQ.setFromAxisAngle(new mathUtil.Vector3(0, 0, 1), -win.orientation * Math.PI / 180); + + _this._setScreenTransform(); // Adjust this filter for being in landscape mode. + + + if (util$1.isLandscapeMode()) { + _this.filterToWorldQ.multiply(_this.inverseWorldToScreenQ); + } // Keep track of a reset transform for resetSensor. + + + _this.resetQ = new mathUtil.Quaternion(); + + _this.deviceMotion.on("devicemotion", _this._onDeviceMotionChange); + + _this.enable(); + + return _this; + } + + var _proto = FusionPoseSensor.prototype; + + _proto.enable = function enable() { + if (this.isEnabled()) { + return; + } + + this.deviceMotion.enable(); + this._isEnabled = true; + win.addEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.disable = function disable() { + if (!this.isEnabled()) { + return; + } + + this.deviceMotion.disable(); + this._isEnabled = false; + win.removeEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.isEnabled = function isEnabled() { + return this._isEnabled; + }; + + _proto.destroy = function destroy() { + this.disable(); + this.deviceMotion = null; + }; + + _proto._triggerChange = function _triggerChange() { + var orientation = this.getOrientation(); // if orientation is not prepared. don't trigger change event + + if (!orientation) { + return; + } + + if (!this._prevOrientation) { + this._prevOrientation = orientation; + return; + } + + if (equals$7(this._prevOrientation, orientation)) { + return; + } + + this.trigger("change", { + quaternion: orientation + }); + }; + + _proto.getOrientation = function getOrientation() { + var _this2 = this; + + var orientation; // Hack around using deviceorientation instead of devicemotion + + if (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) { + this.deviceOrientationFixQ = this.deviceOrientationFixQ || function () { + var y = new mathUtil.Quaternion().setFromAxisAngle(new mathUtil.Vector3(0, 1, 0), -_this2._alpha); + return y; + }(); + + orientation = this._deviceOrientationQ; + var out = new mathUtil.Quaternion(); + out.copy(orientation); + out.multiply(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.worldToScreenQ); + out.multiplyQuaternions(this.deviceOrientationFixQ, out); // return quaternion as glmatrix quaternion object + + var out_ = fromValues$6(out.x, out.y, out.z, out.w); + return normalize$2(out_, out_); + } else { + // Convert from filter space to the the same system used by the + // deviceorientation event. + orientation = this.filter.getOrientation(); + + if (!orientation) { + return null; + } + + var _out = this._convertFusionToPredicted(orientation); // return quaternion as glmatrix quaternion object + + + var _out_ = fromValues$6(_out.x, _out.y, _out.z, _out.w); + + return normalize$2(_out_, _out_); + } + }; + + _proto._convertFusionToPredicted = function _convertFusionToPredicted(orientation) { + // Predict orientation. + this.predictedQ = this.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS); // Convert to THREE coordinate system: -Z forward, Y up, X right. + + var out = new mathUtil.Quaternion(); + out.copy(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.predictedQ); + out.multiply(this.worldToScreenQ); + return out; + }; + + _proto._onDeviceMotionChange = function _onDeviceMotionChange(_ref) { + var inputEvent = _ref.inputEvent; + var deviceorientation = inputEvent.deviceorientation; + var deviceMotion = inputEvent; + var accGravity = deviceMotion.accelerationIncludingGravity; + var rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate; + var timestampS = deviceMotion.timeStamp / 1000; + + if (deviceorientation) { + if (!this._alpha) { + this._alpha = deviceorientation.alpha; + } + + this._deviceOrientationQ = this._deviceOrientationQ || new mathUtil.Quaternion(); + + this._deviceOrientationQ.setFromEulerYXZ(deviceorientation.beta, deviceorientation.alpha, deviceorientation.gamma); + + this._triggerChange(); + } else { + // Firefox Android timeStamp returns one thousandth of a millisecond. + if (this.isFirefoxAndroid) { + timestampS /= 1000; + } + + this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); + this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); // Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate` + // is reported in degrees, so we first convert to radians. + + if (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) { + this.gyroscope.multiplyScalar(Math.PI / 180); + } + + this.filter.addAccelMeasurement(this.accelerometer, timestampS); + this.filter.addGyroMeasurement(this.gyroscope, timestampS); + + this._triggerChange(); + + this.previousTimestampS = timestampS; + } + }; + + _proto._onScreenOrientationChange = function _onScreenOrientationChange(screenOrientation) { + this._setScreenTransform(win.orientation); + }; + + _proto._setScreenTransform = function _setScreenTransform() { + this.worldToScreenQ.set(0, 0, 0, 1); + var orientation = win.orientation; + + switch (orientation) { + case 0: + break; + + case 90: + case -90: + case 180: + this.worldToScreenQ.setFromAxisAngle(new mathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI); + break; + + default: + break; + } + + this.inverseWorldToScreenQ.copy(this.worldToScreenQ); + this.inverseWorldToScreenQ.inverse(); + }; + + return FusionPoseSensor; + }(Component); + + function getDeltaYaw$1(prvQ, curQ) { + var yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW); + var yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) * Math.sin(util.extractPitchFromQuat(curQ)); + return yawDeltaByRoll + yawDeltaByYaw; + } + + function getDeltaPitch$1(prvQ, curQ) { + var pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA); + return pitchDelta; + } + + var TiltMotionInput = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(TiltMotionInput, _Component); + + function TiltMotionInput(el, options) { + var _this; + + _this = _Component.call(this) || this; + _this.element = el; + _this._prevQuaternion = null; + _this._quaternion = null; + _this.fusionPoseSensor = null; + _this.options = _extends({ + scale: 1, + threshold: 0 + }, options); + _this._onPoseChange = _this._onPoseChange.bind(_assertThisInitialized(_this)); + return _this; + } + + var _proto = TiltMotionInput.prototype; + + _proto.mapAxes = function mapAxes(axes) { + this.axes = axes; + }; + + _proto.connect = function connect(observer) { + if (this.observer) { + return this; + } + + this.observer = observer; + this.fusionPoseSensor = new FusionPoseSensor(); + this.fusionPoseSensor.enable(); + + this._attachEvent(); + + return this; + }; + + _proto.disconnect = function disconnect() { + if (!this.observer) { + return this; + } + + this._dettachEvent(); + + this.fusionPoseSensor.disable(); + this.fusionPoseSensor.destroy(); + this.fusionPoseSensor = null; + this.observer = null; + return this; + }; + + _proto.destroy = function destroy() { + this.disconnect(); + this.element = null; + this.options = null; + this.axes = null; + this._prevQuaternion = null; + this._quaternion = null; + }; + + _proto._onPoseChange = function _onPoseChange(event) { + if (!this._prevQuaternion) { + this._prevQuaternion = clone$6(event.quaternion); + this._quaternion = clone$6(event.quaternion); + return; + } + + copy$6(this._prevQuaternion, this._quaternion); + copy$6(this._quaternion, event.quaternion); + this.observer.change(this, event, toAxis$1(this.axes, [getDeltaYaw$1(this._prevQuaternion, this._quaternion), getDeltaPitch$1(this._prevQuaternion, this._quaternion)])); + }; + + _proto._attachEvent = function _attachEvent() { + this.fusionPoseSensor.on("change", this._onPoseChange); + }; + + _proto._dettachEvent = function _dettachEvent() { + this.fusionPoseSensor.off("change", this._onPoseChange); + }; + + return TiltMotionInput; + }(Component); + + var screenRotationAngleInst = null; + var refCount = 0; + + var ScreenRotationAngle = + /*#__PURE__*/ + function () { + function ScreenRotationAngle() { + refCount++; + + if (screenRotationAngleInst) { + return screenRotationAngleInst; + } + /* eslint-disable */ + + + screenRotationAngleInst = this; + /* eslint-enable */ + + this._onDeviceOrientation = this._onDeviceOrientation.bind(this); + this._onOrientationChange = this._onOrientationChange.bind(this); + this._spinR = 0; + this._screenOrientationAngle = 0; + win.addEventListener("deviceorientation", this._onDeviceOrientation); + win.addEventListener("orientationchange", this._onOrientationChange); + } + + var _proto = ScreenRotationAngle.prototype; + + _proto._onDeviceOrientation = function _onDeviceOrientation(e) { + if (e.beta === null || e.gamma === null) { + // (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it. + return; + } // Radian + + + var betaR = toRadian(e.beta); + var gammaR = toRadian(e.gamma); + /* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */ + + this._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR)); + }; + + _proto._onOrientationChange = function _onOrientationChange(e) { + if (win.screen && win.screen.orientation && win.screen.orientation.angle !== undefined) { + this._screenOrientationAngle = screen.orientation.angle; + } else if (win.orientation !== undefined) { + /* iOS */ + this._screenOrientationAngle = win.orientation >= 0 ? win.orientation : 360 + win.orientation; + } + }; + + _proto.getRadian = function getRadian() { + // Join with screen orientation + // this._testVal = this._spinR + ", " + this._screenOrientationAngle + ", " + window.orientation; + return this._spinR + toRadian(this._screenOrientationAngle); + }; + + _proto.unref = function unref() { + if (--refCount > 0) { + return; + } + + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("orientationchange", this._onOrientationChange); + this._spinR = 0; + this._screenOrientationAngle = 0; + /* eslint-disable */ + + screenRotationAngleInst = null; + /* eslint-enable */ + + refCount = 0; + }; + + return ScreenRotationAngle; + }(); + + /** + * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle. + * + * The reason for using this function is that in VR mode, + * the roll angle is adjusted in the direction opposite to the screen rotation angle. + * + * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move. + * @extends PanInput + */ + + var RotationPanInput = + /*#__PURE__*/ + function (_PanInput) { + _inheritsLoose(RotationPanInput, _PanInput); + + /** + * Constructor + * + * @private + * @param {HTMLElement} el target element + * @param {Object} [options] The option object + * @param {Boolean} [options.useRotation] Whether to use rotation(or VR) + */ + function RotationPanInput(el, options) { + var _this; + + _this = _PanInput.call(this, el, options) || this; + _this._useRotation = false; + _this._screenRotationAngle = null; + + _this.setUseRotation(!!(options && options.useRotation)); + + _this._userDirection = Axes.DIRECTION_ALL; + return _this; + } + + var _proto = RotationPanInput.prototype; + + _proto.setUseRotation = function setUseRotation(useRotation) { + this._useRotation = useRotation; + + if (this._screenRotationAngle) { + this._screenRotationAngle.unref(); + + this._screenRotationAngle = null; + } + + if (this._useRotation) { + this._screenRotationAngle = new ScreenRotationAngle(); + } + }; + + _proto.connect = function connect(observer) { + // User intetened direction + this._userDirection = this._direction; // In VR Mode, Use ALL direction if direction is not none + // Because horizontal and vertical is changed dynamically by screen rotation. + // this._direction is used to initialize hammerjs + + if (this._useRotation && this._direction & Axes.DIRECTION_ALL) { + this._direction = Axes.DIRECTION_HORIZONTAL; + } + + _PanInput.prototype.connect.call(this, observer); + }; + + _proto.getOffset = function getOffset(properties, useDirection) { + if (this._useRotation === false) { + return _PanInput.prototype.getOffset.call(this, properties, useDirection); + } + + var offset = _PanInput.prototype.getOffset.call(this, properties, [true, true]); + + var newOffset = [0, 0]; + + var theta = this._screenRotationAngle.getRadian(); + + var cosTheta = Math.cos(theta); + var sinTheta = Math.sin(theta); // RotateZ + + newOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta; + newOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta; // Use only user allowed direction. + + if (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) { + newOffset[0] = 0; + } else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) { + newOffset[1] = 0; + } + + return newOffset; + }; + + _proto.destroy = function destroy() { + if (this._useRotation) { + this._screenRotationAngle && this._screenRotationAngle.unref(); + } + + _PanInput.prototype.destroy.call(this); + }; + + return RotationPanInput; + }(PanInput); + + var Y_AXIS_VECTOR = fromValues$4(0, 1, 0); + + var DeviceQuaternion = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(DeviceQuaternion, _Component); + + function DeviceQuaternion() { + var _this; + + _this = _Component.call(this) || this; + _this._fusionPoseSensor = new FusionPoseSensor(); + _this._quaternion = create$6(); + + _this._fusionPoseSensor.enable(); + + _this._fusionPoseSensor.on("change", function (e) { + _this._quaternion = e.quaternion; + + _this.trigger("change", { + isTrusted: true + }); + }); + + return _this; + } + + var _proto = DeviceQuaternion.prototype; + + _proto.getCombinedQuaternion = function getCombinedQuaternion(yaw) { + var yawQ = setAxisAngle(create$6(), Y_AXIS_VECTOR, toRadian(-yaw)); + var conj = conjugate(create$6(), this._quaternion); // Multiply pitch quaternion -> device quaternion -> yaw quaternion + + var outQ = multiply$6(create$6(), conj, yawQ); + return outQ; + }; + + _proto.destroy = function destroy() { + // detach all event handler + this.off(); + + if (this._fusionPoseSensor) { + this._fusionPoseSensor.off(); + + this._fusionPoseSensor.destroy(); + + this._fusionPoseSensor = null; + } + }; + + return DeviceQuaternion; + }(Component); + + var VERSION = "3.3.3"; + + var DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF]; + var DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF]; + var CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF]; + /** + * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates. + * + * @alias eg.YawPitchControl + * @extends eg.Component + * + * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + */ + + var YawPitchControl = + /*#__PURE__*/ + function () { + var YawPitchControl = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(YawPitchControl, _Component); + + // Expose DeviceOrientationControls sub module for test purpose + + /** + * @param {Object} options The option object of the eg.YawPitch module + * @param {Element}[options.element=null] element A base element for the eg.YawPitch module + * @param {Number} [options.yaw=0] initial yaw (degree) + * @param {Number} [options.pitch=0] initial pitch (degree) + * @param {Number} [options.fov=65] initial field of view (degree) + * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown + * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available + * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. + * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move) + * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw + * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch + * @param {Array} [options.fovRange=[30, 110] Range of FOV + * @param {Number} [options.aspectRatio=1] Aspect Ratio + */ + function YawPitchControl(options) { + var _this; + + _this = _Component.call(this) || this; + + var opt = _extends({ + element: null, + yaw: 0, + pitch: 0, + fov: 65, + showPolePoint: false, + useZoom: true, + useKeyboard: true, + gyroMode: GYRO_MODE.YAWPITCH, + touchDirection: TOUCH_DIRECTION_ALL, + yawRange: DEFAULT_YAW_RANGE, + pitchRange: DEFAULT_PITCH_RANGE, + fovRange: [30, 110], + aspectRatio: 1 + /* TODO: Need Mandatory? */ + + }, options); + + _this._element = opt.element; + _this._initialFov = opt.fov; + _this._enabled = false; + _this._isAnimating = false; + _this._deviceQuaternion = null; + + _this._initAxes(opt); + + _this.option(opt); + + return _this; + } + + var _proto = YawPitchControl.prototype; + + _proto._initAxes = function _initAxes(opt) { + var _this2 = this; + + var yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio); + + var pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint); + + var useRotation = opt.gyroMode === GYRO_MODE.VR; + this.axesPanInput = new RotationPanInput(this._element, { + useRotation: useRotation + }); + this.axesWheelInput = new WheelInput(this._element, { + scale: -4 + }); + this.axesTiltMotionInput = null; + this.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, { + scale: -1 + }) : null; + this.axesMoveKeyInput = new MoveKeyInput(this._element, { + scale: [-6, 6] + }); + this.axes = new Axes({ + yaw: { + range: yRange, + circular: YawPitchControl.isCircular(yRange), + bounce: [0, 0] + }, + pitch: { + range: pRange, + circular: YawPitchControl.isCircular(pRange), + bounce: [0, 0] + }, + fov: { + range: opt.fovRange, + circular: [false, false], + bounce: [0, 0] + } + }, { + deceleration: MC_DECELERATION, + maximumDuration: MC_MAXIMUM_DURATION + }, { + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }).on({ + hold: function hold(evt) { + // Restore maximumDuration not to be spin too mush. + _this2.axes.options.maximumDuration = MC_MAXIMUM_DURATION; + + _this2.trigger("hold", { + isTrusted: evt.isTrusted + }); + }, + change: function change(evt) { + if (evt.delta.fov !== 0) { + _this2._updateControlScale(evt); + + _this2.updatePanScale(); + } + + _this2._triggerChange(evt); + }, + release: function release(evt) { + _this2._triggerChange(evt); + }, + animationStart: function animationStart(evt) {}, + animationEnd: function animationEnd(evt) { + _this2.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + } + /** + * Update Pan Scale + * + * Scale(Sensitivity) values of panning is related with fov and height. + * If at least one of them is changed, this function need to be called. + * @param {*} param + */ + ; + + _proto.updatePanScale = function updatePanScale(param) { + if (param === void 0) { + param = {}; + } + + var fov = this.axes.get().fov; + var areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10); + var scale$$1 = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight; + this.axesPanInput.options.scale = [scale$$1, scale$$1]; + this.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW; + return this; + } + /* + * Override component's option method + * to call method for updating values which is affected by option change. + * + * @param {*} args + */ + ; + + _proto.option = function option() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var argLen = args.length; // Getter + + if (argLen === 0) { + return this._getOptions(); + } else if (argLen === 1 && typeof args[0] === "string") { + return this._getOptions(args[0]); + } // Setter + + + var beforeOptions = _extends({}, this.options); + + var newOptions = {}; + var changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList. + + if (argLen === 1) { + changedKeyList = Object.keys(args[0]); + newOptions = _extends({}, args[0]); + } else if (argLen >= 2) { + changedKeyList.push(args[0]); + newOptions[args[0]] = args[1]; + } + + this._setOptions(this._getValidatedOptions(newOptions)); + + this._applyOptions(changedKeyList, beforeOptions); + + return this; + }; + + _proto._getValidatedOptions = function _getValidatedOptions(newOptions) { + if (newOptions.yawRange) { + newOptions.yawRange = this._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio); + } + + if (newOptions.pitchRange) { + newOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov); + } + + return newOptions; + }; + + _proto._getOptions = function _getOptions(key) { + var value; + + if (typeof key === "string") { + value = this.options[key]; + } else if (arguments.length === 0) { + value = this.options; + } + + return value; + }; + + _proto._setOptions = function _setOptions(options) { + for (var key in options) { + this.options[key] = options[key]; + } + }; + + _proto._applyOptions = function _applyOptions(keys, prevOptions) { + var options = this.options; + var axes = this.axes; + var isVR = options.gyroMode === GYRO_MODE.VR; + var isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH; // If it's VR mode, restrict user interaction to yaw direction only + + var touchDirection = isVR ? TOUCH_DIRECTION_YAW & options.touchDirection : options.touchDirection; // If one of below is changed, call updateControlScale() + + if (keys.some(function (key) { + return key === "showPolePoint" || key === "fov" || key === "aspectRatio" || key === "yawRange" || key === "pitchRange"; + })) { + // If fov is changed, update pan scale + if (keys.indexOf("fov") >= 0) { + axes.setTo({ + "fov": options.fov + }); + this.updatePanScale(); + } + + this._updateControlScale(); + } + + if (keys.some(function (key) { + return key === "fovRange"; + })) { + var fovRange = options.fovRange; + var prevFov = axes.get().fov; + var nextFov = axes.get().fov; + copy$8(axes.axis.fov.range, fovRange); + + if (nextFov < fovRange[0]) { + nextFov = fovRange[0]; + } else if (prevFov > fovRange[1]) { + nextFov = fovRange[1]; + } + + if (prevFov !== nextFov) { + axes.setTo({ + fov: nextFov + }, 0); + + this._updateControlScale(); + + this.updatePanScale(); + } + } + + if (keys.some(function (key) { + return key === "gyroMode"; + }) && SUPPORT_DEVICEMOTION) { + // Disconnect first + if (this.axesTiltMotionInput) { + this.axes.disconnect(this.axesTiltMotionInput); + this.axesTiltMotionInput.destroy(); + this.axesTiltMotionInput = null; + } + + if (this._deviceQuaternion) { + this._deviceQuaternion.destroy(); + + this._deviceQuaternion = null; + } + + if (isVR) { + this._initDeviceQuaternion(); + } else if (isYawPitch) { + this.axesTiltMotionInput = new TiltMotionInput(this._element); + this.axes.connect(["yaw", "pitch"], this.axesTiltMotionInput); + } + + this.axesPanInput.setUseRotation(isVR); + } + + if (keys.some(function (key) { + return key === "useKeyboard"; + })) { + var useKeyboard = options.useKeyboard; + + if (useKeyboard) { + axes.connect(["yaw", "pitch"], this.axesMoveKeyInput); + } else { + axes.disconnect(this.axesMoveKeyInput); + } + } + + if (keys.some(function (key) { + return key === "useZoom"; + })) { + var useZoom = options.useZoom; // Disconnect first + + axes.disconnect(this.axesWheelInput); + + if (useZoom) { + axes.connect(["fov"], this.axesWheelInput); + } + } + + this._togglePinchInputByOption(options.touchDirection, options.useZoom); + + if (keys.some(function (key) { + return key === "touchDirection"; + })) { + this._enabled && this._enableTouch(touchDirection); + } + }; + + _proto._togglePinchInputByOption = function _togglePinchInputByOption(touchDirection, useZoom) { + if (this.axesPinchInput) { + // disconnect first + this.axes.disconnect(this.axesPinchInput); // If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll. + + if (useZoom && touchDirection === TOUCH_DIRECTION_ALL && // TODO: Get rid of using private property of axes instance. + this.axes._inputs.indexOf(this.axesPinchInput) === -1) { + this.axes.connect(["fov"], this.axesPinchInput); + } + } + }; + + _proto._enableTouch = function _enableTouch(direction) { + // Disconnect first + this.axesPanInput && this.axes.disconnect(this.axesPanInput); + var yawEnabled = direction & TOUCH_DIRECTION_YAW ? "yaw" : null; + var pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? "pitch" : null; + this.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput); + }; + + _proto._initDeviceQuaternion = function _initDeviceQuaternion() { + var _this3 = this; + + this._deviceQuaternion = new DeviceQuaternion(); + + this._deviceQuaternion.on("change", function (e) { + _this3._triggerChange(e); + }); + }; + + _proto._getValidYawRange = function _getValidYawRange(newYawRange, newFov, newAspectRatio) { + var ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1); + var fov = newFov || this.axes.get().fov; + var horizontalFov = fov * ratio; + var isValid = newYawRange[1] - newYawRange[0] >= horizontalFov; + + if (isValid) { + return newYawRange; + } else { + return this.options.yawRange || DEFAULT_YAW_RANGE; + } + }; + + _proto._getValidPitchRange = function _getValidPitchRange(newPitchRange, newFov) { + var fov = newFov || this.axes.get().fov; + var isValid = newPitchRange[1] - newPitchRange[0] >= fov; + + if (isValid) { + return newPitchRange; + } else { + return this.options.pitchRange || DEFAULT_PITCH_RANGE; + } + }; + + YawPitchControl.isCircular = function isCircular(range) { + return range[1] - range[0] < 360 ? [false, false] : [true, true]; + } + /** + * Update yaw/pitch min/max by 5 factor + * + * 1. showPolePoint + * 2. fov + * 3. yawRange + * 4. pitchRange + * 5. aspectRatio + * + * If one of above is changed, call this function + */ + ; + + _proto._updateControlScale = function _updateControlScale(changeEvt) { + var opt = this.options; + var fov = this.axes.get().fov; + + var pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint); + + var yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio); // TODO: If not changed!? + + + var pos = this.axes.get(); + var y = pos.yaw; + var p = pos.pitch; + copy$8(this.axes.axis.yaw.range, yRange); + copy$8(this.axes.axis.pitch.range, pRange); + this.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange); + this.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange); + /** + * update yaw/pitch by it's range. + */ + + if (y < yRange[0]) { + y = yRange[0]; + } else if (y > yRange[1]) { + y = yRange[1]; + } + + if (p < pRange[0]) { + p = pRange[0]; + } else if (p > pRange[1]) { + p = pRange[1]; + } + + if (changeEvt) { + changeEvt.set({ + yaw: y, + pitch: p + }); + } + + this.axes.setTo({ + yaw: y, + pitch: p + }, 0); + return this; + }; + + _proto._updatePitchRange = function _updatePitchRange(pitchRange, fov, showPolePoint) { + if (this.options.gyroMode === GYRO_MODE.VR) { + // Circular pitch on VR + return CIRCULAR_PITCH_RANGE; + } + + var verticalAngle = pitchRange[1] - pitchRange[0]; + var halfFov = fov / 2; + var isPanorama = verticalAngle < 180; + + if (showPolePoint && !isPanorama) { + // Use full pinch range + return pitchRange.concat(); + } // Round value as movableCood do. + + + return [pitchRange[0] + halfFov, pitchRange[1] - halfFov]; + }; + + _proto._updateYawRange = function _updateYawRange(yawRange, fov, aspectRatio) { + if (this.options.gyroMode === GYRO_MODE.VR) { + return DEFAULT_YAW_RANGE; + } + + var horizontalAngle = yawRange[1] - yawRange[0]; + /** + * Full 360 Mode + */ + + if (horizontalAngle >= 360) { + // Don't limit yaw range on Full 360 mode. + return yawRange.concat(); + } + /** + * Panorama mode + */ + // Ref : https://github.com/naver/egjs-view360/issues/290 + + + var halfHorizontalFov = util.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(toRadian(fov / 2)))); // Round value as movableCood do. + + return [yawRange[0] + halfHorizontalFov, yawRange[1] - halfHorizontalFov]; + }; + + _proto._triggerChange = function _triggerChange(evt) { + var pos = this.axes.get(); + var opt = this.options; + var event = { + targetElement: opt.element, + isTrusted: evt.isTrusted + }; + event.yaw = pos.yaw; + event.pitch = pos.pitch; + event.fov = pos.fov; + + if (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) { + event.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + } + + this.trigger("change", event); + } // TODO: makes constant to be logic + ; + + YawPitchControl.adjustAspectRatio = function adjustAspectRatio(input) { + var inputRange = [0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670, 0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19, 1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26, 2.30, 2.60, 3.00, 5.00, 6.00]; + var outputRange = [0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710, 0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15, 1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72, 1.82, 1.92, 2.00, 2.24, 2.30]; + var rangeIdx = -1; + + for (var i = 0; i < inputRange.length - 1; i++) { + if (inputRange[i] <= input && inputRange[i + 1] >= input) { + rangeIdx = i; + break; + } + } + + if (rangeIdx === -1) { + if (inputRange[0] > input) { + return outputRange[0]; + } else { + return outputRange[outputRange[0].length - 1]; + } + } + + var inputA = inputRange[rangeIdx]; + var inputB = inputRange[rangeIdx + 1]; + var outputA = outputRange[rangeIdx]; + var outputB = outputRange[rangeIdx + 1]; + return YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA)); + }; + + YawPitchControl.lerp = function lerp$$1(a, b, fraction) { + return a + fraction * (b - a); + } + /** + * Enable YawPitch functionality + * + * @method eg.YawPitch#enable + */ + ; + + _proto.enable = function enable() { + if (this._enabled) { + return this; + } + + this._enabled = true; // touchDirection is decided by parameter is valid string (Ref. Axes.connect) + + this._applyOptions(Object.keys(this.options), this.options); // TODO: Is this code is needed? Check later. + + + this.updatePanScale(); + return this; + } + /** + * Disable YawPitch functionality + * + * @method eg.YawPitch#disable + */ + ; + + _proto.disable = function disable(persistOrientation) { + if (!this._enabled) { + return this; + } // TODO: Check peristOrientation is needed! + + + if (!persistOrientation) { + this._resetOrientation(); + } + + this.axes.disconnect(); + this._enabled = false; + return this; + }; + + _proto._resetOrientation = function _resetOrientation() { + var opt = this.options; + this.axes.setTo({ + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }, 0); + return this; + } + /** + * Set one or more of yaw, pitch, fov + * + * @param {Object} coordinate yaw, pitch, fov + * @param {Number} duration Animation duration. if it is above 0 then it's animated. + */ + ; + + _proto.lookAt = function lookAt$$1(_ref, duration) { + var yaw = _ref.yaw, + pitch = _ref.pitch, + fov = _ref.fov; + var pos = this.axes.get(); + var y = yaw === undefined ? 0 : yaw - pos.yaw; + var p = pitch === undefined ? 0 : pitch - pos.pitch; + var f = fov === undefined ? 0 : fov - pos.fov; // Allow duration of animation to have more than MC_MAXIMUM_DURATION. + + this.axes.options.maximumDuration = Infinity; + this.axes.setBy({ + yaw: y, + pitch: p, + fov: f + }, duration); + }; + + _proto.getYawPitch = function getYawPitch() { + var yawPitch = this.axes.get(); + return { + yaw: yawPitch.yaw, + pitch: yawPitch.pitch + }; + }; + + _proto.getFov = function getFov() { + return this.axes.get().fov; + }; + + _proto.getQuaternion = function getQuaternion() { + var pos = this.axes.get(); + return this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + }; + + _proto.shouldRenderWithQuaternion = function shouldRenderWithQuaternion() { + return this.options.gyroMode === GYRO_MODE.VR; + } + /** + * Destroys objects + */ + ; + + _proto.destroy = function destroy() { + this.axes && this.axes.destroy(); + this.axisPanInput && this.axisPanInput.destroy(); + this.axesWheelInput && this.axesWheelInput.destroy(); + this.axesTiltMotionInput && this.axesTiltMotionInput.destroy(); + this.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy(); + this.axesPinchInput && this.axesPinchInput.destroy(); + this.axesMoveKeyInput && this.axesMoveKeyInput.destroy(); + this._deviceQuaternion && this._deviceQuaternion.destroy(); + }; + + return YawPitchControl; + }(Component); + + YawPitchControl.VERSION = VERSION; + YawPitchControl.CONTROL_MODE_VR = CONTROL_MODE_VR; + YawPitchControl.CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH; + YawPitchControl.TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL; + YawPitchControl.TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW; + YawPitchControl.TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH; + YawPitchControl.TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE; + return YawPitchControl; + }(); + + var _Promise = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var STATUS = { + "NONE": 0, + "LOADING": 1, + "LOADED": 2, + "ERROR": 3 + }; + var EVENT = { + "READYSTATECHANGE": "readystatechange" + }; + + var ImageLoader = + /*#__PURE__*/ + function () { + var ImageLoader = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(ImageLoader, _Component); + + function ImageLoader(image) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + _this._image = null; + _this._onceHandlers = []; + _this._loadStatus = STATUS.NONE; + image && _this.set(image); + return _this; + } + + var _proto = ImageLoader.prototype; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise(function (res, rej) { + if (!_this2._image) { + rej("ImageLoader: image is not defiend"); + } else if (_this2._loadStatus === STATUS.LOADED) { + res(_this2.getElement()); + } else if (_this2._loadStatus === STATUS.LOADING) { + /* Check isMaybeLoaded() first because there may have + posibilities that image already loaded before get is called. + for example calling get on external image onload callback.*/ + if (ImageLoader.isMaybeLoaded(_this2._image)) { + _this2._loadStatus = STATUS.LOADED; + res(_this2.getElement()); + } else { + _this2.on(EVENT.READYSTATECHANGE, function (e) { + if (e.type === STATUS.LOADED) { + res(_this2.getElement()); + } else { + rej("ImageLoader: failed to load images."); + } + }); + } + } else { + rej("ImageLoader: failed to load images"); + } + }); + } + /** + * @param image img element or img url or array of img element or array of img url + */ + ; + + _proto.set = function set(image) { + var _this3 = this; + + this._loadStatus = STATUS.LOADING; + this._image = ImageLoader.createElement(image); + + if (ImageLoader.isMaybeLoaded(this._image)) { + this._loadStatus = STATUS.LOADED; + return; + } + + this.onceLoaded(this._image, function () { + _this3._loadStatus = STATUS.LOADED; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.LOADED + }); + }, function () { + _this3._loadStatus = STATUS.ERROR; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.ERROR + }); + }); + }; + + ImageLoader.createElement = function createElement(image) { + var images = image instanceof Array ? image : [image]; + return images.map(function (img) { + var _img = img; + + if (typeof img === "string") { + _img = new Image(); + _img.crossOrigin = "anonymous"; + _img.src = img; + } + + return _img; + }); + }; + + _proto.getElement = function getElement() { + return this._image.length === 1 ? this._image[0] : this._image; + }; + + ImageLoader.isMaybeLoaded = function isMaybeLoaded(image) { + var result = false; + + if (image instanceof Image) { + result = image.complete && image.naturalWidth !== 0; + } else if (image instanceof Array) { + result = !image.some(function (img) { + return !img.complete || img.naturalWidth === 0; + }); + } + + return result; + }; + + _proto.onceLoaded = function onceLoaded(target, onload, onerror) { + var _this4 = this; + + var targets = target instanceof Array ? target : [target]; + var targetsNotLoaded = targets.filter(function (img) { + return !ImageLoader.isMaybeLoaded(img); + }); + var loadPromises = targetsNotLoaded.map(function (img) { + return new _Promise(function (res, rej) { + _this4._once(img, "load", function () { + return res(img); + }); + + _this4._once(img, "error", function () { + return rej(img); + }); + }); + }); + + _Promise.all(loadPromises).then(function (result) { + return onload(targets.length === 1 ? targets[0] : targets); + }, function (reason) { + return onerror(reason); + }); + }; + + _proto._once = function _once(target, type, listener) { + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + + target.addEventListener(type, fn); + + this._onceHandlers.push({ + target: target, + type: type, + fn: fn + }); + }; + + _proto.getStatus = function getStatus() { + return this._loadStatus; + }; + + _proto.destroy = function destroy() { + this._onceHandlers.forEach(function (handler) { + handler.target.removeEventListener(handler.type, handler.fn); + }); + + this._onceHandlers = []; + this._image.src = ""; + this._image = null; + this._loadStatus = STATUS.NONE; + }; + + return ImageLoader; + }(Component); + + ImageLoader.STATUS = STATUS; + return ImageLoader; + }(); + + var _Promise$1 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + + // import Agent from "@egjs/agent"; + + /* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */ + var READY_STATUS = { + HAVE_NOTHING: 0, + // no information whether or not the audio/video is ready + HAVE_METADATA: 1, + // HAVE_METADATA - metadata for the audio/video is ready + HAVE_CURRENT_DATA: 2, + // data for the current playback position is available, but not enough data to play next frame/millisecond + HAVE_FUTURE_DATA: 3, + // data for the current and at least the next frame is available + HAVE_ENOUGH_DATA: 4, + // enough data available to start playing + // below is custom status for failed to load status + LOADING_FAILED: -1 + }; + var READYSTATECHANGE_EVENT_NAME = {}; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = "loadedmetadata"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = "loadeddata"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = "canplay"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = "canplaythrough"; + + var VideoLoader = + /*#__PURE__*/ + function () { + function VideoLoader(video) { + this._handlers = []; + this._sourceCount = 0; // on iOS safari, 'loadeddata' will not triggered unless the user hits play, + // so used 'loadedmetadata' instead. + + this._thresholdReadyState = READY_STATUS.HAVE_METADATA; + this._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState]; + this._loadStatus = video && video.readyState || READY_STATUS.HAVE_NOTHING; + this._onerror = this._onerror.bind(this); + video && this.set(video); + } + + var _proto = VideoLoader.prototype; + + _proto._onerror = function _onerror() { + this._errorCount++; + + if (this._errorCount >= this._sourceCount) { + this._loadStatus = READY_STATUS.LOADING_FAILED; + + this._detachErrorHandler(this._onerror); + } + } + /** + * + * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src} + */ + ; + + _proto._appendSourceElement = function _appendSourceElement(videoUrl) { + var videoSrc; + var videoType; + + if (typeof videoUrl === "object") { + videoSrc = videoUrl.src; + videoType = videoUrl.type; + } else if (typeof videoUrl === "string") { + videoSrc = videoUrl; + } + + if (!videoSrc) { + return false; + } + + var sourceElement = document.createElement("source"); + sourceElement.src = videoSrc; + videoType && (sourceElement.type = videoType); + + this._video.appendChild(sourceElement); + + return true; + }; + + _proto.set = function set(video) { + var _this = this; + + this._reset(); // reset resources. + + + if (!video) { + return; + } + + if (video instanceof HTMLVideoElement) { + // video tag + this._video = video; + } else if (typeof video === "string" || typeof video === "object") { + // url + this._video = document.createElement("video"); + + this._video.setAttribute("crossorigin", "anonymous"); + + this._video.setAttribute("webkit-playsinline", ""); + + this._video.setAttribute("playsinline", ""); + + if (video instanceof Array) { + video.forEach(function (v) { + return _this._appendSourceElement(v); + }); + } else { + this._appendSourceElement(video); + } + + this._sourceCount = this._video.querySelectorAll("source").length; + + if (this._sourceCount > 0) { + if (this._video.readyState < this._thresholdReadyState) { + this._video.load(); // attach loading error listener + + + this._attachErrorHandler(this._onerror); + } + } else { + this._video = null; + } + } + }; + + _proto._attachErrorHandler = function _attachErrorHandler(handler) { + this._video.addEventListener("error", handler); + + this._sources = this._video.querySelectorAll("source"); + [].forEach.call(this._sources, function (source) { + source.addEventListener("error", handler); + }); + }; + + _proto._detachErrorHandler = function _detachErrorHandler(handler) { + this._video.removeEventListener("error", handler); + + [].forEach.call(this._sources, function (source) { + source.removeEventListener("error", handler); + }); + }; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise$1(function (res, rej) { + if (!_this2._video) { + rej("VideoLoader: video is undefined"); + } else if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + rej("VideoLoader: video source is invalid"); + } else if (_this2._video.readyState >= _this2._thresholdReadyState) { + res(_this2._video); + } else { + // check errorCnt and reject + var rejector = function rejector() { + if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + _this2._detachErrorHandler(rejector); + + rej("VideoLoader: video source is invalid"); + } + }; + + _this2._attachErrorHandler(rejector); + + _this2._once(_this2._thresholdEventName, function () { + return res(_this2._video); + }); + } + }); + }; + + _proto.getElement = function getElement() { + return this._video; + }; + + _proto.destroy = function destroy() { + this._reset(); + }; + + _proto._reset = function _reset() { + var _this3 = this; + + this._handlers.forEach(function (handler) { + _this3._video.removeEventListener(handler.type, handler.fn); + }); + + this._handlers = []; + this._video = null; + this._sourceCount = 0; + this._errorCount = 0; + }; + + _proto._once = function _once(type, listener) { + var target = this._video; + + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + /* By useCapture mode enabled, you can capture the error event being fired on source(child)*/ + + + target.addEventListener(type, fn, true); + + this._handlers.push({ + type: type, + fn: fn + }); + }; + + return VideoLoader; + }(); + + var WEBGL_ERROR_CODE = { + "0": "NO_ERROR", + "1280": "INVALID_ENUM", + "1281": "INVALID_VALUE", + "1282": "INVALID_OPERATION", + "1285": "OUT_OF_MEMORY", + "1286": "INVALID_FRAMEBUFFER_OPERATION", + "37442": "CONTEXT_LOST_WEBGL" + }; + var webglAvailability = null; + var MAX_TEXTURE_SIZE_FOR_TEST = null; + + var WebGLUtils = + /*#__PURE__*/ + function () { + function WebGLUtils() {} + + WebGLUtils.createShader = function createShader(gl, type, source) { + var shader = gl.createShader(type); + gl.shaderSource(shader, source); + gl.compileShader(shader); + var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS); + + if (success) { + return shader; + } else { + // eslint-disable-next-line + console.error(gl.getShaderInfoLog(shader)); + } + + return null; + }; + + WebGLUtils.createProgram = function createProgram(gl, vertexShader, fragmentShader) { + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + gl.linkProgram(program); + gl.detachShader(program, vertexShader); + gl.detachShader(program, fragmentShader); + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + var success = gl.getProgramParameter(program, gl.LINK_STATUS); + + if (success) { + return program; + } + + gl.deleteProgram(program); + return null; + }; + + WebGLUtils.initBuffer = function initBuffer(gl, target + /* bind point */ + , data, itemSize, attr) { + var buffer = gl.createBuffer(); + gl.bindBuffer(target, buffer); + gl.bufferData(target, data, gl.STATIC_DRAW); + + if (buffer) { + buffer.itemSize = itemSize; + buffer.numItems = data.length / itemSize; + } + + if (attr !== undefined) { + gl.enableVertexAttribArray(attr); + gl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0); + } + + return buffer; + }; + + WebGLUtils.getWebglContext = function getWebglContext(canvas, userContextAttributes) { + var webglIdentifiers = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"]; + var context = null; + + var contextAttributes = _extends({ + preserveDrawingBuffer: false, + antialias: false, + xrCompatible: true + }, userContextAttributes); + + function onWebglcontextcreationerror(e) { + return e.statusMessage; + } + + canvas.addEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + + for (var i = 0; i < webglIdentifiers.length; i++) { + try { + context = canvas.getContext(webglIdentifiers[i], contextAttributes); + } catch (t) {} + + if (context) { + break; + } + } + + canvas.removeEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + return context; + }; + + WebGLUtils.createTexture = function createTexture(gl, textureTarget) { + var texture = gl.createTexture(); + gl.bindTexture(textureTarget, texture); + gl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.bindTexture(textureTarget, null); + return texture; + } + /** + * Returns the webgl availability of the current browser. + * @method WebGLUtils#isWebGLAvailable + * @retuen {Boolean} isWebGLAvailable + */ + ; + + WebGLUtils.isWebGLAvailable = function isWebGLAvailable() { + if (webglAvailability === null) { + var canvas = document.createElement("canvas"); + var webglContext = WebGLUtils.getWebglContext(canvas); + webglAvailability = !!webglContext; // webglContext Resource forced collection + + if (webglContext) { + var loseContextExtension = webglContext.getExtension("WEBGL_lose_context"); + loseContextExtension && loseContextExtension.loseContext(); + } + } + + return webglAvailability; + } + /** + * Returns whether webgl is stable in the current browser. + * @method WebGLUtils#isStableWebGL + * @retuen {Boolean} isStableWebGL + */ + ; + + WebGLUtils.isStableWebGL = function isStableWebGL() { + var agentInfo = agent(); + var isStableWebgl = true; + + if (agentInfo.os.name === "android") { + var version = parseFloat(agentInfo.os.version); + + if (version <= 4.3) { + isStableWebgl = false; + } else if (version === 4.4) { + if (agentInfo.browser.name !== "chrome") { + isStableWebgl = false; + } + } + } + + return isStableWebgl; + }; + + WebGLUtils.getErrorNameFromWebGLErrorCode = function getErrorNameFromWebGLErrorCode(code) { + if (!(code in WEBGL_ERROR_CODE)) { + return "UNKNOWN_ERROR"; + } + + return WEBGL_ERROR_CODE[code]; + } + /** + * This function is wrapper for texImage2D to handle exceptions on texImage2D. + * Purpose is to prevent service from being stopped by script error. + * + * @param {*} gl + * @param {*} target + * @param {*} pixels + */ + ; + + WebGLUtils.texImage2D = function texImage2D(gl, target, pixels) { + try { + gl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + } catch (error) { + /* eslint-disable no-console */ + console.error("WebGLUtils.texImage2D error:", error); + /* eslint-enable no-console */ + } + }; + + WebGLUtils.getMaxTextureSize = function getMaxTextureSize(gl) { + // WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test + return MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE); + }; + + return WebGLUtils; + }(); + + var agent$3 = agent(); + var isIE11 = agent$3.browser.name === "ie" && agent$3.browser.majorVersion === 11; + var EVENTS = { + ERROR: "error" + }; + /** + * + * Extends Component for firing errors occurs internally. + */ + + var Renderer = + /*#__PURE__*/ + function () { + var Renderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(Renderer, _Component); + + function Renderer() { + var _this; + + _this = _Component.call(this) || this; + _this._forceDimension = null; + _this._pixelCanvas = null; + _this._pixelContext = null; + return _this; + } + + var _proto = Renderer.prototype; + + _proto.render = function render(_ref) { + var gl = _ref.gl, + shaderProgram = _ref.shaderProgram, + indexBuffer = _ref.indexBuffer, + mvMatrix = _ref.mvMatrix, + pMatrix = _ref.pMatrix; + gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix); + gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix); + + if (indexBuffer) { + gl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0); + } + } // Define interface for Renderers + + /** + * Following MUST BE DEFINED on Child of Renderer + * + * DATA + * + * - getVertexPositionData + * - getIndexData + * - getTextureCoordData + * + * SOURCE + * + * - getVertexShaderSource + * - getFragmentShaderSource + * + * TEXTURE + * + * - bindTexture + */ + ; + + _proto.getDimension = function getDimension(pixelSource) { + var width = pixelSource.naturalWidth || pixelSource.videoWidth; + var height = pixelSource.naturalHeight || pixelSource.videoHeight; + return { + width: width, + height: height + }; + } + /** + * Update data used by shader + * - + * + * + * @param {*} param + */ + ; + + _proto.updateShaderData = function updateShaderData(param) {} + /* + * Update following data in implementation layer. + * If the data is not changed, it does not need to implement this function. + * + * - _VERTEX_POSITION_DATA + * - _TEXTURE_COORD_DATA + * - _INDEX_DATA + */ + + /** + * + * @param {HTMLImageElement | HTMLVideoElement} image + * @param {Object = {width, height}} forceDimension Forced dimension to resize + */ + ; + + _proto._initPixelSource = function _initPixelSource(image, forceDimension) { + var isIE11Video = isIE11 && image instanceof HTMLVideoElement; + + if (isIE11Video || forceDimension) { + var _ref2 = forceDimension || this.getDimension(image), + width = _ref2.width, + height = _ref2.height; + + this._pixelCanvas = document.createElement("canvas"); + this._pixelCanvas.width = width; + this._pixelCanvas.height = height; + this._pixelContext = this._pixelCanvas.getContext("2d"); + } + + this._forceDimension = forceDimension; + }; + + _proto._getPixelSource = function _getPixelSource(image) { + if (!this._pixelCanvas) { + return image; + } + /** + * IE11 && Video + * or + * Dimension is forced (Image is larger than texture size.) + */ + + + var contentDimension = this.getDimension(image); + var textureDimension = this._forceDimension || contentDimension; + + if (this._pixelCanvas.width !== textureDimension.width) { + this._pixelCanvas.width = textureDimension.width; + } + + if (this._pixelCanvas.height !== textureDimension.height) { + this._pixelCanvas.height = textureDimension.height; + } + + if (this._forceDimension) { + this._pixelContext.drawImage(image, 0, 0, contentDimension.width, contentDimension.height, 0, 0, textureDimension.width, textureDimension.height); + } else { + this._pixelContext.drawImage(image, 0, 0); + } + + return this._pixelCanvas; + }; + + _proto._extractTileConfig = function _extractTileConfig(imageConfig) { + var tileConfig = Array.isArray(imageConfig.tileConfig) ? imageConfig.tileConfig : Array.apply(void 0, Array(6)).map(function () { + return imageConfig.tileConfig; + }); + tileConfig = tileConfig.map(function (config) { + return _extends({ + flipHorizontal: false, + rotation: 0 + }, config); + }); + return tileConfig; + }; + + _proto._triggerError = function _triggerError(error) { + /* eslint-disable no-console */ + console.error("Renderer Error:", error); + /* eslint-enable no-console */ + + this.trigger(EVENTS.ERROR, { + message: typeof error === "string" ? error : error.message + }); + }; + + return Renderer; + }(Component); + + Renderer.EVENTS = EVENTS; + return Renderer; + }(); + + var CubeRenderer = + /*#__PURE__*/ + function () { + var CubeRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeRenderer, _Renderer); + + function CubeRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + CubeRenderer._VERTEX_POSITION_DATA = CubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // top + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // bottom + 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + return CubeRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + if (CubeRenderer._INDEX_DATA) { + return CubeRenderer._INDEX_DATA; + } + + var indexData = []; + var vertexPositionData = this.getVertexPositionData(); + + for (var i = 0; i < vertexPositionData.length / 3; i += 4) { + indexData.push(i, i + 2, i + 1, i, i + 3, i + 2); + } + + CubeRenderer._INDEX_DATA = indexData; + return indexData; + }; + + CubeRenderer.extractOrder = function extractOrder(imageConfig) { + return imageConfig.order || "RLUDBF"; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var vertexOrder = "BFUDRL"; + var order = CubeRenderer.extractOrder(imageConfig); + var base = this.getVertexPositionData(); + + var tileConfig = this._extractTileConfig(imageConfig); + + var elemSize = 3; + var vertexPerTile = 4; + var textureCoordData = vertexOrder.split("").map(function (face) { + return tileConfig[order.indexOf(face)]; + }).map(function (config, i) { + var rotation = parseInt(config.rotation / 90, 10); + var ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2]; + + for (var r = 0; r < Math.abs(rotation); r++) { + if (config.flipHorizontal && rotation > 0 || !config.flipHorizontal && rotation < 0) { + ordermap_.push(ordermap_.shift()); + } else { + ordermap_.unshift(ordermap_.pop()); + } + } + + var elemPerTile = elemSize * vertexPerTile; + var tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile); + var tileTemp = []; + + for (var j = 0; j < vertexPerTile; j++) { + tileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize); + } + + return tileTemp; + }).join().split(",").map(function (v) { + return parseInt(v, 10); + }); + return textureCoordData; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image, imageConfig) { + var baseOrder = "RLUDBF"; + var order = CubeRenderer.extractOrder(imageConfig); + var orderMap = {}; + order.split("").forEach(function (v, i) { + orderMap[v] = i; + }); + + try { + if (image instanceof Array) { + for (var surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) { + var tileIdx = orderMap[baseOrder[surfaceIdx]]; + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]); + } + } else { + var maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image); + + for (var _surfaceIdx = 0; _surfaceIdx < 6; _surfaceIdx++) { + var _tileIdx = orderMap[baseOrder[_surfaceIdx]]; + var tile = this.extractTileFromImage(image, _tileIdx, maxCubeMapTextureSize); + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + _surfaceIdx, tile); + } + } + } catch (e) { + this._triggerError(e); + } + }; + + _proto.bindTexture = function bindTexture(gl, texture, image, imageConfig) { + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + this.updateTexture(gl, image, imageConfig); + }; + + _proto.getSourceTileSize = function getSourceTileSize(image) { + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var aspectRatio = width / height; + var inputTextureSize; + + if (aspectRatio === 1 / 6) { + inputTextureSize = width; + } else if (aspectRatio === 6) { + inputTextureSize = height; + } else if (aspectRatio === 2 / 3) { + inputTextureSize = width / 2; + } else { + inputTextureSize = width / 3; + } + + return inputTextureSize; + }; + + _proto.extractTileFromImage = function extractTileFromImage(image, tileIdx, outputTextureSize) { + var _this$getDimension2 = this.getDimension(image), + width = _this$getDimension2.width; + + var inputTextureSize = this.getSourceTileSize(image); + var canvas = document.createElement("canvas"); + canvas.width = outputTextureSize; + canvas.height = outputTextureSize; + var context = canvas.getContext("2d"); + var tilePerRow = width / inputTextureSize; + var x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow); + var y = parseInt(tileIdx / tilePerRow, 10) * inputTextureSize; + context.drawImage(image, x, y, inputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize); + return canvas; + }; + + _proto.getMaxCubeMapTextureSize = function getMaxCubeMapTextureSize(gl, image) { + var agent$$1 = agent(); + var maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); + + var _imageWidth = this.getSourceTileSize(image); + + if (agent$$1.browser.name === "ie" && agent$$1.browser.majorVersion === 11) { + if (!util.isPowerOfTwo(_imageWidth)) { + for (var i = 1; i < maxCubeMapTextureSize; i *= 2) { + if (i < _imageWidth) { + continue; + } else { + _imageWidth = i; + break; + } + } + } + } + + if (agent$$1.os.name === "ios") { + var majorVersion = agent$$1.os.majorVersion; // ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다. + + if (majorVersion === 9) { + _imageWidth = 1024; + } // ios 8 의 경우 텍스쳐 최대사이즈는 512 이다. + + + if (majorVersion === 8) { + _imageWidth = 512; + } + } // maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수 + + + return Math.min(maxCubeMapTextureSize, _imageWidth); + }; + + return CubeRenderer; + }(Renderer); + + CubeRenderer._VERTEX_POSITION_DATA = null; + CubeRenderer._INDEX_DATA = null; + return CubeRenderer; + }(); + + var CubeStripRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeStripRenderer, _Renderer); + + function CubeStripRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeStripRenderer.prototype; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"; + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + if (!this._vertices) { + this._vertices = [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // up + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // down + -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + } + + return this._vertices; + }; + + _proto.getIndexData = function getIndexData() { + var _this = this; + + // TODO: 한번만 계산하도록 수정하기 + var indices = function () { + var indexData = []; + + for (var i = 0; i < _this._vertices.length / 3; i += 4) { + indexData.push(i, i + 1, i + 2, i, i + 2, i + 3); + } + + return indexData; + }(); + + return indices; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var _this2 = this; + + // TODO: make it cols, rows as config. + var cols = 3; + var rows = 2; + var order = imageConfig.order || "RLUDFB"; + var coords = []; // 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다. + + for (var r = rows - 1; r >= 0; r--) { + for (var c = 0; c < cols; c++) { + var coord = [c / cols, r / rows, (c + 1) / cols, r / rows, (c + 1) / cols, (r + 1) / rows, c / cols, (r + 1) / rows]; + coords.push(coord); + } + } + + var tileConfigs = this._extractTileConfig(imageConfig); // Transform Coord By Flip & Rotation + + + coords = coords // shrink coord to avoid pixel bleeding + .map(function (coord) { + return _this2._shrinkCoord(coord); + }).map(function (coord, i) { + return _this2._transformCoord(coord, tileConfigs[i]); + }); // vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치 + + return "BFUDRL".split("").map(function (face) { + return order.indexOf(face); + }).map(function (index) { + return coords[index]; + }).reduce(function (acc, val) { + return acc.concat(val); + }, []); + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto._transformCoord = function _transformCoord(coord, tileConfig) { + var newCoord = coord.slice(); + + if (tileConfig.flipHorizontal) { + newCoord = this._flipHorizontalCoord(newCoord); + } + + if (tileConfig.rotation) { + newCoord = this._rotateCoord(newCoord, tileConfig.rotation); + } + + return newCoord; + }; + + _proto._shrinkCoord = function _shrinkCoord(coord) { + var SHRINK_Y = 0.00; + var SHRINK_X = 0.00; + return [coord[0] + SHRINK_X, coord[1] + SHRINK_Y, coord[2] - SHRINK_X, coord[3] + SHRINK_Y, coord[4] - SHRINK_X, coord[5] - SHRINK_Y, coord[6] + SHRINK_X, coord[7] - SHRINK_Y]; + }; + + _proto._rotateCoord = function _rotateCoord(coord, rotationAngle) { + var SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord. + + var shiftCount = parseInt(rotationAngle / 90, 10) % 4; + + if (shiftCount === 0) { + return coord; + } + + var moved; + var rotatedCoord = []; + + if (shiftCount > 0) { + moved = coord.splice(0, shiftCount * SIZE); + rotatedCoord = coord.concat(moved); + } else { + moved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE); + rotatedCoord = moved.concat(coord); + } + + return rotatedCoord; + }; + + _proto._flipHorizontalCoord = function _flipHorizontalCoord(coord) { + return [coord[2], coord[3], coord[0], coord[1], coord[6], coord[7], coord[4], coord[5]]; + }; + + return CubeStripRenderer; + }(Renderer); + + /** + * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide}) + * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고) + * @namespace + * @name GYRO_MODE + * @memberof eg.view360.PanoViewer + */ + /** + * Constant value for errors + * @ko 에러에 대한 상수 값 + * @namespace + * @name ERROR_TYPE + * @memberof eg.view360.PanoViewer + */ + + var ERROR_TYPE = { + /** + * Unsupported device + * @ko 미지원 기기 + * @name INVALID_DEVICE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 10 + */ + INVALID_DEVICE: 10, + + /** + * Webgl not support + * @ko WEBGL 미지원 + * @name NO_WEBGL + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 11 + */ + NO_WEBGL: 11, + + /** + * Failed to load image + * @ko 이미지 로드 실패 + * @name FAIL_IMAGE_LOAD + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 12 + */ + FAIL_IMAGE_LOAD: 12, + + /** + * Failed to bind texture + * @ko 텍스쳐 바인딩 실패 + * @name FAIL_BIND_TEXTURE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 13 + */ + FAIL_BIND_TEXTURE: 13, + + /** + * Only one resource(image or video) should be specified + * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * @name INVALID_RESOURCE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 14 + */ + INVALID_RESOURCE: 14, + + /** + * WebGL context lost occurred + * @ko WebGL context lost 발생 + * @name RENDERING_CONTEXT_LOST + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 15 + */ + RENDERING_CONTEXT_LOST: 15 + }; + /** + * Constant value for events + * @ko 이벤트에 대한 상수 값 + * @namespace + * @name EVENTS + * @memberof eg.view360.PanoViewer + */ + + var EVENTS$1 = { + /** + * Events that is fired when PanoViewer is ready to show image and handle user interaction. + * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트 + * @name READY + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default ready + */ + READY: "ready", + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name VIEW_CHANGE + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default viewChange + */ + VIEW_CHANGE: "viewChange", + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name ANIMATION_END + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default animationEnd + */ + ANIMATION_END: "animationEnd", + + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name ERROR + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default error + */ + ERROR: "error" + }; + /** + * Constant value for projection type + * @ko 프로젝션 타입 대한 상수 값 + * @namespace + * @name PROJECTION_TYPE + * @memberof eg.view360.PanoViewer + */ + + var PROJECTION_TYPE = { + /** + * Constant value for equirectangular type. + * @ko equirectangular 에 대한 상수 값. + * @name EQUIRECTANGULAR + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default equirectangular + */ + EQUIRECTANGULAR: "equirectangular", + + /** + * Constant value for cubemap type. + * @ko cubemap 에 대한 상수 값. + * @name CUBEMAP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubemap + */ + CUBEMAP: "cubemap", + + /** + * Constant value for cubestrip type. + * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC. + * + * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다. + * @name CUBESTRIP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubestrip + */ + CUBESTRIP: "cubestrip", + + /** + * Constant value for PANORAMA type. + * + * PANORAMA is a format for a panorma image which is taken from smartphone. + * + * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다. + * + * @name PANORAMA + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default panorama + */ + PANORAMA: "panorama", + + /** + * Constant value for EQUI_STEREOSCOPY type. + * + * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present. + * + * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다. + * + * @name STEREOSCOPIC_EQUI + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default stereoequi + */ + STEREOSCOPIC_EQUI: "stereoequi" + }; + /** + * A constant value for the format of the stereoscopic equirectangular projection type. + * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값 + * @namespace + * @name STEREO_FORMAT + * @memberof eg.view360.PanoViewer + */ + + var STEREO_FORMAT = { + /** + * A constant value for format of top bottom stereoscopic 360 equirectangular projection. + * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name TOP_BOTTOM + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dv" + */ + TOP_BOTTOM: "3dv", + + /** + * A constant value for format of left right stereoscopic 360 equirectangular projection. + * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name LEFT_RIGHT + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dh" + */ + LEFT_RIGHT: "3dh", + + /** + * A constant value specifying media is not in stereoscopic format. + * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값. + * @name NONE + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "" + */ + NONE: "" + }; + + var latitudeBands = 60; + var longitudeBands = 60; + var radius = 2; + var ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI; + var textureCoordData = []; + var vertexPositionData = []; + var indexData = []; + var latIdx; + var lngIdx; + + for (latIdx = 0; latIdx <= latitudeBands; latIdx++) { + var theta = (latIdx / latitudeBands - 0.5) * Math.PI; + var sinTheta = Math.sin(theta); + var cosTheta = Math.cos(theta); + + for (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) { + var phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN; + var sinPhi = Math.sin(phi); + var cosPhi = Math.cos(phi); + var x = cosPhi * cosTheta; + var y = sinTheta; + var z = sinPhi * cosTheta; + var u = lngIdx / longitudeBands; + var v = latIdx / latitudeBands; + textureCoordData.push(u, v); + vertexPositionData.push(radius * x, radius * y, radius * z); + + if (lngIdx !== longitudeBands && latIdx !== latitudeBands) { + var a = latIdx * (longitudeBands + 1) + lngIdx; + var b = a + longitudeBands + 1; + indexData.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + + var SphereRenderer = + /*#__PURE__*/ + function () { + var SphereRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(SphereRenderer, _Renderer); + + function SphereRenderer(format) { + var _this; + + _this = _Renderer.call(this) || this; + _this._stereoFormat = format; + return _this; + } + + var _proto = SphereRenderer.prototype; + + _proto.render = function render(ctx) { + var gl = ctx.gl, + shaderProgram = ctx.shaderProgram; + var leftEyeScaleOffset; + var rightEyeScaleOffset; + + switch (this._stereoFormat) { + case STEREO_FORMAT.TOP_BOTTOM: + leftEyeScaleOffset = [1, 0.5, 0, 0]; + rightEyeScaleOffset = [1, 0.5, 0, 0.5]; + break; + + case STEREO_FORMAT.LEFT_RIGHT: + leftEyeScaleOffset = [0.5, 1, 0, 0]; + rightEyeScaleOffset = [0.5, 1, 0.5, 0]; + break; + + default: + leftEyeScaleOffset = [1, 1, 0, 0]; + rightEyeScaleOffset = [1, 1, 0, 0]; + } + + var uTexScaleOffset = gl.getUniformLocation(shaderProgram, "uTexScaleOffset"); + gl.uniform4fv(uTexScaleOffset, [].concat(leftEyeScaleOffset, rightEyeScaleOffset)); + + _Renderer.prototype.render.call(this, ctx); + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + return SphereRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return SphereRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return SphereRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + return SphereRenderer; + }(Renderer); + + SphereRenderer._VERTEX_POSITION_DATA = vertexPositionData; + SphereRenderer._TEXTURE_COORD_DATA = textureCoordData; + SphereRenderer._INDEX_DATA = indexData; + return SphereRenderer; + }(); + + var MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6; + var longitudeBands$1 = 60; + var textureCoordData$1 = []; + var vertexPositionData$1 = []; + var indexData$1 = []; + + var CylinderRenderer = + /*#__PURE__*/ + function () { + var CylinderRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CylinderRenderer, _Renderer); + + function CylinderRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CylinderRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + return CylinderRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return CylinderRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return CylinderRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + var resizeDimension; + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device texture limit(" + maxSize + "))"); // Request resizing texture. + + /** + * TODO: Is it need to apply on another projection type? + */ + + + resizeDimension = width > height ? { + width: maxSize, + height: maxSize * height / width + } : { + width: maxSize * width / height, + height: maxSize + }; + } // Pixel Source for IE11 & Video or resizing needed + + + this._initPixelSource(image, resizeDimension); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto.updateShaderData = function updateShaderData(_ref) { + var _ref$imageAspectRatio = _ref.imageAspectRatio, + imageAspectRatio = _ref$imageAspectRatio === void 0 ? MIN_ASPECT_RATIO_FOR_FULL_PANORAMA : _ref$imageAspectRatio; + var lngIdx; + var cylinderMaxRadian; + var halfCylinderY; + var rotated; + var aspectRatio; // Exception case: orientation is rotated. + + if (imageAspectRatio < 1) { + /** + * If rotated is true, we assume that image is rotated counter clockwise. + * TODO: If there's other rotation, it is need to implement by each rotation. + */ + rotated = true; + aspectRatio = 1 / imageAspectRatio; + } else { + rotated = false; + aspectRatio = imageAspectRatio; + } + + if (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) { + var fov = 360 / aspectRatio; + cylinderMaxRadian = 2 * Math.PI; // 360 deg + + halfCylinderY = Math.tan(toRadian(fov / 2)); + } else { + cylinderMaxRadian = aspectRatio; + halfCylinderY = 0.5; // Range of cylinder is [-0.5, 0.5] to make height to 1. + } // intialize shader data before update + + + textureCoordData$1.length = 0; + vertexPositionData$1.length = 0; + indexData$1.length = 0; + var CYLIDER_Y = [-halfCylinderY, halfCylinderY]; + var startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360) + // console.log("cylinderMaxRadian:", glMatrix.toDegree(cylinderMaxRadian), "CYLIDER_Y", CYLIDER_Y, "start angle", glMatrix.toDegree(startAngleForCenterAlign)); + + for (var yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength + /* bottom & top */ + ; yIdx++) { + for (lngIdx = 0; lngIdx <= longitudeBands$1; lngIdx++) { + var angle$$1 = startAngleForCenterAlign + lngIdx / longitudeBands$1 * cylinderMaxRadian; + var x = Math.cos(angle$$1); + var y = CYLIDER_Y[yIdx]; + var z = Math.sin(angle$$1); + var u = void 0; + var v = void 0; + + if (rotated) { + // Rotated 90 degree (counter clock wise) + u = 1 - yIdx; // yLength - yIdx; + + v = lngIdx / longitudeBands$1; + } else { + // // Normal case (Not rotated) + u = lngIdx / longitudeBands$1; + v = yIdx; + } + + textureCoordData$1.push(u, v); + vertexPositionData$1.push(x, y, z); + + if (yIdx === 0 && lngIdx < longitudeBands$1) { + var a = lngIdx; + var b = a + longitudeBands$1 + 1; + indexData$1.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + }; + + return CylinderRenderer; + }(Renderer); + + CylinderRenderer._VERTEX_POSITION_DATA = vertexPositionData$1; + CylinderRenderer._TEXTURE_COORD_DATA = textureCoordData$1; + CylinderRenderer._INDEX_DATA = indexData$1; + return CylinderRenderer; + }(); + + var _Promise$2 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var VR_DISPLAY_PRESENT_CHANGE = "vrdisplaypresentchange"; + var DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1]; + var DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1]; + var EYES = { + LEFT: "left", + RIGHT: "right" + }; + + var VRManager = + /*#__PURE__*/ + function () { + var VRManager = + /*#__PURE__*/ + function () { + _createClass(VRManager, [{ + key: "context", + get: function get() { + return this._vrDisplay; + } + }]); + + function VRManager() { + var _this = this; + + this.destroy = function () { + var vrDisplay = _this._vrDisplay; + + _this.removeEndCallback(_this.destroy); + + if (vrDisplay && vrDisplay.isPresenting) { + vrDisplay.exitPresent(); + } + + _this._clear(); + }; + + this._frameData = new window.VRFrameData(); + + this._clear(); + } + + var _proto = VRManager.prototype; + + _proto.canRender = function canRender() { + return Boolean(this._vrDisplay); + }; + + _proto.beforeRender = function beforeRender(gl) { + // Render to the default backbuffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + }; + + _proto.afterRender = function afterRender() { + this._vrDisplay.submitFrame(); + }; + + _proto.getEyeParams = function getEyeParams(gl) { + var display = this._vrDisplay; + var halfWidth = gl.drawingBufferWidth * 0.5; + var height = gl.drawingBufferHeight; + var frameData = this._frameData; + display.getFrameData(frameData); + var leftMVMatrix = frameData.leftViewMatrix; + var rightMVMatrix = frameData.rightViewMatrix; + rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset); + rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset); + return [{ + viewport: [0, 0, halfWidth, height], + mvMatrix: leftMVMatrix, + pMatrix: frameData.leftProjectionMatrix + }, { + viewport: [halfWidth, 0, halfWidth, height], + mvMatrix: rightMVMatrix, + pMatrix: frameData.rightProjectionMatrix + }]; + }; + + _proto.isPresenting = function isPresenting() { + return Boolean(this._vrDisplay && this._vrDisplay.isPresenting); + }; + + _proto.addEndCallback = function addEndCallback(callback) { + window.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + window.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.requestPresent = function requestPresent(canvas) { + var _this2 = this; + + return new _Promise$2(function (resolve, reject) { + navigator.getVRDisplays().then(function (displays) { + var vrDisplay = displays.length && displays[0]; + + if (!vrDisplay) { + reject(new Error("No displays available.")); + return; + } + + if (!vrDisplay.capabilities.canPresent) { + reject(new Error("Display lacking capability to present.")); + return; + } + + vrDisplay.requestPresent([{ + source: canvas + }]).then(function () { + var leftEye = vrDisplay.getEyeParameters(EYES.LEFT); + var rightEye = vrDisplay.getEyeParameters(EYES.RIGHT); + canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2; + canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight); + + _this2._setDisplay(vrDisplay); + + resolve(); + }); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setDisplay = function _setDisplay(vrDisplay) { + this._vrDisplay = vrDisplay; + var layers = vrDisplay.getLayers(); + + if (layers.length) { + var layer = layers[0]; + this._leftBounds = layer.leftBounds; + this._rightBounds = layer.rightBounds; + } + + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._vrDisplay = null; + this._leftBounds = DEFAULT_LEFT_BOUNDS; + this._rightBounds = DEFAULT_RIGHT_BOUNDS; + this._yawOffset = 0; + }; + + return VRManager; + }(); + + return VRManager; + }(); + + var XR_REFERENCE_SPACE = "local"; + + var XRManager = + /*#__PURE__*/ + function () { + var XRManager = + /*#__PURE__*/ + function () { + _createClass(XRManager, [{ + key: "context", + get: function get() { + return this._xrSession; + } + }]); + + function XRManager() { + var _this = this; + + this.destroy = function () { + var xrSession = _this._xrSession; + + _this.removeEndCallback(_this.destroy); + + if (xrSession) { + // Capture to avoid errors + xrSession.end().then(function () {}, function () {}); + } + + _this._clear(); + }; + + this._clear(); + } + + var _proto = XRManager.prototype; + + _proto.canRender = function canRender(frame) { + var pose = frame.getViewerPose(this._xrRefSpace); + return Boolean(pose); + }; + + _proto.beforeRender = function beforeRender(gl, frame) { + var session = frame.session; + var baseLayer = session.renderState.baseLayer; + gl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer); + }; + + _proto.afterRender = function afterRender() {}; + + _proto.getEyeParams = function getEyeParams(gl, frame) { + var _this2 = this; + + var session = frame.session; + var pose = frame.getViewerPose(this._xrRefSpace); + + if (!pose) { + // Can't render + return null; + } + + var glLayer = session.renderState.baseLayer; + return pose.views.map(function (view) { + var viewport = glLayer.getViewport(view); + var mvMatrix = view.transform.inverse.matrix; + + if (IS_SAFARI_ON_DESKTOP) { + rotateX(mvMatrix, mvMatrix, toRadian(180)); + } + + rotateY(mvMatrix, mvMatrix, _this2._yawOffset); + return { + viewport: [viewport.x, viewport.y, viewport.width, viewport.height], + mvMatrix: mvMatrix, + pMatrix: view.projectionMatrix + }; + }); + }; + + _proto.isPresenting = function isPresenting() { + return this._presenting; + }; + + _proto.addEndCallback = function addEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.addEventListener("end", callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.removeEventListener("end", callback); + }; + + _proto.requestPresent = function requestPresent(canvas, gl) { + var _this3 = this; + + return navigator.xr.requestSession("immersive-vr", { + requiredFeatures: [XR_REFERENCE_SPACE] + }).then(function (session) { + var xrLayer = new window.XRWebGLLayer(session, gl); + session.updateRenderState({ + baseLayer: xrLayer + }); + return session.requestReferenceSpace(XR_REFERENCE_SPACE).then(function (refSpace) { + _this3._setSession(session, xrLayer, refSpace); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setSession = function _setSession(session, xrLayer, refSpace) { + this._xrSession = session; + this._xrLayer = xrLayer; + this._xrRefSpace = refSpace; + this._presenting = true; + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._xrSession = null; + this._xrLayer = null; + this._xrRefSpace = null; + this._presenting = false; + this._yawOffset = 0; + }; + + return XRManager; + }(); + + return XRManager; + }(); + + var WebGLAnimator = + /*#__PURE__*/ + function () { + var WebGLAnimator = + /*#__PURE__*/ + function () { + function WebGLAnimator() { + var _this = this; + + this._onLoop = function () { + _this._callback.apply(_this, arguments); + + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + }; + + this._onLoopNextTick = function () { + var before = performance.now(); + + _this._callback.apply(_this, arguments); + + var diff = performance.now() - before; + + if (_this._rafTimer >= 0) { + clearTimeout(_this._rafTimer); + _this._rafTimer = -1; + } + /** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */ + + + if (diff < 16) { + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + } else { + /** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/ + _this._rafTimer = setTimeout(_this._onLoop, 0); + } + }; + + this._callback = null; + this._context = window; + this._rafId = -1; + this._rafTimer = -1; + } + + var _proto = WebGLAnimator.prototype; + + _proto.setCallback = function setCallback(callback) { + this._callback = callback; + }; + + _proto.setContext = function setContext(context) { + this._context = context; + }; + + _proto.start = function start() { + var context = this._context; + var callback = this._callback; // No context / callback set + + if (!context || !callback) return; // Animation already started + + if (this._rafId >= 0 || this._rafTimer >= 0) return; + + if (IS_SAFARI_ON_DESKTOP) { + this._rafId = context.requestAnimationFrame(this._onLoopNextTick); + } else { + this._rafId = context.requestAnimationFrame(this._onLoop); + } + }; + + _proto.stop = function stop() { + if (this._rafId >= 0) { + this._context.cancelAnimationFrame(this._rafId); + } + + if (this._rafTimer >= 0) { + clearTimeout(this._rafTimer); + } + + this._rafId = -1; + this._rafTimer = -1; + } + /** + * There can be more than 1 argument when we use XRSession's raf + */ + ; + + return WebGLAnimator; + }(); + + return WebGLAnimator; + }(); + + var _Promise$3 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var ImageType = PROJECTION_TYPE; + var DEVICE_PIXEL_RATIO = devicePixelRatio || 1; // DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다. + + if (DEVICE_PIXEL_RATIO > 2) { + DEVICE_PIXEL_RATIO = 2; + } // define custom events name + + /** + * TODO: how to manage events/errortype with PanoViewer + * + * I think renderer events should be seperated from viewer events although it has same name. + */ + + + var EVENTS$2 = { + BIND_TEXTURE: "bindTexture", + IMAGE_LOADED: "imageLoaded", + ERROR: "error", + RENDERING_CONTEXT_LOST: "renderingContextLost", + RENDERING_CONTEXT_RESTORE: "renderingContextRestore" + }; + var ERROR_TYPE$1 = { + INVALID_DEVICE: 10, + NO_WEBGL: 11, + FAIL_IMAGE_LOAD: 12, + RENDERER_ERROR: 13 + }; + + var PanoImageRenderer = + /*#__PURE__*/ + function () { + var PanoImageRenderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoImageRenderer, _Component); + + function PanoImageRenderer(image, width, height, isVideo, sphericalConfig, renderingContextAttributes) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + + _this._renderStereo = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var eyeParams = vr.getEyeParams(gl, frame); + if (!eyeParams) return; + vr.beforeRender(gl, frame); // Render both eyes + + for (var _i = 0, _arr = [0, 1]; _i < _arr.length; _i++) { + var eyeIndex = _arr[_i]; + var eyeParam = eyeParams[eyeIndex]; + _this.mvMatrix = eyeParam.mvMatrix; + _this.pMatrix = eyeParam.pMatrix; + gl.viewport.apply(gl, eyeParam.viewport); + gl.uniform1f(_this.shaderProgram.uEye, eyeIndex); + + _this._bindBuffers(); + + _this._draw(); + } + + vr.afterRender(); + }; + + _this.exitVR = function () { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; + if (!vr) return; + vr.removeEndCallback(_this.exitVR); + vr.destroy(); + _this._vr = null; // Restore canvas & context on iOS + + if (IS_IOS) { + _this._restoreStyle(); + } + + _this.updateViewportDimensions(_this.width, _this.height); + + _this._updateViewport(); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + _this._bindBuffers(); + + _this._shouldForceDraw = true; + animator.stop(); + animator.setContext(window); + animator.setCallback(_this._render.bind(_assertThisInitialized(_this))); + animator.start(); + }; + + _this._onFirstVRFrame = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; // If rendering is not ready, wait for next frame + + if (!vr.canRender(frame)) return; + var minusZDir = fromValues$4(0, 0, -1); + var eyeParam = vr.getEyeParams(gl, frame)[0]; // Extract only rotation + + var mvMatrix = fromMat4(create$2(), eyeParam.mvMatrix); + var pMatrix = fromMat4(create$2(), eyeParam.pMatrix); + var mvInv = invert$2(create$2(), mvMatrix); + var pInv = invert$2(create$2(), pMatrix); + var viewDir = transformMat3(create$4(), minusZDir, pInv); + transformMat3(viewDir, viewDir, mvInv); + var yawOffset = util.yawOffsetBetween(viewDir, fromValues$4(0, 0, 1)); + + if (yawOffset === 0) { + // If the yawOffset is exactly 0, then device sensor is not ready + // So read it again until it has any value in it + return; + } + + vr.setYawOffset(yawOffset); + animator.setCallback(_this._renderStereo); + }; + + _this.sphericalConfig = sphericalConfig; + _this.fieldOfView = sphericalConfig.fieldOfView; + _this.width = width; + _this.height = height; + _this._lastQuaternion = null; + _this._lastYaw = null; + _this._lastPitch = null; + _this._lastFieldOfView = null; + _this.pMatrix = create$3(); + _this.mvMatrix = create$3(); // initialzie pMatrix + + perspective(_this.pMatrix, toRadian(_this.fieldOfView), width / height, 0.1, 100); + _this.textureCoordBuffer = null; + _this.vertexBuffer = null; + _this.indexBuffer = null; + _this.canvas = _this._initCanvas(width, height); + + _this._setDefaultCanvasStyle(); + + _this._wrapper = null; // canvas wrapper + + _this._wrapperOrigStyle = null; + _this._renderingContextAttributes = renderingContextAttributes; + _this._image = null; + _this._imageConfig = null; + _this._imageIsReady = false; + _this._shouldForceDraw = false; + _this._keepUpdate = false; // Flag to specify 'continuous update' on video even when still. + + _this._onContentLoad = _this._onContentLoad.bind(_assertThisInitialized(_this)); + _this._onContentError = _this._onContentError.bind(_assertThisInitialized(_this)); + _this._animator = new WebGLAnimator(); // VR/XR manager + + _this._vr = null; + + if (image) { + _this.setImage({ + image: image, + imageType: sphericalConfig.imageType, + isVideo: isVideo, + cubemapConfig: sphericalConfig.cubemapConfig + }); + } + + return _this; + } // FIXME: Please refactor me to have more loose connection to yawpitchcontrol + + + var _proto = PanoImageRenderer.prototype; + + _proto.setYawPitchControl = function setYawPitchControl(yawPitchControl) { + this._yawPitchControl = yawPitchControl; + }; + + _proto.getContent = function getContent() { + return this._image; + }; + + _proto.setImage = function setImage(_ref) { + var image = _ref.image, + imageType = _ref.imageType, + _ref$isVideo = _ref.isVideo, + isVideo = _ref$isVideo === void 0 ? false : _ref$isVideo, + cubemapConfig = _ref.cubemapConfig; + this._imageIsReady = false; + this._isVideo = isVideo; + this._imageConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only */ + order: imageType === ImageType.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, cubemapConfig); + + this._setImageType(imageType); + + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + if (isVideo) { + this._contentLoader = new VideoLoader(); + this._keepUpdate = true; + } else { + this._contentLoader = new ImageLoader(); + this._keepUpdate = false; + } // img element or img url + + + this._contentLoader.set(image); // 이미지의 사이즈를 캐시한다. + // image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed. + + + this._image = this._contentLoader.getElement(); + return this._contentLoader.get().then(this._onContentLoad, this._onContentError)["catch"](function (e) { + return setTimeout(function () { + throw e; + }); + }); // Prevent exceptions from being isolated in promise chain. + }; + + _proto._setImageType = function _setImageType(imageType) { + var _this2 = this; + + if (!imageType || this._imageType === imageType) { + return; + } + + this._imageType = imageType; + this._isCubeMap = imageType === ImageType.CUBEMAP; + + if (this._renderer) { + this._renderer.off(); + } + + switch (imageType) { + case ImageType.CUBEMAP: + this._renderer = new CubeRenderer(); + break; + + case ImageType.CUBESTRIP: + this._renderer = new CubeStripRenderer(); + break; + + case ImageType.PANORAMA: + this._renderer = new CylinderRenderer(); + break; + + case ImageType.STEREOSCOPIC_EQUI: + this._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat); + break; + + default: + this._renderer = new SphereRenderer(STEREO_FORMAT.NONE); + break; + } + + this._renderer.on(Renderer.EVENTS.ERROR, function (e) { + _this2.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.RENDERER_ERROR, + message: e.message + }); + }); + + this._initWebGL(); + }; + + _proto._initCanvas = function _initCanvas(width, height) { + var canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + this._onWebglcontextlost = this._onWebglcontextlost.bind(this); + this._onWebglcontextrestored = this._onWebglcontextrestored.bind(this); + canvas.addEventListener("webglcontextlost", this._onWebglcontextlost); + canvas.addEventListener("webglcontextrestored", this._onWebglcontextrestored); + return canvas; + }; + + _proto._setDefaultCanvasStyle = function _setDefaultCanvasStyle() { + var canvas = this.canvas; + canvas.style.bottom = 0; + canvas.style.left = 0; + canvas.style.right = 0; + canvas.style.top = 0; + canvas.style.margin = "auto"; + canvas.style.maxHeight = "100%"; + canvas.style.maxWidth = "100%"; + canvas.style.outline = "none"; + canvas.style.position = "absolute"; + }; + + _proto._onContentError = function _onContentError(error) { + this._imageIsReady = false; + this._image = null; + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.FAIL_IMAGE_LOAD, + message: "failed to load image" + }); + return false; + }; + + _proto._triggerContentLoad = function _triggerContentLoad() { + this.trigger(EVENTS$2.IMAGE_LOADED, { + content: this._image, + isVideo: this._isVideo, + projectionType: this._imageType + }); + }; + + _proto._onContentLoad = function _onContentLoad(image) { + this._imageIsReady = true; + + this._triggerContentLoad(); + + return true; + }; + + _proto.isImageLoaded = function isImageLoaded() { + return !!this._image && this._imageIsReady && (!this._isVideo || this._image.readyState >= 2 + /* HAVE_CURRENT_DATA */ + ); + }; + + _proto.bindTexture = function bindTexture() { + var _this3 = this; + + return new _Promise$3(function (res, rej) { + if (!_this3._contentLoader) { + rej("ImageLoader is not initialized"); + return; + } + + _this3._contentLoader.get().then(function () { + _this3._bindTexture(); + }, rej).then(res); + }); + } // 부모 엘리먼트에 canvas 를 붙임 + ; + + _proto.attachTo = function attachTo(parentElement) { + this.detach(); + parentElement.appendChild(this.canvas); + this._wrapper = parentElement; + }; + + _proto.forceContextLoss = function forceContextLoss() { + if (this.hasRenderingContext()) { + var loseContextExtension = this.context.getExtension("WEBGL_lose_context"); + + if (loseContextExtension) { + loseContextExtension.loseContext(); + } + } + } // 부모 엘리먼트에서 canvas 를 제거 + ; + + _proto.detach = function detach() { + if (this.canvas.parentElement) { + this.canvas.parentElement.removeChild(this.canvas); + } + }; + + _proto.destroy = function destroy() { + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + this._animator.stop(); + + this.detach(); + this.forceContextLoss(); + this.off(); + this.canvas.removeEventListener("webglcontextlost", this._onWebglcontextlost); + this.canvas.removeEventListener("webglcontextrestored", this._onWebglcontextrestored); + }; + + _proto.hasRenderingContext = function hasRenderingContext() { + if (!(this.context && !this.context.isContextLost())) { + return false; + } else if (this.context && !this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) { + return false; + } + + return true; + }; + + _proto._initShaderProgram = function _initShaderProgram() { + var gl = this.context; + + if (this.shaderProgram) { + gl.deleteProgram(this.shaderProgram); + this.shaderProgram = null; + } + + var renderer = this._renderer; + var vsSource = renderer.getVertexShaderSource(); + var fsSource = renderer.getFragmentShaderSource(); + var vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource); + var fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource); + var shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader); + + if (!shaderProgram) { + throw new Error("Failed to intialize shaders: " + WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())); + } + + gl.useProgram(shaderProgram); + shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); + gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute); + shaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix"); + shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); + shaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); + shaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); + shaderProgram.uEye = gl.getUniformLocation(shaderProgram, "uEye"); + gl.enableVertexAttribArray(shaderProgram.textureCoordAttribute); // clear buffer + + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); // Use TEXTURE0 + + gl.uniform1i(shaderProgram.samplerUniform, 0); + this.shaderProgram = shaderProgram; + }; + + _proto._onWebglcontextlost = function _onWebglcontextlost(e) { + e.preventDefault(); + this.trigger(EVENTS$2.RENDERING_CONTEXT_LOST); + }; + + _proto._onWebglcontextrestored = function _onWebglcontextrestored(e) { + this._initWebGL(); + + this.trigger(EVENTS$2.RENDERING_CONTEXT_RESTORE); + }; + + _proto.updateFieldOfView = function updateFieldOfView(fieldOfView) { + this.fieldOfView = fieldOfView; + + this._updateViewport(); + }; + + _proto.updateViewportDimensions = function updateViewportDimensions(width, height) { + var viewPortChanged = false; + this.width = width; + this.height = height; + var w = width * DEVICE_PIXEL_RATIO; + var h = height * DEVICE_PIXEL_RATIO; + + if (w !== this.canvas.width) { + this.canvas.width = w; + viewPortChanged = true; + } + + if (h !== this.canvas.height) { + this.canvas.height = h; + viewPortChanged = true; + } + + if (!viewPortChanged) { + return; + } + + this._updateViewport(); + + this._shouldForceDraw = true; + }; + + _proto._updateViewport = function _updateViewport() { + perspective(this.pMatrix, toRadian(this.fieldOfView), this.canvas.width / this.canvas.height, 0.1, 100); + this.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight); + }; + + _proto._initWebGL = function _initWebGL() { + var gl; // TODO: Following code does need to be executed only if width/height, cubicStrip property is changed. + + try { + this._initRenderingContext(); + + gl = this.context; + this.updateViewportDimensions(this.width, this.height); + + this._initShaderProgram(); + } catch (e) { + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.NO_WEBGL, + message: "no webgl support" + }); + this.destroy(); + console.error(e); // eslint-disable-line no-console + + return; + } // 캔버스를 투명으로 채운다. + + + gl.clearColor(0, 0, 0, 0); + var textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D; + + if (this.texture) { + gl.deleteTexture(this.texture); + } + + this.texture = WebGLUtils.createTexture(gl, textureTarget); + + if (this._imageType === ImageType.CUBESTRIP) { + // TODO: Apply following options on other projection type. + gl.enable(gl.CULL_FACE); // gl.enable(gl.DEPTH_TEST); + } + }; + + _proto._initRenderingContext = function _initRenderingContext() { + if (this.hasRenderingContext()) { + return; + } + + if (!window.WebGLRenderingContext) { + throw new Error("WebGLRenderingContext not available."); + } + + this.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes); + + if (!this.context) { + throw new Error("Failed to acquire 3D rendering context"); + } + }; + + _proto._initBuffers = function _initBuffers() { + var vertexPositionData = this._renderer.getVertexPositionData(); + + var indexData = this._renderer.getIndexData(); + + var textureCoordData = this._renderer.getTextureCoordData(this._imageConfig); + + var gl = this.context; + this.vertexBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3, this.shaderProgram.vertexPositionAttribute); + this.indexBuffer = WebGLUtils.initBuffer(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1); + this.textureCoordBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2, this.shaderProgram.textureCoordAttribute); + + this._bindBuffers(); + }; + + _proto._bindTexture = function _bindTexture() { + // Detect if it is EAC Format while CUBESTRIP mode. + // We assume it is EAC if image is not 3/2 ratio. + if (this._imageType === ImageType.CUBESTRIP) { + var _this$_renderer$getDi = this._renderer.getDimension(this._image), + width = _this$_renderer$getDi.width, + height = _this$_renderer$getDi.height; + + var isEAC = width && height && width / height !== 1.5; + this.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, "uIsEAC"), isEAC); + } else if (this._imageType === ImageType.PANORAMA) { + var _this$_renderer$getDi2 = this._renderer.getDimension(this._image), + _width = _this$_renderer$getDi2.width, + _height = _this$_renderer$getDi2.height; + + var imageAspectRatio = _width && _height && _width / _height; + + this._renderer.updateShaderData({ + imageAspectRatio: imageAspectRatio + }); + } // intialize shader buffers after image is loaded.(by updateShaderData) + // because buffer may be differ by image size.(eg. CylinderRenderer) + + + this._initBuffers(); + + this._renderer.bindTexture(this.context, this.texture, this._image, this._imageConfig); + + this._shouldForceDraw = true; + this.trigger(EVENTS$2.BIND_TEXTURE); + }; + + _proto._updateTexture = function _updateTexture() { + this._renderer.updateTexture(this.context, this._image, this._imageConfig); + }; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + if (doUpdate && this.isImageLoaded() === false) { + // Force to draw a frame after image is loaded on render() + this._shouldForceDraw = true; + } + + this._keepUpdate = doUpdate; + }; + + _proto.startRender = function startRender() { + this._animator.setCallback(this._render.bind(this)); + + this._animator.start(); + }; + + _proto.stopRender = function stopRender() { + this._animator.stop(); + }; + + _proto.renderWithQuaternion = function renderWithQuaternion(quaternion, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastQuaternion && exactEquals$6(this._lastQuaternion, quaternion) && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // updatefieldOfView only if fieldOfView is changed. + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + this.mvMatrix = fromQuat$1(create$3(), quaternion); + + this._draw(); + + this._lastQuaternion = clone$6(quaternion); + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto.renderWithYawPitch = function renderWithYawPitch(yaw, pitch, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastYaw !== null && this._lastYaw === yaw && this._lastPitch !== null && this._lastPitch === pitch && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출 + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + identity$3(this.mvMatrix); + rotateX(this.mvMatrix, this.mvMatrix, -toRadian(pitch)); + rotateY(this.mvMatrix, this.mvMatrix, -toRadian(yaw)); + + this._draw(); + + this._lastYaw = yaw; + this._lastPitch = pitch; + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto._render = function _render() { + var yawPitchControl = this._yawPitchControl; + var fov = yawPitchControl.getFov(); + + if (yawPitchControl.shouldRenderWithQuaternion()) { + var quaternion = yawPitchControl.getQuaternion(); + this.renderWithQuaternion(quaternion, fov); + } else { + var yawPitch = yawPitchControl.getYawPitch(); + this.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov); + } + }; + + _proto._bindBuffers = function _bindBuffers() { + var gl = this.context; + var program = this.shaderProgram; + var vertexBuffer = this.vertexBuffer; + var textureCoordBuffer = this.textureCoordBuffer; + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + gl.enableVertexAttribArray(program.vertexPositionAttribute); + gl.vertexAttribPointer(program.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer); + gl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer); + gl.enableVertexAttribArray(program.textureCoordAttribute); + gl.vertexAttribPointer(program.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0); + }; + + _proto._draw = function _draw() { + if (this._isVideo && this._keepUpdate) { + this._updateTexture(); + } + + this._renderer.render({ + gl: this.context, + shaderProgram: this.shaderProgram, + indexBuffer: this.indexBuffer, + mvMatrix: this.mvMatrix, + pMatrix: this.pMatrix + }); + } + /** + * Returns projection renderer by each type + */ + ; + + _proto.getProjectionRenderer = function getProjectionRenderer() { + return this._renderer; + } + /** + * @return Promise + */ + ; + + _proto.enterVR = function enterVR() { + var vr = this._vr; + + if (!WEBXR_SUPPORTED && !navigator.getVRDisplays) { + return _Promise$3.reject("VR is not available on this browser."); + } + + if (vr && vr.isPresenting()) { + return _Promise$3.resolve("VR already enabled."); + } + + return this._requestPresent(); + }; + + _proto._requestPresent = function _requestPresent() { + var _this4 = this; + + var gl = this.context; + var canvas = this.canvas; + var animator = this._animator; + this._vr = WEBXR_SUPPORTED ? new XRManager() : new VRManager(); + var vr = this._vr; + animator.stop(); + return new _Promise$3(function (resolve, reject) { + vr.requestPresent(canvas, gl).then(function () { + vr.addEndCallback(_this4.exitVR); + animator.setContext(vr.context); + animator.setCallback(_this4._onFirstVRFrame); + + if (IS_IOS) { + _this4._setWrapperFullscreen(); + } + + _this4._shouldForceDraw = true; + animator.start(); + resolve("success"); + })["catch"](function (e) { + vr.destroy(); + _this4._vr = null; + animator.start(); + reject(e); + }); + }); + }; + + _proto._setWrapperFullscreen = function _setWrapperFullscreen() { + var wrapper = this._wrapper; + if (!wrapper) return; + this._wrapperOrigStyle = wrapper.getAttribute("style"); + var wrapperStyle = wrapper.style; + wrapperStyle.width = "100vw"; + wrapperStyle.height = "100vh"; + wrapperStyle.position = "fixed"; + wrapperStyle.left = "0"; + wrapperStyle.top = "0"; + wrapperStyle.zIndex = "9999"; + }; + + _proto._restoreStyle = function _restoreStyle() { + var wrapper = this._wrapper; + var canvas = this.canvas; + if (!wrapper) return; + + if (this._wrapperOrigStyle) { + wrapper.setAttribute("style", this._wrapperOrigStyle); + } else { + wrapper.removeAttribute("style"); + } + + this._wrapperOrigStyle = null; // Restore canvas style + + canvas.removeAttribute("style"); + + this._setDefaultCanvasStyle(); + }; + + return PanoImageRenderer; + }(Component); + + PanoImageRenderer.EVENTS = EVENTS$2; + PanoImageRenderer.ERROR_TYPE = ERROR_TYPE$1; + return PanoImageRenderer; + }(); + + var _Promise$4 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + + var PanoViewer = + /*#__PURE__*/ + function () { + var PanoViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.PanoViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.PanoViewer + */ + // It should be deprecated! + + /** + * Constant value for touch directions + * @ko 터치 방향에 대한 상수 값. + * @namespace + * @name TOUCH_DIRECTION + * @memberof eg.view360.PanoViewer + */ + + /** + * @classdesc 360 media viewer + * @ko 360 미디어 뷰어 + * @class + * @name eg.view360.PanoViewer + * @extends eg.Component + * + * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트 + * @param {Object} config + * + * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
+ * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다. + * @param {Object} [config.cubemapConfig.order = "RLUDBF"(ProjectionType === CUBEMAP) | "RLUDFB" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서 + * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다. + * @param {String} [config.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
+ * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위) + * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위) + * + * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위) + * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위) + * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위) + * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다 + * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다. + * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키 + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE}
+ * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위 + * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위 + * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위 + * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
+ * + * @example + * // PanoViewer Creation + * // create PanoViewer with option + * var PanoViewer = eg.view360.PanoViewer; + * // Area where the image will be displayed(HTMLElement) + * var container = document.getElementById("myPanoViewer"); + * + * var panoViewer = new PanoViewer(container, { + * // If projectionType is not specified, the default is "equirectangular". + * // Specifies an image of the "equirectangular" type. + * image: "/path/to/image/image.jpg" + *}); + * + * @example + * // Cubemap Config Setting Example + * // For support Youtube EAC projection, You should set cubemapConfig as follows. + * cubemapConfig: { + * order: "LFRDBU", + * tileConfig: [ + * tileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}] + * ] + * } + */ + function PanoViewer(container, options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Component.call(this) || this; // Raises the error event if webgl is not supported. + + if (!WebGLUtils.isWebGLAvailable()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.NO_WEBGL, + message: "no webgl support" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!WebGLUtils.isStableWebGL()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_DEVICE, + message: "blacklisted browser" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!!options.image && !!options.video) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_RESOURCE, + message: "Specifying multi resouces(both image and video) is not valid." + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } // Check XR support at not when imported, but when created. + // This is intended to make polyfills easier to use. + + + checkXRSupport(); + _this._container = container; + _this._image = options.image || options.video; + _this._isVideo = !!options.video; + _this._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + _this._cubemapConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/ + order: _this._projectionType === PROJECTION_TYPE.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, options.cubemapConfig); + _this._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; // If the width and height are not provided, will use the size of the container. + + _this._width = options.width || parseInt(window.getComputedStyle(container).width, 10); + _this._height = options.height || parseInt(window.getComputedStyle(container).height, 10); + /** + * Cache the direction for the performance in renderLoop + * + * This value should be updated by "change" event of YawPitchControl. + */ + + _this._yaw = options.yaw || 0; + _this._pitch = options.pitch || 0; + _this._fov = options.fov || 65; + _this._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH; + _this._quaternion = null; + _this._aspectRatio = _this._height !== 0 ? _this._width / _this._height : 1; + var fovRange = options.fovRange || [30, 110]; + var touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ? options.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL; + + var yawPitchConfig = _extends(options, { + element: container, + yaw: _this._yaw, + pitch: _this._pitch, + fov: _this._fov, + gyroMode: _this._gyroMode, + fovRange: fovRange, + aspectRatio: _this._aspectRatio, + touchDirection: touchDirection + }); + + _this._isReady = false; + + _this._initYawPitchControl(yawPitchConfig); + + _this._initRenderer(_this._yaw, _this._pitch, _this._fov, _this._projectionType, _this._cubemapConfig); + + return _this; + } + /** + * Get the video element that the viewer is currently playing. You can use this for playback. + * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다. + * @method eg.view360.PanoViewer#getVideo + * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement + * @example + * var videoTag = panoViewer.getVideo(); + * videoTag.play(); // play video! + */ + + + var _proto = PanoViewer.prototype; + + _proto.getVideo = function getVideo() { + if (!this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the video information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setVideo + * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정) + * @param {Object} param + * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}("equirectangular")] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setVideo("/path/to/video/video.mp4", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR + * }); + */ + ; + + _proto.setVideo = function setVideo(video, param) { + if (param === void 0) { + param = {}; + } + + if (video) { + this.setImage(video, { + projectionType: param.projectionType, + isVideo: true, + cubemapConfig: param.cubemapConfig, + stereoFormat: param.stereoFormat + }); + } + + return this; + } + /** + * Get the image information that the viewer is currently using. + * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다. + * @method eg.view360.PanoViewer#getImage + * @return {Image} Image Object이미지 객체 + * @example + * var imageObj = panoViewer.getImage(); + */ + ; + + _proto.getImage = function getImage() { + if (this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the image information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setImage + * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.) + * @param {Object} param Additional information이미지 추가 정보 + * @param {String} [param.projectionType="equirectangular"] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setImage("/path/to/image/image.png", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP + * }); + */ + ; + + _proto.setImage = function setImage(image, param) { + if (param === void 0) { + param = {}; + } + + var cubemapConfig = _extends({ + order: "RLUDBF", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, param.cubemapConfig); + + var stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; + var isVideo = !!param.isVideo; + + if (this._image && this._isVideo !== isVideo) { + /* eslint-disable no-console */ + console.warn("Currently not supporting to change content type(Image <--> Video)"); + /* eslint-enable no-console */ + + return this; + } + + if (image) { + this._image = image; + this._isVideo = isVideo; + this._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + this._cubemapConfig = cubemapConfig; + this._stereoFormat = stereoFormat; + + this._deactivate(); + + this._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig); + } + + return this; + } + /** + * Set whether the renderer always updates the texture and renders. + * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다. + * + * @method eg.view360.PanoViewer#keepUpdate + * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다. + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + this._photoSphereRenderer.keepUpdate(doUpdate); + + return this; + } + /** + * Get projection type (equirectangular/cube) + * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다. + * + * @method eg.view360.PanoViewer#getProjectionType + * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE} + */ + ; + + _proto.getProjectionType = function getProjectionType() { + return this._projectionType; + } + /** + * Activate the device's motion sensor, and return the Promise whether the sensor is enabled + * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element. + * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다. + * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * @method eg.view360.PanoViewer#enableSensor + * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다. + */ + ; + + _proto.enableSensor = function enableSensor() { + return new _Promise$4(function (resolve, reject) { + if (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === "function") { + DeviceMotionEvent.requestPermission().then(function (permissionState) { + if (permissionState === "granted") { + resolve(); + } else { + reject(new Error("permission denied")); + } + })["catch"](function (e) { + // This can happen when this method wasn't triggered by user interaction + reject(e); + }); + } else { + resolve(); + } + }); + } + /** + * Disable the device's motion sensor. + * @ko 디바이스의 모션 센서를 비활성화합니다. + * @deprecated + * @method eg.view360.PanoViewer#disableSensor + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.disableSensor = function disableSensor() { + return this; + } + /** + * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred). + * This method must be used in the context of user interaction, like onclick callback on the button element. + * It can be rejected when an enabling device sensor fails or image/video is still loading("ready" event not triggered). + * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다) + * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우("ready"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다. + * @method eg.view360.PanoViewer#enterVR + * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error) + */ + ; + + _proto.enterVR = function enterVR() { + var _this2 = this; + + if (!this._isReady) { + return _Promise$4.reject(new Error("PanoViewer is not ready to show image.")); + } + + return new _Promise$4(function (resolve, reject) { + _this2.enableSensor().then(function () { + return _this2._photoSphereRenderer.enterVR(); + }).then(function (res) { + return resolve(res); + })["catch"](function (e) { + return reject(e); + }); + }); + } + /** + * Exit VR stereo rendering mode. + * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다. + * + * @method eg.view360.PanoViewer#exitVR + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.exitVR = function exitVR() { + this._photoSphereRenderer.exitVR(); + + return this; + } // TODO: Remove parameters as they're just using private values + ; + + _proto._initRenderer = function _initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) { + var _this3 = this; + + this._photoSphereRenderer = new PanoImageRenderer(this._image, this._width, this._height, this._isVideo, { + initialYaw: yaw, + initialPitch: pitch, + fieldOfView: fov, + imageType: projectionType, + cubemapConfig: cubemapConfig, + stereoFormat: this._stereoFormat + }); + + this._photoSphereRenderer.setYawPitchControl(this._yawPitchControl); + + this._bindRendererHandler(); + + this._photoSphereRenderer.bindTexture().then(function () { + return _this3._activate(); + })["catch"](function () { + _this3._triggerEvent(EVENTS$1.ERROR, { + type: ERROR_TYPE.FAIL_BIND_TEXTURE, + message: "failed to bind texture" + }); + }); + } + /** + * update values of YawPitchControl if needed. + * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image. + * + * This function should be called after isReady status is true. + */ + ; + + _proto._updateYawPitchIfNeeded = function _updateYawPitchIfNeeded() { + if (this._projectionType === PanoViewer.ProjectionType.PANORAMA) { + // update fov by aspect ratio + var image = this._photoSphereRenderer.getContent(); + + var imageAspectRatio = image.naturalWidth / image.naturalHeight; + var isCircular; + var yawSize; + var maxFov; // If height is larger than width, then we assume it's rotated by 90 degree. + + if (imageAspectRatio < 1) { + // So inverse the aspect ratio. + imageAspectRatio = 1 / imageAspectRatio; + } + + if (imageAspectRatio < 6) { + yawSize = util.toDegree(imageAspectRatio); + isCircular = false; // 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5 + + maxFov = util.toDegree(Math.atan(0.5)) * 2; + } else { + yawSize = 360; + isCircular = true; + maxFov = 360 / imageAspectRatio; // Make it 5 fixed as axes does. + } // console.log("_updateYawPitchIfNeeded", maxFov, "aspectRatio", image.naturalWidth, image.naturalHeight, "yawSize", yawSize); + + + var minFov = this._yawPitchControl.option("fovRange")[0]; // this option should be called after fov is set. + + + this._yawPitchControl.option({ + "fov": maxFov, + + /* parameter for internal validation for pitchrange */ + "yawRange": [-yawSize / 2, yawSize / 2], + isCircular: isCircular, + "pitchRange": [-maxFov / 2, maxFov / 2], + "fovRange": [minFov, maxFov] + }); + + this.lookAt({ + fov: maxFov + }); + } + }; + + _proto._bindRendererHandler = function _bindRendererHandler() { + var _this4 = this; + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, function (e) { + _this4.trigger(EVENTS$1.ERROR, e); + }); + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, function (e) { + _this4._deactivate(); + + _this4.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.RENDERING_CONTEXT_LOST, + message: "webgl rendering context lost" + }); + }); + }; + + _proto._initYawPitchControl = function _initYawPitchControl(yawPitchConfig) { + var _this5 = this; + + this._yawPitchControl = new YawPitchControl(yawPitchConfig); + + this._yawPitchControl.on(EVENTS$1.ANIMATION_END, function (e) { + _this5._triggerEvent(EVENTS$1.ANIMATION_END, e); + }); + + this._yawPitchControl.on("change", function (e) { + _this5._yaw = e.yaw; + _this5._pitch = e.pitch; + _this5._fov = e.fov; + _this5._quaternion = e.quaternion; + + _this5._triggerEvent(EVENTS$1.VIEW_CHANGE, e); + }); + }; + + _proto._triggerEvent = function _triggerEvent(name, param) { + var evt = param || {}; + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name eg.view360.PanoViewer#error + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.type Error type + * 10: INVALID_DEVICE: Unsupported device + * 11: NO_WEBGL: Webgl not support + * 12, FAIL_IMAGE_LOAD: Failed to load image + * 13: FAIL_BIND_TEXTURE: Failed to bind texture + * 14: INVALID_RESOURCE: Only one resource(image or video) should be specified + * 15: RENDERING_CONTEXT_LOST: WebGL context lost occurred + * 에러 종류 + * 10: INVALID_DEVICE: 미지원 기기 + * 11: NO_WEBGL: WEBGL 미지원 + * 12, FAIL_IMAGE_LOAD: 이미지 로드 실패 + * 13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패 + * 14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * 15: RENDERING_CONTEXT_LOST: WebGL context lost 발생 + * + * @param {String} param.message Error message 에러 메시지 + * @see {@link eg.view360.PanoViewer.ERROR_TYPE} + * @example + * + * viwer.on({ + * "error" : function(evt) { + * // evt.type === 13 + * // evt.message === "failed to bind texture" + * }); + * + * // constant can be used + * viwer.on({ + * eg.view360.PanoViewer.EVENTS.ERROR : function(evt) { + * // evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE + * // evt.message === "failed to bind texture" + * }); + */ + + /** + * Events that is fired when PanoViewer is ready to go. + * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트 + * @name eg.view360.PanoViewer#ready + * @event + * + * @example + * + * viwer.on({ + * "ready" : function(evt) { + * // PanoViewer is ready to show image and handle user interaction. + * }); + */ + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#viewChange + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.yaw yawyaw + * @param {Number} param.pitch pitch pitch + * @param {Number} param.fov Field of view (fov) 화각 + * @example + * + * viwer.on({ + * "viewChange" : function(evt) { + * //evt.yaw, evt.pitch, evt.fov is available. + * }); + */ + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#animationEnd + * @event + * @example + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // animation is ended. + * }); + */ + + return this.trigger(name, evt); + } + /** + * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}. + * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다. + * @method eg.view360.PanoViewer#setUseZoom + * @param {Boolean} useZoom + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseZoom = function setUseZoom(useZoom) { + typeof useZoom === "boolean" && this._yawPitchControl.option("useZoom", useZoom); + return this; + } + /** + * When true, enables the keyboard move key control: awsd, arrow keys + * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키) + * @method eg.view360.PanoViewer#setUseKeyboard + * @param {Boolean} useKeyboard + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseKeyboard = function setUseKeyboard(useKeyboard) { + this._yawPitchControl.option("useKeyboard", useKeyboard); + + return this; + } + /** + * Enables control through device motion. ("none", "yawPitch", "VR") + * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR") + * @method eg.view360.PanoViewer#setGyroMode + * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE} + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setGyroMode("yawPitch"); + * //equivalent + * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH); + */ + ; + + _proto.setGyroMode = function setGyroMode(gyroMode) { + this._yawPitchControl.option("gyroMode", gyroMode); + + return this; + } + /** + * Set the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 설정합니다. + * @method eg.view360.PanoViewer#setFovRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setFovRange([50, 90]); + */ + ; + + _proto.setFovRange = function setFovRange(range) { + this._yawPitchControl.option("fovRange", range); + + return this; + } + /** + * Getting the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 반환합니다. + * @method eg.view360.PanoViewer#getFovRange + * @return {Array} + * @example + * var range = panoViewer.getFovRange(); //[50, 90] + */ + ; + + _proto.getFovRange = function getFovRange() { + return this._yawPitchControl.option("fovRange"); + } + /** + * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size. + * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다. + * @method eg.view360.PanoViewer#updateViewportDimensions + * @param {Object} [size] + * @param {Number} [size.width=width of container] + * @param {Number} [size.height=height of container] + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.updateViewportDimensions = function updateViewportDimensions(size) { + if (size === void 0) { + size = { + width: undefined, + height: undefined + }; + } + + if (!this._isReady) { + return this; + } + + var containerSize; + + if (size.width === undefined || size.height === undefined) { + containerSize = window.getComputedStyle(this._container); + } + + var width = size.width || parseInt(containerSize.width, 10); + var height = size.height || parseInt(containerSize.height, 10); // Skip if viewport is not changed. + + if (width === this._width && height === this._height) { + return this; + } + + this._width = width; + this._height = height; + this._aspectRatio = width / height; + + this._photoSphereRenderer.updateViewportDimensions(width, height); + + this._yawPitchControl.option("aspectRatio", this._aspectRatio); + + this._yawPitchControl.updatePanScale({ + height: height + }); + + this.lookAt({}, 0); + return this; + } + /** + * Get the current field of view(FOV) + * @ko 현재 field of view(FOV) 값을 반환합니다. + * @method eg.view360.PanoViewer#getFov + * @return {Number} + */ + ; + + _proto.getFov = function getFov() { + return this._fov; + } + /** + * Get the horizontal field of view in degree + */ + ; + + _proto._getHFov = function _getHFov() { + return util.toDegree(2 * Math.atan(this._aspectRatio * Math.tan(toRadian(this._fov) / 2))); + } + /** + * Get current yaw value + * @ko 현재 yaw 값을 반환합니다. + * @method eg.view360.PanoViewer#getYaw + * @return {Number} + */ + ; + + _proto.getYaw = function getYaw() { + return this._yaw; + } + /** + * Get current pitch value + * @ko 현재 pitch 값을 반환합니다. + * @method eg.view360.PanoViewer#getPitch + * @return {Number} + */ + ; + + _proto.getPitch = function getPitch() { + return this._pitch; + } + /** + * Get the range of controllable Yaw values + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#getYawRange + * @return {Array} + */ + ; + + _proto.getYawRange = function getYawRange() { + return this._yawPitchControl.option("yawRange"); + } + /** + * Get the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다. + * @method eg.view360.PanoViewer#getPitchRange + * @return {Array} + */ + ; + + _proto.getPitchRange = function getPitchRange() { + return this._yawPitchControl.option("pitchRange"); + } + /** + * Set the range of controllable yaw + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#setYawRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setYawRange([-90, 90]); + */ + ; + + _proto.setYawRange = function setYawRange(yawRange) { + this._yawPitchControl.option("yawRange", yawRange); + + return this; + } + /** + * Set the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 설정합니다. + * @method eg.view360.PanoViewer#setPitchRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setPitchRange([-40, 40]); + */ + ; + + _proto.setPitchRange = function setPitchRange(pitchRange) { + this._yawPitchControl.option("pitchRange", pitchRange); + + return this; + } + /** + * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed. + * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다. + * @method eg.view360.PanoViewer#setShowPolePoint + * @param {Boolean} showPolePoint + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setShowPolePoint = function setShowPolePoint(showPolePoint) { + this._yawPitchControl.option("showPolePoint", showPolePoint); + + return this; + } + /** + * Set a new view by setting camera configuration. Any parameters not specified remain the same. + * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다. + * @method eg.view360.PanoViewer#lookAt + * @param {Object} orientation + * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위) + * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위) + * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위) + * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초) + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * // Change the yaw angle (absolute angle) to 30 degrees for one second. + * panoViewer.lookAt({yaw: 30}, 1000); + */ + ; + + _proto.lookAt = function lookAt$$1(orientation, duration) { + if (!this._isReady) { + return this; + } + + var yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw; + var pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch; + + var pitchRange = this._yawPitchControl.option("pitchRange"); + + var verticalAngleOfImage = pitchRange[1] - pitchRange[0]; + var fov = orientation.fov !== undefined ? orientation.fov : this._fov; + + if (verticalAngleOfImage < fov) { + fov = verticalAngleOfImage; + } + + this._yawPitchControl.lookAt({ + yaw: yaw, + pitch: pitch, + fov: fov + }, duration); + + if (duration === 0) { + this._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov); + } + + return this; + }; + + _proto._activate = function _activate() { + this._photoSphereRenderer.attachTo(this._container); + + this._yawPitchControl.enable(); + + this.updateViewportDimensions(); + this._isReady = true; // update yawPitchControl after isReady status is true. + + this._updateYawPitchIfNeeded(); + + this._triggerEvent(EVENTS$1.READY); + + this._photoSphereRenderer.startRender(); + } + /** + * Destroy webgl context and block user interaction and stop rendering + */ + ; + + _proto._deactivate = function _deactivate() { + if (this._isReady) { + this._photoSphereRenderer.stopRender(); + + this._yawPitchControl.disable(); + + this._isReady = false; + } + + if (this._photoSphereRenderer) { + this._photoSphereRenderer.destroy(); + + this._photoSphereRenderer = null; + } + }; + + PanoViewer._isValidTouchDirection = function _isValidTouchDirection(direction) { + return direction === PanoViewer.TOUCH_DIRECTION.NONE || direction === PanoViewer.TOUCH_DIRECTION.YAW || direction === PanoViewer.TOUCH_DIRECTION.PITCH || direction === PanoViewer.TOUCH_DIRECTION.ALL; + } + /** + * Set touch direction by which user can control. + * @ko 사용자가 조작가능한 터치 방향을 지정합니다. + * @method eg.view360.PanoViewer#setTouchDirection + * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @return {eg.view360.PanoViewer} PanoViewer instance + * @example + * + * panoViewer = new PanoViewer(el); + * // Limit the touch direction to the yaw direction only. + * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW); + */ + ; + + _proto.setTouchDirection = function setTouchDirection(direction) { + if (PanoViewer._isValidTouchDirection(direction)) { + this._yawPitchControl.option("touchDirection", direction); + } + + return this; + } + /** + * Returns touch direction by which user can control + * @ko 사용자가 조작가능한 터치 방향을 반환한다. + * @method eg.view360.PanoViewer#getTouchDirection + * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @example + * + * panoViewer = new PanoViewer(el); + * // Returns the current touch direction. + * var dir = panoViewer.getTouchDirection(); + */ + ; + + _proto.getTouchDirection = function getTouchDirection() { + return this._yawPitchControl.option("touchDirection"); + } + /** + * Destroy viewer. Remove all registered event listeners and remove viewer canvas. + * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다. + * @method eg.view360.PanoViewer#destroy + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.destroy = function destroy() { + this._deactivate(); + + if (this._yawPitchControl) { + this._yawPitchControl.destroy(); + + this._yawPitchControl = null; + } + + return this; + } + /** + * Check whether the current environment can execute PanoViewer + * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다. + * @function isSupported + * @memberof eg.view360.PanoViewer + * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부 + * @static + */ + ; + + PanoViewer.isSupported = function isSupported() { + return WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL(); + } + /** + * Check whether the current environment supports the WebGL + * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다. + * @function isWebGLAvailable + * @memberof eg.view360.PanoViewer + * @return {Boolean} WebGL support WebGL 지원여부 + * @static + */ + ; + + PanoViewer.isWebGLAvailable = function isWebGLAvailable() { + return WebGLUtils.isWebGLAvailable(); + } + /** + * Check whether the current environment supports the gyro sensor. + * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다. + * @function isGyroSensorAvailable + * @memberof eg.view360.PanoViewer + * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수 + * @static + */ + ; + + PanoViewer.isGyroSensorAvailable = function isGyroSensorAvailable(callback) { + if (!DeviceMotionEvent) { + callback && callback(false); + return; + } + + var onDeviceMotionChange; + + function checkGyro() { + return new _Promise$4(function (res, rej) { + onDeviceMotionChange = function onDeviceMotionChange(deviceMotion) { + var isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null); + res(isGyroSensorAvailable); + }; + + window.addEventListener("devicemotion", onDeviceMotionChange); + }); + } + + function timeout() { + return new _Promise$4(function (res, rej) { + setTimeout(function () { + return res(false); + }, 1000); + }); + } + + _Promise$4.race([checkGyro(), timeout()]).then(function (isGyroSensorAvailable) { + window.removeEventListener("devicemotion", onDeviceMotionChange); + callback && callback(isGyroSensorAvailable); + + PanoViewer.isGyroSensorAvailable = function (fb) { + fb && fb(isGyroSensorAvailable); + return isGyroSensorAvailable; + }; + }); + }; + + return PanoViewer; + }(Component); + + PanoViewer.VERSION = VERSION; + PanoViewer.ERROR_TYPE = ERROR_TYPE; + PanoViewer.EVENTS = EVENTS$1; + PanoViewer.PROJECTION_TYPE = PROJECTION_TYPE; + PanoViewer.GYRO_MODE = GYRO_MODE; + PanoViewer.ProjectionType = PROJECTION_TYPE; + PanoViewer.STEREO_FORMAT = STEREO_FORMAT; + PanoViewer.TOUCH_DIRECTION = { + /** + * Constant value for none direction. + * @ko none 방향에 대한 상수 값. + * @name NONE + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 1 + */ + NONE: YawPitchControl.TOUCH_DIRECTION_NONE, + + /** + * Constant value for horizontal(yaw) direction. + * @ko horizontal(yaw) 방향에 대한 상수 값. + * @name YAW + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 6 + */ + YAW: YawPitchControl.TOUCH_DIRECTION_YAW, + + /** + * Constant value for vertical direction. + * @ko vertical(pitch) 방향에 대한 상수 값. + * @name PITCH + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 24 + */ + PITCH: YawPitchControl.TOUCH_DIRECTION_PITCH, + + /** + * Constant value for all direction. + * @ko all 방향에 대한 상수 값. + * @name ALL + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 30 + */ + ALL: YawPitchControl.TOUCH_DIRECTION_ALL + }; + return PanoViewer; + }(); + + exports.PanoViewer = PanoViewer; + exports.VERSION = VERSION; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=view360.panoviewer.pkgd.js.map diff --git a/dist/PanoViewer/view360.panoviewer.pkgd.js.map b/dist/PanoViewer/view360.panoviewer.pkgd.js.map new file mode 100644 index 000000000..2705d9e55 --- /dev/null +++ b/dist/PanoViewer/view360.panoviewer.pkgd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.panoviewer.pkgd.js","sources":["../../node_modules/es6-promise/dist/es6-promise.js","../../node_modules/@egjs/component/dist/component.esm.js","../../node_modules/gl-matrix/esm/common.js","../../node_modules/gl-matrix/esm/mat3.js","../../node_modules/gl-matrix/esm/mat4.js","../../node_modules/gl-matrix/esm/vec3.js","../../node_modules/gl-matrix/esm/vec4.js","../../node_modules/gl-matrix/esm/quat.js","../../node_modules/gl-matrix/esm/vec2.js","../../node_modules/@egjs/agent/dist/agent.esm.js","../../src/utils/browser.js","../../src/utils/browserFeature.js","../../node_modules/@egjs/hammerjs/dist/hammer.esm.js","../../node_modules/@egjs/axes/node_modules/@egjs/agent/dist/agent.esm.js","../../node_modules/@egjs/axes/dist/axes.esm.js","../../src/utils/math-util.js","../../src/YawPitchControl/utils.js","../../node_modules/webvr-polyfill/src/math-util.js","../../node_modules/webvr-polyfill/src/util.js","../../node_modules/webvr-polyfill/src/sensor-fusion/pose-predictor.js","../../src/YawPitchControl/consts.js","../../src/YawPitchControl/input/DeviceMotion.js","../../node_modules/webvr-polyfill/src/sensor-fusion/sensor-sample.js","../../node_modules/webvr-polyfill/src/sensor-fusion/complementary-filter.js","../../src/YawPitchControl/input/ComplementaryFilter.js","../../src/YawPitchControl/input/FusionPoseSensor.js","../../src/YawPitchControl/input/TiltMotionInput.js","../../src/YawPitchControl/ScreenRotationAngle.js","../../src/YawPitchControl/input/RotationPanInput.js","../../src/YawPitchControl/DeviceQuaternion.js","../../src/version.js","../../src/YawPitchControl/YawPitchControl.js","../../src/PanoImageRenderer/ImageLoader.js","../../src/PanoImageRenderer/VideoLoader.js","../../src/PanoImageRenderer/WebGLUtils.js","../../src/PanoImageRenderer/renderer/Renderer.js","../../src/PanoImageRenderer/renderer/CubeRenderer.js","../../src/PanoImageRenderer/renderer/CubeStripRenderer.js","../../src/PanoViewer/consts.js","../../src/PanoImageRenderer/renderer/SphereRenderer.js","../../src/PanoImageRenderer/renderer/CylinderRenderer.js","../../src/PanoImageRenderer/vr/VRManager.js","../../src/PanoImageRenderer/vr/XRManager.js","../../src/PanoImageRenderer/WebGLAnimator.js","../../src/PanoImageRenderer/PanoImageRenderer.js","../../src/PanoViewer/PanoViewer.js"],"sourcesContent":["/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.ES6Promise = factory());\n}(this, (function () { 'use strict';\n\nfunction objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n}\n\nfunction isFunction(x) {\n return typeof x === 'function';\n}\n\n\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve$1(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n try {\n then$$1.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then$$1) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then$$1, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$1) {\n if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$1 === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$1)) {\n handleForeignThenable(promise, maybeThenable, then$$1);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then$$1 = void 0;\n try {\n then$$1 = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then$$1);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n}\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve$$1 = c.resolve;\n\n\n if (resolve$$1 === resolve$1) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise$1) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$1) {\n return resolve$$1(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$1(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject$1(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n//# sourceMappingURL=es6-promise.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/component project is licensed under the MIT license\n\n@egjs/component JavaScript library\nhttps://naver.github.io/egjs-component\n\n@version 2.1.2\n*/\n/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\n/**\n * A class used to manage events in a component\n * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스\n * @alias eg.Component\n */\n\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Component.VERSION; // ex) 2.0.0\n * @memberof eg.Component\n */\n\n /**\n * @support {\"ie\": \"7+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n */\n function Component() {\n this._eventHandler = {};\n this.options = {};\n }\n /**\n * Triggers a custom event.\n * @ko 커스텀 이벤트를 발생시킨다\n * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름\n * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터\n * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고\n * @example\n class Some extends eg.Component {\n some(){\n \tif(this.trigger(\"beforeHi\")){ // When event call to stop return false.\n \tthis.trigger(\"hi\");// fire hi event.\n \t}\n }\n }\n const some = new Some();\n some.on(\"beforeHi\", (e) => {\n if(condition){\n \te.stop(); // When event call to stop, `hi` event not call.\n }\n });\n some.on(\"hi\", (e) => {\n // `currentTarget` is component instance.\n console.log(some === e.currentTarget); // true\n });\n // If you want to more know event design. You can see article.\n // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F\n */\n\n\n var _proto = Component.prototype;\n\n _proto.trigger = function trigger(eventName, customEvent) {\n if (customEvent === void 0) {\n customEvent = {};\n }\n\n var handlerList = this._eventHandler[eventName] || [];\n var hasHandlerList = handlerList.length > 0;\n\n if (!hasHandlerList) {\n return true;\n } // If detach method call in handler in first time then handler list calls.\n\n\n handlerList = handlerList.concat();\n customEvent.eventType = eventName;\n var isCanceled = false;\n var arg = [customEvent];\n var i = 0;\n\n customEvent.stop = function () {\n isCanceled = true;\n };\n\n customEvent.currentTarget = this;\n\n for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n restParam[_key - 2] = arguments[_key];\n }\n\n if (restParam.length >= 1) {\n arg = arg.concat(restParam);\n }\n\n for (i = 0; handlerList[i]; i++) {\n handlerList[i].apply(this, arg);\n }\n\n return !isCanceled;\n };\n /**\n * Executed event just one time.\n * @ko 이벤트가 한번만 실행된다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n alert(\"hi\");\n }\n thing() {\n this.once(\"hi\", this.hi);\n }\n }\n var some = new Some();\n some.thing();\n some.trigger(\"hi\");\n // fire alert(\"hi\");\n some.trigger(\"hi\");\n // Nothing happens\n */\n\n\n _proto.once = function once(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var i;\n\n for (i in eventHash) {\n this.once(i, eventHash[i]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var self = this;\n this.on(eventName, function listener() {\n for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arg[_key2] = arguments[_key2];\n }\n\n handlerToAttach.apply(self, arg);\n self.off(eventName, listener);\n });\n }\n\n return this;\n };\n /**\n * Checks whether an event has been attached to a component.\n * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다.\n * @param {String} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름\n * @return {Boolean} Indicates whether the event is attached. 이벤트 등록 여부\n * @example\n class Some extends eg.Component {\n some() {\n this.hasOn(\"hi\");// check hi event.\n }\n }\n */\n\n\n _proto.hasOn = function hasOn(eventName) {\n return !!this._eventHandler[eventName];\n };\n /**\n * Attaches an event to a component.\n * @ko 컴포넌트에 이벤트를 등록한다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.on(\"hi\",this.hi); //attach event\n }\n }\n */\n\n\n _proto.on = function on(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.on(name, eventHash[name]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var handlerList = this._eventHandler[eventName];\n\n if (isUndefined(handlerList)) {\n this._eventHandler[eventName] = [];\n handlerList = this._eventHandler[eventName];\n }\n\n handlerList.push(handlerToAttach);\n }\n\n return this;\n };\n /**\n * Detaches an event from the component.\n * @ko 컴포넌트에 등록된 이벤트를 해제한다\n * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름\n * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.off(\"hi\",this.hi); //detach event\n }\n }\n */\n\n\n _proto.off = function off(eventName, handlerToDetach) {\n // All event detach.\n if (isUndefined(eventName)) {\n this._eventHandler = {};\n return this;\n } // All handler of specific event detach.\n\n\n if (isUndefined(handlerToDetach)) {\n if (typeof eventName === \"string\") {\n this._eventHandler[eventName] = undefined;\n return this;\n } else {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.off(name, eventHash[name]);\n }\n\n return this;\n }\n } // The handler of specific event detach.\n\n\n var handlerList = this._eventHandler[eventName];\n\n if (handlerList) {\n var k;\n var handlerFunction;\n\n for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) {\n if (handlerFunction === handlerToDetach) {\n handlerList = handlerList.splice(k, 1);\n break;\n }\n }\n }\n\n return this;\n };\n\n return Component;\n }();\n\n Component.VERSION = \"2.1.2\";\n return Component;\n}();\n\nexport default Component;\n//# sourceMappingURL=component.esm.js.map\n","/**\r\n * Common utilities\r\n * @module glMatrix\r\n */\n// Configuration Constants\nexport var EPSILON = 0.000001;\nexport var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nexport var RANDOM = Math.random;\n/**\r\n * Sets the type of array used when creating new vectors and matrices\r\n *\r\n * @param {Type} type Array type, such as Float32Array or Array\r\n */\n\nexport function setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\n/**\r\n * Convert Degree To Radian\r\n *\r\n * @param {Number} a Angle in Degrees\r\n */\n\nexport function toRadian(a) {\n return a * degree;\n}\n/**\r\n * Tests whether or not the arguments have approximately the same value, within an absolute\r\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\r\n * than or equal to 1.0, and a relative tolerance is used for larger values)\r\n *\r\n * @param {Number} a The first number to test.\r\n * @param {Number} b The second number to test.\r\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\nif (!Math.hypot) Math.hypot = function () {\n var y = 0,\n i = arguments.length;\n\n while (i--) {\n y += arguments[i] * arguments[i];\n }\n\n return Math.sqrt(y);\n};","import * as glMatrix from \"./common.js\";\n/**\r\n * 3x3 Matrix\r\n * @module mat3\r\n */\n\n/**\r\n * Creates a new identity mat3\r\n *\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(9);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the upper-left 3x3 values into the given mat3.\r\n *\r\n * @param {mat3} out the receiving 3x3 matrix\r\n * @param {mat4} a the source 4x4 matrix\r\n * @returns {mat3} out\r\n */\n\nexport function fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\r\n * Creates a new mat3 initialized with values from an existing matrix\r\n *\r\n * @param {mat3} a matrix to clone\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Copy the values from one mat3 to another\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Create a new mat3 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} A new mat3\r\n */\n\nexport function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set the components of a mat3 to the given values\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} out\r\n */\n\nexport function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set a mat3 to the identity matrix\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @returns {mat3} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b01 = a22 * a11 - a12 * a21;\n var b11 = -a22 * a10 + a12 * a20;\n var b21 = a21 * a10 - a11 * a20; // Calculate the determinant\n\n var det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\r\n * Calculates the determinant of a mat3\r\n *\r\n * @param {mat3} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n}\n/**\r\n * Multiplies two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b00 = b[0],\n b01 = b[1],\n b02 = b[2];\n var b10 = b[3],\n b11 = b[4],\n b12 = b[5];\n var b20 = b[6],\n b21 = b[7],\n b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\r\n * Translate a mat3 by the given vector\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to translate\r\n * @param {vec2} v vector to translate by\r\n * @returns {mat3} out\r\n */\n\nexport function translate(out, a, v) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n x = v[0],\n y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\r\n * Rotates a mat3 by the given angle\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function rotate(out, a, rad) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n;\n/**\r\n * Scales the mat3 by the dimensions in the given vec2\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {vec2} v the vec2 to scale the matrix by\r\n * @returns {mat3} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Translation vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function fromRotation(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Scaling vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the values from a mat2d into a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat2d} a the matrix to copy\r\n * @returns {mat3} out\r\n **/\n\nexport function fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\r\n* Calculates a 3x3 matrix from the given quaternion\r\n*\r\n* @param {mat3} out mat3 receiving operation result\r\n* @param {quat} q Quaternion to create matrix from\r\n*\r\n* @returns {mat3} out\r\n*/\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\r\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n*\r\n* @param {mat3} out mat3 receiving operation result\r\n* @param {mat4} a Mat4 to derive the normal matrix from\r\n*\r\n* @returns {mat3} out\r\n*/\n\nexport function normalFromMat4(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\r\n * Generates a 2D projection matrix with the given bounds\r\n *\r\n * @param {mat3} out mat3 frustum matrix will be written into\r\n * @param {number} width Width of your gl context\r\n * @param {number} height Height of gl context\r\n * @returns {mat3} out\r\n */\n\nexport function projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Returns a string representation of a mat3\r\n *\r\n * @param {mat3} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n}\n/**\r\n * Returns Frobenius norm of a mat3\r\n *\r\n * @param {mat3} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);\n}\n/**\r\n * Adds two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\r\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat3} out the receiving vector\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7],\n a8 = a[8];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));\n}\n/**\r\n * Alias for {@link mat3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied.\r\n * @module mat4\r\n */\n\n/**\r\n * Creates a new identity mat4\r\n *\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 initialized with values from an existing matrix\r\n *\r\n * @param {mat4} a matrix to clone\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Copy the values from one mat4 to another\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Create a new mat4 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} A new mat4\r\n */\n\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set the components of a mat4 to the given values\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} out\r\n */\n\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set a mat4 to the identity matrix\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @returns {mat4} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\r\n * Calculates the determinant of a mat4\r\n *\r\n * @param {mat4} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\r\n * Multiplies two mat4s\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\r\n * Translate a mat4 by the given vector\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to translate\r\n * @param {vec3} v vector to translate by\r\n * @returns {mat4} out\r\n */\n\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\r\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {vec3} v the vec3 to scale the matrix by\r\n * @returns {mat4} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Rotates a mat4 by the given angle around the given axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the X axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Y axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Z axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 from a dual quat.\r\n *\r\n * @param {mat4} out Matrix\r\n * @param {quat2} a Dual Quaternion\r\n * @returns {mat4} mat4 receiving operation result\r\n */\n\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion paramter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @param {quat} out Quaternion to receive the rotation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {quat} out\r\n */\n\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @param {vec3} o The origin vector around which to scale and rotate\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat} q Quaternion to create matrix from\r\n *\r\n * @returns {mat4} out\r\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a frustum matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Number} left Left bound of the frustum\r\n * @param {Number} right Right bound of the frustum\r\n * @param {Number} bottom Bottom bound of the frustum\r\n * @param {Number} top Top bound of the frustum\r\n * @param {Number} near Near bound of the frustum\r\n * @param {Number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} fovy Vertical field of view in radians\r\n * @param {number} aspect Aspect ratio. typically viewport width/height\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum, can be null or Infinity\r\n * @returns {mat4} out\r\n */\n\nexport function perspective(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given field of view.\r\n * This is primarily useful for generating projection matrices to be used\r\n * with the still experiemental WebVR API.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\r\n * Generates a orthogonal projection matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} left Left bound of the frustum\r\n * @param {number} right Right bound of the frustum\r\n * @param {number} bottom Bottom bound of the frustum\r\n * @param {number} top Top bound of the frustum\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\r\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a matrix that makes something look at something else.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n;\n/**\r\n * Returns a string representation of a mat4\r\n *\r\n * @param {mat4} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n}\n/**\r\n * Returns Frobenius norm of a mat4\r\n *\r\n * @param {mat4} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\r\n * Adds two mat4's\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat4} out the receiving vector\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\r\n * Alias for {@link mat4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 3 Dimensional Vector\r\n * @module vec3\r\n */\n\n/**\r\n * Creates a new, empty vec3\r\n *\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n *\r\n * @param {vec3} a vector to clone\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Calculates the length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Creates a new vec3 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Copy the values from one vec3 to another\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the source vector\r\n * @returns {vec3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Set the components of a vec3 to the given values\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} out\r\n */\n\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Adds two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\r\n * Multiplies two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\r\n * Divides two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to ceil\r\n * @returns {vec3} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to floor\r\n * @returns {vec3} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\r\n * Math.round the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to round\r\n * @returns {vec3} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\r\n * Scales a vec3 by a scalar number\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec3} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec3} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Calculates the squared length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Negates the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to negate\r\n * @returns {vec3} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to invert\r\n * @returns {vec3} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\r\n * Normalize a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to normalize\r\n * @returns {vec3} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\r\n * Computes the cross product of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\r\n * Performs a hermite interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Performs a bezier interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec3} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat3.\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat3} m the 3x3 matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\r\n * Rotate a 3D vector around the x-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateX(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(c) - p[2] * Math.sin(c);\n r[2] = p[1] * Math.sin(c) + p[2] * Math.cos(c); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the y-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateY(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(c) + p[0] * Math.cos(c);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(c) - p[0] * Math.sin(c); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the z-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateZ(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(c) - p[1] * Math.sin(c);\n r[1] = p[0] * Math.sin(c) + p[1] * Math.cos(c);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Get the angle between two 3D vectors\r\n * @param {vec3} a The first operand\r\n * @param {vec3} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var tempA = fromValues(a[0], a[1], a[2]);\n var tempB = fromValues(b[0], b[1], b[2]);\n normalize(tempA, tempA);\n normalize(tempB, tempB);\n var cosine = dot(tempA, tempB);\n\n if (cosine > 1.0) {\n return 0;\n } else if (cosine < -1.0) {\n return Math.PI;\n } else {\n return Math.acos(cosine);\n }\n}\n/**\r\n * Set the components of a vec3 to zero\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @returns {vec3} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec3} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\r\n * Alias for {@link vec3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec3.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec3.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec3.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec3.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec3.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec3s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 4 Dimensional Vector\r\n * @module vec4\r\n */\n\n/**\r\n * Creates a new, empty vec4\r\n *\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with values from an existing vector\r\n *\r\n * @param {vec4} a vector to clone\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function fromValues(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Copy the values from one vec4 to another\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the source vector\r\n * @returns {vec4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to the given values\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} out\r\n */\n\nexport function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Adds two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\r\n * Multiplies two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\r\n * Divides two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to ceil\r\n * @returns {vec4} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to floor\r\n * @returns {vec4} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\r\n * Math.round the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to round\r\n * @returns {vec4} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\r\n * Scales a vec4 by a scalar number\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec4} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\r\n * Adds two vec4's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec4} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Calculates the length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Negates the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to negate\r\n * @returns {vec4} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to invert\r\n * @returns {vec4} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\r\n * Normalize a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to normalize\r\n * @returns {vec4} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n *\r\n * @param {vec4} result the receiving vector\r\n * @param {vec4} U the first vector\r\n * @param {vec4} V the second vector\r\n * @param {vec4} W the third vector\r\n * @returns {vec4} result\r\n */\n\nexport function cross(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n;\n/**\r\n * Performs a linear interpolation between two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec4} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec4} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\r\n * Transforms the vec4 with a mat4.\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\r\n * Transforms the vec4 with a quat\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to zero\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @returns {vec4} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec4} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\r\n * Alias for {@link vec4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec4.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec4.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec4.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec4.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec4.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec4s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\nimport * as mat3 from \"./mat3.js\";\nimport * as vec3 from \"./vec3.js\";\nimport * as vec4 from \"./vec4.js\";\n/**\r\n * Quaternion\r\n * @module quat\r\n */\n\n/**\r\n * Creates a new identity quat\r\n *\r\n * @returns {quat} a new quaternion\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n out[3] = 1;\n return out;\n}\n/**\r\n * Set a quat to the identity quaternion\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @returns {quat} out\r\n */\n\nexport function identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {vec3} axis the axis around which to rotate\r\n * @param {Number} rad the angle in radians\r\n * @returns {quat} out\r\n **/\n\nexport function setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n}\n/**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as providied in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @param {vec3} out_axis Vector receiving the axis of rotation\r\n * @param {quat} q Quaternion to be decomposed\r\n * @return {Number} Angle, in radians, of the rotation\r\n */\n\nexport function getAxisAngle(out_axis, q) {\n var rad = Math.acos(q[3]) * 2.0;\n var s = Math.sin(rad / 2.0);\n\n if (s > glMatrix.EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n } else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n\n return rad;\n}\n/**\r\n * Gets the angular distance between two unit quaternions\r\n *\r\n * @param {quat} a Origin unit quaternion \r\n * @param {quat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\n\nexport function getAngle(a, b) {\n var dotproduct = dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n}\n/**\r\n * Multiplies two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {quat} out\r\n */\n\nexport function multiply(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the X axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateX(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateY(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var by = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bz = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n}\n/**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate W component of\r\n * @returns {quat} out\r\n */\n\nexport function calculateW(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n}\n/**\r\n * Calculate the exponential of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @returns {quat} out\r\n */\n\nexport function exp(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var et = Math.exp(w);\n var s = r > 0 ? et * Math.sin(r) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n}\n/**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @returns {quat} out\r\n */\n\nexport function ln(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n}\n/**\r\n * Calculate the scalar power of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @param {Number} b amount to scale the quaternion by\r\n * @returns {quat} out\r\n */\n\nexport function pow(out, a, b) {\n ln(out, a);\n scale(out, out, b);\n exp(out, out);\n return out;\n}\n/**\r\n * Performs a spherical linear interpolation between two quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n */\n\nexport function slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n var omega, cosom, sinom, scale0, scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > glMatrix.EPSILON) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n}\n/**\r\n * Generates a random unit quaternion\r\n * \r\n * @param {quat} out the receiving quaternion\r\n * @returns {quat} out\r\n */\n\nexport function random(out) {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n var u1 = glMatrix.RANDOM();\n var u2 = glMatrix.RANDOM();\n var u3 = glMatrix.RANDOM();\n var sqrt1MinusU1 = Math.sqrt(1 - u1);\n var sqrtU1 = Math.sqrt(u1);\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n}\n/**\r\n * Calculates the inverse of a quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate inverse of\r\n * @returns {quat} out\r\n */\n\nexport function invert(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n}\n/**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate conjugate of\r\n * @returns {quat} out\r\n */\n\nexport function conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to renormalize the quaternion yourself where necessary.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {mat3} m rotation matrix\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport function fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if (m[4] > m[0]) i = 1;\n if (m[8] > m[i * 3 + i]) i = 2;\n var j = (i + 1) % 3;\n var k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n\n return out;\n}\n/**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {x} Angle to rotate around X axis in degrees.\r\n * @param {y} Angle to rotate around Y axis in degrees.\r\n * @param {z} Angle to rotate around Z axis in degrees.\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport function fromEuler(out, x, y, z) {\n var halfToRad = 0.5 * Math.PI / 180.0;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n var sx = Math.sin(x);\n var cx = Math.cos(x);\n var sy = Math.sin(y);\n var cy = Math.cos(y);\n var sz = Math.sin(z);\n var cz = Math.cos(z);\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n return out;\n}\n/**\r\n * Returns a string representation of a quatenion\r\n *\r\n * @param {quat} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n}\n/**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n *\r\n * @param {quat} a quaternion to clone\r\n * @returns {quat} a new quaternion\r\n * @function\r\n */\n\nexport var clone = vec4.clone;\n/**\r\n * Creates a new quat initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {quat} a new quaternion\r\n * @function\r\n */\n\nexport var fromValues = vec4.fromValues;\n/**\r\n * Copy the values from one quat to another\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the source quaternion\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var copy = vec4.copy;\n/**\r\n * Set the components of a quat to the given values\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var set = vec4.set;\n/**\r\n * Adds two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var add = vec4.add;\n/**\r\n * Alias for {@link quat.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Scales a quat by a scalar number\r\n *\r\n * @param {quat} out the receiving vector\r\n * @param {quat} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var scale = vec4.scale;\n/**\r\n * Calculates the dot product of two quat's\r\n *\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {Number} dot product of a and b\r\n * @function\r\n */\n\nexport var dot = vec4.dot;\n/**\r\n * Performs a linear interpolation between two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var lerp = vec4.lerp;\n/**\r\n * Calculates the length of a quat\r\n *\r\n * @param {quat} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport var length = vec4.length;\n/**\r\n * Alias for {@link quat.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Calculates the squared length of a quat\r\n *\r\n * @param {quat} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n * @function\r\n */\n\nexport var squaredLength = vec4.squaredLength;\n/**\r\n * Alias for {@link quat.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Normalize a quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quaternion to normalize\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var normalize = vec4.normalize;\n/**\r\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {quat} a The first quaternion.\r\n * @param {quat} b The second quaternion.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport var exactEquals = vec4.exactEquals;\n/**\r\n * Returns whether or not the quaternions have approximately the same elements in the same position.\r\n *\r\n * @param {quat} a The first vector.\r\n * @param {quat} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport var equals = vec4.equals;\n/**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n *\r\n * @param {quat} out the receiving quaternion.\r\n * @param {vec3} a the initial vector\r\n * @param {vec3} b the destination vector\r\n * @returns {quat} out\r\n */\n\nexport var rotationTo = function () {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1, 0, 0);\n var yUnitVec3 = vec3.fromValues(0, 1, 0);\n return function (out, a, b) {\n var dot = vec3.dot(a, b);\n\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.len(tmpvec3) < 0.000001) vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return normalize(out, out);\n }\n };\n}();\n/**\r\n * Performs a spherical linear interpolation with two control points\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {quat} c the third operand\r\n * @param {quat} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n */\n\nexport var sqlerp = function () {\n var temp1 = create();\n var temp2 = create();\n return function (out, a, b, c, d, t) {\n slerp(temp1, a, d, t);\n slerp(temp2, b, c, t);\n slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n };\n}();\n/**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n *\r\n * @param {vec3} view the vector representing the viewing direction\r\n * @param {vec3} right the vector representing the local \"right\" direction\r\n * @param {vec3} up the vector representing the local \"up\" direction\r\n * @returns {quat} out\r\n */\n\nexport var setAxes = function () {\n var matr = mat3.create();\n return function (out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n return normalize(out, fromMat3(out, matr));\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 2 Dimensional Vector\r\n * @module vec2\r\n */\n\n/**\r\n * Creates a new, empty vec2\r\n *\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(2);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with values from an existing vector\r\n *\r\n * @param {vec2} a vector to clone\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function fromValues(x, y) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Copy the values from one vec2 to another\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the source vector\r\n * @returns {vec2} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Set the components of a vec2 to the given values\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} out\r\n */\n\nexport function set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Adds two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n/**\r\n * Multiplies two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n/**\r\n * Divides two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to ceil\r\n * @returns {vec2} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to floor\r\n * @returns {vec2} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n/**\r\n * Math.round the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to round\r\n * @returns {vec2} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n}\n/**\r\n * Scales a vec2 by a scalar number\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec2} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n/**\r\n * Adds two vec2's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec2} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x * x + y * y;\n}\n/**\r\n * Calculates the length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0],\n y = a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0],\n y = a[1];\n return x * x + y * y;\n}\n/**\r\n * Negates the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to negate\r\n * @returns {vec2} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to invert\r\n * @returns {vec2} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n/**\r\n * Normalize a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to normalize\r\n * @returns {vec2} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0],\n y = a[1];\n var len = x * x + y * y;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n}\n/**\r\n * Computes the cross product of two vec2's\r\n * Note that the cross product must by definition produce a 3D vector\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec2} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec2} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2d\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2d} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2d(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat3\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat3} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat4\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0];\n var y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n/**\r\n * Rotate a 2D vector\r\n * @param {vec2} out The receiving vec2\r\n * @param {vec2} a The vec2 point to rotate\r\n * @param {vec2} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec2} out\r\n */\n\nexport function rotate(out, a, b, c) {\n //Translate point to the origin\n var p0 = a[0] - b[0],\n p1 = a[1] - b[1],\n sinC = Math.sin(c),\n cosC = Math.cos(c); //perform rotation and translate to correct position\n\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n}\n/**\r\n * Get the angle between two 2D vectors\r\n * @param {vec2} a The first operand\r\n * @param {vec2} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var x1 = a[0],\n y1 = a[1],\n x2 = b[0],\n y2 = b[1];\n var len1 = x1 * x1 + y1 * y1;\n\n if (len1 > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len1 = 1 / Math.sqrt(len1);\n }\n\n var len2 = x2 * x2 + y2 * y2;\n\n if (len2 > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len2 = 1 / Math.sqrt(len2);\n }\n\n var cosine = (x1 * x2 + y1 * y2) * len1 * len2;\n\n if (cosine > 1.0) {\n return 0;\n } else if (cosine < -1.0) {\n return Math.PI;\n } else {\n return Math.acos(cosine);\n }\n}\n/**\r\n * Set the components of a vec2 to zero\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @returns {vec2} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec2} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec2(' + a[0] + ', ' + a[1] + ')';\n}\n/**\r\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1];\n var b0 = b[0],\n b1 = b[1];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));\n}\n/**\r\n * Alias for {@link vec2.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec2.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec2.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec2.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec2.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec2.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec2.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec2s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 2;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n\n return a;\n };\n}();","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","/*! Hammer.JS - v2.0.17-rc - 2019-12-16\n * http://naver.github.io/egjs\n *\n * Forked By Naver egjs\n * Copyright (c) hammerjs\n * Licensed under the MIT license */\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\n\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\nvar assign$1 = assign;\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = typeof document === \"undefined\" ? {\n style: {}\n} : document.createElement('div');\nvar TYPE_FUNCTION = 'function';\nvar round = Math.round,\n abs = Math.abs;\nvar now = Date.now;\n\n/**\n * @private\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n\nfunction prefixed(obj, property) {\n var prefix;\n var prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n\n i++;\n }\n\n return undefined;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {};\n} else {\n win = window;\n}\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\nfunction getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n\n var touchMap = {};\n var cssSupports = win.CSS && win.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n}\n\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\nvar TOUCH_ACTION_MAP = getTouchActionProps();\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\nvar SUPPORT_TOUCH = 'ontouchstart' in win;\nvar SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\nvar COMPUTE_INTERVAL = 25;\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * @private\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * @private\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n\nfunction boolOrFn(val, args) {\n if (typeof val === TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n\n return val;\n}\n\n/**\n * @private\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * @private\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n } // pan-x OR pan-y\n\n\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n } // manipulation\n\n\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * @private\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n\nvar TouchAction =\n/*#__PURE__*/\nfunction () {\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n /**\n * @private\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n\n\n var _proto = TouchAction.prototype;\n\n _proto.set = function set(value) {\n // find out the touch-action by the event handlers\n if (value === TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n\n this.actions = value.toLowerCase().trim();\n };\n /**\n * @private\n * just re-set the touchAction value\n */\n\n\n _proto.update = function update() {\n this.set(this.manager.options.touchAction);\n };\n /**\n * @private\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n\n\n _proto.compute = function compute() {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n };\n /**\n * @private\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n\n\n _proto.preventDefaults = function preventDefaults(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection; // if the touch action did prevented once this session\n\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n\n if (hasNone) {\n // do not prevent defaults if this is a tap gesture\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {\n return this.preventSrc(srcEvent);\n }\n };\n /**\n * @private\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n\n\n _proto.preventSrc = function preventSrc(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n };\n\n return TouchAction;\n}();\n\n/**\n * @private\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node === parent) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}\n\n/**\n * @private\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n\nfunction getCenter(pointers) {\n var pointersLength = pointers.length; // no need to loop when only one touch\n\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0;\n var y = 0;\n var i = 0;\n\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * @private\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * @private\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * @private\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * @private\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session;\n // jscs throwing error on defalut destructured values and without defaults tests fail\n\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * @private\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * @private\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input;\n var deltaTime = input.timeStamp - last.timeStamp;\n var velocity;\n var velocityX;\n var velocityY;\n var direction;\n\n if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n* @private\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length; // store the first input to calculate the distance and direction\n\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n } // to compute scale and rotation we need to store the multiple touches\n\n\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput,\n firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;\n computeIntervalInputData(session, input); // find the correct target\n\n var target = manager.element;\n var srcEvent = input.srcEvent;\n var srcEventTarget;\n\n if (srcEvent.composedPath) {\n srcEventTarget = srcEvent.composedPath()[0];\n } else if (srcEvent.path) {\n srcEventTarget = srcEvent.path[0];\n } else {\n srcEventTarget = srcEvent.target;\n }\n\n if (hasParent(srcEventTarget, target)) {\n target = srcEventTarget;\n }\n\n input.target = target;\n}\n\n/**\n * @private\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n } // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n\n\n input.eventType = eventType; // compute scale, rotation etc\n\n computeInputData(manager, input); // emit secret event\n\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * @private\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * @private\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n}\n\n/**\n * @private\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n\nvar Input =\n/*#__PURE__*/\nfunction () {\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n }\n /**\n * @private\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n\n\n var _proto = Input.prototype;\n\n _proto.handler = function handler() {};\n /**\n * @private\n * bind the events\n */\n\n\n _proto.init = function init() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n /**\n * @private\n * unbind the events\n */\n\n\n _proto.destroy = function destroy() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n\n return Input;\n}();\n\n/**\n * @private\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n\n while (i < src.length) {\n if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {\n // do not use === here, test fails\n return i;\n }\n\n i++;\n }\n\n return -1;\n }\n}\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n}; // in IE10 the pointer types is defined as an enum\n\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\n};\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive\n\nif (win.MSPointerEvent && !win.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n/**\n * @private\n * Pointer events input\n * @constructor\n * @extends Input\n */\n\n\nvar PointerEventInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(PointerEventInput, _Input);\n\n function PointerEventInput() {\n var _this;\n\n var proto = PointerEventInput.prototype;\n proto.evEl = POINTER_ELEMENT_EVENTS;\n proto.evWin = POINTER_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.store = _this.manager.session.pointerEvents = [];\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = PointerEventInput.prototype;\n\n _proto.handler = function handler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store\n\n var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down\n\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n } // it not found, so the pointer hasn't been down (so it's probably a hover)\n\n\n if (storeIndex < 0) {\n return;\n } // update the event in the store\n\n\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n };\n\n return PointerEventInput;\n}(Input);\n\n/**\n * @private\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * @private\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function (a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n\nvar TouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(TouchInput, _Input);\n\n function TouchInput() {\n var _this;\n\n TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS;\n\n return _this;\n }\n\n var _proto = TouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return TouchInput;\n}(Input);\n\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds; // when there is only one touch, the process can be simplified\n\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i;\n var targetTouches;\n var changedTouches = toArray(ev.changedTouches);\n var changedTargetTouches = [];\n var target = this.target; // get target touches from touches\n\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n }); // collect touches\n\n if (type === INPUT_START) {\n i = 0;\n\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n } // filter changed touches to only contain touches that exist in the collected target ids\n\n\n i = 0;\n\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n } // cleanup removed touches\n\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n/**\n * @private\n * Mouse events input\n * @constructor\n * @extends Input\n */\n\nvar MouseInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(MouseInput, _Input);\n\n function MouseInput() {\n var _this;\n\n var proto = MouseInput.prototype;\n proto.evEl = MOUSE_ELEMENT_EVENTS;\n proto.evWin = MOUSE_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.pressed = false; // mousedown state\n\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = MouseInput.prototype;\n\n _proto.handler = function handler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down\n\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n } // mouse must be down\n\n\n if (!this.pressed) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n };\n\n return MouseInput;\n}(Input);\n\n/**\n * @private\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\nvar DEDUP_TIMEOUT = 2500;\nvar DEDUP_DISTANCE = 25;\n\nfunction setLastTouch(eventData) {\n var _eventData$changedPoi = eventData.changedPointers,\n touch = _eventData$changedPoi[0];\n\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {\n x: touch.clientX,\n y: touch.clientY\n };\n var lts = this.lastTouches;\n this.lastTouches.push(lastTouch);\n\n var removeLastTouch = function removeLastTouch() {\n var i = lts.indexOf(lastTouch);\n\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n}\n\nfunction recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n}\n\nfunction isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX;\n var y = eventData.srcEvent.clientY;\n\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x);\n var dy = Math.abs(y - t.y);\n\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n\n return false;\n}\n\nvar TouchMouseInput =\n/*#__PURE__*/\nfunction () {\n var TouchMouseInput =\n /*#__PURE__*/\n function (_Input) {\n _inheritsLoose(TouchMouseInput, _Input);\n\n function TouchMouseInput(_manager, callback) {\n var _this;\n\n _this = _Input.call(this, _manager, callback) || this;\n\n _this.handler = function (manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;\n var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;\n\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n } // when we're in a touch event, record touches to de-dupe synthetic mouse event\n\n\n if (isTouch) {\n recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) {\n return;\n }\n\n _this.callback(manager, inputEvent, inputData);\n };\n\n _this.touch = new TouchInput(_this.manager, _this.handler);\n _this.mouse = new MouseInput(_this.manager, _this.handler);\n _this.primaryTouch = null;\n _this.lastTouches = [];\n return _this;\n }\n /**\n * @private\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n\n\n var _proto = TouchMouseInput.prototype;\n\n /**\n * @private\n * remove the event listeners\n */\n _proto.destroy = function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n };\n\n return TouchMouseInput;\n }(Input);\n\n return TouchMouseInput;\n}();\n\n/**\n * @private\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n\nfunction createInputInstance(manager) {\n var Type; // let inputClass = manager.options.inputClass;\n\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n\n return new Type(manager, inputHandler);\n}\n\n/**\n * @private\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n\n return false;\n}\n\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * @private\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * @private\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n\n if (manager) {\n return manager.get(otherRecognizer);\n }\n\n return otherRecognizer;\n}\n\n/**\n * @private\n * get a usable string, used as event postfix\n * @param {constant} state\n * @returns {String} state\n */\n\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n\n return '';\n}\n\n/**\n * @private\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n\n/**\n * @private\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n\nvar Recognizer =\n/*#__PURE__*/\nfunction () {\n function Recognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.options = _extends({\n enable: true\n }, options);\n this.id = uniqueId();\n this.manager = null; // default is enable true\n\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n\n\n var _proto = Recognizer.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state\n\n this.manager && this.manager.touchAction.update();\n return this;\n };\n /**\n * @private\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.recognizeWith = function recognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n };\n /**\n * @private\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.requireFailure = function requireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n\n return this;\n };\n /**\n * @private\n * has require failures boolean\n * @returns {boolean}\n */\n\n\n _proto.hasRequireFailures = function hasRequireFailures() {\n return this.requireFail.length > 0;\n };\n /**\n * @private\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n\n\n _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n };\n /**\n * @private\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n\n\n _proto.emit = function emit(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n } // 'panstart' and 'panmove'\n\n\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n } // panend and pancancel\n\n\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n };\n /**\n * @private\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n\n\n _proto.tryEmit = function tryEmit(input) {\n if (this.canEmit()) {\n return this.emit(input);\n } // it's failing anyway\n\n\n this.state = STATE_FAILED;\n };\n /**\n * @private\n * can we emit?\n * @returns {boolean}\n */\n\n\n _proto.canEmit = function canEmit() {\n var i = 0;\n\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n\n i++;\n }\n\n return true;\n };\n /**\n * @private\n * update the recognizer\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing?\n\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n } // reset when we've reached the end\n\n\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone); // the recognizer has recognized a gesture\n // so trigger an event\n\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n };\n /**\n * @private\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {constant} STATE\n */\n\n /* jshint ignore:start */\n\n\n _proto.process = function process(inputData) {};\n /* jshint ignore:end */\n\n /**\n * @private\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n\n\n _proto.getTouchAction = function getTouchAction() {};\n /**\n * @private\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n\n\n _proto.reset = function reset() {};\n\n return Recognizer;\n}();\n\n/**\n * @private\n * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n\nvar TapRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(TapRecognizer, _Recognizer);\n\n function TapRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n // max time between the multi-tap taps\n time: 250,\n // max time of the pointer to be down (like finger on the screen)\n threshold: 9,\n // a minimal movement is ok, but keep it low\n posThreshold: 10\n }, options)) || this; // previous time and center,\n // used for tap counting\n\n _this.pTime = false;\n _this.pCenter = false;\n _this._timer = null;\n _this._input = null;\n _this.count = 0;\n return _this;\n }\n\n var _proto = TapRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_MANIPULATION];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n\n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n } // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType !== INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input; // if tap count matches we have recognized it,\n // else it has began recognizing...\n\n var tapCount = this.count % options.taps;\n\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.interval);\n return STATE_BEGAN;\n }\n }\n }\n\n return STATE_FAILED;\n };\n\n _proto.failTimeout = function failTimeout() {\n var _this3 = this;\n\n this._timer = setTimeout(function () {\n _this3.state = STATE_FAILED;\n }, this.options.interval);\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit() {\n if (this.state === STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return TapRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n\nvar AttrRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(AttrRecognizer, _Recognizer);\n\n function AttrRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _Recognizer.call(this, _extends({\n pointers: 1\n }, options)) || this;\n }\n /**\n * @private\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n\n\n var _proto = AttrRecognizer.prototype;\n\n _proto.attrTest = function attrTest(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n };\n /**\n * @private\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n\n\n _proto.process = function process(input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED\n\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n\n return state | STATE_CHANGED;\n }\n\n return STATE_FAILED;\n };\n\n return AttrRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * direction cons to string\n * @param {constant} direction\n * @returns {String}\n */\n\nfunction directionStr(direction) {\n if (direction === DIRECTION_DOWN) {\n return 'down';\n } else if (direction === DIRECTION_UP) {\n return 'up';\n } else if (direction === DIRECTION_LEFT) {\n return 'left';\n } else if (direction === DIRECTION_RIGHT) {\n return 'right';\n }\n\n return '';\n}\n\n/**\n * @private\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PanRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PanRecognizer, _AttrRecognizer);\n\n function PanRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _AttrRecognizer.call(this, _extends({\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n }, options)) || this;\n _this.pX = null;\n _this.pY = null;\n return _this;\n }\n\n var _proto = PanRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n var direction = this.options.direction;\n var actions = [];\n\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n\n return actions;\n };\n\n _proto.directionTest = function directionTest(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY; // lock to axis?\n\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x !== this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y !== this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n };\n\n _proto.attrTest = function attrTest(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call\n this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));\n };\n\n _proto.emit = function emit(input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PanRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar SwipeRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(SwipeRecognizer, _AttrRecognizer);\n\n function SwipeRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n }, options)) || this;\n }\n\n var _proto = SwipeRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n };\n\n _proto.attrTest = function attrTest(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n };\n\n _proto.emit = function emit(input) {\n var direction = directionStr(input.offsetDirection);\n\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n };\n\n return SwipeRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PinchRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PinchRecognizer, _AttrRecognizer);\n\n function PinchRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'pinch',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = PinchRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n _proto.emit = function emit(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PinchRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar RotateRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(RotateRecognizer, _AttrRecognizer);\n\n function RotateRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'rotate',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = RotateRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n return RotateRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n\nvar PressRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(PressRecognizer, _Recognizer);\n\n function PressRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'press',\n pointers: 1,\n time: 251,\n // minimal time of the pointer to be pressed\n threshold: 9\n }, options)) || this;\n _this._timer = null;\n _this._input = null;\n return _this;\n }\n\n var _proto = PressRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_AUTO];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input; // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.time);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + \"up\", input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return PressRecognizer;\n}(Recognizer);\n\nvar defaults = {\n /**\n * @private\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * @private\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @private\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * @private\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * @private\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * @private\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * @private\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: \"none\",\n\n /**\n * @private\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: \"none\",\n\n /**\n * @private\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: \"none\",\n\n /**\n * @private\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: \"none\",\n\n /**\n * @private\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: \"none\",\n\n /**\n * @private\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: \"rgba(0,0,0,0)\"\n }\n};\n/**\n * @private\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * This is separated with other defaults because of tree-shaking.\n * @type {Array}\n */\n\nvar preset = [[RotateRecognizer, {\n enable: false\n}], [PinchRecognizer, {\n enable: false\n}, ['rotate']], [SwipeRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}], [PanRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}, ['swipe']], [TapRecognizer], [TapRecognizer, {\n event: 'doubletap',\n taps: 2\n}, ['tap']], [PressRecognizer]];\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n/**\n * @private\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n\n if (!element.style) {\n return;\n }\n\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || \"\";\n }\n });\n\n if (!add) {\n manager.oldCssProps = {};\n }\n}\n/**\n * @private\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n\n\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent(\"Event\");\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n/**\n* @private\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\n\nvar Manager =\n/*#__PURE__*/\nfunction () {\n function Manager(element, options) {\n var _this = this;\n\n this.options = assign$1({}, defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = _this.add(new item[0](item[1]));\n\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n\n\n var _proto = Manager.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // Options that need a little more setup\n\n if (options.touchAction) {\n this.touchAction.update();\n }\n\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n\n return this;\n };\n /**\n * @private\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n\n\n _proto.stop = function stop(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n };\n /**\n * @private\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n var session = this.session;\n\n if (session.stopped) {\n return;\n } // run the touch-action polyfill\n\n\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers; // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n\n var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized\n // or when we're in a new session\n\n if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {\n session.curRecognizer = null;\n curRecognizer = null;\n }\n\n var i = 0;\n\n while (i < recognizers.length) {\n recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer === curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n\n\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n session.curRecognizer = recognizer;\n curRecognizer = recognizer;\n }\n\n i++;\n }\n };\n /**\n * @private\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n\n\n _proto.get = function get(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event === recognizer) {\n return recognizers[i];\n }\n }\n\n return null;\n };\n /**\n * @private add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n\n\n _proto.add = function add(recognizer) {\n if (invokeArrayArg(recognizer, \"add\", this)) {\n return this;\n } // remove existing\n\n\n var existing = this.get(recognizer.options.event);\n\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n };\n /**\n * @private\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n\n\n _proto.remove = function remove(recognizer) {\n if (invokeArrayArg(recognizer, \"remove\", this)) {\n return this;\n }\n\n var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists\n\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, targetRecognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n };\n /**\n * @private\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n\n\n _proto.on = function on(events, handler) {\n if (events === undefined || handler === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n };\n /**\n * @private unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n\n\n _proto.off = function off(events, handler) {\n if (events === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n };\n /**\n * @private emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n\n\n _proto.emit = function emit(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n } // no handlers, so skip it all\n\n\n var handlers = this.handlers[event] && this.handlers[event].slice();\n\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n };\n /**\n * @private\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n\n\n _proto.destroy = function destroy() {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n };\n\n return Manager;\n}();\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Touch events input\n * @constructor\n * @extends Input\n */\n\nvar SingleTouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(SingleTouchInput, _Input);\n\n function SingleTouchInput() {\n var _this;\n\n var proto = SingleTouchInput.prototype;\n proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.started = false;\n return _this;\n }\n\n var _proto = SingleTouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?\n\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state\n\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return SingleTouchInput;\n}(Input);\n\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\n/**\n * @private\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = \"DEPRECATED METHOD: \" + name + \"\\n\" + message + \" AT \\n\";\n return function () {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '').replace(/^\\s+at\\s+/gm, '').replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n\n return method.apply(this, arguments);\n };\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n\nvar extend = deprecate(function (dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n\n while (i < keys.length) {\n if (!merge || merge && dest[keys[i]] === undefined) {\n dest[keys[i]] = src[keys[i]];\n }\n\n i++;\n }\n\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * @private\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n\nvar merge = deprecate(function (dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * @private\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n\nfunction inherit(child, base, properties) {\n var baseP = base.prototype;\n var childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign$1(childP, properties);\n }\n}\n\n/**\n * @private\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * @private\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\nvar Hammer =\n/*#__PURE__*/\nfunction () {\n var Hammer =\n /**\n * @private\n * @const {string}\n */\n function Hammer(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n return new Manager(element, _extends({\n recognizers: preset.concat()\n }, options));\n };\n\n Hammer.VERSION = \"2.0.17-rc\";\n Hammer.DIRECTION_ALL = DIRECTION_ALL;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.DIRECTION_LEFT = DIRECTION_LEFT;\n Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;\n Hammer.DIRECTION_UP = DIRECTION_UP;\n Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n Hammer.DIRECTION_NONE = DIRECTION_NONE;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.INPUT_START = INPUT_START;\n Hammer.INPUT_MOVE = INPUT_MOVE;\n Hammer.INPUT_END = INPUT_END;\n Hammer.INPUT_CANCEL = INPUT_CANCEL;\n Hammer.STATE_POSSIBLE = STATE_POSSIBLE;\n Hammer.STATE_BEGAN = STATE_BEGAN;\n Hammer.STATE_CHANGED = STATE_CHANGED;\n Hammer.STATE_ENDED = STATE_ENDED;\n Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;\n Hammer.STATE_CANCELLED = STATE_CANCELLED;\n Hammer.STATE_FAILED = STATE_FAILED;\n Hammer.Manager = Manager;\n Hammer.Input = Input;\n Hammer.TouchAction = TouchAction;\n Hammer.TouchInput = TouchInput;\n Hammer.MouseInput = MouseInput;\n Hammer.PointerEventInput = PointerEventInput;\n Hammer.TouchMouseInput = TouchMouseInput;\n Hammer.SingleTouchInput = SingleTouchInput;\n Hammer.Recognizer = Recognizer;\n Hammer.AttrRecognizer = AttrRecognizer;\n Hammer.Tap = TapRecognizer;\n Hammer.Pan = PanRecognizer;\n Hammer.Swipe = SwipeRecognizer;\n Hammer.Pinch = PinchRecognizer;\n Hammer.Rotate = RotateRecognizer;\n Hammer.Press = PressRecognizer;\n Hammer.on = addEventListeners;\n Hammer.off = removeEventListeners;\n Hammer.each = each;\n Hammer.merge = merge;\n Hammer.extend = extend;\n Hammer.bindFn = bindFn;\n Hammer.assign = assign$1;\n Hammer.inherit = inherit;\n Hammer.bindFn = bindFn;\n Hammer.prefixed = prefixed;\n Hammer.toArray = toArray;\n Hammer.inArray = inArray;\n Hammer.uniqueArray = uniqueArray;\n Hammer.splitStr = splitStr;\n Hammer.boolOrFn = boolOrFn;\n Hammer.hasParent = hasParent;\n Hammer.addEventListeners = addEventListeners;\n Hammer.removeEventListeners = removeEventListeners;\n Hammer.defaults = assign$1({}, defaults, {\n preset: preset\n });\n return Hammer;\n}();\n\n// style loader but by script tag, not by the loader.\n\nvar defaults$1 = Hammer.defaults;\n\nexport default Hammer;\nexport { INPUT_START, INPUT_MOVE, INPUT_END, INPUT_CANCEL, STATE_POSSIBLE, STATE_BEGAN, STATE_CHANGED, STATE_ENDED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_FAILED, DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, Input, TouchAction, TouchInput, MouseInput, PointerEventInput, TouchMouseInput, SingleTouchInput, Recognizer, AttrRecognizer, TapRecognizer as Tap, PanRecognizer as Pan, SwipeRecognizer as Swipe, PinchRecognizer as Pinch, RotateRecognizer as Rotate, PressRecognizer as Press, addEventListeners as on, removeEventListeners as off, each, merge, extend, assign$1 as assign, inherit, bindFn, prefixed, toArray, inArray, uniqueArray, splitStr, boolOrFn, hasParent, addEventListeners, removeEventListeners, defaults$1 as defaults };\n//# sourceMappingURL=hammer.esm.js.map\n","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/axes project is licensed under the MIT license\n\n@egjs/axes JavaScript library\nhttps://github.com/naver/egjs-axes\n\n@version 2.7.1\n*/\nimport { DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, PointerEventInput, TouchMouseInput, TouchInput, MouseInput, Pan, Pinch } from '@egjs/hammerjs';\nimport getAgent from '@egjs/agent';\nimport Component from '@egjs/component';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n};\n\nfunction __extends(d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nfunction getInsidePosition(destPos, range, circular, bounce) {\n var toDestPos = destPos;\n var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]];\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n return toDestPos;\n} // determine outside\n\nfunction isOutside(pos, range) {\n return pos < range[0] || pos > range[1];\n}\nfunction getDuration(distance, deceleration) {\n var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero\n\n return duration < 100 ? 0 : duration;\n}\nfunction isCircularable(destPos, range, circular) {\n return circular[1] && destPos > range[1] || circular[0] && destPos < range[0];\n}\nfunction getCirculatedPos(pos, range, circular) {\n var toPos = pos;\n var min = range[0];\n var max = range[1];\n var length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = (toPos - max) % length + min;\n }\n\n if (circular[0] && pos < min) {\n // left\n toPos = (toPos - min) % length + max;\n }\n\n return toPos;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\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\nfunction toArray(nodes) {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n var el = [];\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n\n return el;\n}\nfunction $(param, multi) {\n if (multi === void 0) {\n multi = false;\n }\n\n var el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n var match = param.match(/^<([a-z]+)\\s*([^>]*)>/); // creating element\n\n if (match) {\n // HTML\n var dummy = document.createElement(\"div\");\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === win) {\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 (\"jQuery\" in win && param instanceof jQuery || param.constructor.prototype.jquery) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map(function (v) {\n return $(v);\n });\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n\n return el;\n}\nvar raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame;\nvar caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;\n\nif (raf && !caf) {\n var keyInfo_1 = {};\n var oldraf_1 = raf;\n\n raf = function (callback) {\n function wrapCallback(timestamp) {\n if (keyInfo_1[key]) {\n callback(timestamp);\n }\n }\n\n var key = oldraf_1(wrapCallback);\n keyInfo_1[key] = true;\n return key;\n };\n\n caf = function (key) {\n delete keyInfo_1[key];\n };\n} else if (!(raf && caf)) {\n raf = function (callback) {\n return win.setTimeout(function () {\n callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime());\n }, 16);\n };\n\n caf = win.clearTimeout;\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 */\n\n\nfunction 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*/\n\nfunction cancelAnimationFrame(key) {\n caf(key);\n}\nfunction map(obj, callback) {\n var tranformed = {};\n\n for (var k in obj) {\n k && (tranformed[k] = callback(obj[k], k));\n }\n\n return tranformed;\n}\nfunction filter(obj, callback) {\n var filtered = {};\n\n for (var k in obj) {\n k && callback(obj[k], k) && (filtered[k] = obj[k]);\n }\n\n return filtered;\n}\nfunction every(obj, callback) {\n for (var k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n\n return true;\n}\nfunction equal(target, base) {\n return every(target, function (v, k) {\n return v === base[k];\n });\n}\nvar roundNumFunc = {};\nfunction roundNumber(num, roundUnit) {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n}\nfunction roundNumbers(num, roundUnit) {\n if (!num || !roundUnit) {\n return num;\n }\n\n var isNumber = typeof roundUnit === \"number\";\n return map(num, function (value, key) {\n return roundNumber(value, isNumber ? roundUnit : roundUnit[key]);\n });\n}\nfunction getDecimalPlace(val) {\n if (!isFinite(val)) {\n return 0;\n }\n\n var v = val + \"\";\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n var p = 0;\n var e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n } // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n\n\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n}\nfunction inversePow(n) {\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}\nfunction getRoundFunc(v) {\n var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n return function (n) {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n}\n\nfunction minMax(value, min, max) {\n return Math.max(Math.min(value, max), min);\n}\n\nvar AnimationManager =\n/*#__PURE__*/\nfunction () {\n function AnimationManager(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n var __proto = AnimationManager.prototype;\n\n __proto.getDuration = function (depaPos, destPos, wishDuration) {\n var _this = this;\n\n var duration;\n\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n var durations_1 = map(destPos, function (v, k) {\n return getDuration(Math.abs(v - depaPos[k]), _this.options.deceleration);\n });\n duration = Object.keys(durations_1).reduce(function (max, v) {\n return Math.max(max, durations_1[v]);\n }, -Infinity);\n }\n\n return minMax(duration, this.options.minimumDuration, this.options.maximumDuration);\n };\n\n __proto.createAnimationParam = function (pos, duration, option) {\n var depaPos = this.axm.get();\n var destPos = pos;\n var inputEvent = option && option.event || null;\n return {\n depaPos: depaPos,\n destPos: destPos,\n duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration),\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: inputEvent,\n input: option && option.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd\n };\n };\n\n __proto.grab = function (axes, option) {\n if (this._animateParam && axes.length) {\n var orgPos_1 = this.axm.get(axes);\n var pos = this.axm.map(orgPos_1, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n });\n\n if (!every(pos, function (v, k) {\n return orgPos_1[k] === v;\n })) {\n this.em.triggerChange(pos, false, orgPos_1, option, !!option);\n }\n\n this._animateParam = null;\n this._raf && cancelAnimationFrame(this._raf);\n this._raf = null;\n this.em.triggerAnimationEnd(!!(option && option.event));\n }\n };\n\n __proto.getEventInfo = function () {\n if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent\n };\n } else {\n return null;\n }\n };\n\n __proto.restore = function (option) {\n var pos = this.axm.get();\n var destPos = this.axm.map(pos, function (v, opt) {\n return Math.min(opt.range[1], Math.max(opt.range[0], v));\n });\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n };\n\n __proto.animationEnd = function () {\n var beforeParam = this.getEventInfo();\n this._animateParam = null; // for Circular\n\n var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n });\n Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n }));\n this.itm.setInterrupt(false);\n this.em.triggerAnimationEnd(!!beforeParam);\n\n if (this.axm.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n };\n\n __proto.finish = function (isTrusted) {\n this._animateParam = null;\n this.itm.setInterrupt(false);\n this.em.triggerFinish(isTrusted);\n };\n\n __proto.animateLoop = function (param, complete) {\n if (param.duration) {\n this._animateParam = __assign({}, param);\n var info_1 = this._animateParam;\n var self_1 = this;\n var destPos_1 = info_1.destPos;\n var prevPos_1 = info_1.depaPos;\n var prevEasingPer_1 = 0;\n var directions_1 = map(prevPos_1, function (value, key) {\n return value <= destPos_1[key] ? 1 : -1;\n });\n var originalIntendedPos_1 = map(destPos_1, function (v) {\n return v;\n });\n var prevTime_1 = new Date().getTime();\n info_1.startTime = prevTime_1;\n\n (function loop() {\n self_1._raf = null;\n var currentTime = new Date().getTime();\n var ratio = (currentTime - info_1.startTime) / param.duration;\n var easingPer = self_1.easing(ratio);\n var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) {\n var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n\n var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular);\n\n if (nextPos !== circulatedPos) {\n // circular\n var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]);\n destPos_1[key] -= rangeOffset;\n prevPos_1[key] -= rangeOffset;\n }\n\n return circulatedPos;\n });\n var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1);\n prevPos_1 = toPos;\n prevTime_1 = currentTime;\n prevEasingPer_1 = easingPer;\n\n if (easingPer >= 1) {\n destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1);\n\n if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) {\n self_1.em.triggerChange(destPos_1, true, prevPos_1);\n }\n\n complete();\n return;\n } else if (isCanceled) {\n self_1.finish(false);\n } else {\n // animationEnd\n self_1._raf = requestAnimationFrame(loop);\n }\n })();\n } else {\n this.em.triggerChange(param.destPos, true);\n complete();\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 *\n * @param originalIntendedPos\n * @param destPos\n */\n\n\n __proto.getFinalPos = function (destPos, originalIntendedPos) {\n var _this = this; // compare destPos and originalIntendedPos\n\n\n var ERROR_LIMIT = 0.000001;\n var finalPos = map(destPos, function (value, key) {\n if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n var roundUnit = _this.getRoundUnit(value, key);\n\n var result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n };\n\n __proto.getRoundUnit = function (val, key) {\n var roundUnit = this.options.round; // manual mode\n\n var minRoundUnit = null; // auto mode\n // auto mode\n\n if (!roundUnit) {\n // Get minimum round unit\n var options = this.axm.getAxisOptions(key);\n minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val)));\n }\n\n return minRoundUnit || roundUnit;\n };\n\n __proto.getUserControll = function (param) {\n var userWish = param.setTo();\n userWish.destPos = this.axm.get(userWish.destPos);\n userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration);\n return userWish;\n };\n\n __proto.animateTo = function (destPos, duration, option) {\n var _this = this;\n\n var param = this.createAnimationParam(destPos, duration, option);\n\n var depaPos = __assign({}, param.depaPos);\n\n var retTrigger = this.em.triggerAnimationStart(param); // to control\n\n var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true.\n\n if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n })) {\n console.warn(\"You can't stop the 'animation' event when 'circular' is true.\");\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n var inputEvent = option && option.event || null;\n this.animateLoop({\n depaPos: depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axm.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent: inputEvent,\n input: option && option.input || null\n }, function () {\n return _this.animationEnd();\n });\n }\n };\n\n __proto.easing = function (p) {\n return p > 1 ? 1 : this.options.easing(p);\n };\n\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n var axes = Object.keys(pos);\n this.grab(axes);\n var orgPos = this.axm.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n\n this.itm.setInterrupt(true);\n var movedPos = filter(pos, function (v, k) {\n return orgPos[k] !== v;\n });\n\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axm.map(movedPos, function (v, opt) {\n var range = opt.range,\n circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular);\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.em.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n };\n\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) {\n return v + pos[k];\n }), duration);\n };\n\n return AnimationManager;\n}();\n\nvar EventManager =\n/*#__PURE__*/\nfunction () {\n function EventManager(axes) {\n this.axes = axes;\n }\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @name eg.Axes#hold\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n var __proto = EventManager.prototype;\n\n __proto.triggerHold = function (pos, option) {\n var roundPos = this.getRoundPos(pos).roundPos;\n this.axes.trigger(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true\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 * @name set\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\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 * @name setTo\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\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 * @name eg.Axes#release\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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} 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 * 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\n __proto.triggerRelease = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n this.axes.trigger(\"release\", param);\n };\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @name eg.Axes#change\n * @event\n * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\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 * 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\n __proto.triggerChange = function (pos, isAccurate, depaPos, option, holding) {\n if (holding === void 0) {\n holding = false;\n }\n\n var am = this.am;\n var axm = am.axm;\n var eventInfo = am.getEventInfo();\n\n var _a = this.getRoundPos(pos, depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n var moveTo = axm.moveTo(roundPos, roundDepa);\n var inputEvent = option && option.event || eventInfo && eventInfo.event || null;\n var param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n holding: holding,\n inputEvent: inputEvent,\n isTrusted: !!inputEvent,\n input: option && option.input || eventInfo && eventInfo.input || null,\n set: inputEvent ? this.createUserControll(moveTo.pos) : function () {}\n };\n var result = this.axes.trigger(\"change\", param);\n inputEvent && axm.set(param.set()[\"destPos\"]);\n return result;\n };\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @name eg.Axes#animationStart\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationStart = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n return this.axes.trigger(\"animationStart\", param);\n };\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#animationEnd\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationEnd = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"animationEnd\", {\n isTrusted: isTrusted\n });\n };\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#finish\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerFinish = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"finish\", {\n isTrusted: isTrusted\n });\n };\n\n __proto.createUserControll = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n } // to controll\n\n\n var userControl = {\n destPos: __assign({}, pos),\n duration: duration\n };\n return function (toPos, userDuration) {\n toPos && (userControl.destPos = __assign({}, toPos));\n userDuration !== undefined && (userControl.duration = userDuration);\n return userControl;\n };\n };\n\n __proto.setAnimationManager = function (am) {\n this.am = am;\n };\n\n __proto.destroy = function () {\n this.axes.off();\n };\n\n __proto.getRoundPos = function (pos, depaPos) {\n // round value if round exist\n var roundUnit = this.axes.options.round; // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit)\n };\n };\n\n return EventManager;\n}();\n\nvar InterruptManager =\n/*#__PURE__*/\nfunction () {\n function InterruptManager(options) {\n this.options = options;\n this._prevented = false; // check whether the animation event was prevented\n }\n\n var __proto = InterruptManager.prototype;\n\n __proto.isInterrupting = function () {\n // when interruptable is 'true', return value is always 'true'.\n return this.options.interruptable || this._prevented;\n };\n\n __proto.isInterrupted = function () {\n return !this.options.interruptable && this._prevented;\n };\n\n __proto.setInterrupt = function (prevented) {\n !this.options.interruptable && (this._prevented = prevented);\n };\n\n return InterruptManager;\n}();\n\nvar AxisManager =\n/*#__PURE__*/\nfunction () {\n function AxisManager(axis, options) {\n var _this = this;\n\n this.axis = axis;\n this.options = options;\n\n this._complementOptions();\n\n this._pos = Object.keys(this.axis).reduce(function (acc, v) {\n acc[v] = _this.axis[v].range[0];\n return acc;\n }, {});\n }\n /**\n * set up 'css' expression\n * @private\n */\n\n\n var __proto = AxisManager.prototype;\n\n __proto._complementOptions = function () {\n var _this = this;\n\n Object.keys(this.axis).forEach(function (axis) {\n _this.axis[axis] = __assign({\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false]\n }, _this.axis[axis]);\n [\"bounce\", \"circular\"].forEach(function (v) {\n var axisOption = _this.axis;\n var 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 __proto.getDelta = function (depaPos, destPos) {\n var fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), function (v, k) {\n return v - fullDepaPos[k];\n });\n };\n\n __proto.get = function (axes) {\n var _this = this;\n\n if (axes && Array.isArray(axes)) {\n return axes.reduce(function (acc, v) {\n if (v && v in _this._pos) {\n acc[v] = _this._pos[v];\n }\n\n return acc;\n }, {});\n } else {\n return __assign({}, this._pos, axes || {});\n }\n };\n\n __proto.moveTo = function (pos, depaPos) {\n if (depaPos === void 0) {\n depaPos = this._pos;\n }\n\n var delta = map(this._pos, function (v, key) {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n this.set(this.map(pos, function (v, opt) {\n return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0;\n }));\n return {\n pos: __assign({}, this._pos),\n delta: delta\n };\n };\n\n __proto.set = function (pos) {\n for (var k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n };\n\n __proto.every = function (pos, callback) {\n var axisOptions = this.axis;\n return every(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.filter = function (pos, callback) {\n var axisOptions = this.axis;\n return filter(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.map = function (pos, callback) {\n var axisOptions = this.axis;\n return map(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.isOutside = function (axes) {\n return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) {\n return !isOutside(v, opt.range);\n });\n };\n\n __proto.getAxisOptions = function (key) {\n return this.axis[key];\n };\n\n return AxisManager;\n}();\n\nvar InputObserver =\n/*#__PURE__*/\nfunction () {\n function InputObserver(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm,\n am = _a.am;\n this.isOutside = false;\n this.moveDistance = null;\n this.isStopped = false;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.am = am;\n } // when move pointer is held in outside\n\n\n var __proto = InputObserver.prototype;\n\n __proto.atOutside = function (pos) {\n var _this = this;\n\n if (this.isOutside) {\n return this.axm.map(pos, function (v, opt) {\n var tn = opt.range[0] - opt.bounce[0];\n var tx = opt.range[1] + opt.bounce[1];\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n // when start pointer is held in inside\n // get a initialization slope value to prevent smooth animation.\n var initSlope_1 = this.am.easing(0.00001) / 0.00001;\n return this.axm.map(pos, function (v, opt) {\n var min = opt.range[0];\n var max = opt.range[1];\n var out = opt.bounce;\n var circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return min - _this.am.easing((min - v) / (out[0] * initSlope_1)) * out[0];\n } else if (v > max) {\n // right\n return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1];\n }\n\n return v;\n });\n }\n };\n\n __proto.get = function (input) {\n return this.axm.get(input.axes);\n };\n\n __proto.hold = function (input, event) {\n if (this.itm.isInterrupted() || !input.axes.length) {\n return;\n }\n\n var changeOption = {\n input: input,\n event: event\n };\n this.isStopped = false;\n this.itm.setInterrupt(true);\n this.am.grab(input.axes, changeOption);\n !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption);\n this.isOutside = this.axm.isOutside(input.axes);\n this.moveDistance = this.axm.get(input.axes);\n };\n\n __proto.change = function (input, event, offset) {\n if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) {\n return v === 0;\n })) {\n return;\n }\n\n var depaPos = this.moveDistance || this.axm.get(input.axes);\n var destPos; // for outside logic\n\n destPos = map(depaPos, function (v, k) {\n return v + (offset[k] || 0);\n });\n this.moveDistance && (this.moveDistance = destPos); // from outside to inside\n\n if (this.isOutside && this.axm.every(depaPos, function (v, opt) {\n return !isOutside(v, opt.range);\n })) {\n this.isOutside = false;\n }\n\n depaPos = this.atOutside(depaPos);\n destPos = this.atOutside(destPos);\n var isCanceled = !this.em.triggerChange(destPos, false, depaPos, {\n input: input,\n event: event\n }, true);\n\n if (isCanceled) {\n this.isStopped = true;\n this.moveDistance = null;\n this.am.finish(false);\n }\n };\n\n __proto.release = function (input, event, offset, inputDuration) {\n if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) {\n return;\n }\n\n var pos = this.axm.get(input.axes);\n var depaPos = this.axm.get();\n var destPos = this.axm.get(this.axm.map(offset, function (v, opt, k) {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce);\n }\n }));\n var duration = this.am.getDuration(destPos, pos, inputDuration);\n\n if (duration === 0) {\n destPos = __assign({}, depaPos);\n } // prepare params\n\n\n var param = {\n depaPos: depaPos,\n destPos: destPos,\n duration: duration,\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: event,\n input: input,\n isTrusted: true\n };\n this.em.triggerRelease(param);\n this.moveDistance = null; // to contol\n\n var userWish = this.am.getUserControll(param);\n var isEqual = equal(userWish.destPos, depaPos);\n var changeOption = {\n input: input,\n event: event\n };\n\n if (isEqual || userWish.duration === 0) {\n !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true);\n this.itm.setInterrupt(false);\n\n if (this.axm.isOutside()) {\n this.am.restore(changeOption);\n } else {\n this.em.triggerFinish(true);\n }\n } else {\n this.am.animateTo(userWish.destPos, userWish.duration, changeOption);\n }\n };\n\n return InputObserver;\n}();\n\n// export const DIRECTION_NONE = 1;\nvar IOS_EDGE_THRESHOLD = 30;\nvar IS_IOS_SAFARI = \"ontouchstart\" in win && getAgent().browser.name === \"safari\";\nvar TRANSFORM = function () {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n\n var bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0]).style;\n var target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n for (var i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n\n return \"\";\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 * @property {Number[]} [range] The coordinate of range 좌표 범위\n * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표\n * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표\n * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to \"true\" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @property {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 * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @property {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가 적용되지 않는다
\n * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
\n**/\n\n/**\n * @class eg.Axes\n * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.\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] 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 *\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\nvar Axes =\n/*#__PURE__*/\nfunction (_super) {\n __extends(Axes, _super);\n\n function Axes(axis, options, startPos) {\n if (axis === void 0) {\n axis = {};\n }\n\n if (options === void 0) {\n options = {};\n }\n\n var _this = _super.call(this) || this;\n\n _this.axis = axis;\n _this._inputs = [];\n _this.options = __assign({\n easing: function easeOutCubic(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 }, options);\n _this.itm = new InterruptManager(_this.options);\n _this.axm = new AxisManager(_this.axis, _this.options);\n _this.em = new EventManager(_this);\n _this.am = new AnimationManager(_this);\n _this.io = new InputObserver(_this);\n\n _this.em.setAnimationManager(_this.am);\n\n startPos && _this.em.triggerChange(startPos);\n return _this;\n }\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @method eg.Axes#connect\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 * 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\n var __proto = Axes.prototype;\n\n __proto.connect = function (axes, inputType) {\n var mapped;\n\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n } // check same instance\n\n\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n } // check same element in hammer type for share\n\n\n if (\"hammer\" in inputType) {\n var targets = this._inputs.filter(function (v) {\n return v.hammer && v.element === inputType.element;\n });\n\n if (targets.length) {\n inputType.hammer = targets[0].hammer;\n }\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.io);\n\n this._inputs.push(inputType);\n\n return this;\n };\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @method eg.Axes#disconnect\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 * 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\n __proto.disconnect = function (inputType) {\n if (inputType) {\n var index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach(function (v) {\n return v.disconnect();\n });\n\n this._inputs = [];\n }\n\n return this;\n };\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @method eg.Axes#get\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\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\n __proto.get = function (axes) {\n return this.axm.get(axes);\n };\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @method eg.Axes#setTo\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 * 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\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setTo(pos, duration);\n return this;\n };\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @method eg.Axes#setBy\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 * 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\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setBy(pos, duration);\n return this;\n };\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @method eg.Axes#isBounceArea\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\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\n __proto.isBounceArea = function (axes) {\n return this.axm.isOutside(axes);\n };\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n * @method eg.Axes#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.em.destroy();\n };\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Axes.VERSION; // ex) 3.3.3\n * @memberof eg.Axes\n */\n\n\n Axes.VERSION = \"2.7.1\";\n /**\n * @name eg.Axes.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 * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n */\n\n Axes.TRANSFORM = TRANSFORM;\n /**\n * @name eg.Axes.DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name eg.Axes.DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name eg.Axes.DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name eg.Axes.DIRECTION_UP\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_UP = DIRECTION_UP;\n /**\n * @name eg.Axes.DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name eg.Axes.DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name eg.Axes.DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name eg.Axes.DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_ALL = DIRECTION_ALL;\n return Axes;\n}(Component);\n\nvar SUPPORT_POINTER_EVENTS = \"PointerEvent\" in win || \"MSPointerEvent\" in win;\nvar SUPPORT_TOUCH = (\"ontouchstart\" in win);\nvar UNIQUEKEY = \"_EGJS_AXES_INPUTTYPE_\";\nfunction toAxis(source, offset) {\n return offset.reduce(function (acc, v, i) {\n if (source[i]) {\n acc[source[i]] = v;\n }\n\n return acc;\n }, {});\n}\nfunction createHammer(element, options) {\n try {\n // create Hammer\n return new Manager(element, __assign({}, options));\n } catch (e) {\n return null;\n }\n}\nfunction convertInputType(inputType) {\n if (inputType === void 0) {\n inputType = [];\n }\n\n var hasTouch = false;\n var hasMouse = false;\n var hasPointer = false;\n inputType.forEach(function (v) {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n\n if (hasPointer) {\n return PointerEventInput;\n } else if (hasTouch && hasMouse) {\n return TouchMouseInput;\n } else if (hasTouch) {\n return TouchInput;\n } else if (hasMouse) {\n return MouseInput;\n }\n\n return null;\n}\n\nfunction getDirectionByAngle(angle, thresholdAngle) {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n\n var toAngle = Math.abs(angle);\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL;\n}\nfunction getNextOffset(speeds, deceleration) {\n var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]);\n var duration = Math.abs(normalSpeed / -deceleration);\n return [speeds[0] / 2 * duration, speeds[1] / 2 * duration];\n}\nfunction useDirection(checkType, direction, userDirection) {\n if (userDirection) {\n return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType);\n } else {\n return !!(direction & checkType);\n }\n}\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @property {String[]} [inputType=[\"touch\",\"mouse\", \"pointer\"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
\n * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율\n * @property {Number} [scale.1=1] vertical axis scale 수직축 배율\n * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PanInput\n * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\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 */\n\nvar PanInput =\n/*#__PURE__*/\nfunction () {\n function PanInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this.panRecognizer = null;\n this.isRightEdge = false;\n this.rightEdgeTimer = 0;\n this.panFlag = false;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PanInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onHammerInput = this.onHammerInput.bind(this);\n this.onPanmove = this.onPanmove.bind(this);\n this.onPanend = this.onPanend.bind(this);\n }\n\n var __proto = PanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n var useHorizontal = !!axes[0];\n var useVertical = !!axes[1];\n\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\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n direction: this._direction,\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PanRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.panRecognizer = new Pan(hammerOption);\n this.hammer.add(this.panRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.dettachEvent();\n }\n\n this._direction = DIRECTION_NONE;\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PanInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PanInput#enable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PanInput#disable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PanInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pan\").options.enable);\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.panRecognizer) {\n this.hammer.remove(this.panRecognizer);\n this.panRecognizer = null;\n }\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.panFlag = false;\n\n if (event.srcEvent.cancelable !== false) {\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n this.observer.hold(this, event);\n this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold;\n this.panFlag = true;\n }\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanmove = function (event) {\n var _this = this;\n\n if (!this.panFlag) {\n return;\n }\n\n var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start\n\n var prevInput = this.hammer.session.prevInput;\n\n if (prevInput && IS_IOS_SAFARI) {\n var swipeLeftToRight = event.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n return;\n } else if (this.isRightEdge) {\n clearTimeout(this.rightEdgeTimer); // - is right to left\n\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n var swipeRightToLeft = event.deltaX < -edgeThreshold;\n\n if (swipeRightToLeft) {\n this.isRightEdge = false;\n } else {\n // iOS swipe right => left\n this.rightEdgeTimer = window.setTimeout(function () {\n _this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n }, 100);\n }\n }\n }\n /* eslint-disable no-param-reassign */\n\n\n if (prevInput) {\n event.offsetX = event.deltaX - prevInput.deltaX;\n event.offsetY = event.deltaY - prevInput.deltaY;\n } else {\n event.offsetX = 0;\n event.offsetY = 0;\n }\n\n var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]);\n var prevent = offset.some(function (v) {\n return v !== 0;\n });\n\n if (prevent) {\n var srcEvent = event.srcEvent;\n\n if (srcEvent.cancelable !== false) {\n srcEvent.preventDefault();\n }\n\n srcEvent.stopPropagation();\n }\n\n event.preventSystemEvent = prevent;\n prevent && this.observer.change(this, event, toAxis(this.axes, offset));\n };\n\n __proto.onPanend = function (event) {\n if (!this.panFlag) {\n return;\n }\n\n clearTimeout(this.rightEdgeTimer);\n this.panFlag = false;\n var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]);\n offset = getNextOffset(offset, this.observer.options.deceleration);\n this.observer.release(this, event, toAxis(this.axes, offset));\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"hammer.input\", this.onHammerInput).on(\"panstart panmove\", this.onPanmove);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"hammer.input\", this.onHammerInput).off(\"panstart panmove\", this.onPanmove);\n this.observer = null;\n };\n\n __proto.getOffset = function (properties, direction) {\n var offset = [0, 0];\n var scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n\n return offset;\n };\n\n return PanInput;\n}();\n\n/**\n * @class eg.Axes.RotatePanInput\n * @classdesc 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)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.
[상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\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 eg.Axes.PanInput\n */\n\nvar RotatePanInput =\n/*#__PURE__*/\nfunction (_super) {\n __extends(RotatePanInput, _super);\n\n function RotatePanInput(el, options) {\n var _this = _super.call(this, el, options) || this;\n\n _this.prevQuadrant = null;\n _this.lastDiff = 0;\n return _this;\n }\n\n var __proto = RotatePanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.observer.hold(this, event);\n this.onPanstart(event);\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanstart = function (event) {\n var rect = this.element.getBoundingClientRect();\n /**\n * Responsive\n */\n // TODO: how to do if element is ellipse not circle.\n\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\n this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle.\n\n this.prevAngle = null;\n this.triggerChange(event);\n };\n\n __proto.onPanmove = function (event) {\n this.triggerChange(event);\n };\n\n __proto.onPanend = function (event) {\n this.triggerChange(event);\n this.triggerAnimation(event);\n };\n\n __proto.triggerChange = function (event) {\n var angle = this.getAngle(event.center.x, event.center.y);\n var quadrant = this.getQuadrant(event.center.x, event.center.y);\n var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant);\n this.prevAngle = angle;\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 __proto.triggerAnimation = function (event) {\n var vx = event.velocityX;\n var vy = event.velocityY;\n var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise\n\n var duration = Math.abs(velocity / -this.observer.options.deceleration);\n var distance = velocity / 2 * duration;\n this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle]));\n };\n\n __proto.getDifference = function (prevAngle, angle, prevQuadrant, quadrant) {\n var diff;\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 __proto.getPosFromOrigin = function (posX, posY) {\n return {\n x: posX - this.rotateOrigin[0],\n y: this.rotateOrigin[1] - posY\n };\n };\n\n __proto.getAngle = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y);\n\n return angle < 0 ? 360 + angle : angle;\n };\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n\n\n __proto.getQuadrant = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var 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\n return q;\n };\n\n return RotatePanInput;\n}(PanInput);\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PinchInput\n * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\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 */\n\nvar PinchInput =\n/*#__PURE__*/\nfunction () {\n function PinchInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this._base = null;\n this._prev = null;\n this.pinchRecognizer = null;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PinchInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onPinchStart = this.onPinchStart.bind(this);\n this.onPinchMove = this.onPinchMove.bind(this);\n this.onPinchEnd = this.onPinchEnd.bind(this);\n }\n\n var __proto = PinchInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PinchRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.pinchRecognizer = new Pinch(hammerOption);\n this.hammer.add(this.pinchRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n this.dettachEvent();\n }\n\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PinchInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.pinchRecognizer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n }\n };\n\n __proto.onPinchStart = function (event) {\n this._base = this.observer.get(this)[this.axes[0]];\n var offset = this.getOffset(event.scale);\n this.observer.hold(this, event);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchMove = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchEnd = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this.observer.release(this, event, toAxis(this.axes, [0]), 0);\n this._base = null;\n this._prev = null;\n };\n\n __proto.getOffset = function (pinchScale, prev) {\n if (prev === void 0) {\n prev = 1;\n }\n\n return this._base * (pinchScale - prev) * this.options.scale;\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"pinchstart\", this.onPinchStart).on(\"pinchmove\", this.onPinchMove).on(\"pinchend\", this.onPinchEnd);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"pinchstart\", this.onPinchStart).off(\"pinchmove\", this.onPinchMove).off(\"pinchend\", this.onPinchEnd);\n this.observer = null;\n this._prev = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PinchInput#enable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PinchInput#disable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PinchInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pinch\").options.enable);\n };\n\n return PinchInput;\n}();\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n**/\n\n/**\n * @class eg.Axes.WheelInput\n * @classdesc 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 * 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 */\n\nvar WheelInput =\n/*#__PURE__*/\nfunction () {\n function WheelInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n useNormalized: true\n }, options);\n this.onWheel = this.onWheel.bind(this);\n }\n\n var __proto = WheelInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent();\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.WheelInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onWheel = function (event) {\n var _this = this;\n\n if (!this._isEnabled) {\n return;\n }\n\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n if (_this._isHolded) {\n _this._isHolded = false;\n\n _this.observer.release(_this, event, toAxis(_this.axes, [0]));\n }\n }, 50);\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.element.addEventListener(\"wheel\", this.onWheel);\n this._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\n this.element.removeEventListener(\"wheel\", this.onWheel);\n this._isEnabled = false;\n this.observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.WheelInput#enable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.WheelInput#disable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.WheelInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return WheelInput;\n}();\n\nvar KEY_LEFT_ARROW = 37;\nvar KEY_A = 65;\nvar KEY_UP_ARROW = 38;\nvar KEY_W = 87;\nvar KEY_RIGHT_ARROW = 39;\nvar KEY_D = 68;\nvar KEY_DOWN_ARROW = 40;\nvar KEY_S = 83;\nvar DIRECTION_REVERSE = -1;\nvar DIRECTION_FORWARD = 1;\nvar DIRECTION_HORIZONTAL$1 = -1;\nvar DIRECTION_VERTICAL$1 = 1;\nvar DELAY = 80;\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @property {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @property {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n**/\n\n/**\n * @class eg.Axes.MoveKeyInput\n * @classdesc 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 * 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 */\n\nvar MoveKeyInput =\n/*#__PURE__*/\nfunction () {\n function MoveKeyInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: [1, 1]\n }, options);\n this.onKeydown = this.onKeydown.bind(this);\n this.onKeyup = this.onKeyup.bind(this);\n }\n\n var __proto = MoveKeyInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent(); // add tabindex=\"0\" to the container for making it focusable\n\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 __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.MoveKeyInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onKeydown = function (e) {\n if (!this._isEnabled) {\n return;\n }\n\n var isMoveKey = true;\n var direction = DIRECTION_FORWARD;\n var move = DIRECTION_HORIZONTAL$1;\n\n switch (e.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL$1;\n break;\n\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL$1;\n break;\n\n default:\n isMoveKey = false;\n }\n\n if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) {\n isMoveKey = false;\n }\n\n if (!isMoveKey) {\n return;\n }\n\n var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction];\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n clearTimeout(this._timer);\n this.observer.change(this, event, toAxis(this.axes, offsets));\n };\n\n __proto.onKeyup = function (e) {\n var _this = this;\n\n if (!this._isHolded) {\n return;\n }\n\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n _this.observer.release(_this, e, toAxis(_this.axes, [0, 0]));\n\n _this._isHolded = false;\n }, DELAY);\n };\n\n __proto.attachEvent = function (observer) {\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._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\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._isEnabled = false;\n this.observer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.MoveKeyInput#enable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.MoveKeyInput#disable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.MoveKeyInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return MoveKeyInput;\n}();\n\nexport default Axes;\nexport { PanInput, RotatePanInput, PinchInput, WheelInput, MoveKeyInput };\n//# sourceMappingURL=axes.esm.js.map\n","/**\n * Original Code\n * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js\n * Math Util\n * modified by egjs\n */\n/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.2\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n// Some minimal math functionality borrowed from gl-Matrix and stripped down\n// for the purposes of this library.\n\nimport {vec2, vec3, quat} from \"gl-matrix\";\n\nfunction quatToVec3(quaternion) {\n\tconst baseV = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(baseV, baseV, quaternion);\n\treturn baseV;\n}\n\nfunction toDegree(a){\n\treturn a * 180 / Math.PI;\n}\n\nconst util = {};\n\nutil.isPowerOfTwo = function(n) {\n\treturn n && (n & (n - 1)) === 0;\n};\n\nutil.extractPitchFromQuat = function(quaternion) {\n\tconst baseV = quatToVec3(quaternion);\n\n\treturn -1 * Math.atan2(\n\t\tbaseV[1],\n\t\tMath.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2)));\n};\n\nutil.hypot = Math.hypot || function(x, y) {\n\treturn Math.sqrt(x * x + y * y);\n};\n\n// implement reference\n// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식\n// calculating angle between two vectors : http://darkpgmr.tistory.com/121\nconst ROTATE_CONSTANT = {\n\tPITCH_DELTA: 1,\n\tYAW_DELTA_BY_ROLL: 2,\n\tYAW_DELTA_BY_YAW: 3,\n};\n\nROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [0, 0, 1],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [1, 0, 0],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = {\n\ttargetAxis: [1, 0, 0],\n\tmeshPoint: [0, 0, 1],\n};\n\nfunction getRotationDelta(prevQ, curQ, rotateKind) {\n\tconst targetAxis = vec3.fromValues(\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[0],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[1],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[2]\n\t);\n\tconst meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint;\n\n\tconst prevQuaternion = quat.clone(prevQ);\n\tconst curQuaternion = quat.clone(curQ);\n\n\tquat.normalize(prevQuaternion, prevQuaternion);\n\tquat.normalize(curQuaternion, curQuaternion);\n\n\tlet prevPoint = vec3.fromValues(0, 0, 1);\n\tlet curPoint = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\tvec3.transformQuat(targetAxis, targetAxis, curQuaternion);\n\n\tconst rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint));\n\tconst rotateDirection = rotateDistance > 0 ? 1 : -1;\n\n\t// when counter clock wise, use vec3.fromValues(0,1,0)\n\t// when clock wise, use vec3.fromValues(0,-1,0)\n\t// const meshPoint1 = vec3.fromValues(0, 0, 0);\n\tconst meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\n\tlet meshPoint3;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tmeshPoint3 = vec3.fromValues(0, rotateDirection, 0);\n\t} else {\n\t\tmeshPoint3 = vec3.fromValues(rotateDirection, 0, 0);\n\t}\n\n\tvec3.transformQuat(meshPoint2, meshPoint2, curQuaternion);\n\tvec3.transformQuat(meshPoint3, meshPoint3, curQuaternion);\n\n\tconst vecU = meshPoint2;\n\tconst vecV = meshPoint3;\n\tconst vecN = vec3.create();\n\n\tvec3.cross(vecN, vecU, vecV);\n\tvec3.normalize(vecN, vecN);\n\n\tconst coefficientA = vecN[0];\n\tconst coefficientB = vecN[1];\n\tconst coefficientC = vecN[2];\n//\tconst coefficientD = -1 * vec3.dot(vecN, meshPoint1);\n\n\t// a point on the plane\n\tcurPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\n\t// a point should project on the plane\n\tprevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\n\t// distance between prevPoint and the plane\n\tlet distance = Math.abs(\n\t\tprevPoint[0] * coefficientA +\n\t\tprevPoint[1] * coefficientB +\n\t\tprevPoint[2] * coefficientC\n\t);\n\n\tconst projectedPrevPoint = vec3.create();\n\n\tvec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance));\n\n\tlet trigonometricRatio =\n\t\t(projectedPrevPoint[0] * curPoint[0] +\n\t\tprojectedPrevPoint[1] * curPoint[1] +\n\t\tprojectedPrevPoint[2] * curPoint[2]) /\n\t\t(vec3.length(projectedPrevPoint) * vec3.length(curPoint));\n\n\t// defensive block\n\ttrigonometricRatio > 1 && (trigonometricRatio = 1);\n\n\tconst theta = Math.acos(trigonometricRatio);\n\n\tconst crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint);\n\n\tdistance =\n\t\tcoefficientA * crossVec[0] +\n\t\tcoefficientB * crossVec[1] +\n\t\tcoefficientC * crossVec[2];\n\n\tlet thetaDirection;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tthetaDirection = distance > 0 ? 1 : -1;\n\t} else {\n\t\tthetaDirection = distance < 0 ? 1 : -1;\n\t}\n\n\tconst deltaRadian = theta * thetaDirection * rotateDirection;\n\n\treturn toDegree(deltaRadian);\n}\n\nfunction angleBetweenVec2(v1, v2) {\n\tconst det = v1[0] * v2[1] - v2[0] * v1[1];\n\tconst theta = -Math.atan2(det, vec2.dot(v1, v2));\n\treturn theta;\n}\n\nutil.yawOffsetBetween = function(viewDir, targetDir) {\n\tconst viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]);\n\tconst targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]);\n\n\tvec2.normalize(viewDirXZ, viewDirXZ);\n\tvec2.normalize(targetDirXZ, targetDirXZ);\n\n\tconst theta = -angleBetweenVec2(viewDirXZ, targetDirXZ);\n\n\treturn theta;\n}\n\nutil.toDegree = toDegree;\nutil.getRotationDelta = getRotationDelta;\nutil.angleBetweenVec2 = angleBetweenVec2;\n\nexport {\n\tutil,\n\tROTATE_CONSTANT,\n};\n","import {\n\tutil as mathUtil,\n\tROTATE_CONSTANT,\n} from \"../utils/math-util\";\n\nexport function toAxis(source, offset) {\n\treturn offset.reduce((acc, v, i) => {\n\t\tif (source[i]) {\n\t\t\tacc[source[i]] = v;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(mathUtil.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nexport function getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n","/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar MathUtil = window.MathUtil || {};\n\nMathUtil.degToRad = Math.PI / 180;\nMathUtil.radToDeg = 180 / Math.PI;\n\n// Some minimal math functionality borrowed from THREE.Math and stripped down\n// for the purposes of this library.\n\n\nMathUtil.Vector2 = function ( x, y ) {\n this.x = x || 0;\n this.y = y || 0;\n};\n\nMathUtil.Vector2.prototype = {\n constructor: MathUtil.Vector2,\n\n set: function ( x, y ) {\n this.x = x;\n this.y = y;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n\n return this;\n },\n\n subVectors: function ( a, b ) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n\n return this;\n },\n};\n\nMathUtil.Vector3 = function ( x, y, z ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n};\n\nMathUtil.Vector3.prototype = {\n constructor: MathUtil.Vector3,\n\n set: function ( x, y, z ) {\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n\n return this;\n },\n\n length: function () {\n return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n },\n\n normalize: function () {\n var scalar = this.length();\n\n if ( scalar !== 0 ) {\n var invScalar = 1 / scalar;\n\n this.multiplyScalar(invScalar);\n } else {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return this;\n },\n\n multiplyScalar: function ( scalar ) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n },\n\n applyQuaternion: function ( q ) {\n var x = this.x;\n var y = this.y;\n var z = this.z;\n\n var qx = q.x;\n var qy = q.y;\n var qz = q.z;\n var qw = q.w;\n\n // calculate quat * vector\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = - qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n return this;\n },\n\n dot: function ( v ) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n },\n\n crossVectors: function ( a, b ) {\n var ax = a.x, ay = a.y, az = a.z;\n var bx = b.x, by = b.y, bz = b.z;\n\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n\n return this;\n },\n};\n\nMathUtil.Quaternion = function ( x, y, z, w ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = ( w !== undefined ) ? w : 1;\n};\n\nMathUtil.Quaternion.prototype = {\n constructor: MathUtil.Quaternion,\n\n set: function ( x, y, z, w ) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n\n return this;\n },\n\n copy: function ( quaternion ) {\n this.x = quaternion.x;\n this.y = quaternion.y;\n this.z = quaternion.z;\n this.w = quaternion.w;\n\n return this;\n },\n\n setFromEulerXYZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n\n return this;\n },\n\n setFromEulerYXZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n\n return this;\n },\n\n setFromAxisAngle: function ( axis, angle ) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n\n var halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n this.x = axis.x * s;\n this.y = axis.y * s;\n this.z = axis.z * s;\n this.w = Math.cos( halfAngle );\n\n return this;\n },\n\n multiply: function ( q ) {\n return this.multiplyQuaternions( this, q );\n },\n\n multiplyQuaternions: function ( a, b ) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;\n var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;\n\n this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n return this;\n },\n\n inverse: function () {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n\n this.normalize();\n\n return this;\n },\n\n normalize: function () {\n var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n if ( l === 0 ) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 1;\n } else {\n l = 1 / l;\n\n this.x = this.x * l;\n this.y = this.y * l;\n this.z = this.z * l;\n this.w = this.w * l;\n }\n\n return this;\n },\n\n slerp: function ( qb, t ) {\n if ( t === 0 ) return this;\n if ( t === 1 ) return this.copy( qb );\n\n var x = this.x, y = this.y, z = this.z, w = this.w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z;\n\n if ( cosHalfTheta < 0 ) {\n this.w = - qb.w;\n this.x = - qb.x;\n this.y = - qb.y;\n this.z = - qb.z;\n\n cosHalfTheta = - cosHalfTheta;\n } else {\n this.copy( qb );\n }\n\n if ( cosHalfTheta >= 1.0 ) {\n this.w = w;\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n var halfTheta = Math.acos( cosHalfTheta );\n var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\n\n if ( Math.abs( sinHalfTheta ) < 0.001 ) {\n this.w = 0.5 * ( w + this.w );\n this.x = 0.5 * ( x + this.x );\n this.y = 0.5 * ( y + this.y );\n this.z = 0.5 * ( z + this.z );\n\n return this;\n }\n\n var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n this.w = ( w * ratioA + this.w * ratioB );\n this.x = ( x * ratioA + this.x * ratioB );\n this.y = ( y * ratioA + this.y * ratioB );\n this.z = ( z * ratioA + this.z * ratioB );\n\n return this;\n },\n\n setFromUnitVectors: function () {\n // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\n // assumes direction vectors vFrom and vTo are normalized\n\n var v1, r;\n var EPS = 0.000001;\n\n return function ( vFrom, vTo ) {\n if ( v1 === undefined ) v1 = new MathUtil.Vector3();\n\n r = vFrom.dot( vTo ) + 1;\n\n if ( r < EPS ) {\n r = 0;\n\n if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n v1.set( - vFrom.y, vFrom.x, 0 );\n } else {\n v1.set( 0, - vFrom.z, vFrom.y );\n }\n } else {\n v1.crossVectors( vFrom, vTo );\n }\n\n this.x = v1.x;\n this.y = v1.y;\n this.z = v1.z;\n this.w = r;\n\n this.normalize();\n\n return this;\n }\n }(),\n};\n\nmodule.exports = MathUtil;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Util = window.Util || {};\n\nUtil.MIN_TIMESTEP = 0.001;\nUtil.MAX_TIMESTEP = 1;\n\nUtil.base64 = function(mimeType, base64) {\n return 'data:' + mimeType + ';base64,' + base64;\n};\n\nUtil.clamp = function(value, min, max) {\n return Math.min(Math.max(min, value), max);\n};\n\nUtil.lerp = function(a, b, t) {\n return a + ((b - a) * t);\n};\n\n/**\n * Light polyfill for `Promise.race`. Returns\n * a promise that resolves when the first promise\n * provided resolves.\n *\n * @param {Array} promises\n */\nUtil.race = function(promises) {\n if (Promise.race) {\n return Promise.race(promises);\n }\n\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < promises.length; i++) {\n promises[i].then(resolve, reject);\n }\n });\n};\n\nUtil.isIOS = (function() {\n var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);\n return function() {\n return isIOS;\n };\n})();\n\nUtil.isWebViewAndroid = (function() {\n var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1 &&\n navigator.userAgent.indexOf('Chrome') !== -1;\n return function() {\n return isWebViewAndroid;\n };\n})();\n\nUtil.isSafari = (function() {\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n return function() {\n return isSafari;\n };\n})();\n\nUtil.isFirefoxAndroid = (function() {\n var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1;\n return function() {\n return isFirefoxAndroid;\n };\n})();\n\nUtil.isR7 = (function() {\n var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1;\n return function() {\n return isR7;\n };\n})();\n\nUtil.isLandscapeMode = function() {\n var rtn = (window.orientation == 90 || window.orientation == -90);\n return Util.isR7() ? !rtn : rtn;\n};\n\n// Helper method to validate the time steps of sensor timestamps.\nUtil.isTimestampDeltaValid = function(timestampDeltaS) {\n if (isNaN(timestampDeltaS)) {\n return false;\n }\n if (timestampDeltaS <= Util.MIN_TIMESTEP) {\n return false;\n }\n if (timestampDeltaS > Util.MAX_TIMESTEP) {\n return false;\n }\n return true;\n};\n\nUtil.getScreenWidth = function() {\n return Math.max(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.getScreenHeight = function() {\n return Math.min(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.requestFullscreen = function(element) {\n if (Util.isWebViewAndroid()) {\n return false;\n }\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.exitFullscreen = function() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.getFullscreenElement = function() {\n return document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullScreenElement ||\n document.msFullscreenElement;\n};\n\nUtil.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) {\n // No error checking for brevity.\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n for (var attribName in attribLocationMap)\n gl.bindAttribLocation(program, attribLocationMap[attribName], attribName);\n\n gl.linkProgram(program);\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n};\n\nUtil.getProgramUniforms = function(gl, program) {\n var uniforms = {};\n var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n var uniformName = '';\n for (var i = 0; i < uniformCount; i++) {\n var uniformInfo = gl.getActiveUniform(program, i);\n uniformName = uniformInfo.name.replace('[0]', '');\n uniforms[uniformName] = gl.getUniformLocation(program, uniformName);\n }\n return uniforms;\n};\n\nUtil.orthoMatrix = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\nUtil.copyArray = function (source, dest) {\n for (var i = 0, n = source.length; i < n; i++) {\n dest[i] = source[i];\n }\n};\n\nUtil.isMobile = function() {\n var check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);\n return check;\n};\n\nUtil.extend = function(dest, src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n\n return dest;\n}\n\nUtil.safariCssSizeWorkaround = function(canvas) {\n // TODO(smus): Remove this workaround when Safari for iOS is fixed.\n // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556).\n //\n // \"To the last I grapple with thee;\n // from hell's heart I stab at thee;\n // for hate's sake I spit my last breath at thee.\"\n // -- Moby Dick, by Herman Melville\n if (Util.isIOS()) {\n var width = canvas.style.width;\n var height = canvas.style.height;\n canvas.style.width = (parseInt(width) + 1) + 'px';\n canvas.style.height = (parseInt(height)) + 'px';\n setTimeout(function() {\n canvas.style.width = width;\n canvas.style.height = height;\n }, 100);\n }\n\n // Debug only.\n window.Util = Util;\n window.canvas = canvas;\n};\n\nUtil.isDebug = function() {\n return Util.getQueryParameter('debug');\n};\n\nUtil.getQueryParameter = function(name) {\n var name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n results = regex.exec(location.search);\n return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n};\n\nUtil.frameDataFromPose = (function() {\n var piOver180 = Math.PI / 180.0;\n var rad45 = Math.PI * 0.25;\n\n // Borrowed from glMatrix.\n function mat4_perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45),\n downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45),\n leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45),\n rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n\n function mat4_fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n };\n\n function mat4_translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n };\n\n function mat4_invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n };\n\n var defaultOrientation = new Float32Array([0, 0, 0, 1]);\n var defaultPosition = new Float32Array([0, 0, 0]);\n\n function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) {\n mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar);\n\n var orientation = pose.orientation || defaultOrientation;\n var position = pose.position || defaultPosition;\n\n mat4_fromRotationTranslation(view, orientation, position);\n if (parameters)\n mat4_translate(view, view, parameters.offset);\n mat4_invert(view, view);\n }\n\n return function(frameData, pose, vrDisplay) {\n if (!frameData || !pose)\n return false;\n\n frameData.pose = pose;\n frameData.timestamp = pose.timestamp;\n\n updateEyeMatrices(\n frameData.leftProjectionMatrix, frameData.leftViewMatrix,\n pose, vrDisplay.getEyeParameters(\"left\"), vrDisplay);\n updateEyeMatrices(\n frameData.rightProjectionMatrix, frameData.rightViewMatrix,\n pose, vrDisplay.getEyeParameters(\"right\"), vrDisplay);\n\n return true;\n };\n})();\n\nUtil.isInsideCrossDomainIFrame = function() {\n var isFramed = (window.self !== window.top);\n var refDomain = Util.getDomainFromUrl(document.referrer);\n var thisDomain = Util.getDomainFromUrl(window.location.href);\n\n return isFramed && (refDomain !== thisDomain);\n};\n\n// From http://stackoverflow.com/a/23945027.\nUtil.getDomainFromUrl = function(url) {\n var domain;\n // Find & remove protocol (http, ftp, etc.) and get domain.\n if (url.indexOf(\"://\") > -1) {\n domain = url.split('/')[2];\n }\n else {\n domain = url.split('/')[0];\n }\n\n //find & remove port number\n domain = domain.split(':')[0];\n\n return domain;\n}\n\nmodule.exports = Util;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar MathUtil = require('../math-util');\nvar Util = require('../util');\n\n/**\n * Given an orientation and the gyroscope data, predicts the future orientation\n * of the head. This makes rendering appear faster.\n *\n * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf\n *\n * @param {Number} predictionTimeS time from head movement to the appearance of\n * the corresponding image.\n */\nfunction PosePredictor(predictionTimeS) {\n this.predictionTimeS = predictionTimeS;\n\n // The quaternion corresponding to the previous state.\n this.previousQ = new MathUtil.Quaternion();\n // Previous time a prediction occurred.\n this.previousTimestampS = null;\n\n // The delta quaternion that adjusts the current pose.\n this.deltaQ = new MathUtil.Quaternion();\n // The output quaternion.\n this.outQ = new MathUtil.Quaternion();\n}\n\nPosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) {\n if (!this.previousTimestampS) {\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n return currentQ;\n }\n\n // Calculate axis and angle based on gyroscope rotation rate data.\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n\n var angularSpeed = gyro.length();\n\n // If we're rotating slowly, don't do prediction.\n if (angularSpeed < MathUtil.degToRad * 20) {\n if (Util.isDebug()) {\n console.log('Moving slowly, at %s deg/s: no prediction',\n (MathUtil.radToDeg * angularSpeed).toFixed(1));\n }\n this.outQ.copy(currentQ);\n this.previousQ.copy(currentQ);\n return this.outQ;\n }\n\n // Get the predicted angle based on the time delta and latency.\n var deltaT = timestampS - this.previousTimestampS;\n var predictAngle = angularSpeed * this.predictionTimeS;\n\n this.deltaQ.setFromAxisAngle(axis, predictAngle);\n this.outQ.copy(this.previousQ);\n this.outQ.multiply(this.deltaQ);\n\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n\n return this.outQ;\n};\n\n\nmodule.exports = PosePredictor;\n","import {userAgent} from \"../utils/browserFeature\";\n/**\n * Returns a number value indiciating the version of Chrome being used,\n * or otherwise `null` if not on Chrome.\n *\n * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19\n */\n/**\n * In Chrome m65, `devicemotion` events are broken but subsequently fixed\n * in 65.0.3325.148. Since many browsers use Chromium, ensure that\n * we scope this detection by branch and build numbers to provide\n * a proper fallback.\n * https://github.com/immersive-web/webvr-polyfill/issues/307\n */\nlet version = -1; // It should not be null because it will be compared with number\nlet branch = null;\nlet build = null;\n\nconst match = /Chrome\\/([0-9]+)\\.(?:[0-9]*)\\.([0-9]*)\\.([0-9]*)/i.exec(userAgent);\n\nif (match) {\n\tversion = parseInt(match[1], 10);\n\tbranch = match[2];\n\tbuild = match[3];\n}\n\nconst CHROME_VERSION = version;\nconst IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === \"3325\" && parseInt(build, 10) < 148;\nconst IS_ANDROID = /Android/i.test(userAgent);\n\nconst CONTROL_MODE_VR = 1;\nconst CONTROL_MODE_YAWPITCH = 2;\n\nconst TOUCH_DIRECTION_NONE = 1;\nconst TOUCH_DIRECTION_YAW = 2;\nconst TOUCH_DIRECTION_PITCH = 4;\nconst TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH;\n\n/* Const for MovableCoord */\nconst MC_DECELERATION = 0.0014;\nconst MC_MAXIMUM_DURATION = 1000;\nconst MC_BIND_SCALE = [0.20, 0.20];\n\nconst MIN_FIELD_OF_VIEW = 20;\nconst MAX_FIELD_OF_VIEW = 110;\nconst PAN_SCALE = 320;\n\n// const DELTA_THRESHOLD = 0.015;\n// const DELTA_THRESHOLD = 0.09; // Note4\n// const DELTA_THRESHOLD = 0.0825;\n// const DELTA_THRESHOLD = 0.075;\n// const DELTA_THRESHOLD = 0.06;\n// const DELTA_THRESHOLD = 0.045;\nconst DELTA_THRESHOLD = 0.0375; // Note2\n\nconst YAW_RANGE_HALF = 180;\nconst PITCH_RANGE_HALF = 90;\nconst CIRCULAR_PITCH_RANGE_HALF = 180;\nconst PINCH_EVENTS = \"pinchstart pinchmove pinchend\";\n\nconst KEYMAP = {\n\tLEFT_ARROW: 37,\n\tA: 65,\n\tUP_ARROW: 38,\n\tW: 87,\n\tRIGHT_ARROW: 39,\n\tD: 68,\n\tDOWN_ARROW: 40,\n\tS: 83,\n};\n\nconst GYRO_MODE = {\n\tNONE: \"none\",\n\tYAWPITCH: \"yawPitch\",\n\tVR: \"VR\"\n};\n\nexport {\n\tGYRO_MODE,\n\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\n\tTOUCH_DIRECTION_NONE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMIN_FIELD_OF_VIEW,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tDELTA_THRESHOLD,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tPINCH_EVENTS,\n\tKEYMAP,\n\n\tCHROME_VERSION,\n\tIS_CHROME_WITHOUT_DEVICE_MOTION,\n\tIS_ANDROID\n};\n","import Component from \"@egjs/component\";\nimport {vec3} from \"gl-matrix\";\nimport {window} from \"../../utils/browser\";\nimport {IS_CHROME_WITHOUT_DEVICE_MOTION, IS_ANDROID} from \"../consts\";\n\nconst STILLNESS_THRESHOLD = 200; // millisecond\n\nexport default class DeviceMotion extends Component {\n\tconstructor() {\n\t\tsuper();\n\t\tthis._onDeviceMotion = this._onDeviceMotion.bind(this);\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onChromeWithoutDeviceMotion = this._onChromeWithoutDeviceMotion.bind(this);\n\n\t\tthis.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION;\n\t\tthis.isAndroid = IS_ANDROID;\n\n\t\tthis.stillGyroVec = vec3.create();\n\t\tthis.rawGyroVec = vec3.create();\n\t\tthis.adjustedGyroVec = vec3.create();\n\n\t\tthis._timer = null;\n\n\t\tthis.lastDevicemotionTimestamp = 0;\n\t\tthis._isEnabled = false;\n\t\tthis.enable();\n\t}\n\t_onChromeWithoutDeviceMotion(e) {\n\t\tlet {alpha, beta, gamma} = e;\n\n\t\t// There is deviceorientation event trigged with empty values\n\t\t// on Headless Chrome.\n\t\tif (alpha === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// convert to radian\n\t\talpha = (alpha || 0) * Math.PI / 180;\n\t\tbeta = (beta || 0) * Math.PI / 180;\n\t\tgamma = (gamma || 0) * Math.PI / 180;\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: {\n\t\t\t\tdeviceorientation: {\n\t\t\t\t\talpha,\n\t\t\t\t\tbeta,\n\t\t\t\t\tgamma: -gamma\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t_onDeviceOrientation() {\n\t\tthis._timer && clearTimeout(this._timer);\n\t\tthis._timer = setTimeout(() => {\n\t\t\tif ((new Date().getTime() - this.lastDevicemotionTimestamp) < STILLNESS_THRESHOLD) {\n\t\t\t\tvec3.copy(this.stillGyroVec, this.rawGyroVec);\n\t\t\t}\n\t\t}, STILLNESS_THRESHOLD);\n\t}\n\t_onDeviceMotion(e) {\n\t\t// desktop chrome triggers devicemotion event with empthy sensor values.\n\t\t// Those events should ignored.\n\t\tconst isGyroSensorAvailable = !(e.rotationRate.alpha == null);\n\t\tconst isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null);\n\n\t\tif (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst devicemotionEvent = Object.assign({}, e);\n\n\t\tdevicemotionEvent.interval = e.interval;\n\t\tdevicemotionEvent.timeStamp = e.timeStamp;\n\t\tdevicemotionEvent.type = e.type;\n\t\tdevicemotionEvent.rotationRate = {\n\t\t\talpha: e.rotationRate.alpha,\n\t\t\tbeta: e.rotationRate.beta,\n\t\t\tgamma: e.rotationRate.gamma,\n\t\t};\n\t\tdevicemotionEvent.accelerationIncludingGravity = {\n\t\t\tx: e.accelerationIncludingGravity.x,\n\t\t\ty: e.accelerationIncludingGravity.y,\n\t\t\tz: e.accelerationIncludingGravity.z,\n\t\t};\n\t\tdevicemotionEvent.acceleration = {\n\t\t\tx: e.acceleration.x,\n\t\t\ty: e.acceleration.y,\n\t\t\tz: e.acceleration.z,\n\t\t};\n\n\t\tif (this.isAndroid) {\n\t\t\tvec3.set(\n\t\t\t\tthis.rawGyroVec,\n\t\t\t\te.rotationRate.alpha || 0,\n\t\t\t\te.rotationRate.beta || 0,\n\t\t\t\te.rotationRate.gamma || 0);\n\t\t\tvec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec);\n\t\t\tthis.lastDevicemotionTimestamp = new Date().getTime();\n\n\t\t\tdevicemotionEvent.adjustedRotationRate = {\n\t\t\t\talpha: this.adjustedGyroVec[0],\n\t\t\t\tbeta: this.adjustedGyroVec[1],\n\t\t\t\tgamma: this.adjustedGyroVec[2]};\n\t\t}\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: devicemotionEvent\n\t\t});\n\t}\n\tenable() {\n\t\tif (this.isAndroid) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\t}\n\t\tif (this.isWithoutDeviceMotion) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\t} else {\n\t\t\twindow.addEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\t}\n\t\tthis._isEnabled = true;\n\t}\n\tdisable() {\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\twindow.removeEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\tthis._isEnabled = false;\n\t}\n}\n","function SensorSample(sample, timestampS) {\n this.set(sample, timestampS);\n};\n\nSensorSample.prototype.set = function(sample, timestampS) {\n this.sample = sample;\n this.timestampS = timestampS;\n};\n\nSensorSample.prototype.copy = function(sensorSample) {\n this.set(sensorSample.sample, sensorSample.timestampS);\n};\n\nmodule.exports = SensorSample;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar SensorSample = require('./sensor-sample.js');\nvar MathUtil = require('../math-util.js');\nvar Util = require('../util.js');\n\n/**\n * An implementation of a simple complementary filter, which fuses gyroscope and\n * accelerometer data from the 'devicemotion' event.\n *\n * Accelerometer data is very noisy, but stable over the long term.\n * Gyroscope data is smooth, but tends to drift over the long term.\n *\n * This fusion is relatively simple:\n * 1. Get orientation estimates from accelerometer by applying a low-pass filter\n * on that data.\n * 2. Get orientation estimates from gyroscope by integrating over time.\n * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the\n * short term.\n */\nfunction ComplementaryFilter(kFilter) {\n this.kFilter = kFilter;\n\n // Raw sensor measurements.\n this.currentAccelMeasurement = new SensorSample();\n this.currentGyroMeasurement = new SensorSample();\n this.previousGyroMeasurement = new SensorSample();\n\n // Set default look direction to be in the correct direction.\n if (Util.isIOS()) {\n this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1);\n } else {\n this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1);\n }\n this.previousFilterQ = new MathUtil.Quaternion();\n this.previousFilterQ.copy(this.filterQ);\n\n // Orientation based on the accelerometer.\n this.accelQ = new MathUtil.Quaternion();\n // Whether or not the orientation has been initialized.\n this.isOrientationInitialized = false;\n // Running estimate of gravity based on the current orientation.\n this.estimatedGravity = new MathUtil.Vector3();\n // Measured gravity based on accelerometer.\n this.measuredGravity = new MathUtil.Vector3();\n\n // Debug only quaternion of gyro-based orientation.\n this.gyroIntegralQ = new MathUtil.Quaternion();\n}\n\nComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) {\n this.currentAccelMeasurement.set(vector, timestampS);\n};\n\nComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {\n this.currentGyroMeasurement.set(vector, timestampS);\n\n var deltaT = timestampS - this.previousGyroMeasurement.timestampS;\n if (Util.isTimestampDeltaValid(deltaT)) {\n this.run_();\n }\n\n this.previousGyroMeasurement.copy(this.currentGyroMeasurement);\n};\n\nComplementaryFilter.prototype.run_ = function() {\n\n if (!this.isOrientationInitialized) {\n this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n this.previousFilterQ.copy(this.accelQ);\n this.isOrientationInitialized = true;\n return;\n }\n\n var deltaT = this.currentGyroMeasurement.timestampS -\n this.previousGyroMeasurement.timestampS;\n\n // Convert gyro rotation vector to a quaternion delta.\n var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n this.gyroIntegralQ.multiply(gyroDeltaQ);\n\n // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n this.filterQ.copy(this.previousFilterQ);\n this.filterQ.multiply(gyroDeltaQ);\n\n // Calculate the delta between the current estimated gravity and the real\n // gravity vector from accelerometer.\n var invFilterQ = new MathUtil.Quaternion();\n invFilterQ.copy(this.filterQ);\n invFilterQ.inverse();\n\n this.estimatedGravity.set(0, 0, -1);\n this.estimatedGravity.applyQuaternion(invFilterQ);\n this.estimatedGravity.normalize();\n\n this.measuredGravity.copy(this.currentAccelMeasurement.sample);\n this.measuredGravity.normalize();\n\n // Compare estimated gravity with measured gravity, get the delta quaternion\n // between the two.\n var deltaQ = new MathUtil.Quaternion();\n deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n deltaQ.inverse();\n\n if (Util.isDebug()) {\n console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)',\n MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ),\n (this.estimatedGravity.x).toFixed(1),\n (this.estimatedGravity.y).toFixed(1),\n (this.estimatedGravity.z).toFixed(1),\n (this.measuredGravity.x).toFixed(1),\n (this.measuredGravity.y).toFixed(1),\n (this.measuredGravity.z).toFixed(1));\n }\n\n // Calculate the SLERP target: current orientation plus the measured-estimated\n // quaternion delta.\n var targetQ = new MathUtil.Quaternion();\n targetQ.copy(this.filterQ);\n targetQ.multiply(deltaQ);\n\n // SLERP factor: 0 is pure gyro, 1 is pure accel.\n this.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n this.previousFilterQ.copy(this.filterQ);\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n return this.filterQ;\n};\n\nComplementaryFilter.prototype.accelToQuaternion_ = function(accel) {\n var normAccel = new MathUtil.Vector3();\n normAccel.copy(accel);\n normAccel.normalize();\n var quat = new MathUtil.Quaternion();\n quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel);\n quat.inverse();\n return quat;\n};\n\nComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) {\n // Extract axis and angle from the gyroscope data.\n var quat = new MathUtil.Quaternion();\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n quat.setFromAxisAngle(axis, gyro.length() * dt);\n return quat;\n};\n\n\nmodule.exports = ComplementaryFilter;\n","import MathUtil from \"webvr-polyfill/src/math-util\";\nimport ComplementaryFilter from \"webvr-polyfill/src/sensor-fusion/complementary-filter\";\n\nComplementaryFilter.prototype.run_ = function() {\n\tif (!this.isOrientationInitialized) {\n\t\tthis.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n\t\tthis.previousFilterQ.copy(this.accelQ);\n\t\tthis.isOrientationInitialized = true;\n\t\treturn;\n\t}\n\n\tconst deltaT = this.currentGyroMeasurement.timestampS -\n\tthis.previousGyroMeasurement.timestampS;\n\n\t// Convert gyro rotation vector to a quaternion delta.\n\tconst gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n\n\tthis.gyroIntegralQ.multiply(gyroDeltaQ);\n\n\t// filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n\tthis.filterQ.copy(this.previousFilterQ);\n\tthis.filterQ.multiply(gyroDeltaQ);\n\n\t// Calculate the delta between the current estimated gravity and the real\n\t// gravity vector from accelerometer.\n\tconst invFilterQ = new MathUtil.Quaternion();\n\n\tinvFilterQ.copy(this.filterQ);\n\tinvFilterQ.inverse();\n\n\tthis.estimatedGravity.set(0, 0, -1);\n\tthis.estimatedGravity.applyQuaternion(invFilterQ);\n\tthis.estimatedGravity.normalize();\n\n\tthis.measuredGravity.copy(this.currentAccelMeasurement.sample);\n\tthis.measuredGravity.normalize();\n\n\t// Compare estimated gravity with measured gravity, get the delta quaternion\n\t// between the two.\n\tconst deltaQ = new MathUtil.Quaternion();\n\n\tdeltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n\tdeltaQ.inverse();\n\n\t// Calculate the SLERP target: current orientation plus the measured-estimated\n\t// quaternion delta.\n\tconst targetQ = new MathUtil.Quaternion();\n\n\ttargetQ.copy(this.filterQ);\n\ttargetQ.multiply(deltaQ);\n\n\t// SLERP factor: 0 is pure gyro, 1 is pure accel.\n\tthis.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n\tthis.previousFilterQ.copy(this.filterQ);\n\n\tif (!this.isFilterQuaternionInitialized) {\n\t\tthis.isFilterQuaternionInitialized = true;\n\t}\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n\tif (this.isFilterQuaternionInitialized) {\n\t\treturn this.filterQ;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexport default ComplementaryFilter;\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport PosePredictor from \"webvr-polyfill/src/sensor-fusion/pose-predictor\";\nimport MathUtil from \"webvr-polyfill/src/math-util\";\nimport Util from \"webvr-polyfill/src/util\";\nimport {window, IS_IOS, IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\nimport DeviceMotion from \"./DeviceMotion\";\nimport ComplementaryFilter from \"./ComplementaryFilter\";\nimport {CHROME_VERSION} from \"../consts\";\n\nconst K_FILTER = 0.98;\nconst PREDICTION_TIME_S = 0.040;\n\nexport default class FusionPoseSensor extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.deviceMotion = new DeviceMotion();\n\n\t\tthis.accelerometer = new MathUtil.Vector3();\n\t\tthis.gyroscope = new MathUtil.Vector3();\n\n\t\tthis._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);\n\t\tthis._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);\n\n\t\tthis.filter = new ComplementaryFilter(K_FILTER);\n\t\tthis.posePredictor = new PosePredictor(PREDICTION_TIME_S);\n\n\t\tthis.filterToWorldQ = new MathUtil.Quaternion();\n\n\t\tthis.isFirefoxAndroid = Util.isFirefoxAndroid();\n\t\t// This includes iPhone & iPad(both desktop and mobile mode) ref #326\n\t\tthis.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP;\n\n\t\t// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18\n\t\tthis.isChromeUsingDegrees = CHROME_VERSION >= 66;\n\n\t\tthis._isEnabled = false;\n\n\t\t// Set the filter to world transform, depending on OS.\n\t\tif (this.isIOS) {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);\n\t\t} else {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);\n\t\t}\n\n\t\tthis.inverseWorldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.worldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1),\n\t\t\t-window.orientation * Math.PI / 180);\n\n\t\tthis._setScreenTransform();\n\t\t// Adjust this filter for being in landscape mode.\n\t\tif (Util.isLandscapeMode()) {\n\t\t\tthis.filterToWorldQ.multiply(this.inverseWorldToScreenQ);\n\t\t}\n\n\t\t// Keep track of a reset transform for resetSensor.\n\t\tthis.resetQ = new MathUtil.Quaternion();\n\n\t\tthis.deviceMotion.on(\"devicemotion\", this._onDeviceMotionChange);\n\t\tthis.enable();\n\t}\n\tenable() {\n\t\tif (this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.enable();\n\t\tthis._isEnabled = true;\n\t\twindow.addEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tdisable() {\n\t\tif (!this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.disable();\n\t\tthis._isEnabled = false;\n\t\twindow.removeEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tisEnabled() {\n\t\treturn this._isEnabled;\n\t}\n\tdestroy() {\n\t\tthis.disable();\n\t\tthis.deviceMotion = null;\n\t}\n\t_triggerChange() {\n\t\tconst orientation = this.getOrientation();\n\n\t\t// if orientation is not prepared. don't trigger change event\n\t\tif (!orientation) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._prevOrientation) {\n\t\t\tthis._prevOrientation = orientation;\n\t\t\treturn;\n\t\t}\n\n\t\tif (quat.equals(this._prevOrientation, orientation)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.trigger(\"change\", {quaternion: orientation});\n\t}\n\tgetOrientation() {\n\t\tlet orientation;\n\n\t\t// Hack around using deviceorientation instead of devicemotion\n\t\tif (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) {\n\t\t\tthis.deviceOrientationFixQ = this.deviceOrientationFixQ || (() => {\n\t\t\t\tconst y = new MathUtil.Quaternion()\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -this._alpha);\n\n\t\t\t\treturn y;\n\t\t\t})();\n\n\t\t\torientation = this._deviceOrientationQ;\n\t\t\tconst out = new MathUtil.Quaternion();\n\n\t\t\tout.copy(orientation);\n\t\t\tout.multiply(this.filterToWorldQ);\n\t\t\tout.multiply(this.resetQ);\n\t\t\tout.multiply(this.worldToScreenQ);\n\t\t\tout.multiplyQuaternions(this.deviceOrientationFixQ, out);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t} else {\n\t\t\t// Convert from filter space to the the same system used by the\n\t\t\t// deviceorientation event.\n\t\t\torientation = this.filter.getOrientation();\n\n\t\t\tif (!orientation) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst out = this._convertFusionToPredicted(orientation);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t}\n\t}\n\t_convertFusionToPredicted(orientation) {\n\t\t// Predict orientation.\n\t\tthis.predictedQ =\n\t\t\tthis.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS);\n\n\t\t// Convert to THREE coordinate system: -Z forward, Y up, X right.\n\t\tconst out = new MathUtil.Quaternion();\n\n\t\tout.copy(this.filterToWorldQ);\n\t\tout.multiply(this.resetQ);\n\t\tout.multiply(this.predictedQ);\n\t\tout.multiply(this.worldToScreenQ);\n\n\t\treturn out;\n\t}\n\t_onDeviceMotionChange({inputEvent}) {\n\t\tconst deviceorientation = inputEvent.deviceorientation;\n\t\tconst deviceMotion = inputEvent;\n\t\tconst accGravity = deviceMotion.accelerationIncludingGravity;\n\t\tconst rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate;\n\t\tlet timestampS = deviceMotion.timeStamp / 1000;\n\n\t\tif (deviceorientation) {\n\t\t\tif (!this._alpha) {\n\t\t\t\tthis._alpha = deviceorientation.alpha;\n\t\t\t}\n\t\t\tthis._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion();\n\t\t\tthis._deviceOrientationQ.setFromEulerYXZ(\n\t\t\t\tdeviceorientation.beta,\n\t\t\t\tdeviceorientation.alpha,\n\t\t\t\tdeviceorientation.gamma\n\t\t\t);\n\n\t\t\tthis._triggerChange();\n\t\t} else {\n\t\t\t// Firefox Android timeStamp returns one thousandth of a millisecond.\n\t\t\tif (this.isFirefoxAndroid) {\n\t\t\t\ttimestampS /= 1000;\n\t\t\t}\n\n\t\t\tthis.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z);\n\t\t\tthis.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma);\n\n\t\t\t// Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate`\n\t\t\t// is reported in degrees, so we first convert to radians.\n\t\t\tif (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) {\n\t\t\t\tthis.gyroscope.multiplyScalar(Math.PI / 180);\n\t\t\t}\n\n\t\t\tthis.filter.addAccelMeasurement(this.accelerometer, timestampS);\n\t\t\tthis.filter.addGyroMeasurement(this.gyroscope, timestampS);\n\n\t\t\tthis._triggerChange();\n\n\t\t\tthis.previousTimestampS = timestampS;\n\t\t}\n\t}\n\t_onScreenOrientationChange(screenOrientation) {\n\t\tthis._setScreenTransform(window.orientation);\n\t}\n\t_setScreenTransform() {\n\t\tthis.worldToScreenQ.set(0, 0, 0, 1);\n\n\t\tconst orientation = window.orientation;\n\n\t\tswitch (orientation) {\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tcase 90:\n\t\t\tcase -90:\n\t\t\tcase 180:\n\t\t\t\tthis.worldToScreenQ\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.inverseWorldToScreenQ.copy(this.worldToScreenQ);\n\t\tthis.inverseWorldToScreenQ.inverse();\n\t}\n}\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport {toAxis} from \"../utils\";\nimport FusionPoseSensor from \"./FusionPoseSensor\";\nimport {util, ROTATE_CONSTANT} from \"../../utils/math-util\";\n\nfunction getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(util.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nfunction getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n\nexport default class TiltMotionInput extends Component {\n\tconstructor(el, options) {\n\t\tsuper();\n\t\tthis.element = el;\n\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\n\t\tthis.fusionPoseSensor = null;\n\n\t\tthis.options = Object.assign({\n\t\t\tscale: 1,\n\t\t\tthreshold: 0,\n\t\t}, options);\n\n\t\tthis._onPoseChange = this._onPoseChange.bind(this);\n\t}\n\tmapAxes(axes) {\n\t\tthis.axes = axes;\n\t}\n\tconnect(observer) {\n\t\tif (this.observer) {\n\t\t\treturn this;\n\t\t}\n\t\tthis.observer = observer;\n\t\tthis.fusionPoseSensor = new FusionPoseSensor();\n\t\tthis.fusionPoseSensor.enable();\n\t\tthis._attachEvent();\n\t\treturn this;\n\t}\n\tdisconnect() {\n\t\tif (!this.observer) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._dettachEvent();\n\t\tthis.fusionPoseSensor.disable();\n\t\tthis.fusionPoseSensor.destroy();\n\t\tthis.fusionPoseSensor = null;\n\t\tthis.observer = null;\n\t\treturn this;\n\t}\n\tdestroy() {\n\t\tthis.disconnect();\n\t\tthis.element = null;\n\t\tthis.options = null;\n\t\tthis.axes = null;\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\t}\n\t_onPoseChange(event) {\n\t\tif (!this._prevQuaternion) {\n\t\t\tthis._prevQuaternion = quat.clone(event.quaternion);\n\t\t\tthis._quaternion = quat.clone(event.quaternion);\n\t\t\treturn;\n\t\t}\n\n\t\tquat.copy(this._prevQuaternion, this._quaternion);\n\t\tquat.copy(this._quaternion, event.quaternion);\n\n\t\tthis.observer.change(this, event, toAxis(this.axes, [\n\t\t\tgetDeltaYaw(this._prevQuaternion, this._quaternion),\n\t\t\tgetDeltaPitch(this._prevQuaternion, this._quaternion)\n\t\t]));\n\t}\n\t_attachEvent() {\n\t\tthis.fusionPoseSensor.on(\"change\", this._onPoseChange);\n\t}\n\t_dettachEvent() {\n\t\tthis.fusionPoseSensor.off(\"change\", this._onPoseChange);\n\t}\n}\n","import {glMatrix} from \"gl-matrix\";\nimport {window} from \"../utils/browser\";\n\n// Singleton\nlet screenRotationAngleInst = null;\nlet refCount = 0;\n\nexport default class ScreenRotationAngle {\n\tconstructor() {\n\t\trefCount++;\n\n\t\tif (screenRotationAngleInst) {\n\t\t\treturn screenRotationAngleInst;\n\t\t}\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = this;\n\t\t/* eslint-enable */\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onOrientationChange = this._onOrientationChange.bind(this);\n\n\t\tthis._spinR = 0;\n\n\t\tthis._screenOrientationAngle = 0;\n\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.addEventListener(\"orientationchange\", this._onOrientationChange);\n\t}\n\n\t_onDeviceOrientation(e) {\n\t\tif (e.beta === null || e.gamma === null) {\n\t\t\t// (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it.\n\t\t\treturn;\n\t\t}\n\n\t\t// Radian\n\t\tconst betaR = glMatrix.toRadian(e.beta);\n\t\tconst gammaR = glMatrix.toRadian(e.gamma);\n\n\t\t/* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */\n\t\tthis._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR));\n\t}\n\n\t_onOrientationChange(e) {\n\t\tif (window.screen && window.screen.orientation && window.screen.orientation.angle !== undefined) {\n\t\t\tthis._screenOrientationAngle = screen.orientation.angle;\n\t\t} else if (window.orientation !== undefined) {\n\t\t\t/* iOS */\n\t\t\tthis._screenOrientationAngle = window.orientation >= 0 ?\n\t\t\t\twindow.orientation : 360 + window.orientation;\n\t\t}\n\t}\n\n\tgetRadian() {\n\t\t// Join with screen orientation\n\t\t// this._testVal = this._spinR + \", \" + this._screenOrientationAngle + \", \" + window.orientation;\n\t\treturn this._spinR + glMatrix.toRadian(this._screenOrientationAngle);\n\t}\n\n\tunref() {\n\t\tif (--refCount > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"orientationchange\", this._onOrientationChange);\n\n\t\tthis._spinR = 0;\n\t\tthis._screenOrientationAngle = 0;\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = null;\n\t\t/* eslint-enable */\n\t\trefCount = 0;\n\t}\n}\n","import Axes, {PanInput} from \"@egjs/axes\";\nimport ScreenRotationAngle from \"../ScreenRotationAngle\";\n\n/**\n * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle.\n *\n * The reason for using this function is that in VR mode,\n * the roll angle is adjusted in the direction opposite to the screen rotation angle.\n *\n * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.\n * @extends PanInput\n */\nexport default class RotationPanInput extends PanInput {\n\t/**\n\t * Constructor\n\t *\n\t * @private\n\t * @param {HTMLElement} el target element\n\t * @param {Object} [options] The option object\n\t * @param {Boolean} [options.useRotation] Whether to use rotation(or VR)\n\t */\n\tconstructor(el, options) {\n\t\tsuper(el, options);\n\n\t\tthis._useRotation = false;\n\t\tthis._screenRotationAngle = null;\n\n\t\tthis.setUseRotation(!!(options && options.useRotation));\n\n\t\tthis._userDirection = Axes.DIRECTION_ALL;\n\t}\n\n\tsetUseRotation(useRotation) {\n\t\tthis._useRotation = useRotation;\n\n\t\tif (this._screenRotationAngle) {\n\t\t\tthis._screenRotationAngle.unref();\n\t\t\tthis._screenRotationAngle = null;\n\t\t}\n\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle = new ScreenRotationAngle();\n\t\t}\n\t}\n\n\tconnect(observer) {\n\t\t// User intetened direction\n\t\tthis._userDirection = this._direction;\n\n\t\t// In VR Mode, Use ALL direction if direction is not none\n\t\t// Because horizontal and vertical is changed dynamically by screen rotation.\n\t\t// this._direction is used to initialize hammerjs\n\t\tif (this._useRotation && (this._direction & Axes.DIRECTION_ALL)) {\n\t\t\tthis._direction = Axes.DIRECTION_HORIZONTAL;\n\t\t}\n\n\t\tsuper.connect(observer);\n\t}\n\n\tgetOffset(properties, useDirection) {\n\t\tif (this._useRotation === false) {\n\t\t\treturn super.getOffset(properties, useDirection);\n\t\t}\n\n\t\tconst offset = super.getOffset(properties, [true, true]);\n\t\tconst newOffset = [0, 0];\n\n\t\tconst theta = this._screenRotationAngle.getRadian();\n\n\t\tconst cosTheta = Math.cos(theta);\n\t\tconst sinTheta = Math.sin(theta);\n\n\t\t// RotateZ\n\t\tnewOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta;\n\t\tnewOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta;\n\n\t\t// Use only user allowed direction.\n\t\tif (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) {\n\t\t\tnewOffset[0] = 0;\n\t\t} else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) {\n\t\t\tnewOffset[1] = 0;\n\t\t}\n\n\t\treturn newOffset;\n\t}\n\n\tdestroy() {\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle && this._screenRotationAngle.unref();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n\n/**\n * Override getDirectionByAngle to return DIRECTION_ALL\n * Ref: https://github.com/naver/egjs-axes/issues/99\n *\n * But we obey axes's rule. If axes's rule is problem, let's apply following code.\n */\n// PanInput.getDirectionByAngle = function (angle, thresholdAngle) {\n// \treturn DIRECTION_ALL;\n// };\n","import Component from \"@egjs/component\";\nimport {vec3, glMatrix, quat} from \"gl-matrix\";\nimport FusionPoseSensor from \"./input/FusionPoseSensor\";\n\nconst Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0);\n\nexport default class DeviceQuaternion extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._fusionPoseSensor = new FusionPoseSensor();\n\t\tthis._quaternion = quat.create();\n\n\t\tthis._fusionPoseSensor.enable();\n\t\tthis._fusionPoseSensor.on(\"change\", e => {\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis.trigger(\"change\", {isTrusted: true});\n\t\t});\n\t}\n\n\tgetCombinedQuaternion(yaw) {\n\t\tconst yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw));\n\t\tconst conj = quat.conjugate(quat.create(), this._quaternion);\n\t\t// Multiply pitch quaternion -> device quaternion -> yaw quaternion\n\t\tconst outQ = quat.multiply(quat.create(), conj, yawQ);\n\n\t\treturn outQ;\n\t}\n\n\tdestroy() {\n\t\t// detach all event handler\n\t\tthis.off();\n\n\t\tif (this._fusionPoseSensor) {\n\t\t\tthis._fusionPoseSensor.off();\n\t\t\tthis._fusionPoseSensor.destroy();\n\t\t\tthis._fusionPoseSensor = null;\n\t\t}\n\t}\n}\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport Axes, {PinchInput, MoveKeyInput, WheelInput} from \"@egjs/axes\";\nimport {vec2, glMatrix} from \"gl-matrix\";\nimport {getComputedStyle, SUPPORT_TOUCH, SUPPORT_DEVICEMOTION} from \"../utils/browserFeature\";\nimport TiltMotionInput from \"./input/TiltMotionInput\";\nimport RotationPanInput from \"./input/RotationPanInput\";\nimport DeviceQuaternion from \"./DeviceQuaternion\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {\n\tGYRO_MODE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\tTOUCH_DIRECTION_NONE,\n} from \"./consts\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF];\nconst DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF];\nconst CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF];\n\n/**\n * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates.\n *\n * @alias eg.YawPitchControl\n * @extends eg.Component\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n */\nclass YawPitchControl extends Component {\n\tstatic VERSION = VERSION;\n\t// Expose DeviceOrientationControls sub module for test purpose\n\tstatic CONTROL_MODE_VR = CONTROL_MODE_VR;\n\tstatic CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH;\n\tstatic TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL;\n\tstatic TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW;\n\tstatic TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH;\n\tstatic TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE;\n\t/**\n\t * @param {Object} options The option object of the eg.YawPitch module\n\t * @param {Element}[options.element=null] element A base element for the eg.YawPitch module\n\t * @param {Number} [options.yaw=0] initial yaw (degree)\n\t * @param {Number} [options.pitch=0] initial pitch (degree)\n\t * @param {Number} [options.fov=65] initial field of view (degree)\n\t * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown\n\t * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available\n\t * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion.\n\t * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move)\n\t * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw\n\t * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch\n\t * @param {Array} [options.fovRange=[30, 110] Range of FOV\n\t * @param {Number} [options.aspectRatio=1] Aspect Ratio\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\n\t\tconst opt = Object.assign({\n\t\t\telement: null,\n\t\t\tyaw: 0,\n\t\t\tpitch: 0,\n\t\t\tfov: 65,\n\t\t\tshowPolePoint: false,\n\t\t\tuseZoom: true,\n\t\t\tuseKeyboard: true,\n\t\t\tgyroMode: GYRO_MODE.YAWPITCH,\n\t\t\ttouchDirection: TOUCH_DIRECTION_ALL,\n\t\t\tyawRange: DEFAULT_YAW_RANGE,\n\t\t\tpitchRange: DEFAULT_PITCH_RANGE,\n\t\t\tfovRange: [30, 110],\n\t\t\taspectRatio: 1, /* TODO: Need Mandatory? */\n\t\t}, options);\n\n\t\tthis._element = opt.element;\n\t\tthis._initialFov = opt.fov;\n\t\tthis._enabled = false;\n\t\tthis._isAnimating = false;\n\t\tthis._deviceQuaternion = null;\n\n\t\tthis._initAxes(opt);\n\t\tthis.option(opt);\n\t}\n\n\t_initAxes(opt) {\n\t\tconst yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio);\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint);\n\t\tconst useRotation = opt.gyroMode === GYRO_MODE.VR;\n\n\t\tthis.axesPanInput = new RotationPanInput(this._element, {useRotation});\n\t\tthis.axesWheelInput = new WheelInput(this._element, {scale: -4});\n\t\tthis.axesTiltMotionInput = null;\n\t\tthis.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, {scale: -1}) : null;\n\t\tthis.axesMoveKeyInput = new MoveKeyInput(this._element, {scale: [-6, 6]});\n\n\t\tthis.axes = new Axes({\n\t\t\tyaw: {\n\t\t\t\trange: yRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(yRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tpitch: {\n\t\t\t\trange: pRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(pRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tfov: {\n\t\t\t\trange: opt.fovRange,\n\t\t\t\tcircular: [false, false],\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t}, {\n\t\t\tdeceleration: MC_DECELERATION,\n\t\t\tmaximumDuration: MC_MAXIMUM_DURATION\n\t\t}, {\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov\n\t\t}).on({\n\t\t\thold: evt => {\n\t\t\t\t// Restore maximumDuration not to be spin too mush.\n\t\t\t\tthis.axes.options.maximumDuration = MC_MAXIMUM_DURATION;\n\n\t\t\t\tthis.trigger(\"hold\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t\tchange: evt => {\n\t\t\t\tif (evt.delta.fov !== 0) {\n\t\t\t\t\tthis._updateControlScale(evt);\n\t\t\t\t\tthis.updatePanScale();\n\t\t\t\t}\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\trelease: evt => {\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\tanimationStart: evt => {\n\t\t\t},\n\t\t\tanimationEnd: evt => {\n\t\t\t\tthis.trigger(\"animationEnd\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Update Pan Scale\n\t *\n\t * Scale(Sensitivity) values of panning is related with fov and height.\n\t * If at least one of them is changed, this function need to be called.\n\t * @param {*} param\n\t */\n\tupdatePanScale(param = {}) {\n\t\tconst fov = this.axes.get().fov;\n\t\tconst areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);\n\t\tconst scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight;\n\n\t\tthis.axesPanInput.options.scale = [scale, scale];\n\t\tthis.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW;\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * Override component's option method\n\t * to call method for updating values which is affected by option change.\n\t *\n\t * @param {*} args\n\t */\n\toption(...args) {\n\t\tconst argLen = args.length;\n\n\t\t// Getter\n\t\tif (argLen === 0) {\n\t\t\treturn this._getOptions();\n\t\t} else if (argLen === 1 && typeof args[0] === \"string\") {\n\t\t\treturn this._getOptions(args[0]);\n\t\t}\n\n\t\t// Setter\n\t\tconst beforeOptions = Object.assign({}, this.options);\n\t\tlet newOptions = {};\n\t\tlet changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList.\n\n\t\tif (argLen === 1) {\n\t\t\tchangedKeyList = Object.keys(args[0]);\n\t\t\tnewOptions = Object.assign({}, args[0]);\n\t\t} else if (argLen >= 2) {\n\t\t\tchangedKeyList.push(args[0]);\n\t\t\tnewOptions[args[0]] = args[1];\n\t\t}\n\n\t\tthis._setOptions(this._getValidatedOptions(newOptions));\n\t\tthis._applyOptions(changedKeyList, beforeOptions);\n\t\treturn this;\n\t}\n\n\t_getValidatedOptions(newOptions) {\n\t\tif (newOptions.yawRange) {\n\t\t\tnewOptions.yawRange =\n\t\t\t\tthis._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio);\n\t\t}\n\t\tif (newOptions.pitchRange) {\n\t\t\tnewOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov);\n\t\t}\n\t\treturn newOptions;\n\t}\n\n\t_getOptions(key) {\n\t\tlet value;\n\n\t\tif (typeof key === \"string\") {\n\t\t\tvalue = this.options[key];\n\t\t} else if (arguments.length === 0) {\n\t\t\tvalue = this.options;\n\t\t}\n\t\treturn value;\n\t}\n\n\t_setOptions(options) {\n\t\tfor (const key in options) {\n\t\t\tthis.options[key] = options[key];\n\t\t}\n\t}\n\n\t_applyOptions(keys, prevOptions) {\n\t\tconst options = this.options;\n\t\tconst axes = this.axes;\n\t\tconst isVR = options.gyroMode === GYRO_MODE.VR;\n\t\tconst isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH;\n\t\t// If it's VR mode, restrict user interaction to yaw direction only\n\t\tconst touchDirection = isVR ?\n\t\t\t(TOUCH_DIRECTION_YAW & options.touchDirection) :\n\t\t\toptions.touchDirection;\n\n\t\t// If one of below is changed, call updateControlScale()\n\t\tif (keys.some(key =>\n\t\t\tkey === \"showPolePoint\" || key === \"fov\" || key === \"aspectRatio\" ||\n\t\t\tkey === \"yawRange\" || key === \"pitchRange\"\n\t\t)) {\n\t\t\t// If fov is changed, update pan scale\n\t\t\tif (keys.indexOf(\"fov\") >= 0) {\n\t\t\t\taxes.setTo({\"fov\": options.fov});\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\n\t\t\tthis._updateControlScale();\n\t\t}\n\n\t\tif (keys.some(key => key === \"fovRange\")) {\n\t\t\tconst fovRange = options.fovRange;\n\t\t\tconst prevFov = axes.get().fov;\n\t\t\tlet nextFov = axes.get().fov;\n\n\t\t\tvec2.copy(axes.axis.fov.range, fovRange);\n\n\t\t\tif (nextFov < fovRange[0]) {\n\t\t\t\tnextFov = fovRange[0];\n\t\t\t} else if (prevFov > fovRange[1]) {\n\t\t\t\tnextFov = fovRange[1];\n\t\t\t}\n\n\t\t\tif (prevFov !== nextFov) {\n\t\t\t\taxes.setTo({\n\t\t\t\t\tfov: nextFov\n\t\t\t\t}, 0);\n\t\t\t\tthis._updateControlScale();\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"gyroMode\") && SUPPORT_DEVICEMOTION) {\n\t\t\t// Disconnect first\n\t\t\tif (this.axesTiltMotionInput) {\n\t\t\t\tthis.axes.disconnect(this.axesTiltMotionInput);\n\t\t\t\tthis.axesTiltMotionInput.destroy();\n\t\t\t\tthis.axesTiltMotionInput = null;\n\t\t\t}\n\n\t\t\tif (this._deviceQuaternion) {\n\t\t\t\tthis._deviceQuaternion.destroy();\n\t\t\t\tthis._deviceQuaternion = null;\n\t\t\t}\n\n\t\t\tif (isVR) {\n\t\t\t\tthis._initDeviceQuaternion();\n\t\t\t} else if (isYawPitch) {\n\t\t\t\tthis.axesTiltMotionInput = new TiltMotionInput(this._element);\n\t\t\t\tthis.axes.connect([\"yaw\", \"pitch\"], this.axesTiltMotionInput);\n\t\t\t}\n\n\t\t\tthis.axesPanInput.setUseRotation(isVR);\n\t\t}\n\n\t\tif (keys.some(key => key === \"useKeyboard\")) {\n\t\t\tconst useKeyboard = options.useKeyboard;\n\n\t\t\tif (useKeyboard) {\n\t\t\t\taxes.connect([\"yaw\", \"pitch\"], this.axesMoveKeyInput);\n\t\t\t} else {\n\t\t\t\taxes.disconnect(this.axesMoveKeyInput);\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"useZoom\")) {\n\t\t\tconst useZoom = options.useZoom;\n\n\t\t\t// Disconnect first\n\t\t\taxes.disconnect(this.axesWheelInput);\n\t\t\tif (useZoom) {\n\t\t\t\taxes.connect([\"fov\"], this.axesWheelInput);\n\t\t\t}\n\t\t}\n\n\t\tthis._togglePinchInputByOption(options.touchDirection, options.useZoom);\n\n\t\tif (keys.some(key => key === \"touchDirection\")) {\n\t\t\tthis._enabled && this._enableTouch(touchDirection);\n\t\t}\n\t}\n\n\t_togglePinchInputByOption(touchDirection, useZoom) {\n\t\tif (this.axesPinchInput) {\n\t\t\t// disconnect first\n\t\t\tthis.axes.disconnect(this.axesPinchInput);\n\n\t\t\t// If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll.\n\t\t\tif (\n\t\t\t\tuseZoom &&\n\t\t\t\ttouchDirection === TOUCH_DIRECTION_ALL &&\n\t\t\t\t// TODO: Get rid of using private property of axes instance.\n\t\t\t\tthis.axes._inputs.indexOf(this.axesPinchInput) === -1\n\t\t\t) {\n\t\t\t\tthis.axes.connect([\"fov\"], this.axesPinchInput);\n\t\t\t}\n\t\t}\n\t}\n\n\t_enableTouch(direction) {\n\t\t// Disconnect first\n\t\tthis.axesPanInput && this.axes.disconnect(this.axesPanInput);\n\n\t\tconst yawEnabled = direction & TOUCH_DIRECTION_YAW ? \"yaw\" : null;\n\t\tconst pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? \"pitch\" : null;\n\n\t\tthis.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput);\n\t}\n\n\t_initDeviceQuaternion() {\n\t\tthis._deviceQuaternion = new DeviceQuaternion();\n\t\tthis._deviceQuaternion.on(\"change\", e => {\n\t\t\tthis._triggerChange(e);\n\t\t});\n\t}\n\n\t_getValidYawRange(newYawRange, newFov, newAspectRatio) {\n\t\tconst ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1);\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst horizontalFov = fov * ratio;\n\t\tconst isValid = newYawRange[1] - newYawRange[0] >= horizontalFov;\n\n\t\tif (isValid) {\n\t\t\treturn newYawRange;\n\t\t} else {\n\t\t\treturn this.options.yawRange || DEFAULT_YAW_RANGE;\n\t\t}\n\t}\n\n\t_getValidPitchRange(newPitchRange, newFov) {\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst isValid = newPitchRange[1] - newPitchRange[0] >= fov;\n\n\t\tif (isValid) {\n\t\t\treturn newPitchRange;\n\t\t} else {\n\t\t\treturn this.options.pitchRange || DEFAULT_PITCH_RANGE;\n\t\t}\n\t}\n\n\tstatic isCircular(range) {\n\t\treturn range[1] - range[0] < 360 ? [false, false] : [true, true];\n\t}\n\n\t/**\n\t * Update yaw/pitch min/max by 5 factor\n\t *\n\t * 1. showPolePoint\n\t * 2. fov\n\t * 3. yawRange\n\t * 4. pitchRange\n\t * 5. aspectRatio\n\t *\n\t * If one of above is changed, call this function\n\t */\n\t_updateControlScale(changeEvt) {\n\t\tconst opt = this.options;\n\t\tconst fov = this.axes.get().fov;\n\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint);\n\t\tconst yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio);\n\n\t\t// TODO: If not changed!?\n\t\tconst pos = this.axes.get();\n\t\tlet y = pos.yaw;\n\t\tlet p = pos.pitch;\n\n\t\tvec2.copy(this.axes.axis.yaw.range, yRange);\n\t\tvec2.copy(this.axes.axis.pitch.range, pRange);\n\t\tthis.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange);\n\t\tthis.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange);\n\n\t\t/**\n\t\t * update yaw/pitch by it's range.\n\t\t */\n\t\tif (y < yRange[0]) {\n\t\t\ty = yRange[0];\n\t\t} else if (y > yRange[1]) {\n\t\t\ty = yRange[1];\n\t\t}\n\n\t\tif (p < pRange[0]) {\n\t\t\tp = pRange[0];\n\t\t} else if (p > pRange[1]) {\n\t\t\tp = pRange[1];\n\t\t}\n\n\t\tif (changeEvt) {\n\t\t\tchangeEvt.set({\n\t\t\t\tyaw: y,\n\t\t\t\tpitch: p,\n\t\t\t});\n\t\t}\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\t_updatePitchRange(pitchRange, fov, showPolePoint) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\t// Circular pitch on VR\n\t\t\treturn CIRCULAR_PITCH_RANGE;\n\t\t}\n\n\t\tconst verticalAngle = pitchRange[1] - pitchRange[0];\n\t\tconst halfFov = fov / 2;\n\t\tconst isPanorama = verticalAngle < 180;\n\n\t\tif (showPolePoint && !isPanorama) {\n\t\t\t// Use full pinch range\n\t\t\treturn pitchRange.concat();\n\t\t}\n\n\t\t// Round value as movableCood do.\n\t\treturn [pitchRange[0] + halfFov, pitchRange[1] - halfFov];\n\t}\n\n\t_updateYawRange(yawRange, fov, aspectRatio) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\treturn DEFAULT_YAW_RANGE;\n\t\t}\n\n\t\tconst horizontalAngle = yawRange[1] - yawRange[0];\n\n\t\t/**\n\t\t * Full 360 Mode\n\t\t */\n\t\tif (horizontalAngle >= 360) {\n\t\t\t// Don't limit yaw range on Full 360 mode.\n\t\t\treturn yawRange.concat();\n\t\t}\n\n\t\t/**\n\t\t * Panorama mode\n\t\t */\n\t\t// Ref : https://github.com/naver/egjs-view360/issues/290\n\t\tconst halfHorizontalFov =\n\t\t\tmathUtil.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2))));\n\n\t\t// Round value as movableCood do.\n\t\treturn [\n\t\t\tyawRange[0] + halfHorizontalFov,\n\t\t\tyawRange[1] - halfHorizontalFov\n\t\t];\n\t}\n\n\t_triggerChange(evt) {\n\t\tconst pos = this.axes.get();\n\t\tconst opt = this.options;\n\t\tconst event = {\n\t\t\ttargetElement: opt.element,\n\t\t\tisTrusted: evt.isTrusted,\n\t\t};\n\n\t\tevent.yaw = pos.yaw;\n\t\tevent.pitch = pos.pitch;\n\t\tevent.fov = pos.fov;\n\n\t\tif (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) {\n\t\t\tevent.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t\t}\n\t\tthis.trigger(\"change\", event);\n\t}\n\n\t// TODO: makes constant to be logic\n\tstatic adjustAspectRatio(input) {\n\t\tconst inputRange = [\n\t\t\t0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670,\n\t\t\t0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19,\n\t\t\t1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26,\n\t\t\t2.30, 2.60, 3.00, 5.00, 6.00\n\t\t];\n\t\tconst outputRange = [\n\t\t\t0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710,\n\t\t\t0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15,\n\t\t\t1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72,\n\t\t\t1.82, 1.92, 2.00, 2.24, 2.30\n\t\t];\n\n\t\tlet rangeIdx = -1;\n\n\t\tfor (let i = 0; i < inputRange.length - 1; i++) {\n\t\t\tif (inputRange[i] <= input && inputRange[i + 1] >= input) {\n\t\t\t\trangeIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (rangeIdx === -1) {\n\t\t\tif (inputRange[0] > input) {\n\t\t\t\treturn outputRange[0];\n\t\t\t} else {\n\t\t\t\treturn outputRange[outputRange[0].length - 1];\n\t\t\t}\n\t\t}\n\n\t\tconst inputA = inputRange[rangeIdx];\n\t\tconst inputB = inputRange[rangeIdx + 1];\n\t\tconst outputA = outputRange[rangeIdx];\n\t\tconst outputB = outputRange[rangeIdx + 1];\n\n\t\treturn YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA));\n\t}\n\n\tstatic lerp(a, b, fraction) {\n\t\treturn a + fraction * (b - a);\n\t}\n\n\t/**\n\t * Enable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#enable\n\t */\n\tenable() {\n\t\tif (this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._enabled = true;\n\n\t\t// touchDirection is decided by parameter is valid string (Ref. Axes.connect)\n\t\tthis._applyOptions(Object.keys(this.options), this.options);\n\n\t\t// TODO: Is this code is needed? Check later.\n\t\tthis.updatePanScale();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Disable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#disable\n\t */\n\tdisable(persistOrientation) {\n\t\tif (!this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// TODO: Check peristOrientation is needed!\n\t\tif (!persistOrientation) {\n\t\t\tthis._resetOrientation();\n\t\t}\n\t\tthis.axes.disconnect();\n\t\tthis._enabled = false;\n\t\treturn this;\n\t}\n\n\t_resetOrientation() {\n\t\tconst opt = this.options;\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Set one or more of yaw, pitch, fov\n\t *\n\t * @param {Object} coordinate yaw, pitch, fov\n\t * @param {Number} duration Animation duration. if it is above 0 then it's animated.\n\t */\n\tlookAt({yaw, pitch, fov}, duration) {\n\t\tconst pos = this.axes.get();\n\n\t\tconst y = yaw === undefined ? 0 : yaw - pos.yaw;\n\t\tconst p = pitch === undefined ? 0 : pitch - pos.pitch;\n\t\tconst f = fov === undefined ? 0 : fov - pos.fov;\n\n\t\t// Allow duration of animation to have more than MC_MAXIMUM_DURATION.\n\t\tthis.axes.options.maximumDuration = Infinity;\n\n\t\tthis.axes.setBy({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t\tfov: f\n\t\t}, duration);\n\t}\n\n\tgetYawPitch() {\n\t\tconst yawPitch = this.axes.get();\n\n\t\treturn {\n\t\t\tyaw: yawPitch.yaw,\n\t\t\tpitch: yawPitch.pitch,\n\t\t};\n\t}\n\n\tgetFov() {\n\t\treturn this.axes.get().fov;\n\t}\n\n\tgetQuaternion() {\n\t\tconst pos = this.axes.get();\n\n\t\treturn this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t}\n\n\tshouldRenderWithQuaternion() {\n\t\treturn this.options.gyroMode === GYRO_MODE.VR;\n\t}\n\n\t/**\n\t * Destroys objects\n\t */\n\tdestroy() {\n\t\tthis.axes && this.axes.destroy();\n\t\tthis.axisPanInput && this.axisPanInput.destroy();\n\t\tthis.axesWheelInput && this.axesWheelInput.destroy();\n\t\tthis.axesTiltMotionInput && this.axesTiltMotionInput.destroy();\n\t\tthis.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy();\n\t\tthis.axesPinchInput && this.axesPinchInput.destroy();\n\t\tthis.axesMoveKeyInput && this.axesMoveKeyInput.destroy();\n\t\tthis._deviceQuaternion && this._deviceQuaternion.destroy();\n\t}\n}\n\nexport default YawPitchControl;\n","import Component from \"@egjs/component\";\n\nconst STATUS = {\n\t\"NONE\": 0,\n\t\"LOADING\": 1,\n\t\"LOADED\": 2,\n\t\"ERROR\": 3\n};\n\nconst EVENT = {\n\t\"READYSTATECHANGE\": \"readystatechange\"\n};\n\nclass ImageLoader extends Component {\n\tstatic STATUS = STATUS;\n\tconstructor(image) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis._image = null;\n\t\tthis._onceHandlers = [];\n\t\tthis._loadStatus = STATUS.NONE;\n\n\t\timage && this.set(image);\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._image) {\n\t\t\t\trej(\"ImageLoader: image is not defiend\");\n\t\t\t} else if (this._loadStatus === STATUS.LOADED) {\n\t\t\t\tres(this.getElement());\n\t\t\t} else if (this._loadStatus === STATUS.LOADING) {\n\t\t\t\t/* Check isMaybeLoaded() first because there may have\n\t\t\t\t\tposibilities that image already loaded before get is called.\n\t\t\t\t\tfor example calling get on external image onload callback.*/\n\t\t\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\t\tres(this.getElement());\n\t\t\t\t} else {\n\t\t\t\t\tthis.on(EVENT.READYSTATECHANGE, e => {\n\t\t\t\t\t\tif (e.type === STATUS.LOADED) {\n\t\t\t\t\t\t\tres(this.getElement());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trej(\"ImageLoader: failed to load images.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trej(\"ImageLoader: failed to load images\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param image img element or img url or array of img element or array of img url\n\t */\n\tset(image) {\n\t\tthis._loadStatus = STATUS.LOADING;\n\n\t\tthis._image = ImageLoader.createElement(image);\n\n\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.onceLoaded(\n\t\t\tthis._image,\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.LOADED\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.ERROR;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.ERROR\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tstatic createElement(image) {\n\t\tconst images = image instanceof Array ? image : [image];\n\n\t\treturn images.map(img => {\n\t\t\tlet _img = img;\n\n\t\t\tif (typeof img === \"string\") {\n\t\t\t\t_img = new Image();\n\t\t\t\t_img.crossOrigin = \"anonymous\";\n\t\t\t\t_img.src = img;\n\t\t\t}\n\t\t\treturn _img;\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._image.length === 1 ? this._image[0] : this._image;\n\t}\n\n\tstatic isMaybeLoaded(image) {\n\t\tlet result = false;\n\n\t\tif (image instanceof Image) {\n\t\t\tresult = image.complete && image.naturalWidth !== 0;\n\t\t} else if (image instanceof Array) {\n\t\t\tresult = !image.some(img => !img.complete || img.naturalWidth === 0);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonceLoaded(target, onload, onerror) {\n\t\tconst targets = target instanceof Array ? target : [target];\n\t\tconst targetsNotLoaded = targets.filter(img => !ImageLoader.isMaybeLoaded(img));\n\t\tconst loadPromises = targetsNotLoaded.map(img => new Promise((res, rej) => {\n\t\t\tthis._once(img, \"load\", () => (res(img)));\n\t\t\tthis._once(img, \"error\", () => (rej(img)));\n\t\t}));\n\n\t\tPromise.all(loadPromises).then(\n\t\t\tresult => (onload(targets.length === 1 ? targets[0] : targets)),\n\t\t\treason => (onerror(reason))\n\t\t);\n\t}\n\n\t_once(target, type, listener) {\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\ttarget.addEventListener(type, fn);\n\t\tthis._onceHandlers.push({target, type, fn});\n\t}\n\n\tgetStatus() {\n\t\treturn this._loadStatus;\n\t}\n\n\tdestroy() {\n\t\tthis._onceHandlers.forEach(handler => {\n\t\t\thandler.target.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._onceHandlers = [];\n\t\tthis._image.src = \"\";\n\t\tthis._image = null;\n\t\tthis._loadStatus = STATUS.NONE;\n\t}\n}\n\nexport default ImageLoader;\n","// import Agent from \"@egjs/agent\";\n\n/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */\nconst READY_STATUS = {\n\tHAVE_NOTHING: 0, // no information whether or not the audio/video is ready\n\tHAVE_METADATA: 1, // HAVE_METADATA - metadata for the audio/video is ready\n\tHAVE_CURRENT_DATA: 2, // data for the current playback position is available, but not enough data to play next frame/millisecond\n\tHAVE_FUTURE_DATA: 3, // data for the current and at least the next frame is available\n\tHAVE_ENOUGH_DATA: 4, // enough data available to start playing\n\t// below is custom status for failed to load status\n\tLOADING_FAILED: -1\n};\n\nconst READYSTATECHANGE_EVENT_NAME = {};\n\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = \"loadedmetadata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = \"loadeddata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = \"canplay\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = \"canplaythrough\";\n\nexport default class VideoLoader {\n\tconstructor(video) {\n\t\tthis._handlers = [];\n\t\tthis._sourceCount = 0;\n\n\t\t// on iOS safari, 'loadeddata' will not triggered unless the user hits play,\n\t\t// so used 'loadedmetadata' instead.\n\t\tthis._thresholdReadyState = READY_STATUS.HAVE_METADATA;\n\t\tthis._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState];\n\n\t\tthis._loadStatus = (video && video.readyState) || READY_STATUS.HAVE_NOTHING;\n\n\t\tthis._onerror = this._onerror.bind(this);\n\n\t\tvideo && this.set(video);\n\t}\n\n\t_onerror() {\n\t\tthis._errorCount++;\n\t\tif (this._errorCount >= this._sourceCount) {\n\t\t\tthis._loadStatus = READY_STATUS.LOADING_FAILED;\n\t\t\tthis._detachErrorHandler(this._onerror);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src}\n\t */\n\t_appendSourceElement(videoUrl) {\n\t\tlet videoSrc;\n\t\tlet videoType;\n\n\t\tif (typeof videoUrl === \"object\") {\n\t\t\tvideoSrc = videoUrl.src;\n\t\t\tvideoType = videoUrl.type;\n\t\t} else if (typeof videoUrl === \"string\") {\n\t\t\tvideoSrc = videoUrl;\n\t\t}\n\n\t\tif (!videoSrc) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst sourceElement = document.createElement(\"source\");\n\n\t\tsourceElement.src = videoSrc;\n\t\tvideoType && (sourceElement.type = videoType);\n\n\t\tthis._video.appendChild(sourceElement);\n\t\treturn true;\n\t}\n\n\tset(video) {\n\t\tthis._reset(); // reset resources.\n\n\t\tif (!video) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (video instanceof HTMLVideoElement) {\n\t\t\t// video tag\n\t\t\tthis._video = video;\n\t\t} else if (typeof video === \"string\" || typeof video === \"object\") {\n\t\t\t// url\n\t\t\tthis._video = document.createElement(\"video\");\n\t\t\tthis._video.setAttribute(\"crossorigin\", \"anonymous\");\n\t\t\tthis._video.setAttribute(\"webkit-playsinline\", \"\");\n\t\t\tthis._video.setAttribute(\"playsinline\", \"\");\n\n\t\t\tif (video instanceof Array) {\n\t\t\t\tvideo.forEach(v => this._appendSourceElement(v));\n\t\t\t} else {\n\t\t\t\tthis._appendSourceElement(video);\n\t\t\t}\n\n\t\t\tthis._sourceCount = this._video.querySelectorAll(\"source\").length;\n\n\t\t\tif (this._sourceCount > 0) {\n\t\t\t\tif (this._video.readyState < this._thresholdReadyState) {\n\t\t\t\t\tthis._video.load();\n\t\t\t\t\t// attach loading error listener\n\t\t\t\t\tthis._attachErrorHandler(this._onerror);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._video = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t_attachErrorHandler(handler) {\n\t\tthis._video.addEventListener(\"error\", handler);\n\t\tthis._sources = this._video.querySelectorAll(\"source\");\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.addEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\t_detachErrorHandler(handler) {\n\t\tthis._video.removeEventListener(\"error\", handler);\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.removeEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._video) {\n\t\t\t\trej(\"VideoLoader: video is undefined\");\n\t\t\t} else if (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t} else if (this._video.readyState >= this._thresholdReadyState) {\n\t\t\t\tres(this._video);\n\t\t\t} else {\n\t\t\t\t// check errorCnt and reject\n\t\t\t\tconst rejector = () => {\n\t\t\t\t\tif (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\t\t\tthis._detachErrorHandler(rejector);\n\t\t\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis._attachErrorHandler(rejector);\n\t\t\t\tthis._once(this._thresholdEventName, () => res(this._video));\n\t\t\t}\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._video;\n\t}\n\n\tdestroy() {\n\t\tthis._reset();\n\t}\n\n\t_reset() {\n\t\tthis._handlers.forEach(handler => {\n\t\t\tthis._video.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._handlers = [];\n\t\tthis._video = null;\n\n\t\tthis._sourceCount = 0;\n\t\tthis._errorCount = 0;\n\t}\n\n\t_once(type, listener) {\n\t\tconst target = this._video;\n\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\t/* By useCapture mode enabled, you can capture the error event being fired on source(child)*/\n\t\ttarget.addEventListener(type, fn, true);\n\t\tthis._handlers.push({type, fn});\n\t}\n}\n","import agent from \"@egjs/agent\";\n\nconst WEBGL_ERROR_CODE = {\n\t\"0\": \"NO_ERROR\",\n\t\"1280\": \"INVALID_ENUM\",\n\t\"1281\": \"INVALID_VALUE\",\n\t\"1282\": \"INVALID_OPERATION\",\n\t\"1285\": \"OUT_OF_MEMORY\",\n\t\"1286\": \"INVALID_FRAMEBUFFER_OPERATION\",\n\t\"37442\": \"CONTEXT_LOST_WEBGL\"\n};\n\nlet webglAvailability = null;\nlet MAX_TEXTURE_SIZE_FOR_TEST = null;\n\nexport default class WebGLUtils {\n\tstatic createShader(gl, type, source) {\n\t\tconst shader = gl.createShader(type);\n\n\t\tgl.shaderSource(shader, source);\n\t\tgl.compileShader(shader);\n\t\tconst success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n\t\tif (success) {\n\t\t\treturn shader;\n\t\t} else {\n\t\t\t// eslint-disable-next-line\n\t\t\tconsole.error(gl.getShaderInfoLog(shader));\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic createProgram(gl, vertexShader, fragmentShader) {\n\t\tconst program = gl.createProgram();\n\n\t\tgl.attachShader(program, vertexShader);\n\t\tgl.attachShader(program, fragmentShader);\n\t\tgl.linkProgram(program);\n\n\t\tgl.detachShader(program, vertexShader);\n\t\tgl.detachShader(program, fragmentShader);\n\t\tgl.deleteShader(vertexShader);\n\t\tgl.deleteShader(fragmentShader);\n\n\t\tconst success = gl.getProgramParameter(program, gl.LINK_STATUS);\n\n\t\tif (success) {\n\t\t\treturn program;\n\t\t}\n\n\t\tgl.deleteProgram(program);\n\t\treturn null;\n\t}\n\n\tstatic initBuffer(gl, target /* bind point */, data, itemSize, attr) {\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer(target, buffer);\n\t\tgl.bufferData(target, data, gl.STATIC_DRAW);\n\n\t\tif (buffer) {\n\t\t\tbuffer.itemSize = itemSize;\n\t\t\tbuffer.numItems = data.length / itemSize;\n\t\t}\n\n\t\tif (attr !== undefined) {\n\t\t\tgl.enableVertexAttribArray(attr);\n\t\t\tgl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\tstatic getWebglContext(canvas, userContextAttributes) {\n\t\tconst webglIdentifiers = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n\t\tlet context = null;\n\t\tconst contextAttributes = Object.assign({\n\t\t\tpreserveDrawingBuffer: false,\n\t\t\tantialias: false,\n\t\t\txrCompatible: true\n\t\t}, userContextAttributes);\n\n\t\tfunction onWebglcontextcreationerror(e) {\n\t\t\treturn e.statusMessage;\n\t\t}\n\n\t\tcanvas.addEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\tfor (let i = 0; i < webglIdentifiers.length; i++) {\n\t\t\ttry {\n\t\t\t\tcontext = canvas.getContext(webglIdentifiers[i], contextAttributes);\n\t\t\t} catch (t) {}\n\t\t\tif (context) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcanvas.removeEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\treturn context;\n\t}\n\n\tstatic createTexture(gl, textureTarget) {\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture(textureTarget, texture);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(textureTarget, null);\n\n\t\treturn texture;\n\t}\n\n\t/**\n\t * Returns the webgl availability of the current browser.\n\t * @method WebGLUtils#isWebGLAvailable\n\t * @retuen {Boolean} isWebGLAvailable\n\t */\n\tstatic isWebGLAvailable() {\n\t\tif (webglAvailability === null) {\n\t\t\tconst canvas = document.createElement(\"canvas\");\n\t\t\tconst webglContext = WebGLUtils.getWebglContext(canvas);\n\n\t\t\twebglAvailability = !!webglContext;\n\n\t\t\t// webglContext Resource forced collection\n\t\t\tif (webglContext) {\n\t\t\t\tconst loseContextExtension = webglContext.getExtension(\"WEBGL_lose_context\");\n\n\t\t\t\tloseContextExtension && loseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t\treturn webglAvailability;\n\t}\n\n\t/**\n\t * Returns whether webgl is stable in the current browser.\n\t * @method WebGLUtils#isStableWebGL\n\t * @retuen {Boolean} isStableWebGL\n\t */\n\tstatic isStableWebGL() {\n\t\tconst agentInfo = agent();\n\t\tlet isStableWebgl = true;\n\n\t\tif (agentInfo.os.name === \"android\") {\n\t\t\tconst version = parseFloat(agentInfo.os.version);\n\n\t\t\tif (version <= 4.3) {\n\t\t\t\tisStableWebgl = false;\n\t\t\t} else if (version === 4.4) {\n\t\t\t\tif (agentInfo.browser.name !== \"chrome\") {\n\t\t\t\t\tisStableWebgl = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isStableWebgl;\n\t}\n\n\tstatic getErrorNameFromWebGLErrorCode(code) {\n\t\tif (!(code in WEBGL_ERROR_CODE)) {\n\t\t\treturn \"UNKNOWN_ERROR\";\n\t\t}\n\n\t\treturn WEBGL_ERROR_CODE[code];\n\t}\n\n\n\t/**\n\t * This function is wrapper for texImage2D to handle exceptions on texImage2D.\n\t * Purpose is to prevent service from being stopped by script error.\n\t *\n\t * @param {*} gl\n\t * @param {*} target\n\t * @param {*} pixels\n\t */\n\tstatic texImage2D(gl, target, pixels) {\n\t\ttry {\n\t\t\tgl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\t\t} catch (error) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.error(\"WebGLUtils.texImage2D error:\", error);\n\t\t\t/* eslint-enable no-console */\n\t\t}\n\t}\n\n\tstatic getMaxTextureSize(gl) {\n\t\t// WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test\n\t\treturn MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\t}\n}\n\n/**\n * This function should not be used in service code. It's provided only for test purpose.\n * It should be set to null or 0 when test is done.\n *\n * @param {Number} size\n */\nfunction setMaxTextureSizeForTestOnlyPurpose(size) {\n\tMAX_TEXTURE_SIZE_FOR_TEST = size;\n}\n\nexport {\n\tsetMaxTextureSizeForTestOnlyPurpose\n};\n","import Component from \"@egjs/component\";\nimport Agent from \"@egjs/agent\";\n\nconst agent = Agent();\nconst isIE11 = agent.browser.name === \"ie\" && agent.browser.majorVersion === 11;\n\nconst EVENTS = {\n\tERROR: \"error\"\n};\n\n/**\n *\n * Extends Component for firing errors occurs internally.\n */\nclass Renderer extends Component {\n\tstatic EVENTS = EVENTS;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._forceDimension = null;\n\t\tthis._pixelCanvas = null;\n\t\tthis._pixelContext = null;\n\t}\n\n\trender({gl, shaderProgram, indexBuffer, mvMatrix, pMatrix}) {\n\t\tgl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n\t\tgl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n\n\t\tif (indexBuffer) {\n\t\t\tgl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n\t\t}\n\t}\n\n\t// Define interface for Renderers\n\t/**\n\t * Following MUST BE DEFINED on Child of Renderer\n\t *\n\t * DATA\n\t *\n\t * - getVertexPositionData\n\t * - getIndexData\n\t * - getTextureCoordData\n\t *\n\t * SOURCE\n\t *\n\t * - getVertexShaderSource\n\t * - getFragmentShaderSource\n\t *\n\t * TEXTURE\n\t *\n\t * - bindTexture\n\t */\n\tgetDimension(pixelSource) {\n\t\tconst width = pixelSource.naturalWidth || pixelSource.videoWidth;\n\t\tconst height = pixelSource.naturalHeight || pixelSource.videoHeight;\n\n\t\treturn {width, height};\n\t}\n\n\t/**\n\t * Update data used by shader\n\t * \t-\n\t *\n\t *\n\t * @param {*} param\n\t */\n\tupdateShaderData(param) {\n\t\t/*\n\t\t* Update following data in implementation layer.\n\t\t* If the data is not changed, it does not need to implement this function.\n\t\t*\n\t\t* - _VERTEX_POSITION_DATA\n\t\t* - _TEXTURE_COORD_DATA\n\t\t* - _INDEX_DATA\n\t\t*/\n\t}\n\n\t/**\n\t *\n\t * @param {HTMLImageElement | HTMLVideoElement} image\n\t * @param {Object = {width, height}} forceDimension Forced dimension to resize\n\t */\n\t_initPixelSource(image, forceDimension) {\n\t\tconst isIE11Video = isIE11 && (image instanceof HTMLVideoElement);\n\n\t\tif (isIE11Video || forceDimension) {\n\t\t\tconst {width, height} = forceDimension || this.getDimension(image);\n\n\t\t\tthis._pixelCanvas = document.createElement(\"canvas\");\n\t\t\tthis._pixelCanvas.width = width;\n\t\t\tthis._pixelCanvas.height = height;\n\t\t\tthis._pixelContext = this._pixelCanvas.getContext(\"2d\");\n\t\t}\n\t\tthis._forceDimension = forceDimension;\n\t}\n\n\t_getPixelSource(image) {\n\t\tif (!this._pixelCanvas) {\n\t\t\treturn image;\n\t\t}\n\n\t\t/**\n\t\t * IE11 && Video\n\t\t * or\n\t\t * Dimension is forced (Image is larger than texture size.)\n\t\t */\n\t\tconst contentDimension = this.getDimension(image);\n\t\tconst textureDimension = this._forceDimension || contentDimension;\n\n\t\tif (this._pixelCanvas.width !== textureDimension.width) {\n\t\t\tthis._pixelCanvas.width = textureDimension.width;\n\t\t}\n\n\t\tif (this._pixelCanvas.height !== textureDimension.height) {\n\t\t\tthis._pixelCanvas.height = textureDimension.height;\n\t\t}\n\n\t\tif (this._forceDimension) {\n\t\t\tthis._pixelContext.drawImage(image,\n\t\t\t\t0, 0, contentDimension.width, contentDimension.height,\n\t\t\t\t0, 0, textureDimension.width, textureDimension.height);\n\t\t} else {\n\t\t\tthis._pixelContext.drawImage(image, 0, 0);\n\t\t}\n\n\t\treturn this._pixelCanvas;\n\t}\n\n\t_extractTileConfig(imageConfig) {\n\t\tlet tileConfig =\n\t\t\tArray.isArray(imageConfig.tileConfig) ?\n\t\t\t\timageConfig.tileConfig : Array(...Array(6)).map(() => imageConfig.tileConfig);\n\n\t\ttileConfig = tileConfig.map(\n\t\t\tconfig => Object.assign({\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}, config)\n\t\t);\n\n\t\treturn tileConfig;\n\t}\n\n\t_triggerError(error) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.error(\"Renderer Error:\", error);\n\t\t/* eslint-enable no-console */\n\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\tmessage: typeof error === \"string\" ? error : error.message\n\t\t});\n\t}\n}\n\nexport default Renderer;\n","import Agent from \"@egjs/agent\";\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {util as mathUtil} from \"../../utils/math-util.js\";\n\nclass CubeRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = null;\n\tstatic _INDEX_DATA = null;\n\tgetVertexPositionData() {\n\t\tCubeRenderer._VERTEX_POSITION_DATA =\n\t\t\tCubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// top\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// bottom\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\n\t\treturn CubeRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\tif (CubeRenderer._INDEX_DATA) {\n\t\t\treturn CubeRenderer._INDEX_DATA;\n\t\t}\n\n\t\tconst indexData = [];\n\t\tconst vertexPositionData = this.getVertexPositionData();\n\n\t\tfor (let i = 0; i < (vertexPositionData.length / 3); i += 4) {\n\t\t\tindexData.push(\n\t\t\t\ti,\n\t\t\t\ti + 2,\n\t\t\t\ti + 1,\n\t\t\t\ti,\n\t\t\t\ti + 3,\n\t\t\t\ti + 2\n\t\t\t);\n\t\t}\n\n\t\tCubeRenderer._INDEX_DATA = indexData;\n\t\treturn indexData;\n\t}\n\n\tstatic extractOrder(imageConfig) {\n\t\treturn imageConfig.order || \"RLUDBF\";\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\tconst vertexOrder = \"BFUDRL\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst base = this.getVertexPositionData();\n\t\tconst tileConfig = this._extractTileConfig(imageConfig);\n\t\tconst elemSize = 3;\n\t\tconst vertexPerTile = 4;\n\t\tconst textureCoordData =\n\t\t\tvertexOrder.split(\"\")\n\t\t\t\t.map(face => tileConfig[order.indexOf(face)])\n\t\t\t\t.map((config, i) => {\n\t\t\t\t\tconst rotation = parseInt(config.rotation / 90, 10);\n\t\t\t\t\tconst ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2];\n\n\t\t\t\t\tfor (let r = 0; r < Math.abs(rotation); r++) {\n\t\t\t\t\t\tif ((config.flipHorizontal && rotation > 0) ||\n\t\t\t\t\t\t\t(!config.flipHorizontal && rotation < 0)) {\n\t\t\t\t\t\t\tordermap_.push(ordermap_.shift());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tordermap_.unshift(ordermap_.pop());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst elemPerTile = elemSize * vertexPerTile;\n\t\t\t\t\tconst tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile);\n\t\t\t\t\tconst tileTemp = [];\n\n\t\t\t\t\tfor (let j = 0; j < vertexPerTile; j++) {\n\t\t\t\t\t\ttileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize);\n\t\t\t\t\t}\n\t\t\t\t\treturn tileTemp;\n\t\t\t\t})\n\t\t\t\t.join()\n\t\t\t\t.split(\",\")\n\t\t\t\t.map(v => parseInt(v, 10));\n\n\t\treturn textureCoordData;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}`;\n\t}\n\n\tupdateTexture(gl, image, imageConfig) {\n\t\tconst baseOrder = \"RLUDBF\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst orderMap = {};\n\n\t\torder.split(\"\").forEach((v, i) => {\n\t\t\torderMap[v] = i;\n\t\t});\n\n\t\ttry {\n\t\t\tif (image instanceof Array) {\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image);\n\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\t\t\t\t\tconst tile = this.extractTileFromImage(\n\t\t\t\t\t\timage, tileIdx, maxCubeMapTextureSize\n\t\t\t\t\t);\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, tile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis._triggerError(e);\n\t\t}\n\t}\n\n\tbindTexture(gl, texture, image, imageConfig) {\n\t\tgl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\t\tthis.updateTexture(gl, image, imageConfig);\n\t}\n\n\tgetSourceTileSize(image) {\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst aspectRatio = width / height;\n\t\tlet inputTextureSize;\n\n\t\tif (aspectRatio === 1 / 6) {\n\t\t\tinputTextureSize = width;\n\t\t} else if (aspectRatio === 6) {\n\t\t\tinputTextureSize = height;\n\t\t} else if (aspectRatio === 2 / 3) {\n\t\t\tinputTextureSize = width / 2;\n\t\t} else {\n\t\t\tinputTextureSize = width / 3;\n\t\t}\n\t\treturn inputTextureSize;\n\t}\n\n\textractTileFromImage(image, tileIdx, outputTextureSize) {\n\t\tconst {width} = this.getDimension(image);\n\t\tconst inputTextureSize = this.getSourceTileSize(image);\n\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = outputTextureSize;\n\t\tcanvas.height = outputTextureSize;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tconst tilePerRow = width / inputTextureSize;\n\n\t\tconst x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow);\n\t\tconst y = parseInt(tileIdx / tilePerRow, 10) * (inputTextureSize);\n\n\t\tcontext.drawImage(\n\t\t\timage, x, y,\n\t\t\tinputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize\n\t\t);\n\t\treturn canvas;\n\t}\n\n\tgetMaxCubeMapTextureSize(gl, image) {\n\t\tconst agent = Agent();\n\t\tconst maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n\t\tlet _imageWidth = this.getSourceTileSize(image);\n\n\t\tif (agent.browser.name === \"ie\" && agent.browser.majorVersion === 11) {\n\t\t\tif (!mathUtil.isPowerOfTwo(_imageWidth)) {\n\t\t\t\tfor (let i = 1; i < maxCubeMapTextureSize; i *= 2) {\n\t\t\t\t\tif (i < _imageWidth) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_imageWidth = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (agent.os.name === \"ios\") {\n\t\t\tconst majorVersion = agent.os.majorVersion;\n\n\t\t\t// ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다.\n\t\t\tif (majorVersion === 9) {\n\t\t\t\t_imageWidth = 1024;\n\t\t\t}\n\t\t\t// ios 8 의 경우 텍스쳐 최대사이즈는 512 이다.\n\t\t\tif (majorVersion === 8) {\n\t\t\t\t_imageWidth = 512;\n\t\t\t}\n\t\t}\n\t\t// maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수\n\t\treturn Math.min(maxCubeMapTextureSize, _imageWidth);\n\t}\n}\n\nexport default CubeRenderer;\n","\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\n\nexport default class CubeStripRenderer extends Renderer {\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}`;\n\t}\n\n\tgetVertexPositionData() {\n\t\tif (!this._vertices) {\n\t\t\tthis._vertices = [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// up\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// down\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\t\t}\n\n\t\treturn this._vertices;\n\t}\n\n\tgetIndexData() {\n\t\t// TODO: 한번만 계산하도록 수정하기\n\t\tconst indices = (() => {\n\t\t\tconst indexData = [];\n\n\t\t\tfor (let i = 0; i < (this._vertices.length / 3); i += 4) {\n\t\t\t\tindexData.push(\n\t\t\t\t\ti,\n\t\t\t\t\ti + 1,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti + 3\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn indexData;\n\t\t})();\n\n\t\treturn indices;\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\t// TODO: make it cols, rows as config.\n\t\tconst cols = 3;\n\t\tconst rows = 2;\n\t\tconst order = imageConfig.order || \"RLUDFB\";\n\t\tlet coords = [];\n\n\t\t// 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다.\n\t\tfor (let r = rows - 1; r >= 0; r--) {\n\t\t\tfor (let c = 0; c < cols; c++) {\n\t\t\t\tconst coord = [\n\t\t\t\t\tc / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, (r + 1) / rows,\n\t\t\t\t\tc / cols, (r + 1) / rows\n\t\t\t\t];\n\n\t\t\t\tcoords.push(coord);\n\t\t\t}\n\t\t}\n\n\t\tconst tileConfigs = this._extractTileConfig(imageConfig);\n\n\t\t// Transform Coord By Flip & Rotation\n\t\tcoords = coords\n\t\t// shrink coord to avoid pixel bleeding\n\t\t\t.map(coord => this._shrinkCoord(coord))\n\t\t\t.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));\n\n\t\t// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치\n\t\treturn \"BFUDRL\".split(\"\")\n\t\t\t.map(face => order.indexOf(face))\n\t\t\t.map(index => coords[index])\n\t\t\t.reduce((acc, val) => acc.concat(val), []);\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\t_transformCoord(coord, tileConfig) {\n\t\tlet newCoord = coord.slice();\n\n\t\tif (tileConfig.flipHorizontal) {\n\t\t\tnewCoord = this._flipHorizontalCoord(newCoord);\n\t\t}\n\n\t\tif (tileConfig.rotation) {\n\t\t\tnewCoord = this._rotateCoord(newCoord, tileConfig.rotation);\n\t\t}\n\n\t\treturn newCoord;\n\t}\n\n\t_shrinkCoord(coord) {\n\t\tconst SHRINK_Y = 0.00;\n\t\tconst SHRINK_X = 0.00;\n\n\t\treturn [\n\t\t\tcoord[0] + SHRINK_X, coord[1] + SHRINK_Y,\n\t\t\tcoord[2] - SHRINK_X, coord[3] + SHRINK_Y,\n\t\t\tcoord[4] - SHRINK_X, coord[5] - SHRINK_Y,\n\t\t\tcoord[6] + SHRINK_X, coord[7] - SHRINK_Y\n\t\t];\n\t}\n\n\t_rotateCoord(coord, rotationAngle) {\n\t\tconst SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord.\n\t\tconst shiftCount = parseInt(rotationAngle / 90, 10) % 4;\n\n\t\tif (shiftCount === 0) {\n\t\t\treturn coord;\n\t\t}\n\n\t\tlet moved;\n\t\tlet rotatedCoord = [];\n\n\t\tif (shiftCount > 0) {\n\t\t\tmoved = coord.splice(0, shiftCount * SIZE);\n\t\t\trotatedCoord = coord.concat(moved);\n\t\t} else {\n\t\t\tmoved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE);\n\t\t\trotatedCoord = moved.concat(coord);\n\t\t}\n\n\t\treturn rotatedCoord;\n\t}\n\n\t_flipHorizontalCoord(coord) {\n\t\treturn [\n\t\t\tcoord[2], coord[3],\n\t\t\tcoord[0], coord[1],\n\t\t\tcoord[6], coord[7],\n\t\t\tcoord[4], coord[5]\n\t\t];\n\t}\n}\n","/**\n * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide})\n * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고)\n * @namespace\n * @name GYRO_MODE\n * @memberof eg.view360.PanoViewer\n */\n/**\n * Disable gyro\n * @ko gyro 비활성화\n * @name NONE\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"none\"\n */\n/**\n * YawPitch Mode\n * @ko YawPitch Mode\n * @name YAWPITCH\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"yawPitch\"\n */\n/**\n * VR Mode\n * @ko VR Mode\n * @name VR\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"VR\"\n */\nimport {GYRO_MODE} from \"../YawPitchControl/consts\";\n\n/**\n * Constant value for errors\n * @ko 에러에 대한 상수 값\n * @namespace\n * @name ERROR_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst ERROR_TYPE = {\n\t/**\n\t * Unsupported device\n\t * @ko 미지원 기기\n\t * @name INVALID_DEVICE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 10\n\t */\n\tINVALID_DEVICE: 10,\n\t/**\n\t * Webgl not support\n\t * @ko WEBGL 미지원\n\t * @name NO_WEBGL\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 11\n\t */\n\tNO_WEBGL: 11,\n\t/**\n\t * Failed to load image\n\t * @ko 이미지 로드 실패\n\t * @name FAIL_IMAGE_LOAD\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 12\n\t */\n\tFAIL_IMAGE_LOAD: 12,\n\t/**\n\t * Failed to bind texture\n\t * @ko 텍스쳐 바인딩 실패\n\t * @name FAIL_BIND_TEXTURE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 13\n\t */\n\tFAIL_BIND_TEXTURE: 13,\n\t/**\n\t * Only one resource(image or video) should be specified\n\t * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t * @name INVALID_RESOURCE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 14\n\t */\n\tINVALID_RESOURCE: 14,\n\t/**\n\t * WebGL context lost occurred\n\t * @ko WebGL context lost 발생\n\t * @name RENDERING_CONTEXT_LOST\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 15\n\t */\n\tRENDERING_CONTEXT_LOST: 15,\n};\n\n/**\n * Constant value for events\n * @ko 이벤트에 대한 상수 값\n * @namespace\n * @name EVENTS\n * @memberof eg.view360.PanoViewer\n */\nconst EVENTS = {\n\t/**\n\t * Events that is fired when PanoViewer is ready to show image and handle user interaction.\n\t * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트\n\t * @name READY\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default ready\n\t */\n\tREADY: \"ready\",\n\t/**\n\t * Events that is fired when direction or fov is changed.\n\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t * @name VIEW_CHANGE\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default viewChange\n\t */\n\tVIEW_CHANGE: \"viewChange\",\n\t/**\n\t * Events that is fired when animation which is triggered by inertia is ended.\n\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t * @name ANIMATION_END\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default animationEnd\n\t */\n\tANIMATION_END: \"animationEnd\",\n\t/**\n\t * Events that is fired when error occurs\n\t * @ko 에러 발생 시 발생하는 이벤트\n\t * @name ERROR\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default error\n\t */\n\tERROR: \"error\"\n};\n\n/**\n * Constant value for projection type\n * @ko 프로젝션 타입 대한 상수 값\n * @namespace\n * @name PROJECTION_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst PROJECTION_TYPE = {\n\t/**\n\t * Constant value for equirectangular type.\n\t * @ko equirectangular 에 대한 상수 값.\n\t * @name EQUIRECTANGULAR\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default equirectangular\n\t */\n\tEQUIRECTANGULAR: \"equirectangular\",\n\t/**\n\t * Constant value for cubemap type.\n\t * @ko cubemap 에 대한 상수 값.\n\t * @name CUBEMAP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubemap\n\t */\n\tCUBEMAP: \"cubemap\",\n\t/**\n\t * Constant value for cubestrip type.\n\t * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC.\n\t *\n\t * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다.\n\t * @name CUBESTRIP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubestrip\n\t */\n\tCUBESTRIP: \"cubestrip\",\n\t/**\n\t * Constant value for PANORAMA type.\n\t *\n\t * PANORAMA is a format for a panorma image which is taken from smartphone.\n\t *\n\t * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다.\n\t *\n\t * @name PANORAMA\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default panorama\n\t */\n\tPANORAMA: \"panorama\",\n\t/**\n\t * Constant value for EQUI_STEREOSCOPY type.\n\t *\n\t * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present.\n\t *\n\t * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다.\n\t *\n\t * @name STEREOSCOPIC_EQUI\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default stereoequi\n\t */\n\tSTEREOSCOPIC_EQUI: \"stereoequi\",\n};\n\n/**\n * A constant value for the format of the stereoscopic equirectangular projection type.\n * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값\n * @namespace\n * @name STEREO_FORMAT\n * @memberof eg.view360.PanoViewer\n */\nconst STEREO_FORMAT = {\n\t/**\n\t * A constant value for format of top bottom stereoscopic 360 equirectangular projection.\n\t * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name TOP_BOTTOM\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dv\"\n\t */\n\tTOP_BOTTOM: \"3dv\",\n\t/**\n\t * A constant value for format of left right stereoscopic 360 equirectangular projection.\n\t * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name LEFT_RIGHT\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dh\"\n\t */\n\tLEFT_RIGHT: \"3dh\",\n\t/**\n\t * A constant value specifying media is not in stereoscopic format.\n\t * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값.\n\t * @name NONE\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"\"\n\t */\n\tNONE: \"\",\n};\n\nexport {\n\tGYRO_MODE,\n\tEVENTS,\n\tERROR_TYPE,\n\tPROJECTION_TYPE,\n\tSTEREO_FORMAT\n};\n","import Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {STEREO_FORMAT} from \"../../PanoViewer/consts\";\n\nconst latitudeBands = 60;\nconst longitudeBands = 60;\nconst radius = 2;\nconst ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\nlet latIdx;\nlet lngIdx;\n\nfor (latIdx = 0; latIdx <= latitudeBands; latIdx++) {\n\tconst theta = (latIdx / latitudeBands - 0.5) * Math.PI;\n\tconst sinTheta = Math.sin(theta);\n\tconst cosTheta = Math.cos(theta);\n\n\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\tconst phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN;\n\t\tconst sinPhi = Math.sin(phi);\n\t\tconst cosPhi = Math.cos(phi);\n\t\tconst x = cosPhi * cosTheta;\n\t\tconst y = sinTheta;\n\t\tconst z = sinPhi * cosTheta;\n\t\tconst u = lngIdx / longitudeBands;\n\t\tconst v = latIdx / latitudeBands;\n\n\t\ttextureCoordData.push(u, v);\n\t\tvertexPositionData.push(radius * x, radius * y, radius * z);\n\n\t\tif (lngIdx !== longitudeBands && latIdx !== latitudeBands) {\n\t\t\tconst a = latIdx * (longitudeBands + 1) + lngIdx;\n\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t}\n\t}\n}\n\nclass SphereRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tconstructor(format) {\n\t\tsuper();\n\n\t\tthis._stereoFormat = format;\n\t}\n\n\trender(ctx) {\n\t\tconst {gl, shaderProgram} = ctx;\n\n\t\tlet leftEyeScaleOffset;\n\t\tlet rightEyeScaleOffset;\n\n\t\tswitch (this._stereoFormat) {\n\t\t\tcase STEREO_FORMAT.TOP_BOTTOM:\n\t\t\t\tleftEyeScaleOffset = [1, 0.5, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 0.5, 0, 0.5];\n\t\t\t\tbreak;\n\t\t\tcase STEREO_FORMAT.LEFT_RIGHT:\n\t\t\t\tleftEyeScaleOffset = [0.5, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [0.5, 1, 0.5, 0];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tleftEyeScaleOffset = [1, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 1, 0, 0];\n\t\t}\n\n\t\tconst uTexScaleOffset = gl.getUniformLocation(shaderProgram, \"uTexScaleOffset\");\n\n\t\tgl.uniform4fv(uTexScaleOffset, [...leftEyeScaleOffset, ...rightEyeScaleOffset]);\n\n\t\tsuper.render(ctx);\n\t}\n\n\tgetVertexPositionData() {\n\t\treturn SphereRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn SphereRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn SphereRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n}\n\nexport default SphereRenderer;\n","import {glMatrix} from \"gl-matrix\";\nimport Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\n\n// const latitudeBands = 60;\nconst MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6;\nconst longitudeBands = 60;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\n\nclass CylinderRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tgetVertexPositionData() {\n\t\treturn CylinderRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn CylinderRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn CylinderRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\t\tlet resizeDimension;\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device texture limit(${maxSize}))`);\n\n\t\t\t// Request resizing texture.\n\t\t\t/**\n\t\t\t * TODO: Is it need to apply on another projection type?\n\t\t\t */\n\t\t\tresizeDimension = width > height ?\n\t\t\t\t{width: maxSize, height: maxSize * height / width} :\n\t\t\t\t{width: maxSize * width / height, height: maxSize};\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video or resizing needed\n\t\tthis._initPixelSource(image, resizeDimension);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\tupdateShaderData({imageAspectRatio = MIN_ASPECT_RATIO_FOR_FULL_PANORAMA}) {\n\t\tlet lngIdx;\n\t\tlet cylinderMaxRadian;\n\t\tlet halfCylinderY;\n\t\tlet rotated;\n\t\tlet aspectRatio;\n\n\t\t// Exception case: orientation is rotated.\n\t\tif (imageAspectRatio < 1) {\n\t\t\t/**\n\t\t\t * If rotated is true, we assume that image is rotated counter clockwise.\n\t\t\t * TODO: If there's other rotation, it is need to implement by each rotation.\n\t\t\t */\n\t\t\trotated = true;\n\t\t\taspectRatio = 1 / imageAspectRatio;\n\t\t} else {\n\t\t\trotated = false;\n\t\t\taspectRatio = imageAspectRatio;\n\t\t}\n\n\t\tif (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) {\n\t\t\tconst fov = 360 / aspectRatio;\n\n\t\t\tcylinderMaxRadian = 2 * Math.PI; // 360 deg\n\t\t\thalfCylinderY = Math.tan(glMatrix.toRadian(fov / 2));\n\t\t} else {\n\t\t\tcylinderMaxRadian = aspectRatio;\n\t\t\thalfCylinderY = 0.5;// Range of cylinder is [-0.5, 0.5] to make height to 1.\n\t\t}\n\n\t\t// intialize shader data before update\n\t\ttextureCoordData.length = 0;\n\t\tvertexPositionData.length = 0;\n\t\tindexData.length = 0;\n\n\t\tconst CYLIDER_Y = [-halfCylinderY, halfCylinderY];\n\t\tconst startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360)\n\n\t\t// console.log(\"cylinderMaxRadian:\", glMatrix.toDegree(cylinderMaxRadian), \"CYLIDER_Y\", CYLIDER_Y, \"start angle\", glMatrix.toDegree(startAngleForCenterAlign));\n\t\tfor (let yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength/* bottom & top */; yIdx++) {\n\t\t\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\t\t\tconst angle = startAngleForCenterAlign + (lngIdx / longitudeBands * cylinderMaxRadian);\n\t\t\t\tconst x = Math.cos(angle);\n\t\t\t\tconst y = CYLIDER_Y[yIdx];\n\t\t\t\tconst z = Math.sin(angle);\n\t\t\t\tlet u;\n\t\t\t\tlet v;\n\n\t\t\t\tif (rotated) {\n\t\t\t\t\t// Rotated 90 degree (counter clock wise)\n\t\t\t\t\tu = 1 - yIdx; // yLength - yIdx;\n\t\t\t\t\tv = lngIdx / longitudeBands;\n\t\t\t\t} else {\n\t\t\t\t// \t// Normal case (Not rotated)\n\t\t\t\t\tu = lngIdx / longitudeBands;\n\t\t\t\t\tv = yIdx;\n\t\t\t\t}\n\n\t\t\t\ttextureCoordData.push(u, v);\n\t\t\t\tvertexPositionData.push(x, y, z);\n\n\t\t\t\tif (yIdx === 0 && lngIdx < longitudeBands) {\n\t\t\t\t\tconst a = lngIdx;\n\t\t\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default CylinderRenderer;\n","import {mat4} from \"gl-matrix\";\n\nconst VR_DISPLAY_PRESENT_CHANGE = \"vrdisplaypresentchange\";\nconst DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1];\nconst DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1];\nconst EYES = {\n\tLEFT: \"left\",\n\tRIGHT: \"right\"\n};\n\nclass VRManager {\n\tget context() { return this._vrDisplay; }\n\n\tconstructor() {\n\t\tthis._frameData = new window.VRFrameData();\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst vrDisplay = this._vrDisplay;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (vrDisplay && vrDisplay.isPresenting) {\n\t\t\tvrDisplay.exitPresent();\n\t\t}\n\n\t\tthis._clear();\n\t}\n\n\tcanRender() {\n\t\treturn Boolean(this._vrDisplay);\n\t}\n\n\tbeforeRender(gl) {\n\t\t// Render to the default backbuffer\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t}\n\n\tafterRender() {\n\t\tthis._vrDisplay.submitFrame();\n\t}\n\n\tgetEyeParams(gl) {\n\t\tconst display = this._vrDisplay;\n\t\tconst halfWidth = gl.drawingBufferWidth * 0.5;\n\t\tconst height = gl.drawingBufferHeight;\n\t\tconst frameData = this._frameData;\n\n\t\tdisplay.getFrameData(frameData);\n\n\t\tconst leftMVMatrix = frameData.leftViewMatrix;\n\t\tconst rightMVMatrix = frameData.rightViewMatrix;\n\n\t\tmat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset);\n\t\tmat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tviewport: [0, 0, halfWidth, height],\n\t\t\t\tmvMatrix: leftMVMatrix,\n\t\t\t\tpMatrix: frameData.leftProjectionMatrix,\n\t\t\t},\n\t\t\t{\n\t\t\t\tviewport: [halfWidth, 0, halfWidth, height],\n\t\t\t\tmvMatrix: rightMVMatrix,\n\t\t\t\tpMatrix: frameData.rightProjectionMatrix,\n\t\t\t}\n\t\t];\n\t}\n\n\tisPresenting() {\n\t\treturn Boolean(this._vrDisplay && this._vrDisplay.isPresenting);\n\t}\n\n\taddEndCallback(callback) {\n\t\twindow.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\twindow.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\trequestPresent(canvas) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tnavigator.getVRDisplays().then(displays => {\n\t\t\t\tconst vrDisplay = displays.length && displays[0];\n\n\t\t\t\tif (!vrDisplay) {\n\t\t\t\t\treject(new Error(\"No displays available.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!vrDisplay.capabilities.canPresent) {\n\t\t\t\t\treject(new Error(\"Display lacking capability to present.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvrDisplay.requestPresent([{source: canvas}]).then(() => {\n\t\t\t\t\tconst leftEye = vrDisplay.getEyeParameters(EYES.LEFT);\n\t\t\t\t\tconst rightEye = vrDisplay.getEyeParameters(EYES.RIGHT);\n\n\t\t\t\t\tcanvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;\n\t\t\t\t\tcanvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);\n\n\t\t\t\t\tthis._setDisplay(vrDisplay);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setDisplay(vrDisplay) {\n\t\tthis._vrDisplay = vrDisplay;\n\n\t\tconst layers = vrDisplay.getLayers();\n\n\t\tif (layers.length) {\n\t\t\tconst layer = layers[0];\n\n\t\t\tthis._leftBounds = layer.leftBounds;\n\t\t\tthis._rightBounds = layer.rightBounds;\n\t\t}\n\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._vrDisplay = null;\n\t\tthis._leftBounds = DEFAULT_LEFT_BOUNDS;\n\t\tthis._rightBounds = DEFAULT_RIGHT_BOUNDS;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default VRManager;\n","import {mat4, glMatrix} from \"gl-matrix\";\nimport {IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\n\nconst XR_REFERENCE_SPACE = \"local\";\n\nclass XRManager {\n\tget context() { return this._xrSession; }\n\n\tconstructor() {\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst xrSession = this._xrSession;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (xrSession) {\n\t\t\t// Capture to avoid errors\n\t\t\txrSession.end().then(() => {}, () => {});\n\t\t}\n\t\tthis._clear();\n\t}\n\n\tcanRender(frame) {\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\treturn Boolean(pose);\n\t}\n\n\tbeforeRender(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst baseLayer = session.renderState.baseLayer;\n\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer);\n\t}\n\n\tafterRender() {}\n\n\tgetEyeParams(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\tif (!pose) {\n\t\t\t// Can't render\n\t\t\treturn null;\n\t\t}\n\n\t\tconst glLayer = session.renderState.baseLayer;\n\n\t\treturn pose.views.map(view => {\n\t\t\tconst viewport = glLayer.getViewport(view);\n\t\t\tconst mvMatrix = view.transform.inverse.matrix;\n\n\t\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\t\tmat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180));\n\t\t\t}\n\n\t\t\tmat4.rotateY(mvMatrix, mvMatrix, this._yawOffset);\n\n\t\t\treturn {\n\t\t\t\tviewport: [viewport.x, viewport.y, viewport.width, viewport.height],\n\t\t\t\tmvMatrix,\n\t\t\t\tpMatrix: view.projectionMatrix\n\t\t\t};\n\t\t});\n\t}\n\n\tisPresenting() {\n\t\treturn this._presenting;\n\t}\n\n\taddEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.addEventListener(\"end\", callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.removeEventListener(\"end\", callback);\n\t}\n\n\trequestPresent(canvas, gl) {\n\t\treturn navigator.xr.requestSession(\"immersive-vr\", {\n\t\t\trequiredFeatures: [XR_REFERENCE_SPACE],\n\t\t}).then(session => {\n\t\t\tconst xrLayer = new window.XRWebGLLayer(session, gl);\n\n\t\t\tsession.updateRenderState({baseLayer: xrLayer});\n\t\t\treturn session.requestReferenceSpace(XR_REFERENCE_SPACE)\n\t\t\t\t.then(refSpace => {\n\t\t\t\t\tthis._setSession(session, xrLayer, refSpace);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setSession(session, xrLayer, refSpace) {\n\t\tthis._xrSession = session;\n\t\tthis._xrLayer = xrLayer;\n\t\tthis._xrRefSpace = refSpace;\n\t\tthis._presenting = true;\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._xrSession = null;\n\t\tthis._xrLayer = null;\n\t\tthis._xrRefSpace = null;\n\t\tthis._presenting = false;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default XRManager;\n","import {IS_SAFARI_ON_DESKTOP} from \"../utils/browser\";\n\nclass WebGLAnimator {\n\tconstructor() {\n\t\tthis._callback = null;\n\t\tthis._context = window;\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\tsetCallback(callback) {\n\t\tthis._callback = callback;\n\t}\n\n\tsetContext(context) {\n\t\tthis._context = context;\n\t}\n\n\tstart() {\n\t\tconst context = this._context;\n\t\tconst callback = this._callback;\n\n\t\t// No context / callback set\n\t\tif (!context || !callback) return;\n\t\t// Animation already started\n\t\tif (this._rafId >= 0 || this._rafTimer >= 0) return;\n\n\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoopNextTick);\n\t\t} else {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoop);\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this._rafId >= 0) {\n\t\t\tthis._context.cancelAnimationFrame(this._rafId);\n\t\t}\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t}\n\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\t/**\n\t * There can be more than 1 argument when we use XRSession's raf\n\t */\n\t_onLoop = (...args) => {\n\t\tthis._callback(...args);\n\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t}\n\n\t/**\n\t * MacOS X Safari Bug Fix\n\t * This code guarantees that rendering should be occurred.\n\t *\n\t * In MacOS X(10.14.2), Safari (12.0.2)\n\t * The requestAnimationFrame(RAF) callback is called just after previous RAF callback without term\n\t * only if requestAnimationFrame is called for next frame while updating frame is delayed (~over 2ms)\n\t * So browser cannot render the frame and may be freezing.\n\t */\n\t_onLoopNextTick = (...args) => {\n\t\tconst before = performance.now();\n\n\t\tthis._callback(...args);\n\n\t\tconst diff = performance.now() - before;\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t\tthis._rafTimer = -1;\n\t\t}\n\n\t\t/** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */\n\t\tif (diff < 16) {\n\t\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t\t} else {\n\t\t\t/** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/\n\t\t\tthis._rafTimer = setTimeout(this._onLoop, 0);\n\t\t}\n\t}\n}\n\nexport default WebGLAnimator;\n","import Component from \"@egjs/component\";\nimport {glMatrix, vec3, mat3, mat4, quat} from \"gl-matrix\";\nimport ImageLoader from \"./ImageLoader\";\nimport VideoLoader from \"./VideoLoader\";\nimport WebGLUtils from \"./WebGLUtils\";\nimport Renderer from \"./renderer/Renderer\";\nimport CubeRenderer from \"./renderer/CubeRenderer\";\nimport CubeStripRenderer from \"./renderer/CubeStripRenderer\";\nimport SphereRenderer from \"./renderer/SphereRenderer\";\nimport CylinderRenderer from \"./renderer/CylinderRenderer\";\nimport VRManager from \"./vr/VRManager\";\nimport XRManager from \"./vr/XRManager\";\nimport WebGLAnimator from \"./WebGLAnimator\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {devicePixelRatio, WEBXR_SUPPORTED} from \"../utils/browserFeature\";\nimport {PROJECTION_TYPE, STEREO_FORMAT} from \"../PanoViewer/consts\";\nimport {IS_IOS} from \"../utils/browser\";\n\nconst ImageType = PROJECTION_TYPE;\n\nlet DEVICE_PIXEL_RATIO = devicePixelRatio || 1;\n\n// DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다.\nif (DEVICE_PIXEL_RATIO > 2) {\n\tDEVICE_PIXEL_RATIO = 2;\n}\n\n// define custom events name\n/**\n * TODO: how to manage events/errortype with PanoViewer\n *\n * I think renderer events should be seperated from viewer events although it has same name.\n */\nconst EVENTS = {\n\tBIND_TEXTURE: \"bindTexture\",\n\tIMAGE_LOADED: \"imageLoaded\",\n\tERROR: \"error\",\n\tRENDERING_CONTEXT_LOST: \"renderingContextLost\",\n\tRENDERING_CONTEXT_RESTORE: \"renderingContextRestore\",\n};\n\nconst ERROR_TYPE = {\n\tINVALID_DEVICE: 10,\n\tNO_WEBGL: 11,\n\tFAIL_IMAGE_LOAD: 12,\n\tRENDERER_ERROR: 13\n};\n\nclass PanoImageRenderer extends Component {\n\tstatic EVENTS = EVENTS;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\n\tconstructor(\n\t\timage, width, height, isVideo, sphericalConfig, renderingContextAttributes\n\t) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis.sphericalConfig = sphericalConfig;\n\t\tthis.fieldOfView = sphericalConfig.fieldOfView;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tthis._lastQuaternion = null;\n\t\tthis._lastYaw = null;\n\t\tthis._lastPitch = null;\n\t\tthis._lastFieldOfView = null;\n\n\t\tthis.pMatrix = mat4.create();\n\t\tthis.mvMatrix = mat4.create();\n\n\t\t// initialzie pMatrix\n\t\tmat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), width / height, 0.1, 100);\n\n\t\tthis.textureCoordBuffer = null;\n\t\tthis.vertexBuffer = null;\n\t\tthis.indexBuffer = null;\n\n\t\tthis.canvas = this._initCanvas(width, height);\n\t\tthis._setDefaultCanvasStyle();\n\t\tthis._wrapper = null; // canvas wrapper\n\t\tthis._wrapperOrigStyle = null;\n\n\t\tthis._renderingContextAttributes = renderingContextAttributes;\n\t\tthis._image = null;\n\t\tthis._imageConfig = null;\n\t\tthis._imageIsReady = false;\n\t\tthis._shouldForceDraw = false;\n\t\tthis._keepUpdate = false; // Flag to specify 'continuous update' on video even when still.\n\n\t\tthis._onContentLoad = this._onContentLoad.bind(this);\n\t\tthis._onContentError = \tthis._onContentError.bind(this);\n\n\t\tthis._animator = new WebGLAnimator();\n\n\t\t// VR/XR manager\n\t\tthis._vr = null;\n\n\t\tif (image) {\n\t\t\tthis.setImage({\n\t\t\t\timage,\n\t\t\t\timageType: sphericalConfig.imageType,\n\t\t\t\tisVideo,\n\t\t\t\tcubemapConfig: sphericalConfig.cubemapConfig\n\t\t\t});\n\t\t}\n\t}\n\n\t// FIXME: Please refactor me to have more loose connection to yawpitchcontrol\n\tsetYawPitchControl(yawPitchControl) {\n\t\tthis._yawPitchControl = yawPitchControl;\n\t}\n\n\tgetContent() {\n\t\treturn this._image;\n\t}\n\n\tsetImage({image, imageType, isVideo = false, cubemapConfig}) {\n\t\tthis._imageIsReady = false;\n\t\tthis._isVideo = isVideo;\n\t\tthis._imageConfig = Object.assign(\n\t\t\t{\n\t\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only */\n\t\t\t\torder: (imageType === ImageType.CUBEMAP) ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\t\ttileConfig: {\n\t\t\t\t\tflipHorizontal: false,\n\t\t\t\t\trotation: 0\n\t\t\t\t}\n\t\t\t},\n\t\t\tcubemapConfig\n\t\t);\n\t\tthis._setImageType(imageType);\n\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tif (isVideo) {\n\t\t\tthis._contentLoader = new VideoLoader();\n\t\t\tthis._keepUpdate = true;\n\t\t} else {\n\t\t\tthis._contentLoader = new ImageLoader();\n\t\t\tthis._keepUpdate = false;\n\t\t}\n\n\t\t// img element or img url\n\t\tthis._contentLoader.set(image);\n\n\t\t// 이미지의 사이즈를 캐시한다.\n\t\t// image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed.\n\t\tthis._image = this._contentLoader.getElement();\n\n\t\treturn this._contentLoader.get()\n\t\t\t.then(this._onContentLoad, this._onContentError)\n\t\t\t.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.\n\t}\n\n\t_setImageType(imageType) {\n\t\tif (!imageType || this._imageType === imageType) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._imageType = imageType;\n\t\tthis._isCubeMap = imageType === ImageType.CUBEMAP;\n\n\t\tif (this._renderer) {\n\t\t\tthis._renderer.off();\n\t\t}\n\n\t\tswitch (imageType) {\n\t\t\tcase ImageType.CUBEMAP:\n\t\t\t\tthis._renderer = new CubeRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.CUBESTRIP:\n\t\t\t\tthis._renderer = new CubeStripRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.PANORAMA:\n\t\t\t\tthis._renderer = new CylinderRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.STEREOSCOPIC_EQUI:\n\t\t\t\tthis._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis._renderer = new SphereRenderer(STEREO_FORMAT.NONE);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis._renderer.on(Renderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERER_ERROR,\n\t\t\t\tmessage: e.message\n\t\t\t});\n\t\t});\n\n\t\tthis._initWebGL();\n\t}\n\n\t_initCanvas(width, height) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\n\t\tthis._onWebglcontextlost = this._onWebglcontextlost.bind(this);\n\t\tthis._onWebglcontextrestored = this._onWebglcontextrestored.bind(this);\n\n\t\tcanvas.addEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tcanvas.addEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\n\t\treturn canvas;\n\t}\n\n\t_setDefaultCanvasStyle() {\n\t\tconst canvas = this.canvas;\n\n\t\tcanvas.style.bottom = 0;\n\t\tcanvas.style.left = 0;\n\t\tcanvas.style.right = 0;\n\t\tcanvas.style.top = 0;\n\t\tcanvas.style.margin = \"auto\";\n\t\tcanvas.style.maxHeight = \"100%\";\n\t\tcanvas.style.maxWidth = \"100%\";\n\t\tcanvas.style.outline = \"none\";\n\t\tcanvas.style.position = \"absolute\";\n\t}\n\n\t_onContentError(error) {\n\t\tthis._imageIsReady = false;\n\t\tthis._image = null;\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\ttype: ERROR_TYPE.FAIL_IMAGE_LOAD,\n\t\t\tmessage: \"failed to load image\"\n\t\t});\n\n\t\treturn false;\n\t}\n\n\t_triggerContentLoad() {\n\t\tthis.trigger(EVENTS.IMAGE_LOADED, {\n\t\t\tcontent: this._image,\n\t\t\tisVideo: this._isVideo,\n\t\t\tprojectionType: this._imageType\n\t\t});\n\t}\n\t_onContentLoad(image) {\n\t\tthis._imageIsReady = true;\n\n\t\tthis._triggerContentLoad();\n\t\treturn true;\n\t}\n\n\tisImageLoaded() {\n\t\treturn !!this._image && this._imageIsReady &&\n\t\t\t(!this._isVideo || this._image.readyState >= 2 /* HAVE_CURRENT_DATA */);\n\t}\n\n\tbindTexture() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._contentLoader) {\n\t\t\t\trej(\"ImageLoader is not initialized\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._contentLoader.get()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis._bindTexture();\n\t\t\t\t}, rej)\n\t\t\t\t.then(res);\n\t\t});\n\t}\n\n\t// 부모 엘리먼트에 canvas 를 붙임\n\tattachTo(parentElement) {\n\t\tthis.detach();\n\t\tparentElement.appendChild(this.canvas);\n\t\tthis._wrapper = parentElement;\n\t}\n\n\tforceContextLoss() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\tconst loseContextExtension = this.context.getExtension(\"WEBGL_lose_context\");\n\n\t\t\tif (loseContextExtension) {\n\t\t\t\tloseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t}\n\n\t// 부모 엘리먼트에서 canvas 를 제거\n\tdetach() {\n\t\tif (this.canvas.parentElement) {\n\t\t\tthis.canvas.parentElement.removeChild(this.canvas);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tthis._animator.stop();\n\t\tthis.detach();\n\t\tthis.forceContextLoss();\n\n\t\tthis.off();\n\n\t\tthis.canvas.removeEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tthis.canvas.removeEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\t}\n\n\thasRenderingContext() {\n\t\tif (!(this.context && !this.context.isContextLost())) {\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tthis.context &&\n\t\t\t!this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t_initShaderProgram() {\n\t\tconst gl = this.context;\n\n\t\tif (this.shaderProgram) {\n\t\t\tgl.deleteProgram(this.shaderProgram);\n\t\t\tthis.shaderProgram = null;\n\t\t}\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst vsSource = renderer.getVertexShaderSource();\n\t\tconst fsSource = renderer.getFragmentShaderSource();\n\n\t\tconst vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource);\n\t\tconst fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource);\n\n\t\tconst shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader);\n\n\t\tif (!shaderProgram) {\n\t\t\tthrow new Error(`Failed to intialize shaders: ${WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())}`);\n\t\t}\n\n\t\tgl.useProgram(shaderProgram);\n\t\tshaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\");\n\t\tgl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);\n\t\tshaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, \"uPMatrix\");\n\t\tshaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, \"uMVMatrix\");\n\t\tshaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, \"uSampler\");\n\t\tshaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, \"aTextureCoord\");\n\t\tshaderProgram.uEye = gl.getUniformLocation(shaderProgram, \"uEye\");\n\n\t\tgl.enableVertexAttribArray(shaderProgram.textureCoordAttribute);\n\n\t\t// clear buffer\n\t\tgl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n\t\t// Use TEXTURE0\n\t\tgl.uniform1i(shaderProgram.samplerUniform, 0);\n\n\t\tthis.shaderProgram = shaderProgram;\n\t}\n\n\t_onWebglcontextlost(e) {\n\t\te.preventDefault();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_LOST);\n\t}\n\n\t_onWebglcontextrestored(e) {\n\t\tthis._initWebGL();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_RESTORE);\n\t}\n\n\tupdateFieldOfView(fieldOfView) {\n\t\tthis.fieldOfView = fieldOfView;\n\t\tthis._updateViewport();\n\t}\n\n\tupdateViewportDimensions(width, height) {\n\t\tlet viewPortChanged = false;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tconst w = width * DEVICE_PIXEL_RATIO;\n\t\tconst h = height * DEVICE_PIXEL_RATIO;\n\n\t\tif (w !== this.canvas.width) {\n\t\t\tthis.canvas.width = w;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (h !== this.canvas.height) {\n\t\t\tthis.canvas.height = h;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (!viewPortChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._updateViewport();\n\t\tthis._shouldForceDraw = true;\n\t}\n\n\t_updateViewport() {\n\t\tmat4.perspective(\n\t\t\tthis.pMatrix,\n\t\t\tglMatrix.toRadian(this.fieldOfView),\n\t\t\tthis.canvas.width / this.canvas.height,\n\t\t\t0.1,\n\t\t\t100);\n\n\t\tthis.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight);\n\t}\n\n\t_initWebGL() {\n\t\tlet gl;\n\n\t\t// TODO: Following code does need to be executed only if width/height, cubicStrip property is changed.\n\t\ttry {\n\t\t\tthis._initRenderingContext();\n\t\t\tgl = this.context;\n\n\t\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\t\tthis._initShaderProgram();\n\t\t} catch (e) {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\tmessage: \"no webgl support\"\n\t\t\t});\n\t\t\tthis.destroy();\n\t\t\tconsole.error(e); // eslint-disable-line no-console\n\t\t\treturn;\n\t\t}\n\t\t// 캔버스를 투명으로 채운다.\n\t\tgl.clearColor(0, 0, 0, 0);\n\t\tconst textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n\n\t\tif (this.texture) {\n\t\t\tgl.deleteTexture(this.texture);\n\t\t}\n\n\t\tthis.texture = WebGLUtils.createTexture(gl, textureTarget);\n\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\t// TODO: Apply following options on other projection type.\n\t\t\tgl.enable(gl.CULL_FACE);\n\t\t\t// gl.enable(gl.DEPTH_TEST);\n\t\t}\n\t}\n\n\t_initRenderingContext() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!window.WebGLRenderingContext) {\n\t\t\tthrow new Error(\"WebGLRenderingContext not available.\");\n\t\t}\n\n\t\tthis.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes);\n\n\t\tif (!this.context) {\n\t\t\tthrow new Error(\"Failed to acquire 3D rendering context\");\n\t\t}\n\t}\n\n\t_initBuffers() {\n\t\tconst vertexPositionData = this._renderer.getVertexPositionData();\n\t\tconst indexData = this._renderer.getIndexData();\n\t\tconst textureCoordData = this._renderer.getTextureCoordData(this._imageConfig);\n\t\tconst gl = this.context;\n\n\t\tthis.vertexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3,\n\t\t\tthis.shaderProgram.vertexPositionAttribute);\n\n\t\tthis.indexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1);\n\n\t\tthis.textureCoordBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2,\n\t\t\tthis.shaderProgram.textureCoordAttribute);\n\n\t\tthis._bindBuffers();\n\t}\n\n\t_bindTexture() {\n\t\t// Detect if it is EAC Format while CUBESTRIP mode.\n\t\t// We assume it is EAC if image is not 3/2 ratio.\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst isEAC = width && height && width / height !== 1.5;\n\n\t\t\tthis.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, \"uIsEAC\"), isEAC);\n\t\t} else if (this._imageType === ImageType.PANORAMA) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst imageAspectRatio = width && height && width / height;\n\n\t\t\tthis._renderer.updateShaderData({imageAspectRatio});\n\t\t}\n\n\t\t// intialize shader buffers after image is loaded.(by updateShaderData)\n\t\t// because buffer may be differ by image size.(eg. CylinderRenderer)\n\t\tthis._initBuffers();\n\n\t\tthis._renderer.bindTexture(\n\t\t\tthis.context,\n\t\t\tthis.texture,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t\tthis._shouldForceDraw = true;\n\n\t\tthis.trigger(EVENTS.BIND_TEXTURE);\n\t}\n\n\t_updateTexture() {\n\t\tthis._renderer.updateTexture(\n\t\t\tthis.context,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t}\n\n\tkeepUpdate(doUpdate) {\n\t\tif (doUpdate && this.isImageLoaded() === false) {\n\t\t\t// Force to draw a frame after image is loaded on render()\n\t\t\tthis._shouldForceDraw = true;\n\t\t}\n\n\t\tthis._keepUpdate = doUpdate;\n\t}\n\n\tstartRender() {\n\t\tthis._animator.setCallback(this._render.bind(this));\n\t\tthis._animator.start();\n\t}\n\n\tstopRender() {\n\t\tthis._animator.stop();\n\t}\n\n\trenderWithQuaternion(quaternion, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\tthis._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) &&\n\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// updatefieldOfView only if fieldOfView is changed.\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tthis.mvMatrix = mat4.fromQuat(mat4.create(), quaternion);\n\n\t\tthis._draw();\n\n\t\tthis._lastQuaternion = quat.clone(quaternion);\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\trenderWithYawPitch(yaw, pitch, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\t\tthis._lastYaw !== null && this._lastYaw === yaw &&\n\t\t\t\tthis._lastPitch !== null && this._lastPitch === pitch &&\n\t\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch));\n\t\tmat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw));\n\n\t\tthis._draw();\n\n\t\tthis._lastYaw = yaw;\n\t\tthis._lastPitch = pitch;\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\t_render() {\n\t\tconst yawPitchControl = this._yawPitchControl;\n\t\tconst fov = yawPitchControl.getFov();\n\n\t\tif (yawPitchControl.shouldRenderWithQuaternion()) {\n\t\t\tconst quaternion = yawPitchControl.getQuaternion();\n\n\t\t\tthis.renderWithQuaternion(quaternion, fov);\n\t\t} else {\n\t\t\tconst yawPitch = yawPitchControl.getYawPitch();\n\n\t\t\tthis.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov);\n\t\t}\n\t}\n\n\t_renderStereo = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\n\t\tconst eyeParams = vr.getEyeParams(gl, frame);\n\n\t\tif (!eyeParams) return;\n\n\t\tvr.beforeRender(gl, frame);\n\n\t\t// Render both eyes\n\t\tfor (const eyeIndex of [0, 1]) {\n\t\t\tconst eyeParam = eyeParams[eyeIndex];\n\n\t\t\tthis.mvMatrix = eyeParam.mvMatrix;\n\t\t\tthis.pMatrix = eyeParam.pMatrix;\n\n\t\t\tgl.viewport(...eyeParam.viewport);\n\t\t\tgl.uniform1f(this.shaderProgram.uEye, eyeIndex);\n\n\t\t\tthis._bindBuffers();\n\t\t\tthis._draw();\n\t\t}\n\n\t\tvr.afterRender();\n\t}\n\n\t_bindBuffers() {\n\t\tconst gl = this.context;\n\t\tconst program = this.shaderProgram;\n\n\t\tconst vertexBuffer = this.vertexBuffer;\n\t\tconst textureCoordBuffer = this.textureCoordBuffer;\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\t\tgl.enableVertexAttribArray(program.vertexPositionAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\n\t\tgl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\t\tgl.enableVertexAttribArray(program.textureCoordAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\t}\n\n\t_draw() {\n\t\tif (this._isVideo && this._keepUpdate) {\n\t\t\tthis._updateTexture();\n\t\t}\n\n\t\tthis._renderer.render({\n\t\t\tgl: this.context,\n\t\t\tshaderProgram: this.shaderProgram,\n\t\t\tindexBuffer: this.indexBuffer,\n\t\t\tmvMatrix: this.mvMatrix,\n\t\t\tpMatrix: this.pMatrix,\n\t\t});\n\t}\n\n\t/**\n\t * Returns projection renderer by each type\n\t */\n\tgetProjectionRenderer() {\n\t\treturn this._renderer;\n\t}\n\n\t/**\n\t * @return Promise\n\t */\n\tenterVR() {\n\t\tconst vr = this._vr;\n\n\t\tif (!WEBXR_SUPPORTED && !navigator.getVRDisplays) {\n\t\t\treturn Promise.reject(\"VR is not available on this browser.\");\n\t\t}\n\t\tif (vr && vr.isPresenting()) {\n\t\t\treturn Promise.resolve(\"VR already enabled.\");\n\t\t}\n\n\t\treturn this._requestPresent();\n\t}\n\n\texitVR = () => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\tif (!vr) return;\n\n\t\tvr.removeEndCallback(this.exitVR);\n\t\tvr.destroy();\n\t\tthis._vr = null;\n\n\t\t// Restore canvas & context on iOS\n\t\tif (IS_IOS) {\n\t\t\tthis._restoreStyle();\n\t\t}\n\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\tthis._updateViewport();\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t\tthis._bindBuffers();\n\t\tthis._shouldForceDraw = true;\n\n\t\tanimator.stop();\n\t\tanimator.setContext(window);\n\t\tanimator.setCallback(this._render.bind(this));\n\t\tanimator.start();\n\t}\n\n\t_requestPresent() {\n\t\tconst gl = this.context;\n\t\tconst canvas = this.canvas;\n\t\tconst animator = this._animator;\n\n\t\tthis._vr = WEBXR_SUPPORTED ?\n\t\t\tnew XRManager() :\n\t\t\tnew VRManager();\n\n\t\tconst vr = this._vr;\n\n\t\tanimator.stop();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvr.requestPresent(canvas, gl)\n\t\t\t\t.then(() => {\n\t\t\t\t\tvr.addEndCallback(this.exitVR);\n\t\t\t\t\tanimator.setContext(vr.context);\n\t\t\t\t\tanimator.setCallback(this._onFirstVRFrame);\n\n\t\t\t\t\tif (IS_IOS) {\n\t\t\t\t\t\tthis._setWrapperFullscreen();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shouldForceDraw = true;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\tresolve(\"success\");\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tvr.destroy();\n\t\t\t\t\tthis._vr = null;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t});\n\t}\n\n\t_onFirstVRFrame = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\t// If rendering is not ready, wait for next frame\n\t\tif (!vr.canRender(frame)) return;\n\n\t\tconst minusZDir = vec3.fromValues(0, 0, -1);\n\t\tconst eyeParam = vr.getEyeParams(gl, frame)[0];\n\t\t// Extract only rotation\n\t\tconst mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix);\n\t\tconst pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix);\n\n\t\tconst mvInv = mat3.invert(mat3.create(), mvMatrix);\n\t\tconst pInv = mat3.invert(mat3.create(), pMatrix);\n\t\tconst viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv);\n\n\t\tvec3.transformMat3(viewDir, viewDir, mvInv);\n\n\t\tconst yawOffset = mathUtil.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1));\n\n\t\tif (yawOffset === 0) {\n\t\t\t// If the yawOffset is exactly 0, then device sensor is not ready\n\t\t\t// So read it again until it has any value in it\n\t\t\treturn;\n\t\t}\n\n\t\tvr.setYawOffset(yawOffset);\n\t\tanimator.setCallback(this._renderStereo);\n\t}\n\n\t_setWrapperFullscreen() {\n\t\tconst wrapper = this._wrapper;\n\n\t\tif (!wrapper) return;\n\n\t\tthis._wrapperOrigStyle = wrapper.getAttribute(\"style\");\n\t\tconst wrapperStyle = wrapper.style;\n\n\t\twrapperStyle.width = \"100vw\";\n\t\twrapperStyle.height = \"100vh\";\n\t\twrapperStyle.position = \"fixed\";\n\t\twrapperStyle.left = \"0\";\n\t\twrapperStyle.top = \"0\";\n\t\twrapperStyle.zIndex = \"9999\";\n\t}\n\n\t_restoreStyle() {\n\t\tconst wrapper = this._wrapper;\n\t\tconst canvas = this.canvas;\n\n\t\tif (!wrapper) return;\n\n\t\tif (this._wrapperOrigStyle) {\n\t\t\twrapper.setAttribute(\"style\", this._wrapperOrigStyle);\n\t\t} else {\n\t\t\twrapper.removeAttribute(\"style\");\n\t\t}\n\n\t\tthis._wrapperOrigStyle = null;\n\n\t\t// Restore canvas style\n\t\tcanvas.removeAttribute(\"style\");\n\t\tthis._setDefaultCanvasStyle();\n\t}\n}\n\nexport default PanoImageRenderer;\n","import Component from \"@egjs/component\";\nimport {glMatrix} from \"gl-matrix\";\nimport {\n\tDeviceMotionEvent, checkXRSupport\n} from \"../utils/browserFeature\";\n\nimport YawPitchControl from \"../YawPitchControl/YawPitchControl\";\nimport PanoImageRenderer from \"../PanoImageRenderer/PanoImageRenderer\";\nimport WebGLUtils from \"../PanoImageRenderer/WebGLUtils\";\nimport {ERROR_TYPE, EVENTS, GYRO_MODE, PROJECTION_TYPE, STEREO_FORMAT} from \"./consts\";\nimport {util as mathUtil} from \"../utils/math-util.js\";\nimport {VERSION} from \"../version\";\n\nclass PanoViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.PanoViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic VERSION = VERSION;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\tstatic EVENTS = EVENTS;\n\tstatic PROJECTION_TYPE = PROJECTION_TYPE;\n\tstatic GYRO_MODE = GYRO_MODE;\n\t// It should be deprecated!\n\tstatic ProjectionType = PROJECTION_TYPE;\n\tstatic STEREO_FORMAT = STEREO_FORMAT;\n\t/**\n\t * Constant value for touch directions\n\t * @ko 터치 방향에 대한 상수 값.\n\t * @namespace\n\t * @name TOUCH_DIRECTION\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic TOUCH_DIRECTION = {\n\t\t/**\n\t\t * Constant value for none direction.\n\t\t * @ko none 방향에 대한 상수 값.\n\t\t * @name NONE\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 1\n\t\t */\n\t\tNONE: YawPitchControl.TOUCH_DIRECTION_NONE,\n\t\t/**\n\t\t * Constant value for horizontal(yaw) direction.\n\t\t * @ko horizontal(yaw) 방향에 대한 상수 값.\n\t\t * @name YAW\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 6\n\t\t */\n\t\tYAW: YawPitchControl.TOUCH_DIRECTION_YAW,\n\t\t/**\n\t\t * Constant value for vertical direction.\n\t\t * @ko vertical(pitch) 방향에 대한 상수 값.\n\t\t * @name PITCH\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 24\n\t\t */\n\t\tPITCH: YawPitchControl.TOUCH_DIRECTION_PITCH,\n\t\t/**\n\t\t * Constant value for all direction.\n\t\t * @ko all 방향에 대한 상수 값.\n\t\t * @name ALL\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 30\n\t\t */\n\t\tALL: YawPitchControl.TOUCH_DIRECTION_ALL\n\t};\n\n\t/**\n\t * @classdesc 360 media viewer\n\t * @ko 360 미디어 뷰어\n\t * @class\n\t * @name eg.view360.PanoViewer\n\t * @extends eg.Component\n\t *\n\t * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트\n\t * @param {Object} config\n\t *\n\t * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
\n\t * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.\n\t * @param {Object} [config.cubemapConfig.order = \"RLUDBF\"(ProjectionType === CUBEMAP) | \"RLUDFB\" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서\n\t * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.\n\t * @param {String} [config.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
\n\t * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위)\n\t * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위)\n\t *\n\t * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위)\n\t * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위)\n\t * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위)\n\t * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다\n\t * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다.\n\t * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE}
\n\t * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위\n\t * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위\n\t * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위\n\t * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
\n\t *\n\t * @example\n\t * // PanoViewer Creation\n\t * // create PanoViewer with option\n\t * var PanoViewer = eg.view360.PanoViewer;\n\t * // Area where the image will be displayed(HTMLElement)\n\t * var container = document.getElementById(\"myPanoViewer\");\n\t *\n\t * var panoViewer = new PanoViewer(container, {\n\t * // If projectionType is not specified, the default is \"equirectangular\".\n\t * // Specifies an image of the \"equirectangular\" type.\n\t * image: \"/path/to/image/image.jpg\"\n\t *});\n\t *\n\t * @example\n\t * // Cubemap Config Setting Example\n\t * // For support Youtube EAC projection, You should set cubemapConfig as follows.\n\t * cubemapConfig: {\n\t * \torder: \"LFRDBU\",\n\t * \ttileConfig: [\n\t * \t\ttileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}]\n\t * \t]\n\t * }\n\t */\n\tconstructor(container, options = {}) {\n\t\tsuper();\n\n\t\t// Raises the error event if webgl is not supported.\n\t\tif (!WebGLUtils.isWebGLAvailable()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\t\tmessage: \"no webgl support\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!WebGLUtils.isStableWebGL()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_DEVICE,\n\t\t\t\t\tmessage: \"blacklisted browser\"\n\t\t\t\t});\n\t\t\t}, 0);\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!!options.image && !!options.video) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_RESOURCE,\n\t\t\t\t\tmessage: \"Specifying multi resouces(both image and video) is not valid.\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\t// Check XR support at not when imported, but when created.\n\t\t// This is intended to make polyfills easier to use.\n\t\tcheckXRSupport();\n\n\t\tthis._container = container;\n\t\tthis._image = options.image || options.video;\n\t\tthis._isVideo = !!options.video;\n\t\tthis._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\tthis._cubemapConfig = Object.assign({\n\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/\n\t\t\torder: this._projectionType === PROJECTION_TYPE.CUBEMAP ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, options.cubemapConfig);\n\t\tthis._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\n\t\t// If the width and height are not provided, will use the size of the container.\n\t\tthis._width = options.width || parseInt(window.getComputedStyle(container).width, 10);\n\t\tthis._height = options.height || parseInt(window.getComputedStyle(container).height, 10);\n\n\t\t/**\n\t\t * Cache the direction for the performance in renderLoop\n\t\t *\n\t\t * This value should be updated by \"change\" event of YawPitchControl.\n\t\t */\n\t\tthis._yaw = options.yaw || 0;\n\t\tthis._pitch = options.pitch || 0;\n\t\tthis._fov = options.fov || 65;\n\n\t\tthis._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH;\n\t\tthis._quaternion = null;\n\n\t\tthis._aspectRatio = this._height !== 0 ? this._width / this._height : 1;\n\t\tconst fovRange = options.fovRange || [30, 110];\n\t\tconst touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ?\n\t\t\toptions.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL;\n\t\tconst yawPitchConfig = Object.assign(options, {\n\t\t\telement: container,\n\t\t\tyaw: this._yaw,\n\t\t\tpitch: this._pitch,\n\t\t\tfov: this._fov,\n\t\t\tgyroMode: this._gyroMode,\n\t\t\tfovRange,\n\t\t\taspectRatio: this._aspectRatio,\n\t\t\ttouchDirection\n\t\t});\n\n\t\tthis._isReady = false;\n\n\t\tthis._initYawPitchControl(yawPitchConfig);\n\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t}\n\n\t/**\n\t * Get the video element that the viewer is currently playing. You can use this for playback.\n\t * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다.\n\t * @method eg.view360.PanoViewer#getVideo\n\t * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement\n\t * @example\n\t * var videoTag = panoViewer.getVideo();\n\t * videoTag.play(); // play video!\n\t */\n\tgetVideo() {\n\t\tif (!this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the video information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setVideo\n\t * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정)\n\t * @param {Object} param\n\t * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}(\"equirectangular\")] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setVideo(\"/path/to/video/video.mp4\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR\n\t * });\n\t */\n\tsetVideo(video, param = {}) {\n\t\tif (video) {\n\t\t\tthis.setImage(video, {\n\t\t\t\tprojectionType: param.projectionType,\n\t\t\t\tisVideo: true,\n\t\t\t\tcubemapConfig: param.cubemapConfig,\n\t\t\t\tstereoFormat: param.stereoFormat\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the image information that the viewer is currently using.\n\t * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다.\n\t * @method eg.view360.PanoViewer#getImage\n\t * @return {Image} Image Object이미지 객체\n\t * @example\n\t * var imageObj = panoViewer.getImage();\n\t */\n\tgetImage() {\n\t\tif (this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the image information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setImage\n\t * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.)\n\t * @param {Object} param Additional information이미지 추가 정보\n\t * @param {String} [param.projectionType=\"equirectangular\"] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setImage(\"/path/to/image/image.png\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP\n\t * });\n\t */\n\tsetImage(image, param = {}) {\n\t\tconst cubemapConfig = Object.assign({\n\t\t\torder: \"RLUDBF\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, param.cubemapConfig);\n\t\tconst stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\t\tconst isVideo = !!(param.isVideo);\n\n\t\tif (this._image && this._isVideo !== isVideo) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.warn(\"Currently not supporting to change content type(Image <--> Video)\");\n\t\t\t/* eslint-enable no-console */\n\t\t\treturn this;\n\t\t}\n\n\t\tif (image) {\n\t\t\tthis._image = image;\n\t\t\tthis._isVideo = isVideo;\n\t\t\tthis._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\t\tthis._cubemapConfig = cubemapConfig;\n\t\t\tthis._stereoFormat = stereoFormat;\n\n\t\t\tthis._deactivate();\n\t\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set whether the renderer always updates the texture and renders.\n\t * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다.\n\t *\n\t * @method eg.view360.PanoViewer#keepUpdate\n\t * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다.\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tkeepUpdate(doUpdate) {\n\t\tthis._photoSphereRenderer.keepUpdate(doUpdate);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get projection type (equirectangular/cube)\n\t * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#getProjectionType\n\t * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE}\n\t */\n\tgetProjectionType() {\n\t\treturn this._projectionType;\n\t}\n\n\t/**\n\t * Activate the device's motion sensor, and return the Promise whether the sensor is enabled\n\t * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element.\n\t * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다.\n\t * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * @method eg.view360.PanoViewer#enableSensor\n\t * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다.\n\t */\n\tenableSensor() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\") {\n\t\t\t\tDeviceMotionEvent.requestPermission().then(permissionState => {\n\t\t\t\t\tif (permissionState === \"granted\") {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(new Error(\"permission denied\"));\n\t\t\t\t\t}\n\t\t\t\t}).catch(e => {\n\t\t\t\t\t// This can happen when this method wasn't triggered by user interaction\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disable the device's motion sensor.\n\t * @ko 디바이스의 모션 센서를 비활성화합니다.\n\t * @deprecated\n\t * @method eg.view360.PanoViewer#disableSensor\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdisableSensor() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred).\n\t * This method must be used in the context of user interaction, like onclick callback on the button element.\n\t * It can be rejected when an enabling device sensor fails or image/video is still loading(\"ready\" event not triggered).\n\t * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다)\n\t * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우(\"ready\"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다.\n\t * @method eg.view360.PanoViewer#enterVR\n\t * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error)\n\t */\n\tenterVR() {\n\t\tif (!this._isReady) {\n\t\t\treturn Promise.reject(new Error(\"PanoViewer is not ready to show image.\"));\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.enableSensor()\n\t\t\t\t.then(() => this._photoSphereRenderer.enterVR())\n\t\t\t\t.then(res => resolve(res))\n\t\t\t\t.catch(e => reject(e));\n\t\t});\n\t}\n\n\t/**\n\t * Exit VR stereo rendering mode.\n\t * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#exitVR\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\texitVR() {\n\t\tthis._photoSphereRenderer.exitVR();\n\t\treturn this;\n\t}\n\n\t// TODO: Remove parameters as they're just using private values\n\t_initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) {\n\t\tthis._photoSphereRenderer = new PanoImageRenderer(\n\t\t\tthis._image,\n\t\t\tthis._width,\n\t\t\tthis._height,\n\t\t\tthis._isVideo,\n\t\t\t{\n\t\t\t\tinitialYaw: yaw,\n\t\t\t\tinitialPitch: pitch,\n\t\t\t\tfieldOfView: fov,\n\t\t\t\timageType: projectionType,\n\t\t\t\tcubemapConfig,\n\t\t\t\tstereoFormat: this._stereoFormat\n\t\t\t},\n\t\t);\n\t\tthis._photoSphereRenderer.setYawPitchControl(this._yawPitchControl);\n\n\t\tthis._bindRendererHandler();\n\n\t\tthis._photoSphereRenderer\n\t\t\t.bindTexture()\n\t\t\t.then(() => this._activate())\n\t\t\t.catch(() => {\n\t\t\t\tthis._triggerEvent(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.FAIL_BIND_TEXTURE,\n\t\t\t\t\tmessage: \"failed to bind texture\"\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * update values of YawPitchControl if needed.\n\t * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image.\n\t *\n\t * This function should be called after isReady status is true.\n\t */\n\t_updateYawPitchIfNeeded() {\n\t\tif (this._projectionType === PanoViewer.ProjectionType.PANORAMA) {\n\t\t\t// update fov by aspect ratio\n\t\t\tconst image = this._photoSphereRenderer.getContent();\n\t\t\tlet imageAspectRatio = image.naturalWidth / image.naturalHeight;\n\t\t\tlet isCircular;\n\t\t\tlet yawSize;\n\t\t\tlet maxFov;\n\n\t\t\t// If height is larger than width, then we assume it's rotated by 90 degree.\n\t\t\tif (imageAspectRatio < 1) {\n\t\t\t\t// So inverse the aspect ratio.\n\t\t\t\timageAspectRatio = 1 / imageAspectRatio;\n\t\t\t}\n\n\t\t\tif (imageAspectRatio < 6) {\n\t\t\t\tyawSize = mathUtil.toDegree(imageAspectRatio);\n\t\t\t\tisCircular = false;\n\t\t\t\t// 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5\n\t\t\t\tmaxFov = mathUtil.toDegree(Math.atan(0.5)) * 2;\n\t\t\t} else {\n\t\t\t\tyawSize = 360;\n\t\t\t\tisCircular = true;\n\t\t\t\tmaxFov = (360 / imageAspectRatio); // Make it 5 fixed as axes does.\n\t\t\t}\n\n\t\t\t// console.log(\"_updateYawPitchIfNeeded\", maxFov, \"aspectRatio\", image.naturalWidth, image.naturalHeight, \"yawSize\", yawSize);\n\t\t\tconst minFov = (this._yawPitchControl.option(\"fovRange\"))[0];\n\n\t\t\t// this option should be called after fov is set.\n\t\t\tthis._yawPitchControl.option({\n\t\t\t\t\"fov\": maxFov, /* parameter for internal validation for pitchrange */\n\t\t\t\t\"yawRange\": [-yawSize / 2, yawSize / 2],\n\t\t\t\tisCircular,\n\t\t\t\t\"pitchRange\": [-maxFov / 2, maxFov / 2],\n\t\t\t\t\"fovRange\": [minFov, maxFov]\n\t\t\t});\n\t\t\tthis.lookAt({fov: maxFov});\n\t\t}\n\t}\n\n\t_bindRendererHandler() {\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, e);\n\t\t});\n\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, e => {\n\t\t\tthis._deactivate();\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERING_CONTEXT_LOST,\n\t\t\t\tmessage: \"webgl rendering context lost\"\n\t\t\t});\n\t\t});\n\t}\n\n\t_initYawPitchControl(yawPitchConfig) {\n\t\tthis._yawPitchControl = new YawPitchControl(yawPitchConfig);\n\n\t\tthis._yawPitchControl.on(EVENTS.ANIMATION_END, e => {\n\t\t\tthis._triggerEvent(EVENTS.ANIMATION_END, e);\n\t\t});\n\n\t\tthis._yawPitchControl.on(\"change\", e => {\n\t\t\tthis._yaw = e.yaw;\n\t\t\tthis._pitch = e.pitch;\n\t\t\tthis._fov = e.fov;\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis._triggerEvent(EVENTS.VIEW_CHANGE, e);\n\t\t});\n\t}\n\n\t_triggerEvent(name, param) {\n\t\tconst evt = param || {};\n\n\t\t/**\n\t\t * Events that is fired when error occurs\n\t\t * @ko 에러 발생 시 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#error\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.type Error type\n\t\t * \t\t10: INVALID_DEVICE: Unsupported device\n\t\t * \t\t11: NO_WEBGL: Webgl not support\n\t\t * \t\t12, FAIL_IMAGE_LOAD: Failed to load image\n\t\t * \t\t13: FAIL_BIND_TEXTURE: Failed to bind texture\n\t\t * \t\t14: INVALID_RESOURCE: Only one resource(image or video) should be specified\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost occurred\n\t\t * 에러 종류\n\t\t * \t\t10: INVALID_DEVICE: 미지원 기기\n\t\t * \t\t11: NO_WEBGL: WEBGL 미지원\n\t\t * \t\t12, FAIL_IMAGE_LOAD: 이미지 로드 실패\n\t\t * \t\t13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패\n\t\t * \t\t14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost 발생\n\t\t * \n\t\t * @param {String} param.message Error message 에러 메시지\n\t\t * @see {@link eg.view360.PanoViewer.ERROR_TYPE}\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"error\" : function(evt) {\n\t\t *\t\t// evt.type === 13\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t *\n\t\t * // constant can be used\n\t\t * viwer.on({\n\t\t *\teg.view360.PanoViewer.EVENTS.ERROR : function(evt) {\n\t\t *\t\t// evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when PanoViewer is ready to go.\n\t\t * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#ready\n\t\t * @event\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"ready\" : function(evt) {\n\t\t *\t\t// PanoViewer is ready to show image and handle user interaction.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when direction or fov is changed.\n\t\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#viewChange\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.yaw yawyaw\n\t\t * @param {Number} param.pitch pitch pitch\n\t\t * @param {Number} param.fov Field of view (fov) 화각\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"viewChange\" : function(evt) {\n\t\t *\t\t//evt.yaw, evt.pitch, evt.fov is available.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when animation which is triggered by inertia is ended.\n\t\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#animationEnd\n\t\t * @event\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"animationEnd\" : function(evt) {\n\t\t *\t\t// animation is ended.\n\t\t * });\n\t\t */\n\t\treturn this.trigger(name, evt);\n\t}\n\n\t/**\n\t * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}.\n\t * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다.\n\t * @method eg.view360.PanoViewer#setUseZoom\n\t * @param {Boolean} useZoom\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseZoom(useZoom) {\n\t\ttypeof useZoom === \"boolean\" && this._yawPitchControl.option(\"useZoom\", useZoom);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * When true, enables the keyboard move key control: awsd, arrow keys\n\t * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키)\n\t * @method eg.view360.PanoViewer#setUseKeyboard\n\t * @param {Boolean} useKeyboard\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseKeyboard(useKeyboard) {\n\t\tthis._yawPitchControl.option(\"useKeyboard\", useKeyboard);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")\n\t * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")\n\t * @method eg.view360.PanoViewer#setGyroMode\n\t * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE}\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setGyroMode(\"yawPitch\");\n\t * //equivalent\n\t * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH);\n\t */\n\tsetGyroMode(gyroMode) {\n\t\tthis._yawPitchControl.option(\"gyroMode\", gyroMode);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setFovRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setFovRange([50, 90]);\n\t */\n\tsetFovRange(range) {\n\t\tthis._yawPitchControl.option(\"fovRange\", range);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Getting the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFovRange\n\t * @return {Array}\n\t * @example\n\t * var range = panoViewer.getFovRange(); //[50, 90]\n\t */\n\tgetFovRange() {\n\t\treturn this._yawPitchControl.option(\"fovRange\");\n\t}\n\n\t/**\n\t * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size.\n\t * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다.\n\t * @method eg.view360.PanoViewer#updateViewportDimensions\n\t * @param {Object} [size]\n\t * @param {Number} [size.width=width of container]\n\t * @param {Number} [size.height=height of container]\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tupdateViewportDimensions(size = {width: undefined, height: undefined}) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet containerSize;\n\n\t\tif (size.width === undefined || size.height === undefined) {\n\t\t\tcontainerSize = window.getComputedStyle(this._container);\n\t\t}\n\n\t\tconst width = size.width || parseInt(containerSize.width, 10);\n\t\tconst height = size.height || parseInt(containerSize.height, 10);\n\n\t\t// Skip if viewport is not changed.\n\t\tif (width === this._width && height === this._height) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tthis._aspectRatio = width / height;\n\t\tthis._photoSphereRenderer.updateViewportDimensions(width, height);\n\t\tthis._yawPitchControl.option(\"aspectRatio\", this._aspectRatio);\n\t\tthis._yawPitchControl.updatePanScale({height});\n\n\t\tthis.lookAt({}, 0);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the current field of view(FOV)\n\t * @ko 현재 field of view(FOV) 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFov\n\t * @return {Number}\n\t */\n\tgetFov() {\n\t\treturn this._fov;\n\t}\n\n\t/**\n\t * Get the horizontal field of view in degree\n\t */\n\t_getHFov() {\n\t\treturn mathUtil.toDegree(\n\t\t\t2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2)));\n\t}\n\n\t/**\n\t * Get current yaw value\n\t * @ko 현재 yaw 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYaw\n\t * @return {Number}\n\t */\n\tgetYaw() {\n\t\treturn this._yaw;\n\t}\n\n\t/**\n\t * Get current pitch value\n\t * @ko 현재 pitch 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getPitch\n\t * @return {Number}\n\t */\n\tgetPitch() {\n\t\treturn this._pitch;\n\t}\n\n\t/**\n\t * Get the range of controllable Yaw values\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYawRange\n\t * @return {Array}\n\t */\n\tgetYawRange() {\n\t\treturn this._yawPitchControl.option(\"yawRange\");\n\t}\n\n\t/**\n\t * Get the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다.\n\t * @method eg.view360.PanoViewer#getPitchRange\n\t * @return {Array}\n\t */\n\tgetPitchRange() {\n\t\treturn this._yawPitchControl.option(\"pitchRange\");\n\t}\n\n\t/**\n\t * Set the range of controllable yaw\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#setYawRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setYawRange([-90, 90]);\n\t */\n\tsetYawRange(yawRange) {\n\t\tthis._yawPitchControl.option(\"yawRange\", yawRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setPitchRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setPitchRange([-40, 40]);\n\t */\n\tsetPitchRange(pitchRange) {\n\t\tthis._yawPitchControl.option(\"pitchRange\", pitchRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed.\n\t * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다.\n\t * @method eg.view360.PanoViewer#setShowPolePoint\n\t * @param {Boolean} showPolePoint\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetShowPolePoint(showPolePoint) {\n\t\tthis._yawPitchControl.option(\"showPolePoint\", showPolePoint);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a new view by setting camera configuration. Any parameters not specified remain the same.\n\t * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다.\n\t * @method eg.view360.PanoViewer#lookAt\n\t * @param {Object} orientation\n\t * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위)\n\t * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위)\n\t * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위)\n\t * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초)\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * // Change the yaw angle (absolute angle) to 30 degrees for one second.\n\t * panoViewer.lookAt({yaw: 30}, 1000);\n\t */\n\tlookAt(orientation, duration) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw;\n\t\tconst pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch;\n\t\tconst pitchRange = this._yawPitchControl.option(\"pitchRange\");\n\t\tconst verticalAngleOfImage = pitchRange[1] - pitchRange[0];\n\t\tlet fov = orientation.fov !== undefined ? orientation.fov : this._fov;\n\n\t\tif (verticalAngleOfImage < fov) {\n\t\t\tfov = verticalAngleOfImage;\n\t\t}\n\n\t\tthis._yawPitchControl.lookAt({yaw, pitch, fov}, duration);\n\n\t\tif (duration === 0) {\n\t\t\tthis._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_activate() {\n\t\tthis._photoSphereRenderer.attachTo(this._container);\n\t\tthis._yawPitchControl.enable();\n\n\t\tthis.updateViewportDimensions();\n\n\t\tthis._isReady = true;\n\n\t\t// update yawPitchControl after isReady status is true.\n\t\tthis._updateYawPitchIfNeeded();\n\n\t\tthis._triggerEvent(EVENTS.READY);\n\t\tthis._photoSphereRenderer.startRender();\n\t}\n\n\t/**\n\t * Destroy webgl context and block user interaction and stop rendering\n\t */\n\t_deactivate() {\n\t\tif (this._isReady) {\n\t\t\tthis._photoSphereRenderer.stopRender();\n\t\t\tthis._yawPitchControl.disable();\n\t\t\tthis._isReady = false;\n\t\t}\n\n\t\tif (this._photoSphereRenderer) {\n\t\t\tthis._photoSphereRenderer.destroy();\n\t\t\tthis._photoSphereRenderer = null;\n\t\t}\n\t}\n\n\tstatic _isValidTouchDirection(direction) {\n\t\treturn direction === PanoViewer.TOUCH_DIRECTION.NONE ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.YAW ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.PITCH ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.ALL;\n\t}\n\n\t/**\n\t * Set touch direction by which user can control.\n\t * @ko 사용자가 조작가능한 터치 방향을 지정합니다.\n\t * @method eg.view360.PanoViewer#setTouchDirection\n\t * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @return {eg.view360.PanoViewer} PanoViewer instance\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Limit the touch direction to the yaw direction only.\n\t * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW);\n\t */\n\tsetTouchDirection(direction) {\n\t\tif (PanoViewer._isValidTouchDirection(direction)) {\n\t\t\tthis._yawPitchControl.option(\"touchDirection\", direction);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns touch direction by which user can control\n\t * @ko 사용자가 조작가능한 터치 방향을 반환한다.\n\t * @method eg.view360.PanoViewer#getTouchDirection\n\t * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Returns the current touch direction.\n\t * var dir = panoViewer.getTouchDirection();\n\t */\n\tgetTouchDirection() {\n\t\treturn this._yawPitchControl.option(\"touchDirection\");\n\t}\n\n\t/**\n\t * Destroy viewer. Remove all registered event listeners and remove viewer canvas.\n\t * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다.\n\t * @method eg.view360.PanoViewer#destroy\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdestroy() {\n\t\tthis._deactivate();\n\n\t\tif (this._yawPitchControl) {\n\t\t\tthis._yawPitchControl.destroy();\n\t\t\tthis._yawPitchControl = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check whether the current environment can execute PanoViewer\n\t * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다.\n\t * @function isSupported\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부\n\t * @static\n\t */\n\tstatic isSupported() {\n\t\treturn WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the WebGL\n\t * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다.\n\t * @function isWebGLAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} WebGL support WebGL 지원여부\n\t * @static\n\t */\n\tstatic isWebGLAvailable() {\n\t\treturn WebGLUtils.isWebGLAvailable();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the gyro sensor.\n\t * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다.\n\t * @function isGyroSensorAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수\n\t * @static\n\t */\n\tstatic isGyroSensorAvailable(callback) {\n\t\tif (!DeviceMotionEvent) {\n\t\t\tcallback && callback(false);\n\t\t\treturn;\n\t\t}\n\n\t\tlet onDeviceMotionChange;\n\n\t\tfunction checkGyro() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tonDeviceMotionChange = function(deviceMotion) {\n\t\t\t\t\tconst isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null);\n\n\t\t\t\t\tres(isGyroSensorAvailable);\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener(\"devicemotion\", onDeviceMotionChange);\n\t\t\t});\n\t\t}\n\n\t\tfunction timeout() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tsetTimeout(() => res(false), 1000);\n\t\t\t});\n\t\t}\n\n\t\tPromise.race([checkGyro(), timeout()]).then(isGyroSensorAvailable => {\n\t\t\twindow.removeEventListener(\"devicemotion\", onDeviceMotionChange);\n\n\t\t\tcallback && callback(isGyroSensorAvailable);\n\n\t\t\tPanoViewer.isGyroSensorAvailable = function(fb) {\n\t\t\t\tfb && fb(isGyroSensorAvailable);\n\t\t\t\treturn isGyroSensorAvailable;\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport default PanoViewer;\n"],"names":["this","require","global","create","glMatrix.ARRAY_TYPE","invert","identity","fromQuat","fromValues","copy","set","subtract","scale","clone","normalize","exactEquals","equals","glMatrix.EPSILON","forEach","multiply","vec4.clone","vec4.fromValues","vec4.copy","vec4.normalize","vec4.exactEquals","vec4.equals","vec3.create","vec3.fromValues","dot","vec3.dot","vec3.cross","vec3.len","vec3.normalize","mat3.create","win","window","Math","self","Function","doc","document","agent","getAgent","osName","os","name","browserName","browser","IS_IOS","IS_SAFARI_ON_DESKTOP","Float32Array","Array","getComputedStyle","userAgent","navigator","SUPPORT_TOUCH","SUPPORT_DEVICEMOTION","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","i","len","length","SUPPORT_WILLCHANGE","CSS","supports","WEBXR_SUPPORTED","checkXRSupport","xr","isSessionSupported","then","res","supportsSession","_extends","_inheritsLoose","_assertThisInitialized","round","getAngle","getRotation","some","find","getUserAgent","execRegExp","hasUserAgentData","findVersion","convertVersion","findPreset","findBrand","BROWSER_PRESETS","CHROMIUM_PRESETS","WEBKIT_PRESETS","WEBVIEW_PRESETS","OS_PRESETS","parseUserAgentData","parseUserAgent","toArray","SUPPORT_POINTER_EVENTS","Pan","Pinch","quatToVec3","quaternion","baseV","vec3","toDegree","a","PI","util","isPowerOfTwo","n","extractPitchFromQuat","atan2","sqrt","pow","hypot","x","y","ROTATE_CONSTANT","PITCH_DELTA","YAW_DELTA_BY_ROLL","YAW_DELTA_BY_YAW","targetAxis","meshPoint","getRotationDelta","prevQ","curQ","rotateKind","prevQuaternion","quat","curQuaternion","prevPoint","curPoint","rotateDistance","rotateDirection","meshPoint2","meshPoint3","vecU","vecV","vecN","coefficientA","coefficientB","coefficientC","distance","abs","projectedPrevPoint","trigonometricRatio","theta","acos","crossVec","thetaDirection","deltaRadian","angleBetweenVec2","v1","v2","det","vec2","yawOffsetBetween","viewDir","targetDir","viewDirXZ","targetDirXZ","toAxis","source","offset","reduce","acc","v","MathUtil","Util","version","branch","build","match","exec","parseInt","CHROME_VERSION","IS_CHROME_WITHOUT_DEVICE_MOTION","IS_ANDROID","test","CONTROL_MODE_VR","CONTROL_MODE_YAWPITCH","TOUCH_DIRECTION_NONE","TOUCH_DIRECTION_YAW","TOUCH_DIRECTION_PITCH","TOUCH_DIRECTION_ALL","MC_DECELERATION","MC_MAXIMUM_DURATION","MC_BIND_SCALE","MAX_FIELD_OF_VIEW","PAN_SCALE","YAW_RANGE_HALF","PITCH_RANGE_HALF","CIRCULAR_PITCH_RANGE_HALF","GYRO_MODE","NONE","YAWPITCH","VR","STILLNESS_THRESHOLD","DeviceMotion","_onDeviceMotion","bind","_onDeviceOrientation","_onChromeWithoutDeviceMotion","isWithoutDeviceMotion","isAndroid","stillGyroVec","rawGyroVec","adjustedGyroVec","_timer","lastDevicemotionTimestamp","_isEnabled","enable","e","alpha","beta","gamma","trigger","inputEvent","deviceorientation","clearTimeout","setTimeout","Date","getTime","isGyroSensorAvailable","rotationRate","isGravitySensorAvailable","accelerationIncludingGravity","interval","devicemotionEvent","timeStamp","type","z","acceleration","adjustedRotationRate","addEventListener","disable","removeEventListener","Component","SensorSample","ComplementaryFilter","prototype","run_","isOrientationInitialized","accelQ","accelToQuaternion_","currentAccelMeasurement","sample","previousFilterQ","deltaT","currentGyroMeasurement","timestampS","previousGyroMeasurement","gyroDeltaQ","gyroToQuaternionDelta_","gyroIntegralQ","filterQ","invFilterQ","Quaternion","inverse","estimatedGravity","applyQuaternion","measuredGravity","deltaQ","setFromUnitVectors","targetQ","slerp","kFilter","isFilterQuaternionInitialized","getOrientation","K_FILTER","PREDICTION_TIME_S","FusionPoseSensor","deviceMotion","accelerometer","Vector3","gyroscope","_onDeviceMotionChange","_onScreenOrientationChange","filter","posePredictor","PosePredictor","filterToWorldQ","isFirefoxAndroid","isIOS","isChromeUsingDegrees","setFromAxisAngle","inverseWorldToScreenQ","worldToScreenQ","originalPoseAdjustQ","orientation","_setScreenTransform","isLandscapeMode","resetQ","on","isEnabled","destroy","_triggerChange","_prevOrientation","_deviceOrientationQ","deviceOrientationFixQ","_alpha","out","multiplyQuaternions","out_","w","_convertFusionToPredicted","predictedQ","getPrediction","previousTimestampS","accGravity","rotRate","setFromEulerYXZ","multiplyScalar","addAccelMeasurement","addGyroMeasurement","screenOrientation","getDeltaYaw","prvQ","yawDeltaByYaw","yawDeltaByRoll","sin","getDeltaPitch","pitchDelta","TiltMotionInput","el","options","element","_prevQuaternion","_quaternion","fusionPoseSensor","threshold","_onPoseChange","mapAxes","axes","connect","observer","_attachEvent","disconnect","_dettachEvent","event","change","off","screenRotationAngleInst","refCount","ScreenRotationAngle","_onOrientationChange","_spinR","_screenOrientationAngle","betaR","glMatrix","gammaR","cos","screen","angle","undefined","getRadian","unref","RotationPanInput","_useRotation","_screenRotationAngle","setUseRotation","useRotation","_userDirection","Axes","DIRECTION_ALL","_direction","DIRECTION_HORIZONTAL","getOffset","properties","useDirection","newOffset","cosTheta","sinTheta","DIRECTION_VERTICAL","PanInput","Y_AXIS_VECTOR","DeviceQuaternion","_fusionPoseSensor","isTrusted","getCombinedQuaternion","yaw","yawQ","conj","outQ","VERSION","DEFAULT_YAW_RANGE","DEFAULT_PITCH_RANGE","CIRCULAR_PITCH_RANGE","YawPitchControl","opt","pitch","fov","showPolePoint","useZoom","useKeyboard","gyroMode","touchDirection","yawRange","pitchRange","fovRange","aspectRatio","_element","_initialFov","_enabled","_isAnimating","_deviceQuaternion","_initAxes","option","yRange","_updateYawRange","pRange","_updatePitchRange","axesPanInput","axesWheelInput","WheelInput","axesTiltMotionInput","axesPinchInput","PinchInput","axesMoveKeyInput","MoveKeyInput","range","circular","isCircular","bounce","deceleration","maximumDuration","hold","evt","delta","_updateControlScale","updatePanScale","release","animationStart","animationEnd","param","get","areaHeight","height","args","argLen","_getOptions","beforeOptions","newOptions","changedKeyList","Object","keys","push","_setOptions","_getValidatedOptions","_applyOptions","_getValidYawRange","_getValidPitchRange","key","value","arguments","prevOptions","isVR","isYawPitch","indexOf","setTo","prevFov","nextFov","axis","_initDeviceQuaternion","_togglePinchInputByOption","_enableTouch","_inputs","direction","yawEnabled","pitchEnabled","newYawRange","newFov","newAspectRatio","ratio","adjustAspectRatio","horizontalFov","isValid","newPitchRange","changeEvt","pos","p","verticalAngle","halfFov","isPanorama","concat","horizontalAngle","halfHorizontalFov","mathUtil","tan","targetElement","input","inputRange","outputRange","rangeIdx","inputA","inputB","outputA","outputB","lerp","b","fraction","persistOrientation","_resetOrientation","lookAt","duration","f","Infinity","setBy","getYawPitch","yawPitch","getFov","getQuaternion","shouldRenderWithQuaternion","axisPanInput","axesDeviceOrientationInput","STATUS","EVENT","ImageLoader","image","_image","_onceHandlers","_loadStatus","rej","LOADED","getElement","LOADING","isMaybeLoaded","READYSTATECHANGE","createElement","onceLoaded","ERROR","images","map","img","_img","Image","crossOrigin","src","result","complete","naturalWidth","onload","onerror","targets","targetsNotLoaded","loadPromises","_once","all","reason","listener","fn","getStatus","handler","READY_STATUS","HAVE_NOTHING","HAVE_METADATA","HAVE_CURRENT_DATA","HAVE_FUTURE_DATA","HAVE_ENOUGH_DATA","LOADING_FAILED","READYSTATECHANGE_EVENT_NAME","VideoLoader","video","_handlers","_sourceCount","_thresholdReadyState","_thresholdEventName","readyState","_onerror","_errorCount","_detachErrorHandler","_appendSourceElement","videoUrl","videoSrc","videoType","sourceElement","_video","appendChild","_reset","HTMLVideoElement","setAttribute","querySelectorAll","load","_attachErrorHandler","_sources","call","rejector","WEBGL_ERROR_CODE","webglAvailability","MAX_TEXTURE_SIZE_FOR_TEST","WebGLUtils","createShader","gl","shader","shaderSource","compileShader","success","getShaderParameter","COMPILE_STATUS","console","error","getShaderInfoLog","createProgram","vertexShader","fragmentShader","program","attachShader","linkProgram","detachShader","deleteShader","getProgramParameter","LINK_STATUS","deleteProgram","initBuffer","data","itemSize","attr","buffer","createBuffer","bindBuffer","bufferData","STATIC_DRAW","numItems","enableVertexAttribArray","vertexAttribPointer","FLOAT","getWebglContext","canvas","userContextAttributes","webglIdentifiers","context","contextAttributes","preserveDrawingBuffer","antialias","xrCompatible","onWebglcontextcreationerror","statusMessage","getContext","t","createTexture","textureTarget","texture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","isWebGLAvailable","webglContext","loseContextExtension","getExtension","loseContext","isStableWebGL","agentInfo","isStableWebgl","parseFloat","getErrorNameFromWebGLErrorCode","code","texImage2D","pixels","RGBA","UNSIGNED_BYTE","getMaxTextureSize","getParameter","MAX_TEXTURE_SIZE","Agent","isIE11","majorVersion","EVENTS","Renderer","_forceDimension","_pixelCanvas","_pixelContext","render","shaderProgram","indexBuffer","mvMatrix","pMatrix","uniformMatrix4fv","pMatrixUniform","mvMatrixUniform","drawElements","TRIANGLES","UNSIGNED_SHORT","getDimension","pixelSource","width","videoWidth","naturalHeight","videoHeight","updateShaderData","_initPixelSource","forceDimension","isIE11Video","_getPixelSource","contentDimension","textureDimension","drawImage","_extractTileConfig","imageConfig","tileConfig","isArray","config","flipHorizontal","rotation","_triggerError","message","CubeRenderer","getVertexPositionData","_VERTEX_POSITION_DATA","getIndexData","_INDEX_DATA","indexData","vertexPositionData","extractOrder","order","getTextureCoordData","vertexOrder","base","elemSize","vertexPerTile","textureCoordData","split","face","ordermap_","r","shift","unshift","pop","elemPerTile","tileVertex","slice","tileTemp","j","splice","join","getVertexShaderSource","getFragmentShaderSource","updateTexture","baseOrder","orderMap","surfaceIdx","tileIdx","TEXTURE_CUBE_MAP_POSITIVE_X","maxCubeMapTextureSize","getMaxCubeMapTextureSize","tile","extractTileFromImage","TEXTURE_CUBE_MAP","getSourceTileSize","inputTextureSize","outputTextureSize","tilePerRow","MAX_CUBE_MAP_TEXTURE_SIZE","_imageWidth","min","CubeStripRenderer","_vertices","indices","cols","rows","coords","c","coord","tileConfigs","_shrinkCoord","_transformCoord","index","val","TEXTURE_2D","size","max","maxSize","activeTexture","TEXTURE0","pixelStorei","UNPACK_FLIP_Y_WEBGL","newCoord","_flipHorizontalCoord","_rotateCoord","SHRINK_Y","SHRINK_X","rotationAngle","SIZE","shiftCount","moved","rotatedCoord","ERROR_TYPE","INVALID_DEVICE","NO_WEBGL","FAIL_IMAGE_LOAD","FAIL_BIND_TEXTURE","INVALID_RESOURCE","RENDERING_CONTEXT_LOST","READY","VIEW_CHANGE","ANIMATION_END","PROJECTION_TYPE","EQUIRECTANGULAR","CUBEMAP","CUBESTRIP","PANORAMA","STEREOSCOPIC_EQUI","STEREO_FORMAT","TOP_BOTTOM","LEFT_RIGHT","latitudeBands","longitudeBands","radius","ANGLE_CORRECTION_FOR_CENTER_ALIGN","latIdx","lngIdx","phi","sinPhi","cosPhi","u","SphereRenderer","format","_stereoFormat","ctx","leftEyeScaleOffset","rightEyeScaleOffset","uTexScaleOffset","getUniformLocation","uniform4fv","_TEXTURE_COORD_DATA","MIN_ASPECT_RATIO_FOR_FULL_PANORAMA","CylinderRenderer","resizeDimension","imageAspectRatio","cylinderMaxRadian","halfCylinderY","rotated","CYLIDER_Y","startAngleForCenterAlign","yIdx","yLength","VR_DISPLAY_PRESENT_CHANGE","DEFAULT_LEFT_BOUNDS","DEFAULT_RIGHT_BOUNDS","EYES","LEFT","RIGHT","VRManager","_vrDisplay","vrDisplay","removeEndCallback","isPresenting","exitPresent","_clear","_frameData","VRFrameData","canRender","Boolean","beforeRender","bindFramebuffer","FRAMEBUFFER","afterRender","submitFrame","getEyeParams","display","halfWidth","drawingBufferWidth","drawingBufferHeight","frameData","getFrameData","leftMVMatrix","leftViewMatrix","rightMVMatrix","rightViewMatrix","mat4","_yawOffset","viewport","leftProjectionMatrix","rightProjectionMatrix","addEndCallback","callback","requestPresent","resolve","reject","getVRDisplays","displays","Error","capabilities","canPresent","leftEye","getEyeParameters","rightEye","renderWidth","renderHeight","_setDisplay","setYawOffset","layers","getLayers","layer","_leftBounds","leftBounds","_rightBounds","rightBounds","XR_REFERENCE_SPACE","XRManager","_xrSession","xrSession","end","frame","pose","getViewerPose","_xrRefSpace","session","baseLayer","renderState","framebuffer","glLayer","views","view","getViewport","transform","matrix","projectionMatrix","_presenting","requestSession","requiredFeatures","xrLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","refSpace","_setSession","_xrLayer","WebGLAnimator","_onLoop","_callback","_rafId","_context","requestAnimationFrame","_onLoopNextTick","before","performance","now","diff","_rafTimer","setCallback","setContext","start","stop","cancelAnimationFrame","ImageType","DEVICE_PIXEL_RATIO","BIND_TEXTURE","IMAGE_LOADED","RENDERING_CONTEXT_RESTORE","RENDERER_ERROR","PanoImageRenderer","isVideo","sphericalConfig","renderingContextAttributes","_renderStereo","time","vr","_vr","eyeParams","eyeIndex","eyeParam","uniform1f","uEye","_bindBuffers","_draw","exitVR","animator","_animator","_restoreStyle","updateViewportDimensions","_updateViewport","_shouldForceDraw","_render","_onFirstVRFrame","minusZDir","mat3","mvInv","pInv","yawOffset","fieldOfView","_lastQuaternion","_lastYaw","_lastPitch","_lastFieldOfView","textureCoordBuffer","vertexBuffer","_initCanvas","_setDefaultCanvasStyle","_wrapper","_wrapperOrigStyle","_renderingContextAttributes","_imageConfig","_imageIsReady","_keepUpdate","_onContentLoad","_onContentError","setImage","imageType","cubemapConfig","setYawPitchControl","yawPitchControl","_yawPitchControl","getContent","_isVideo","_setImageType","_contentLoader","_imageType","_isCubeMap","_renderer","stereoFormat","_initWebGL","_onWebglcontextlost","_onWebglcontextrestored","bottom","left","right","top","margin","maxHeight","maxWidth","outline","position","_triggerContentLoad","content","projectionType","isImageLoaded","_bindTexture","attachTo","parentElement","detach","forceContextLoss","hasRenderingContext","removeChild","isContextLost","_initShaderProgram","renderer","vsSource","fsSource","VERTEX_SHADER","FRAGMENT_SHADER","getError","useProgram","vertexPositionAttribute","getAttribLocation","samplerUniform","textureCoordAttribute","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","uniform1i","preventDefault","updateFieldOfView","viewPortChanged","h","_initRenderingContext","clearColor","deleteTexture","CULL_FACE","WebGLRenderingContext","_initBuffers","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","Uint16Array","isEAC","_updateTexture","keepUpdate","doUpdate","startRender","stopRender","renderWithQuaternion","renderWithYawPitch","getProjectionRenderer","enterVR","_Promise","_requestPresent","_setWrapperFullscreen","wrapper","getAttribute","wrapperStyle","zIndex","removeAttribute","PanoViewer","container","_container","_projectionType","_cubemapConfig","_width","_height","_yaw","_pitch","_fov","_gyroMode","_aspectRatio","_isValidTouchDirection","yawPitchConfig","_isReady","_initYawPitchControl","_initRenderer","getVideo","_photoSphereRenderer","setVideo","getImage","warn","_deactivate","getProjectionType","enableSensor","requestPermission","permissionState","disableSensor","initialYaw","initialPitch","_bindRendererHandler","_activate","_triggerEvent","_updateYawPitchIfNeeded","ProjectionType","yawSize","maxFov","atan","minFov","setUseZoom","setUseKeyboard","setGyroMode","setFovRange","getFovRange","containerSize","_getHFov","getYaw","getPitch","getYawRange","getPitchRange","setYawRange","setPitchRange","setShowPolePoint","verticalAngleOfImage","TOUCH_DIRECTION","YAW","PITCH","ALL","setTouchDirection","getTouchDirection","isSupported","onDeviceMotionChange","checkGyro","timeout","race","fb"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;EAQA,CAAC,UAAU,MAAM,EAAE,OAAO,EAAE;GAC3B,AAA+D,cAAc,GAAG,OAAO,EAAE,AAE1D,CAAC;GAChC,CAACA,cAAI,GAAG,YAAY;EAErB,SAAS,gBAAgB,CAAC,CAAC,EAAE;IAC3B,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CAAC,CAAC;GACjE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e,CAAC/M,oBAVE;;EAWxB;;;;;;;;;EASAi8B,IAAAA,GAAG,EAAElvB,eAAe,CAAC9M,mBApBG;;EAqBxB;;;;;;;;;EASAi8B,IAAAA,KAAK,EAAEnvB,eAAe,CAAC7M,qBA9BC;;EA+BxB;;;;;;;;;EASAi8B,IAAAA,GAAG,EAAEpvB,eAAe,CAAC5M;EAxCG;WA1BpBu4B;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/PanoViewer/view360.panoviewer.pkgd.min.js b/dist/PanoViewer/view360.panoviewer.pkgd.min.js new file mode 100644 index 000000000..3c0ad1a39 --- /dev/null +++ b/dist/PanoViewer/view360.panoviewer.pkgd.min.js @@ -0,0 +1,11 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +All-in-one packaged file for ease use of '@egjs/view360' with below dependencies. +- @egjs/agent ^2.2.1, @egjs/axes ^2.7.1, @egjs/component ^2.1.2, es6-promise ^4.2.5, gl-matrix ^3.1.0, motion-sensors-polyfill ^0.3.1, webvr-polyfill ^0.9.41 +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t.eg=t.eg||{},t.eg.view360={}))}(this,function(t){"use strict";function n(t,e){for(var i=0;i=Ut(e)?t<0?oe:se:e<0?ae:he}function be(t,e,i){return{x:e/t||0,y:i/t||0}}function Re(t,e){var i=t.session,n=e.pointers,r=n.length;i.firstInput||(i.firstInput=we(e)),1Ut(y.y)?y.x:y.y,e.scale=f?(v=f.pointers,xe((m=n)[0],m[1],de)/xe(v[0],v[1],de)):1,e.rotation=f?(g=f.pointers,Ee((_=n)[1],_[0],de)+Ee(g[1],g[0],de)):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,n,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==ne&&(teUt(c.y)?c.x:c.y,o=Te(h,u),t.lastInterval=e}else i=s.velocity,n=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=i,e.velocityX=n,e.velocityY=r,e.direction=o}(i,e);var w,x=t.element,E=e.srcEvent;_e(w=E.composedPath?E.composedPath()[0]:E.path?E.path[0]:E.target,x)&&(x=w),e.target=x}function Pe(t,e,i){var n=i.pointers.length,r=i.changedPointers.length,o=e&ee&&n-r==0,s=e&(ie|ne)&&n-r==0;i.isFirst=!!o,i.isFinal=!!s,o&&(t.session={}),i.eventType=e,Re(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function Ae(t){return t.trim().split(/\s+/g)}function Ce(e,t,i){pe(Ae(t),function(t){e.addEventListener(t,i,!1)})}function Ie(e,t,i){pe(Ae(t),function(t){e.removeEventListener(t,i,!1)})}function Oe(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var Se=function(){function t(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){ve(e.options.enable,[e])&&i.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&Ce(this.element,this.evEl,this.domHandler),this.evTarget&&Ce(this.target,this.evTarget,this.domHandler),this.evWin&&Ce(Oe(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&Ie(this.element,this.evEl,this.domHandler),this.evTarget&&Ie(this.target,this.evTarget,this.domHandler),this.evWin&&Ie(Oe(this.element),this.evWin,this.domHandler)},t}();function De(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;ne[i]}):n.sort()),n}var Qe={touchstart:ee,touchmove:2,touchend:ie,touchcancel:ne},ke=function(e){function i(){var t;return i.prototype.evTarget="touchstart touchmove touchend touchcancel",(t=e.apply(this,arguments)||this).targetIds={},t}return Ot(i,e),i.prototype.handler=function(t){var e=Qe[t.type],i=function(t,e){var i,n,r=Ue(t.touches),o=this.targetIds;if(e&(2|ee)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=Ue(t.changedTouches),a=[],h=this.target;if(n=r.filter(function(t){return _e(t.target,h)}),e===ee)for(i=0;ie.threshold&&r&e.direction},e.attrTest=function(t){return $e.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=ti(t.direction);e&&(t.additionalEvent=this.options.event+e),i.prototype.emit.call(this,t)},t}($e),ii=function(i){function t(t){return void 0===t&&(t={}),i.call(this,It({event:"pinch",threshold:0,pointers:2},t))||this}Ot(t,i);var e=t.prototype;return e.getTouchAction=function(){return[Gt]},e.attrTest=function(t){return i.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},e.emit=function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}i.prototype.emit.call(this,t)},t}($e),ni={domEvents:!1,touchAction:Xt,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function ri(i,n){var r,o=i.element;o.style&&(pe(i.options.cssProps,function(t,e){r=Qt(o.style,e),n?(i.oldCssProps[r]=o.style[r],o.style[r]=t):o.style[r]=i.oldCssProps[r]||""}),n||(i.oldCssProps={}))}var oi=function(){function t(t,e){var i,n=this;this.options=Mt({},ni,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((i=this).options.inputClass||(Kt?Ne:Zt?ke:qt?je:Xe))(i,Pe),this.touchAction=new ge(this,this.options.touchAction),ri(this,!0),pe(this.options.recognizers,function(t){var e=n.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return Mt(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var i;this.touchAction.preventDefaults(t);var n=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",i=window.console&&(window.console.warn||window.console.log);return i&&i.call(window.console,r,e),n.apply(this,arguments)}}var ai=si(function(t,e,i){for(var n=Object.keys(e),r=0;re[1]}function Pi(t,e,i){return i[1]&&t>e[1]||i[0]&&t]*)>/)){var n=document.createElement("div");n.innerHTML=t,i=Ci(n.childNodes)}else i=Ci(document.querySelectorAll(t));e||(i=1<=i.length?i[0]:void 0)}else t===Ei?i=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in Ei&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return Ii(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t;return i}var Oi=(Ei="undefined"==typeof window?{navigator:{userAgent:""}}:window).requestAnimationFrame||Ei.webkitRequestAnimationFrame,Si=Ei.cancelAnimationFrame||Ei.webkitCancelAnimationFrame;if(Oi&&!Si){var Di={},Mi=Oi;Oi=function(e){var i=Mi(function(t){Di[i]&&e(t)});return Di[i]=!0,i},Si=function(t){delete Di[t]}}else Oi&&Si||(Oi=function(t){return Ei.setTimeout(function(){t(Ei.performance&&Ei.performance.now&&Ei.performance.now()||(new Date).getTime())},16)},Si=Ei.clearTimeout);function Li(t,e){var i={};for(var n in t)n&&(i[n]=e(t[n],n));return i}function Fi(t,e){var i={};for(var n in t)n&&e(t[n],n)&&(i[n]=t[n]);return i}function Vi(t,e){for(var i in t)if(i&&!e(t[i],i))return!1;return!0}function Ni(t,i){return Vi(t,function(t,e){return t===i[e]})}var Ui={};function zi(t,e){var i,n;return Ui[e]||(Ui[e]=(n=(i=e)<1?Math.pow(10,ki(i)):1,function(t){return 0===i?0:Math.round(Math.round(t/i)*i*n)/n})),Ui[e](t)}function Qi(t,i){if(!t||!i)return t;var n="number"==typeof i;return Li(t,function(t,e){return zi(t,n?i:i[e])})}function ki(t){if(!isFinite(t))return 0;var e=t+"";if(0<=e.indexOf("e")){for(var i=0,n=1;Math.round(t*n)/n!==t;)n*=10,i++;return i}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function Wi(t,e,i){return Math.max(Math.min(t,i),e)}var Xi,Yi=function(){function t(t){var e=t.options,i=t.itm,n=t.em,r=t.axm;this.options=e,this.itm=i,this.em=n,this.axm=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(o,t,e){var i,s=this;if(void 0!==e)i=e;else{var n=Li(t,function(t,e){return i=Math.abs(t-o[e]),n=s.options.deceleration,(r=Math.sqrt(i/n*2))<100?0:r;var i,n,r});i=Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)}return Wi(i,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,i){var n=this.axm.get(),r=t,o=i&&i.event||null;return{depaPos:n,destPos:r,duration:Wi(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(n,r),inputEvent:o,input:i&&i.input||null,isTrusted:!!o,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var i=this.axm.get(t),n=this.axm.map(i,function(t,e){return Ai(t,e.range,e.circular)});Vi(n,function(t,e){return i[e]===t})||this.em.triggerChange(n,!1,i,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,Si(r)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var r},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axm.get(),i=this.axm.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.animateTo(i,this.getDuration(e,i),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e){return Pi(t,e.range,e.circular)});0=i[e]-1e-6&&t<=i[e]+1e-6?i[e]:zi(t,n.getRoundUnit(t,e))})},e.getRoundUnit=function(t,e){var i,n=this.options.round,r=null;if(!n){var o=this.axm.getAxisOptions(e);i=Math.max(ki(o.range[0]),ki(o.range[1]),ki(t)),r=1/Math.pow(10,i)}return r||n},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=Wi(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,i){var n=this,r=this.createAnimationParam(t,e,i),o=Ti({},r.depaPos),s=this.em.triggerAnimationStart(r),a=this.getUserControll(r);if(!s&&this.axm.every(a.destPos,function(t,e){return Pi(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),s&&!Ni(a.destPos,o)){var h=i&&i.event||null;this.animateLoop({depaPos:o,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(o,a.destPos),isTrusted:!!h,inputEvent:h,input:i&&i.input||null},function(){return n.animationEnd()})}},e.easing=function(t){return 1window.innerWidth-e,this.panFlag=!0}}else t.isFinal&&this.onPanend(t)},e.onPanmove=function(t){var e=this;if(this.panFlag){var i=function(t,e){if(e<0||90Math.abs(t.z)?pn.set(-t.y,t.x,0):pn.set(0,-t.z,t.y)):pn.crossVectors(t,e),this.x=pn.x,this.y=pn.y,this.z=pn.z,this.w=vn,this.normalize(),this}};var gn,_n,yn,wn,xn,En,Tn,bn,Rn,Pn=mn,An=window.Util||{};function Cn(t,e,i,n,r){var o,s,a,h,u,c,l,f,d,p;o=t,s=n?n.fieldOfView:null,a=r.depthNear,h=r.depthFar,u=Math.tan(s?s.upDegrees*En:Tn),c=Math.tan(s?s.downDegrees*En:Tn),l=Math.tan(s?s.leftDegrees*En:Tn),f=Math.tan(s?s.rightDegrees*En:Tn),d=2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=J=e)[0],et=$[1],it=$[2],nt=$[3],rt=$[4],ot=$[5],st=$[6],at=$[7],ht=$[8],ut=$[9],ct=$[10],lt=$[11],ft=$[12],dt=$[13],pt=$[14],vt=$[15],(Ct=(mt=tt*ot-et*rt)*(At=ct*vt-lt*pt)-(gt=tt*st-it*rt)*(Pt=ut*vt-lt*dt)+(_t=tt*at-nt*rt)*(Rt=ut*pt-ct*dt)+(yt=et*st-it*ot)*(bt=ht*vt-lt*ft)-(wt=et*at-nt*ot)*(Tt=ht*pt-ct*ft)+(xt=it*at-nt*st)*(Et=ht*dt-ut*ft))&&(Ct=1/Ct,J[0]=(ot*At-st*Pt+at*Rt)*Ct,J[1]=(it*Pt-et*At-nt*Rt)*Ct,J[2]=(dt*xt-pt*wt+vt*yt)*Ct,J[3]=(ct*wt-ut*xt-lt*yt)*Ct,J[4]=(st*bt-rt*At-at*Tt)*Ct,J[5]=(tt*At-it*bt+nt*Tt)*Ct,J[6]=(pt*_t-ft*xt-vt*gt)*Ct,J[7]=(ht*xt-ct*_t+lt*gt)*Ct,J[8]=(rt*Pt-ot*bt+at*Et)*Ct,J[9]=(et*bt-tt*Pt-nt*Et)*Ct,J[10]=(ft*wt-dt*_t+vt*mt)*Ct,J[11]=(ut*_t-ht*wt-lt*mt)*Ct,J[12]=(ot*Tt-rt*Rt-st*Et)*Ct,J[13]=(tt*Rt-et*Tt+it*Et)*Ct,J[14]=(dt*gt-ft*yt-pt*mt)*Ct,J[15]=(ht*yt-ut*gt+ct*mt)*Ct)}An.MIN_TIMESTEP=.001,An.MAX_TIMESTEP=1,An.base64=function(t,e){return"data:"+t+";base64,"+e},An.clamp=function(t,e,i){return Math.min(Math.max(e,t),i)},An.lerp=function(t,e,i){return t+(e-t)*i},An.race=function(n){return Promise.race?Promise.race(n):new Promise(function(t,e){for(var i=0;iAn.MAX_TIMESTEP))},An.getScreenWidth=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},An.getScreenHeight=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},An.requestFullscreen=function(t){if(An.isWebViewAndroid())return!1;if(t.requestFullscreen)t.requestFullscreen();else if(t.webkitRequestFullscreen)t.webkitRequestFullscreen();else if(t.mozRequestFullScreen)t.mozRequestFullScreen();else{if(!t.msRequestFullscreen)return!1;t.msRequestFullscreen()}return!0},An.exitFullscreen=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},An.getFullscreenElement=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},An.linkProgram=function(t,e,i,n){var r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);var o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,i),t.compileShader(o);var s=t.createProgram();for(var a in t.attachShader(s,r),t.attachShader(s,o),n)t.bindAttribLocation(s,n[a],a);return t.linkProgram(s),t.deleteShader(r),t.deleteShader(o),s},An.getProgramUniforms=function(t,e){for(var i={},n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r="",o=0;os[1]&&(h=s[1]),a!==h&&(i.setTo({fov:h},0),this._updateControlScale(),this.updatePanScale())}t.some(function(t){return"gyroMode"===t})&&Rt&&(this.axesTiltMotionInput&&(this.axes.disconnect(this.axesTiltMotionInput),this.axesTiltMotionInput.destroy(),this.axesTiltMotionInput=null),this._deviceQuaternion&&(this._deviceQuaternion.destroy(),this._deviceQuaternion=null),n?this._initDeviceQuaternion():r&&(this.axesTiltMotionInput=new jn(this._element),this.axes.connect(["yaw","pitch"],this.axesTiltMotionInput)),this.axesPanInput.setUseRotation(n)),t.some(function(t){return"useKeyboard"===t})&&(e.useKeyboard?i.connect(["yaw","pitch"],this.axesMoveKeyInput):i.disconnect(this.axesMoveKeyInput));if(t.some(function(t){return"useZoom"===t})){var u=e.useZoom;i.disconnect(this.axesWheelInput),u&&i.connect(["fov"],this.axesWheelInput)}this._togglePinchInputByOption(e.touchDirection,e.useZoom),t.some(function(t){return"touchDirection"===t})&&this._enabled&&this._enableTouch(o)},t._togglePinchInputByOption=function(t,e){this.axesPinchInput&&(this.axes.disconnect(this.axesPinchInput),e&&6===t&&-1===this.axes._inputs.indexOf(this.axesPinchInput)&&this.axes.connect(["fov"],this.axesPinchInput))},t._enableTouch=function(t){this.axesPanInput&&this.axes.disconnect(this.axesPanInput);var e=2&t?"yaw":null,i=4&t?"pitch":null;this.axes.connect([e,i],this.axesPanInput)},t._initDeviceQuaternion=function(){var e=this;this._deviceQuaternion=new $n,this._deviceQuaternion.on("change",function(t){e._triggerChange(t)})},t._getValidYawRange=function(t,e,i){var n=h.adjustAspectRatio(i||this.options.aspectRatio||1),r=(e||this.axes.get().fov)*n;return t[1]-t[0]>=r?t:this.options.yawRange||er},t._getValidPitchRange=function(t,e){var i=e||this.axes.get().fov;return t[1]-t[0]>=i?t:this.options.pitchRange||ir},h.isCircular=function(t){return t[1]-t[0]<360?[!1,!1]:[!0,!0]},t._updateControlScale=function(t){var e=this.options,i=this.axes.get().fov,n=this._updatePitchRange(e.pitchRange,i,e.showPolePoint),r=this._updateYawRange(e.yawRange,i,e.aspectRatio),o=this.axes.get(),s=o.yaw,a=o.pitch;return K(this.axes.axis.yaw.range,r),K(this.axes.axis.pitch.range,n),this.axes.axis.yaw.circular=h.isCircular(r),this.axes.axis.pitch.circular=h.isCircular(n),sr[1]&&(s=r[1]),an[1]&&(a=n[1]),t&&t.set({yaw:s,pitch:a}),this.axes.setTo({yaw:s,pitch:a},0),this},t._updatePitchRange=function(t,e,i){if(this.options.gyroMode===Qn.VR)return nr;var n=t[1]-t[0],r=e/2;return i&&!(n<180)?t.concat():[t[0]+r,t[1]-r]},t._updateYawRange=function(t,e,i){if(this.options.gyroMode===Qn.VR)return er;if(360<=t[1]-t[0])return t.concat();var n=ln.toDegree(Math.atan2(i,1/Math.tan(w(e/2))));return[t[0]+n,t[1]-n]},t._triggerChange=function(t){var e=this.axes.get(),i=this.options,n={targetElement:i.element,isTrusted:t.isTrusted};n.yaw=e.yaw,n.pitch=e.pitch,n.fov=e.fov,i.gyroMode===Qn.VR&&this._deviceQuaternion&&(n.quaternion=this._deviceQuaternion.getCombinedQuaternion(e.yaw)),this.trigger("change",n)},h.adjustAspectRatio=function(t){for(var e=[.52,.54,.563,.57,.584,.59,.609,.67,.702,.72,.76,.78,.82,.92,.97,1,1.07,1.14,1.19,1.25,1.32,1.38,1.4,1.43,1.53,1.62,1.76,1.77,1.86,1.96,2.26,2.3,2.6,3,5,6],i=[.51,.54,.606,.56,.628,.63,.647,.71,.736,.757,.78,.77,.8,.89,.975,1,1.07,1.1,1.15,1.18,1.22,1.27,1.3,1.33,1.39,1.45,1.54,1.55,1.58,1.62,1.72,1.82,1.92,2,2.24,2.3],n=-1,r=0;r=this._sourceCount&&(this._loadStatus=vr,this._detachErrorHandler(this._onerror))},e._appendSourceElement=function(t){var e,i;if("object"==typeof t?(e=t.src,i=t.type):"string"==typeof t&&(e=t),!e)return!1;var n=document.createElement("source");return n.src=e,i&&(n.type=i),this._video.appendChild(n),!0},e.set=function(t){var e=this;this._reset(),t&&(t instanceof HTMLVideoElement?this._video=t:"string"!=typeof t&&"object"!=typeof t||(this._video=document.createElement("video"),this._video.setAttribute("crossorigin","anonymous"),this._video.setAttribute("webkit-playsinline",""),this._video.setAttribute("playsinline",""),t instanceof Array?t.forEach(function(t){return e._appendSourceElement(t)}):this._appendSourceElement(t),this._sourceCount=this._video.querySelectorAll("source").length,0=i._thresholdReadyState)t(i._video);else{i._attachErrorHandler(function t(){i._loadStatus===vr&&(i._detachErrorHandler(t),e("VideoLoader: video source is invalid"))}),i._once(i._thresholdEventName,function(){return t(i._video)})}else e("VideoLoader: video is undefined")})},e.getElement=function(){return this._video},e.destroy=function(){this._reset()},e._reset=function(){var e=this;this._handlers.forEach(function(t){e._video.removeEventListener(t.type,t.fn)}),this._handlers=[],this._video=null,this._sourceCount=0,this._errorCount=0},e._once=function(e,i){function n(t){r.removeEventListener(e,n),i(t)}var r=this._video;r.addEventListener(e,n,!0),this._handlers.push({type:e,fn:n})},t}(),wr={0:"NO_ERROR",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",37442:"CONTEXT_LOST_WEBGL"},xr=null,Er=function(){function n(){}return n.createShader=function(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:(console.error(t.getShaderInfoLog(n)),null)},n.createProgram=function(t,e,i){var n=t.createProgram();return t.attachShader(n,e),t.attachShader(n,i),t.linkProgram(n),t.detachShader(n,e),t.detachShader(n,i),t.deleteShader(e),t.deleteShader(i),t.getProgramParameter(n,t.LINK_STATUS)?n:(t.deleteProgram(n),null)},n.initBuffer=function(t,e,i,n,r){var o=t.createBuffer();return t.bindBuffer(e,o),t.bufferData(e,i,t.STATIC_DRAW),o&&(o.itemSize=n,o.numItems=i.length/n),void 0!==r&&(t.enableVertexAttribArray(r),t.vertexAttribPointer(r,o.itemSize,t.FLOAT,!1,0,0)),o},n.getWebglContext=function(t,e){var i=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=null,r=u({preserveDrawingBuffer:!1,antialias:!1,xrCompatible:!0},e);function o(t){return t.statusMessage}t.addEventListener("webglcontextcreationerror",o);for(var s=0;s= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"},i.getVertexPositionData=function(){return this._vertices||(this._vertices=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1]),this._vertices},i.getIndexData=function(){var i=this;return function(){for(var t=[],e=0;e postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n//# sourceMappingURL=es6-promise.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/component project is licensed under the MIT license\n\n@egjs/component JavaScript library\nhttps://naver.github.io/egjs-component\n\n@version 2.1.2\n*/\n/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\n/**\n * A class used to manage events in a component\n * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스\n * @alias eg.Component\n */\n\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Component.VERSION; // ex) 2.0.0\n * @memberof eg.Component\n */\n\n /**\n * @support {\"ie\": \"7+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n */\n function Component() {\n this._eventHandler = {};\n this.options = {};\n }\n /**\n * Triggers a custom event.\n * @ko 커스텀 이벤트를 발생시킨다\n * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름\n * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터\n * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고\n * @example\n class Some extends eg.Component {\n some(){\n \tif(this.trigger(\"beforeHi\")){ // When event call to stop return false.\n \tthis.trigger(\"hi\");// fire hi event.\n \t}\n }\n }\n const some = new Some();\n some.on(\"beforeHi\", (e) => {\n if(condition){\n \te.stop(); // When event call to stop, `hi` event not call.\n }\n });\n some.on(\"hi\", (e) => {\n // `currentTarget` is component instance.\n console.log(some === e.currentTarget); // true\n });\n // If you want to more know event design. You can see article.\n // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F\n */\n\n\n var _proto = Component.prototype;\n\n _proto.trigger = function trigger(eventName, customEvent) {\n if (customEvent === void 0) {\n customEvent = {};\n }\n\n var handlerList = this._eventHandler[eventName] || [];\n var hasHandlerList = handlerList.length > 0;\n\n if (!hasHandlerList) {\n return true;\n } // If detach method call in handler in first time then handler list calls.\n\n\n handlerList = handlerList.concat();\n customEvent.eventType = eventName;\n var isCanceled = false;\n var arg = [customEvent];\n var i = 0;\n\n customEvent.stop = function () {\n isCanceled = true;\n };\n\n customEvent.currentTarget = this;\n\n for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n restParam[_key - 2] = arguments[_key];\n }\n\n if (restParam.length >= 1) {\n arg = arg.concat(restParam);\n }\n\n for (i = 0; handlerList[i]; i++) {\n handlerList[i].apply(this, arg);\n }\n\n return !isCanceled;\n };\n /**\n * Executed event just one time.\n * @ko 이벤트가 한번만 실행된다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n alert(\"hi\");\n }\n thing() {\n this.once(\"hi\", this.hi);\n }\n }\n var some = new Some();\n some.thing();\n some.trigger(\"hi\");\n // fire alert(\"hi\");\n some.trigger(\"hi\");\n // Nothing happens\n */\n\n\n _proto.once = function once(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var i;\n\n for (i in eventHash) {\n this.once(i, eventHash[i]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var self = this;\n this.on(eventName, function listener() {\n for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arg[_key2] = arguments[_key2];\n }\n\n handlerToAttach.apply(self, arg);\n self.off(eventName, listener);\n });\n }\n\n return this;\n };\n /**\n * Checks whether an event has been attached to a component.\n * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다.\n * @param {String} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름\n * @return {Boolean} Indicates whether the event is attached. 이벤트 등록 여부\n * @example\n class Some extends eg.Component {\n some() {\n this.hasOn(\"hi\");// check hi event.\n }\n }\n */\n\n\n _proto.hasOn = function hasOn(eventName) {\n return !!this._eventHandler[eventName];\n };\n /**\n * Attaches an event to a component.\n * @ko 컴포넌트에 이벤트를 등록한다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.on(\"hi\",this.hi); //attach event\n }\n }\n */\n\n\n _proto.on = function on(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.on(name, eventHash[name]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var handlerList = this._eventHandler[eventName];\n\n if (isUndefined(handlerList)) {\n this._eventHandler[eventName] = [];\n handlerList = this._eventHandler[eventName];\n }\n\n handlerList.push(handlerToAttach);\n }\n\n return this;\n };\n /**\n * Detaches an event from the component.\n * @ko 컴포넌트에 등록된 이벤트를 해제한다\n * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름\n * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.off(\"hi\",this.hi); //detach event\n }\n }\n */\n\n\n _proto.off = function off(eventName, handlerToDetach) {\n // All event detach.\n if (isUndefined(eventName)) {\n this._eventHandler = {};\n return this;\n } // All handler of specific event detach.\n\n\n if (isUndefined(handlerToDetach)) {\n if (typeof eventName === \"string\") {\n this._eventHandler[eventName] = undefined;\n return this;\n } else {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.off(name, eventHash[name]);\n }\n\n return this;\n }\n } // The handler of specific event detach.\n\n\n var handlerList = this._eventHandler[eventName];\n\n if (handlerList) {\n var k;\n var handlerFunction;\n\n for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) {\n if (handlerFunction === handlerToDetach) {\n handlerList = handlerList.splice(k, 1);\n break;\n }\n }\n }\n\n return this;\n };\n\n return Component;\n }();\n\n Component.VERSION = \"2.1.2\";\n return Component;\n}();\n\nexport default Component;\n//# sourceMappingURL=component.esm.js.map\n","/**\r\n * Common utilities\r\n * @module glMatrix\r\n */\n// Configuration Constants\nexport var EPSILON = 0.000001;\nexport var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nexport var RANDOM = Math.random;\n/**\r\n * Sets the type of array used when creating new vectors and matrices\r\n *\r\n * @param {Type} type Array type, such as Float32Array or Array\r\n */\n\nexport function setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\n/**\r\n * Convert Degree To Radian\r\n *\r\n * @param {Number} a Angle in Degrees\r\n */\n\nexport function toRadian(a) {\n return a * degree;\n}\n/**\r\n * Tests whether or not the arguments have approximately the same value, within an absolute\r\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\r\n * than or equal to 1.0, and a relative tolerance is used for larger values)\r\n *\r\n * @param {Number} a The first number to test.\r\n * @param {Number} b The second number to test.\r\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\nif (!Math.hypot) Math.hypot = function () {\n var y = 0,\n i = arguments.length;\n\n while (i--) {\n y += arguments[i] * arguments[i];\n }\n\n return Math.sqrt(y);\n};","import * as glMatrix from \"./common.js\";\n/**\r\n * 3x3 Matrix\r\n * @module mat3\r\n */\n\n/**\r\n * Creates a new identity mat3\r\n *\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(9);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the upper-left 3x3 values into the given mat3.\r\n *\r\n * @param {mat3} out the receiving 3x3 matrix\r\n * @param {mat4} a the source 4x4 matrix\r\n * @returns {mat3} out\r\n */\n\nexport function fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\r\n * Creates a new mat3 initialized with values from an existing matrix\r\n *\r\n * @param {mat3} a matrix to clone\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Copy the values from one mat3 to another\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Create a new mat3 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} A new mat3\r\n */\n\nexport function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set the components of a mat3 to the given values\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} out\r\n */\n\nexport function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set a mat3 to the identity matrix\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @returns {mat3} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b01 = a22 * a11 - a12 * a21;\n var b11 = -a22 * a10 + a12 * a20;\n var b21 = a21 * a10 - a11 * a20; // Calculate the determinant\n\n var det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\r\n * Calculates the determinant of a mat3\r\n *\r\n * @param {mat3} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n}\n/**\r\n * Multiplies two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b00 = b[0],\n b01 = b[1],\n b02 = b[2];\n var b10 = b[3],\n b11 = b[4],\n b12 = b[5];\n var b20 = b[6],\n b21 = b[7],\n b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\r\n * Translate a mat3 by the given vector\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to translate\r\n * @param {vec2} v vector to translate by\r\n * @returns {mat3} out\r\n */\n\nexport function translate(out, a, v) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n x = v[0],\n y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\r\n * Rotates a mat3 by the given angle\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function rotate(out, a, rad) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n;\n/**\r\n * Scales the mat3 by the dimensions in the given vec2\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {vec2} v the vec2 to scale the matrix by\r\n * @returns {mat3} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Translation vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function fromRotation(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Scaling vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the values from a mat2d into a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat2d} a the matrix to copy\r\n * @returns {mat3} out\r\n **/\n\nexport function fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\r\n* Calculates a 3x3 matrix from the given quaternion\r\n*\r\n* @param {mat3} out mat3 receiving operation result\r\n* @param {quat} q Quaternion to create matrix from\r\n*\r\n* @returns {mat3} out\r\n*/\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\r\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n*\r\n* @param {mat3} out mat3 receiving operation result\r\n* @param {mat4} a Mat4 to derive the normal matrix from\r\n*\r\n* @returns {mat3} out\r\n*/\n\nexport function normalFromMat4(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\r\n * Generates a 2D projection matrix with the given bounds\r\n *\r\n * @param {mat3} out mat3 frustum matrix will be written into\r\n * @param {number} width Width of your gl context\r\n * @param {number} height Height of gl context\r\n * @returns {mat3} out\r\n */\n\nexport function projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Returns a string representation of a mat3\r\n *\r\n * @param {mat3} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n}\n/**\r\n * Returns Frobenius norm of a mat3\r\n *\r\n * @param {mat3} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);\n}\n/**\r\n * Adds two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\r\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat3} out the receiving vector\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7],\n a8 = a[8];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));\n}\n/**\r\n * Alias for {@link mat3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied.\r\n * @module mat4\r\n */\n\n/**\r\n * Creates a new identity mat4\r\n *\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 initialized with values from an existing matrix\r\n *\r\n * @param {mat4} a matrix to clone\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Copy the values from one mat4 to another\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Create a new mat4 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} A new mat4\r\n */\n\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set the components of a mat4 to the given values\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} out\r\n */\n\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set a mat4 to the identity matrix\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @returns {mat4} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\r\n * Calculates the determinant of a mat4\r\n *\r\n * @param {mat4} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\r\n * Multiplies two mat4s\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\r\n * Translate a mat4 by the given vector\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to translate\r\n * @param {vec3} v vector to translate by\r\n * @returns {mat4} out\r\n */\n\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\r\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {vec3} v the vec3 to scale the matrix by\r\n * @returns {mat4} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Rotates a mat4 by the given angle around the given axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the X axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Y axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Z axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 from a dual quat.\r\n *\r\n * @param {mat4} out Matrix\r\n * @param {quat2} a Dual Quaternion\r\n * @returns {mat4} mat4 receiving operation result\r\n */\n\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion paramter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @param {quat} out Quaternion to receive the rotation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {quat} out\r\n */\n\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @param {vec3} o The origin vector around which to scale and rotate\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat} q Quaternion to create matrix from\r\n *\r\n * @returns {mat4} out\r\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a frustum matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Number} left Left bound of the frustum\r\n * @param {Number} right Right bound of the frustum\r\n * @param {Number} bottom Bottom bound of the frustum\r\n * @param {Number} top Top bound of the frustum\r\n * @param {Number} near Near bound of the frustum\r\n * @param {Number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} fovy Vertical field of view in radians\r\n * @param {number} aspect Aspect ratio. typically viewport width/height\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum, can be null or Infinity\r\n * @returns {mat4} out\r\n */\n\nexport function perspective(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given field of view.\r\n * This is primarily useful for generating projection matrices to be used\r\n * with the still experiemental WebVR API.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\r\n * Generates a orthogonal projection matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} left Left bound of the frustum\r\n * @param {number} right Right bound of the frustum\r\n * @param {number} bottom Bottom bound of the frustum\r\n * @param {number} top Top bound of the frustum\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\r\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a matrix that makes something look at something else.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n;\n/**\r\n * Returns a string representation of a mat4\r\n *\r\n * @param {mat4} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n}\n/**\r\n * Returns Frobenius norm of a mat4\r\n *\r\n * @param {mat4} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\r\n * Adds two mat4's\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat4} out the receiving vector\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\r\n * Alias for {@link mat4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 3 Dimensional Vector\r\n * @module vec3\r\n */\n\n/**\r\n * Creates a new, empty vec3\r\n *\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n *\r\n * @param {vec3} a vector to clone\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Calculates the length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Creates a new vec3 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Copy the values from one vec3 to another\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the source vector\r\n * @returns {vec3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Set the components of a vec3 to the given values\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} out\r\n */\n\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Adds two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\r\n * Multiplies two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\r\n * Divides two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to ceil\r\n * @returns {vec3} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to floor\r\n * @returns {vec3} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\r\n * Math.round the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to round\r\n * @returns {vec3} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\r\n * Scales a vec3 by a scalar number\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec3} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec3} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Calculates the squared length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Negates the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to negate\r\n * @returns {vec3} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to invert\r\n * @returns {vec3} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\r\n * Normalize a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to normalize\r\n * @returns {vec3} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\r\n * Computes the cross product of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\r\n * Performs a hermite interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Performs a bezier interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec3} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat3.\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat3} m the 3x3 matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\r\n * Rotate a 3D vector around the x-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateX(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(c) - p[2] * Math.sin(c);\n r[2] = p[1] * Math.sin(c) + p[2] * Math.cos(c); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the y-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateY(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(c) + p[0] * Math.cos(c);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(c) - p[0] * Math.sin(c); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the z-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateZ(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(c) - p[1] * Math.sin(c);\n r[1] = p[0] * Math.sin(c) + p[1] * Math.cos(c);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Get the angle between two 3D vectors\r\n * @param {vec3} a The first operand\r\n * @param {vec3} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var tempA = fromValues(a[0], a[1], a[2]);\n var tempB = fromValues(b[0], b[1], b[2]);\n normalize(tempA, tempA);\n normalize(tempB, tempB);\n var cosine = dot(tempA, tempB);\n\n if (cosine > 1.0) {\n return 0;\n } else if (cosine < -1.0) {\n return Math.PI;\n } else {\n return Math.acos(cosine);\n }\n}\n/**\r\n * Set the components of a vec3 to zero\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @returns {vec3} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec3} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\r\n * Alias for {@link vec3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec3.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec3.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec3.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec3.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec3.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec3s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 4 Dimensional Vector\r\n * @module vec4\r\n */\n\n/**\r\n * Creates a new, empty vec4\r\n *\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with values from an existing vector\r\n *\r\n * @param {vec4} a vector to clone\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function fromValues(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Copy the values from one vec4 to another\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the source vector\r\n * @returns {vec4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to the given values\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} out\r\n */\n\nexport function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Adds two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\r\n * Multiplies two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\r\n * Divides two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to ceil\r\n * @returns {vec4} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to floor\r\n * @returns {vec4} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\r\n * Math.round the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to round\r\n * @returns {vec4} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\r\n * Scales a vec4 by a scalar number\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec4} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\r\n * Adds two vec4's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec4} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Calculates the length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Negates the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to negate\r\n * @returns {vec4} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to invert\r\n * @returns {vec4} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\r\n * Normalize a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to normalize\r\n * @returns {vec4} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n *\r\n * @param {vec4} result the receiving vector\r\n * @param {vec4} U the first vector\r\n * @param {vec4} V the second vector\r\n * @param {vec4} W the third vector\r\n * @returns {vec4} result\r\n */\n\nexport function cross(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n;\n/**\r\n * Performs a linear interpolation between two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec4} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec4} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\r\n * Transforms the vec4 with a mat4.\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\r\n * Transforms the vec4 with a quat\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to zero\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @returns {vec4} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec4} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\r\n * Alias for {@link vec4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec4.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec4.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec4.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec4.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec4.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec4s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\nimport * as mat3 from \"./mat3.js\";\nimport * as vec3 from \"./vec3.js\";\nimport * as vec4 from \"./vec4.js\";\n/**\r\n * Quaternion\r\n * @module quat\r\n */\n\n/**\r\n * Creates a new identity quat\r\n *\r\n * @returns {quat} a new quaternion\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n out[3] = 1;\n return out;\n}\n/**\r\n * Set a quat to the identity quaternion\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @returns {quat} out\r\n */\n\nexport function identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {vec3} axis the axis around which to rotate\r\n * @param {Number} rad the angle in radians\r\n * @returns {quat} out\r\n **/\n\nexport function setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n}\n/**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as providied in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @param {vec3} out_axis Vector receiving the axis of rotation\r\n * @param {quat} q Quaternion to be decomposed\r\n * @return {Number} Angle, in radians, of the rotation\r\n */\n\nexport function getAxisAngle(out_axis, q) {\n var rad = Math.acos(q[3]) * 2.0;\n var s = Math.sin(rad / 2.0);\n\n if (s > glMatrix.EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n } else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n\n return rad;\n}\n/**\r\n * Gets the angular distance between two unit quaternions\r\n *\r\n * @param {quat} a Origin unit quaternion \r\n * @param {quat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\n\nexport function getAngle(a, b) {\n var dotproduct = dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n}\n/**\r\n * Multiplies two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {quat} out\r\n */\n\nexport function multiply(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the X axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateX(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateY(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var by = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bz = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n}\n/**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate W component of\r\n * @returns {quat} out\r\n */\n\nexport function calculateW(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n}\n/**\r\n * Calculate the exponential of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @returns {quat} out\r\n */\n\nexport function exp(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var et = Math.exp(w);\n var s = r > 0 ? et * Math.sin(r) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n}\n/**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @returns {quat} out\r\n */\n\nexport function ln(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n}\n/**\r\n * Calculate the scalar power of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @param {Number} b amount to scale the quaternion by\r\n * @returns {quat} out\r\n */\n\nexport function pow(out, a, b) {\n ln(out, a);\n scale(out, out, b);\n exp(out, out);\n return out;\n}\n/**\r\n * Performs a spherical linear interpolation between two quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n */\n\nexport function slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n var omega, cosom, sinom, scale0, scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > glMatrix.EPSILON) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n}\n/**\r\n * Generates a random unit quaternion\r\n * \r\n * @param {quat} out the receiving quaternion\r\n * @returns {quat} out\r\n */\n\nexport function random(out) {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n var u1 = glMatrix.RANDOM();\n var u2 = glMatrix.RANDOM();\n var u3 = glMatrix.RANDOM();\n var sqrt1MinusU1 = Math.sqrt(1 - u1);\n var sqrtU1 = Math.sqrt(u1);\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n}\n/**\r\n * Calculates the inverse of a quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate inverse of\r\n * @returns {quat} out\r\n */\n\nexport function invert(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n}\n/**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate conjugate of\r\n * @returns {quat} out\r\n */\n\nexport function conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to renormalize the quaternion yourself where necessary.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {mat3} m rotation matrix\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport function fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if (m[4] > m[0]) i = 1;\n if (m[8] > m[i * 3 + i]) i = 2;\n var j = (i + 1) % 3;\n var k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n\n return out;\n}\n/**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {x} Angle to rotate around X axis in degrees.\r\n * @param {y} Angle to rotate around Y axis in degrees.\r\n * @param {z} Angle to rotate around Z axis in degrees.\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport function fromEuler(out, x, y, z) {\n var halfToRad = 0.5 * Math.PI / 180.0;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n var sx = Math.sin(x);\n var cx = Math.cos(x);\n var sy = Math.sin(y);\n var cy = Math.cos(y);\n var sz = Math.sin(z);\n var cz = Math.cos(z);\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n return out;\n}\n/**\r\n * Returns a string representation of a quatenion\r\n *\r\n * @param {quat} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n}\n/**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n *\r\n * @param {quat} a quaternion to clone\r\n * @returns {quat} a new quaternion\r\n * @function\r\n */\n\nexport var clone = vec4.clone;\n/**\r\n * Creates a new quat initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {quat} a new quaternion\r\n * @function\r\n */\n\nexport var fromValues = vec4.fromValues;\n/**\r\n * Copy the values from one quat to another\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the source quaternion\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var copy = vec4.copy;\n/**\r\n * Set the components of a quat to the given values\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var set = vec4.set;\n/**\r\n * Adds two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var add = vec4.add;\n/**\r\n * Alias for {@link quat.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Scales a quat by a scalar number\r\n *\r\n * @param {quat} out the receiving vector\r\n * @param {quat} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var scale = vec4.scale;\n/**\r\n * Calculates the dot product of two quat's\r\n *\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {Number} dot product of a and b\r\n * @function\r\n */\n\nexport var dot = vec4.dot;\n/**\r\n * Performs a linear interpolation between two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var lerp = vec4.lerp;\n/**\r\n * Calculates the length of a quat\r\n *\r\n * @param {quat} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport var length = vec4.length;\n/**\r\n * Alias for {@link quat.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Calculates the squared length of a quat\r\n *\r\n * @param {quat} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n * @function\r\n */\n\nexport var squaredLength = vec4.squaredLength;\n/**\r\n * Alias for {@link quat.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Normalize a quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quaternion to normalize\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var normalize = vec4.normalize;\n/**\r\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {quat} a The first quaternion.\r\n * @param {quat} b The second quaternion.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport var exactEquals = vec4.exactEquals;\n/**\r\n * Returns whether or not the quaternions have approximately the same elements in the same position.\r\n *\r\n * @param {quat} a The first vector.\r\n * @param {quat} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport var equals = vec4.equals;\n/**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n *\r\n * @param {quat} out the receiving quaternion.\r\n * @param {vec3} a the initial vector\r\n * @param {vec3} b the destination vector\r\n * @returns {quat} out\r\n */\n\nexport var rotationTo = function () {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1, 0, 0);\n var yUnitVec3 = vec3.fromValues(0, 1, 0);\n return function (out, a, b) {\n var dot = vec3.dot(a, b);\n\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.len(tmpvec3) < 0.000001) vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return normalize(out, out);\n }\n };\n}();\n/**\r\n * Performs a spherical linear interpolation with two control points\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {quat} c the third operand\r\n * @param {quat} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n */\n\nexport var sqlerp = function () {\n var temp1 = create();\n var temp2 = create();\n return function (out, a, b, c, d, t) {\n slerp(temp1, a, d, t);\n slerp(temp2, b, c, t);\n slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n };\n}();\n/**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n *\r\n * @param {vec3} view the vector representing the viewing direction\r\n * @param {vec3} right the vector representing the local \"right\" direction\r\n * @param {vec3} up the vector representing the local \"up\" direction\r\n * @returns {quat} out\r\n */\n\nexport var setAxes = function () {\n var matr = mat3.create();\n return function (out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n return normalize(out, fromMat3(out, matr));\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 2 Dimensional Vector\r\n * @module vec2\r\n */\n\n/**\r\n * Creates a new, empty vec2\r\n *\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(2);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with values from an existing vector\r\n *\r\n * @param {vec2} a vector to clone\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function fromValues(x, y) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Copy the values from one vec2 to another\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the source vector\r\n * @returns {vec2} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Set the components of a vec2 to the given values\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} out\r\n */\n\nexport function set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Adds two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n/**\r\n * Multiplies two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n/**\r\n * Divides two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to ceil\r\n * @returns {vec2} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to floor\r\n * @returns {vec2} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n/**\r\n * Math.round the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to round\r\n * @returns {vec2} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n}\n/**\r\n * Scales a vec2 by a scalar number\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec2} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n/**\r\n * Adds two vec2's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec2} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x * x + y * y;\n}\n/**\r\n * Calculates the length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0],\n y = a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0],\n y = a[1];\n return x * x + y * y;\n}\n/**\r\n * Negates the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to negate\r\n * @returns {vec2} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to invert\r\n * @returns {vec2} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n/**\r\n * Normalize a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to normalize\r\n * @returns {vec2} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0],\n y = a[1];\n var len = x * x + y * y;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n}\n/**\r\n * Computes the cross product of two vec2's\r\n * Note that the cross product must by definition produce a 3D vector\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec2} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec2} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2d\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2d} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2d(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat3\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat3} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat4\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0];\n var y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n/**\r\n * Rotate a 2D vector\r\n * @param {vec2} out The receiving vec2\r\n * @param {vec2} a The vec2 point to rotate\r\n * @param {vec2} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec2} out\r\n */\n\nexport function rotate(out, a, b, c) {\n //Translate point to the origin\n var p0 = a[0] - b[0],\n p1 = a[1] - b[1],\n sinC = Math.sin(c),\n cosC = Math.cos(c); //perform rotation and translate to correct position\n\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n}\n/**\r\n * Get the angle between two 2D vectors\r\n * @param {vec2} a The first operand\r\n * @param {vec2} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var x1 = a[0],\n y1 = a[1],\n x2 = b[0],\n y2 = b[1];\n var len1 = x1 * x1 + y1 * y1;\n\n if (len1 > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len1 = 1 / Math.sqrt(len1);\n }\n\n var len2 = x2 * x2 + y2 * y2;\n\n if (len2 > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len2 = 1 / Math.sqrt(len2);\n }\n\n var cosine = (x1 * x2 + y1 * y2) * len1 * len2;\n\n if (cosine > 1.0) {\n return 0;\n } else if (cosine < -1.0) {\n return Math.PI;\n } else {\n return Math.acos(cosine);\n }\n}\n/**\r\n * Set the components of a vec2 to zero\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @returns {vec2} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec2} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec2(' + a[0] + ', ' + a[1] + ')';\n}\n/**\r\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1];\n var b0 = b[0],\n b1 = b[1];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));\n}\n/**\r\n * Alias for {@link vec2.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec2.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec2.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec2.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec2.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec2.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec2.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec2s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 2;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n\n return a;\n };\n}();","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","/*! Hammer.JS - v2.0.17-rc - 2019-12-16\n * http://naver.github.io/egjs\n *\n * Forked By Naver egjs\n * Copyright (c) hammerjs\n * Licensed under the MIT license */\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\n\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\nvar assign$1 = assign;\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = typeof document === \"undefined\" ? {\n style: {}\n} : document.createElement('div');\nvar TYPE_FUNCTION = 'function';\nvar round = Math.round,\n abs = Math.abs;\nvar now = Date.now;\n\n/**\n * @private\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n\nfunction prefixed(obj, property) {\n var prefix;\n var prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n\n i++;\n }\n\n return undefined;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {};\n} else {\n win = window;\n}\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\nfunction getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n\n var touchMap = {};\n var cssSupports = win.CSS && win.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n}\n\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\nvar TOUCH_ACTION_MAP = getTouchActionProps();\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\nvar SUPPORT_TOUCH = 'ontouchstart' in win;\nvar SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\nvar COMPUTE_INTERVAL = 25;\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * @private\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * @private\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n\nfunction boolOrFn(val, args) {\n if (typeof val === TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n\n return val;\n}\n\n/**\n * @private\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * @private\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n } // pan-x OR pan-y\n\n\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n } // manipulation\n\n\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * @private\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n\nvar TouchAction =\n/*#__PURE__*/\nfunction () {\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n /**\n * @private\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n\n\n var _proto = TouchAction.prototype;\n\n _proto.set = function set(value) {\n // find out the touch-action by the event handlers\n if (value === TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n\n this.actions = value.toLowerCase().trim();\n };\n /**\n * @private\n * just re-set the touchAction value\n */\n\n\n _proto.update = function update() {\n this.set(this.manager.options.touchAction);\n };\n /**\n * @private\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n\n\n _proto.compute = function compute() {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n };\n /**\n * @private\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n\n\n _proto.preventDefaults = function preventDefaults(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection; // if the touch action did prevented once this session\n\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n\n if (hasNone) {\n // do not prevent defaults if this is a tap gesture\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {\n return this.preventSrc(srcEvent);\n }\n };\n /**\n * @private\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n\n\n _proto.preventSrc = function preventSrc(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n };\n\n return TouchAction;\n}();\n\n/**\n * @private\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node === parent) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}\n\n/**\n * @private\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n\nfunction getCenter(pointers) {\n var pointersLength = pointers.length; // no need to loop when only one touch\n\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0;\n var y = 0;\n var i = 0;\n\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * @private\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * @private\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * @private\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * @private\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session;\n // jscs throwing error on defalut destructured values and without defaults tests fail\n\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * @private\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * @private\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input;\n var deltaTime = input.timeStamp - last.timeStamp;\n var velocity;\n var velocityX;\n var velocityY;\n var direction;\n\n if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n* @private\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length; // store the first input to calculate the distance and direction\n\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n } // to compute scale and rotation we need to store the multiple touches\n\n\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput,\n firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;\n computeIntervalInputData(session, input); // find the correct target\n\n var target = manager.element;\n var srcEvent = input.srcEvent;\n var srcEventTarget;\n\n if (srcEvent.composedPath) {\n srcEventTarget = srcEvent.composedPath()[0];\n } else if (srcEvent.path) {\n srcEventTarget = srcEvent.path[0];\n } else {\n srcEventTarget = srcEvent.target;\n }\n\n if (hasParent(srcEventTarget, target)) {\n target = srcEventTarget;\n }\n\n input.target = target;\n}\n\n/**\n * @private\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n } // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n\n\n input.eventType = eventType; // compute scale, rotation etc\n\n computeInputData(manager, input); // emit secret event\n\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * @private\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * @private\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n}\n\n/**\n * @private\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n\nvar Input =\n/*#__PURE__*/\nfunction () {\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n }\n /**\n * @private\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n\n\n var _proto = Input.prototype;\n\n _proto.handler = function handler() {};\n /**\n * @private\n * bind the events\n */\n\n\n _proto.init = function init() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n /**\n * @private\n * unbind the events\n */\n\n\n _proto.destroy = function destroy() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n\n return Input;\n}();\n\n/**\n * @private\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n\n while (i < src.length) {\n if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {\n // do not use === here, test fails\n return i;\n }\n\n i++;\n }\n\n return -1;\n }\n}\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n}; // in IE10 the pointer types is defined as an enum\n\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\n};\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive\n\nif (win.MSPointerEvent && !win.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n/**\n * @private\n * Pointer events input\n * @constructor\n * @extends Input\n */\n\n\nvar PointerEventInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(PointerEventInput, _Input);\n\n function PointerEventInput() {\n var _this;\n\n var proto = PointerEventInput.prototype;\n proto.evEl = POINTER_ELEMENT_EVENTS;\n proto.evWin = POINTER_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.store = _this.manager.session.pointerEvents = [];\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = PointerEventInput.prototype;\n\n _proto.handler = function handler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store\n\n var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down\n\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n } // it not found, so the pointer hasn't been down (so it's probably a hover)\n\n\n if (storeIndex < 0) {\n return;\n } // update the event in the store\n\n\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n };\n\n return PointerEventInput;\n}(Input);\n\n/**\n * @private\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * @private\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function (a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n\nvar TouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(TouchInput, _Input);\n\n function TouchInput() {\n var _this;\n\n TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS;\n\n return _this;\n }\n\n var _proto = TouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return TouchInput;\n}(Input);\n\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds; // when there is only one touch, the process can be simplified\n\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i;\n var targetTouches;\n var changedTouches = toArray(ev.changedTouches);\n var changedTargetTouches = [];\n var target = this.target; // get target touches from touches\n\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n }); // collect touches\n\n if (type === INPUT_START) {\n i = 0;\n\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n } // filter changed touches to only contain touches that exist in the collected target ids\n\n\n i = 0;\n\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n } // cleanup removed touches\n\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n/**\n * @private\n * Mouse events input\n * @constructor\n * @extends Input\n */\n\nvar MouseInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(MouseInput, _Input);\n\n function MouseInput() {\n var _this;\n\n var proto = MouseInput.prototype;\n proto.evEl = MOUSE_ELEMENT_EVENTS;\n proto.evWin = MOUSE_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.pressed = false; // mousedown state\n\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = MouseInput.prototype;\n\n _proto.handler = function handler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down\n\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n } // mouse must be down\n\n\n if (!this.pressed) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n };\n\n return MouseInput;\n}(Input);\n\n/**\n * @private\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\nvar DEDUP_TIMEOUT = 2500;\nvar DEDUP_DISTANCE = 25;\n\nfunction setLastTouch(eventData) {\n var _eventData$changedPoi = eventData.changedPointers,\n touch = _eventData$changedPoi[0];\n\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {\n x: touch.clientX,\n y: touch.clientY\n };\n var lts = this.lastTouches;\n this.lastTouches.push(lastTouch);\n\n var removeLastTouch = function removeLastTouch() {\n var i = lts.indexOf(lastTouch);\n\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n}\n\nfunction recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n}\n\nfunction isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX;\n var y = eventData.srcEvent.clientY;\n\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x);\n var dy = Math.abs(y - t.y);\n\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n\n return false;\n}\n\nvar TouchMouseInput =\n/*#__PURE__*/\nfunction () {\n var TouchMouseInput =\n /*#__PURE__*/\n function (_Input) {\n _inheritsLoose(TouchMouseInput, _Input);\n\n function TouchMouseInput(_manager, callback) {\n var _this;\n\n _this = _Input.call(this, _manager, callback) || this;\n\n _this.handler = function (manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;\n var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;\n\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n } // when we're in a touch event, record touches to de-dupe synthetic mouse event\n\n\n if (isTouch) {\n recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) {\n return;\n }\n\n _this.callback(manager, inputEvent, inputData);\n };\n\n _this.touch = new TouchInput(_this.manager, _this.handler);\n _this.mouse = new MouseInput(_this.manager, _this.handler);\n _this.primaryTouch = null;\n _this.lastTouches = [];\n return _this;\n }\n /**\n * @private\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n\n\n var _proto = TouchMouseInput.prototype;\n\n /**\n * @private\n * remove the event listeners\n */\n _proto.destroy = function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n };\n\n return TouchMouseInput;\n }(Input);\n\n return TouchMouseInput;\n}();\n\n/**\n * @private\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n\nfunction createInputInstance(manager) {\n var Type; // let inputClass = manager.options.inputClass;\n\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n\n return new Type(manager, inputHandler);\n}\n\n/**\n * @private\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n\n return false;\n}\n\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * @private\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * @private\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n\n if (manager) {\n return manager.get(otherRecognizer);\n }\n\n return otherRecognizer;\n}\n\n/**\n * @private\n * get a usable string, used as event postfix\n * @param {constant} state\n * @returns {String} state\n */\n\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n\n return '';\n}\n\n/**\n * @private\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n\n/**\n * @private\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n\nvar Recognizer =\n/*#__PURE__*/\nfunction () {\n function Recognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.options = _extends({\n enable: true\n }, options);\n this.id = uniqueId();\n this.manager = null; // default is enable true\n\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n\n\n var _proto = Recognizer.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state\n\n this.manager && this.manager.touchAction.update();\n return this;\n };\n /**\n * @private\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.recognizeWith = function recognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n };\n /**\n * @private\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.requireFailure = function requireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n\n return this;\n };\n /**\n * @private\n * has require failures boolean\n * @returns {boolean}\n */\n\n\n _proto.hasRequireFailures = function hasRequireFailures() {\n return this.requireFail.length > 0;\n };\n /**\n * @private\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n\n\n _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n };\n /**\n * @private\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n\n\n _proto.emit = function emit(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n } // 'panstart' and 'panmove'\n\n\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n } // panend and pancancel\n\n\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n };\n /**\n * @private\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n\n\n _proto.tryEmit = function tryEmit(input) {\n if (this.canEmit()) {\n return this.emit(input);\n } // it's failing anyway\n\n\n this.state = STATE_FAILED;\n };\n /**\n * @private\n * can we emit?\n * @returns {boolean}\n */\n\n\n _proto.canEmit = function canEmit() {\n var i = 0;\n\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n\n i++;\n }\n\n return true;\n };\n /**\n * @private\n * update the recognizer\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing?\n\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n } // reset when we've reached the end\n\n\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone); // the recognizer has recognized a gesture\n // so trigger an event\n\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n };\n /**\n * @private\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {constant} STATE\n */\n\n /* jshint ignore:start */\n\n\n _proto.process = function process(inputData) {};\n /* jshint ignore:end */\n\n /**\n * @private\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n\n\n _proto.getTouchAction = function getTouchAction() {};\n /**\n * @private\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n\n\n _proto.reset = function reset() {};\n\n return Recognizer;\n}();\n\n/**\n * @private\n * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n\nvar TapRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(TapRecognizer, _Recognizer);\n\n function TapRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n // max time between the multi-tap taps\n time: 250,\n // max time of the pointer to be down (like finger on the screen)\n threshold: 9,\n // a minimal movement is ok, but keep it low\n posThreshold: 10\n }, options)) || this; // previous time and center,\n // used for tap counting\n\n _this.pTime = false;\n _this.pCenter = false;\n _this._timer = null;\n _this._input = null;\n _this.count = 0;\n return _this;\n }\n\n var _proto = TapRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_MANIPULATION];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n\n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n } // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType !== INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input; // if tap count matches we have recognized it,\n // else it has began recognizing...\n\n var tapCount = this.count % options.taps;\n\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.interval);\n return STATE_BEGAN;\n }\n }\n }\n\n return STATE_FAILED;\n };\n\n _proto.failTimeout = function failTimeout() {\n var _this3 = this;\n\n this._timer = setTimeout(function () {\n _this3.state = STATE_FAILED;\n }, this.options.interval);\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit() {\n if (this.state === STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return TapRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n\nvar AttrRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(AttrRecognizer, _Recognizer);\n\n function AttrRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _Recognizer.call(this, _extends({\n pointers: 1\n }, options)) || this;\n }\n /**\n * @private\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n\n\n var _proto = AttrRecognizer.prototype;\n\n _proto.attrTest = function attrTest(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n };\n /**\n * @private\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n\n\n _proto.process = function process(input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED\n\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n\n return state | STATE_CHANGED;\n }\n\n return STATE_FAILED;\n };\n\n return AttrRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * direction cons to string\n * @param {constant} direction\n * @returns {String}\n */\n\nfunction directionStr(direction) {\n if (direction === DIRECTION_DOWN) {\n return 'down';\n } else if (direction === DIRECTION_UP) {\n return 'up';\n } else if (direction === DIRECTION_LEFT) {\n return 'left';\n } else if (direction === DIRECTION_RIGHT) {\n return 'right';\n }\n\n return '';\n}\n\n/**\n * @private\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PanRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PanRecognizer, _AttrRecognizer);\n\n function PanRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _AttrRecognizer.call(this, _extends({\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n }, options)) || this;\n _this.pX = null;\n _this.pY = null;\n return _this;\n }\n\n var _proto = PanRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n var direction = this.options.direction;\n var actions = [];\n\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n\n return actions;\n };\n\n _proto.directionTest = function directionTest(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY; // lock to axis?\n\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x !== this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y !== this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n };\n\n _proto.attrTest = function attrTest(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call\n this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));\n };\n\n _proto.emit = function emit(input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PanRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar SwipeRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(SwipeRecognizer, _AttrRecognizer);\n\n function SwipeRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n }, options)) || this;\n }\n\n var _proto = SwipeRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n };\n\n _proto.attrTest = function attrTest(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n };\n\n _proto.emit = function emit(input) {\n var direction = directionStr(input.offsetDirection);\n\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n };\n\n return SwipeRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PinchRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PinchRecognizer, _AttrRecognizer);\n\n function PinchRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'pinch',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = PinchRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n _proto.emit = function emit(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PinchRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar RotateRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(RotateRecognizer, _AttrRecognizer);\n\n function RotateRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'rotate',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = RotateRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n return RotateRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n\nvar PressRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(PressRecognizer, _Recognizer);\n\n function PressRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'press',\n pointers: 1,\n time: 251,\n // minimal time of the pointer to be pressed\n threshold: 9\n }, options)) || this;\n _this._timer = null;\n _this._input = null;\n return _this;\n }\n\n var _proto = PressRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_AUTO];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input; // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.time);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + \"up\", input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return PressRecognizer;\n}(Recognizer);\n\nvar defaults = {\n /**\n * @private\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * @private\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @private\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * @private\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * @private\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * @private\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * @private\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: \"none\",\n\n /**\n * @private\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: \"none\",\n\n /**\n * @private\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: \"none\",\n\n /**\n * @private\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: \"none\",\n\n /**\n * @private\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: \"none\",\n\n /**\n * @private\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: \"rgba(0,0,0,0)\"\n }\n};\n/**\n * @private\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * This is separated with other defaults because of tree-shaking.\n * @type {Array}\n */\n\nvar preset = [[RotateRecognizer, {\n enable: false\n}], [PinchRecognizer, {\n enable: false\n}, ['rotate']], [SwipeRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}], [PanRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}, ['swipe']], [TapRecognizer], [TapRecognizer, {\n event: 'doubletap',\n taps: 2\n}, ['tap']], [PressRecognizer]];\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n/**\n * @private\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n\n if (!element.style) {\n return;\n }\n\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || \"\";\n }\n });\n\n if (!add) {\n manager.oldCssProps = {};\n }\n}\n/**\n * @private\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n\n\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent(\"Event\");\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n/**\n* @private\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\n\nvar Manager =\n/*#__PURE__*/\nfunction () {\n function Manager(element, options) {\n var _this = this;\n\n this.options = assign$1({}, defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = _this.add(new item[0](item[1]));\n\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n\n\n var _proto = Manager.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // Options that need a little more setup\n\n if (options.touchAction) {\n this.touchAction.update();\n }\n\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n\n return this;\n };\n /**\n * @private\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n\n\n _proto.stop = function stop(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n };\n /**\n * @private\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n var session = this.session;\n\n if (session.stopped) {\n return;\n } // run the touch-action polyfill\n\n\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers; // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n\n var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized\n // or when we're in a new session\n\n if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {\n session.curRecognizer = null;\n curRecognizer = null;\n }\n\n var i = 0;\n\n while (i < recognizers.length) {\n recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer === curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n\n\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n session.curRecognizer = recognizer;\n curRecognizer = recognizer;\n }\n\n i++;\n }\n };\n /**\n * @private\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n\n\n _proto.get = function get(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event === recognizer) {\n return recognizers[i];\n }\n }\n\n return null;\n };\n /**\n * @private add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n\n\n _proto.add = function add(recognizer) {\n if (invokeArrayArg(recognizer, \"add\", this)) {\n return this;\n } // remove existing\n\n\n var existing = this.get(recognizer.options.event);\n\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n };\n /**\n * @private\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n\n\n _proto.remove = function remove(recognizer) {\n if (invokeArrayArg(recognizer, \"remove\", this)) {\n return this;\n }\n\n var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists\n\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, targetRecognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n };\n /**\n * @private\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n\n\n _proto.on = function on(events, handler) {\n if (events === undefined || handler === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n };\n /**\n * @private unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n\n\n _proto.off = function off(events, handler) {\n if (events === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n };\n /**\n * @private emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n\n\n _proto.emit = function emit(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n } // no handlers, so skip it all\n\n\n var handlers = this.handlers[event] && this.handlers[event].slice();\n\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n };\n /**\n * @private\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n\n\n _proto.destroy = function destroy() {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n };\n\n return Manager;\n}();\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Touch events input\n * @constructor\n * @extends Input\n */\n\nvar SingleTouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(SingleTouchInput, _Input);\n\n function SingleTouchInput() {\n var _this;\n\n var proto = SingleTouchInput.prototype;\n proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.started = false;\n return _this;\n }\n\n var _proto = SingleTouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?\n\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state\n\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return SingleTouchInput;\n}(Input);\n\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\n/**\n * @private\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = \"DEPRECATED METHOD: \" + name + \"\\n\" + message + \" AT \\n\";\n return function () {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '').replace(/^\\s+at\\s+/gm, '').replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n\n return method.apply(this, arguments);\n };\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n\nvar extend = deprecate(function (dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n\n while (i < keys.length) {\n if (!merge || merge && dest[keys[i]] === undefined) {\n dest[keys[i]] = src[keys[i]];\n }\n\n i++;\n }\n\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * @private\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n\nvar merge = deprecate(function (dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * @private\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n\nfunction inherit(child, base, properties) {\n var baseP = base.prototype;\n var childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign$1(childP, properties);\n }\n}\n\n/**\n * @private\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * @private\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\nvar Hammer =\n/*#__PURE__*/\nfunction () {\n var Hammer =\n /**\n * @private\n * @const {string}\n */\n function Hammer(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n return new Manager(element, _extends({\n recognizers: preset.concat()\n }, options));\n };\n\n Hammer.VERSION = \"2.0.17-rc\";\n Hammer.DIRECTION_ALL = DIRECTION_ALL;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.DIRECTION_LEFT = DIRECTION_LEFT;\n Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;\n Hammer.DIRECTION_UP = DIRECTION_UP;\n Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n Hammer.DIRECTION_NONE = DIRECTION_NONE;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.INPUT_START = INPUT_START;\n Hammer.INPUT_MOVE = INPUT_MOVE;\n Hammer.INPUT_END = INPUT_END;\n Hammer.INPUT_CANCEL = INPUT_CANCEL;\n Hammer.STATE_POSSIBLE = STATE_POSSIBLE;\n Hammer.STATE_BEGAN = STATE_BEGAN;\n Hammer.STATE_CHANGED = STATE_CHANGED;\n Hammer.STATE_ENDED = STATE_ENDED;\n Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;\n Hammer.STATE_CANCELLED = STATE_CANCELLED;\n Hammer.STATE_FAILED = STATE_FAILED;\n Hammer.Manager = Manager;\n Hammer.Input = Input;\n Hammer.TouchAction = TouchAction;\n Hammer.TouchInput = TouchInput;\n Hammer.MouseInput = MouseInput;\n Hammer.PointerEventInput = PointerEventInput;\n Hammer.TouchMouseInput = TouchMouseInput;\n Hammer.SingleTouchInput = SingleTouchInput;\n Hammer.Recognizer = Recognizer;\n Hammer.AttrRecognizer = AttrRecognizer;\n Hammer.Tap = TapRecognizer;\n Hammer.Pan = PanRecognizer;\n Hammer.Swipe = SwipeRecognizer;\n Hammer.Pinch = PinchRecognizer;\n Hammer.Rotate = RotateRecognizer;\n Hammer.Press = PressRecognizer;\n Hammer.on = addEventListeners;\n Hammer.off = removeEventListeners;\n Hammer.each = each;\n Hammer.merge = merge;\n Hammer.extend = extend;\n Hammer.bindFn = bindFn;\n Hammer.assign = assign$1;\n Hammer.inherit = inherit;\n Hammer.bindFn = bindFn;\n Hammer.prefixed = prefixed;\n Hammer.toArray = toArray;\n Hammer.inArray = inArray;\n Hammer.uniqueArray = uniqueArray;\n Hammer.splitStr = splitStr;\n Hammer.boolOrFn = boolOrFn;\n Hammer.hasParent = hasParent;\n Hammer.addEventListeners = addEventListeners;\n Hammer.removeEventListeners = removeEventListeners;\n Hammer.defaults = assign$1({}, defaults, {\n preset: preset\n });\n return Hammer;\n}();\n\n// style loader but by script tag, not by the loader.\n\nvar defaults$1 = Hammer.defaults;\n\nexport default Hammer;\nexport { INPUT_START, INPUT_MOVE, INPUT_END, INPUT_CANCEL, STATE_POSSIBLE, STATE_BEGAN, STATE_CHANGED, STATE_ENDED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_FAILED, DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, Input, TouchAction, TouchInput, MouseInput, PointerEventInput, TouchMouseInput, SingleTouchInput, Recognizer, AttrRecognizer, TapRecognizer as Tap, PanRecognizer as Pan, SwipeRecognizer as Swipe, PinchRecognizer as Pinch, RotateRecognizer as Rotate, PressRecognizer as Press, addEventListeners as on, removeEventListeners as off, each, merge, extend, assign$1 as assign, inherit, bindFn, prefixed, toArray, inArray, uniqueArray, splitStr, boolOrFn, hasParent, addEventListeners, removeEventListeners, defaults$1 as defaults };\n//# sourceMappingURL=hammer.esm.js.map\n","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/axes project is licensed under the MIT license\n\n@egjs/axes JavaScript library\nhttps://github.com/naver/egjs-axes\n\n@version 2.7.1\n*/\nimport { DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, PointerEventInput, TouchMouseInput, TouchInput, MouseInput, Pan, Pinch } from '@egjs/hammerjs';\nimport getAgent from '@egjs/agent';\nimport Component from '@egjs/component';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n};\n\nfunction __extends(d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nfunction getInsidePosition(destPos, range, circular, bounce) {\n var toDestPos = destPos;\n var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]];\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n return toDestPos;\n} // determine outside\n\nfunction isOutside(pos, range) {\n return pos < range[0] || pos > range[1];\n}\nfunction getDuration(distance, deceleration) {\n var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero\n\n return duration < 100 ? 0 : duration;\n}\nfunction isCircularable(destPos, range, circular) {\n return circular[1] && destPos > range[1] || circular[0] && destPos < range[0];\n}\nfunction getCirculatedPos(pos, range, circular) {\n var toPos = pos;\n var min = range[0];\n var max = range[1];\n var length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = (toPos - max) % length + min;\n }\n\n if (circular[0] && pos < min) {\n // left\n toPos = (toPos - min) % length + max;\n }\n\n return toPos;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\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\nfunction toArray(nodes) {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n var el = [];\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n\n return el;\n}\nfunction $(param, multi) {\n if (multi === void 0) {\n multi = false;\n }\n\n var el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n var match = param.match(/^<([a-z]+)\\s*([^>]*)>/); // creating element\n\n if (match) {\n // HTML\n var dummy = document.createElement(\"div\");\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === win) {\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 (\"jQuery\" in win && param instanceof jQuery || param.constructor.prototype.jquery) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map(function (v) {\n return $(v);\n });\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n\n return el;\n}\nvar raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame;\nvar caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;\n\nif (raf && !caf) {\n var keyInfo_1 = {};\n var oldraf_1 = raf;\n\n raf = function (callback) {\n function wrapCallback(timestamp) {\n if (keyInfo_1[key]) {\n callback(timestamp);\n }\n }\n\n var key = oldraf_1(wrapCallback);\n keyInfo_1[key] = true;\n return key;\n };\n\n caf = function (key) {\n delete keyInfo_1[key];\n };\n} else if (!(raf && caf)) {\n raf = function (callback) {\n return win.setTimeout(function () {\n callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime());\n }, 16);\n };\n\n caf = win.clearTimeout;\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 */\n\n\nfunction 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*/\n\nfunction cancelAnimationFrame(key) {\n caf(key);\n}\nfunction map(obj, callback) {\n var tranformed = {};\n\n for (var k in obj) {\n k && (tranformed[k] = callback(obj[k], k));\n }\n\n return tranformed;\n}\nfunction filter(obj, callback) {\n var filtered = {};\n\n for (var k in obj) {\n k && callback(obj[k], k) && (filtered[k] = obj[k]);\n }\n\n return filtered;\n}\nfunction every(obj, callback) {\n for (var k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n\n return true;\n}\nfunction equal(target, base) {\n return every(target, function (v, k) {\n return v === base[k];\n });\n}\nvar roundNumFunc = {};\nfunction roundNumber(num, roundUnit) {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n}\nfunction roundNumbers(num, roundUnit) {\n if (!num || !roundUnit) {\n return num;\n }\n\n var isNumber = typeof roundUnit === \"number\";\n return map(num, function (value, key) {\n return roundNumber(value, isNumber ? roundUnit : roundUnit[key]);\n });\n}\nfunction getDecimalPlace(val) {\n if (!isFinite(val)) {\n return 0;\n }\n\n var v = val + \"\";\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n var p = 0;\n var e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n } // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n\n\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n}\nfunction inversePow(n) {\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}\nfunction getRoundFunc(v) {\n var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n return function (n) {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n}\n\nfunction minMax(value, min, max) {\n return Math.max(Math.min(value, max), min);\n}\n\nvar AnimationManager =\n/*#__PURE__*/\nfunction () {\n function AnimationManager(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n var __proto = AnimationManager.prototype;\n\n __proto.getDuration = function (depaPos, destPos, wishDuration) {\n var _this = this;\n\n var duration;\n\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n var durations_1 = map(destPos, function (v, k) {\n return getDuration(Math.abs(v - depaPos[k]), _this.options.deceleration);\n });\n duration = Object.keys(durations_1).reduce(function (max, v) {\n return Math.max(max, durations_1[v]);\n }, -Infinity);\n }\n\n return minMax(duration, this.options.minimumDuration, this.options.maximumDuration);\n };\n\n __proto.createAnimationParam = function (pos, duration, option) {\n var depaPos = this.axm.get();\n var destPos = pos;\n var inputEvent = option && option.event || null;\n return {\n depaPos: depaPos,\n destPos: destPos,\n duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration),\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: inputEvent,\n input: option && option.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd\n };\n };\n\n __proto.grab = function (axes, option) {\n if (this._animateParam && axes.length) {\n var orgPos_1 = this.axm.get(axes);\n var pos = this.axm.map(orgPos_1, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n });\n\n if (!every(pos, function (v, k) {\n return orgPos_1[k] === v;\n })) {\n this.em.triggerChange(pos, false, orgPos_1, option, !!option);\n }\n\n this._animateParam = null;\n this._raf && cancelAnimationFrame(this._raf);\n this._raf = null;\n this.em.triggerAnimationEnd(!!(option && option.event));\n }\n };\n\n __proto.getEventInfo = function () {\n if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent\n };\n } else {\n return null;\n }\n };\n\n __proto.restore = function (option) {\n var pos = this.axm.get();\n var destPos = this.axm.map(pos, function (v, opt) {\n return Math.min(opt.range[1], Math.max(opt.range[0], v));\n });\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n };\n\n __proto.animationEnd = function () {\n var beforeParam = this.getEventInfo();\n this._animateParam = null; // for Circular\n\n var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n });\n Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n }));\n this.itm.setInterrupt(false);\n this.em.triggerAnimationEnd(!!beforeParam);\n\n if (this.axm.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n };\n\n __proto.finish = function (isTrusted) {\n this._animateParam = null;\n this.itm.setInterrupt(false);\n this.em.triggerFinish(isTrusted);\n };\n\n __proto.animateLoop = function (param, complete) {\n if (param.duration) {\n this._animateParam = __assign({}, param);\n var info_1 = this._animateParam;\n var self_1 = this;\n var destPos_1 = info_1.destPos;\n var prevPos_1 = info_1.depaPos;\n var prevEasingPer_1 = 0;\n var directions_1 = map(prevPos_1, function (value, key) {\n return value <= destPos_1[key] ? 1 : -1;\n });\n var originalIntendedPos_1 = map(destPos_1, function (v) {\n return v;\n });\n var prevTime_1 = new Date().getTime();\n info_1.startTime = prevTime_1;\n\n (function loop() {\n self_1._raf = null;\n var currentTime = new Date().getTime();\n var ratio = (currentTime - info_1.startTime) / param.duration;\n var easingPer = self_1.easing(ratio);\n var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) {\n var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n\n var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular);\n\n if (nextPos !== circulatedPos) {\n // circular\n var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]);\n destPos_1[key] -= rangeOffset;\n prevPos_1[key] -= rangeOffset;\n }\n\n return circulatedPos;\n });\n var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1);\n prevPos_1 = toPos;\n prevTime_1 = currentTime;\n prevEasingPer_1 = easingPer;\n\n if (easingPer >= 1) {\n destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1);\n\n if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) {\n self_1.em.triggerChange(destPos_1, true, prevPos_1);\n }\n\n complete();\n return;\n } else if (isCanceled) {\n self_1.finish(false);\n } else {\n // animationEnd\n self_1._raf = requestAnimationFrame(loop);\n }\n })();\n } else {\n this.em.triggerChange(param.destPos, true);\n complete();\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 *\n * @param originalIntendedPos\n * @param destPos\n */\n\n\n __proto.getFinalPos = function (destPos, originalIntendedPos) {\n var _this = this; // compare destPos and originalIntendedPos\n\n\n var ERROR_LIMIT = 0.000001;\n var finalPos = map(destPos, function (value, key) {\n if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n var roundUnit = _this.getRoundUnit(value, key);\n\n var result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n };\n\n __proto.getRoundUnit = function (val, key) {\n var roundUnit = this.options.round; // manual mode\n\n var minRoundUnit = null; // auto mode\n // auto mode\n\n if (!roundUnit) {\n // Get minimum round unit\n var options = this.axm.getAxisOptions(key);\n minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val)));\n }\n\n return minRoundUnit || roundUnit;\n };\n\n __proto.getUserControll = function (param) {\n var userWish = param.setTo();\n userWish.destPos = this.axm.get(userWish.destPos);\n userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration);\n return userWish;\n };\n\n __proto.animateTo = function (destPos, duration, option) {\n var _this = this;\n\n var param = this.createAnimationParam(destPos, duration, option);\n\n var depaPos = __assign({}, param.depaPos);\n\n var retTrigger = this.em.triggerAnimationStart(param); // to control\n\n var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true.\n\n if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n })) {\n console.warn(\"You can't stop the 'animation' event when 'circular' is true.\");\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n var inputEvent = option && option.event || null;\n this.animateLoop({\n depaPos: depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axm.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent: inputEvent,\n input: option && option.input || null\n }, function () {\n return _this.animationEnd();\n });\n }\n };\n\n __proto.easing = function (p) {\n return p > 1 ? 1 : this.options.easing(p);\n };\n\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n var axes = Object.keys(pos);\n this.grab(axes);\n var orgPos = this.axm.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n\n this.itm.setInterrupt(true);\n var movedPos = filter(pos, function (v, k) {\n return orgPos[k] !== v;\n });\n\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axm.map(movedPos, function (v, opt) {\n var range = opt.range,\n circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular);\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.em.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n };\n\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) {\n return v + pos[k];\n }), duration);\n };\n\n return AnimationManager;\n}();\n\nvar EventManager =\n/*#__PURE__*/\nfunction () {\n function EventManager(axes) {\n this.axes = axes;\n }\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @name eg.Axes#hold\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n var __proto = EventManager.prototype;\n\n __proto.triggerHold = function (pos, option) {\n var roundPos = this.getRoundPos(pos).roundPos;\n this.axes.trigger(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true\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 * @name set\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\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 * @name setTo\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\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 * @name eg.Axes#release\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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} 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 * 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\n __proto.triggerRelease = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n this.axes.trigger(\"release\", param);\n };\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @name eg.Axes#change\n * @event\n * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\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 * 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\n __proto.triggerChange = function (pos, isAccurate, depaPos, option, holding) {\n if (holding === void 0) {\n holding = false;\n }\n\n var am = this.am;\n var axm = am.axm;\n var eventInfo = am.getEventInfo();\n\n var _a = this.getRoundPos(pos, depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n var moveTo = axm.moveTo(roundPos, roundDepa);\n var inputEvent = option && option.event || eventInfo && eventInfo.event || null;\n var param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n holding: holding,\n inputEvent: inputEvent,\n isTrusted: !!inputEvent,\n input: option && option.input || eventInfo && eventInfo.input || null,\n set: inputEvent ? this.createUserControll(moveTo.pos) : function () {}\n };\n var result = this.axes.trigger(\"change\", param);\n inputEvent && axm.set(param.set()[\"destPos\"]);\n return result;\n };\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @name eg.Axes#animationStart\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationStart = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n return this.axes.trigger(\"animationStart\", param);\n };\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#animationEnd\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationEnd = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"animationEnd\", {\n isTrusted: isTrusted\n });\n };\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#finish\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerFinish = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"finish\", {\n isTrusted: isTrusted\n });\n };\n\n __proto.createUserControll = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n } // to controll\n\n\n var userControl = {\n destPos: __assign({}, pos),\n duration: duration\n };\n return function (toPos, userDuration) {\n toPos && (userControl.destPos = __assign({}, toPos));\n userDuration !== undefined && (userControl.duration = userDuration);\n return userControl;\n };\n };\n\n __proto.setAnimationManager = function (am) {\n this.am = am;\n };\n\n __proto.destroy = function () {\n this.axes.off();\n };\n\n __proto.getRoundPos = function (pos, depaPos) {\n // round value if round exist\n var roundUnit = this.axes.options.round; // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit)\n };\n };\n\n return EventManager;\n}();\n\nvar InterruptManager =\n/*#__PURE__*/\nfunction () {\n function InterruptManager(options) {\n this.options = options;\n this._prevented = false; // check whether the animation event was prevented\n }\n\n var __proto = InterruptManager.prototype;\n\n __proto.isInterrupting = function () {\n // when interruptable is 'true', return value is always 'true'.\n return this.options.interruptable || this._prevented;\n };\n\n __proto.isInterrupted = function () {\n return !this.options.interruptable && this._prevented;\n };\n\n __proto.setInterrupt = function (prevented) {\n !this.options.interruptable && (this._prevented = prevented);\n };\n\n return InterruptManager;\n}();\n\nvar AxisManager =\n/*#__PURE__*/\nfunction () {\n function AxisManager(axis, options) {\n var _this = this;\n\n this.axis = axis;\n this.options = options;\n\n this._complementOptions();\n\n this._pos = Object.keys(this.axis).reduce(function (acc, v) {\n acc[v] = _this.axis[v].range[0];\n return acc;\n }, {});\n }\n /**\n * set up 'css' expression\n * @private\n */\n\n\n var __proto = AxisManager.prototype;\n\n __proto._complementOptions = function () {\n var _this = this;\n\n Object.keys(this.axis).forEach(function (axis) {\n _this.axis[axis] = __assign({\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false]\n }, _this.axis[axis]);\n [\"bounce\", \"circular\"].forEach(function (v) {\n var axisOption = _this.axis;\n var 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 __proto.getDelta = function (depaPos, destPos) {\n var fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), function (v, k) {\n return v - fullDepaPos[k];\n });\n };\n\n __proto.get = function (axes) {\n var _this = this;\n\n if (axes && Array.isArray(axes)) {\n return axes.reduce(function (acc, v) {\n if (v && v in _this._pos) {\n acc[v] = _this._pos[v];\n }\n\n return acc;\n }, {});\n } else {\n return __assign({}, this._pos, axes || {});\n }\n };\n\n __proto.moveTo = function (pos, depaPos) {\n if (depaPos === void 0) {\n depaPos = this._pos;\n }\n\n var delta = map(this._pos, function (v, key) {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n this.set(this.map(pos, function (v, opt) {\n return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0;\n }));\n return {\n pos: __assign({}, this._pos),\n delta: delta\n };\n };\n\n __proto.set = function (pos) {\n for (var k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n };\n\n __proto.every = function (pos, callback) {\n var axisOptions = this.axis;\n return every(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.filter = function (pos, callback) {\n var axisOptions = this.axis;\n return filter(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.map = function (pos, callback) {\n var axisOptions = this.axis;\n return map(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.isOutside = function (axes) {\n return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) {\n return !isOutside(v, opt.range);\n });\n };\n\n __proto.getAxisOptions = function (key) {\n return this.axis[key];\n };\n\n return AxisManager;\n}();\n\nvar InputObserver =\n/*#__PURE__*/\nfunction () {\n function InputObserver(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm,\n am = _a.am;\n this.isOutside = false;\n this.moveDistance = null;\n this.isStopped = false;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.am = am;\n } // when move pointer is held in outside\n\n\n var __proto = InputObserver.prototype;\n\n __proto.atOutside = function (pos) {\n var _this = this;\n\n if (this.isOutside) {\n return this.axm.map(pos, function (v, opt) {\n var tn = opt.range[0] - opt.bounce[0];\n var tx = opt.range[1] + opt.bounce[1];\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n // when start pointer is held in inside\n // get a initialization slope value to prevent smooth animation.\n var initSlope_1 = this.am.easing(0.00001) / 0.00001;\n return this.axm.map(pos, function (v, opt) {\n var min = opt.range[0];\n var max = opt.range[1];\n var out = opt.bounce;\n var circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return min - _this.am.easing((min - v) / (out[0] * initSlope_1)) * out[0];\n } else if (v > max) {\n // right\n return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1];\n }\n\n return v;\n });\n }\n };\n\n __proto.get = function (input) {\n return this.axm.get(input.axes);\n };\n\n __proto.hold = function (input, event) {\n if (this.itm.isInterrupted() || !input.axes.length) {\n return;\n }\n\n var changeOption = {\n input: input,\n event: event\n };\n this.isStopped = false;\n this.itm.setInterrupt(true);\n this.am.grab(input.axes, changeOption);\n !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption);\n this.isOutside = this.axm.isOutside(input.axes);\n this.moveDistance = this.axm.get(input.axes);\n };\n\n __proto.change = function (input, event, offset) {\n if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) {\n return v === 0;\n })) {\n return;\n }\n\n var depaPos = this.moveDistance || this.axm.get(input.axes);\n var destPos; // for outside logic\n\n destPos = map(depaPos, function (v, k) {\n return v + (offset[k] || 0);\n });\n this.moveDistance && (this.moveDistance = destPos); // from outside to inside\n\n if (this.isOutside && this.axm.every(depaPos, function (v, opt) {\n return !isOutside(v, opt.range);\n })) {\n this.isOutside = false;\n }\n\n depaPos = this.atOutside(depaPos);\n destPos = this.atOutside(destPos);\n var isCanceled = !this.em.triggerChange(destPos, false, depaPos, {\n input: input,\n event: event\n }, true);\n\n if (isCanceled) {\n this.isStopped = true;\n this.moveDistance = null;\n this.am.finish(false);\n }\n };\n\n __proto.release = function (input, event, offset, inputDuration) {\n if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) {\n return;\n }\n\n var pos = this.axm.get(input.axes);\n var depaPos = this.axm.get();\n var destPos = this.axm.get(this.axm.map(offset, function (v, opt, k) {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce);\n }\n }));\n var duration = this.am.getDuration(destPos, pos, inputDuration);\n\n if (duration === 0) {\n destPos = __assign({}, depaPos);\n } // prepare params\n\n\n var param = {\n depaPos: depaPos,\n destPos: destPos,\n duration: duration,\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: event,\n input: input,\n isTrusted: true\n };\n this.em.triggerRelease(param);\n this.moveDistance = null; // to contol\n\n var userWish = this.am.getUserControll(param);\n var isEqual = equal(userWish.destPos, depaPos);\n var changeOption = {\n input: input,\n event: event\n };\n\n if (isEqual || userWish.duration === 0) {\n !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true);\n this.itm.setInterrupt(false);\n\n if (this.axm.isOutside()) {\n this.am.restore(changeOption);\n } else {\n this.em.triggerFinish(true);\n }\n } else {\n this.am.animateTo(userWish.destPos, userWish.duration, changeOption);\n }\n };\n\n return InputObserver;\n}();\n\n// export const DIRECTION_NONE = 1;\nvar IOS_EDGE_THRESHOLD = 30;\nvar IS_IOS_SAFARI = \"ontouchstart\" in win && getAgent().browser.name === \"safari\";\nvar TRANSFORM = function () {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n\n var bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0]).style;\n var target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n for (var i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n\n return \"\";\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 * @property {Number[]} [range] The coordinate of range 좌표 범위\n * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표\n * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표\n * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to \"true\" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @property {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 * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @property {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가 적용되지 않는다
\n * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
\n**/\n\n/**\n * @class eg.Axes\n * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.\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] 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 *\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\nvar Axes =\n/*#__PURE__*/\nfunction (_super) {\n __extends(Axes, _super);\n\n function Axes(axis, options, startPos) {\n if (axis === void 0) {\n axis = {};\n }\n\n if (options === void 0) {\n options = {};\n }\n\n var _this = _super.call(this) || this;\n\n _this.axis = axis;\n _this._inputs = [];\n _this.options = __assign({\n easing: function easeOutCubic(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 }, options);\n _this.itm = new InterruptManager(_this.options);\n _this.axm = new AxisManager(_this.axis, _this.options);\n _this.em = new EventManager(_this);\n _this.am = new AnimationManager(_this);\n _this.io = new InputObserver(_this);\n\n _this.em.setAnimationManager(_this.am);\n\n startPos && _this.em.triggerChange(startPos);\n return _this;\n }\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @method eg.Axes#connect\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 * 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\n var __proto = Axes.prototype;\n\n __proto.connect = function (axes, inputType) {\n var mapped;\n\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n } // check same instance\n\n\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n } // check same element in hammer type for share\n\n\n if (\"hammer\" in inputType) {\n var targets = this._inputs.filter(function (v) {\n return v.hammer && v.element === inputType.element;\n });\n\n if (targets.length) {\n inputType.hammer = targets[0].hammer;\n }\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.io);\n\n this._inputs.push(inputType);\n\n return this;\n };\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @method eg.Axes#disconnect\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 * 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\n __proto.disconnect = function (inputType) {\n if (inputType) {\n var index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach(function (v) {\n return v.disconnect();\n });\n\n this._inputs = [];\n }\n\n return this;\n };\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @method eg.Axes#get\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\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\n __proto.get = function (axes) {\n return this.axm.get(axes);\n };\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @method eg.Axes#setTo\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 * 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\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setTo(pos, duration);\n return this;\n };\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @method eg.Axes#setBy\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 * 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\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setBy(pos, duration);\n return this;\n };\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @method eg.Axes#isBounceArea\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\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\n __proto.isBounceArea = function (axes) {\n return this.axm.isOutside(axes);\n };\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n * @method eg.Axes#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.em.destroy();\n };\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Axes.VERSION; // ex) 3.3.3\n * @memberof eg.Axes\n */\n\n\n Axes.VERSION = \"2.7.1\";\n /**\n * @name eg.Axes.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 * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n */\n\n Axes.TRANSFORM = TRANSFORM;\n /**\n * @name eg.Axes.DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name eg.Axes.DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name eg.Axes.DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name eg.Axes.DIRECTION_UP\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_UP = DIRECTION_UP;\n /**\n * @name eg.Axes.DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name eg.Axes.DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name eg.Axes.DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name eg.Axes.DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_ALL = DIRECTION_ALL;\n return Axes;\n}(Component);\n\nvar SUPPORT_POINTER_EVENTS = \"PointerEvent\" in win || \"MSPointerEvent\" in win;\nvar SUPPORT_TOUCH = (\"ontouchstart\" in win);\nvar UNIQUEKEY = \"_EGJS_AXES_INPUTTYPE_\";\nfunction toAxis(source, offset) {\n return offset.reduce(function (acc, v, i) {\n if (source[i]) {\n acc[source[i]] = v;\n }\n\n return acc;\n }, {});\n}\nfunction createHammer(element, options) {\n try {\n // create Hammer\n return new Manager(element, __assign({}, options));\n } catch (e) {\n return null;\n }\n}\nfunction convertInputType(inputType) {\n if (inputType === void 0) {\n inputType = [];\n }\n\n var hasTouch = false;\n var hasMouse = false;\n var hasPointer = false;\n inputType.forEach(function (v) {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n\n if (hasPointer) {\n return PointerEventInput;\n } else if (hasTouch && hasMouse) {\n return TouchMouseInput;\n } else if (hasTouch) {\n return TouchInput;\n } else if (hasMouse) {\n return MouseInput;\n }\n\n return null;\n}\n\nfunction getDirectionByAngle(angle, thresholdAngle) {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n\n var toAngle = Math.abs(angle);\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL;\n}\nfunction getNextOffset(speeds, deceleration) {\n var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]);\n var duration = Math.abs(normalSpeed / -deceleration);\n return [speeds[0] / 2 * duration, speeds[1] / 2 * duration];\n}\nfunction useDirection(checkType, direction, userDirection) {\n if (userDirection) {\n return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType);\n } else {\n return !!(direction & checkType);\n }\n}\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @property {String[]} [inputType=[\"touch\",\"mouse\", \"pointer\"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
\n * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율\n * @property {Number} [scale.1=1] vertical axis scale 수직축 배율\n * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PanInput\n * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\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 */\n\nvar PanInput =\n/*#__PURE__*/\nfunction () {\n function PanInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this.panRecognizer = null;\n this.isRightEdge = false;\n this.rightEdgeTimer = 0;\n this.panFlag = false;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PanInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onHammerInput = this.onHammerInput.bind(this);\n this.onPanmove = this.onPanmove.bind(this);\n this.onPanend = this.onPanend.bind(this);\n }\n\n var __proto = PanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n var useHorizontal = !!axes[0];\n var useVertical = !!axes[1];\n\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\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n direction: this._direction,\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PanRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.panRecognizer = new Pan(hammerOption);\n this.hammer.add(this.panRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.dettachEvent();\n }\n\n this._direction = DIRECTION_NONE;\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PanInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PanInput#enable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PanInput#disable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PanInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pan\").options.enable);\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.panRecognizer) {\n this.hammer.remove(this.panRecognizer);\n this.panRecognizer = null;\n }\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.panFlag = false;\n\n if (event.srcEvent.cancelable !== false) {\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n this.observer.hold(this, event);\n this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold;\n this.panFlag = true;\n }\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanmove = function (event) {\n var _this = this;\n\n if (!this.panFlag) {\n return;\n }\n\n var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start\n\n var prevInput = this.hammer.session.prevInput;\n\n if (prevInput && IS_IOS_SAFARI) {\n var swipeLeftToRight = event.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n return;\n } else if (this.isRightEdge) {\n clearTimeout(this.rightEdgeTimer); // - is right to left\n\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n var swipeRightToLeft = event.deltaX < -edgeThreshold;\n\n if (swipeRightToLeft) {\n this.isRightEdge = false;\n } else {\n // iOS swipe right => left\n this.rightEdgeTimer = window.setTimeout(function () {\n _this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n }, 100);\n }\n }\n }\n /* eslint-disable no-param-reassign */\n\n\n if (prevInput) {\n event.offsetX = event.deltaX - prevInput.deltaX;\n event.offsetY = event.deltaY - prevInput.deltaY;\n } else {\n event.offsetX = 0;\n event.offsetY = 0;\n }\n\n var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]);\n var prevent = offset.some(function (v) {\n return v !== 0;\n });\n\n if (prevent) {\n var srcEvent = event.srcEvent;\n\n if (srcEvent.cancelable !== false) {\n srcEvent.preventDefault();\n }\n\n srcEvent.stopPropagation();\n }\n\n event.preventSystemEvent = prevent;\n prevent && this.observer.change(this, event, toAxis(this.axes, offset));\n };\n\n __proto.onPanend = function (event) {\n if (!this.panFlag) {\n return;\n }\n\n clearTimeout(this.rightEdgeTimer);\n this.panFlag = false;\n var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]);\n offset = getNextOffset(offset, this.observer.options.deceleration);\n this.observer.release(this, event, toAxis(this.axes, offset));\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"hammer.input\", this.onHammerInput).on(\"panstart panmove\", this.onPanmove);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"hammer.input\", this.onHammerInput).off(\"panstart panmove\", this.onPanmove);\n this.observer = null;\n };\n\n __proto.getOffset = function (properties, direction) {\n var offset = [0, 0];\n var scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n\n return offset;\n };\n\n return PanInput;\n}();\n\n/**\n * @class eg.Axes.RotatePanInput\n * @classdesc 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)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.
[상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\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 eg.Axes.PanInput\n */\n\nvar RotatePanInput =\n/*#__PURE__*/\nfunction (_super) {\n __extends(RotatePanInput, _super);\n\n function RotatePanInput(el, options) {\n var _this = _super.call(this, el, options) || this;\n\n _this.prevQuadrant = null;\n _this.lastDiff = 0;\n return _this;\n }\n\n var __proto = RotatePanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.observer.hold(this, event);\n this.onPanstart(event);\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanstart = function (event) {\n var rect = this.element.getBoundingClientRect();\n /**\n * Responsive\n */\n // TODO: how to do if element is ellipse not circle.\n\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\n this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle.\n\n this.prevAngle = null;\n this.triggerChange(event);\n };\n\n __proto.onPanmove = function (event) {\n this.triggerChange(event);\n };\n\n __proto.onPanend = function (event) {\n this.triggerChange(event);\n this.triggerAnimation(event);\n };\n\n __proto.triggerChange = function (event) {\n var angle = this.getAngle(event.center.x, event.center.y);\n var quadrant = this.getQuadrant(event.center.x, event.center.y);\n var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant);\n this.prevAngle = angle;\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 __proto.triggerAnimation = function (event) {\n var vx = event.velocityX;\n var vy = event.velocityY;\n var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise\n\n var duration = Math.abs(velocity / -this.observer.options.deceleration);\n var distance = velocity / 2 * duration;\n this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle]));\n };\n\n __proto.getDifference = function (prevAngle, angle, prevQuadrant, quadrant) {\n var diff;\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 __proto.getPosFromOrigin = function (posX, posY) {\n return {\n x: posX - this.rotateOrigin[0],\n y: this.rotateOrigin[1] - posY\n };\n };\n\n __proto.getAngle = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y);\n\n return angle < 0 ? 360 + angle : angle;\n };\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n\n\n __proto.getQuadrant = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var 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\n return q;\n };\n\n return RotatePanInput;\n}(PanInput);\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PinchInput\n * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\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 */\n\nvar PinchInput =\n/*#__PURE__*/\nfunction () {\n function PinchInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this._base = null;\n this._prev = null;\n this.pinchRecognizer = null;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PinchInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onPinchStart = this.onPinchStart.bind(this);\n this.onPinchMove = this.onPinchMove.bind(this);\n this.onPinchEnd = this.onPinchEnd.bind(this);\n }\n\n var __proto = PinchInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PinchRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.pinchRecognizer = new Pinch(hammerOption);\n this.hammer.add(this.pinchRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n this.dettachEvent();\n }\n\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PinchInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.pinchRecognizer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n }\n };\n\n __proto.onPinchStart = function (event) {\n this._base = this.observer.get(this)[this.axes[0]];\n var offset = this.getOffset(event.scale);\n this.observer.hold(this, event);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchMove = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchEnd = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this.observer.release(this, event, toAxis(this.axes, [0]), 0);\n this._base = null;\n this._prev = null;\n };\n\n __proto.getOffset = function (pinchScale, prev) {\n if (prev === void 0) {\n prev = 1;\n }\n\n return this._base * (pinchScale - prev) * this.options.scale;\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"pinchstart\", this.onPinchStart).on(\"pinchmove\", this.onPinchMove).on(\"pinchend\", this.onPinchEnd);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"pinchstart\", this.onPinchStart).off(\"pinchmove\", this.onPinchMove).off(\"pinchend\", this.onPinchEnd);\n this.observer = null;\n this._prev = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PinchInput#enable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PinchInput#disable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PinchInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pinch\").options.enable);\n };\n\n return PinchInput;\n}();\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n**/\n\n/**\n * @class eg.Axes.WheelInput\n * @classdesc 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 * 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 */\n\nvar WheelInput =\n/*#__PURE__*/\nfunction () {\n function WheelInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n useNormalized: true\n }, options);\n this.onWheel = this.onWheel.bind(this);\n }\n\n var __proto = WheelInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent();\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.WheelInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onWheel = function (event) {\n var _this = this;\n\n if (!this._isEnabled) {\n return;\n }\n\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n if (_this._isHolded) {\n _this._isHolded = false;\n\n _this.observer.release(_this, event, toAxis(_this.axes, [0]));\n }\n }, 50);\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.element.addEventListener(\"wheel\", this.onWheel);\n this._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\n this.element.removeEventListener(\"wheel\", this.onWheel);\n this._isEnabled = false;\n this.observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.WheelInput#enable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.WheelInput#disable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.WheelInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return WheelInput;\n}();\n\nvar KEY_LEFT_ARROW = 37;\nvar KEY_A = 65;\nvar KEY_UP_ARROW = 38;\nvar KEY_W = 87;\nvar KEY_RIGHT_ARROW = 39;\nvar KEY_D = 68;\nvar KEY_DOWN_ARROW = 40;\nvar KEY_S = 83;\nvar DIRECTION_REVERSE = -1;\nvar DIRECTION_FORWARD = 1;\nvar DIRECTION_HORIZONTAL$1 = -1;\nvar DIRECTION_VERTICAL$1 = 1;\nvar DELAY = 80;\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @property {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @property {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n**/\n\n/**\n * @class eg.Axes.MoveKeyInput\n * @classdesc 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 * 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 */\n\nvar MoveKeyInput =\n/*#__PURE__*/\nfunction () {\n function MoveKeyInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: [1, 1]\n }, options);\n this.onKeydown = this.onKeydown.bind(this);\n this.onKeyup = this.onKeyup.bind(this);\n }\n\n var __proto = MoveKeyInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent(); // add tabindex=\"0\" to the container for making it focusable\n\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 __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.MoveKeyInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onKeydown = function (e) {\n if (!this._isEnabled) {\n return;\n }\n\n var isMoveKey = true;\n var direction = DIRECTION_FORWARD;\n var move = DIRECTION_HORIZONTAL$1;\n\n switch (e.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL$1;\n break;\n\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL$1;\n break;\n\n default:\n isMoveKey = false;\n }\n\n if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) {\n isMoveKey = false;\n }\n\n if (!isMoveKey) {\n return;\n }\n\n var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction];\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n clearTimeout(this._timer);\n this.observer.change(this, event, toAxis(this.axes, offsets));\n };\n\n __proto.onKeyup = function (e) {\n var _this = this;\n\n if (!this._isHolded) {\n return;\n }\n\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n _this.observer.release(_this, e, toAxis(_this.axes, [0, 0]));\n\n _this._isHolded = false;\n }, DELAY);\n };\n\n __proto.attachEvent = function (observer) {\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._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\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._isEnabled = false;\n this.observer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.MoveKeyInput#enable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.MoveKeyInput#disable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.MoveKeyInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return MoveKeyInput;\n}();\n\nexport default Axes;\nexport { PanInput, RotatePanInput, PinchInput, WheelInput, MoveKeyInput };\n//# sourceMappingURL=axes.esm.js.map\n","/**\n * Original Code\n * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js\n * Math Util\n * modified by egjs\n */\n/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.2\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n// Some minimal math functionality borrowed from gl-Matrix and stripped down\n// for the purposes of this library.\n\nimport {vec2, vec3, quat} from \"gl-matrix\";\n\nfunction quatToVec3(quaternion) {\n\tconst baseV = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(baseV, baseV, quaternion);\n\treturn baseV;\n}\n\nfunction toDegree(a){\n\treturn a * 180 / Math.PI;\n}\n\nconst util = {};\n\nutil.isPowerOfTwo = function(n) {\n\treturn n && (n & (n - 1)) === 0;\n};\n\nutil.extractPitchFromQuat = function(quaternion) {\n\tconst baseV = quatToVec3(quaternion);\n\n\treturn -1 * Math.atan2(\n\t\tbaseV[1],\n\t\tMath.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2)));\n};\n\nutil.hypot = Math.hypot || function(x, y) {\n\treturn Math.sqrt(x * x + y * y);\n};\n\n// implement reference\n// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식\n// calculating angle between two vectors : http://darkpgmr.tistory.com/121\nconst ROTATE_CONSTANT = {\n\tPITCH_DELTA: 1,\n\tYAW_DELTA_BY_ROLL: 2,\n\tYAW_DELTA_BY_YAW: 3,\n};\n\nROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [0, 0, 1],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [1, 0, 0],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = {\n\ttargetAxis: [1, 0, 0],\n\tmeshPoint: [0, 0, 1],\n};\n\nfunction getRotationDelta(prevQ, curQ, rotateKind) {\n\tconst targetAxis = vec3.fromValues(\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[0],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[1],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[2]\n\t);\n\tconst meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint;\n\n\tconst prevQuaternion = quat.clone(prevQ);\n\tconst curQuaternion = quat.clone(curQ);\n\n\tquat.normalize(prevQuaternion, prevQuaternion);\n\tquat.normalize(curQuaternion, curQuaternion);\n\n\tlet prevPoint = vec3.fromValues(0, 0, 1);\n\tlet curPoint = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\tvec3.transformQuat(targetAxis, targetAxis, curQuaternion);\n\n\tconst rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint));\n\tconst rotateDirection = rotateDistance > 0 ? 1 : -1;\n\n\t// when counter clock wise, use vec3.fromValues(0,1,0)\n\t// when clock wise, use vec3.fromValues(0,-1,0)\n\t// const meshPoint1 = vec3.fromValues(0, 0, 0);\n\tconst meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\n\tlet meshPoint3;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tmeshPoint3 = vec3.fromValues(0, rotateDirection, 0);\n\t} else {\n\t\tmeshPoint3 = vec3.fromValues(rotateDirection, 0, 0);\n\t}\n\n\tvec3.transformQuat(meshPoint2, meshPoint2, curQuaternion);\n\tvec3.transformQuat(meshPoint3, meshPoint3, curQuaternion);\n\n\tconst vecU = meshPoint2;\n\tconst vecV = meshPoint3;\n\tconst vecN = vec3.create();\n\n\tvec3.cross(vecN, vecU, vecV);\n\tvec3.normalize(vecN, vecN);\n\n\tconst coefficientA = vecN[0];\n\tconst coefficientB = vecN[1];\n\tconst coefficientC = vecN[2];\n//\tconst coefficientD = -1 * vec3.dot(vecN, meshPoint1);\n\n\t// a point on the plane\n\tcurPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\n\t// a point should project on the plane\n\tprevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\n\t// distance between prevPoint and the plane\n\tlet distance = Math.abs(\n\t\tprevPoint[0] * coefficientA +\n\t\tprevPoint[1] * coefficientB +\n\t\tprevPoint[2] * coefficientC\n\t);\n\n\tconst projectedPrevPoint = vec3.create();\n\n\tvec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance));\n\n\tlet trigonometricRatio =\n\t\t(projectedPrevPoint[0] * curPoint[0] +\n\t\tprojectedPrevPoint[1] * curPoint[1] +\n\t\tprojectedPrevPoint[2] * curPoint[2]) /\n\t\t(vec3.length(projectedPrevPoint) * vec3.length(curPoint));\n\n\t// defensive block\n\ttrigonometricRatio > 1 && (trigonometricRatio = 1);\n\n\tconst theta = Math.acos(trigonometricRatio);\n\n\tconst crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint);\n\n\tdistance =\n\t\tcoefficientA * crossVec[0] +\n\t\tcoefficientB * crossVec[1] +\n\t\tcoefficientC * crossVec[2];\n\n\tlet thetaDirection;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tthetaDirection = distance > 0 ? 1 : -1;\n\t} else {\n\t\tthetaDirection = distance < 0 ? 1 : -1;\n\t}\n\n\tconst deltaRadian = theta * thetaDirection * rotateDirection;\n\n\treturn toDegree(deltaRadian);\n}\n\nfunction angleBetweenVec2(v1, v2) {\n\tconst det = v1[0] * v2[1] - v2[0] * v1[1];\n\tconst theta = -Math.atan2(det, vec2.dot(v1, v2));\n\treturn theta;\n}\n\nutil.yawOffsetBetween = function(viewDir, targetDir) {\n\tconst viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]);\n\tconst targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]);\n\n\tvec2.normalize(viewDirXZ, viewDirXZ);\n\tvec2.normalize(targetDirXZ, targetDirXZ);\n\n\tconst theta = -angleBetweenVec2(viewDirXZ, targetDirXZ);\n\n\treturn theta;\n}\n\nutil.toDegree = toDegree;\nutil.getRotationDelta = getRotationDelta;\nutil.angleBetweenVec2 = angleBetweenVec2;\n\nexport {\n\tutil,\n\tROTATE_CONSTANT,\n};\n","/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar MathUtil = window.MathUtil || {};\n\nMathUtil.degToRad = Math.PI / 180;\nMathUtil.radToDeg = 180 / Math.PI;\n\n// Some minimal math functionality borrowed from THREE.Math and stripped down\n// for the purposes of this library.\n\n\nMathUtil.Vector2 = function ( x, y ) {\n this.x = x || 0;\n this.y = y || 0;\n};\n\nMathUtil.Vector2.prototype = {\n constructor: MathUtil.Vector2,\n\n set: function ( x, y ) {\n this.x = x;\n this.y = y;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n\n return this;\n },\n\n subVectors: function ( a, b ) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n\n return this;\n },\n};\n\nMathUtil.Vector3 = function ( x, y, z ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n};\n\nMathUtil.Vector3.prototype = {\n constructor: MathUtil.Vector3,\n\n set: function ( x, y, z ) {\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n\n return this;\n },\n\n length: function () {\n return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n },\n\n normalize: function () {\n var scalar = this.length();\n\n if ( scalar !== 0 ) {\n var invScalar = 1 / scalar;\n\n this.multiplyScalar(invScalar);\n } else {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return this;\n },\n\n multiplyScalar: function ( scalar ) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n },\n\n applyQuaternion: function ( q ) {\n var x = this.x;\n var y = this.y;\n var z = this.z;\n\n var qx = q.x;\n var qy = q.y;\n var qz = q.z;\n var qw = q.w;\n\n // calculate quat * vector\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = - qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n return this;\n },\n\n dot: function ( v ) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n },\n\n crossVectors: function ( a, b ) {\n var ax = a.x, ay = a.y, az = a.z;\n var bx = b.x, by = b.y, bz = b.z;\n\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n\n return this;\n },\n};\n\nMathUtil.Quaternion = function ( x, y, z, w ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = ( w !== undefined ) ? w : 1;\n};\n\nMathUtil.Quaternion.prototype = {\n constructor: MathUtil.Quaternion,\n\n set: function ( x, y, z, w ) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n\n return this;\n },\n\n copy: function ( quaternion ) {\n this.x = quaternion.x;\n this.y = quaternion.y;\n this.z = quaternion.z;\n this.w = quaternion.w;\n\n return this;\n },\n\n setFromEulerXYZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n\n return this;\n },\n\n setFromEulerYXZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n\n return this;\n },\n\n setFromAxisAngle: function ( axis, angle ) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n\n var halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n this.x = axis.x * s;\n this.y = axis.y * s;\n this.z = axis.z * s;\n this.w = Math.cos( halfAngle );\n\n return this;\n },\n\n multiply: function ( q ) {\n return this.multiplyQuaternions( this, q );\n },\n\n multiplyQuaternions: function ( a, b ) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;\n var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;\n\n this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n return this;\n },\n\n inverse: function () {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n\n this.normalize();\n\n return this;\n },\n\n normalize: function () {\n var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n if ( l === 0 ) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 1;\n } else {\n l = 1 / l;\n\n this.x = this.x * l;\n this.y = this.y * l;\n this.z = this.z * l;\n this.w = this.w * l;\n }\n\n return this;\n },\n\n slerp: function ( qb, t ) {\n if ( t === 0 ) return this;\n if ( t === 1 ) return this.copy( qb );\n\n var x = this.x, y = this.y, z = this.z, w = this.w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z;\n\n if ( cosHalfTheta < 0 ) {\n this.w = - qb.w;\n this.x = - qb.x;\n this.y = - qb.y;\n this.z = - qb.z;\n\n cosHalfTheta = - cosHalfTheta;\n } else {\n this.copy( qb );\n }\n\n if ( cosHalfTheta >= 1.0 ) {\n this.w = w;\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n var halfTheta = Math.acos( cosHalfTheta );\n var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\n\n if ( Math.abs( sinHalfTheta ) < 0.001 ) {\n this.w = 0.5 * ( w + this.w );\n this.x = 0.5 * ( x + this.x );\n this.y = 0.5 * ( y + this.y );\n this.z = 0.5 * ( z + this.z );\n\n return this;\n }\n\n var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n this.w = ( w * ratioA + this.w * ratioB );\n this.x = ( x * ratioA + this.x * ratioB );\n this.y = ( y * ratioA + this.y * ratioB );\n this.z = ( z * ratioA + this.z * ratioB );\n\n return this;\n },\n\n setFromUnitVectors: function () {\n // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\n // assumes direction vectors vFrom and vTo are normalized\n\n var v1, r;\n var EPS = 0.000001;\n\n return function ( vFrom, vTo ) {\n if ( v1 === undefined ) v1 = new MathUtil.Vector3();\n\n r = vFrom.dot( vTo ) + 1;\n\n if ( r < EPS ) {\n r = 0;\n\n if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n v1.set( - vFrom.y, vFrom.x, 0 );\n } else {\n v1.set( 0, - vFrom.z, vFrom.y );\n }\n } else {\n v1.crossVectors( vFrom, vTo );\n }\n\n this.x = v1.x;\n this.y = v1.y;\n this.z = v1.z;\n this.w = r;\n\n this.normalize();\n\n return this;\n }\n }(),\n};\n\nmodule.exports = MathUtil;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Util = window.Util || {};\n\nUtil.MIN_TIMESTEP = 0.001;\nUtil.MAX_TIMESTEP = 1;\n\nUtil.base64 = function(mimeType, base64) {\n return 'data:' + mimeType + ';base64,' + base64;\n};\n\nUtil.clamp = function(value, min, max) {\n return Math.min(Math.max(min, value), max);\n};\n\nUtil.lerp = function(a, b, t) {\n return a + ((b - a) * t);\n};\n\n/**\n * Light polyfill for `Promise.race`. Returns\n * a promise that resolves when the first promise\n * provided resolves.\n *\n * @param {Array} promises\n */\nUtil.race = function(promises) {\n if (Promise.race) {\n return Promise.race(promises);\n }\n\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < promises.length; i++) {\n promises[i].then(resolve, reject);\n }\n });\n};\n\nUtil.isIOS = (function() {\n var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);\n return function() {\n return isIOS;\n };\n})();\n\nUtil.isWebViewAndroid = (function() {\n var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1 &&\n navigator.userAgent.indexOf('Chrome') !== -1;\n return function() {\n return isWebViewAndroid;\n };\n})();\n\nUtil.isSafari = (function() {\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n return function() {\n return isSafari;\n };\n})();\n\nUtil.isFirefoxAndroid = (function() {\n var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1;\n return function() {\n return isFirefoxAndroid;\n };\n})();\n\nUtil.isR7 = (function() {\n var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1;\n return function() {\n return isR7;\n };\n})();\n\nUtil.isLandscapeMode = function() {\n var rtn = (window.orientation == 90 || window.orientation == -90);\n return Util.isR7() ? !rtn : rtn;\n};\n\n// Helper method to validate the time steps of sensor timestamps.\nUtil.isTimestampDeltaValid = function(timestampDeltaS) {\n if (isNaN(timestampDeltaS)) {\n return false;\n }\n if (timestampDeltaS <= Util.MIN_TIMESTEP) {\n return false;\n }\n if (timestampDeltaS > Util.MAX_TIMESTEP) {\n return false;\n }\n return true;\n};\n\nUtil.getScreenWidth = function() {\n return Math.max(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.getScreenHeight = function() {\n return Math.min(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.requestFullscreen = function(element) {\n if (Util.isWebViewAndroid()) {\n return false;\n }\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.exitFullscreen = function() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.getFullscreenElement = function() {\n return document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullScreenElement ||\n document.msFullscreenElement;\n};\n\nUtil.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) {\n // No error checking for brevity.\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n for (var attribName in attribLocationMap)\n gl.bindAttribLocation(program, attribLocationMap[attribName], attribName);\n\n gl.linkProgram(program);\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n};\n\nUtil.getProgramUniforms = function(gl, program) {\n var uniforms = {};\n var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n var uniformName = '';\n for (var i = 0; i < uniformCount; i++) {\n var uniformInfo = gl.getActiveUniform(program, i);\n uniformName = uniformInfo.name.replace('[0]', '');\n uniforms[uniformName] = gl.getUniformLocation(program, uniformName);\n }\n return uniforms;\n};\n\nUtil.orthoMatrix = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\nUtil.copyArray = function (source, dest) {\n for (var i = 0, n = source.length; i < n; i++) {\n dest[i] = source[i];\n }\n};\n\nUtil.isMobile = function() {\n var check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);\n return check;\n};\n\nUtil.extend = function(dest, src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n\n return dest;\n}\n\nUtil.safariCssSizeWorkaround = function(canvas) {\n // TODO(smus): Remove this workaround when Safari for iOS is fixed.\n // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556).\n //\n // \"To the last I grapple with thee;\n // from hell's heart I stab at thee;\n // for hate's sake I spit my last breath at thee.\"\n // -- Moby Dick, by Herman Melville\n if (Util.isIOS()) {\n var width = canvas.style.width;\n var height = canvas.style.height;\n canvas.style.width = (parseInt(width) + 1) + 'px';\n canvas.style.height = (parseInt(height)) + 'px';\n setTimeout(function() {\n canvas.style.width = width;\n canvas.style.height = height;\n }, 100);\n }\n\n // Debug only.\n window.Util = Util;\n window.canvas = canvas;\n};\n\nUtil.isDebug = function() {\n return Util.getQueryParameter('debug');\n};\n\nUtil.getQueryParameter = function(name) {\n var name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n results = regex.exec(location.search);\n return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n};\n\nUtil.frameDataFromPose = (function() {\n var piOver180 = Math.PI / 180.0;\n var rad45 = Math.PI * 0.25;\n\n // Borrowed from glMatrix.\n function mat4_perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45),\n downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45),\n leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45),\n rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n\n function mat4_fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n };\n\n function mat4_translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n };\n\n function mat4_invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n };\n\n var defaultOrientation = new Float32Array([0, 0, 0, 1]);\n var defaultPosition = new Float32Array([0, 0, 0]);\n\n function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) {\n mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar);\n\n var orientation = pose.orientation || defaultOrientation;\n var position = pose.position || defaultPosition;\n\n mat4_fromRotationTranslation(view, orientation, position);\n if (parameters)\n mat4_translate(view, view, parameters.offset);\n mat4_invert(view, view);\n }\n\n return function(frameData, pose, vrDisplay) {\n if (!frameData || !pose)\n return false;\n\n frameData.pose = pose;\n frameData.timestamp = pose.timestamp;\n\n updateEyeMatrices(\n frameData.leftProjectionMatrix, frameData.leftViewMatrix,\n pose, vrDisplay.getEyeParameters(\"left\"), vrDisplay);\n updateEyeMatrices(\n frameData.rightProjectionMatrix, frameData.rightViewMatrix,\n pose, vrDisplay.getEyeParameters(\"right\"), vrDisplay);\n\n return true;\n };\n})();\n\nUtil.isInsideCrossDomainIFrame = function() {\n var isFramed = (window.self !== window.top);\n var refDomain = Util.getDomainFromUrl(document.referrer);\n var thisDomain = Util.getDomainFromUrl(window.location.href);\n\n return isFramed && (refDomain !== thisDomain);\n};\n\n// From http://stackoverflow.com/a/23945027.\nUtil.getDomainFromUrl = function(url) {\n var domain;\n // Find & remove protocol (http, ftp, etc.) and get domain.\n if (url.indexOf(\"://\") > -1) {\n domain = url.split('/')[2];\n }\n else {\n domain = url.split('/')[0];\n }\n\n //find & remove port number\n domain = domain.split(':')[0];\n\n return domain;\n}\n\nmodule.exports = Util;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar MathUtil = require('../math-util');\nvar Util = require('../util');\n\n/**\n * Given an orientation and the gyroscope data, predicts the future orientation\n * of the head. This makes rendering appear faster.\n *\n * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf\n *\n * @param {Number} predictionTimeS time from head movement to the appearance of\n * the corresponding image.\n */\nfunction PosePredictor(predictionTimeS) {\n this.predictionTimeS = predictionTimeS;\n\n // The quaternion corresponding to the previous state.\n this.previousQ = new MathUtil.Quaternion();\n // Previous time a prediction occurred.\n this.previousTimestampS = null;\n\n // The delta quaternion that adjusts the current pose.\n this.deltaQ = new MathUtil.Quaternion();\n // The output quaternion.\n this.outQ = new MathUtil.Quaternion();\n}\n\nPosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) {\n if (!this.previousTimestampS) {\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n return currentQ;\n }\n\n // Calculate axis and angle based on gyroscope rotation rate data.\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n\n var angularSpeed = gyro.length();\n\n // If we're rotating slowly, don't do prediction.\n if (angularSpeed < MathUtil.degToRad * 20) {\n if (Util.isDebug()) {\n console.log('Moving slowly, at %s deg/s: no prediction',\n (MathUtil.radToDeg * angularSpeed).toFixed(1));\n }\n this.outQ.copy(currentQ);\n this.previousQ.copy(currentQ);\n return this.outQ;\n }\n\n // Get the predicted angle based on the time delta and latency.\n var deltaT = timestampS - this.previousTimestampS;\n var predictAngle = angularSpeed * this.predictionTimeS;\n\n this.deltaQ.setFromAxisAngle(axis, predictAngle);\n this.outQ.copy(this.previousQ);\n this.outQ.multiply(this.deltaQ);\n\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n\n return this.outQ;\n};\n\n\nmodule.exports = PosePredictor;\n","import {userAgent} from \"../utils/browserFeature\";\n/**\n * Returns a number value indiciating the version of Chrome being used,\n * or otherwise `null` if not on Chrome.\n *\n * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19\n */\n/**\n * In Chrome m65, `devicemotion` events are broken but subsequently fixed\n * in 65.0.3325.148. Since many browsers use Chromium, ensure that\n * we scope this detection by branch and build numbers to provide\n * a proper fallback.\n * https://github.com/immersive-web/webvr-polyfill/issues/307\n */\nlet version = -1; // It should not be null because it will be compared with number\nlet branch = null;\nlet build = null;\n\nconst match = /Chrome\\/([0-9]+)\\.(?:[0-9]*)\\.([0-9]*)\\.([0-9]*)/i.exec(userAgent);\n\nif (match) {\n\tversion = parseInt(match[1], 10);\n\tbranch = match[2];\n\tbuild = match[3];\n}\n\nconst CHROME_VERSION = version;\nconst IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === \"3325\" && parseInt(build, 10) < 148;\nconst IS_ANDROID = /Android/i.test(userAgent);\n\nconst CONTROL_MODE_VR = 1;\nconst CONTROL_MODE_YAWPITCH = 2;\n\nconst TOUCH_DIRECTION_NONE = 1;\nconst TOUCH_DIRECTION_YAW = 2;\nconst TOUCH_DIRECTION_PITCH = 4;\nconst TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH;\n\n/* Const for MovableCoord */\nconst MC_DECELERATION = 0.0014;\nconst MC_MAXIMUM_DURATION = 1000;\nconst MC_BIND_SCALE = [0.20, 0.20];\n\nconst MIN_FIELD_OF_VIEW = 20;\nconst MAX_FIELD_OF_VIEW = 110;\nconst PAN_SCALE = 320;\n\n// const DELTA_THRESHOLD = 0.015;\n// const DELTA_THRESHOLD = 0.09; // Note4\n// const DELTA_THRESHOLD = 0.0825;\n// const DELTA_THRESHOLD = 0.075;\n// const DELTA_THRESHOLD = 0.06;\n// const DELTA_THRESHOLD = 0.045;\nconst DELTA_THRESHOLD = 0.0375; // Note2\n\nconst YAW_RANGE_HALF = 180;\nconst PITCH_RANGE_HALF = 90;\nconst CIRCULAR_PITCH_RANGE_HALF = 180;\nconst PINCH_EVENTS = \"pinchstart pinchmove pinchend\";\n\nconst KEYMAP = {\n\tLEFT_ARROW: 37,\n\tA: 65,\n\tUP_ARROW: 38,\n\tW: 87,\n\tRIGHT_ARROW: 39,\n\tD: 68,\n\tDOWN_ARROW: 40,\n\tS: 83,\n};\n\nconst GYRO_MODE = {\n\tNONE: \"none\",\n\tYAWPITCH: \"yawPitch\",\n\tVR: \"VR\"\n};\n\nexport {\n\tGYRO_MODE,\n\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\n\tTOUCH_DIRECTION_NONE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMIN_FIELD_OF_VIEW,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tDELTA_THRESHOLD,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tPINCH_EVENTS,\n\tKEYMAP,\n\n\tCHROME_VERSION,\n\tIS_CHROME_WITHOUT_DEVICE_MOTION,\n\tIS_ANDROID\n};\n","import Component from \"@egjs/component\";\nimport {vec3} from \"gl-matrix\";\nimport {window} from \"../../utils/browser\";\nimport {IS_CHROME_WITHOUT_DEVICE_MOTION, IS_ANDROID} from \"../consts\";\n\nconst STILLNESS_THRESHOLD = 200; // millisecond\n\nexport default class DeviceMotion extends Component {\n\tconstructor() {\n\t\tsuper();\n\t\tthis._onDeviceMotion = this._onDeviceMotion.bind(this);\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onChromeWithoutDeviceMotion = this._onChromeWithoutDeviceMotion.bind(this);\n\n\t\tthis.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION;\n\t\tthis.isAndroid = IS_ANDROID;\n\n\t\tthis.stillGyroVec = vec3.create();\n\t\tthis.rawGyroVec = vec3.create();\n\t\tthis.adjustedGyroVec = vec3.create();\n\n\t\tthis._timer = null;\n\n\t\tthis.lastDevicemotionTimestamp = 0;\n\t\tthis._isEnabled = false;\n\t\tthis.enable();\n\t}\n\t_onChromeWithoutDeviceMotion(e) {\n\t\tlet {alpha, beta, gamma} = e;\n\n\t\t// There is deviceorientation event trigged with empty values\n\t\t// on Headless Chrome.\n\t\tif (alpha === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// convert to radian\n\t\talpha = (alpha || 0) * Math.PI / 180;\n\t\tbeta = (beta || 0) * Math.PI / 180;\n\t\tgamma = (gamma || 0) * Math.PI / 180;\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: {\n\t\t\t\tdeviceorientation: {\n\t\t\t\t\talpha,\n\t\t\t\t\tbeta,\n\t\t\t\t\tgamma: -gamma\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t_onDeviceOrientation() {\n\t\tthis._timer && clearTimeout(this._timer);\n\t\tthis._timer = setTimeout(() => {\n\t\t\tif ((new Date().getTime() - this.lastDevicemotionTimestamp) < STILLNESS_THRESHOLD) {\n\t\t\t\tvec3.copy(this.stillGyroVec, this.rawGyroVec);\n\t\t\t}\n\t\t}, STILLNESS_THRESHOLD);\n\t}\n\t_onDeviceMotion(e) {\n\t\t// desktop chrome triggers devicemotion event with empthy sensor values.\n\t\t// Those events should ignored.\n\t\tconst isGyroSensorAvailable = !(e.rotationRate.alpha == null);\n\t\tconst isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null);\n\n\t\tif (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst devicemotionEvent = Object.assign({}, e);\n\n\t\tdevicemotionEvent.interval = e.interval;\n\t\tdevicemotionEvent.timeStamp = e.timeStamp;\n\t\tdevicemotionEvent.type = e.type;\n\t\tdevicemotionEvent.rotationRate = {\n\t\t\talpha: e.rotationRate.alpha,\n\t\t\tbeta: e.rotationRate.beta,\n\t\t\tgamma: e.rotationRate.gamma,\n\t\t};\n\t\tdevicemotionEvent.accelerationIncludingGravity = {\n\t\t\tx: e.accelerationIncludingGravity.x,\n\t\t\ty: e.accelerationIncludingGravity.y,\n\t\t\tz: e.accelerationIncludingGravity.z,\n\t\t};\n\t\tdevicemotionEvent.acceleration = {\n\t\t\tx: e.acceleration.x,\n\t\t\ty: e.acceleration.y,\n\t\t\tz: e.acceleration.z,\n\t\t};\n\n\t\tif (this.isAndroid) {\n\t\t\tvec3.set(\n\t\t\t\tthis.rawGyroVec,\n\t\t\t\te.rotationRate.alpha || 0,\n\t\t\t\te.rotationRate.beta || 0,\n\t\t\t\te.rotationRate.gamma || 0);\n\t\t\tvec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec);\n\t\t\tthis.lastDevicemotionTimestamp = new Date().getTime();\n\n\t\t\tdevicemotionEvent.adjustedRotationRate = {\n\t\t\t\talpha: this.adjustedGyroVec[0],\n\t\t\t\tbeta: this.adjustedGyroVec[1],\n\t\t\t\tgamma: this.adjustedGyroVec[2]};\n\t\t}\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: devicemotionEvent\n\t\t});\n\t}\n\tenable() {\n\t\tif (this.isAndroid) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\t}\n\t\tif (this.isWithoutDeviceMotion) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\t} else {\n\t\t\twindow.addEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\t}\n\t\tthis._isEnabled = true;\n\t}\n\tdisable() {\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\twindow.removeEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\tthis._isEnabled = false;\n\t}\n}\n","function SensorSample(sample, timestampS) {\n this.set(sample, timestampS);\n};\n\nSensorSample.prototype.set = function(sample, timestampS) {\n this.sample = sample;\n this.timestampS = timestampS;\n};\n\nSensorSample.prototype.copy = function(sensorSample) {\n this.set(sensorSample.sample, sensorSample.timestampS);\n};\n\nmodule.exports = SensorSample;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar SensorSample = require('./sensor-sample.js');\nvar MathUtil = require('../math-util.js');\nvar Util = require('../util.js');\n\n/**\n * An implementation of a simple complementary filter, which fuses gyroscope and\n * accelerometer data from the 'devicemotion' event.\n *\n * Accelerometer data is very noisy, but stable over the long term.\n * Gyroscope data is smooth, but tends to drift over the long term.\n *\n * This fusion is relatively simple:\n * 1. Get orientation estimates from accelerometer by applying a low-pass filter\n * on that data.\n * 2. Get orientation estimates from gyroscope by integrating over time.\n * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the\n * short term.\n */\nfunction ComplementaryFilter(kFilter) {\n this.kFilter = kFilter;\n\n // Raw sensor measurements.\n this.currentAccelMeasurement = new SensorSample();\n this.currentGyroMeasurement = new SensorSample();\n this.previousGyroMeasurement = new SensorSample();\n\n // Set default look direction to be in the correct direction.\n if (Util.isIOS()) {\n this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1);\n } else {\n this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1);\n }\n this.previousFilterQ = new MathUtil.Quaternion();\n this.previousFilterQ.copy(this.filterQ);\n\n // Orientation based on the accelerometer.\n this.accelQ = new MathUtil.Quaternion();\n // Whether or not the orientation has been initialized.\n this.isOrientationInitialized = false;\n // Running estimate of gravity based on the current orientation.\n this.estimatedGravity = new MathUtil.Vector3();\n // Measured gravity based on accelerometer.\n this.measuredGravity = new MathUtil.Vector3();\n\n // Debug only quaternion of gyro-based orientation.\n this.gyroIntegralQ = new MathUtil.Quaternion();\n}\n\nComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) {\n this.currentAccelMeasurement.set(vector, timestampS);\n};\n\nComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {\n this.currentGyroMeasurement.set(vector, timestampS);\n\n var deltaT = timestampS - this.previousGyroMeasurement.timestampS;\n if (Util.isTimestampDeltaValid(deltaT)) {\n this.run_();\n }\n\n this.previousGyroMeasurement.copy(this.currentGyroMeasurement);\n};\n\nComplementaryFilter.prototype.run_ = function() {\n\n if (!this.isOrientationInitialized) {\n this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n this.previousFilterQ.copy(this.accelQ);\n this.isOrientationInitialized = true;\n return;\n }\n\n var deltaT = this.currentGyroMeasurement.timestampS -\n this.previousGyroMeasurement.timestampS;\n\n // Convert gyro rotation vector to a quaternion delta.\n var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n this.gyroIntegralQ.multiply(gyroDeltaQ);\n\n // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n this.filterQ.copy(this.previousFilterQ);\n this.filterQ.multiply(gyroDeltaQ);\n\n // Calculate the delta between the current estimated gravity and the real\n // gravity vector from accelerometer.\n var invFilterQ = new MathUtil.Quaternion();\n invFilterQ.copy(this.filterQ);\n invFilterQ.inverse();\n\n this.estimatedGravity.set(0, 0, -1);\n this.estimatedGravity.applyQuaternion(invFilterQ);\n this.estimatedGravity.normalize();\n\n this.measuredGravity.copy(this.currentAccelMeasurement.sample);\n this.measuredGravity.normalize();\n\n // Compare estimated gravity with measured gravity, get the delta quaternion\n // between the two.\n var deltaQ = new MathUtil.Quaternion();\n deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n deltaQ.inverse();\n\n if (Util.isDebug()) {\n console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)',\n MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ),\n (this.estimatedGravity.x).toFixed(1),\n (this.estimatedGravity.y).toFixed(1),\n (this.estimatedGravity.z).toFixed(1),\n (this.measuredGravity.x).toFixed(1),\n (this.measuredGravity.y).toFixed(1),\n (this.measuredGravity.z).toFixed(1));\n }\n\n // Calculate the SLERP target: current orientation plus the measured-estimated\n // quaternion delta.\n var targetQ = new MathUtil.Quaternion();\n targetQ.copy(this.filterQ);\n targetQ.multiply(deltaQ);\n\n // SLERP factor: 0 is pure gyro, 1 is pure accel.\n this.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n this.previousFilterQ.copy(this.filterQ);\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n return this.filterQ;\n};\n\nComplementaryFilter.prototype.accelToQuaternion_ = function(accel) {\n var normAccel = new MathUtil.Vector3();\n normAccel.copy(accel);\n normAccel.normalize();\n var quat = new MathUtil.Quaternion();\n quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel);\n quat.inverse();\n return quat;\n};\n\nComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) {\n // Extract axis and angle from the gyroscope data.\n var quat = new MathUtil.Quaternion();\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n quat.setFromAxisAngle(axis, gyro.length() * dt);\n return quat;\n};\n\n\nmodule.exports = ComplementaryFilter;\n","import MathUtil from \"webvr-polyfill/src/math-util\";\nimport ComplementaryFilter from \"webvr-polyfill/src/sensor-fusion/complementary-filter\";\n\nComplementaryFilter.prototype.run_ = function() {\n\tif (!this.isOrientationInitialized) {\n\t\tthis.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n\t\tthis.previousFilterQ.copy(this.accelQ);\n\t\tthis.isOrientationInitialized = true;\n\t\treturn;\n\t}\n\n\tconst deltaT = this.currentGyroMeasurement.timestampS -\n\tthis.previousGyroMeasurement.timestampS;\n\n\t// Convert gyro rotation vector to a quaternion delta.\n\tconst gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n\n\tthis.gyroIntegralQ.multiply(gyroDeltaQ);\n\n\t// filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n\tthis.filterQ.copy(this.previousFilterQ);\n\tthis.filterQ.multiply(gyroDeltaQ);\n\n\t// Calculate the delta between the current estimated gravity and the real\n\t// gravity vector from accelerometer.\n\tconst invFilterQ = new MathUtil.Quaternion();\n\n\tinvFilterQ.copy(this.filterQ);\n\tinvFilterQ.inverse();\n\n\tthis.estimatedGravity.set(0, 0, -1);\n\tthis.estimatedGravity.applyQuaternion(invFilterQ);\n\tthis.estimatedGravity.normalize();\n\n\tthis.measuredGravity.copy(this.currentAccelMeasurement.sample);\n\tthis.measuredGravity.normalize();\n\n\t// Compare estimated gravity with measured gravity, get the delta quaternion\n\t// between the two.\n\tconst deltaQ = new MathUtil.Quaternion();\n\n\tdeltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n\tdeltaQ.inverse();\n\n\t// Calculate the SLERP target: current orientation plus the measured-estimated\n\t// quaternion delta.\n\tconst targetQ = new MathUtil.Quaternion();\n\n\ttargetQ.copy(this.filterQ);\n\ttargetQ.multiply(deltaQ);\n\n\t// SLERP factor: 0 is pure gyro, 1 is pure accel.\n\tthis.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n\tthis.previousFilterQ.copy(this.filterQ);\n\n\tif (!this.isFilterQuaternionInitialized) {\n\t\tthis.isFilterQuaternionInitialized = true;\n\t}\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n\tif (this.isFilterQuaternionInitialized) {\n\t\treturn this.filterQ;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexport default ComplementaryFilter;\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport PosePredictor from \"webvr-polyfill/src/sensor-fusion/pose-predictor\";\nimport MathUtil from \"webvr-polyfill/src/math-util\";\nimport Util from \"webvr-polyfill/src/util\";\nimport {window, IS_IOS, IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\nimport DeviceMotion from \"./DeviceMotion\";\nimport ComplementaryFilter from \"./ComplementaryFilter\";\nimport {CHROME_VERSION} from \"../consts\";\n\nconst K_FILTER = 0.98;\nconst PREDICTION_TIME_S = 0.040;\n\nexport default class FusionPoseSensor extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.deviceMotion = new DeviceMotion();\n\n\t\tthis.accelerometer = new MathUtil.Vector3();\n\t\tthis.gyroscope = new MathUtil.Vector3();\n\n\t\tthis._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);\n\t\tthis._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);\n\n\t\tthis.filter = new ComplementaryFilter(K_FILTER);\n\t\tthis.posePredictor = new PosePredictor(PREDICTION_TIME_S);\n\n\t\tthis.filterToWorldQ = new MathUtil.Quaternion();\n\n\t\tthis.isFirefoxAndroid = Util.isFirefoxAndroid();\n\t\t// This includes iPhone & iPad(both desktop and mobile mode) ref #326\n\t\tthis.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP;\n\n\t\t// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18\n\t\tthis.isChromeUsingDegrees = CHROME_VERSION >= 66;\n\n\t\tthis._isEnabled = false;\n\n\t\t// Set the filter to world transform, depending on OS.\n\t\tif (this.isIOS) {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);\n\t\t} else {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);\n\t\t}\n\n\t\tthis.inverseWorldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.worldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1),\n\t\t\t-window.orientation * Math.PI / 180);\n\n\t\tthis._setScreenTransform();\n\t\t// Adjust this filter for being in landscape mode.\n\t\tif (Util.isLandscapeMode()) {\n\t\t\tthis.filterToWorldQ.multiply(this.inverseWorldToScreenQ);\n\t\t}\n\n\t\t// Keep track of a reset transform for resetSensor.\n\t\tthis.resetQ = new MathUtil.Quaternion();\n\n\t\tthis.deviceMotion.on(\"devicemotion\", this._onDeviceMotionChange);\n\t\tthis.enable();\n\t}\n\tenable() {\n\t\tif (this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.enable();\n\t\tthis._isEnabled = true;\n\t\twindow.addEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tdisable() {\n\t\tif (!this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.disable();\n\t\tthis._isEnabled = false;\n\t\twindow.removeEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tisEnabled() {\n\t\treturn this._isEnabled;\n\t}\n\tdestroy() {\n\t\tthis.disable();\n\t\tthis.deviceMotion = null;\n\t}\n\t_triggerChange() {\n\t\tconst orientation = this.getOrientation();\n\n\t\t// if orientation is not prepared. don't trigger change event\n\t\tif (!orientation) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._prevOrientation) {\n\t\t\tthis._prevOrientation = orientation;\n\t\t\treturn;\n\t\t}\n\n\t\tif (quat.equals(this._prevOrientation, orientation)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.trigger(\"change\", {quaternion: orientation});\n\t}\n\tgetOrientation() {\n\t\tlet orientation;\n\n\t\t// Hack around using deviceorientation instead of devicemotion\n\t\tif (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) {\n\t\t\tthis.deviceOrientationFixQ = this.deviceOrientationFixQ || (() => {\n\t\t\t\tconst y = new MathUtil.Quaternion()\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -this._alpha);\n\n\t\t\t\treturn y;\n\t\t\t})();\n\n\t\t\torientation = this._deviceOrientationQ;\n\t\t\tconst out = new MathUtil.Quaternion();\n\n\t\t\tout.copy(orientation);\n\t\t\tout.multiply(this.filterToWorldQ);\n\t\t\tout.multiply(this.resetQ);\n\t\t\tout.multiply(this.worldToScreenQ);\n\t\t\tout.multiplyQuaternions(this.deviceOrientationFixQ, out);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t} else {\n\t\t\t// Convert from filter space to the the same system used by the\n\t\t\t// deviceorientation event.\n\t\t\torientation = this.filter.getOrientation();\n\n\t\t\tif (!orientation) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst out = this._convertFusionToPredicted(orientation);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t}\n\t}\n\t_convertFusionToPredicted(orientation) {\n\t\t// Predict orientation.\n\t\tthis.predictedQ =\n\t\t\tthis.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS);\n\n\t\t// Convert to THREE coordinate system: -Z forward, Y up, X right.\n\t\tconst out = new MathUtil.Quaternion();\n\n\t\tout.copy(this.filterToWorldQ);\n\t\tout.multiply(this.resetQ);\n\t\tout.multiply(this.predictedQ);\n\t\tout.multiply(this.worldToScreenQ);\n\n\t\treturn out;\n\t}\n\t_onDeviceMotionChange({inputEvent}) {\n\t\tconst deviceorientation = inputEvent.deviceorientation;\n\t\tconst deviceMotion = inputEvent;\n\t\tconst accGravity = deviceMotion.accelerationIncludingGravity;\n\t\tconst rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate;\n\t\tlet timestampS = deviceMotion.timeStamp / 1000;\n\n\t\tif (deviceorientation) {\n\t\t\tif (!this._alpha) {\n\t\t\t\tthis._alpha = deviceorientation.alpha;\n\t\t\t}\n\t\t\tthis._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion();\n\t\t\tthis._deviceOrientationQ.setFromEulerYXZ(\n\t\t\t\tdeviceorientation.beta,\n\t\t\t\tdeviceorientation.alpha,\n\t\t\t\tdeviceorientation.gamma\n\t\t\t);\n\n\t\t\tthis._triggerChange();\n\t\t} else {\n\t\t\t// Firefox Android timeStamp returns one thousandth of a millisecond.\n\t\t\tif (this.isFirefoxAndroid) {\n\t\t\t\ttimestampS /= 1000;\n\t\t\t}\n\n\t\t\tthis.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z);\n\t\t\tthis.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma);\n\n\t\t\t// Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate`\n\t\t\t// is reported in degrees, so we first convert to radians.\n\t\t\tif (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) {\n\t\t\t\tthis.gyroscope.multiplyScalar(Math.PI / 180);\n\t\t\t}\n\n\t\t\tthis.filter.addAccelMeasurement(this.accelerometer, timestampS);\n\t\t\tthis.filter.addGyroMeasurement(this.gyroscope, timestampS);\n\n\t\t\tthis._triggerChange();\n\n\t\t\tthis.previousTimestampS = timestampS;\n\t\t}\n\t}\n\t_onScreenOrientationChange(screenOrientation) {\n\t\tthis._setScreenTransform(window.orientation);\n\t}\n\t_setScreenTransform() {\n\t\tthis.worldToScreenQ.set(0, 0, 0, 1);\n\n\t\tconst orientation = window.orientation;\n\n\t\tswitch (orientation) {\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tcase 90:\n\t\t\tcase -90:\n\t\t\tcase 180:\n\t\t\t\tthis.worldToScreenQ\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.inverseWorldToScreenQ.copy(this.worldToScreenQ);\n\t\tthis.inverseWorldToScreenQ.inverse();\n\t}\n}\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport {toAxis} from \"../utils\";\nimport FusionPoseSensor from \"./FusionPoseSensor\";\nimport {util, ROTATE_CONSTANT} from \"../../utils/math-util\";\n\nfunction getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(util.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nfunction getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n\nexport default class TiltMotionInput extends Component {\n\tconstructor(el, options) {\n\t\tsuper();\n\t\tthis.element = el;\n\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\n\t\tthis.fusionPoseSensor = null;\n\n\t\tthis.options = Object.assign({\n\t\t\tscale: 1,\n\t\t\tthreshold: 0,\n\t\t}, options);\n\n\t\tthis._onPoseChange = this._onPoseChange.bind(this);\n\t}\n\tmapAxes(axes) {\n\t\tthis.axes = axes;\n\t}\n\tconnect(observer) {\n\t\tif (this.observer) {\n\t\t\treturn this;\n\t\t}\n\t\tthis.observer = observer;\n\t\tthis.fusionPoseSensor = new FusionPoseSensor();\n\t\tthis.fusionPoseSensor.enable();\n\t\tthis._attachEvent();\n\t\treturn this;\n\t}\n\tdisconnect() {\n\t\tif (!this.observer) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._dettachEvent();\n\t\tthis.fusionPoseSensor.disable();\n\t\tthis.fusionPoseSensor.destroy();\n\t\tthis.fusionPoseSensor = null;\n\t\tthis.observer = null;\n\t\treturn this;\n\t}\n\tdestroy() {\n\t\tthis.disconnect();\n\t\tthis.element = null;\n\t\tthis.options = null;\n\t\tthis.axes = null;\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\t}\n\t_onPoseChange(event) {\n\t\tif (!this._prevQuaternion) {\n\t\t\tthis._prevQuaternion = quat.clone(event.quaternion);\n\t\t\tthis._quaternion = quat.clone(event.quaternion);\n\t\t\treturn;\n\t\t}\n\n\t\tquat.copy(this._prevQuaternion, this._quaternion);\n\t\tquat.copy(this._quaternion, event.quaternion);\n\n\t\tthis.observer.change(this, event, toAxis(this.axes, [\n\t\t\tgetDeltaYaw(this._prevQuaternion, this._quaternion),\n\t\t\tgetDeltaPitch(this._prevQuaternion, this._quaternion)\n\t\t]));\n\t}\n\t_attachEvent() {\n\t\tthis.fusionPoseSensor.on(\"change\", this._onPoseChange);\n\t}\n\t_dettachEvent() {\n\t\tthis.fusionPoseSensor.off(\"change\", this._onPoseChange);\n\t}\n}\n","import {\n\tutil as mathUtil,\n\tROTATE_CONSTANT,\n} from \"../utils/math-util\";\n\nexport function toAxis(source, offset) {\n\treturn offset.reduce((acc, v, i) => {\n\t\tif (source[i]) {\n\t\t\tacc[source[i]] = v;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(mathUtil.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nexport function getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n","import {glMatrix} from \"gl-matrix\";\nimport {window} from \"../utils/browser\";\n\n// Singleton\nlet screenRotationAngleInst = null;\nlet refCount = 0;\n\nexport default class ScreenRotationAngle {\n\tconstructor() {\n\t\trefCount++;\n\n\t\tif (screenRotationAngleInst) {\n\t\t\treturn screenRotationAngleInst;\n\t\t}\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = this;\n\t\t/* eslint-enable */\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onOrientationChange = this._onOrientationChange.bind(this);\n\n\t\tthis._spinR = 0;\n\n\t\tthis._screenOrientationAngle = 0;\n\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.addEventListener(\"orientationchange\", this._onOrientationChange);\n\t}\n\n\t_onDeviceOrientation(e) {\n\t\tif (e.beta === null || e.gamma === null) {\n\t\t\t// (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it.\n\t\t\treturn;\n\t\t}\n\n\t\t// Radian\n\t\tconst betaR = glMatrix.toRadian(e.beta);\n\t\tconst gammaR = glMatrix.toRadian(e.gamma);\n\n\t\t/* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */\n\t\tthis._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR));\n\t}\n\n\t_onOrientationChange(e) {\n\t\tif (window.screen && window.screen.orientation && window.screen.orientation.angle !== undefined) {\n\t\t\tthis._screenOrientationAngle = screen.orientation.angle;\n\t\t} else if (window.orientation !== undefined) {\n\t\t\t/* iOS */\n\t\t\tthis._screenOrientationAngle = window.orientation >= 0 ?\n\t\t\t\twindow.orientation : 360 + window.orientation;\n\t\t}\n\t}\n\n\tgetRadian() {\n\t\t// Join with screen orientation\n\t\t// this._testVal = this._spinR + \", \" + this._screenOrientationAngle + \", \" + window.orientation;\n\t\treturn this._spinR + glMatrix.toRadian(this._screenOrientationAngle);\n\t}\n\n\tunref() {\n\t\tif (--refCount > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"orientationchange\", this._onOrientationChange);\n\n\t\tthis._spinR = 0;\n\t\tthis._screenOrientationAngle = 0;\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = null;\n\t\t/* eslint-enable */\n\t\trefCount = 0;\n\t}\n}\n","import Axes, {PanInput} from \"@egjs/axes\";\nimport ScreenRotationAngle from \"../ScreenRotationAngle\";\n\n/**\n * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle.\n *\n * The reason for using this function is that in VR mode,\n * the roll angle is adjusted in the direction opposite to the screen rotation angle.\n *\n * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.\n * @extends PanInput\n */\nexport default class RotationPanInput extends PanInput {\n\t/**\n\t * Constructor\n\t *\n\t * @private\n\t * @param {HTMLElement} el target element\n\t * @param {Object} [options] The option object\n\t * @param {Boolean} [options.useRotation] Whether to use rotation(or VR)\n\t */\n\tconstructor(el, options) {\n\t\tsuper(el, options);\n\n\t\tthis._useRotation = false;\n\t\tthis._screenRotationAngle = null;\n\n\t\tthis.setUseRotation(!!(options && options.useRotation));\n\n\t\tthis._userDirection = Axes.DIRECTION_ALL;\n\t}\n\n\tsetUseRotation(useRotation) {\n\t\tthis._useRotation = useRotation;\n\n\t\tif (this._screenRotationAngle) {\n\t\t\tthis._screenRotationAngle.unref();\n\t\t\tthis._screenRotationAngle = null;\n\t\t}\n\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle = new ScreenRotationAngle();\n\t\t}\n\t}\n\n\tconnect(observer) {\n\t\t// User intetened direction\n\t\tthis._userDirection = this._direction;\n\n\t\t// In VR Mode, Use ALL direction if direction is not none\n\t\t// Because horizontal and vertical is changed dynamically by screen rotation.\n\t\t// this._direction is used to initialize hammerjs\n\t\tif (this._useRotation && (this._direction & Axes.DIRECTION_ALL)) {\n\t\t\tthis._direction = Axes.DIRECTION_HORIZONTAL;\n\t\t}\n\n\t\tsuper.connect(observer);\n\t}\n\n\tgetOffset(properties, useDirection) {\n\t\tif (this._useRotation === false) {\n\t\t\treturn super.getOffset(properties, useDirection);\n\t\t}\n\n\t\tconst offset = super.getOffset(properties, [true, true]);\n\t\tconst newOffset = [0, 0];\n\n\t\tconst theta = this._screenRotationAngle.getRadian();\n\n\t\tconst cosTheta = Math.cos(theta);\n\t\tconst sinTheta = Math.sin(theta);\n\n\t\t// RotateZ\n\t\tnewOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta;\n\t\tnewOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta;\n\n\t\t// Use only user allowed direction.\n\t\tif (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) {\n\t\t\tnewOffset[0] = 0;\n\t\t} else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) {\n\t\t\tnewOffset[1] = 0;\n\t\t}\n\n\t\treturn newOffset;\n\t}\n\n\tdestroy() {\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle && this._screenRotationAngle.unref();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n\n/**\n * Override getDirectionByAngle to return DIRECTION_ALL\n * Ref: https://github.com/naver/egjs-axes/issues/99\n *\n * But we obey axes's rule. If axes's rule is problem, let's apply following code.\n */\n// PanInput.getDirectionByAngle = function (angle, thresholdAngle) {\n// \treturn DIRECTION_ALL;\n// };\n","import Component from \"@egjs/component\";\nimport {vec3, glMatrix, quat} from \"gl-matrix\";\nimport FusionPoseSensor from \"./input/FusionPoseSensor\";\n\nconst Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0);\n\nexport default class DeviceQuaternion extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._fusionPoseSensor = new FusionPoseSensor();\n\t\tthis._quaternion = quat.create();\n\n\t\tthis._fusionPoseSensor.enable();\n\t\tthis._fusionPoseSensor.on(\"change\", e => {\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis.trigger(\"change\", {isTrusted: true});\n\t\t});\n\t}\n\n\tgetCombinedQuaternion(yaw) {\n\t\tconst yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw));\n\t\tconst conj = quat.conjugate(quat.create(), this._quaternion);\n\t\t// Multiply pitch quaternion -> device quaternion -> yaw quaternion\n\t\tconst outQ = quat.multiply(quat.create(), conj, yawQ);\n\n\t\treturn outQ;\n\t}\n\n\tdestroy() {\n\t\t// detach all event handler\n\t\tthis.off();\n\n\t\tif (this._fusionPoseSensor) {\n\t\t\tthis._fusionPoseSensor.off();\n\t\t\tthis._fusionPoseSensor.destroy();\n\t\t\tthis._fusionPoseSensor = null;\n\t\t}\n\t}\n}\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport Axes, {PinchInput, MoveKeyInput, WheelInput} from \"@egjs/axes\";\nimport {vec2, glMatrix} from \"gl-matrix\";\nimport {getComputedStyle, SUPPORT_TOUCH, SUPPORT_DEVICEMOTION} from \"../utils/browserFeature\";\nimport TiltMotionInput from \"./input/TiltMotionInput\";\nimport RotationPanInput from \"./input/RotationPanInput\";\nimport DeviceQuaternion from \"./DeviceQuaternion\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {\n\tGYRO_MODE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\tTOUCH_DIRECTION_NONE,\n} from \"./consts\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF];\nconst DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF];\nconst CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF];\n\n/**\n * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates.\n *\n * @alias eg.YawPitchControl\n * @extends eg.Component\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n */\nclass YawPitchControl extends Component {\n\tstatic VERSION = VERSION;\n\t// Expose DeviceOrientationControls sub module for test purpose\n\tstatic CONTROL_MODE_VR = CONTROL_MODE_VR;\n\tstatic CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH;\n\tstatic TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL;\n\tstatic TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW;\n\tstatic TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH;\n\tstatic TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE;\n\t/**\n\t * @param {Object} options The option object of the eg.YawPitch module\n\t * @param {Element}[options.element=null] element A base element for the eg.YawPitch module\n\t * @param {Number} [options.yaw=0] initial yaw (degree)\n\t * @param {Number} [options.pitch=0] initial pitch (degree)\n\t * @param {Number} [options.fov=65] initial field of view (degree)\n\t * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown\n\t * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available\n\t * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion.\n\t * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move)\n\t * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw\n\t * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch\n\t * @param {Array} [options.fovRange=[30, 110] Range of FOV\n\t * @param {Number} [options.aspectRatio=1] Aspect Ratio\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\n\t\tconst opt = Object.assign({\n\t\t\telement: null,\n\t\t\tyaw: 0,\n\t\t\tpitch: 0,\n\t\t\tfov: 65,\n\t\t\tshowPolePoint: false,\n\t\t\tuseZoom: true,\n\t\t\tuseKeyboard: true,\n\t\t\tgyroMode: GYRO_MODE.YAWPITCH,\n\t\t\ttouchDirection: TOUCH_DIRECTION_ALL,\n\t\t\tyawRange: DEFAULT_YAW_RANGE,\n\t\t\tpitchRange: DEFAULT_PITCH_RANGE,\n\t\t\tfovRange: [30, 110],\n\t\t\taspectRatio: 1, /* TODO: Need Mandatory? */\n\t\t}, options);\n\n\t\tthis._element = opt.element;\n\t\tthis._initialFov = opt.fov;\n\t\tthis._enabled = false;\n\t\tthis._isAnimating = false;\n\t\tthis._deviceQuaternion = null;\n\n\t\tthis._initAxes(opt);\n\t\tthis.option(opt);\n\t}\n\n\t_initAxes(opt) {\n\t\tconst yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio);\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint);\n\t\tconst useRotation = opt.gyroMode === GYRO_MODE.VR;\n\n\t\tthis.axesPanInput = new RotationPanInput(this._element, {useRotation});\n\t\tthis.axesWheelInput = new WheelInput(this._element, {scale: -4});\n\t\tthis.axesTiltMotionInput = null;\n\t\tthis.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, {scale: -1}) : null;\n\t\tthis.axesMoveKeyInput = new MoveKeyInput(this._element, {scale: [-6, 6]});\n\n\t\tthis.axes = new Axes({\n\t\t\tyaw: {\n\t\t\t\trange: yRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(yRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tpitch: {\n\t\t\t\trange: pRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(pRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tfov: {\n\t\t\t\trange: opt.fovRange,\n\t\t\t\tcircular: [false, false],\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t}, {\n\t\t\tdeceleration: MC_DECELERATION,\n\t\t\tmaximumDuration: MC_MAXIMUM_DURATION\n\t\t}, {\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov\n\t\t}).on({\n\t\t\thold: evt => {\n\t\t\t\t// Restore maximumDuration not to be spin too mush.\n\t\t\t\tthis.axes.options.maximumDuration = MC_MAXIMUM_DURATION;\n\n\t\t\t\tthis.trigger(\"hold\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t\tchange: evt => {\n\t\t\t\tif (evt.delta.fov !== 0) {\n\t\t\t\t\tthis._updateControlScale(evt);\n\t\t\t\t\tthis.updatePanScale();\n\t\t\t\t}\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\trelease: evt => {\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\tanimationStart: evt => {\n\t\t\t},\n\t\t\tanimationEnd: evt => {\n\t\t\t\tthis.trigger(\"animationEnd\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Update Pan Scale\n\t *\n\t * Scale(Sensitivity) values of panning is related with fov and height.\n\t * If at least one of them is changed, this function need to be called.\n\t * @param {*} param\n\t */\n\tupdatePanScale(param = {}) {\n\t\tconst fov = this.axes.get().fov;\n\t\tconst areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);\n\t\tconst scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight;\n\n\t\tthis.axesPanInput.options.scale = [scale, scale];\n\t\tthis.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW;\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * Override component's option method\n\t * to call method for updating values which is affected by option change.\n\t *\n\t * @param {*} args\n\t */\n\toption(...args) {\n\t\tconst argLen = args.length;\n\n\t\t// Getter\n\t\tif (argLen === 0) {\n\t\t\treturn this._getOptions();\n\t\t} else if (argLen === 1 && typeof args[0] === \"string\") {\n\t\t\treturn this._getOptions(args[0]);\n\t\t}\n\n\t\t// Setter\n\t\tconst beforeOptions = Object.assign({}, this.options);\n\t\tlet newOptions = {};\n\t\tlet changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList.\n\n\t\tif (argLen === 1) {\n\t\t\tchangedKeyList = Object.keys(args[0]);\n\t\t\tnewOptions = Object.assign({}, args[0]);\n\t\t} else if (argLen >= 2) {\n\t\t\tchangedKeyList.push(args[0]);\n\t\t\tnewOptions[args[0]] = args[1];\n\t\t}\n\n\t\tthis._setOptions(this._getValidatedOptions(newOptions));\n\t\tthis._applyOptions(changedKeyList, beforeOptions);\n\t\treturn this;\n\t}\n\n\t_getValidatedOptions(newOptions) {\n\t\tif (newOptions.yawRange) {\n\t\t\tnewOptions.yawRange =\n\t\t\t\tthis._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio);\n\t\t}\n\t\tif (newOptions.pitchRange) {\n\t\t\tnewOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov);\n\t\t}\n\t\treturn newOptions;\n\t}\n\n\t_getOptions(key) {\n\t\tlet value;\n\n\t\tif (typeof key === \"string\") {\n\t\t\tvalue = this.options[key];\n\t\t} else if (arguments.length === 0) {\n\t\t\tvalue = this.options;\n\t\t}\n\t\treturn value;\n\t}\n\n\t_setOptions(options) {\n\t\tfor (const key in options) {\n\t\t\tthis.options[key] = options[key];\n\t\t}\n\t}\n\n\t_applyOptions(keys, prevOptions) {\n\t\tconst options = this.options;\n\t\tconst axes = this.axes;\n\t\tconst isVR = options.gyroMode === GYRO_MODE.VR;\n\t\tconst isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH;\n\t\t// If it's VR mode, restrict user interaction to yaw direction only\n\t\tconst touchDirection = isVR ?\n\t\t\t(TOUCH_DIRECTION_YAW & options.touchDirection) :\n\t\t\toptions.touchDirection;\n\n\t\t// If one of below is changed, call updateControlScale()\n\t\tif (keys.some(key =>\n\t\t\tkey === \"showPolePoint\" || key === \"fov\" || key === \"aspectRatio\" ||\n\t\t\tkey === \"yawRange\" || key === \"pitchRange\"\n\t\t)) {\n\t\t\t// If fov is changed, update pan scale\n\t\t\tif (keys.indexOf(\"fov\") >= 0) {\n\t\t\t\taxes.setTo({\"fov\": options.fov});\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\n\t\t\tthis._updateControlScale();\n\t\t}\n\n\t\tif (keys.some(key => key === \"fovRange\")) {\n\t\t\tconst fovRange = options.fovRange;\n\t\t\tconst prevFov = axes.get().fov;\n\t\t\tlet nextFov = axes.get().fov;\n\n\t\t\tvec2.copy(axes.axis.fov.range, fovRange);\n\n\t\t\tif (nextFov < fovRange[0]) {\n\t\t\t\tnextFov = fovRange[0];\n\t\t\t} else if (prevFov > fovRange[1]) {\n\t\t\t\tnextFov = fovRange[1];\n\t\t\t}\n\n\t\t\tif (prevFov !== nextFov) {\n\t\t\t\taxes.setTo({\n\t\t\t\t\tfov: nextFov\n\t\t\t\t}, 0);\n\t\t\t\tthis._updateControlScale();\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"gyroMode\") && SUPPORT_DEVICEMOTION) {\n\t\t\t// Disconnect first\n\t\t\tif (this.axesTiltMotionInput) {\n\t\t\t\tthis.axes.disconnect(this.axesTiltMotionInput);\n\t\t\t\tthis.axesTiltMotionInput.destroy();\n\t\t\t\tthis.axesTiltMotionInput = null;\n\t\t\t}\n\n\t\t\tif (this._deviceQuaternion) {\n\t\t\t\tthis._deviceQuaternion.destroy();\n\t\t\t\tthis._deviceQuaternion = null;\n\t\t\t}\n\n\t\t\tif (isVR) {\n\t\t\t\tthis._initDeviceQuaternion();\n\t\t\t} else if (isYawPitch) {\n\t\t\t\tthis.axesTiltMotionInput = new TiltMotionInput(this._element);\n\t\t\t\tthis.axes.connect([\"yaw\", \"pitch\"], this.axesTiltMotionInput);\n\t\t\t}\n\n\t\t\tthis.axesPanInput.setUseRotation(isVR);\n\t\t}\n\n\t\tif (keys.some(key => key === \"useKeyboard\")) {\n\t\t\tconst useKeyboard = options.useKeyboard;\n\n\t\t\tif (useKeyboard) {\n\t\t\t\taxes.connect([\"yaw\", \"pitch\"], this.axesMoveKeyInput);\n\t\t\t} else {\n\t\t\t\taxes.disconnect(this.axesMoveKeyInput);\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"useZoom\")) {\n\t\t\tconst useZoom = options.useZoom;\n\n\t\t\t// Disconnect first\n\t\t\taxes.disconnect(this.axesWheelInput);\n\t\t\tif (useZoom) {\n\t\t\t\taxes.connect([\"fov\"], this.axesWheelInput);\n\t\t\t}\n\t\t}\n\n\t\tthis._togglePinchInputByOption(options.touchDirection, options.useZoom);\n\n\t\tif (keys.some(key => key === \"touchDirection\")) {\n\t\t\tthis._enabled && this._enableTouch(touchDirection);\n\t\t}\n\t}\n\n\t_togglePinchInputByOption(touchDirection, useZoom) {\n\t\tif (this.axesPinchInput) {\n\t\t\t// disconnect first\n\t\t\tthis.axes.disconnect(this.axesPinchInput);\n\n\t\t\t// If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll.\n\t\t\tif (\n\t\t\t\tuseZoom &&\n\t\t\t\ttouchDirection === TOUCH_DIRECTION_ALL &&\n\t\t\t\t// TODO: Get rid of using private property of axes instance.\n\t\t\t\tthis.axes._inputs.indexOf(this.axesPinchInput) === -1\n\t\t\t) {\n\t\t\t\tthis.axes.connect([\"fov\"], this.axesPinchInput);\n\t\t\t}\n\t\t}\n\t}\n\n\t_enableTouch(direction) {\n\t\t// Disconnect first\n\t\tthis.axesPanInput && this.axes.disconnect(this.axesPanInput);\n\n\t\tconst yawEnabled = direction & TOUCH_DIRECTION_YAW ? \"yaw\" : null;\n\t\tconst pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? \"pitch\" : null;\n\n\t\tthis.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput);\n\t}\n\n\t_initDeviceQuaternion() {\n\t\tthis._deviceQuaternion = new DeviceQuaternion();\n\t\tthis._deviceQuaternion.on(\"change\", e => {\n\t\t\tthis._triggerChange(e);\n\t\t});\n\t}\n\n\t_getValidYawRange(newYawRange, newFov, newAspectRatio) {\n\t\tconst ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1);\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst horizontalFov = fov * ratio;\n\t\tconst isValid = newYawRange[1] - newYawRange[0] >= horizontalFov;\n\n\t\tif (isValid) {\n\t\t\treturn newYawRange;\n\t\t} else {\n\t\t\treturn this.options.yawRange || DEFAULT_YAW_RANGE;\n\t\t}\n\t}\n\n\t_getValidPitchRange(newPitchRange, newFov) {\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst isValid = newPitchRange[1] - newPitchRange[0] >= fov;\n\n\t\tif (isValid) {\n\t\t\treturn newPitchRange;\n\t\t} else {\n\t\t\treturn this.options.pitchRange || DEFAULT_PITCH_RANGE;\n\t\t}\n\t}\n\n\tstatic isCircular(range) {\n\t\treturn range[1] - range[0] < 360 ? [false, false] : [true, true];\n\t}\n\n\t/**\n\t * Update yaw/pitch min/max by 5 factor\n\t *\n\t * 1. showPolePoint\n\t * 2. fov\n\t * 3. yawRange\n\t * 4. pitchRange\n\t * 5. aspectRatio\n\t *\n\t * If one of above is changed, call this function\n\t */\n\t_updateControlScale(changeEvt) {\n\t\tconst opt = this.options;\n\t\tconst fov = this.axes.get().fov;\n\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint);\n\t\tconst yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio);\n\n\t\t// TODO: If not changed!?\n\t\tconst pos = this.axes.get();\n\t\tlet y = pos.yaw;\n\t\tlet p = pos.pitch;\n\n\t\tvec2.copy(this.axes.axis.yaw.range, yRange);\n\t\tvec2.copy(this.axes.axis.pitch.range, pRange);\n\t\tthis.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange);\n\t\tthis.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange);\n\n\t\t/**\n\t\t * update yaw/pitch by it's range.\n\t\t */\n\t\tif (y < yRange[0]) {\n\t\t\ty = yRange[0];\n\t\t} else if (y > yRange[1]) {\n\t\t\ty = yRange[1];\n\t\t}\n\n\t\tif (p < pRange[0]) {\n\t\t\tp = pRange[0];\n\t\t} else if (p > pRange[1]) {\n\t\t\tp = pRange[1];\n\t\t}\n\n\t\tif (changeEvt) {\n\t\t\tchangeEvt.set({\n\t\t\t\tyaw: y,\n\t\t\t\tpitch: p,\n\t\t\t});\n\t\t}\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\t_updatePitchRange(pitchRange, fov, showPolePoint) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\t// Circular pitch on VR\n\t\t\treturn CIRCULAR_PITCH_RANGE;\n\t\t}\n\n\t\tconst verticalAngle = pitchRange[1] - pitchRange[0];\n\t\tconst halfFov = fov / 2;\n\t\tconst isPanorama = verticalAngle < 180;\n\n\t\tif (showPolePoint && !isPanorama) {\n\t\t\t// Use full pinch range\n\t\t\treturn pitchRange.concat();\n\t\t}\n\n\t\t// Round value as movableCood do.\n\t\treturn [pitchRange[0] + halfFov, pitchRange[1] - halfFov];\n\t}\n\n\t_updateYawRange(yawRange, fov, aspectRatio) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\treturn DEFAULT_YAW_RANGE;\n\t\t}\n\n\t\tconst horizontalAngle = yawRange[1] - yawRange[0];\n\n\t\t/**\n\t\t * Full 360 Mode\n\t\t */\n\t\tif (horizontalAngle >= 360) {\n\t\t\t// Don't limit yaw range on Full 360 mode.\n\t\t\treturn yawRange.concat();\n\t\t}\n\n\t\t/**\n\t\t * Panorama mode\n\t\t */\n\t\t// Ref : https://github.com/naver/egjs-view360/issues/290\n\t\tconst halfHorizontalFov =\n\t\t\tmathUtil.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2))));\n\n\t\t// Round value as movableCood do.\n\t\treturn [\n\t\t\tyawRange[0] + halfHorizontalFov,\n\t\t\tyawRange[1] - halfHorizontalFov\n\t\t];\n\t}\n\n\t_triggerChange(evt) {\n\t\tconst pos = this.axes.get();\n\t\tconst opt = this.options;\n\t\tconst event = {\n\t\t\ttargetElement: opt.element,\n\t\t\tisTrusted: evt.isTrusted,\n\t\t};\n\n\t\tevent.yaw = pos.yaw;\n\t\tevent.pitch = pos.pitch;\n\t\tevent.fov = pos.fov;\n\n\t\tif (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) {\n\t\t\tevent.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t\t}\n\t\tthis.trigger(\"change\", event);\n\t}\n\n\t// TODO: makes constant to be logic\n\tstatic adjustAspectRatio(input) {\n\t\tconst inputRange = [\n\t\t\t0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670,\n\t\t\t0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19,\n\t\t\t1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26,\n\t\t\t2.30, 2.60, 3.00, 5.00, 6.00\n\t\t];\n\t\tconst outputRange = [\n\t\t\t0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710,\n\t\t\t0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15,\n\t\t\t1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72,\n\t\t\t1.82, 1.92, 2.00, 2.24, 2.30\n\t\t];\n\n\t\tlet rangeIdx = -1;\n\n\t\tfor (let i = 0; i < inputRange.length - 1; i++) {\n\t\t\tif (inputRange[i] <= input && inputRange[i + 1] >= input) {\n\t\t\t\trangeIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (rangeIdx === -1) {\n\t\t\tif (inputRange[0] > input) {\n\t\t\t\treturn outputRange[0];\n\t\t\t} else {\n\t\t\t\treturn outputRange[outputRange[0].length - 1];\n\t\t\t}\n\t\t}\n\n\t\tconst inputA = inputRange[rangeIdx];\n\t\tconst inputB = inputRange[rangeIdx + 1];\n\t\tconst outputA = outputRange[rangeIdx];\n\t\tconst outputB = outputRange[rangeIdx + 1];\n\n\t\treturn YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA));\n\t}\n\n\tstatic lerp(a, b, fraction) {\n\t\treturn a + fraction * (b - a);\n\t}\n\n\t/**\n\t * Enable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#enable\n\t */\n\tenable() {\n\t\tif (this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._enabled = true;\n\n\t\t// touchDirection is decided by parameter is valid string (Ref. Axes.connect)\n\t\tthis._applyOptions(Object.keys(this.options), this.options);\n\n\t\t// TODO: Is this code is needed? Check later.\n\t\tthis.updatePanScale();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Disable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#disable\n\t */\n\tdisable(persistOrientation) {\n\t\tif (!this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// TODO: Check peristOrientation is needed!\n\t\tif (!persistOrientation) {\n\t\t\tthis._resetOrientation();\n\t\t}\n\t\tthis.axes.disconnect();\n\t\tthis._enabled = false;\n\t\treturn this;\n\t}\n\n\t_resetOrientation() {\n\t\tconst opt = this.options;\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Set one or more of yaw, pitch, fov\n\t *\n\t * @param {Object} coordinate yaw, pitch, fov\n\t * @param {Number} duration Animation duration. if it is above 0 then it's animated.\n\t */\n\tlookAt({yaw, pitch, fov}, duration) {\n\t\tconst pos = this.axes.get();\n\n\t\tconst y = yaw === undefined ? 0 : yaw - pos.yaw;\n\t\tconst p = pitch === undefined ? 0 : pitch - pos.pitch;\n\t\tconst f = fov === undefined ? 0 : fov - pos.fov;\n\n\t\t// Allow duration of animation to have more than MC_MAXIMUM_DURATION.\n\t\tthis.axes.options.maximumDuration = Infinity;\n\n\t\tthis.axes.setBy({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t\tfov: f\n\t\t}, duration);\n\t}\n\n\tgetYawPitch() {\n\t\tconst yawPitch = this.axes.get();\n\n\t\treturn {\n\t\t\tyaw: yawPitch.yaw,\n\t\t\tpitch: yawPitch.pitch,\n\t\t};\n\t}\n\n\tgetFov() {\n\t\treturn this.axes.get().fov;\n\t}\n\n\tgetQuaternion() {\n\t\tconst pos = this.axes.get();\n\n\t\treturn this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t}\n\n\tshouldRenderWithQuaternion() {\n\t\treturn this.options.gyroMode === GYRO_MODE.VR;\n\t}\n\n\t/**\n\t * Destroys objects\n\t */\n\tdestroy() {\n\t\tthis.axes && this.axes.destroy();\n\t\tthis.axisPanInput && this.axisPanInput.destroy();\n\t\tthis.axesWheelInput && this.axesWheelInput.destroy();\n\t\tthis.axesTiltMotionInput && this.axesTiltMotionInput.destroy();\n\t\tthis.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy();\n\t\tthis.axesPinchInput && this.axesPinchInput.destroy();\n\t\tthis.axesMoveKeyInput && this.axesMoveKeyInput.destroy();\n\t\tthis._deviceQuaternion && this._deviceQuaternion.destroy();\n\t}\n}\n\nexport default YawPitchControl;\n","import Component from \"@egjs/component\";\n\nconst STATUS = {\n\t\"NONE\": 0,\n\t\"LOADING\": 1,\n\t\"LOADED\": 2,\n\t\"ERROR\": 3\n};\n\nconst EVENT = {\n\t\"READYSTATECHANGE\": \"readystatechange\"\n};\n\nclass ImageLoader extends Component {\n\tstatic STATUS = STATUS;\n\tconstructor(image) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis._image = null;\n\t\tthis._onceHandlers = [];\n\t\tthis._loadStatus = STATUS.NONE;\n\n\t\timage && this.set(image);\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._image) {\n\t\t\t\trej(\"ImageLoader: image is not defiend\");\n\t\t\t} else if (this._loadStatus === STATUS.LOADED) {\n\t\t\t\tres(this.getElement());\n\t\t\t} else if (this._loadStatus === STATUS.LOADING) {\n\t\t\t\t/* Check isMaybeLoaded() first because there may have\n\t\t\t\t\tposibilities that image already loaded before get is called.\n\t\t\t\t\tfor example calling get on external image onload callback.*/\n\t\t\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\t\tres(this.getElement());\n\t\t\t\t} else {\n\t\t\t\t\tthis.on(EVENT.READYSTATECHANGE, e => {\n\t\t\t\t\t\tif (e.type === STATUS.LOADED) {\n\t\t\t\t\t\t\tres(this.getElement());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trej(\"ImageLoader: failed to load images.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trej(\"ImageLoader: failed to load images\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param image img element or img url or array of img element or array of img url\n\t */\n\tset(image) {\n\t\tthis._loadStatus = STATUS.LOADING;\n\n\t\tthis._image = ImageLoader.createElement(image);\n\n\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.onceLoaded(\n\t\t\tthis._image,\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.LOADED\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.ERROR;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.ERROR\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tstatic createElement(image) {\n\t\tconst images = image instanceof Array ? image : [image];\n\n\t\treturn images.map(img => {\n\t\t\tlet _img = img;\n\n\t\t\tif (typeof img === \"string\") {\n\t\t\t\t_img = new Image();\n\t\t\t\t_img.crossOrigin = \"anonymous\";\n\t\t\t\t_img.src = img;\n\t\t\t}\n\t\t\treturn _img;\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._image.length === 1 ? this._image[0] : this._image;\n\t}\n\n\tstatic isMaybeLoaded(image) {\n\t\tlet result = false;\n\n\t\tif (image instanceof Image) {\n\t\t\tresult = image.complete && image.naturalWidth !== 0;\n\t\t} else if (image instanceof Array) {\n\t\t\tresult = !image.some(img => !img.complete || img.naturalWidth === 0);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonceLoaded(target, onload, onerror) {\n\t\tconst targets = target instanceof Array ? target : [target];\n\t\tconst targetsNotLoaded = targets.filter(img => !ImageLoader.isMaybeLoaded(img));\n\t\tconst loadPromises = targetsNotLoaded.map(img => new Promise((res, rej) => {\n\t\t\tthis._once(img, \"load\", () => (res(img)));\n\t\t\tthis._once(img, \"error\", () => (rej(img)));\n\t\t}));\n\n\t\tPromise.all(loadPromises).then(\n\t\t\tresult => (onload(targets.length === 1 ? targets[0] : targets)),\n\t\t\treason => (onerror(reason))\n\t\t);\n\t}\n\n\t_once(target, type, listener) {\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\ttarget.addEventListener(type, fn);\n\t\tthis._onceHandlers.push({target, type, fn});\n\t}\n\n\tgetStatus() {\n\t\treturn this._loadStatus;\n\t}\n\n\tdestroy() {\n\t\tthis._onceHandlers.forEach(handler => {\n\t\t\thandler.target.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._onceHandlers = [];\n\t\tthis._image.src = \"\";\n\t\tthis._image = null;\n\t\tthis._loadStatus = STATUS.NONE;\n\t}\n}\n\nexport default ImageLoader;\n","// import Agent from \"@egjs/agent\";\n\n/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */\nconst READY_STATUS = {\n\tHAVE_NOTHING: 0, // no information whether or not the audio/video is ready\n\tHAVE_METADATA: 1, // HAVE_METADATA - metadata for the audio/video is ready\n\tHAVE_CURRENT_DATA: 2, // data for the current playback position is available, but not enough data to play next frame/millisecond\n\tHAVE_FUTURE_DATA: 3, // data for the current and at least the next frame is available\n\tHAVE_ENOUGH_DATA: 4, // enough data available to start playing\n\t// below is custom status for failed to load status\n\tLOADING_FAILED: -1\n};\n\nconst READYSTATECHANGE_EVENT_NAME = {};\n\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = \"loadedmetadata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = \"loadeddata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = \"canplay\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = \"canplaythrough\";\n\nexport default class VideoLoader {\n\tconstructor(video) {\n\t\tthis._handlers = [];\n\t\tthis._sourceCount = 0;\n\n\t\t// on iOS safari, 'loadeddata' will not triggered unless the user hits play,\n\t\t// so used 'loadedmetadata' instead.\n\t\tthis._thresholdReadyState = READY_STATUS.HAVE_METADATA;\n\t\tthis._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState];\n\n\t\tthis._loadStatus = (video && video.readyState) || READY_STATUS.HAVE_NOTHING;\n\n\t\tthis._onerror = this._onerror.bind(this);\n\n\t\tvideo && this.set(video);\n\t}\n\n\t_onerror() {\n\t\tthis._errorCount++;\n\t\tif (this._errorCount >= this._sourceCount) {\n\t\t\tthis._loadStatus = READY_STATUS.LOADING_FAILED;\n\t\t\tthis._detachErrorHandler(this._onerror);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src}\n\t */\n\t_appendSourceElement(videoUrl) {\n\t\tlet videoSrc;\n\t\tlet videoType;\n\n\t\tif (typeof videoUrl === \"object\") {\n\t\t\tvideoSrc = videoUrl.src;\n\t\t\tvideoType = videoUrl.type;\n\t\t} else if (typeof videoUrl === \"string\") {\n\t\t\tvideoSrc = videoUrl;\n\t\t}\n\n\t\tif (!videoSrc) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst sourceElement = document.createElement(\"source\");\n\n\t\tsourceElement.src = videoSrc;\n\t\tvideoType && (sourceElement.type = videoType);\n\n\t\tthis._video.appendChild(sourceElement);\n\t\treturn true;\n\t}\n\n\tset(video) {\n\t\tthis._reset(); // reset resources.\n\n\t\tif (!video) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (video instanceof HTMLVideoElement) {\n\t\t\t// video tag\n\t\t\tthis._video = video;\n\t\t} else if (typeof video === \"string\" || typeof video === \"object\") {\n\t\t\t// url\n\t\t\tthis._video = document.createElement(\"video\");\n\t\t\tthis._video.setAttribute(\"crossorigin\", \"anonymous\");\n\t\t\tthis._video.setAttribute(\"webkit-playsinline\", \"\");\n\t\t\tthis._video.setAttribute(\"playsinline\", \"\");\n\n\t\t\tif (video instanceof Array) {\n\t\t\t\tvideo.forEach(v => this._appendSourceElement(v));\n\t\t\t} else {\n\t\t\t\tthis._appendSourceElement(video);\n\t\t\t}\n\n\t\t\tthis._sourceCount = this._video.querySelectorAll(\"source\").length;\n\n\t\t\tif (this._sourceCount > 0) {\n\t\t\t\tif (this._video.readyState < this._thresholdReadyState) {\n\t\t\t\t\tthis._video.load();\n\t\t\t\t\t// attach loading error listener\n\t\t\t\t\tthis._attachErrorHandler(this._onerror);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._video = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t_attachErrorHandler(handler) {\n\t\tthis._video.addEventListener(\"error\", handler);\n\t\tthis._sources = this._video.querySelectorAll(\"source\");\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.addEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\t_detachErrorHandler(handler) {\n\t\tthis._video.removeEventListener(\"error\", handler);\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.removeEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._video) {\n\t\t\t\trej(\"VideoLoader: video is undefined\");\n\t\t\t} else if (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t} else if (this._video.readyState >= this._thresholdReadyState) {\n\t\t\t\tres(this._video);\n\t\t\t} else {\n\t\t\t\t// check errorCnt and reject\n\t\t\t\tconst rejector = () => {\n\t\t\t\t\tif (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\t\t\tthis._detachErrorHandler(rejector);\n\t\t\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis._attachErrorHandler(rejector);\n\t\t\t\tthis._once(this._thresholdEventName, () => res(this._video));\n\t\t\t}\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._video;\n\t}\n\n\tdestroy() {\n\t\tthis._reset();\n\t}\n\n\t_reset() {\n\t\tthis._handlers.forEach(handler => {\n\t\t\tthis._video.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._handlers = [];\n\t\tthis._video = null;\n\n\t\tthis._sourceCount = 0;\n\t\tthis._errorCount = 0;\n\t}\n\n\t_once(type, listener) {\n\t\tconst target = this._video;\n\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\t/* By useCapture mode enabled, you can capture the error event being fired on source(child)*/\n\t\ttarget.addEventListener(type, fn, true);\n\t\tthis._handlers.push({type, fn});\n\t}\n}\n","import Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {STEREO_FORMAT} from \"../../PanoViewer/consts\";\n\nconst latitudeBands = 60;\nconst longitudeBands = 60;\nconst radius = 2;\nconst ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\nlet latIdx;\nlet lngIdx;\n\nfor (latIdx = 0; latIdx <= latitudeBands; latIdx++) {\n\tconst theta = (latIdx / latitudeBands - 0.5) * Math.PI;\n\tconst sinTheta = Math.sin(theta);\n\tconst cosTheta = Math.cos(theta);\n\n\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\tconst phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN;\n\t\tconst sinPhi = Math.sin(phi);\n\t\tconst cosPhi = Math.cos(phi);\n\t\tconst x = cosPhi * cosTheta;\n\t\tconst y = sinTheta;\n\t\tconst z = sinPhi * cosTheta;\n\t\tconst u = lngIdx / longitudeBands;\n\t\tconst v = latIdx / latitudeBands;\n\n\t\ttextureCoordData.push(u, v);\n\t\tvertexPositionData.push(radius * x, radius * y, radius * z);\n\n\t\tif (lngIdx !== longitudeBands && latIdx !== latitudeBands) {\n\t\t\tconst a = latIdx * (longitudeBands + 1) + lngIdx;\n\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t}\n\t}\n}\n\nclass SphereRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tconstructor(format) {\n\t\tsuper();\n\n\t\tthis._stereoFormat = format;\n\t}\n\n\trender(ctx) {\n\t\tconst {gl, shaderProgram} = ctx;\n\n\t\tlet leftEyeScaleOffset;\n\t\tlet rightEyeScaleOffset;\n\n\t\tswitch (this._stereoFormat) {\n\t\t\tcase STEREO_FORMAT.TOP_BOTTOM:\n\t\t\t\tleftEyeScaleOffset = [1, 0.5, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 0.5, 0, 0.5];\n\t\t\t\tbreak;\n\t\t\tcase STEREO_FORMAT.LEFT_RIGHT:\n\t\t\t\tleftEyeScaleOffset = [0.5, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [0.5, 1, 0.5, 0];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tleftEyeScaleOffset = [1, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 1, 0, 0];\n\t\t}\n\n\t\tconst uTexScaleOffset = gl.getUniformLocation(shaderProgram, \"uTexScaleOffset\");\n\n\t\tgl.uniform4fv(uTexScaleOffset, [...leftEyeScaleOffset, ...rightEyeScaleOffset]);\n\n\t\tsuper.render(ctx);\n\t}\n\n\tgetVertexPositionData() {\n\t\treturn SphereRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn SphereRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn SphereRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n}\n\nexport default SphereRenderer;\n","import agent from \"@egjs/agent\";\n\nconst WEBGL_ERROR_CODE = {\n\t\"0\": \"NO_ERROR\",\n\t\"1280\": \"INVALID_ENUM\",\n\t\"1281\": \"INVALID_VALUE\",\n\t\"1282\": \"INVALID_OPERATION\",\n\t\"1285\": \"OUT_OF_MEMORY\",\n\t\"1286\": \"INVALID_FRAMEBUFFER_OPERATION\",\n\t\"37442\": \"CONTEXT_LOST_WEBGL\"\n};\n\nlet webglAvailability = null;\nlet MAX_TEXTURE_SIZE_FOR_TEST = null;\n\nexport default class WebGLUtils {\n\tstatic createShader(gl, type, source) {\n\t\tconst shader = gl.createShader(type);\n\n\t\tgl.shaderSource(shader, source);\n\t\tgl.compileShader(shader);\n\t\tconst success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n\t\tif (success) {\n\t\t\treturn shader;\n\t\t} else {\n\t\t\t// eslint-disable-next-line\n\t\t\tconsole.error(gl.getShaderInfoLog(shader));\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic createProgram(gl, vertexShader, fragmentShader) {\n\t\tconst program = gl.createProgram();\n\n\t\tgl.attachShader(program, vertexShader);\n\t\tgl.attachShader(program, fragmentShader);\n\t\tgl.linkProgram(program);\n\n\t\tgl.detachShader(program, vertexShader);\n\t\tgl.detachShader(program, fragmentShader);\n\t\tgl.deleteShader(vertexShader);\n\t\tgl.deleteShader(fragmentShader);\n\n\t\tconst success = gl.getProgramParameter(program, gl.LINK_STATUS);\n\n\t\tif (success) {\n\t\t\treturn program;\n\t\t}\n\n\t\tgl.deleteProgram(program);\n\t\treturn null;\n\t}\n\n\tstatic initBuffer(gl, target /* bind point */, data, itemSize, attr) {\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer(target, buffer);\n\t\tgl.bufferData(target, data, gl.STATIC_DRAW);\n\n\t\tif (buffer) {\n\t\t\tbuffer.itemSize = itemSize;\n\t\t\tbuffer.numItems = data.length / itemSize;\n\t\t}\n\n\t\tif (attr !== undefined) {\n\t\t\tgl.enableVertexAttribArray(attr);\n\t\t\tgl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\tstatic getWebglContext(canvas, userContextAttributes) {\n\t\tconst webglIdentifiers = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n\t\tlet context = null;\n\t\tconst contextAttributes = Object.assign({\n\t\t\tpreserveDrawingBuffer: false,\n\t\t\tantialias: false,\n\t\t\txrCompatible: true\n\t\t}, userContextAttributes);\n\n\t\tfunction onWebglcontextcreationerror(e) {\n\t\t\treturn e.statusMessage;\n\t\t}\n\n\t\tcanvas.addEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\tfor (let i = 0; i < webglIdentifiers.length; i++) {\n\t\t\ttry {\n\t\t\t\tcontext = canvas.getContext(webglIdentifiers[i], contextAttributes);\n\t\t\t} catch (t) {}\n\t\t\tif (context) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcanvas.removeEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\treturn context;\n\t}\n\n\tstatic createTexture(gl, textureTarget) {\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture(textureTarget, texture);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(textureTarget, null);\n\n\t\treturn texture;\n\t}\n\n\t/**\n\t * Returns the webgl availability of the current browser.\n\t * @method WebGLUtils#isWebGLAvailable\n\t * @retuen {Boolean} isWebGLAvailable\n\t */\n\tstatic isWebGLAvailable() {\n\t\tif (webglAvailability === null) {\n\t\t\tconst canvas = document.createElement(\"canvas\");\n\t\t\tconst webglContext = WebGLUtils.getWebglContext(canvas);\n\n\t\t\twebglAvailability = !!webglContext;\n\n\t\t\t// webglContext Resource forced collection\n\t\t\tif (webglContext) {\n\t\t\t\tconst loseContextExtension = webglContext.getExtension(\"WEBGL_lose_context\");\n\n\t\t\t\tloseContextExtension && loseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t\treturn webglAvailability;\n\t}\n\n\t/**\n\t * Returns whether webgl is stable in the current browser.\n\t * @method WebGLUtils#isStableWebGL\n\t * @retuen {Boolean} isStableWebGL\n\t */\n\tstatic isStableWebGL() {\n\t\tconst agentInfo = agent();\n\t\tlet isStableWebgl = true;\n\n\t\tif (agentInfo.os.name === \"android\") {\n\t\t\tconst version = parseFloat(agentInfo.os.version);\n\n\t\t\tif (version <= 4.3) {\n\t\t\t\tisStableWebgl = false;\n\t\t\t} else if (version === 4.4) {\n\t\t\t\tif (agentInfo.browser.name !== \"chrome\") {\n\t\t\t\t\tisStableWebgl = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isStableWebgl;\n\t}\n\n\tstatic getErrorNameFromWebGLErrorCode(code) {\n\t\tif (!(code in WEBGL_ERROR_CODE)) {\n\t\t\treturn \"UNKNOWN_ERROR\";\n\t\t}\n\n\t\treturn WEBGL_ERROR_CODE[code];\n\t}\n\n\n\t/**\n\t * This function is wrapper for texImage2D to handle exceptions on texImage2D.\n\t * Purpose is to prevent service from being stopped by script error.\n\t *\n\t * @param {*} gl\n\t * @param {*} target\n\t * @param {*} pixels\n\t */\n\tstatic texImage2D(gl, target, pixels) {\n\t\ttry {\n\t\t\tgl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\t\t} catch (error) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.error(\"WebGLUtils.texImage2D error:\", error);\n\t\t\t/* eslint-enable no-console */\n\t\t}\n\t}\n\n\tstatic getMaxTextureSize(gl) {\n\t\t// WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test\n\t\treturn MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\t}\n}\n\n/**\n * This function should not be used in service code. It's provided only for test purpose.\n * It should be set to null or 0 when test is done.\n *\n * @param {Number} size\n */\nfunction setMaxTextureSizeForTestOnlyPurpose(size) {\n\tMAX_TEXTURE_SIZE_FOR_TEST = size;\n}\n\nexport {\n\tsetMaxTextureSizeForTestOnlyPurpose\n};\n","import Component from \"@egjs/component\";\nimport Agent from \"@egjs/agent\";\n\nconst agent = Agent();\nconst isIE11 = agent.browser.name === \"ie\" && agent.browser.majorVersion === 11;\n\nconst EVENTS = {\n\tERROR: \"error\"\n};\n\n/**\n *\n * Extends Component for firing errors occurs internally.\n */\nclass Renderer extends Component {\n\tstatic EVENTS = EVENTS;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._forceDimension = null;\n\t\tthis._pixelCanvas = null;\n\t\tthis._pixelContext = null;\n\t}\n\n\trender({gl, shaderProgram, indexBuffer, mvMatrix, pMatrix}) {\n\t\tgl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n\t\tgl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n\n\t\tif (indexBuffer) {\n\t\t\tgl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n\t\t}\n\t}\n\n\t// Define interface for Renderers\n\t/**\n\t * Following MUST BE DEFINED on Child of Renderer\n\t *\n\t * DATA\n\t *\n\t * - getVertexPositionData\n\t * - getIndexData\n\t * - getTextureCoordData\n\t *\n\t * SOURCE\n\t *\n\t * - getVertexShaderSource\n\t * - getFragmentShaderSource\n\t *\n\t * TEXTURE\n\t *\n\t * - bindTexture\n\t */\n\tgetDimension(pixelSource) {\n\t\tconst width = pixelSource.naturalWidth || pixelSource.videoWidth;\n\t\tconst height = pixelSource.naturalHeight || pixelSource.videoHeight;\n\n\t\treturn {width, height};\n\t}\n\n\t/**\n\t * Update data used by shader\n\t * \t-\n\t *\n\t *\n\t * @param {*} param\n\t */\n\tupdateShaderData(param) {\n\t\t/*\n\t\t* Update following data in implementation layer.\n\t\t* If the data is not changed, it does not need to implement this function.\n\t\t*\n\t\t* - _VERTEX_POSITION_DATA\n\t\t* - _TEXTURE_COORD_DATA\n\t\t* - _INDEX_DATA\n\t\t*/\n\t}\n\n\t/**\n\t *\n\t * @param {HTMLImageElement | HTMLVideoElement} image\n\t * @param {Object = {width, height}} forceDimension Forced dimension to resize\n\t */\n\t_initPixelSource(image, forceDimension) {\n\t\tconst isIE11Video = isIE11 && (image instanceof HTMLVideoElement);\n\n\t\tif (isIE11Video || forceDimension) {\n\t\t\tconst {width, height} = forceDimension || this.getDimension(image);\n\n\t\t\tthis._pixelCanvas = document.createElement(\"canvas\");\n\t\t\tthis._pixelCanvas.width = width;\n\t\t\tthis._pixelCanvas.height = height;\n\t\t\tthis._pixelContext = this._pixelCanvas.getContext(\"2d\");\n\t\t}\n\t\tthis._forceDimension = forceDimension;\n\t}\n\n\t_getPixelSource(image) {\n\t\tif (!this._pixelCanvas) {\n\t\t\treturn image;\n\t\t}\n\n\t\t/**\n\t\t * IE11 && Video\n\t\t * or\n\t\t * Dimension is forced (Image is larger than texture size.)\n\t\t */\n\t\tconst contentDimension = this.getDimension(image);\n\t\tconst textureDimension = this._forceDimension || contentDimension;\n\n\t\tif (this._pixelCanvas.width !== textureDimension.width) {\n\t\t\tthis._pixelCanvas.width = textureDimension.width;\n\t\t}\n\n\t\tif (this._pixelCanvas.height !== textureDimension.height) {\n\t\t\tthis._pixelCanvas.height = textureDimension.height;\n\t\t}\n\n\t\tif (this._forceDimension) {\n\t\t\tthis._pixelContext.drawImage(image,\n\t\t\t\t0, 0, contentDimension.width, contentDimension.height,\n\t\t\t\t0, 0, textureDimension.width, textureDimension.height);\n\t\t} else {\n\t\t\tthis._pixelContext.drawImage(image, 0, 0);\n\t\t}\n\n\t\treturn this._pixelCanvas;\n\t}\n\n\t_extractTileConfig(imageConfig) {\n\t\tlet tileConfig =\n\t\t\tArray.isArray(imageConfig.tileConfig) ?\n\t\t\t\timageConfig.tileConfig : Array(...Array(6)).map(() => imageConfig.tileConfig);\n\n\t\ttileConfig = tileConfig.map(\n\t\t\tconfig => Object.assign({\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}, config)\n\t\t);\n\n\t\treturn tileConfig;\n\t}\n\n\t_triggerError(error) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.error(\"Renderer Error:\", error);\n\t\t/* eslint-enable no-console */\n\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\tmessage: typeof error === \"string\" ? error : error.message\n\t\t});\n\t}\n}\n\nexport default Renderer;\n","import Agent from \"@egjs/agent\";\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {util as mathUtil} from \"../../utils/math-util.js\";\n\nclass CubeRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = null;\n\tstatic _INDEX_DATA = null;\n\tgetVertexPositionData() {\n\t\tCubeRenderer._VERTEX_POSITION_DATA =\n\t\t\tCubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// top\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// bottom\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\n\t\treturn CubeRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\tif (CubeRenderer._INDEX_DATA) {\n\t\t\treturn CubeRenderer._INDEX_DATA;\n\t\t}\n\n\t\tconst indexData = [];\n\t\tconst vertexPositionData = this.getVertexPositionData();\n\n\t\tfor (let i = 0; i < (vertexPositionData.length / 3); i += 4) {\n\t\t\tindexData.push(\n\t\t\t\ti,\n\t\t\t\ti + 2,\n\t\t\t\ti + 1,\n\t\t\t\ti,\n\t\t\t\ti + 3,\n\t\t\t\ti + 2\n\t\t\t);\n\t\t}\n\n\t\tCubeRenderer._INDEX_DATA = indexData;\n\t\treturn indexData;\n\t}\n\n\tstatic extractOrder(imageConfig) {\n\t\treturn imageConfig.order || \"RLUDBF\";\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\tconst vertexOrder = \"BFUDRL\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst base = this.getVertexPositionData();\n\t\tconst tileConfig = this._extractTileConfig(imageConfig);\n\t\tconst elemSize = 3;\n\t\tconst vertexPerTile = 4;\n\t\tconst textureCoordData =\n\t\t\tvertexOrder.split(\"\")\n\t\t\t\t.map(face => tileConfig[order.indexOf(face)])\n\t\t\t\t.map((config, i) => {\n\t\t\t\t\tconst rotation = parseInt(config.rotation / 90, 10);\n\t\t\t\t\tconst ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2];\n\n\t\t\t\t\tfor (let r = 0; r < Math.abs(rotation); r++) {\n\t\t\t\t\t\tif ((config.flipHorizontal && rotation > 0) ||\n\t\t\t\t\t\t\t(!config.flipHorizontal && rotation < 0)) {\n\t\t\t\t\t\t\tordermap_.push(ordermap_.shift());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tordermap_.unshift(ordermap_.pop());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst elemPerTile = elemSize * vertexPerTile;\n\t\t\t\t\tconst tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile);\n\t\t\t\t\tconst tileTemp = [];\n\n\t\t\t\t\tfor (let j = 0; j < vertexPerTile; j++) {\n\t\t\t\t\t\ttileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize);\n\t\t\t\t\t}\n\t\t\t\t\treturn tileTemp;\n\t\t\t\t})\n\t\t\t\t.join()\n\t\t\t\t.split(\",\")\n\t\t\t\t.map(v => parseInt(v, 10));\n\n\t\treturn textureCoordData;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}`;\n\t}\n\n\tupdateTexture(gl, image, imageConfig) {\n\t\tconst baseOrder = \"RLUDBF\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst orderMap = {};\n\n\t\torder.split(\"\").forEach((v, i) => {\n\t\t\torderMap[v] = i;\n\t\t});\n\n\t\ttry {\n\t\t\tif (image instanceof Array) {\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image);\n\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\t\t\t\t\tconst tile = this.extractTileFromImage(\n\t\t\t\t\t\timage, tileIdx, maxCubeMapTextureSize\n\t\t\t\t\t);\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, tile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis._triggerError(e);\n\t\t}\n\t}\n\n\tbindTexture(gl, texture, image, imageConfig) {\n\t\tgl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\t\tthis.updateTexture(gl, image, imageConfig);\n\t}\n\n\tgetSourceTileSize(image) {\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst aspectRatio = width / height;\n\t\tlet inputTextureSize;\n\n\t\tif (aspectRatio === 1 / 6) {\n\t\t\tinputTextureSize = width;\n\t\t} else if (aspectRatio === 6) {\n\t\t\tinputTextureSize = height;\n\t\t} else if (aspectRatio === 2 / 3) {\n\t\t\tinputTextureSize = width / 2;\n\t\t} else {\n\t\t\tinputTextureSize = width / 3;\n\t\t}\n\t\treturn inputTextureSize;\n\t}\n\n\textractTileFromImage(image, tileIdx, outputTextureSize) {\n\t\tconst {width} = this.getDimension(image);\n\t\tconst inputTextureSize = this.getSourceTileSize(image);\n\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = outputTextureSize;\n\t\tcanvas.height = outputTextureSize;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tconst tilePerRow = width / inputTextureSize;\n\n\t\tconst x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow);\n\t\tconst y = parseInt(tileIdx / tilePerRow, 10) * (inputTextureSize);\n\n\t\tcontext.drawImage(\n\t\t\timage, x, y,\n\t\t\tinputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize\n\t\t);\n\t\treturn canvas;\n\t}\n\n\tgetMaxCubeMapTextureSize(gl, image) {\n\t\tconst agent = Agent();\n\t\tconst maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n\t\tlet _imageWidth = this.getSourceTileSize(image);\n\n\t\tif (agent.browser.name === \"ie\" && agent.browser.majorVersion === 11) {\n\t\t\tif (!mathUtil.isPowerOfTwo(_imageWidth)) {\n\t\t\t\tfor (let i = 1; i < maxCubeMapTextureSize; i *= 2) {\n\t\t\t\t\tif (i < _imageWidth) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_imageWidth = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (agent.os.name === \"ios\") {\n\t\t\tconst majorVersion = agent.os.majorVersion;\n\n\t\t\t// ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다.\n\t\t\tif (majorVersion === 9) {\n\t\t\t\t_imageWidth = 1024;\n\t\t\t}\n\t\t\t// ios 8 의 경우 텍스쳐 최대사이즈는 512 이다.\n\t\t\tif (majorVersion === 8) {\n\t\t\t\t_imageWidth = 512;\n\t\t\t}\n\t\t}\n\t\t// maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수\n\t\treturn Math.min(maxCubeMapTextureSize, _imageWidth);\n\t}\n}\n\nexport default CubeRenderer;\n","\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\n\nexport default class CubeStripRenderer extends Renderer {\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}`;\n\t}\n\n\tgetVertexPositionData() {\n\t\tif (!this._vertices) {\n\t\t\tthis._vertices = [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// up\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// down\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\t\t}\n\n\t\treturn this._vertices;\n\t}\n\n\tgetIndexData() {\n\t\t// TODO: 한번만 계산하도록 수정하기\n\t\tconst indices = (() => {\n\t\t\tconst indexData = [];\n\n\t\t\tfor (let i = 0; i < (this._vertices.length / 3); i += 4) {\n\t\t\t\tindexData.push(\n\t\t\t\t\ti,\n\t\t\t\t\ti + 1,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti + 3\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn indexData;\n\t\t})();\n\n\t\treturn indices;\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\t// TODO: make it cols, rows as config.\n\t\tconst cols = 3;\n\t\tconst rows = 2;\n\t\tconst order = imageConfig.order || \"RLUDFB\";\n\t\tlet coords = [];\n\n\t\t// 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다.\n\t\tfor (let r = rows - 1; r >= 0; r--) {\n\t\t\tfor (let c = 0; c < cols; c++) {\n\t\t\t\tconst coord = [\n\t\t\t\t\tc / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, (r + 1) / rows,\n\t\t\t\t\tc / cols, (r + 1) / rows\n\t\t\t\t];\n\n\t\t\t\tcoords.push(coord);\n\t\t\t}\n\t\t}\n\n\t\tconst tileConfigs = this._extractTileConfig(imageConfig);\n\n\t\t// Transform Coord By Flip & Rotation\n\t\tcoords = coords\n\t\t// shrink coord to avoid pixel bleeding\n\t\t\t.map(coord => this._shrinkCoord(coord))\n\t\t\t.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));\n\n\t\t// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치\n\t\treturn \"BFUDRL\".split(\"\")\n\t\t\t.map(face => order.indexOf(face))\n\t\t\t.map(index => coords[index])\n\t\t\t.reduce((acc, val) => acc.concat(val), []);\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\t_transformCoord(coord, tileConfig) {\n\t\tlet newCoord = coord.slice();\n\n\t\tif (tileConfig.flipHorizontal) {\n\t\t\tnewCoord = this._flipHorizontalCoord(newCoord);\n\t\t}\n\n\t\tif (tileConfig.rotation) {\n\t\t\tnewCoord = this._rotateCoord(newCoord, tileConfig.rotation);\n\t\t}\n\n\t\treturn newCoord;\n\t}\n\n\t_shrinkCoord(coord) {\n\t\tconst SHRINK_Y = 0.00;\n\t\tconst SHRINK_X = 0.00;\n\n\t\treturn [\n\t\t\tcoord[0] + SHRINK_X, coord[1] + SHRINK_Y,\n\t\t\tcoord[2] - SHRINK_X, coord[3] + SHRINK_Y,\n\t\t\tcoord[4] - SHRINK_X, coord[5] - SHRINK_Y,\n\t\t\tcoord[6] + SHRINK_X, coord[7] - SHRINK_Y\n\t\t];\n\t}\n\n\t_rotateCoord(coord, rotationAngle) {\n\t\tconst SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord.\n\t\tconst shiftCount = parseInt(rotationAngle / 90, 10) % 4;\n\n\t\tif (shiftCount === 0) {\n\t\t\treturn coord;\n\t\t}\n\n\t\tlet moved;\n\t\tlet rotatedCoord = [];\n\n\t\tif (shiftCount > 0) {\n\t\t\tmoved = coord.splice(0, shiftCount * SIZE);\n\t\t\trotatedCoord = coord.concat(moved);\n\t\t} else {\n\t\t\tmoved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE);\n\t\t\trotatedCoord = moved.concat(coord);\n\t\t}\n\n\t\treturn rotatedCoord;\n\t}\n\n\t_flipHorizontalCoord(coord) {\n\t\treturn [\n\t\t\tcoord[2], coord[3],\n\t\t\tcoord[0], coord[1],\n\t\t\tcoord[6], coord[7],\n\t\t\tcoord[4], coord[5]\n\t\t];\n\t}\n}\n","/**\n * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide})\n * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고)\n * @namespace\n * @name GYRO_MODE\n * @memberof eg.view360.PanoViewer\n */\n/**\n * Disable gyro\n * @ko gyro 비활성화\n * @name NONE\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"none\"\n */\n/**\n * YawPitch Mode\n * @ko YawPitch Mode\n * @name YAWPITCH\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"yawPitch\"\n */\n/**\n * VR Mode\n * @ko VR Mode\n * @name VR\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"VR\"\n */\nimport {GYRO_MODE} from \"../YawPitchControl/consts\";\n\n/**\n * Constant value for errors\n * @ko 에러에 대한 상수 값\n * @namespace\n * @name ERROR_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst ERROR_TYPE = {\n\t/**\n\t * Unsupported device\n\t * @ko 미지원 기기\n\t * @name INVALID_DEVICE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 10\n\t */\n\tINVALID_DEVICE: 10,\n\t/**\n\t * Webgl not support\n\t * @ko WEBGL 미지원\n\t * @name NO_WEBGL\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 11\n\t */\n\tNO_WEBGL: 11,\n\t/**\n\t * Failed to load image\n\t * @ko 이미지 로드 실패\n\t * @name FAIL_IMAGE_LOAD\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 12\n\t */\n\tFAIL_IMAGE_LOAD: 12,\n\t/**\n\t * Failed to bind texture\n\t * @ko 텍스쳐 바인딩 실패\n\t * @name FAIL_BIND_TEXTURE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 13\n\t */\n\tFAIL_BIND_TEXTURE: 13,\n\t/**\n\t * Only one resource(image or video) should be specified\n\t * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t * @name INVALID_RESOURCE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 14\n\t */\n\tINVALID_RESOURCE: 14,\n\t/**\n\t * WebGL context lost occurred\n\t * @ko WebGL context lost 발생\n\t * @name RENDERING_CONTEXT_LOST\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 15\n\t */\n\tRENDERING_CONTEXT_LOST: 15,\n};\n\n/**\n * Constant value for events\n * @ko 이벤트에 대한 상수 값\n * @namespace\n * @name EVENTS\n * @memberof eg.view360.PanoViewer\n */\nconst EVENTS = {\n\t/**\n\t * Events that is fired when PanoViewer is ready to show image and handle user interaction.\n\t * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트\n\t * @name READY\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default ready\n\t */\n\tREADY: \"ready\",\n\t/**\n\t * Events that is fired when direction or fov is changed.\n\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t * @name VIEW_CHANGE\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default viewChange\n\t */\n\tVIEW_CHANGE: \"viewChange\",\n\t/**\n\t * Events that is fired when animation which is triggered by inertia is ended.\n\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t * @name ANIMATION_END\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default animationEnd\n\t */\n\tANIMATION_END: \"animationEnd\",\n\t/**\n\t * Events that is fired when error occurs\n\t * @ko 에러 발생 시 발생하는 이벤트\n\t * @name ERROR\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default error\n\t */\n\tERROR: \"error\"\n};\n\n/**\n * Constant value for projection type\n * @ko 프로젝션 타입 대한 상수 값\n * @namespace\n * @name PROJECTION_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst PROJECTION_TYPE = {\n\t/**\n\t * Constant value for equirectangular type.\n\t * @ko equirectangular 에 대한 상수 값.\n\t * @name EQUIRECTANGULAR\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default equirectangular\n\t */\n\tEQUIRECTANGULAR: \"equirectangular\",\n\t/**\n\t * Constant value for cubemap type.\n\t * @ko cubemap 에 대한 상수 값.\n\t * @name CUBEMAP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubemap\n\t */\n\tCUBEMAP: \"cubemap\",\n\t/**\n\t * Constant value for cubestrip type.\n\t * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC.\n\t *\n\t * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다.\n\t * @name CUBESTRIP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubestrip\n\t */\n\tCUBESTRIP: \"cubestrip\",\n\t/**\n\t * Constant value for PANORAMA type.\n\t *\n\t * PANORAMA is a format for a panorma image which is taken from smartphone.\n\t *\n\t * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다.\n\t *\n\t * @name PANORAMA\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default panorama\n\t */\n\tPANORAMA: \"panorama\",\n\t/**\n\t * Constant value for EQUI_STEREOSCOPY type.\n\t *\n\t * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present.\n\t *\n\t * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다.\n\t *\n\t * @name STEREOSCOPIC_EQUI\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default stereoequi\n\t */\n\tSTEREOSCOPIC_EQUI: \"stereoequi\",\n};\n\n/**\n * A constant value for the format of the stereoscopic equirectangular projection type.\n * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값\n * @namespace\n * @name STEREO_FORMAT\n * @memberof eg.view360.PanoViewer\n */\nconst STEREO_FORMAT = {\n\t/**\n\t * A constant value for format of top bottom stereoscopic 360 equirectangular projection.\n\t * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name TOP_BOTTOM\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dv\"\n\t */\n\tTOP_BOTTOM: \"3dv\",\n\t/**\n\t * A constant value for format of left right stereoscopic 360 equirectangular projection.\n\t * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name LEFT_RIGHT\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dh\"\n\t */\n\tLEFT_RIGHT: \"3dh\",\n\t/**\n\t * A constant value specifying media is not in stereoscopic format.\n\t * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값.\n\t * @name NONE\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"\"\n\t */\n\tNONE: \"\",\n};\n\nexport {\n\tGYRO_MODE,\n\tEVENTS,\n\tERROR_TYPE,\n\tPROJECTION_TYPE,\n\tSTEREO_FORMAT\n};\n","import {glMatrix} from \"gl-matrix\";\nimport Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\n\n// const latitudeBands = 60;\nconst MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6;\nconst longitudeBands = 60;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\n\nclass CylinderRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tgetVertexPositionData() {\n\t\treturn CylinderRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn CylinderRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn CylinderRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\t\tlet resizeDimension;\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device texture limit(${maxSize}))`);\n\n\t\t\t// Request resizing texture.\n\t\t\t/**\n\t\t\t * TODO: Is it need to apply on another projection type?\n\t\t\t */\n\t\t\tresizeDimension = width > height ?\n\t\t\t\t{width: maxSize, height: maxSize * height / width} :\n\t\t\t\t{width: maxSize * width / height, height: maxSize};\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video or resizing needed\n\t\tthis._initPixelSource(image, resizeDimension);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\tupdateShaderData({imageAspectRatio = MIN_ASPECT_RATIO_FOR_FULL_PANORAMA}) {\n\t\tlet lngIdx;\n\t\tlet cylinderMaxRadian;\n\t\tlet halfCylinderY;\n\t\tlet rotated;\n\t\tlet aspectRatio;\n\n\t\t// Exception case: orientation is rotated.\n\t\tif (imageAspectRatio < 1) {\n\t\t\t/**\n\t\t\t * If rotated is true, we assume that image is rotated counter clockwise.\n\t\t\t * TODO: If there's other rotation, it is need to implement by each rotation.\n\t\t\t */\n\t\t\trotated = true;\n\t\t\taspectRatio = 1 / imageAspectRatio;\n\t\t} else {\n\t\t\trotated = false;\n\t\t\taspectRatio = imageAspectRatio;\n\t\t}\n\n\t\tif (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) {\n\t\t\tconst fov = 360 / aspectRatio;\n\n\t\t\tcylinderMaxRadian = 2 * Math.PI; // 360 deg\n\t\t\thalfCylinderY = Math.tan(glMatrix.toRadian(fov / 2));\n\t\t} else {\n\t\t\tcylinderMaxRadian = aspectRatio;\n\t\t\thalfCylinderY = 0.5;// Range of cylinder is [-0.5, 0.5] to make height to 1.\n\t\t}\n\n\t\t// intialize shader data before update\n\t\ttextureCoordData.length = 0;\n\t\tvertexPositionData.length = 0;\n\t\tindexData.length = 0;\n\n\t\tconst CYLIDER_Y = [-halfCylinderY, halfCylinderY];\n\t\tconst startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360)\n\n\t\t// console.log(\"cylinderMaxRadian:\", glMatrix.toDegree(cylinderMaxRadian), \"CYLIDER_Y\", CYLIDER_Y, \"start angle\", glMatrix.toDegree(startAngleForCenterAlign));\n\t\tfor (let yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength/* bottom & top */; yIdx++) {\n\t\t\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\t\t\tconst angle = startAngleForCenterAlign + (lngIdx / longitudeBands * cylinderMaxRadian);\n\t\t\t\tconst x = Math.cos(angle);\n\t\t\t\tconst y = CYLIDER_Y[yIdx];\n\t\t\t\tconst z = Math.sin(angle);\n\t\t\t\tlet u;\n\t\t\t\tlet v;\n\n\t\t\t\tif (rotated) {\n\t\t\t\t\t// Rotated 90 degree (counter clock wise)\n\t\t\t\t\tu = 1 - yIdx; // yLength - yIdx;\n\t\t\t\t\tv = lngIdx / longitudeBands;\n\t\t\t\t} else {\n\t\t\t\t// \t// Normal case (Not rotated)\n\t\t\t\t\tu = lngIdx / longitudeBands;\n\t\t\t\t\tv = yIdx;\n\t\t\t\t}\n\n\t\t\t\ttextureCoordData.push(u, v);\n\t\t\t\tvertexPositionData.push(x, y, z);\n\n\t\t\t\tif (yIdx === 0 && lngIdx < longitudeBands) {\n\t\t\t\t\tconst a = lngIdx;\n\t\t\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default CylinderRenderer;\n","import {mat4} from \"gl-matrix\";\n\nconst VR_DISPLAY_PRESENT_CHANGE = \"vrdisplaypresentchange\";\nconst DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1];\nconst DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1];\nconst EYES = {\n\tLEFT: \"left\",\n\tRIGHT: \"right\"\n};\n\nclass VRManager {\n\tget context() { return this._vrDisplay; }\n\n\tconstructor() {\n\t\tthis._frameData = new window.VRFrameData();\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst vrDisplay = this._vrDisplay;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (vrDisplay && vrDisplay.isPresenting) {\n\t\t\tvrDisplay.exitPresent();\n\t\t}\n\n\t\tthis._clear();\n\t}\n\n\tcanRender() {\n\t\treturn Boolean(this._vrDisplay);\n\t}\n\n\tbeforeRender(gl) {\n\t\t// Render to the default backbuffer\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t}\n\n\tafterRender() {\n\t\tthis._vrDisplay.submitFrame();\n\t}\n\n\tgetEyeParams(gl) {\n\t\tconst display = this._vrDisplay;\n\t\tconst halfWidth = gl.drawingBufferWidth * 0.5;\n\t\tconst height = gl.drawingBufferHeight;\n\t\tconst frameData = this._frameData;\n\n\t\tdisplay.getFrameData(frameData);\n\n\t\tconst leftMVMatrix = frameData.leftViewMatrix;\n\t\tconst rightMVMatrix = frameData.rightViewMatrix;\n\n\t\tmat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset);\n\t\tmat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tviewport: [0, 0, halfWidth, height],\n\t\t\t\tmvMatrix: leftMVMatrix,\n\t\t\t\tpMatrix: frameData.leftProjectionMatrix,\n\t\t\t},\n\t\t\t{\n\t\t\t\tviewport: [halfWidth, 0, halfWidth, height],\n\t\t\t\tmvMatrix: rightMVMatrix,\n\t\t\t\tpMatrix: frameData.rightProjectionMatrix,\n\t\t\t}\n\t\t];\n\t}\n\n\tisPresenting() {\n\t\treturn Boolean(this._vrDisplay && this._vrDisplay.isPresenting);\n\t}\n\n\taddEndCallback(callback) {\n\t\twindow.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\twindow.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\trequestPresent(canvas) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tnavigator.getVRDisplays().then(displays => {\n\t\t\t\tconst vrDisplay = displays.length && displays[0];\n\n\t\t\t\tif (!vrDisplay) {\n\t\t\t\t\treject(new Error(\"No displays available.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!vrDisplay.capabilities.canPresent) {\n\t\t\t\t\treject(new Error(\"Display lacking capability to present.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvrDisplay.requestPresent([{source: canvas}]).then(() => {\n\t\t\t\t\tconst leftEye = vrDisplay.getEyeParameters(EYES.LEFT);\n\t\t\t\t\tconst rightEye = vrDisplay.getEyeParameters(EYES.RIGHT);\n\n\t\t\t\t\tcanvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;\n\t\t\t\t\tcanvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);\n\n\t\t\t\t\tthis._setDisplay(vrDisplay);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setDisplay(vrDisplay) {\n\t\tthis._vrDisplay = vrDisplay;\n\n\t\tconst layers = vrDisplay.getLayers();\n\n\t\tif (layers.length) {\n\t\t\tconst layer = layers[0];\n\n\t\t\tthis._leftBounds = layer.leftBounds;\n\t\t\tthis._rightBounds = layer.rightBounds;\n\t\t}\n\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._vrDisplay = null;\n\t\tthis._leftBounds = DEFAULT_LEFT_BOUNDS;\n\t\tthis._rightBounds = DEFAULT_RIGHT_BOUNDS;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default VRManager;\n","import {mat4, glMatrix} from \"gl-matrix\";\nimport {IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\n\nconst XR_REFERENCE_SPACE = \"local\";\n\nclass XRManager {\n\tget context() { return this._xrSession; }\n\n\tconstructor() {\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst xrSession = this._xrSession;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (xrSession) {\n\t\t\t// Capture to avoid errors\n\t\t\txrSession.end().then(() => {}, () => {});\n\t\t}\n\t\tthis._clear();\n\t}\n\n\tcanRender(frame) {\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\treturn Boolean(pose);\n\t}\n\n\tbeforeRender(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst baseLayer = session.renderState.baseLayer;\n\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer);\n\t}\n\n\tafterRender() {}\n\n\tgetEyeParams(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\tif (!pose) {\n\t\t\t// Can't render\n\t\t\treturn null;\n\t\t}\n\n\t\tconst glLayer = session.renderState.baseLayer;\n\n\t\treturn pose.views.map(view => {\n\t\t\tconst viewport = glLayer.getViewport(view);\n\t\t\tconst mvMatrix = view.transform.inverse.matrix;\n\n\t\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\t\tmat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180));\n\t\t\t}\n\n\t\t\tmat4.rotateY(mvMatrix, mvMatrix, this._yawOffset);\n\n\t\t\treturn {\n\t\t\t\tviewport: [viewport.x, viewport.y, viewport.width, viewport.height],\n\t\t\t\tmvMatrix,\n\t\t\t\tpMatrix: view.projectionMatrix\n\t\t\t};\n\t\t});\n\t}\n\n\tisPresenting() {\n\t\treturn this._presenting;\n\t}\n\n\taddEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.addEventListener(\"end\", callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.removeEventListener(\"end\", callback);\n\t}\n\n\trequestPresent(canvas, gl) {\n\t\treturn navigator.xr.requestSession(\"immersive-vr\", {\n\t\t\trequiredFeatures: [XR_REFERENCE_SPACE],\n\t\t}).then(session => {\n\t\t\tconst xrLayer = new window.XRWebGLLayer(session, gl);\n\n\t\t\tsession.updateRenderState({baseLayer: xrLayer});\n\t\t\treturn session.requestReferenceSpace(XR_REFERENCE_SPACE)\n\t\t\t\t.then(refSpace => {\n\t\t\t\t\tthis._setSession(session, xrLayer, refSpace);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setSession(session, xrLayer, refSpace) {\n\t\tthis._xrSession = session;\n\t\tthis._xrLayer = xrLayer;\n\t\tthis._xrRefSpace = refSpace;\n\t\tthis._presenting = true;\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._xrSession = null;\n\t\tthis._xrLayer = null;\n\t\tthis._xrRefSpace = null;\n\t\tthis._presenting = false;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default XRManager;\n","import {IS_SAFARI_ON_DESKTOP} from \"../utils/browser\";\n\nclass WebGLAnimator {\n\tconstructor() {\n\t\tthis._callback = null;\n\t\tthis._context = window;\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\tsetCallback(callback) {\n\t\tthis._callback = callback;\n\t}\n\n\tsetContext(context) {\n\t\tthis._context = context;\n\t}\n\n\tstart() {\n\t\tconst context = this._context;\n\t\tconst callback = this._callback;\n\n\t\t// No context / callback set\n\t\tif (!context || !callback) return;\n\t\t// Animation already started\n\t\tif (this._rafId >= 0 || this._rafTimer >= 0) return;\n\n\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoopNextTick);\n\t\t} else {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoop);\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this._rafId >= 0) {\n\t\t\tthis._context.cancelAnimationFrame(this._rafId);\n\t\t}\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t}\n\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\t/**\n\t * There can be more than 1 argument when we use XRSession's raf\n\t */\n\t_onLoop = (...args) => {\n\t\tthis._callback(...args);\n\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t}\n\n\t/**\n\t * MacOS X Safari Bug Fix\n\t * This code guarantees that rendering should be occurred.\n\t *\n\t * In MacOS X(10.14.2), Safari (12.0.2)\n\t * The requestAnimationFrame(RAF) callback is called just after previous RAF callback without term\n\t * only if requestAnimationFrame is called for next frame while updating frame is delayed (~over 2ms)\n\t * So browser cannot render the frame and may be freezing.\n\t */\n\t_onLoopNextTick = (...args) => {\n\t\tconst before = performance.now();\n\n\t\tthis._callback(...args);\n\n\t\tconst diff = performance.now() - before;\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t\tthis._rafTimer = -1;\n\t\t}\n\n\t\t/** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */\n\t\tif (diff < 16) {\n\t\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t\t} else {\n\t\t\t/** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/\n\t\t\tthis._rafTimer = setTimeout(this._onLoop, 0);\n\t\t}\n\t}\n}\n\nexport default WebGLAnimator;\n","import Component from \"@egjs/component\";\nimport {glMatrix, vec3, mat3, mat4, quat} from \"gl-matrix\";\nimport ImageLoader from \"./ImageLoader\";\nimport VideoLoader from \"./VideoLoader\";\nimport WebGLUtils from \"./WebGLUtils\";\nimport Renderer from \"./renderer/Renderer\";\nimport CubeRenderer from \"./renderer/CubeRenderer\";\nimport CubeStripRenderer from \"./renderer/CubeStripRenderer\";\nimport SphereRenderer from \"./renderer/SphereRenderer\";\nimport CylinderRenderer from \"./renderer/CylinderRenderer\";\nimport VRManager from \"./vr/VRManager\";\nimport XRManager from \"./vr/XRManager\";\nimport WebGLAnimator from \"./WebGLAnimator\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {devicePixelRatio, WEBXR_SUPPORTED} from \"../utils/browserFeature\";\nimport {PROJECTION_TYPE, STEREO_FORMAT} from \"../PanoViewer/consts\";\nimport {IS_IOS} from \"../utils/browser\";\n\nconst ImageType = PROJECTION_TYPE;\n\nlet DEVICE_PIXEL_RATIO = devicePixelRatio || 1;\n\n// DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다.\nif (DEVICE_PIXEL_RATIO > 2) {\n\tDEVICE_PIXEL_RATIO = 2;\n}\n\n// define custom events name\n/**\n * TODO: how to manage events/errortype with PanoViewer\n *\n * I think renderer events should be seperated from viewer events although it has same name.\n */\nconst EVENTS = {\n\tBIND_TEXTURE: \"bindTexture\",\n\tIMAGE_LOADED: \"imageLoaded\",\n\tERROR: \"error\",\n\tRENDERING_CONTEXT_LOST: \"renderingContextLost\",\n\tRENDERING_CONTEXT_RESTORE: \"renderingContextRestore\",\n};\n\nconst ERROR_TYPE = {\n\tINVALID_DEVICE: 10,\n\tNO_WEBGL: 11,\n\tFAIL_IMAGE_LOAD: 12,\n\tRENDERER_ERROR: 13\n};\n\nclass PanoImageRenderer extends Component {\n\tstatic EVENTS = EVENTS;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\n\tconstructor(\n\t\timage, width, height, isVideo, sphericalConfig, renderingContextAttributes\n\t) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis.sphericalConfig = sphericalConfig;\n\t\tthis.fieldOfView = sphericalConfig.fieldOfView;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tthis._lastQuaternion = null;\n\t\tthis._lastYaw = null;\n\t\tthis._lastPitch = null;\n\t\tthis._lastFieldOfView = null;\n\n\t\tthis.pMatrix = mat4.create();\n\t\tthis.mvMatrix = mat4.create();\n\n\t\t// initialzie pMatrix\n\t\tmat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), width / height, 0.1, 100);\n\n\t\tthis.textureCoordBuffer = null;\n\t\tthis.vertexBuffer = null;\n\t\tthis.indexBuffer = null;\n\n\t\tthis.canvas = this._initCanvas(width, height);\n\t\tthis._setDefaultCanvasStyle();\n\t\tthis._wrapper = null; // canvas wrapper\n\t\tthis._wrapperOrigStyle = null;\n\n\t\tthis._renderingContextAttributes = renderingContextAttributes;\n\t\tthis._image = null;\n\t\tthis._imageConfig = null;\n\t\tthis._imageIsReady = false;\n\t\tthis._shouldForceDraw = false;\n\t\tthis._keepUpdate = false; // Flag to specify 'continuous update' on video even when still.\n\n\t\tthis._onContentLoad = this._onContentLoad.bind(this);\n\t\tthis._onContentError = \tthis._onContentError.bind(this);\n\n\t\tthis._animator = new WebGLAnimator();\n\n\t\t// VR/XR manager\n\t\tthis._vr = null;\n\n\t\tif (image) {\n\t\t\tthis.setImage({\n\t\t\t\timage,\n\t\t\t\timageType: sphericalConfig.imageType,\n\t\t\t\tisVideo,\n\t\t\t\tcubemapConfig: sphericalConfig.cubemapConfig\n\t\t\t});\n\t\t}\n\t}\n\n\t// FIXME: Please refactor me to have more loose connection to yawpitchcontrol\n\tsetYawPitchControl(yawPitchControl) {\n\t\tthis._yawPitchControl = yawPitchControl;\n\t}\n\n\tgetContent() {\n\t\treturn this._image;\n\t}\n\n\tsetImage({image, imageType, isVideo = false, cubemapConfig}) {\n\t\tthis._imageIsReady = false;\n\t\tthis._isVideo = isVideo;\n\t\tthis._imageConfig = Object.assign(\n\t\t\t{\n\t\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only */\n\t\t\t\torder: (imageType === ImageType.CUBEMAP) ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\t\ttileConfig: {\n\t\t\t\t\tflipHorizontal: false,\n\t\t\t\t\trotation: 0\n\t\t\t\t}\n\t\t\t},\n\t\t\tcubemapConfig\n\t\t);\n\t\tthis._setImageType(imageType);\n\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tif (isVideo) {\n\t\t\tthis._contentLoader = new VideoLoader();\n\t\t\tthis._keepUpdate = true;\n\t\t} else {\n\t\t\tthis._contentLoader = new ImageLoader();\n\t\t\tthis._keepUpdate = false;\n\t\t}\n\n\t\t// img element or img url\n\t\tthis._contentLoader.set(image);\n\n\t\t// 이미지의 사이즈를 캐시한다.\n\t\t// image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed.\n\t\tthis._image = this._contentLoader.getElement();\n\n\t\treturn this._contentLoader.get()\n\t\t\t.then(this._onContentLoad, this._onContentError)\n\t\t\t.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.\n\t}\n\n\t_setImageType(imageType) {\n\t\tif (!imageType || this._imageType === imageType) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._imageType = imageType;\n\t\tthis._isCubeMap = imageType === ImageType.CUBEMAP;\n\n\t\tif (this._renderer) {\n\t\t\tthis._renderer.off();\n\t\t}\n\n\t\tswitch (imageType) {\n\t\t\tcase ImageType.CUBEMAP:\n\t\t\t\tthis._renderer = new CubeRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.CUBESTRIP:\n\t\t\t\tthis._renderer = new CubeStripRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.PANORAMA:\n\t\t\t\tthis._renderer = new CylinderRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.STEREOSCOPIC_EQUI:\n\t\t\t\tthis._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis._renderer = new SphereRenderer(STEREO_FORMAT.NONE);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis._renderer.on(Renderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERER_ERROR,\n\t\t\t\tmessage: e.message\n\t\t\t});\n\t\t});\n\n\t\tthis._initWebGL();\n\t}\n\n\t_initCanvas(width, height) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\n\t\tthis._onWebglcontextlost = this._onWebglcontextlost.bind(this);\n\t\tthis._onWebglcontextrestored = this._onWebglcontextrestored.bind(this);\n\n\t\tcanvas.addEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tcanvas.addEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\n\t\treturn canvas;\n\t}\n\n\t_setDefaultCanvasStyle() {\n\t\tconst canvas = this.canvas;\n\n\t\tcanvas.style.bottom = 0;\n\t\tcanvas.style.left = 0;\n\t\tcanvas.style.right = 0;\n\t\tcanvas.style.top = 0;\n\t\tcanvas.style.margin = \"auto\";\n\t\tcanvas.style.maxHeight = \"100%\";\n\t\tcanvas.style.maxWidth = \"100%\";\n\t\tcanvas.style.outline = \"none\";\n\t\tcanvas.style.position = \"absolute\";\n\t}\n\n\t_onContentError(error) {\n\t\tthis._imageIsReady = false;\n\t\tthis._image = null;\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\ttype: ERROR_TYPE.FAIL_IMAGE_LOAD,\n\t\t\tmessage: \"failed to load image\"\n\t\t});\n\n\t\treturn false;\n\t}\n\n\t_triggerContentLoad() {\n\t\tthis.trigger(EVENTS.IMAGE_LOADED, {\n\t\t\tcontent: this._image,\n\t\t\tisVideo: this._isVideo,\n\t\t\tprojectionType: this._imageType\n\t\t});\n\t}\n\t_onContentLoad(image) {\n\t\tthis._imageIsReady = true;\n\n\t\tthis._triggerContentLoad();\n\t\treturn true;\n\t}\n\n\tisImageLoaded() {\n\t\treturn !!this._image && this._imageIsReady &&\n\t\t\t(!this._isVideo || this._image.readyState >= 2 /* HAVE_CURRENT_DATA */);\n\t}\n\n\tbindTexture() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._contentLoader) {\n\t\t\t\trej(\"ImageLoader is not initialized\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._contentLoader.get()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis._bindTexture();\n\t\t\t\t}, rej)\n\t\t\t\t.then(res);\n\t\t});\n\t}\n\n\t// 부모 엘리먼트에 canvas 를 붙임\n\tattachTo(parentElement) {\n\t\tthis.detach();\n\t\tparentElement.appendChild(this.canvas);\n\t\tthis._wrapper = parentElement;\n\t}\n\n\tforceContextLoss() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\tconst loseContextExtension = this.context.getExtension(\"WEBGL_lose_context\");\n\n\t\t\tif (loseContextExtension) {\n\t\t\t\tloseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t}\n\n\t// 부모 엘리먼트에서 canvas 를 제거\n\tdetach() {\n\t\tif (this.canvas.parentElement) {\n\t\t\tthis.canvas.parentElement.removeChild(this.canvas);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tthis._animator.stop();\n\t\tthis.detach();\n\t\tthis.forceContextLoss();\n\n\t\tthis.off();\n\n\t\tthis.canvas.removeEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tthis.canvas.removeEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\t}\n\n\thasRenderingContext() {\n\t\tif (!(this.context && !this.context.isContextLost())) {\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tthis.context &&\n\t\t\t!this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t_initShaderProgram() {\n\t\tconst gl = this.context;\n\n\t\tif (this.shaderProgram) {\n\t\t\tgl.deleteProgram(this.shaderProgram);\n\t\t\tthis.shaderProgram = null;\n\t\t}\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst vsSource = renderer.getVertexShaderSource();\n\t\tconst fsSource = renderer.getFragmentShaderSource();\n\n\t\tconst vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource);\n\t\tconst fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource);\n\n\t\tconst shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader);\n\n\t\tif (!shaderProgram) {\n\t\t\tthrow new Error(`Failed to intialize shaders: ${WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())}`);\n\t\t}\n\n\t\tgl.useProgram(shaderProgram);\n\t\tshaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\");\n\t\tgl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);\n\t\tshaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, \"uPMatrix\");\n\t\tshaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, \"uMVMatrix\");\n\t\tshaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, \"uSampler\");\n\t\tshaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, \"aTextureCoord\");\n\t\tshaderProgram.uEye = gl.getUniformLocation(shaderProgram, \"uEye\");\n\n\t\tgl.enableVertexAttribArray(shaderProgram.textureCoordAttribute);\n\n\t\t// clear buffer\n\t\tgl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n\t\t// Use TEXTURE0\n\t\tgl.uniform1i(shaderProgram.samplerUniform, 0);\n\n\t\tthis.shaderProgram = shaderProgram;\n\t}\n\n\t_onWebglcontextlost(e) {\n\t\te.preventDefault();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_LOST);\n\t}\n\n\t_onWebglcontextrestored(e) {\n\t\tthis._initWebGL();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_RESTORE);\n\t}\n\n\tupdateFieldOfView(fieldOfView) {\n\t\tthis.fieldOfView = fieldOfView;\n\t\tthis._updateViewport();\n\t}\n\n\tupdateViewportDimensions(width, height) {\n\t\tlet viewPortChanged = false;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tconst w = width * DEVICE_PIXEL_RATIO;\n\t\tconst h = height * DEVICE_PIXEL_RATIO;\n\n\t\tif (w !== this.canvas.width) {\n\t\t\tthis.canvas.width = w;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (h !== this.canvas.height) {\n\t\t\tthis.canvas.height = h;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (!viewPortChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._updateViewport();\n\t\tthis._shouldForceDraw = true;\n\t}\n\n\t_updateViewport() {\n\t\tmat4.perspective(\n\t\t\tthis.pMatrix,\n\t\t\tglMatrix.toRadian(this.fieldOfView),\n\t\t\tthis.canvas.width / this.canvas.height,\n\t\t\t0.1,\n\t\t\t100);\n\n\t\tthis.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight);\n\t}\n\n\t_initWebGL() {\n\t\tlet gl;\n\n\t\t// TODO: Following code does need to be executed only if width/height, cubicStrip property is changed.\n\t\ttry {\n\t\t\tthis._initRenderingContext();\n\t\t\tgl = this.context;\n\n\t\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\t\tthis._initShaderProgram();\n\t\t} catch (e) {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\tmessage: \"no webgl support\"\n\t\t\t});\n\t\t\tthis.destroy();\n\t\t\tconsole.error(e); // eslint-disable-line no-console\n\t\t\treturn;\n\t\t}\n\t\t// 캔버스를 투명으로 채운다.\n\t\tgl.clearColor(0, 0, 0, 0);\n\t\tconst textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n\n\t\tif (this.texture) {\n\t\t\tgl.deleteTexture(this.texture);\n\t\t}\n\n\t\tthis.texture = WebGLUtils.createTexture(gl, textureTarget);\n\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\t// TODO: Apply following options on other projection type.\n\t\t\tgl.enable(gl.CULL_FACE);\n\t\t\t// gl.enable(gl.DEPTH_TEST);\n\t\t}\n\t}\n\n\t_initRenderingContext() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!window.WebGLRenderingContext) {\n\t\t\tthrow new Error(\"WebGLRenderingContext not available.\");\n\t\t}\n\n\t\tthis.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes);\n\n\t\tif (!this.context) {\n\t\t\tthrow new Error(\"Failed to acquire 3D rendering context\");\n\t\t}\n\t}\n\n\t_initBuffers() {\n\t\tconst vertexPositionData = this._renderer.getVertexPositionData();\n\t\tconst indexData = this._renderer.getIndexData();\n\t\tconst textureCoordData = this._renderer.getTextureCoordData(this._imageConfig);\n\t\tconst gl = this.context;\n\n\t\tthis.vertexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3,\n\t\t\tthis.shaderProgram.vertexPositionAttribute);\n\n\t\tthis.indexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1);\n\n\t\tthis.textureCoordBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2,\n\t\t\tthis.shaderProgram.textureCoordAttribute);\n\n\t\tthis._bindBuffers();\n\t}\n\n\t_bindTexture() {\n\t\t// Detect if it is EAC Format while CUBESTRIP mode.\n\t\t// We assume it is EAC if image is not 3/2 ratio.\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst isEAC = width && height && width / height !== 1.5;\n\n\t\t\tthis.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, \"uIsEAC\"), isEAC);\n\t\t} else if (this._imageType === ImageType.PANORAMA) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst imageAspectRatio = width && height && width / height;\n\n\t\t\tthis._renderer.updateShaderData({imageAspectRatio});\n\t\t}\n\n\t\t// intialize shader buffers after image is loaded.(by updateShaderData)\n\t\t// because buffer may be differ by image size.(eg. CylinderRenderer)\n\t\tthis._initBuffers();\n\n\t\tthis._renderer.bindTexture(\n\t\t\tthis.context,\n\t\t\tthis.texture,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t\tthis._shouldForceDraw = true;\n\n\t\tthis.trigger(EVENTS.BIND_TEXTURE);\n\t}\n\n\t_updateTexture() {\n\t\tthis._renderer.updateTexture(\n\t\t\tthis.context,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t}\n\n\tkeepUpdate(doUpdate) {\n\t\tif (doUpdate && this.isImageLoaded() === false) {\n\t\t\t// Force to draw a frame after image is loaded on render()\n\t\t\tthis._shouldForceDraw = true;\n\t\t}\n\n\t\tthis._keepUpdate = doUpdate;\n\t}\n\n\tstartRender() {\n\t\tthis._animator.setCallback(this._render.bind(this));\n\t\tthis._animator.start();\n\t}\n\n\tstopRender() {\n\t\tthis._animator.stop();\n\t}\n\n\trenderWithQuaternion(quaternion, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\tthis._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) &&\n\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// updatefieldOfView only if fieldOfView is changed.\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tthis.mvMatrix = mat4.fromQuat(mat4.create(), quaternion);\n\n\t\tthis._draw();\n\n\t\tthis._lastQuaternion = quat.clone(quaternion);\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\trenderWithYawPitch(yaw, pitch, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\t\tthis._lastYaw !== null && this._lastYaw === yaw &&\n\t\t\t\tthis._lastPitch !== null && this._lastPitch === pitch &&\n\t\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch));\n\t\tmat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw));\n\n\t\tthis._draw();\n\n\t\tthis._lastYaw = yaw;\n\t\tthis._lastPitch = pitch;\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\t_render() {\n\t\tconst yawPitchControl = this._yawPitchControl;\n\t\tconst fov = yawPitchControl.getFov();\n\n\t\tif (yawPitchControl.shouldRenderWithQuaternion()) {\n\t\t\tconst quaternion = yawPitchControl.getQuaternion();\n\n\t\t\tthis.renderWithQuaternion(quaternion, fov);\n\t\t} else {\n\t\t\tconst yawPitch = yawPitchControl.getYawPitch();\n\n\t\t\tthis.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov);\n\t\t}\n\t}\n\n\t_renderStereo = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\n\t\tconst eyeParams = vr.getEyeParams(gl, frame);\n\n\t\tif (!eyeParams) return;\n\n\t\tvr.beforeRender(gl, frame);\n\n\t\t// Render both eyes\n\t\tfor (const eyeIndex of [0, 1]) {\n\t\t\tconst eyeParam = eyeParams[eyeIndex];\n\n\t\t\tthis.mvMatrix = eyeParam.mvMatrix;\n\t\t\tthis.pMatrix = eyeParam.pMatrix;\n\n\t\t\tgl.viewport(...eyeParam.viewport);\n\t\t\tgl.uniform1f(this.shaderProgram.uEye, eyeIndex);\n\n\t\t\tthis._bindBuffers();\n\t\t\tthis._draw();\n\t\t}\n\n\t\tvr.afterRender();\n\t}\n\n\t_bindBuffers() {\n\t\tconst gl = this.context;\n\t\tconst program = this.shaderProgram;\n\n\t\tconst vertexBuffer = this.vertexBuffer;\n\t\tconst textureCoordBuffer = this.textureCoordBuffer;\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\t\tgl.enableVertexAttribArray(program.vertexPositionAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\n\t\tgl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\t\tgl.enableVertexAttribArray(program.textureCoordAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\t}\n\n\t_draw() {\n\t\tif (this._isVideo && this._keepUpdate) {\n\t\t\tthis._updateTexture();\n\t\t}\n\n\t\tthis._renderer.render({\n\t\t\tgl: this.context,\n\t\t\tshaderProgram: this.shaderProgram,\n\t\t\tindexBuffer: this.indexBuffer,\n\t\t\tmvMatrix: this.mvMatrix,\n\t\t\tpMatrix: this.pMatrix,\n\t\t});\n\t}\n\n\t/**\n\t * Returns projection renderer by each type\n\t */\n\tgetProjectionRenderer() {\n\t\treturn this._renderer;\n\t}\n\n\t/**\n\t * @return Promise\n\t */\n\tenterVR() {\n\t\tconst vr = this._vr;\n\n\t\tif (!WEBXR_SUPPORTED && !navigator.getVRDisplays) {\n\t\t\treturn Promise.reject(\"VR is not available on this browser.\");\n\t\t}\n\t\tif (vr && vr.isPresenting()) {\n\t\t\treturn Promise.resolve(\"VR already enabled.\");\n\t\t}\n\n\t\treturn this._requestPresent();\n\t}\n\n\texitVR = () => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\tif (!vr) return;\n\n\t\tvr.removeEndCallback(this.exitVR);\n\t\tvr.destroy();\n\t\tthis._vr = null;\n\n\t\t// Restore canvas & context on iOS\n\t\tif (IS_IOS) {\n\t\t\tthis._restoreStyle();\n\t\t}\n\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\tthis._updateViewport();\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t\tthis._bindBuffers();\n\t\tthis._shouldForceDraw = true;\n\n\t\tanimator.stop();\n\t\tanimator.setContext(window);\n\t\tanimator.setCallback(this._render.bind(this));\n\t\tanimator.start();\n\t}\n\n\t_requestPresent() {\n\t\tconst gl = this.context;\n\t\tconst canvas = this.canvas;\n\t\tconst animator = this._animator;\n\n\t\tthis._vr = WEBXR_SUPPORTED ?\n\t\t\tnew XRManager() :\n\t\t\tnew VRManager();\n\n\t\tconst vr = this._vr;\n\n\t\tanimator.stop();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvr.requestPresent(canvas, gl)\n\t\t\t\t.then(() => {\n\t\t\t\t\tvr.addEndCallback(this.exitVR);\n\t\t\t\t\tanimator.setContext(vr.context);\n\t\t\t\t\tanimator.setCallback(this._onFirstVRFrame);\n\n\t\t\t\t\tif (IS_IOS) {\n\t\t\t\t\t\tthis._setWrapperFullscreen();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shouldForceDraw = true;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\tresolve(\"success\");\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tvr.destroy();\n\t\t\t\t\tthis._vr = null;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t});\n\t}\n\n\t_onFirstVRFrame = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\t// If rendering is not ready, wait for next frame\n\t\tif (!vr.canRender(frame)) return;\n\n\t\tconst minusZDir = vec3.fromValues(0, 0, -1);\n\t\tconst eyeParam = vr.getEyeParams(gl, frame)[0];\n\t\t// Extract only rotation\n\t\tconst mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix);\n\t\tconst pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix);\n\n\t\tconst mvInv = mat3.invert(mat3.create(), mvMatrix);\n\t\tconst pInv = mat3.invert(mat3.create(), pMatrix);\n\t\tconst viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv);\n\n\t\tvec3.transformMat3(viewDir, viewDir, mvInv);\n\n\t\tconst yawOffset = mathUtil.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1));\n\n\t\tif (yawOffset === 0) {\n\t\t\t// If the yawOffset is exactly 0, then device sensor is not ready\n\t\t\t// So read it again until it has any value in it\n\t\t\treturn;\n\t\t}\n\n\t\tvr.setYawOffset(yawOffset);\n\t\tanimator.setCallback(this._renderStereo);\n\t}\n\n\t_setWrapperFullscreen() {\n\t\tconst wrapper = this._wrapper;\n\n\t\tif (!wrapper) return;\n\n\t\tthis._wrapperOrigStyle = wrapper.getAttribute(\"style\");\n\t\tconst wrapperStyle = wrapper.style;\n\n\t\twrapperStyle.width = \"100vw\";\n\t\twrapperStyle.height = \"100vh\";\n\t\twrapperStyle.position = \"fixed\";\n\t\twrapperStyle.left = \"0\";\n\t\twrapperStyle.top = \"0\";\n\t\twrapperStyle.zIndex = \"9999\";\n\t}\n\n\t_restoreStyle() {\n\t\tconst wrapper = this._wrapper;\n\t\tconst canvas = this.canvas;\n\n\t\tif (!wrapper) return;\n\n\t\tif (this._wrapperOrigStyle) {\n\t\t\twrapper.setAttribute(\"style\", this._wrapperOrigStyle);\n\t\t} else {\n\t\t\twrapper.removeAttribute(\"style\");\n\t\t}\n\n\t\tthis._wrapperOrigStyle = null;\n\n\t\t// Restore canvas style\n\t\tcanvas.removeAttribute(\"style\");\n\t\tthis._setDefaultCanvasStyle();\n\t}\n}\n\nexport default PanoImageRenderer;\n","import Component from \"@egjs/component\";\nimport {glMatrix} from \"gl-matrix\";\nimport {\n\tDeviceMotionEvent, checkXRSupport\n} from \"../utils/browserFeature\";\n\nimport YawPitchControl from \"../YawPitchControl/YawPitchControl\";\nimport PanoImageRenderer from \"../PanoImageRenderer/PanoImageRenderer\";\nimport WebGLUtils from \"../PanoImageRenderer/WebGLUtils\";\nimport {ERROR_TYPE, EVENTS, GYRO_MODE, PROJECTION_TYPE, STEREO_FORMAT} from \"./consts\";\nimport {util as mathUtil} from \"../utils/math-util.js\";\nimport {VERSION} from \"../version\";\n\nclass PanoViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.PanoViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic VERSION = VERSION;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\tstatic EVENTS = EVENTS;\n\tstatic PROJECTION_TYPE = PROJECTION_TYPE;\n\tstatic GYRO_MODE = GYRO_MODE;\n\t// It should be deprecated!\n\tstatic ProjectionType = PROJECTION_TYPE;\n\tstatic STEREO_FORMAT = STEREO_FORMAT;\n\t/**\n\t * Constant value for touch directions\n\t * @ko 터치 방향에 대한 상수 값.\n\t * @namespace\n\t * @name TOUCH_DIRECTION\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic TOUCH_DIRECTION = {\n\t\t/**\n\t\t * Constant value for none direction.\n\t\t * @ko none 방향에 대한 상수 값.\n\t\t * @name NONE\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 1\n\t\t */\n\t\tNONE: YawPitchControl.TOUCH_DIRECTION_NONE,\n\t\t/**\n\t\t * Constant value for horizontal(yaw) direction.\n\t\t * @ko horizontal(yaw) 방향에 대한 상수 값.\n\t\t * @name YAW\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 6\n\t\t */\n\t\tYAW: YawPitchControl.TOUCH_DIRECTION_YAW,\n\t\t/**\n\t\t * Constant value for vertical direction.\n\t\t * @ko vertical(pitch) 방향에 대한 상수 값.\n\t\t * @name PITCH\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 24\n\t\t */\n\t\tPITCH: YawPitchControl.TOUCH_DIRECTION_PITCH,\n\t\t/**\n\t\t * Constant value for all direction.\n\t\t * @ko all 방향에 대한 상수 값.\n\t\t * @name ALL\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 30\n\t\t */\n\t\tALL: YawPitchControl.TOUCH_DIRECTION_ALL\n\t};\n\n\t/**\n\t * @classdesc 360 media viewer\n\t * @ko 360 미디어 뷰어\n\t * @class\n\t * @name eg.view360.PanoViewer\n\t * @extends eg.Component\n\t *\n\t * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트\n\t * @param {Object} config\n\t *\n\t * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
\n\t * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.\n\t * @param {Object} [config.cubemapConfig.order = \"RLUDBF\"(ProjectionType === CUBEMAP) | \"RLUDFB\" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서\n\t * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.\n\t * @param {String} [config.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
\n\t * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위)\n\t * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위)\n\t *\n\t * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위)\n\t * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위)\n\t * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위)\n\t * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다\n\t * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다.\n\t * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE}
\n\t * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위\n\t * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위\n\t * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위\n\t * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
\n\t *\n\t * @example\n\t * // PanoViewer Creation\n\t * // create PanoViewer with option\n\t * var PanoViewer = eg.view360.PanoViewer;\n\t * // Area where the image will be displayed(HTMLElement)\n\t * var container = document.getElementById(\"myPanoViewer\");\n\t *\n\t * var panoViewer = new PanoViewer(container, {\n\t * // If projectionType is not specified, the default is \"equirectangular\".\n\t * // Specifies an image of the \"equirectangular\" type.\n\t * image: \"/path/to/image/image.jpg\"\n\t *});\n\t *\n\t * @example\n\t * // Cubemap Config Setting Example\n\t * // For support Youtube EAC projection, You should set cubemapConfig as follows.\n\t * cubemapConfig: {\n\t * \torder: \"LFRDBU\",\n\t * \ttileConfig: [\n\t * \t\ttileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}]\n\t * \t]\n\t * }\n\t */\n\tconstructor(container, options = {}) {\n\t\tsuper();\n\n\t\t// Raises the error event if webgl is not supported.\n\t\tif (!WebGLUtils.isWebGLAvailable()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\t\tmessage: \"no webgl support\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!WebGLUtils.isStableWebGL()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_DEVICE,\n\t\t\t\t\tmessage: \"blacklisted browser\"\n\t\t\t\t});\n\t\t\t}, 0);\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!!options.image && !!options.video) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_RESOURCE,\n\t\t\t\t\tmessage: \"Specifying multi resouces(both image and video) is not valid.\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\t// Check XR support at not when imported, but when created.\n\t\t// This is intended to make polyfills easier to use.\n\t\tcheckXRSupport();\n\n\t\tthis._container = container;\n\t\tthis._image = options.image || options.video;\n\t\tthis._isVideo = !!options.video;\n\t\tthis._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\tthis._cubemapConfig = Object.assign({\n\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/\n\t\t\torder: this._projectionType === PROJECTION_TYPE.CUBEMAP ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, options.cubemapConfig);\n\t\tthis._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\n\t\t// If the width and height are not provided, will use the size of the container.\n\t\tthis._width = options.width || parseInt(window.getComputedStyle(container).width, 10);\n\t\tthis._height = options.height || parseInt(window.getComputedStyle(container).height, 10);\n\n\t\t/**\n\t\t * Cache the direction for the performance in renderLoop\n\t\t *\n\t\t * This value should be updated by \"change\" event of YawPitchControl.\n\t\t */\n\t\tthis._yaw = options.yaw || 0;\n\t\tthis._pitch = options.pitch || 0;\n\t\tthis._fov = options.fov || 65;\n\n\t\tthis._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH;\n\t\tthis._quaternion = null;\n\n\t\tthis._aspectRatio = this._height !== 0 ? this._width / this._height : 1;\n\t\tconst fovRange = options.fovRange || [30, 110];\n\t\tconst touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ?\n\t\t\toptions.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL;\n\t\tconst yawPitchConfig = Object.assign(options, {\n\t\t\telement: container,\n\t\t\tyaw: this._yaw,\n\t\t\tpitch: this._pitch,\n\t\t\tfov: this._fov,\n\t\t\tgyroMode: this._gyroMode,\n\t\t\tfovRange,\n\t\t\taspectRatio: this._aspectRatio,\n\t\t\ttouchDirection\n\t\t});\n\n\t\tthis._isReady = false;\n\n\t\tthis._initYawPitchControl(yawPitchConfig);\n\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t}\n\n\t/**\n\t * Get the video element that the viewer is currently playing. You can use this for playback.\n\t * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다.\n\t * @method eg.view360.PanoViewer#getVideo\n\t * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement\n\t * @example\n\t * var videoTag = panoViewer.getVideo();\n\t * videoTag.play(); // play video!\n\t */\n\tgetVideo() {\n\t\tif (!this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the video information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setVideo\n\t * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정)\n\t * @param {Object} param\n\t * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}(\"equirectangular\")] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setVideo(\"/path/to/video/video.mp4\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR\n\t * });\n\t */\n\tsetVideo(video, param = {}) {\n\t\tif (video) {\n\t\t\tthis.setImage(video, {\n\t\t\t\tprojectionType: param.projectionType,\n\t\t\t\tisVideo: true,\n\t\t\t\tcubemapConfig: param.cubemapConfig,\n\t\t\t\tstereoFormat: param.stereoFormat\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the image information that the viewer is currently using.\n\t * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다.\n\t * @method eg.view360.PanoViewer#getImage\n\t * @return {Image} Image Object이미지 객체\n\t * @example\n\t * var imageObj = panoViewer.getImage();\n\t */\n\tgetImage() {\n\t\tif (this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the image information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setImage\n\t * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.)\n\t * @param {Object} param Additional information이미지 추가 정보\n\t * @param {String} [param.projectionType=\"equirectangular\"] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setImage(\"/path/to/image/image.png\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP\n\t * });\n\t */\n\tsetImage(image, param = {}) {\n\t\tconst cubemapConfig = Object.assign({\n\t\t\torder: \"RLUDBF\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, param.cubemapConfig);\n\t\tconst stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\t\tconst isVideo = !!(param.isVideo);\n\n\t\tif (this._image && this._isVideo !== isVideo) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.warn(\"Currently not supporting to change content type(Image <--> Video)\");\n\t\t\t/* eslint-enable no-console */\n\t\t\treturn this;\n\t\t}\n\n\t\tif (image) {\n\t\t\tthis._image = image;\n\t\t\tthis._isVideo = isVideo;\n\t\t\tthis._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\t\tthis._cubemapConfig = cubemapConfig;\n\t\t\tthis._stereoFormat = stereoFormat;\n\n\t\t\tthis._deactivate();\n\t\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set whether the renderer always updates the texture and renders.\n\t * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다.\n\t *\n\t * @method eg.view360.PanoViewer#keepUpdate\n\t * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다.\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tkeepUpdate(doUpdate) {\n\t\tthis._photoSphereRenderer.keepUpdate(doUpdate);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get projection type (equirectangular/cube)\n\t * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#getProjectionType\n\t * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE}\n\t */\n\tgetProjectionType() {\n\t\treturn this._projectionType;\n\t}\n\n\t/**\n\t * Activate the device's motion sensor, and return the Promise whether the sensor is enabled\n\t * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element.\n\t * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다.\n\t * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * @method eg.view360.PanoViewer#enableSensor\n\t * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다.\n\t */\n\tenableSensor() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\") {\n\t\t\t\tDeviceMotionEvent.requestPermission().then(permissionState => {\n\t\t\t\t\tif (permissionState === \"granted\") {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(new Error(\"permission denied\"));\n\t\t\t\t\t}\n\t\t\t\t}).catch(e => {\n\t\t\t\t\t// This can happen when this method wasn't triggered by user interaction\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disable the device's motion sensor.\n\t * @ko 디바이스의 모션 센서를 비활성화합니다.\n\t * @deprecated\n\t * @method eg.view360.PanoViewer#disableSensor\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdisableSensor() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred).\n\t * This method must be used in the context of user interaction, like onclick callback on the button element.\n\t * It can be rejected when an enabling device sensor fails or image/video is still loading(\"ready\" event not triggered).\n\t * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다)\n\t * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우(\"ready\"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다.\n\t * @method eg.view360.PanoViewer#enterVR\n\t * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error)\n\t */\n\tenterVR() {\n\t\tif (!this._isReady) {\n\t\t\treturn Promise.reject(new Error(\"PanoViewer is not ready to show image.\"));\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.enableSensor()\n\t\t\t\t.then(() => this._photoSphereRenderer.enterVR())\n\t\t\t\t.then(res => resolve(res))\n\t\t\t\t.catch(e => reject(e));\n\t\t});\n\t}\n\n\t/**\n\t * Exit VR stereo rendering mode.\n\t * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#exitVR\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\texitVR() {\n\t\tthis._photoSphereRenderer.exitVR();\n\t\treturn this;\n\t}\n\n\t// TODO: Remove parameters as they're just using private values\n\t_initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) {\n\t\tthis._photoSphereRenderer = new PanoImageRenderer(\n\t\t\tthis._image,\n\t\t\tthis._width,\n\t\t\tthis._height,\n\t\t\tthis._isVideo,\n\t\t\t{\n\t\t\t\tinitialYaw: yaw,\n\t\t\t\tinitialPitch: pitch,\n\t\t\t\tfieldOfView: fov,\n\t\t\t\timageType: projectionType,\n\t\t\t\tcubemapConfig,\n\t\t\t\tstereoFormat: this._stereoFormat\n\t\t\t},\n\t\t);\n\t\tthis._photoSphereRenderer.setYawPitchControl(this._yawPitchControl);\n\n\t\tthis._bindRendererHandler();\n\n\t\tthis._photoSphereRenderer\n\t\t\t.bindTexture()\n\t\t\t.then(() => this._activate())\n\t\t\t.catch(() => {\n\t\t\t\tthis._triggerEvent(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.FAIL_BIND_TEXTURE,\n\t\t\t\t\tmessage: \"failed to bind texture\"\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * update values of YawPitchControl if needed.\n\t * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image.\n\t *\n\t * This function should be called after isReady status is true.\n\t */\n\t_updateYawPitchIfNeeded() {\n\t\tif (this._projectionType === PanoViewer.ProjectionType.PANORAMA) {\n\t\t\t// update fov by aspect ratio\n\t\t\tconst image = this._photoSphereRenderer.getContent();\n\t\t\tlet imageAspectRatio = image.naturalWidth / image.naturalHeight;\n\t\t\tlet isCircular;\n\t\t\tlet yawSize;\n\t\t\tlet maxFov;\n\n\t\t\t// If height is larger than width, then we assume it's rotated by 90 degree.\n\t\t\tif (imageAspectRatio < 1) {\n\t\t\t\t// So inverse the aspect ratio.\n\t\t\t\timageAspectRatio = 1 / imageAspectRatio;\n\t\t\t}\n\n\t\t\tif (imageAspectRatio < 6) {\n\t\t\t\tyawSize = mathUtil.toDegree(imageAspectRatio);\n\t\t\t\tisCircular = false;\n\t\t\t\t// 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5\n\t\t\t\tmaxFov = mathUtil.toDegree(Math.atan(0.5)) * 2;\n\t\t\t} else {\n\t\t\t\tyawSize = 360;\n\t\t\t\tisCircular = true;\n\t\t\t\tmaxFov = (360 / imageAspectRatio); // Make it 5 fixed as axes does.\n\t\t\t}\n\n\t\t\t// console.log(\"_updateYawPitchIfNeeded\", maxFov, \"aspectRatio\", image.naturalWidth, image.naturalHeight, \"yawSize\", yawSize);\n\t\t\tconst minFov = (this._yawPitchControl.option(\"fovRange\"))[0];\n\n\t\t\t// this option should be called after fov is set.\n\t\t\tthis._yawPitchControl.option({\n\t\t\t\t\"fov\": maxFov, /* parameter for internal validation for pitchrange */\n\t\t\t\t\"yawRange\": [-yawSize / 2, yawSize / 2],\n\t\t\t\tisCircular,\n\t\t\t\t\"pitchRange\": [-maxFov / 2, maxFov / 2],\n\t\t\t\t\"fovRange\": [minFov, maxFov]\n\t\t\t});\n\t\t\tthis.lookAt({fov: maxFov});\n\t\t}\n\t}\n\n\t_bindRendererHandler() {\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, e);\n\t\t});\n\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, e => {\n\t\t\tthis._deactivate();\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERING_CONTEXT_LOST,\n\t\t\t\tmessage: \"webgl rendering context lost\"\n\t\t\t});\n\t\t});\n\t}\n\n\t_initYawPitchControl(yawPitchConfig) {\n\t\tthis._yawPitchControl = new YawPitchControl(yawPitchConfig);\n\n\t\tthis._yawPitchControl.on(EVENTS.ANIMATION_END, e => {\n\t\t\tthis._triggerEvent(EVENTS.ANIMATION_END, e);\n\t\t});\n\n\t\tthis._yawPitchControl.on(\"change\", e => {\n\t\t\tthis._yaw = e.yaw;\n\t\t\tthis._pitch = e.pitch;\n\t\t\tthis._fov = e.fov;\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis._triggerEvent(EVENTS.VIEW_CHANGE, e);\n\t\t});\n\t}\n\n\t_triggerEvent(name, param) {\n\t\tconst evt = param || {};\n\n\t\t/**\n\t\t * Events that is fired when error occurs\n\t\t * @ko 에러 발생 시 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#error\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.type Error type\n\t\t * \t\t10: INVALID_DEVICE: Unsupported device\n\t\t * \t\t11: NO_WEBGL: Webgl not support\n\t\t * \t\t12, FAIL_IMAGE_LOAD: Failed to load image\n\t\t * \t\t13: FAIL_BIND_TEXTURE: Failed to bind texture\n\t\t * \t\t14: INVALID_RESOURCE: Only one resource(image or video) should be specified\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost occurred\n\t\t * 에러 종류\n\t\t * \t\t10: INVALID_DEVICE: 미지원 기기\n\t\t * \t\t11: NO_WEBGL: WEBGL 미지원\n\t\t * \t\t12, FAIL_IMAGE_LOAD: 이미지 로드 실패\n\t\t * \t\t13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패\n\t\t * \t\t14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost 발생\n\t\t * \n\t\t * @param {String} param.message Error message 에러 메시지\n\t\t * @see {@link eg.view360.PanoViewer.ERROR_TYPE}\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"error\" : function(evt) {\n\t\t *\t\t// evt.type === 13\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t *\n\t\t * // constant can be used\n\t\t * viwer.on({\n\t\t *\teg.view360.PanoViewer.EVENTS.ERROR : function(evt) {\n\t\t *\t\t// evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when PanoViewer is ready to go.\n\t\t * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#ready\n\t\t * @event\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"ready\" : function(evt) {\n\t\t *\t\t// PanoViewer is ready to show image and handle user interaction.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when direction or fov is changed.\n\t\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#viewChange\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.yaw yawyaw\n\t\t * @param {Number} param.pitch pitch pitch\n\t\t * @param {Number} param.fov Field of view (fov) 화각\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"viewChange\" : function(evt) {\n\t\t *\t\t//evt.yaw, evt.pitch, evt.fov is available.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when animation which is triggered by inertia is ended.\n\t\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#animationEnd\n\t\t * @event\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"animationEnd\" : function(evt) {\n\t\t *\t\t// animation is ended.\n\t\t * });\n\t\t */\n\t\treturn this.trigger(name, evt);\n\t}\n\n\t/**\n\t * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}.\n\t * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다.\n\t * @method eg.view360.PanoViewer#setUseZoom\n\t * @param {Boolean} useZoom\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseZoom(useZoom) {\n\t\ttypeof useZoom === \"boolean\" && this._yawPitchControl.option(\"useZoom\", useZoom);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * When true, enables the keyboard move key control: awsd, arrow keys\n\t * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키)\n\t * @method eg.view360.PanoViewer#setUseKeyboard\n\t * @param {Boolean} useKeyboard\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseKeyboard(useKeyboard) {\n\t\tthis._yawPitchControl.option(\"useKeyboard\", useKeyboard);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")\n\t * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")\n\t * @method eg.view360.PanoViewer#setGyroMode\n\t * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE}\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setGyroMode(\"yawPitch\");\n\t * //equivalent\n\t * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH);\n\t */\n\tsetGyroMode(gyroMode) {\n\t\tthis._yawPitchControl.option(\"gyroMode\", gyroMode);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setFovRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setFovRange([50, 90]);\n\t */\n\tsetFovRange(range) {\n\t\tthis._yawPitchControl.option(\"fovRange\", range);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Getting the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFovRange\n\t * @return {Array}\n\t * @example\n\t * var range = panoViewer.getFovRange(); //[50, 90]\n\t */\n\tgetFovRange() {\n\t\treturn this._yawPitchControl.option(\"fovRange\");\n\t}\n\n\t/**\n\t * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size.\n\t * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다.\n\t * @method eg.view360.PanoViewer#updateViewportDimensions\n\t * @param {Object} [size]\n\t * @param {Number} [size.width=width of container]\n\t * @param {Number} [size.height=height of container]\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tupdateViewportDimensions(size = {width: undefined, height: undefined}) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet containerSize;\n\n\t\tif (size.width === undefined || size.height === undefined) {\n\t\t\tcontainerSize = window.getComputedStyle(this._container);\n\t\t}\n\n\t\tconst width = size.width || parseInt(containerSize.width, 10);\n\t\tconst height = size.height || parseInt(containerSize.height, 10);\n\n\t\t// Skip if viewport is not changed.\n\t\tif (width === this._width && height === this._height) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tthis._aspectRatio = width / height;\n\t\tthis._photoSphereRenderer.updateViewportDimensions(width, height);\n\t\tthis._yawPitchControl.option(\"aspectRatio\", this._aspectRatio);\n\t\tthis._yawPitchControl.updatePanScale({height});\n\n\t\tthis.lookAt({}, 0);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the current field of view(FOV)\n\t * @ko 현재 field of view(FOV) 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFov\n\t * @return {Number}\n\t */\n\tgetFov() {\n\t\treturn this._fov;\n\t}\n\n\t/**\n\t * Get the horizontal field of view in degree\n\t */\n\t_getHFov() {\n\t\treturn mathUtil.toDegree(\n\t\t\t2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2)));\n\t}\n\n\t/**\n\t * Get current yaw value\n\t * @ko 현재 yaw 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYaw\n\t * @return {Number}\n\t */\n\tgetYaw() {\n\t\treturn this._yaw;\n\t}\n\n\t/**\n\t * Get current pitch value\n\t * @ko 현재 pitch 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getPitch\n\t * @return {Number}\n\t */\n\tgetPitch() {\n\t\treturn this._pitch;\n\t}\n\n\t/**\n\t * Get the range of controllable Yaw values\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYawRange\n\t * @return {Array}\n\t */\n\tgetYawRange() {\n\t\treturn this._yawPitchControl.option(\"yawRange\");\n\t}\n\n\t/**\n\t * Get the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다.\n\t * @method eg.view360.PanoViewer#getPitchRange\n\t * @return {Array}\n\t */\n\tgetPitchRange() {\n\t\treturn this._yawPitchControl.option(\"pitchRange\");\n\t}\n\n\t/**\n\t * Set the range of controllable yaw\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#setYawRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setYawRange([-90, 90]);\n\t */\n\tsetYawRange(yawRange) {\n\t\tthis._yawPitchControl.option(\"yawRange\", yawRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setPitchRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setPitchRange([-40, 40]);\n\t */\n\tsetPitchRange(pitchRange) {\n\t\tthis._yawPitchControl.option(\"pitchRange\", pitchRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed.\n\t * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다.\n\t * @method eg.view360.PanoViewer#setShowPolePoint\n\t * @param {Boolean} showPolePoint\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetShowPolePoint(showPolePoint) {\n\t\tthis._yawPitchControl.option(\"showPolePoint\", showPolePoint);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a new view by setting camera configuration. Any parameters not specified remain the same.\n\t * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다.\n\t * @method eg.view360.PanoViewer#lookAt\n\t * @param {Object} orientation\n\t * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위)\n\t * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위)\n\t * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위)\n\t * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초)\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * // Change the yaw angle (absolute angle) to 30 degrees for one second.\n\t * panoViewer.lookAt({yaw: 30}, 1000);\n\t */\n\tlookAt(orientation, duration) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw;\n\t\tconst pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch;\n\t\tconst pitchRange = this._yawPitchControl.option(\"pitchRange\");\n\t\tconst verticalAngleOfImage = pitchRange[1] - pitchRange[0];\n\t\tlet fov = orientation.fov !== undefined ? orientation.fov : this._fov;\n\n\t\tif (verticalAngleOfImage < fov) {\n\t\t\tfov = verticalAngleOfImage;\n\t\t}\n\n\t\tthis._yawPitchControl.lookAt({yaw, pitch, fov}, duration);\n\n\t\tif (duration === 0) {\n\t\t\tthis._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_activate() {\n\t\tthis._photoSphereRenderer.attachTo(this._container);\n\t\tthis._yawPitchControl.enable();\n\n\t\tthis.updateViewportDimensions();\n\n\t\tthis._isReady = true;\n\n\t\t// update yawPitchControl after isReady status is true.\n\t\tthis._updateYawPitchIfNeeded();\n\n\t\tthis._triggerEvent(EVENTS.READY);\n\t\tthis._photoSphereRenderer.startRender();\n\t}\n\n\t/**\n\t * Destroy webgl context and block user interaction and stop rendering\n\t */\n\t_deactivate() {\n\t\tif (this._isReady) {\n\t\t\tthis._photoSphereRenderer.stopRender();\n\t\t\tthis._yawPitchControl.disable();\n\t\t\tthis._isReady = false;\n\t\t}\n\n\t\tif (this._photoSphereRenderer) {\n\t\t\tthis._photoSphereRenderer.destroy();\n\t\t\tthis._photoSphereRenderer = null;\n\t\t}\n\t}\n\n\tstatic _isValidTouchDirection(direction) {\n\t\treturn direction === PanoViewer.TOUCH_DIRECTION.NONE ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.YAW ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.PITCH ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.ALL;\n\t}\n\n\t/**\n\t * Set touch direction by which user can control.\n\t * @ko 사용자가 조작가능한 터치 방향을 지정합니다.\n\t * @method eg.view360.PanoViewer#setTouchDirection\n\t * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @return {eg.view360.PanoViewer} PanoViewer instance\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Limit the touch direction to the yaw direction only.\n\t * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW);\n\t */\n\tsetTouchDirection(direction) {\n\t\tif (PanoViewer._isValidTouchDirection(direction)) {\n\t\t\tthis._yawPitchControl.option(\"touchDirection\", direction);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns touch direction by which user can control\n\t * @ko 사용자가 조작가능한 터치 방향을 반환한다.\n\t * @method eg.view360.PanoViewer#getTouchDirection\n\t * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Returns the current touch direction.\n\t * var dir = panoViewer.getTouchDirection();\n\t */\n\tgetTouchDirection() {\n\t\treturn this._yawPitchControl.option(\"touchDirection\");\n\t}\n\n\t/**\n\t * Destroy viewer. Remove all registered event listeners and remove viewer canvas.\n\t * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다.\n\t * @method eg.view360.PanoViewer#destroy\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdestroy() {\n\t\tthis._deactivate();\n\n\t\tif (this._yawPitchControl) {\n\t\t\tthis._yawPitchControl.destroy();\n\t\t\tthis._yawPitchControl = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check whether the current environment can execute PanoViewer\n\t * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다.\n\t * @function isSupported\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부\n\t * @static\n\t */\n\tstatic isSupported() {\n\t\treturn WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the WebGL\n\t * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다.\n\t * @function isWebGLAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} WebGL support WebGL 지원여부\n\t * @static\n\t */\n\tstatic isWebGLAvailable() {\n\t\treturn WebGLUtils.isWebGLAvailable();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the gyro sensor.\n\t * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다.\n\t * @function isGyroSensorAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수\n\t * @static\n\t */\n\tstatic isGyroSensorAvailable(callback) {\n\t\tif (!DeviceMotionEvent) {\n\t\t\tcallback && callback(false);\n\t\t\treturn;\n\t\t}\n\n\t\tlet onDeviceMotionChange;\n\n\t\tfunction checkGyro() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tonDeviceMotionChange = function(deviceMotion) {\n\t\t\t\t\tconst isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null);\n\n\t\t\t\t\tres(isGyroSensorAvailable);\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener(\"devicemotion\", onDeviceMotionChange);\n\t\t\t});\n\t\t}\n\n\t\tfunction timeout() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tsetTimeout(() => res(false), 1000);\n\t\t\t});\n\t\t}\n\n\t\tPromise.race([checkGyro(), timeout()]).then(isGyroSensorAvailable => {\n\t\t\twindow.removeEventListener(\"devicemotion\", onDeviceMotionChange);\n\n\t\t\tcallback && callback(isGyroSensorAvailable);\n\n\t\t\tPanoViewer.isGyroSensorAvailable = function(fb) {\n\t\t\t\tfb && fb(isGyroSensorAvailable);\n\t\t\t\treturn isGyroSensorAvailable;\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport default PanoViewer;\n"],"names":["module","objectOrFunction","x","type","isFunction","_isArray","Array","isArray","Object","prototype","toString","call","len","vertxNext","customSchedulerFn","asap","callback","arg","queue","flush","scheduleFlush","setScheduler","scheduleFn","setAsap","asapFn","browserWindow","window","undefined","browserGlobal","BrowserMutationObserver","MutationObserver","WebKitMutationObserver","isNode","self","process","isWorker","Uint8ClampedArray","importScripts","MessageChannel","useNextTick","nextTick","useVertxTimer","useSetTimeout","useMutationObserver","iterations","observer","node","document","createTextNode","observe","characterData","data","useMessageChannel","channel","port1","onmessage","port2","postMessage","globalSetTimeout","setTimeout","i","attemptVertx","vertx","Function","require","runOnLoop","runOnContext","e","then","onFulfillment","onRejection","parent","this","child","constructor","noop","PROMISE_ID","makePromise","_state","arguments","invokeCallback","_result","subscribe","resolve$1","object","Constructor","promise","resolve","Math","random","substring","PENDING","FULFILLED","REJECTED","selfFulfillment","TypeError","cannotReturnOwn","tryThen","then$$1","value","fulfillmentHandler","rejectionHandler","handleForeignThenable","thenable","sealed","error","fulfill","reason","reject","_label","handleOwnThenable","handleMaybeThenable","maybeThenable","publishRejection","_onerror","publish","_subscribers","length","subscribers","settled","detail","hasCallback","succeeded","initializePromise","resolver","resolvePromise","rejectPromise","id","nextId","validationError","Error","Enumerator","input","_instanceConstructor","_remaining","_enumerate","_eachEntry","entry","c","resolve$$1","_then","didError","_settledAt","Promise$1","_willSettleAt","state","enumerator","all","entries","race","_","reject$1","needsResolver","needsNew","Promise","catch","_catch","finally","_finally","polyfill","local","global","P","promiseToString","cast","_setScheduler","_setAsap","_asap","factory","isUndefined","Component","_eventHandler","options","_proto","trigger","eventName","customEvent","handlerList","concat","eventType","isCanceled","stop","currentTarget","_len","restParam","_key","apply","once","handlerToAttach","eventHash","on","listener","_len2","_key2","off","hasOn","name","push","handlerToDetach","k","handlerFunction","splice","VERSION","EPSILON","ARRAY_TYPE","Float32Array","degree","PI","toRadian","a","create","out","glMatrix.ARRAY_TYPE","fromMat4","invert","a00","a01","a02","a10","a11","a12","a20","a21","a22","b01","b11","b21","det","rotateX","rad","s","sin","cos","a13","a23","rotateY","a03","perspective","fovy","aspect","near","far","nf","f","tan","Infinity","y","z","hypot","fromValues","subtract","b","normalize","sqrt","dot","cross","ax","ay","az","bx","by","bz","transformMat3","m","transformQuat","q","qx","qy","qz","qw","uvx","uvy","uvz","uuvx","uuvy","uuvz","w2","vec","setAxisAngle","axis","slerp","t","omega","cosom","sinom","scale0","scale1","aw","bw","glMatrix.EPSILON","acos","tmpvec3","xUnitVec3","yUnitVec3","temp1","temp2","matr","clone","w","copy","exactEquals","equals","a0","a1","a2","a3","b0","b1","b2","b3","abs","max","vec3.create","vec3.fromValues","mat3.create","some","arr","find","execRegExp","pattern","text","RegExp","exec","convertVersion","replace","findPreset","presets","userAgent","userPreset","version","preset","versionTest","result","test","brand","versionAlias","toLowerCase","findBrand","brands","_a","BROWSER_PRESETS","CHROMIUM_PRESETS","WEBKIT_PRESETS","WEBVIEW_PRESETS","OS_PRESETS","parseUserAgent","nextAgent","agent","navigator","getUserAgent","isMobile","browser","majorVersion","webview","chromium","webkit","os","browserPreset","browserVersion","_b","osPreset","osVersion","parseInt","isHints","userAgentData","uaList","hasUserAgentData","osData","slice","mobile","firstBrand","platform_1","platform","platformVersion","uaFullVersion","parseUserAgentData","win","doc","getAgent","osName","browserName","IS_IOS","IS_SAFARI_ON_DESKTOP","getComputedStyle","SUPPORT_TOUCH","SUPPORT_DEVICEMOTION","DeviceMotionEvent","devicePixelRatio","WEBXR_SUPPORTED","docStyle","documentElement","style","target","CSS","supports","_extends","assign","source","key","hasOwnProperty","_inheritsLoose","subClass","superClass","__proto__","_assertThisInitialized","ReferenceError","assign$1","output","index","nextKey","VENDOR_PREFIXES","TEST_ELEMENT","createElement","TYPE_FUNCTION","round","now","Date","prefixed","obj","property","prefix","prop","camelProp","toUpperCase","PREFIXED_TOUCH_ACTION","NATIVE_TOUCH_ACTION","TOUCH_ACTION_COMPUTE","TOUCH_ACTION_MANIPULATION","TOUCH_ACTION_NONE","TOUCH_ACTION_PAN_X","TOUCH_ACTION_PAN_Y","TOUCH_ACTION_MAP","touchMap","cssSupports","forEach","val","getTouchActionProps","SUPPORT_POINTER_EVENTS","SUPPORT_ONLY_TOUCH","INPUT_TYPE_TOUCH","INPUT_TYPE_MOUSE","COMPUTE_INTERVAL","INPUT_START","INPUT_END","INPUT_CANCEL","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DIRECTION_DOWN","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","DIRECTION_ALL","PROPS_XY","PROPS_CLIENT_XY","each","iterator","context","boolOrFn","args","inStr","str","indexOf","TouchAction","manager","set","compute","element","actions","trim","update","touchAction","recognizers","recognizer","enable","getTouchAction","hasPanX","hasPanY","cleanTouchActions","join","preventDefaults","srcEvent","direction","offsetDirection","session","prevented","preventDefault","hasNone","isTapPointer","pointers","isTapMovement","distance","isTapTouchTime","deltaTime","preventSrc","hasParent","parentNode","getCenter","pointersLength","clientX","clientY","simpleCloneInputData","timeStamp","center","deltaX","deltaY","getDistance","p1","p2","props","getAngle","atan2","getDirection","getVelocity","computeInputData","firstInput","firstMultiple","offset","prevDelta","prevInput","offsetCenter","angle","offsetDelta","start","end","overallVelocity","overallVelocityX","overallVelocityY","scale","rotation","maxPointers","velocity","velocityX","velocityY","last","lastInterval","v","computeIntervalInputData","srcEventTarget","composedPath","path","inputHandler","pointersLen","changedPointersLen","changedPointers","isFirst","isFinal","emit","recognize","splitStr","split","addEventListeners","types","handler","addEventListener","removeEventListeners","removeEventListener","getWindowForElement","ownerDocument","defaultView","parentWindow","Input","inputTarget","domHandler","ev","init","evEl","evTarget","evWin","destroy","inArray","src","findByKey","POINTER_INPUT_MAP","pointerdown","pointermove","pointerup","pointercancel","pointerout","IE10_POINTER_TYPE_ENUM","2","3","4","5","POINTER_ELEMENT_EVENTS","POINTER_WINDOW_EVENTS","MSPointerEvent","PointerEvent","PointerEventInput","_Input","_this","proto","store","pointerEvents","removePointer","eventTypeNormalized","pointerType","isTouch","storeIndex","pointerId","button","toArray","uniqueArray","sort","results","values","TOUCH_INPUT_MAP","touchstart","touchmove","touchend","touchcancel","TouchInput","targetIds","touches","targetTouches","allTouches","identifier","changedTouches","changedTargetTouches","filter","touch","MOUSE_INPUT_MAP","mousedown","mousemove","mouseup","MouseInput","pressed","which","DEDUP_TIMEOUT","DEDUP_DISTANCE","setLastTouch","eventData","primaryTouch","lastTouch","lts","lastTouches","TouchMouseInput","_manager","inputEvent","inputData","isMouse","sourceCapabilities","firesTouchEvents","dx","dy","mouse","invokeArrayArg","fn","_uniqueId","getRecognizerByNameIfManager","otherRecognizer","get","stateStr","Recognizer","simultaneous","requireFail","recognizeWith","dropRecognizeWith","requireFailure","dropRequireFailure","hasRequireFailures","canRecognizeWith","event","additionalEvent","tryEmit","canEmit","inputDataClone","reset","AttrRecognizer","_Recognizer","attrTest","optionPointers","isRecognized","isValid","directionStr","PanRecognizer","_AttrRecognizer","threshold","pX","pY","directionTest","hasMoved","PinchRecognizer","inOut","defaults","domEvents","inputClass","cssProps","userSelect","touchSelect","touchCallout","contentZooming","userDrag","tapHighlightColor","toggleCssProps","add","oldCssProps","Manager","handlers","item","force","stopped","curRecognizer","existing","remove","targetRecognizer","events","gestureEvent","createEvent","initEvent","gesture","dispatchEvent","deprecate","method","message","deprecationMessage","stack","log","console","warn","extend","dest","merge","keys","extendStatics","d","setPrototypeOf","p","__extends","__","__assign","n","getInsidePosition","destPos","range","circular","bounce","toDestPos","targetRange","min","isOutside","pos","isCircularable","getCirculatedPos","toPos","nodes","el","$","param","multi","match","dummy","innerHTML","childNodes","querySelectorAll","nodeName","nodeType","jQuery","jquery","map","raf","requestAnimationFrame","webkitRequestAnimationFrame","caf","cancelAnimationFrame","webkitCancelAnimationFrame","keyInfo_1","oldraf_1","timestamp","performance","getTime","clearTimeout","tranformed","filtered","every","equal","base","roundNumFunc","roundNumber","num","roundUnit","pow","getDecimalPlace","roundNumbers","isNumber","isFinite","minMax","AnimationManager","itm","em","axm","animationEnd","bind","__proto","getDuration","depaPos","wishDuration","duration","durations_1","deceleration","reduce","minimumDuration","maximumDuration","createAnimationParam","option","delta","getDelta","isTrusted","done","grab","axes","_animateParam","orgPos_1","opt","triggerChange","_raf","triggerAnimationEnd","getEventInfo","restore","animateTo","beforeParam","circularTargets","setTo","setInterrupt","finish","triggerFinish","animateLoop","complete","info_1","self_1","destPos_1","prevPos_1","prevEasingPer_1","directions_1","originalIntendedPos_1","prevTime_1","startTime","loop","currentTime","ratio","easingPer","easing","nextPos","circulatedPos","rangeOffset","getFinalPos","originalIntendedPos","getRoundUnit","minRoundUnit","getAxisOptions","getUserControll","userWish","retTrigger","triggerAnimationStart","orgPos","movedPos","setBy","EventManager","triggerHold","roundPos","getRoundPos","triggerRelease","roundDepa","createUserControll","isAccurate","holding","am","eventInfo","moveTo","userControl","userDuration","setAnimationManager","InterruptManager","_prevented","isInterrupting","interruptable","isInterrupted","AxisManager","_complementOptions","_pos","acc","axisOption","fullDepaPos","axisOptions","InputObserver","moveDistance","isStopped","atOutside","tn","tx","initSlope_1","hold","changeOption","change","release","inputDuration","isEqual","IS_IOS_SAFARI","TRANSFORM","bodyStyle","head","getElementsByTagName","Axes","_super","startPos","_inputs","io","connect","inputType","mapped","disconnect","targets","hammer","mapAxes","isBounceArea","UNIQUEKEY","toAxis","createHammer","convertInputType","hasTouch","hasMouse","hasPointer","useDirection","checkType","userDirection","PanInput","panRecognizer","isRightEdge","rightEdgeTimer","panFlag","thresholdAngle","iOSEdgeSwipeThreshold","hammerManagerOptions","onHammerInput","onPanmove","onPanend","useHorizontal","useVertical","_direction","hammerOption","removeRecognizer","dettachEvent","keyValue","String","Pan","attachEvent","disable","isEnable","cancelable","edgeThreshold","innerWidth","toAngle","getDirectionByAngle","offsetX","offsetY","getOffset","prevent","stopPropagation","preventSystemEvent","speeds","normalSpeed","properties","PinchInput","_base","_prev","pinchRecognizer","onPinchStart","onPinchMove","onPinchEnd","Pinch","pinchScale","prev","WheelInput","_isEnabled","_isHolded","_timer","useNormalized","onWheel","MoveKeyInput","onKeydown","onKeyup","getAttribute","setAttribute","isMoveKey","move","keyCode","offsets","toDegree","util","extractPitchFromQuat","quaternion","baseV","vec3","ROTATE_CONSTANT","PITCH_DELTA","YAW_DELTA_BY_ROLL","YAW_DELTA_BY_YAW","angleBetweenVec2","v1","v2","targetAxis","meshPoint","yawOffsetBetween","viewDir","targetDir","viewDirXZ","vec2","targetDirXZ","getRotationDelta","prevQ","curQ","rotateKind","prevQuaternion","quat","curQuaternion","prevPoint","curPoint","meshPoint3","rotateDirection","meshPoint2","vecU","vecV","vecN","coefficientA","coefficientB","coefficientC","projectedPrevPoint","trigonometricRatio","theta","crossVec","r","MathUtil","degToRad","radToDeg","Vector2","subVectors","Vector3","scalar","invScalar","multiplyScalar","applyQuaternion","ix","iy","iz","iw","crossVectors","Quaternion","setFromEulerXYZ","c1","c2","c3","s1","s2","s3","setFromEulerYXZ","setFromAxisAngle","halfAngle","multiply","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","inverse","l","qb","cosHalfTheta","halfTheta","sinHalfTheta","ratioA","ratioB","setFromUnitVectors","vFrom","vTo","isIOS","isWebViewAndroid","isSafari","isFirefoxAndroid","isR7","piOver180","rad45","defaultOrientation","defaultPosition","Util","updateEyeMatrices","projection","view","pose","parameters","vrDisplay","fov","upTan","downTan","leftTan","rightTan","xScale","yScale","fieldOfView","depthNear","depthFar","upDegrees","downDegrees","leftDegrees","rightDegrees","x2","y2","z2","xx","xy","xz","yy","yz","zz","wx","wy","wz","a30","a31","a32","a33","b00","b02","b03","b04","b05","b06","b07","b08","b09","b10","orientation","position","MIN_TIMESTEP","MAX_TIMESTEP","base64","mimeType","clamp","lerp","promises","isLandscapeMode","rtn","isTimestampDeltaValid","timestampDeltaS","isNaN","getScreenWidth","screen","width","height","getScreenHeight","requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen","exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen","getFullscreenElement","fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement","linkProgram","gl","vertexSource","fragmentSource","attribLocationMap","vertexShader","createShader","VERTEX_SHADER","shaderSource","compileShader","fragmentShader","FRAGMENT_SHADER","program","createProgram","attribName","attachShader","bindAttribLocation","deleteShader","getProgramUniforms","uniforms","uniformCount","getProgramParameter","ACTIVE_UNIFORMS","uniformName","getActiveUniform","getUniformLocation","orthoMatrix","left","right","bottom","top","lr","bt","copyArray","check","vendor","opera","substr","safariCssSizeWorkaround","canvas","isDebug","getQueryParameter","location","search","decodeURIComponent","frameDataFromPose","frameData","leftProjectionMatrix","leftViewMatrix","getEyeParameters","rightProjectionMatrix","rightViewMatrix","isInsideCrossDomainIFrame","isFramed","refDomain","getDomainFromUrl","referrer","thisDomain","href","url","PosePredictor","predictionTimeS","previousQ","previousTimestampS","deltaQ","outQ","getPrediction","currentQ","gyro","timestampS","angularSpeed","toFixed","predictAngle","branch","build","CHROME_VERSION","IS_CHROME_WITHOUT_DEVICE_MOTION","IS_ANDROID","MC_BIND_SCALE","GYRO_MODE","NONE","YAWPITCH","VR","DeviceMotion","_onDeviceMotion","_onDeviceOrientation","_onChromeWithoutDeviceMotion","isWithoutDeviceMotion","isAndroid","stillGyroVec","rawGyroVec","adjustedGyroVec","lastDevicemotionTimestamp","alpha","beta","gamma","deviceorientation","_this2","isGyroSensorAvailable","rotationRate","isGravitySensorAvailable","accelerationIncludingGravity","interval","devicemotionEvent","acceleration","adjustedRotationRate","SensorSample","sample","sensorSample","ComplementaryFilter","kFilter","currentAccelMeasurement","currentGyroMeasurement","previousGyroMeasurement","filterQ","previousFilterQ","accelQ","isOrientationInitialized","estimatedGravity","measuredGravity","gyroIntegralQ","addAccelMeasurement","vector","addGyroMeasurement","deltaT","run_","accelToQuaternion_","gyroDeltaQ","gyroToQuaternionDelta_","invFilterQ","getQuaternionAngle","targetQ","getOrientation","accel","normAccel","dt","isFilterQuaternionInitialized","FusionPoseSensor","deviceMotion","accelerometer","gyroscope","_onDeviceMotionChange","_onScreenOrientationChange","posePredictor","filterToWorldQ","isChromeUsingDegrees","inverseWorldToScreenQ","worldToScreenQ","originalPoseAdjustQ","_setScreenTransform","resetQ","isEnabled","_triggerChange","_prevOrientation","_deviceOrientationQ","deviceOrientationFixQ","_alpha","out_","_convertFusionToPredicted","predictedQ","accGravity","rotRate","TiltMotionInput","_prevQuaternion","_quaternion","fusionPoseSensor","_onPoseChange","_attachEvent","_dettachEvent","prvQ","yawDeltaByYaw","screenRotationAngleInst","refCount","ScreenRotationAngle","_onOrientationChange","_spinR","_screenOrientationAngle","betaR","glMatrix","gammaR","getRadian","unref","RotationPanInput","_useRotation","_screenRotationAngle","setUseRotation","useRotation","_userDirection","newOffset","cosTheta","sinTheta","Y_AXIS_VECTOR","DeviceQuaternion","_fusionPoseSensor","getCombinedQuaternion","yaw","yawQ","conj","DEFAULT_YAW_RANGE","DEFAULT_PITCH_RANGE","CIRCULAR_PITCH_RANGE","YawPitchControl","pitch","showPolePoint","useZoom","useKeyboard","gyroMode","touchDirection","TOUCH_DIRECTION_YAW","yawRange","pitchRange","fovRange","aspectRatio","_element","_initialFov","_enabled","_isAnimating","_deviceQuaternion","_initAxes","yRange","_updateYawRange","pRange","_updatePitchRange","axesPanInput","axesWheelInput","axesTiltMotionInput","axesPinchInput","axesMoveKeyInput","isCircular","evt","_updateControlScale","updatePanScale","animationStart","areaHeight","argLen","_getOptions","beforeOptions","newOptions","changedKeyList","_setOptions","_getValidatedOptions","_applyOptions","_getValidYawRange","_getValidPitchRange","isVR","isYawPitch","prevFov","nextFov","_initDeviceQuaternion","_togglePinchInputByOption","_enableTouch","yawEnabled","pitchEnabled","_this3","newYawRange","newFov","newAspectRatio","adjustAspectRatio","horizontalFov","newPitchRange","changeEvt","verticalAngle","halfFov","halfHorizontalFov","mathUtil","targetElement","inputRange","outputRange","rangeIdx","inputA","fraction","persistOrientation","_resetOrientation","lookAt","getYawPitch","yawPitch","getFov","getQuaternion","shouldRenderWithQuaternion","axisPanInput","axesDeviceOrientationInput","CONTROL_MODE_VR","CONTROL_MODE_YAWPITCH","TOUCH_DIRECTION_ALL","TOUCH_DIRECTION_PITCH","TOUCH_DIRECTION_NONE","STATUS","EVENT","ImageLoader","image","_image","_onceHandlers","_loadStatus","res","rej","LOADED","getElement","LOADING","isMaybeLoaded","onceLoaded","ERROR","img","_img","Image","crossOrigin","naturalWidth","onload","onerror","loadPromises","_this4","_once","getStatus","READY_STATUS","READYSTATECHANGE_EVENT_NAME","latIdx","lngIdx","VideoLoader","video","_handlers","_sourceCount","_thresholdReadyState","_thresholdEventName","readyState","_errorCount","_detachErrorHandler","_appendSourceElement","videoUrl","videoSrc","videoType","sourceElement","_video","appendChild","_reset","HTMLVideoElement","load","_attachErrorHandler","_sources","rejector","WEBGL_ERROR_CODE","webglAvailability","WebGLUtils","shader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","detachShader","LINK_STATUS","deleteProgram","initBuffer","itemSize","attr","buffer","createBuffer","bindBuffer","bufferData","STATIC_DRAW","numItems","enableVertexAttribArray","vertexAttribPointer","FLOAT","getWebglContext","userContextAttributes","webglIdentifiers","contextAttributes","preserveDrawingBuffer","antialias","xrCompatible","onWebglcontextcreationerror","statusMessage","getContext","createTexture","textureTarget","texture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","isWebGLAvailable","webglContext","loseContextExtension","getExtension","loseContext","isStableWebGL","agentInfo","isStableWebgl","parseFloat","getErrorNameFromWebGLErrorCode","code","texImage2D","pixels","RGBA","UNSIGNED_BYTE","getMaxTextureSize","getParameter","MAX_TEXTURE_SIZE","Agent","isIE11","EVENTS","Renderer","_forceDimension","_pixelCanvas","_pixelContext","render","shaderProgram","indexBuffer","mvMatrix","pMatrix","uniformMatrix4fv","pMatrixUniform","mvMatrixUniform","drawElements","TRIANGLES","UNSIGNED_SHORT","getDimension","pixelSource","videoWidth","naturalHeight","videoHeight","updateShaderData","_initPixelSource","forceDimension","_getPixelSource","contentDimension","textureDimension","drawImage","_extractTileConfig","imageConfig","tileConfig","config","flipHorizontal","_triggerError","CubeRenderer","getVertexPositionData","_VERTEX_POSITION_DATA","getIndexData","_INDEX_DATA","indexData","vertexPositionData","extractOrder","order","getTextureCoordData","face","ordermap_","shift","unshift","pop","tileVertex","elemSize","tileTemp","j","getVertexShaderSource","getFragmentShaderSource","updateTexture","orderMap","surfaceIdx","tileIdx","TEXTURE_CUBE_MAP_POSITIVE_X","maxCubeMapTextureSize","getMaxCubeMapTextureSize","tile","extractTileFromImage","TEXTURE_CUBE_MAP","getSourceTileSize","outputTextureSize","inputTextureSize","tilePerRow","MAX_CUBE_MAP_TEXTURE_SIZE","_imageWidth","isPowerOfTwo","CubeStripRenderer","_vertices","coords","rows","coord","tileConfigs","_shrinkCoord","_transformCoord","TEXTURE_2D","size","maxSize","activeTexture","TEXTURE0","pixelStorei","UNPACK_FLIP_Y_WEBGL","newCoord","_flipHorizontalCoord","_rotateCoord","rotationAngle","moved","shiftCount","ERROR_TYPE","INVALID_DEVICE","NO_WEBGL","FAIL_IMAGE_LOAD","FAIL_BIND_TEXTURE","INVALID_RESOURCE","RENDERING_CONTEXT_LOST","READY","VIEW_CHANGE","ANIMATION_END","PROJECTION_TYPE","EQUIRECTANGULAR","CUBEMAP","CUBESTRIP","PANORAMA","STEREOSCOPIC_EQUI","STEREO_FORMAT","TOP_BOTTOM","LEFT_RIGHT","ANGLE_CORRECTION_FOR_CENTER_ALIGN","textureCoordData","phi","sinPhi","u","SphereRenderer","format","_stereoFormat","ctx","leftEyeScaleOffset","rightEyeScaleOffset","uTexScaleOffset","uniform4fv","_TEXTURE_COORD_DATA","CylinderRenderer","resizeDimension","cylinderMaxRadian","halfCylinderY","rotated","imageAspectRatio","CYLIDER_Y","startAngleForCenterAlign","yIdx","yLength","VR_DISPLAY_PRESENT_CHANGE","DEFAULT_LEFT_BOUNDS","DEFAULT_RIGHT_BOUNDS","EYES","VRManager","_vrDisplay","removeEndCallback","isPresenting","exitPresent","_clear","_frameData","VRFrameData","canRender","Boolean","beforeRender","bindFramebuffer","FRAMEBUFFER","afterRender","submitFrame","getEyeParams","display","halfWidth","drawingBufferWidth","drawingBufferHeight","getFrameData","leftMVMatrix","rightMVMatrix","mat4","_yawOffset","viewport","addEndCallback","requestPresent","getVRDisplays","displays","capabilities","canPresent","leftEye","rightEye","renderWidth","renderHeight","_setDisplay","setYawOffset","layers","getLayers","layer","_leftBounds","leftBounds","_rightBounds","rightBounds","XRManager","xrSession","_xrSession","frame","getViewerPose","_xrRefSpace","baseLayer","renderState","framebuffer","glLayer","views","getViewport","transform","matrix","projectionMatrix","_presenting","xr","requestSession","requiredFeatures","xrLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","refSpace","_setSession","_xrLayer","WebGLAnimator","_onLoop","_callback","_rafId","_context","_onLoopNextTick","before","diff","_rafTimer","setCallback","setContext","ImageType","DEVICE_PIXEL_RATIO","BIND_TEXTURE","IMAGE_LOADED","RENDERING_CONTEXT_RESTORE","RENDERER_ERROR","PanoImageRenderer","isVideo","sphericalConfig","renderingContextAttributes","_renderStereo","time","vr","_vr","eyeParams","eyeIndex","eyeParam","uniform1f","uEye","_bindBuffers","_draw","exitVR","animator","_animator","_restoreStyle","updateViewportDimensions","_updateViewport","_shouldForceDraw","_render","_onFirstVRFrame","minusZDir","mat3","mvInv","pInv","yawOffset","_lastQuaternion","_lastYaw","_lastPitch","_lastFieldOfView","textureCoordBuffer","vertexBuffer","_initCanvas","_setDefaultCanvasStyle","_wrapper","_wrapperOrigStyle","_renderingContextAttributes","_imageConfig","_imageIsReady","_keepUpdate","_onContentLoad","_onContentError","setImage","imageType","cubemapConfig","setYawPitchControl","yawPitchControl","_yawPitchControl","getContent","_isVideo","_setImageType","_contentLoader","_imageType","_isCubeMap","_renderer","stereoFormat","_initWebGL","_onWebglcontextlost","_onWebglcontextrestored","margin","maxHeight","maxWidth","outline","_triggerContentLoad","content","projectionType","isImageLoaded","_bindTexture","attachTo","parentElement","detach","forceContextLoss","hasRenderingContext","removeChild","isContextLost","_initShaderProgram","renderer","vsSource","fsSource","getError","useProgram","vertexPositionAttribute","getAttribLocation","samplerUniform","textureCoordAttribute","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","uniform1i","updateFieldOfView","viewPortChanged","h","_initRenderingContext","clearColor","deleteTexture","CULL_FACE","WebGLRenderingContext","_initBuffers","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","Uint16Array","isEAC","_updateTexture","keepUpdate","doUpdate","startRender","stopRender","renderWithQuaternion","yx","zx","zy","renderWithYawPitch","getProjectionRenderer","enterVR","_Promise","_requestPresent","_setWrapperFullscreen","wrapper","wrapperStyle","zIndex","removeAttribute","PanoViewer","container","isSessionSupported","supportsSession","_container","_projectionType","_cubemapConfig","_width","_height","_yaw","_pitch","_fov","_gyroMode","_aspectRatio","_isValidTouchDirection","yawPitchConfig","_isReady","_initYawPitchControl","_initRenderer","getVideo","_photoSphereRenderer","setVideo","getImage","_deactivate","getProjectionType","enableSensor","requestPermission","permissionState","disableSensor","initialYaw","initialPitch","_bindRendererHandler","_activate","_triggerEvent","_updateYawPitchIfNeeded","ProjectionType","yawSize","maxFov","atan","minFov","_this5","setUseZoom","setUseKeyboard","setGyroMode","setFovRange","getFovRange","containerSize","_getHFov","getYaw","getPitch","getYawRange","getPitchRange","setYawRange","setPitchRange","setShowPolePoint","verticalAngleOfImage","TOUCH_DIRECTION","YAW","PITCH","ALL","setTouchDirection","getTouchDirection","isSupported","onDeviceMotionChange","fb"],"mappings":";;;;;;;;;0mCASgEA,qBAKhE,SAASC,EAAiBC,GACxB,IAAIC,SAAcD,EAClB,OAAOA,IAAM,OAASC,IAAS,UAAYA,IAAS,YAGtD,SAASC,EAAWF,GAClB,cAAcA,IAAM,WAKtB,IAAIG,OAAgB,EACpB,GAAIC,MAAMC,QAAS,CACjBF,EAAWC,MAAMC,YACZ,CACLF,EAAW,SAAUH,GACnB,OAAOM,OAAOC,UAAUC,SAASC,KAAKT,KAAO,kBAIjD,IAAIK,EAAUF,EAEVO,EAAM,EACNC,OAAiB,EACjBC,OAAyB,EAEzBC,EAAO,SAASA,EAAKC,EAAUC,GACjCC,EAAMN,GAAOI,EACbE,EAAMN,EAAM,GAAKK,EACjBL,GAAO,EACP,GAAIA,IAAQ,EAAG,CAIb,GAAIE,EAAmB,CACrBA,EAAkBK,OACb,CACLC,OAKN,SAASC,EAAaC,GACpBR,EAAoBQ,EAGtB,SAASC,EAAQC,GACfT,EAAOS,EAGT,IAAIC,SAAuBC,SAAW,YAAcA,OAASC,UACzDC,EAAgBH,GAAiB,GACjCI,EAA0BD,EAAcE,kBAAoBF,EAAcG,uBAC1EC,SAAgBC,OAAS,oBAAsBC,UAAY,aAAe,GAAGxB,SAASC,KAAKuB,WAAa,mBAGxGC,SAAkBC,oBAAsB,oBAAsBC,gBAAkB,oBAA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jW,OAASA,GAbXiW,EAcE1P,gBAAkBA,GAdpB0P,EAeEnqB,UAAYA,GAfdmqB,EAiBEmC,eAAiB7R,GAjBnB0P,EAkBEpP,cAAgBA,GAlBlBoP,EA0BEwD,gBAAkB,CAUxB1tB,KAAMyH,GAAgBoF,qBAUtB8gB,IAAKlmB,GAAgBO,oBAUrB4lB,MAAOnmB,GAAgBmF,sBAUvBihB,IAAKpmB,GAAgBkF,qBAlEjBud"} \ No newline at end of file diff --git a/dist/SpinViewer/view360.spinviewer.js b/dist/SpinViewer/view360.spinviewer.js new file mode 100644 index 000000000..dadcbcac9 --- /dev/null +++ b/dist/SpinViewer/view360.spinviewer.js @@ -0,0 +1,754 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@egjs/axes'), require('@egjs/component'), require('@egjs/agent')) : + typeof define === 'function' && define.amd ? define(['exports', '@egjs/axes', '@egjs/component', '@egjs/agent'], factory) : + (factory((global.eg = global.eg || {}, global.eg.view360 = {}),global.eg.Axes,global.eg.Component,global.eg.Agent)); +}(this, (function (exports,Axes,Component,getAgent) { 'use strict'; + + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + /* eslint-disable no-new-func, no-nested-ternary */ + + var win = typeof window !== "undefined" && window.Math === Math ? window : typeof self !== "undefined" && self.Math === Math ? self : Function("return this")(); + /* eslint-enable no-new-func, no-nested-ternary */ + + var doc = win.document; + var agent = getAgent(); + var osName = agent.os.name; + var browserName = agent.browser.name; + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + win.Float32Array = typeof win.Float32Array !== "undefined" ? win.Float32Array : win.Array; + var Float32Array = win.Float32Array; + var getComputedStyle = win.getComputedStyle; + var userAgent = win.navigator.userAgent; + var DeviceMotionEvent = win.DeviceMotionEvent; + var devicePixelRatio = win.devicePixelRatio; + + var TRANSFORM = function () { + var docStyle = doc.documentElement.style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in docStyle) { + return target[i]; + } + } + + return ""; + }(); // check for will-change support + + + var SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports && win.CSS.supports("will-change", "transform"); + + var VERSION = "3.3.3"; + + /** + * @class eg.view360.SpriteImage + * @classdesc A module that displays a single or continuous image of any one of the "sprite images". SpinViewer internally uses SpriteImage to show each frame of the sprite image. + * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the "Sprite image". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
+ * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpriteImage + * + * var el = document.getElementById("image-div"); + * var sprites = new eg.view360.SpriteImage(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 + * }); + */ + + var SpriteImage = + /*#__PURE__*/ + function () { + var SpriteImage = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpriteImage, _Component); + + function SpriteImage(element, options) { + var _this; + + _this = _Component.call(this) || this; + var opt = options || {}; + _this._el = element; + _this._rowCount = opt.rowCount || 1; + _this._colCount = opt.colCount || 1; + _this._totalCount = _this._rowCount * _this._colCount; // total frames + + _this._width = opt.width || "auto"; + _this._height = opt.height || "auto"; + _this._autoHeight = opt.autoHeight != null ? opt.autoHeight : "true"; // If autoHeight is specified, _height will be overwritten. + + _this._colRow = [0, 0]; + + if (opt.colRow) { + _this._colRow = opt.colRow; + } else if (opt.frameIndex) { + _this.setFrameIndex(opt.frameIndex); + } + + _this._el.style.width = SpriteImage._getSizeString(_this._width); + _this._el.style.height = SpriteImage._getSizeString(_this._height); + + if (!opt.imageUrl) { + setTimeout(function () { + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }, 0); + return _assertThisInitialized(_this); + } + + _this._image = new Image(); + /** + * Event + */ + + _this._image.onload = function () { + _this._bg = SpriteImage._createBgDiv(_this._image, _this._rowCount, _this._colCount, _this._autoHeight); + + _this._el.appendChild(_this._bg); + + _this.setColRow(_this._colRow[0], _this._colRow[1]); + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpriteImage#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * sprites.on({ + * "load" : function(evt) { + * console.log("load event fired - e.target", e.target, "e.bgElement", e.bgElement); + * } + * }); + */ + + + _this.trigger("load", { + target: _this._el, + bgElement: _this._bg + }); + + if (_this._autoPlayReservedInfo) { + _this.play(_this._autoPlayReservedInfo); + + _this._autoPlayReservedInfo = null; + } + }; + + _this._image.onerror = function (e) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpriteImage#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * sprites.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }; + + _this._image.src = opt.imageUrl; + return _this; + } + + SpriteImage._createBgDiv = function _createBgDiv(img, rowCount, colCount, autoHeight) { + var el = document.createElement("div"); + el.style.position = "relative"; + el.style.overflow = "hidden"; + img.style.position = "absolute"; + img.style.width = colCount * 100 + "%"; + img.style.height = rowCount * 100 + "%"; + /** Prevent image from being dragged on IE10, IE11, Safari especially */ + + img.ondragstart = function () { + return false; + }; // img.style.pointerEvents = "none"; + // Use hardware accelerator if available + + + SUPPORT_WILLCHANGE && (img.style.willChange = "transform"); + el.appendChild(img); + var unitWidth = img.width / colCount; + var unitHeight = img.height / rowCount; + + if (autoHeight) { + var r = unitHeight / unitWidth; + el.style.paddingBottom = r * 100 + "%"; + } else { + el.style.height = "100%"; + } + + return el; + } + /** + * Specifies the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정 + * @method eg.view360.SpriteImage#setFrameIndex + * @param {Number} frameIndex frame index of a frame프레임의 인덱스 + * + * @example + * + * sprites.setFrameIndex(0, 1);// col = 0, row = 1 + */ + ; + + var _proto = SpriteImage.prototype; + + _proto.setFrameIndex = function setFrameIndex(index) { + var colRow = this.toColRow(index); + this.setColRow(colRow[0], colRow[1]); + } + /** + * Returns the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환 + * @method eg.view360.SpriteImage#getFrameIndex + * @return {Number} frame index frame 인덱스 + * + * @example + * + * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1 + * + */ + ; + + _proto.getFrameIndex = function getFrameIndex() { + return this._colRow[1] * this._colCount + this._colRow[0]; + } + /** + * Specifies the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정 + * @method eg.view360.SpriteImage#setColRow + * @param {Number} col Column number of a frame프레임의 행값 + * @param {Number} row Row number of a frame프레임의 열값 + * + * @example + * + * sprites.setlColRow(1, 2); // col = 1, row = 2 + */ + ; + + _proto.setColRow = function setColRow(col, row) { + if (row > this._rowCount - 1 || col > this._colCount - 1) { + return; + } + + if (this._image && TRANSFORM) { + // NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser? + this._image.style[TRANSFORM] = "translate(" + -(col / this._colCount * 100) + "%, " + -(row / this._rowCount * 100) + "%)"; + } + + this._colRow = [col, row]; + } + /** + * Returns the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환 + * @method eg.view360.SpriteImage#gelColRow + * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열 + * + * @example + * + * var colRow = sprites.getlColRow(); + * // colRow = [1, 2] - index of col is 1, index of row is 2 + * + */ + ; + + _proto.getColRow = function getColRow() { + return this._colRow; + }; + + SpriteImage._getSizeString = function _getSizeString(size) { + if (typeof size === "number") { + return size + "px"; + } + + return size; + } + /** + * Stop playing + * @ko play 되고 있던 프레임 재생을 중지합니다. + * @method eg.view360.SpriteImage#stop + * + * @example + * + * viewer.stop(); + * + */ + ; + + _proto.stop = function stop() { + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + } + /** + * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'. + * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다. + * @method eg.view360.SpriteImage#play + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위 + * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복 + * + * @example + * + * viewer.play({angle: 16, playCount: 1}); + * + */ + ; + + _proto.play = function play(_temp) { + var _this2 = this; + + var _ref = _temp === void 0 ? { + interval: 1000 / this._totalCount, + playCount: 0 + } : _temp, + interval = _ref.interval, + playCount = _ref.playCount; + + if (!this._bg) { + this._autoPlayReservedInfo = { + interval: interval, + playCount: playCount + }; + return; + } + + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + + var frameIndex = this.getFrameIndex(); + var count = 0; + var frameCount = 0; // for checking 1 cycle + + this._autoPlayTimer = setInterval(function () { + frameIndex %= _this2._totalCount; + + var colRow = _this2.toColRow(frameIndex); + + _this2.setColRow(colRow[0], colRow[1]); + + frameIndex++; // Done 1 Cycle? + + if (++frameCount === _this2._totalCount) { + frameCount = 0; + count++; + } + + if (playCount > 0 && count === playCount) { + clearInterval(_this2._autoPlayTimer); + } + }, interval); + }; + + _proto.toColRow = function toColRow(frameIndex) { + var colCount = this._colCount; + var rowCount = this._rowCount; + + if (frameIndex < 0) { + return [0, 0]; + } else if (frameIndex >= this._totalCount) { + return [colCount - 1, rowCount - 1]; + } + + var col = frameIndex % colCount; + var row = Math.floor(frameIndex / colCount); // console.log(frameIndex, col, row); + + return [col, row]; + }; + + return SpriteImage; + }(Component); + + SpriteImage.VERSION = VERSION; + return SpriteImage; + }(); + + var DEFAULT_PAN_SCALE = 0.21; + /** + * @class eg.view360.SpinViewer + * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object. + * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpinViewer + * var el = document.getElementById("product-360"); + * var viewer = new eg.view360.SpinViewer(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 //required + * }); + */ + + var SpinViewer = + /*#__PURE__*/ + function () { + var SpinViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpinViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.SpinViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.SpinViewer + */ + function SpinViewer(element, options) { + var _this; + + _this = _Component.call(this) || this; + _this._el = element; + + var opt = _extends({}, options); + + var colCount = opt.colCount || 1; + var rowCount = opt.rowCount || 1; + _this._scale = opt.scale || 1; + _this._panScale = _this._scale * DEFAULT_PAN_SCALE; + _this._frameCount = colCount * rowCount; // Init SpriteImage + + _this._sprites = new SpriteImage(element, opt).on({ + "load": function load(evt) { + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpinViewer#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * viwer.on({ + * "load" : function(evt) { + * this.spinBy(360, {duration: 300}); + * } + * }); + */ + _this.trigger("load", evt); + }, + "imageError": function imageError(evt) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * viewer.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: evt.imageUrl + }); + } + }); // Init Axes + + _this._panInput = new Axes.PanInput(_this._el, { + scale: [_this._panScale, _this._panScale] + }); + _this._axes = new Axes({ + angle: { + range: [0, 359], + circular: true + } + }).on({ + "change": function change(evt) { + var curr = Math.floor(evt.pos.angle / (360 / _this._frameCount)); + var frameIndex = _this._frameCount - curr - 1; + + _this._sprites.setFrameIndex(frameIndex); + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#change + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row + * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값 + * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님) + * + * @example + * + * viwer.on({ + * "change" : function(evt) { + * console.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30 + * } + * }); + */ + + + _this.trigger("change", { + frameIndex: frameIndex, + colRow: _this._sprites.getColRow(), + angle: evt.pos.angle + }); + }, + "animationEnd": function animationEnd(evt) { + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생하는 이벤트 + * @name eg.view360.SpinViewer#animationEnd + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Boolean} param.isTrusted 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 + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // evt.isTrusted === true or false + * } + * }); + */ + _this.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + + _this._axes.connect("angle", _this._panInput); + + return _this; + } + /** + * Set spin scale + * @ko scale 을 조정할 수 있는 함수 + * @method eg.view360.SpinViewer#setScale + * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.setScale(2);// It moves twice as much. + */ + + + var _proto = SpinViewer.prototype; + + _proto.setScale = function setScale(scale) { + if (isNaN(scale) || scale < 0) { + return this; + } + + this._scale = scale; + this._panScale = scale * DEFAULT_PAN_SCALE; + this._panInput.options.scale = [this._panScale, this._panScale]; + return this; + } + /** + * Get spin scale + * @ko scale 값을 반환한다. + * @method eg.view360.SpinViewer#getScale + * + * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @example + * + * viewer.getScale();// It returns number + */ + ; + + _proto.getScale = function getScale() { + return this._scale; + } + /** + * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle. + * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinBy + * + * @param {Number} [angle = 0] angle상대적 회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinBy(720, {duration: 500}); + */ + ; + + _proto.spinBy = function spinBy(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setBy({ + angle: angle + }, param.duration); + + return this; + } + /** + * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle). + * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinTo + * + * @param {Number} [angle = 0] angle회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinTo(30, {duration:100}); + */ + ; + + _proto.spinTo = function spinTo(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setTo({ + angle: angle + }, param.duration); + + return this; + } + /** + * Returns current angles + * @ko 현재 각도를 반환한다. + * + * @return {Number} Current angle 현재 각도 + */ + ; + + _proto.getAngle = function getAngle() { + return this._axes.get().angle || 0; + }; + + return SpinViewer; + }(Component); + + SpinViewer.VERSION = VERSION; + return SpinViewer; + }(); + + exports.SpinViewer = SpinViewer; + exports.SpriteImage = SpriteImage; + exports.VERSION = VERSION; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=view360.spinviewer.js.map diff --git a/dist/SpinViewer/view360.spinviewer.js.map b/dist/SpinViewer/view360.spinviewer.js.map new file mode 100644 index 000000000..52594d9e1 --- /dev/null +++ b/dist/SpinViewer/view360.spinviewer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.spinviewer.js","sources":["../../src/utils/browser.js","../../src/utils/browserFeature.js","../../src/version.js","../../src/SpinViewer/SpriteImage.js","../../src/SpinViewer/SpinViewer.js"],"sourcesContent":["/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport {TRANSFORM, SUPPORT_WILLCHANGE} from \"../utils/browserFeature\";\nimport {VERSION} from \"../version\";\n/**\n * @class eg.view360.SpriteImage\n * @classdesc A module that displays a single or continuous image of any one of the \"sprite images\". SpinViewer internally uses SpriteImage to show each frame of the sprite image.\n * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the \"Sprite image\". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n *\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpriteImage\n *\n * var el = document.getElementById(\"image-div\");\n * var sprites = new eg.view360.SpriteImage(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24\n * });\n */\nclass SpriteImage extends Component {\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\t\tconst opt = options || {};\n\n\t\tthis._el = element;\n\t\tthis._rowCount = opt.rowCount || 1;\n\t\tthis._colCount = opt.colCount || 1;\n\t\tthis._totalCount = this._rowCount * this._colCount;// total frames\n\t\tthis._width = opt.width || \"auto\";\n\t\tthis._height = opt.height || \"auto\";\n\t\tthis._autoHeight = opt.autoHeight != null ? opt.autoHeight : \"true\"; // If autoHeight is specified, _height will be overwritten.\n\t\tthis._colRow = [0, 0];\n\n\t\tif (opt.colRow) {\n\t\t\tthis._colRow = opt.colRow;\n\t\t} else if (opt.frameIndex) {\n\t\t\tthis.setFrameIndex(opt.frameIndex);\n\t\t}\n\n\t\tthis._el.style.width = SpriteImage._getSizeString(this._width);\n\t\tthis._el.style.height = SpriteImage._getSizeString(this._height);\n\n\t\tif (!opt.imageUrl) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: opt.imageUrl\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._image = new Image();\n\t\t/**\n\t\t * Event\n\t\t */\n\t\tthis._image.onload = () => {\n\t\t\tthis._bg = SpriteImage._createBgDiv(\n\t\t\t\tthis._image, this._rowCount, this._colCount, this._autoHeight);\n\t\t\tthis._el.appendChild(this._bg);\n\t\t\tthis.setColRow(this._colRow[0], this._colRow[1]);\n\n\t\t\t/**\n\t\t\t * Events that occur when component loading is complete\n\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#load\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"load\" : function(evt) {\n\t\t\t *\t\tconsole.log(\"load event fired - e.target\", e.target, \"e.bgElement\", e.bgElement);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"load\", {\n\t\t\t\ttarget: this._el,\n\t\t\t\tbgElement: this._bg\n\t\t\t});\n\n\t\t\tif (this._autoPlayReservedInfo) {\n\t\t\t\tthis.play(this._autoPlayReservedInfo);\n\t\t\t\tthis._autoPlayReservedInfo = null;\n\t\t\t}\n\t\t};\n\n\t\tthis._image.onerror = e => {\n\t\t\t/**\n\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#imageError\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t *\t\t// Error handling\n\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\timageUrl: opt.imageUrl\n\t\t\t});\n\t\t};\n\n\t\tthis._image.src = opt.imageUrl;\n\t}\n\n\tstatic _createBgDiv(img, rowCount, colCount, autoHeight) {\n\t\tconst el = document.createElement(\"div\");\n\n\t\tel.style.position = \"relative\";\n\t\tel.style.overflow = \"hidden\";\n\n\t\timg.style.position = \"absolute\";\n\t\timg.style.width = `${colCount * 100}%`;\n\t\timg.style.height = `${rowCount * 100}%`;\n\t\t/** Prevent image from being dragged on IE10, IE11, Safari especially */\n\t\timg.ondragstart = () => (false); // img.style.pointerEvents = \"none\";\n\t\t// Use hardware accelerator if available\n\t\tSUPPORT_WILLCHANGE && (img.style.willChange = \"transform\");\n\n\t\tel.appendChild(img);\n\n\t\tconst unitWidth = img.width / colCount;\n\t\tconst unitHeight = img.height / rowCount;\n\n\t\tif (autoHeight) {\n\t\t\tconst r = unitHeight / unitWidth;\n\n\t\t\tel.style.paddingBottom = `${r * 100}%`;\n\t\t} else {\n\t\t\tel.style.height = \"100%\";\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/**\n\t * Specifies the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정\n\t * @method eg.view360.SpriteImage#setFrameIndex\n\t * @param {Number} frameIndex frame index of a frame프레임의 인덱스\n\t *\n\t * @example\n\t *\n\t * sprites.setFrameIndex(0, 1);// col = 0, row = 1\n\t */\n\tsetFrameIndex(index) {\n\t\tconst colRow = this.toColRow(index);\n\n\t\tthis.setColRow(colRow[0], colRow[1]);\n\t}\n\n\t/**\n\t * Returns the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환\n\t * @method eg.view360.SpriteImage#getFrameIndex\n\t * @return {Number} frame index frame 인덱스\n\t *\n\t * @example\n\t *\n\t * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1\n\t *\n\t */\n\tgetFrameIndex() {\n\t\treturn this._colRow[1] * this._colCount + this._colRow[0];\n\t}\n\n\t/**\n\t * Specifies the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정\n\t * @method eg.view360.SpriteImage#setColRow\n\t * @param {Number} col Column number of a frame프레임의 행값\n\t * @param {Number} row Row number of a frame프레임의 열값\n\t *\n\t * @example\n\t *\n\t * sprites.setlColRow(1, 2); // col = 1, row = 2\n\t */\n\tsetColRow(col, row) {\n\t\tif (row > this._rowCount - 1 || col > this._colCount - 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._image && TRANSFORM) {\n\t\t\t// NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser?\n\t\t\tthis._image.style[TRANSFORM] = `translate(${-(col / this._colCount * 100)}%, ${-(row / this._rowCount * 100)}%)`;\n\t\t}\n\n\t\tthis._colRow = [col, row];\n\t}\n\n\t/**\n\t * Returns the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환\n\t * @method eg.view360.SpriteImage#gelColRow\n\t * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열\n\t *\n\t * @example\n\t *\n\t * var colRow = sprites.getlColRow();\n\t * // colRow = [1, 2] - index of col is 1, index of row is 2\n\t *\n\t */\n\tgetColRow() {\n\t\treturn this._colRow;\n\t}\n\n\tstatic _getSizeString(size) {\n\t\tif (typeof size === \"number\") {\n\t\t\treturn `${size}px`;\n\t\t}\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Stop playing\n\t * @ko play 되고 있던 프레임 재생을 중지합니다.\n\t * @method eg.view360.SpriteImage#stop\n\t *\n\t * @example\n\t *\n\t * viewer.stop();\n\t *\n\t */\n\tstop() {\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\t}\n\n\t/**\n\t * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'.\n\t * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다.\n\t * @method eg.view360.SpriteImage#play\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위\n\t * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복\n\t *\n\t * @example\n\t *\n\t * viewer.play({angle: 16, playCount: 1});\n\t *\n\t */\n\tplay({interval, playCount} = {interval: 1000 / this._totalCount, playCount: 0}) {\n\t\tif (!this._bg) {\n\t\t\tthis._autoPlayReservedInfo = {interval, playCount};\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\n\t\tlet frameIndex = this.getFrameIndex();\n\t\tlet count = 0;\n\t\tlet frameCount = 0; // for checking 1 cycle\n\n\t\tthis._autoPlayTimer = setInterval(() => {\n\t\t\tframeIndex %= this._totalCount;\n\t\t\tconst colRow = this.toColRow(frameIndex);\n\n\t\t\tthis.setColRow(colRow[0], colRow[1]);\n\t\t\tframeIndex++;\n\n\t\t\t// Done 1 Cycle?\n\t\t\tif (++frameCount === this._totalCount) {\n\t\t\t\tframeCount = 0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (playCount > 0 && count === playCount) {\n\t\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\t}\n\t\t}, interval);\n\t}\n\n\ttoColRow(frameIndex) {\n\t\tconst colCount = this._colCount;\n\t\tconst rowCount = this._rowCount;\n\n\t\tif (frameIndex < 0) {\n\t\t\treturn [0, 0];\n\t\t} else if (frameIndex >= this._totalCount) {\n\t\t\treturn [colCount - 1, rowCount - 1];\n\t\t}\n\n\t\tconst col = frameIndex % colCount;\n\t\tconst row = Math.floor(frameIndex / colCount);\n\n\t\t// console.log(frameIndex, col, row);\n\t\treturn [col, row];\n\t}\n}\n\nexport default SpriteImage;\n","import Component from \"@egjs/component\";\nimport Axes, {PanInput} from \"@egjs/axes\";\nimport SpriteImage from \"./SpriteImage\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_PAN_SCALE = 0.21;\n\n/**\n * @class eg.view360.SpinViewer\n * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object.\n * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpinViewer\n * var el = document.getElementById(\"product-360\");\n * var viewer = new eg.view360.SpinViewer(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24 //required\n * });\n */\nclass SpinViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.SpinViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.SpinViewer\n\t */\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\n\t\tthis._el = element;\n\n\t\tconst opt = Object.assign({}, options);\n\t\tconst colCount = opt.colCount || 1;\n\t\tconst rowCount = opt.rowCount || 1;\n\n\t\tthis._scale = (opt.scale || 1);\n\t\tthis._panScale = this._scale * DEFAULT_PAN_SCALE;\n\n\t\tthis._frameCount = colCount * rowCount;\n\n\t\t// Init SpriteImage\n\t\tthis._sprites = new SpriteImage(element, opt).on({\n\t\t\t\"load\": evt => {\n\t\t\t\t/**\n\t\t\t\t * Events that occur when component loading is complete\n\t\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#load\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"load\" : function(evt) {\n\t\t\t\t *\t\tthis.spinBy(360, {duration: 300});\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"load\", evt);\n\t\t\t},\n\t\t\t\"imageError\": evt => {\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#imageError\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viewer.on({\n\t\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t\t *\t\t// Error handling\n\t\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: evt.imageUrl\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Init Axes\n\t\tthis._panInput = new PanInput(this._el, {\n\t\t\tscale: [this._panScale, this._panScale]\n\t\t});\n\t\tthis._axes = new Axes({\n\t\t\tangle: {\n\t\t\t\trange: [0, 359],\n\t\t\t\tcircular: true\n\t\t\t}\n\t\t}).on({\n\t\t\t\"change\": evt => {\n\t\t\t\tconst curr = Math.floor(evt.pos.angle / (360 / this._frameCount));\n\t\t\t\tconst frameIndex = this._frameCount - curr - 1;\n\n\t\t\t\tthis._sprites.setFrameIndex(frameIndex);\n\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#change\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row\n\t\t\t\t * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값\n\t\t\t\t * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님)\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"change\" : function(evt) {\n\t\t\t\t *\t\tconsole.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"change\", {\n\t\t\t\t\tframeIndex,\n\t\t\t\t\tcolRow: this._sprites.getColRow(),\n\t\t\t\t\tangle: evt.pos.angle\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"animationEnd\": evt => {\n\t\t\t\t/**\n\t\t\t\t * This event is fired when animation ends.\n\t\t\t\t * @ko 에니메이션이 끝났을 때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#animationEnd\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Boolean} param.isTrusted 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\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"animationEnd\" : function(evt) {\n\t\t\t\t *\t\t// evt.isTrusted === true or false\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"animationEnd\", {\n\t\t\t\t\tisTrusted: evt.isTrusted\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._axes.connect(\"angle\", this._panInput);\n\t}\n\n\t/**\n\t * Set spin scale\n\t * @ko scale 을 조정할 수 있는 함수\n\t * @method eg.view360.SpinViewer#setScale\n\t * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.setScale(2);// It moves twice as much.\n\t */\n\tsetScale(scale) {\n\t\tif (isNaN(scale) || scale < 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._scale = scale;\n\t\tthis._panScale = scale * DEFAULT_PAN_SCALE;\n\t\tthis._panInput.options.scale = [this._panScale, this._panScale];\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get spin scale\n\t * @ko scale 값을 반환한다.\n\t * @method eg.view360.SpinViewer#getScale\n\t *\n\t * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @example\n\t *\n\t * viewer.getScale();// It returns number\n\t */\n\tgetScale() {\n\t\treturn this._scale;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle.\n\t * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinBy\n\t *\n\t * @param {Number} [angle = 0] angle상대적 회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinBy(720, {duration: 500});\n\t */\n\tspinBy(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setBy({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle).\n\t * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinTo\n\t *\n\t * @param {Number} [angle = 0] angle회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinTo(30, {duration:100});\n\t */\n\tspinTo(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setTo({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns current angles\n\t * @ko 현재 각도를 반환한다.\n\t *\n\t * @return {Number} Current angle 현재 각도\n\t */\n\tgetAngle() {\n\t\treturn this._axes.get().angle || 0;\n\t}\n}\n\nexport default SpinViewer;\n"],"names":["win","window","Math","self","Function","doc","document","agent","getAgent","osName","os","name","browserName","browser","Float32Array","Array","getComputedStyle","userAgent","navigator","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","i","len","length","SUPPORT_WILLCHANGE","CSS","supports","VERSION","SpriteImage","element","options","opt","_el","_rowCount","rowCount","_colCount","colCount","_totalCount","_width","width","_height","height","_autoHeight","autoHeight","_colRow","colRow","frameIndex","setFrameIndex","_getSizeString","imageUrl","setTimeout","trigger","_image","Image","onload","_bg","_createBgDiv","appendChild","setColRow","bgElement","_autoPlayReservedInfo","play","onerror","e","src","img","el","createElement","position","overflow","ondragstart","willChange","unitWidth","unitHeight","r","paddingBottom","index","toColRow","getFrameIndex","col","row","getColRow","size","stop","_autoPlayTimer","clearInterval","interval","playCount","count","frameCount","setInterval","floor","Component","DEFAULT_PAN_SCALE","SpinViewer","_scale","scale","_panScale","_frameCount","_sprites","on","evt","_panInput","PanInput","_axes","Axes","angle","range","circular","curr","pos","isTrusted","connect","setScale","isNaN","getScale","spinBy","param","duration","setBy","spinTo","setTo","getAngle","get"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;AAIA,EAEA;;EACA,IAAMA,GAAG,GAAG,OAAOC,MAAP,KAAkB,WAAlB,IAAiCA,MAAM,CAACC,IAAP,KAAgBA,IAAjD,GAAwDD,MAAxD,GAAiE,OAAOE,IAAP,KAAgB,WAAhB,IAA+BA,IAAI,CAACD,IAAL,KAAcA,IAA7C,GAAoDC,IAApD,GAA2DC,QAAQ,CAAC,aAAD,CAAR,EAAxI;EACA;;EAEA,IAAMC,GAAG,GAAGL,GAAG,CAACM,QAAhB;EACA,IAAMC,KAAK,GAAGC,QAAQ,EAAtB;EACA,IAAMC,MAAM,GAAGF,KAAK,CAACG,EAAN,CAASC,IAAxB;EACA,IAAMC,WAAW,GAAGL,KAAK,CAACM,OAAN,CAAcF,IAAlC;;ECbA;;;;AAIA,EAEAX,GAAG,CAACc,YAAJ,GAAoB,OAAOd,GAAG,CAACc,YAAX,KAA4B,WAA7B,GAA4Cd,GAAG,CAACc,Y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AAKpB,MAAZ;EACA;EAED;;;;;;;;;;;;;;;;;aAeAqB,SAAA,gBAAOV,KAAP,EAAkBW,KAAlB,EAAyC;EAAA,UAAlCX,KAAkC;EAAlCA,QAAAA,KAAkC,GAA1B,CAA0B;EAAA;;EAAA,UAAvBW,KAAuB;EAAvBA,QAAAA,KAAuB,GAAf;EAACC,UAAAA,QAAQ,EAAE;EAAX,SAAe;EAAA;;EACxC,WAAKd,KAAL,CAAWe,KAAX,CAAiB;EAACb,QAAAA,KAAK,EAALA;EAAD,OAAjB,EAA0BW,KAAK,CAACC,QAAhC;;EACA,aAAO,IAAP;EACA;EAED;;;;;;;;;;;;;;;;;aAeAE,SAAA,gBAAOd,KAAP,EAAkBW,KAAlB,EAAyC;EAAA,UAAlCX,KAAkC;EAAlCA,QAAAA,KAAkC,GAA1B,CAA0B;EAAA;;EAAA,UAAvBW,KAAuB;EAAvBA,QAAAA,KAAuB,GAAf;EAACC,UAAAA,QAAQ,EAAE;EAAX,SAAe;EAAA;;EACxC,WAAKd,KAAL,CAAWiB,KAAX,CAAiB;EAACf,QAAAA,KAAK,EAALA;EAAD,OAAjB,EAA0BW,KAAK,CAACC,QAAhC;;EACA,aAAO,IAAP;EACA;EAED;;;;;;;;aAMAI,WAAA,oBAAW;EACV,aAAO,KAAKlB,KAAL,CAAWmB,GAAX,GAAiBjB,KAAjB,IAA0B,CAAjC;EACA;;;MAjOuBd;;EAAnBE,EAAAA,WAWEnE,UAAUA;WAXZmE;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/SpinViewer/view360.spinviewer.min.js b/dist/SpinViewer/view360.spinviewer.min.js new file mode 100644 index 000000000..a0684fa35 --- /dev/null +++ b/dist/SpinViewer/view360.spinviewer.min.js @@ -0,0 +1,9 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@egjs/axes"),require("@egjs/component"),require("@egjs/agent")):"function"==typeof define&&define.amd?define(["exports","@egjs/axes","@egjs/component","@egjs/agent"],e):e((t.eg=t.eg||{},t.eg.view360={}),t.eg.Axes,t.eg.Component,t.eg.Agent)}(this,function(t,l,e,o){"use strict";function s(){return(s=Object.assign||function(t){for(var e=1;ethis._rowCount-1||t>this._colCount-1||(this._image&&u&&(this._image.style[u]="translate("+-t/this._colCount*100+"%, "+-e/this._rowCount*100+"%)"),this._colRow=[t,e])},t.getColRow=function(){return this._colRow},i._getSizeString=function(t){return"number"==typeof t?t+"px":t},t.stop=function(){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=null)},t.play=function(t){var e=this,o=void 0===t?{interval:1e3/this._totalCount,playCount:0}:t,n=o.interval,r=o.playCount;if(this._bg){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=null);var i=this.getFrameIndex(),a=0,l=0;this._autoPlayTimer=setInterval(function(){i%=e._totalCount;var t=e.toColRow(i);e.setColRow(t[0],t[1]),i++,++l===e._totalCount&&(l=0,a++),0=this._totalCount?[e-1,o-1]:[t%e,Math.floor(t/e)]},i}(e);return t.VERSION=g,t}(),h=function(){var t=function(a){function t(t,e){var n;(n=a.call(this)||this)._el=t;var o=s({},e),r=o.colCount||1,i=o.rowCount||1;return n._scale=o.scale||1,n._panScale=.21*n._scale,n._frameCount=r*i,n._sprites=new _(t,o).on({load:function(t){n.trigger("load",t)},imageError:function(t){n.trigger("imageError",{imageUrl:t.imageUrl})}}),n._panInput=new l.PanInput(n._el,{scale:[n._panScale,n._panScale]}),n._axes=new l({angle:{range:[0,359],circular:!0}}).on({change:function(t){var e=Math.floor(t.pos.angle/(360/n._frameCount)),o=n._frameCount-e-1;n._sprites.setFrameIndex(o),n.trigger("change",{frameIndex:o,colRow:n._sprites.getColRow(),angle:t.pos.angle})},animationEnd:function(t){n.trigger("animationEnd",{isTrusted:t.isTrusted})}}),n._axes.connect("angle",n._panInput),n}n(t,a);var e=t.prototype;return e.setScale=function(t){return isNaN(t)||t<0||(this._scale=t,this._panScale=.21*t,this._panInput.options.scale=[this._panScale,this._panScale]),this},e.getScale=function(){return this._scale},e.spinBy=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setBy({angle:t},e.duration),this},e.spinTo=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setTo({angle:t},e.duration),this},e.getAngle=function(){return this._axes.get().angle||0},t}(e);return t.VERSION=g,t}();t.SpinViewer=h,t.SpriteImage=_,t.VERSION=g,Object.defineProperty(t,"__esModule",{value:!0})}); +//# sourceMappingURL=view360.spinviewer.min.js.map diff --git a/dist/SpinViewer/view360.spinviewer.min.js.map b/dist/SpinViewer/view360.spinviewer.min.js.map new file mode 100644 index 000000000..27b2b77b7 --- /dev/null +++ b/dist/SpinViewer/view360.spinviewer.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.spinviewer.min.js","sources":["../../src/utils/browser.js","../../src/utils/browserFeature.js","../../src/version.js","../../src/SpinViewer/SpriteImage.js","../../src/SpinViewer/SpinViewer.js"],"sourcesContent":["/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport {TRANSFORM, SUPPORT_WILLCHANGE} from \"../utils/browserFeature\";\nimport {VERSION} from \"../version\";\n/**\n * @class eg.view360.SpriteImage\n * @classdesc A module that displays a single or continuous image of any one of the \"sprite images\". SpinViewer internally uses SpriteImage to show each frame of the sprite image.\n * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the \"Sprite image\". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n *\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpriteImage\n *\n * var el = document.getElementById(\"image-div\");\n * var sprites = new eg.view360.SpriteImage(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24\n * });\n */\nclass SpriteImage extends Component {\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\t\tconst opt = options || {};\n\n\t\tthis._el = element;\n\t\tthis._rowCount = opt.rowCount || 1;\n\t\tthis._colCount = opt.colCount || 1;\n\t\tthis._totalCount = this._rowCount * this._colCount;// total frames\n\t\tthis._width = opt.width || \"auto\";\n\t\tthis._height = opt.height || \"auto\";\n\t\tthis._autoHeight = opt.autoHeight != null ? opt.autoHeight : \"true\"; // If autoHeight is specified, _height will be overwritten.\n\t\tthis._colRow = [0, 0];\n\n\t\tif (opt.colRow) {\n\t\t\tthis._colRow = opt.colRow;\n\t\t} else if (opt.frameIndex) {\n\t\t\tthis.setFrameIndex(opt.frameIndex);\n\t\t}\n\n\t\tthis._el.style.width = SpriteImage._getSizeString(this._width);\n\t\tthis._el.style.height = SpriteImage._getSizeString(this._height);\n\n\t\tif (!opt.imageUrl) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: opt.imageUrl\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._image = new Image();\n\t\t/**\n\t\t * Event\n\t\t */\n\t\tthis._image.onload = () => {\n\t\t\tthis._bg = SpriteImage._createBgDiv(\n\t\t\t\tthis._image, this._rowCount, this._colCount, this._autoHeight);\n\t\t\tthis._el.appendChild(this._bg);\n\t\t\tthis.setColRow(this._colRow[0], this._colRow[1]);\n\n\t\t\t/**\n\t\t\t * Events that occur when component loading is complete\n\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#load\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"load\" : function(evt) {\n\t\t\t *\t\tconsole.log(\"load event fired - e.target\", e.target, \"e.bgElement\", e.bgElement);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"load\", {\n\t\t\t\ttarget: this._el,\n\t\t\t\tbgElement: this._bg\n\t\t\t});\n\n\t\t\tif (this._autoPlayReservedInfo) {\n\t\t\t\tthis.play(this._autoPlayReservedInfo);\n\t\t\t\tthis._autoPlayReservedInfo = null;\n\t\t\t}\n\t\t};\n\n\t\tthis._image.onerror = e => {\n\t\t\t/**\n\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#imageError\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t *\t\t// Error handling\n\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\timageUrl: opt.imageUrl\n\t\t\t});\n\t\t};\n\n\t\tthis._image.src = opt.imageUrl;\n\t}\n\n\tstatic _createBgDiv(img, rowCount, colCount, autoHeight) {\n\t\tconst el = document.createElement(\"div\");\n\n\t\tel.style.position = \"relative\";\n\t\tel.style.overflow = \"hidden\";\n\n\t\timg.style.position = \"absolute\";\n\t\timg.style.width = `${colCount * 100}%`;\n\t\timg.style.height = `${rowCount * 100}%`;\n\t\t/** Prevent image from being dragged on IE10, IE11, Safari especially */\n\t\timg.ondragstart = () => (false); // img.style.pointerEvents = \"none\";\n\t\t// Use hardware accelerator if available\n\t\tSUPPORT_WILLCHANGE && (img.style.willChange = \"transform\");\n\n\t\tel.appendChild(img);\n\n\t\tconst unitWidth = img.width / colCount;\n\t\tconst unitHeight = img.height / rowCount;\n\n\t\tif (autoHeight) {\n\t\t\tconst r = unitHeight / unitWidth;\n\n\t\t\tel.style.paddingBottom = `${r * 100}%`;\n\t\t} else {\n\t\t\tel.style.height = \"100%\";\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/**\n\t * Specifies the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정\n\t * @method eg.view360.SpriteImage#setFrameIndex\n\t * @param {Number} frameIndex frame index of a frame프레임의 인덱스\n\t *\n\t * @example\n\t *\n\t * sprites.setFrameIndex(0, 1);// col = 0, row = 1\n\t */\n\tsetFrameIndex(index) {\n\t\tconst colRow = this.toColRow(index);\n\n\t\tthis.setColRow(colRow[0], colRow[1]);\n\t}\n\n\t/**\n\t * Returns the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환\n\t * @method eg.view360.SpriteImage#getFrameIndex\n\t * @return {Number} frame index frame 인덱스\n\t *\n\t * @example\n\t *\n\t * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1\n\t *\n\t */\n\tgetFrameIndex() {\n\t\treturn this._colRow[1] * this._colCount + this._colRow[0];\n\t}\n\n\t/**\n\t * Specifies the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정\n\t * @method eg.view360.SpriteImage#setColRow\n\t * @param {Number} col Column number of a frame프레임의 행값\n\t * @param {Number} row Row number of a frame프레임의 열값\n\t *\n\t * @example\n\t *\n\t * sprites.setlColRow(1, 2); // col = 1, row = 2\n\t */\n\tsetColRow(col, row) {\n\t\tif (row > this._rowCount - 1 || col > this._colCount - 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._image && TRANSFORM) {\n\t\t\t// NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser?\n\t\t\tthis._image.style[TRANSFORM] = `translate(${-(col / this._colCount * 100)}%, ${-(row / this._rowCount * 100)}%)`;\n\t\t}\n\n\t\tthis._colRow = [col, row];\n\t}\n\n\t/**\n\t * Returns the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환\n\t * @method eg.view360.SpriteImage#gelColRow\n\t * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열\n\t *\n\t * @example\n\t *\n\t * var colRow = sprites.getlColRow();\n\t * // colRow = [1, 2] - index of col is 1, index of row is 2\n\t *\n\t */\n\tgetColRow() {\n\t\treturn this._colRow;\n\t}\n\n\tstatic _getSizeString(size) {\n\t\tif (typeof size === \"number\") {\n\t\t\treturn `${size}px`;\n\t\t}\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Stop playing\n\t * @ko play 되고 있던 프레임 재생을 중지합니다.\n\t * @method eg.view360.SpriteImage#stop\n\t *\n\t * @example\n\t *\n\t * viewer.stop();\n\t *\n\t */\n\tstop() {\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\t}\n\n\t/**\n\t * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'.\n\t * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다.\n\t * @method eg.view360.SpriteImage#play\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위\n\t * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복\n\t *\n\t * @example\n\t *\n\t * viewer.play({angle: 16, playCount: 1});\n\t *\n\t */\n\tplay({interval, playCount} = {interval: 1000 / this._totalCount, playCount: 0}) {\n\t\tif (!this._bg) {\n\t\t\tthis._autoPlayReservedInfo = {interval, playCount};\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\n\t\tlet frameIndex = this.getFrameIndex();\n\t\tlet count = 0;\n\t\tlet frameCount = 0; // for checking 1 cycle\n\n\t\tthis._autoPlayTimer = setInterval(() => {\n\t\t\tframeIndex %= this._totalCount;\n\t\t\tconst colRow = this.toColRow(frameIndex);\n\n\t\t\tthis.setColRow(colRow[0], colRow[1]);\n\t\t\tframeIndex++;\n\n\t\t\t// Done 1 Cycle?\n\t\t\tif (++frameCount === this._totalCount) {\n\t\t\t\tframeCount = 0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (playCount > 0 && count === playCount) {\n\t\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\t}\n\t\t}, interval);\n\t}\n\n\ttoColRow(frameIndex) {\n\t\tconst colCount = this._colCount;\n\t\tconst rowCount = this._rowCount;\n\n\t\tif (frameIndex < 0) {\n\t\t\treturn [0, 0];\n\t\t} else if (frameIndex >= this._totalCount) {\n\t\t\treturn [colCount - 1, rowCount - 1];\n\t\t}\n\n\t\tconst col = frameIndex % colCount;\n\t\tconst row = Math.floor(frameIndex / colCount);\n\n\t\t// console.log(frameIndex, col, row);\n\t\treturn [col, row];\n\t}\n}\n\nexport default SpriteImage;\n","import Component from \"@egjs/component\";\nimport Axes, {PanInput} from \"@egjs/axes\";\nimport SpriteImage from \"./SpriteImage\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_PAN_SCALE = 0.21;\n\n/**\n * @class eg.view360.SpinViewer\n * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object.\n * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpinViewer\n * var el = document.getElementById(\"product-360\");\n * var viewer = new eg.view360.SpinViewer(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24 //required\n * });\n */\nclass SpinViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.SpinViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.SpinViewer\n\t */\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\n\t\tthis._el = element;\n\n\t\tconst opt = Object.assign({}, options);\n\t\tconst colCount = opt.colCount || 1;\n\t\tconst rowCount = opt.rowCount || 1;\n\n\t\tthis._scale = (opt.scale || 1);\n\t\tthis._panScale = this._scale * DEFAULT_PAN_SCALE;\n\n\t\tthis._frameCount = colCount * rowCount;\n\n\t\t// Init SpriteImage\n\t\tthis._sprites = new SpriteImage(element, opt).on({\n\t\t\t\"load\": evt => {\n\t\t\t\t/**\n\t\t\t\t * Events that occur when component loading is complete\n\t\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#load\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"load\" : function(evt) {\n\t\t\t\t *\t\tthis.spinBy(360, {duration: 300});\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"load\", evt);\n\t\t\t},\n\t\t\t\"imageError\": evt => {\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#imageError\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viewer.on({\n\t\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t\t *\t\t// Error handling\n\t\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: evt.imageUrl\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Init Axes\n\t\tthis._panInput = new PanInput(this._el, {\n\t\t\tscale: [this._panScale, this._panScale]\n\t\t});\n\t\tthis._axes = new Axes({\n\t\t\tangle: {\n\t\t\t\trange: [0, 359],\n\t\t\t\tcircular: true\n\t\t\t}\n\t\t}).on({\n\t\t\t\"change\": evt => {\n\t\t\t\tconst curr = Math.floor(evt.pos.angle / (360 / this._frameCount));\n\t\t\t\tconst frameIndex = this._frameCount - curr - 1;\n\n\t\t\t\tthis._sprites.setFrameIndex(frameIndex);\n\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#change\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row\n\t\t\t\t * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값\n\t\t\t\t * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님)\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"change\" : function(evt) {\n\t\t\t\t *\t\tconsole.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"change\", {\n\t\t\t\t\tframeIndex,\n\t\t\t\t\tcolRow: this._sprites.getColRow(),\n\t\t\t\t\tangle: evt.pos.angle\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"animationEnd\": evt => {\n\t\t\t\t/**\n\t\t\t\t * This event is fired when animation ends.\n\t\t\t\t * @ko 에니메이션이 끝났을 때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#animationEnd\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Boolean} param.isTrusted 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\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"animationEnd\" : function(evt) {\n\t\t\t\t *\t\t// evt.isTrusted === true or false\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"animationEnd\", {\n\t\t\t\t\tisTrusted: evt.isTrusted\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._axes.connect(\"angle\", this._panInput);\n\t}\n\n\t/**\n\t * Set spin scale\n\t * @ko scale 을 조정할 수 있는 함수\n\t * @method eg.view360.SpinViewer#setScale\n\t * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.setScale(2);// It moves twice as much.\n\t */\n\tsetScale(scale) {\n\t\tif (isNaN(scale) || scale < 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._scale = scale;\n\t\tthis._panScale = scale * DEFAULT_PAN_SCALE;\n\t\tthis._panInput.options.scale = [this._panScale, this._panScale];\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get spin scale\n\t * @ko scale 값을 반환한다.\n\t * @method eg.view360.SpinViewer#getScale\n\t *\n\t * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @example\n\t *\n\t * viewer.getScale();// It returns number\n\t */\n\tgetScale() {\n\t\treturn this._scale;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle.\n\t * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinBy\n\t *\n\t * @param {Number} [angle = 0] angle상대적 회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinBy(720, {duration: 500});\n\t */\n\tspinBy(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setBy({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle).\n\t * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinTo\n\t *\n\t * @param {Number} [angle = 0] angle회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinTo(30, {duration:100});\n\t */\n\tspinTo(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setTo({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns current angles\n\t * @ko 현재 각도를 반환한다.\n\t *\n\t * @return {Number} Current angle 현재 각도\n\t */\n\tgetAngle() {\n\t\treturn this._axes.get().angle || 0;\n\t}\n}\n\nexport default SpinViewer;\n"],"names":["win","window","Math","self","Function","doc","document","agent","getAgent","os","name","browser","Float32Array","Array","getComputedStyle","navigator","userAgent","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","i","len","length","SUPPORT_WILLCHANGE","CSS","supports","VERSION","SpriteImage","element","options","opt","_el","_rowCount","rowCount","_colCount","colCount","_totalCount","_this","_width","width","_height","height","_autoHeight","autoHeight","_colRow","colRow","frameIndex","setFrameIndex","_getSizeString","imageUrl","_image","Image","onload","_bg","_createBgDiv","appendChild","setColRow","trigger","bgElement","_autoPlayReservedInfo","play","onerror","e","src","setTimeout","img","el","createElement","position","overflow","ondragstart","willChange","unitWidth","unitHeight","r","paddingBottom","index","this","toColRow","getFrameIndex","col","row","getColRow","size","stop","_autoPlayTimer","clearInterval","interval","playCount","count","frameCount","setInterval","_this2","floor","Component","SpinViewer","_extends","_scale","scale","_panScale","_frameCount","_sprites","on","evt","_panInput","PanInput","_axes","Axes","angle","range","circular","curr","pos","isTrusted","connect","setScale","isNaN","getScale","spinBy","param","duration","setBy","spinTo","setTo","getAngle","get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WErE,QAAUA,EAXZqE"} \ No newline at end of file diff --git a/dist/SpinViewer/view360.spinviewer.pkgd.js b/dist/SpinViewer/view360.spinviewer.pkgd.js new file mode 100644 index 000000000..57832e781 --- /dev/null +++ b/dist/SpinViewer/view360.spinviewer.pkgd.js @@ -0,0 +1,7089 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +All-in-one packaged file for ease use of '@egjs/view360' with below dependencies. +- @egjs/agent ^2.2.1, @egjs/axes ^2.7.1, @egjs/component ^2.1.2, es6-promise ^4.2.5, gl-matrix ^3.1.0, motion-sensors-polyfill ^0.3.1, webvr-polyfill ^0.9.41 +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.eg = global.eg || {}, global.eg.view360 = {}))); +}(this, (function (exports) { 'use strict'; + + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + /* + Copyright (c) 2017 NAVER Corp. + @egjs/component project is licensed under the MIT license + + @egjs/component JavaScript library + https://naver.github.io/egjs-component + + @version 2.1.2 + */ + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + function isUndefined(value) { + return typeof value === "undefined"; + } + /** + * A class used to manage events in a component + * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스 + * @alias eg.Component + */ + + + var Component = + /*#__PURE__*/ + function () { + var Component = + /*#__PURE__*/ + function () { + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.Component.VERSION; // ex) 2.0.0 + * @memberof eg.Component + */ + + /** + * @support {"ie": "7+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.1+ (except 3.x)"} + */ + function Component() { + this._eventHandler = {}; + this.options = {}; + } + /** + * Triggers a custom event. + * @ko 커스텀 이벤트를 발생시킨다 + * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름 + * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터 + * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고 + * @example + class Some extends eg.Component { + 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. + } + }); + some.on("hi", (e) => { + // `currentTarget` is component instance. + console.log(some === e.currentTarget); // true + }); + // 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 trigger(eventName, customEvent) { + if (customEvent === void 0) { + customEvent = {}; + } + + var handlerList = this._eventHandler[eventName] || []; + var hasHandlerList = handlerList.length > 0; + + if (!hasHandlerList) { + return true; + } // If detach method call in handler in first time then handler list calls. + + + handlerList = handlerList.concat(); + customEvent.eventType = eventName; + var isCanceled = false; + var arg = [customEvent]; + var i = 0; + + customEvent.stop = function () { + isCanceled = true; + }; + + customEvent.currentTarget = this; + + for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + restParam[_key - 2] = arguments[_key]; + } + + if (restParam.length >= 1) { + arg = arg.concat(restParam); + } + + for (i = 0; handlerList[i]; i++) { + handlerList[i].apply(this, arg); + } + + return !isCanceled; + }; + /** + * Executed event just one time. + * @ko 이벤트가 한번만 실행된다. + * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름 + * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + alert("hi"); + } + thing() { + this.once("hi", this.hi); + } + } + var some = new Some(); + some.thing(); + some.trigger("hi"); + // fire alert("hi"); + some.trigger("hi"); + // Nothing happens + */ + + + _proto.once = function once(eventName, handlerToAttach) { + if (typeof eventName === "object" && isUndefined(handlerToAttach)) { + var eventHash = eventName; + var i; + + for (i in eventHash) { + this.once(i, eventHash[i]); + } + + return this; + } else if (typeof eventName === "string" && typeof handlerToAttach === "function") { + var self = this; + this.on(eventName, function listener() { + for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + arg[_key2] = arguments[_key2]; + } + + handlerToAttach.apply(self, arg); + self.off(eventName, listener); + }); + } + + 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 + class Some extends eg.Component { + some() { + this.hasOn("hi");// check hi event. + } + } + */ + + + _proto.hasOn = function hasOn(eventName) { + return !!this._eventHandler[eventName]; + }; + /** + * Attaches an event to a component. + * @ko 컴포넌트에 이벤트를 등록한다. + * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름 + * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + console.log("hi"); + } + some() { + this.on("hi",this.hi); //attach event + } + } + */ + + + _proto.on = function on(eventName, handlerToAttach) { + if (typeof eventName === "object" && isUndefined(handlerToAttach)) { + var eventHash = eventName; + var name; + + for (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. + * @ko 컴포넌트에 등록된 이벤트를 해제한다 + * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름 + * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + console.log("hi"); + } + some() { + this.off("hi",this.hi); //detach event + } + } + */ + + + _proto.off = function off(eventName, handlerToDetach) { + // All event detach. + if (isUndefined(eventName)) { + this._eventHandler = {}; + return this; + } // All handler of specific event detach. + + + if (isUndefined(handlerToDetach)) { + if (typeof eventName === "string") { + this._eventHandler[eventName] = undefined; + return this; + } else { + var eventHash = eventName; + var name; + + for (name in eventHash) { + this.off(name, eventHash[name]); + } + + return this; + } + } // The handler of specific event detach. + + + var handlerList = this._eventHandler[eventName]; + + if (handlerList) { + var k; + var handlerFunction; + + for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) { + if (handlerFunction === handlerToDetach) { + handlerList = handlerList.splice(k, 1); + break; + } + } + } + + return this; + }; + + return Component; + }(); + + Component.VERSION = "2.1.2"; + return Component; + }(); + + /*! Hammer.JS - v2.0.17-rc - 2019-12-16 + * http://naver.github.io/egjs + * + * Forked By Naver egjs + * Copyright (c) hammerjs + * Licensed under the MIT license */ + function _extends$1() { + _extends$1 = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends$1.apply(this, arguments); + } + + function _inheritsLoose$1(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized$1(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + /** + * @private + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} target + * @param {...Object} objects_to_assign + * @returns {Object} target + */ + var assign; + + if (typeof Object.assign !== 'function') { + assign = function assign(target) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + + return output; + }; + } else { + assign = Object.assign; + } + + var assign$1 = assign; + + var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; + var TEST_ELEMENT = typeof document === "undefined" ? { + style: {} + } : document.createElement('div'); + var TYPE_FUNCTION = 'function'; + var round = Math.round, + abs = Math.abs; + var now = Date.now; + + /** + * @private + * get the prefixed property + * @param {Object} obj + * @param {String} property + * @returns {String|Undefined} prefixed + */ + + function prefixed(obj, property) { + var prefix; + var prop; + var camelProp = property[0].toUpperCase() + property.slice(1); + var i = 0; + + while (i < VENDOR_PREFIXES.length) { + prefix = VENDOR_PREFIXES[i]; + prop = prefix ? prefix + camelProp : property; + + if (prop in obj) { + return prop; + } + + i++; + } + + return undefined; + } + + /* eslint-disable no-new-func, no-nested-ternary */ + var win; + + if (typeof window === "undefined") { + // window is undefined in node.js + win = {}; + } else { + win = window; + } + + var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); + var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; + function getTouchActionProps() { + if (!NATIVE_TOUCH_ACTION) { + return false; + } + + var touchMap = {}; + var cssSupports = win.CSS && win.CSS.supports; + ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) { + // If css.supports is not supported but there is native touch-action assume it supports + // all values. This is the case for IE 10 and 11. + return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true; + }); + return touchMap; + } + + var TOUCH_ACTION_COMPUTE = 'compute'; + var TOUCH_ACTION_AUTO = 'auto'; + var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented + + var TOUCH_ACTION_NONE = 'none'; + var TOUCH_ACTION_PAN_X = 'pan-x'; + var TOUCH_ACTION_PAN_Y = 'pan-y'; + var TOUCH_ACTION_MAP = getTouchActionProps(); + + var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; + var SUPPORT_TOUCH = 'ontouchstart' in win; + var SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined; + var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); + var INPUT_TYPE_TOUCH = 'touch'; + var INPUT_TYPE_PEN = 'pen'; + var INPUT_TYPE_MOUSE = 'mouse'; + var INPUT_TYPE_KINECT = 'kinect'; + var COMPUTE_INTERVAL = 25; + var INPUT_START = 1; + var INPUT_MOVE = 2; + var INPUT_END = 4; + var INPUT_CANCEL = 8; + var DIRECTION_NONE = 1; + var DIRECTION_LEFT = 2; + var DIRECTION_RIGHT = 4; + var DIRECTION_UP = 8; + var DIRECTION_DOWN = 16; + var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; + var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; + var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; + var PROPS_XY = ['x', 'y']; + var PROPS_CLIENT_XY = ['clientX', 'clientY']; + + /** + * @private + * walk objects and arrays + * @param {Object} obj + * @param {Function} iterator + * @param {Object} context + */ + function each(obj, iterator, context) { + var i; + + if (!obj) { + return; + } + + if (obj.forEach) { + obj.forEach(iterator, context); + } else if (obj.length !== undefined) { + i = 0; + + while (i < obj.length) { + iterator.call(context, obj[i], i, obj); + i++; + } + } else { + for (i in obj) { + obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); + } + } + } + + /** + * @private + * let a boolean value also be a function that must return a boolean + * this first item in args will be used as the context + * @param {Boolean|Function} val + * @param {Array} [args] + * @returns {Boolean} + */ + + function boolOrFn(val, args) { + if (typeof val === TYPE_FUNCTION) { + return val.apply(args ? args[0] || undefined : undefined, args); + } + + return val; + } + + /** + * @private + * small indexOf wrapper + * @param {String} str + * @param {String} find + * @returns {Boolean} found + */ + function inStr(str, find) { + return str.indexOf(find) > -1; + } + + /** + * @private + * when the touchActions are collected they are not a valid value, so we need to clean things up. * + * @param {String} actions + * @returns {*} + */ + + function cleanTouchActions(actions) { + // none + if (inStr(actions, TOUCH_ACTION_NONE)) { + return TOUCH_ACTION_NONE; + } + + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers + // for different directions, e.g. horizontal pan but vertical swipe?) + // we need none (as otherwise with pan-x pan-y combined none of these + // recognizers will work, since the browser would handle all panning + + if (hasPanX && hasPanY) { + return TOUCH_ACTION_NONE; + } // pan-x OR pan-y + + + if (hasPanX || hasPanY) { + return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; + } // manipulation + + + if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { + return TOUCH_ACTION_MANIPULATION; + } + + return TOUCH_ACTION_AUTO; + } + + /** + * @private + * Touch Action + * sets the touchAction property or uses the js alternative + * @param {Manager} manager + * @param {String} value + * @constructor + */ + + var TouchAction = + /*#__PURE__*/ + function () { + function TouchAction(manager, value) { + this.manager = manager; + this.set(value); + } + /** + * @private + * set the touchAction value on the element or enable the polyfill + * @param {String} value + */ + + + var _proto = TouchAction.prototype; + + _proto.set = function set(value) { + // find out the touch-action by the event handlers + if (value === TOUCH_ACTION_COMPUTE) { + value = this.compute(); + } + + if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { + this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; + } + + this.actions = value.toLowerCase().trim(); + }; + /** + * @private + * just re-set the touchAction value + */ + + + _proto.update = function update() { + this.set(this.manager.options.touchAction); + }; + /** + * @private + * compute the value for the touchAction property based on the recognizer's settings + * @returns {String} value + */ + + + _proto.compute = function compute() { + var actions = []; + each(this.manager.recognizers, function (recognizer) { + if (boolOrFn(recognizer.options.enable, [recognizer])) { + actions = actions.concat(recognizer.getTouchAction()); + } + }); + return cleanTouchActions(actions.join(' ')); + }; + /** + * @private + * this method is called on each input cycle and provides the preventing of the browser behavior + * @param {Object} input + */ + + + _proto.preventDefaults = function preventDefaults(input) { + var srcEvent = input.srcEvent; + var direction = input.offsetDirection; // if the touch action did prevented once this session + + if (this.manager.session.prevented) { + srcEvent.preventDefault(); + return; + } + + var actions = this.actions; + var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; + + if (hasNone) { + // do not prevent defaults if this is a tap gesture + var isTapPointer = input.pointers.length === 1; + var isTapMovement = input.distance < 2; + var isTapTouchTime = input.deltaTime < 250; + + if (isTapPointer && isTapMovement && isTapTouchTime) { + return; + } + } + + if (hasPanX && hasPanY) { + // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent + return; + } + + if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) { + return this.preventSrc(srcEvent); + } + }; + /** + * @private + * call preventDefault to prevent the browser's default behavior (scrolling in most cases) + * @param {Object} srcEvent + */ + + + _proto.preventSrc = function preventSrc(srcEvent) { + this.manager.session.prevented = true; + srcEvent.preventDefault(); + }; + + return TouchAction; + }(); + + /** + * @private + * find if a node is in the given parent + * @method hasParent + * @param {HTMLElement} node + * @param {HTMLElement} parent + * @return {Boolean} found + */ + function hasParent(node, parent) { + while (node) { + if (node === parent) { + return true; + } + + node = node.parentNode; + } + + return false; + } + + /** + * @private + * get the center of all the pointers + * @param {Array} pointers + * @return {Object} center contains `x` and `y` properties + */ + + function getCenter(pointers) { + var pointersLength = pointers.length; // no need to loop when only one touch + + if (pointersLength === 1) { + return { + x: round(pointers[0].clientX), + y: round(pointers[0].clientY) + }; + } + + var x = 0; + var y = 0; + var i = 0; + + while (i < pointersLength) { + x += pointers[i].clientX; + y += pointers[i].clientY; + i++; + } + + return { + x: round(x / pointersLength), + y: round(y / pointersLength) + }; + } + + /** + * @private + * create a simple clone from the input used for storage of firstInput and firstMultiple + * @param {Object} input + * @returns {Object} clonedInputData + */ + + function simpleCloneInputData(input) { + // make a simple copy of the pointers because we will get a reference if we don't + // we only need clientXY for the calculations + var pointers = []; + var i = 0; + + while (i < input.pointers.length) { + pointers[i] = { + clientX: round(input.pointers[i].clientX), + clientY: round(input.pointers[i].clientY) + }; + i++; + } + + return { + timeStamp: now(), + pointers: pointers, + center: getCenter(pointers), + deltaX: input.deltaX, + deltaY: input.deltaY + }; + } + + /** + * @private + * calculate the absolute distance between two points + * @param {Object} p1 {x, y} + * @param {Object} p2 {x, y} + * @param {Array} [props] containing x and y keys + * @return {Number} distance + */ + + function getDistance(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + + var x = p2[props[0]] - p1[props[0]]; + var y = p2[props[1]] - p1[props[1]]; + return Math.sqrt(x * x + y * y); + } + + /** + * @private + * calculate the angle between two coordinates + * @param {Object} p1 + * @param {Object} p2 + * @param {Array} [props] containing x and y keys + * @return {Number} angle + */ + + function getAngle(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + + var x = p2[props[0]] - p1[props[0]]; + var y = p2[props[1]] - p1[props[1]]; + return Math.atan2(y, x) * 180 / Math.PI; + } + + /** + * @private + * get the direction between two points + * @param {Number} x + * @param {Number} y + * @return {Number} direction + */ + + function getDirection(x, y) { + if (x === y) { + return DIRECTION_NONE; + } + + if (abs(x) >= abs(y)) { + return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + + return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; + } + + function computeDeltaXY(session, input) { + var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session; + // jscs throwing error on defalut destructured values and without defaults tests fail + + var offset = session.offsetDelta || {}; + var prevDelta = session.prevDelta || {}; + var prevInput = session.prevInput || {}; + + if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { + prevDelta = session.prevDelta = { + x: prevInput.deltaX || 0, + y: prevInput.deltaY || 0 + }; + offset = session.offsetDelta = { + x: center.x, + y: center.y + }; + } + + input.deltaX = prevDelta.x + (center.x - offset.x); + input.deltaY = prevDelta.y + (center.y - offset.y); + } + + /** + * @private + * calculate the velocity between two points. unit is in px per ms. + * @param {Number} deltaTime + * @param {Number} x + * @param {Number} y + * @return {Object} velocity `x` and `y` + */ + function getVelocity(deltaTime, x, y) { + return { + x: x / deltaTime || 0, + y: y / deltaTime || 0 + }; + } + + /** + * @private + * calculate the scale factor between two pointersets + * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} scale + */ + + function getScale(start, end) { + return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); + } + + /** + * @private + * calculate the rotation degrees between two pointersets + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} rotation + */ + + function getRotation(start, end) { + return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); + } + + /** + * @private + * velocity is calculated every x ms + * @param {Object} session + * @param {Object} input + */ + + function computeIntervalInputData(session, input) { + var last = session.lastInterval || input; + var deltaTime = input.timeStamp - last.timeStamp; + var velocity; + var velocityX; + var velocityY; + var direction; + + if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { + var deltaX = input.deltaX - last.deltaX; + var deltaY = input.deltaY - last.deltaY; + var v = getVelocity(deltaTime, deltaX, deltaY); + velocityX = v.x; + velocityY = v.y; + velocity = abs(v.x) > abs(v.y) ? v.x : v.y; + direction = getDirection(deltaX, deltaY); + session.lastInterval = input; + } else { + // use latest velocity info if it doesn't overtake a minimum period + velocity = last.velocity; + velocityX = last.velocityX; + velocityY = last.velocityY; + direction = last.direction; + } + + input.velocity = velocity; + input.velocityX = velocityX; + input.velocityY = velocityY; + input.direction = direction; + } + + /** + * @private + * extend the data with some usable properties like scale, rotate, velocity etc + * @param {Object} manager + * @param {Object} input + */ + + function computeInputData(manager, input) { + var session = manager.session; + var pointers = input.pointers; + var pointersLength = pointers.length; // store the first input to calculate the distance and direction + + if (!session.firstInput) { + session.firstInput = simpleCloneInputData(input); + } // to compute scale and rotation we need to store the multiple touches + + + if (pointersLength > 1 && !session.firstMultiple) { + session.firstMultiple = simpleCloneInputData(input); + } else if (pointersLength === 1) { + session.firstMultiple = false; + } + + var firstInput = session.firstInput, + firstMultiple = session.firstMultiple; + var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; + var center = input.center = getCenter(pointers); + input.timeStamp = now(); + input.deltaTime = input.timeStamp - firstInput.timeStamp; + input.angle = getAngle(offsetCenter, center); + input.distance = getDistance(offsetCenter, center); + computeDeltaXY(session, input); + input.offsetDirection = getDirection(input.deltaX, input.deltaY); + var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); + input.overallVelocityX = overallVelocity.x; + input.overallVelocityY = overallVelocity.y; + input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y; + input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; + input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; + input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers; + computeIntervalInputData(session, input); // find the correct target + + var target = manager.element; + var srcEvent = input.srcEvent; + var srcEventTarget; + + if (srcEvent.composedPath) { + srcEventTarget = srcEvent.composedPath()[0]; + } else if (srcEvent.path) { + srcEventTarget = srcEvent.path[0]; + } else { + srcEventTarget = srcEvent.target; + } + + if (hasParent(srcEventTarget, target)) { + target = srcEventTarget; + } + + input.target = target; + } + + /** + * @private + * handle input events + * @param {Manager} manager + * @param {String} eventType + * @param {Object} input + */ + + function inputHandler(manager, eventType, input) { + var pointersLen = input.pointers.length; + var changedPointersLen = input.changedPointers.length; + var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0; + var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0; + input.isFirst = !!isFirst; + input.isFinal = !!isFinal; + + if (isFirst) { + manager.session = {}; + } // source event is the normalized value of the domEvents + // like 'touchstart, mouseup, pointerdown' + + + input.eventType = eventType; // compute scale, rotation etc + + computeInputData(manager, input); // emit secret event + + manager.emit('hammer.input', input); + manager.recognize(input); + manager.session.prevInput = input; + } + + /** + * @private + * split string on whitespace + * @param {String} str + * @returns {Array} words + */ + function splitStr(str) { + return str.trim().split(/\s+/g); + } + + /** + * @private + * addEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ + + function addEventListeners(target, types, handler) { + each(splitStr(types), function (type) { + target.addEventListener(type, handler, false); + }); + } + + /** + * @private + * removeEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ + + function removeEventListeners(target, types, handler) { + each(splitStr(types), function (type) { + target.removeEventListener(type, handler, false); + }); + } + + /** + * @private + * get the window object of an element + * @param {HTMLElement} element + * @returns {DocumentView|Window} + */ + function getWindowForElement(element) { + var doc = element.ownerDocument || element; + return doc.defaultView || doc.parentWindow || window; + } + + /** + * @private + * create new input type manager + * @param {Manager} manager + * @param {Function} callback + * @returns {Input} + * @constructor + */ + + var Input = + /*#__PURE__*/ + function () { + function Input(manager, callback) { + var self = this; + this.manager = manager; + this.callback = callback; + this.element = manager.element; + this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager, + // so when disabled the input events are completely bypassed. + + this.domHandler = function (ev) { + if (boolOrFn(manager.options.enable, [manager])) { + self.handler(ev); + } + }; + + this.init(); + } + /** + * @private + * should handle the inputEvent data and trigger the callback + * @virtual + */ + + + var _proto = Input.prototype; + + _proto.handler = function handler() {}; + /** + * @private + * bind the events + */ + + + _proto.init = function init() { + this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }; + /** + * @private + * unbind the events + */ + + + _proto.destroy = function destroy() { + this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }; + + return Input; + }(); + + /** + * @private + * find if a array contains the object using indexOf or a simple polyFill + * @param {Array} src + * @param {String} find + * @param {String} [findByKey] + * @return {Boolean|Number} false when not found, or the index + */ + function inArray(src, find, findByKey) { + if (src.indexOf && !findByKey) { + return src.indexOf(find); + } else { + var i = 0; + + while (i < src.length) { + if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) { + // do not use === here, test fails + return i; + } + + i++; + } + + return -1; + } + } + + var POINTER_INPUT_MAP = { + pointerdown: INPUT_START, + pointermove: INPUT_MOVE, + pointerup: INPUT_END, + pointercancel: INPUT_CANCEL, + pointerout: INPUT_CANCEL + }; // in IE10 the pointer types is defined as an enum + + var IE10_POINTER_TYPE_ENUM = { + 2: INPUT_TYPE_TOUCH, + 3: INPUT_TYPE_PEN, + 4: INPUT_TYPE_MOUSE, + 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 + + }; + var POINTER_ELEMENT_EVENTS = 'pointerdown'; + var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive + + if (win.MSPointerEvent && !win.PointerEvent) { + POINTER_ELEMENT_EVENTS = 'MSPointerDown'; + POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; + } + /** + * @private + * Pointer events input + * @constructor + * @extends Input + */ + + + var PointerEventInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(PointerEventInput, _Input); + + function PointerEventInput() { + var _this; + + var proto = PointerEventInput.prototype; + proto.evEl = POINTER_ELEMENT_EVENTS; + proto.evWin = POINTER_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.store = _this.manager.session.pointerEvents = []; + return _this; + } + /** + * @private + * handle mouse events + * @param {Object} ev + */ + + + var _proto = PointerEventInput.prototype; + + _proto.handler = function handler(ev) { + var store = this.store; + var removePointer = false; + var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); + var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; + var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; + var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store + + var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down + + if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { + if (storeIndex < 0) { + store.push(ev); + storeIndex = store.length - 1; + } + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + removePointer = true; + } // it not found, so the pointer hasn't been down (so it's probably a hover) + + + if (storeIndex < 0) { + return; + } // update the event in the store + + + store[storeIndex] = ev; + this.callback(this.manager, eventType, { + pointers: store, + changedPointers: [ev], + pointerType: pointerType, + srcEvent: ev + }); + + if (removePointer) { + // remove from the store + store.splice(storeIndex, 1); + } + }; + + return PointerEventInput; + }(Input); + + /** + * @private + * convert array-like objects to real arrays + * @param {Object} obj + * @returns {Array} + */ + function toArray(obj) { + return Array.prototype.slice.call(obj, 0); + } + + /** + * @private + * unique array with objects based on a key (like 'id') or just by the array's value + * @param {Array} src [{id:1},{id:2},{id:1}] + * @param {String} [key] + * @param {Boolean} [sort=False] + * @returns {Array} [{id:1},{id:2}] + */ + + function uniqueArray(src, key, sort) { + var results = []; + var values = []; + var i = 0; + + while (i < src.length) { + var val = key ? src[i][key] : src[i]; + + if (inArray(values, val) < 0) { + results.push(src[i]); + } + + values[i] = val; + i++; + } + + if (sort) { + if (!key) { + results = results.sort(); + } else { + results = results.sort(function (a, b) { + return a[key] > b[key]; + }); + } + } + + return results; + } + + var TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL + }; + var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; + /** + * @private + * Multi-user touch events input + * @constructor + * @extends Input + */ + + var TouchInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(TouchInput, _Input); + + function TouchInput() { + var _this; + + TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS; + + return _this; + } + + var _proto = TouchInput.prototype; + + _proto.handler = function handler(ev) { + var type = TOUCH_INPUT_MAP[ev.type]; + var touches = getTouches.call(this, ev, type); + + if (!touches) { + return; + } + + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + }; + + return TouchInput; + }(Input); + + function getTouches(ev, type) { + var allTouches = toArray(ev.touches); + var targetIds = this.targetIds; // when there is only one touch, the process can be simplified + + if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { + targetIds[allTouches[0].identifier] = true; + return [allTouches, allTouches]; + } + + var i; + var targetTouches; + var changedTouches = toArray(ev.changedTouches); + var changedTargetTouches = []; + var target = this.target; // get target touches from touches + + targetTouches = allTouches.filter(function (touch) { + return hasParent(touch.target, target); + }); // collect touches + + if (type === INPUT_START) { + i = 0; + + while (i < targetTouches.length) { + targetIds[targetTouches[i].identifier] = true; + i++; + } + } // filter changed touches to only contain touches that exist in the collected target ids + + + i = 0; + + while (i < changedTouches.length) { + if (targetIds[changedTouches[i].identifier]) { + changedTargetTouches.push(changedTouches[i]); + } // cleanup removed touches + + + if (type & (INPUT_END | INPUT_CANCEL)) { + delete targetIds[changedTouches[i].identifier]; + } + + i++; + } + + if (!changedTargetTouches.length) { + return; + } + + return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' + uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches]; + } + + var MOUSE_INPUT_MAP = { + mousedown: INPUT_START, + mousemove: INPUT_MOVE, + mouseup: INPUT_END + }; + var MOUSE_ELEMENT_EVENTS = 'mousedown'; + var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; + /** + * @private + * Mouse events input + * @constructor + * @extends Input + */ + + var MouseInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(MouseInput, _Input); + + function MouseInput() { + var _this; + + var proto = MouseInput.prototype; + proto.evEl = MOUSE_ELEMENT_EVENTS; + proto.evWin = MOUSE_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.pressed = false; // mousedown state + + return _this; + } + /** + * @private + * handle mouse events + * @param {Object} ev + */ + + + var _proto = MouseInput.prototype; + + _proto.handler = function handler(ev) { + var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down + + if (eventType & INPUT_START && ev.button === 0) { + this.pressed = true; + } + + if (eventType & INPUT_MOVE && ev.which !== 1) { + eventType = INPUT_END; + } // mouse must be down + + + if (!this.pressed) { + return; + } + + if (eventType & INPUT_END) { + this.pressed = false; + } + + this.callback(this.manager, eventType, { + pointers: [ev], + changedPointers: [ev], + pointerType: INPUT_TYPE_MOUSE, + srcEvent: ev + }); + }; + + return MouseInput; + }(Input); + + /** + * @private + * Combined touch and mouse input + * + * Touch has a higher priority then mouse, and while touching no mouse events are allowed. + * This because touch devices also emit mouse events while doing a touch. + * + * @constructor + * @extends Input + */ + + var DEDUP_TIMEOUT = 2500; + var DEDUP_DISTANCE = 25; + + function setLastTouch(eventData) { + var _eventData$changedPoi = eventData.changedPointers, + touch = _eventData$changedPoi[0]; + + if (touch.identifier === this.primaryTouch) { + var lastTouch = { + x: touch.clientX, + y: touch.clientY + }; + var lts = this.lastTouches; + this.lastTouches.push(lastTouch); + + var removeLastTouch = function removeLastTouch() { + var i = lts.indexOf(lastTouch); + + if (i > -1) { + lts.splice(i, 1); + } + }; + + setTimeout(removeLastTouch, DEDUP_TIMEOUT); + } + } + + function recordTouches(eventType, eventData) { + if (eventType & INPUT_START) { + this.primaryTouch = eventData.changedPointers[0].identifier; + setLastTouch.call(this, eventData); + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + setLastTouch.call(this, eventData); + } + } + + function isSyntheticEvent(eventData) { + var x = eventData.srcEvent.clientX; + var y = eventData.srcEvent.clientY; + + for (var i = 0; i < this.lastTouches.length; i++) { + var t = this.lastTouches[i]; + var dx = Math.abs(x - t.x); + var dy = Math.abs(y - t.y); + + if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { + return true; + } + } + + return false; + } + + var TouchMouseInput = + /*#__PURE__*/ + function () { + var TouchMouseInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(TouchMouseInput, _Input); + + function TouchMouseInput(_manager, callback) { + var _this; + + _this = _Input.call(this, _manager, callback) || this; + + _this.handler = function (manager, inputEvent, inputData) { + var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH; + var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE; + + if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { + return; + } // when we're in a touch event, record touches to de-dupe synthetic mouse event + + + if (isTouch) { + recordTouches.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputEvent, inputData); + } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputData)) { + return; + } + + _this.callback(manager, inputEvent, inputData); + }; + + _this.touch = new TouchInput(_this.manager, _this.handler); + _this.mouse = new MouseInput(_this.manager, _this.handler); + _this.primaryTouch = null; + _this.lastTouches = []; + return _this; + } + /** + * @private + * handle mouse and touch events + * @param {Hammer} manager + * @param {String} inputEvent + * @param {Object} inputData + */ + + + var _proto = TouchMouseInput.prototype; + + /** + * @private + * remove the event listeners + */ + _proto.destroy = function destroy() { + this.touch.destroy(); + this.mouse.destroy(); + }; + + return TouchMouseInput; + }(Input); + + return TouchMouseInput; + }(); + + /** + * @private + * create new input type manager + * called by the Manager constructor + * @param {Hammer} manager + * @returns {Input} + */ + + function createInputInstance(manager) { + var Type; // let inputClass = manager.options.inputClass; + + var inputClass = manager.options.inputClass; + + if (inputClass) { + Type = inputClass; + } else if (SUPPORT_POINTER_EVENTS) { + Type = PointerEventInput; + } else if (SUPPORT_ONLY_TOUCH) { + Type = TouchInput; + } else if (!SUPPORT_TOUCH) { + Type = MouseInput; + } else { + Type = TouchMouseInput; + } + + return new Type(manager, inputHandler); + } + + /** + * @private + * if the argument is an array, we want to execute the fn on each entry + * if it aint an array we don't want to do a thing. + * this is used by all the methods that accept a single and array argument. + * @param {*|Array} arg + * @param {String} fn + * @param {Object} [context] + * @returns {Boolean} + */ + + function invokeArrayArg(arg, fn, context) { + if (Array.isArray(arg)) { + each(arg, context[fn], context); + return true; + } + + return false; + } + + var STATE_POSSIBLE = 1; + var STATE_BEGAN = 2; + var STATE_CHANGED = 4; + var STATE_ENDED = 8; + var STATE_RECOGNIZED = STATE_ENDED; + var STATE_CANCELLED = 16; + var STATE_FAILED = 32; + + /** + * @private + * get a unique id + * @returns {number} uniqueId + */ + var _uniqueId = 1; + function uniqueId() { + return _uniqueId++; + } + + /** + * @private + * get a recognizer by name if it is bound to a manager + * @param {Recognizer|String} otherRecognizer + * @param {Recognizer} recognizer + * @returns {Recognizer} + */ + function getRecognizerByNameIfManager(otherRecognizer, recognizer) { + var manager = recognizer.manager; + + if (manager) { + return manager.get(otherRecognizer); + } + + return otherRecognizer; + } + + /** + * @private + * get a usable string, used as event postfix + * @param {constant} state + * @returns {String} state + */ + + function stateStr(state) { + if (state & STATE_CANCELLED) { + return 'cancel'; + } else if (state & STATE_ENDED) { + return 'end'; + } else if (state & STATE_CHANGED) { + return 'move'; + } else if (state & STATE_BEGAN) { + return 'start'; + } + + return ''; + } + + /** + * @private + * Recognizer flow explained; * + * All recognizers have the initial state of POSSIBLE when a input session starts. + * The definition of a input session is from the first input until the last input, with all it's movement in it. * + * Example session for mouse-input: mousedown -> mousemove -> mouseup + * + * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed + * which determines with state it should be. + * + * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to + * POSSIBLE to give it another change on the next cycle. + * + * Possible + * | + * +-----+---------------+ + * | | + * +-----+-----+ | + * | | | + * Failed Cancelled | + * +-------+------+ + * | | + * Recognized Began + * | + * Changed + * | + * Ended/Recognized + */ + + /** + * @private + * Recognizer + * Every recognizer needs to extend from this class. + * @constructor + * @param {Object} options + */ + + var Recognizer = + /*#__PURE__*/ + function () { + function Recognizer(options) { + if (options === void 0) { + options = {}; + } + + this.options = _extends$1({ + enable: true + }, options); + this.id = uniqueId(); + this.manager = null; // default is enable true + + this.state = STATE_POSSIBLE; + this.simultaneous = {}; + this.requireFail = []; + } + /** + * @private + * set options + * @param {Object} options + * @return {Recognizer} + */ + + + var _proto = Recognizer.prototype; + + _proto.set = function set(options) { + assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state + + this.manager && this.manager.touchAction.update(); + return this; + }; + /** + * @private + * recognize simultaneous with an other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.recognizeWith = function recognizeWith(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { + return this; + } + + var simultaneous = this.simultaneous; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + + if (!simultaneous[otherRecognizer.id]) { + simultaneous[otherRecognizer.id] = otherRecognizer; + otherRecognizer.recognizeWith(this); + } + + return this; + }; + /** + * @private + * drop the simultaneous link. it doesnt remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { + return this; + } + + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + delete this.simultaneous[otherRecognizer.id]; + return this; + }; + /** + * @private + * recognizer can only run when an other is failing + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.requireFailure = function requireFailure(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { + return this; + } + + var requireFail = this.requireFail; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + + if (inArray(requireFail, otherRecognizer) === -1) { + requireFail.push(otherRecognizer); + otherRecognizer.requireFailure(this); + } + + return this; + }; + /** + * @private + * drop the requireFailure link. it does not remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { + return this; + } + + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + var index = inArray(this.requireFail, otherRecognizer); + + if (index > -1) { + this.requireFail.splice(index, 1); + } + + return this; + }; + /** + * @private + * has require failures boolean + * @returns {boolean} + */ + + + _proto.hasRequireFailures = function hasRequireFailures() { + return this.requireFail.length > 0; + }; + /** + * @private + * if the recognizer can recognize simultaneous with an other recognizer + * @param {Recognizer} otherRecognizer + * @returns {Boolean} + */ + + + _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) { + return !!this.simultaneous[otherRecognizer.id]; + }; + /** + * @private + * You should use `tryEmit` instead of `emit` directly to check + * that all the needed recognizers has failed before emitting. + * @param {Object} input + */ + + + _proto.emit = function emit(input) { + var self = this; + var state = this.state; + + function emit(event) { + self.manager.emit(event, input); + } // 'panstart' and 'panmove' + + + if (state < STATE_ENDED) { + emit(self.options.event + stateStr(state)); + } + + emit(self.options.event); // simple 'eventName' events + + if (input.additionalEvent) { + // additional event(panleft, panright, pinchin, pinchout...) + emit(input.additionalEvent); + } // panend and pancancel + + + if (state >= STATE_ENDED) { + emit(self.options.event + stateStr(state)); + } + }; + /** + * @private + * Check that all the require failure recognizers has failed, + * if true, it emits a gesture event, + * otherwise, setup the state to FAILED. + * @param {Object} input + */ + + + _proto.tryEmit = function tryEmit(input) { + if (this.canEmit()) { + return this.emit(input); + } // it's failing anyway + + + this.state = STATE_FAILED; + }; + /** + * @private + * can we emit? + * @returns {boolean} + */ + + + _proto.canEmit = function canEmit() { + var i = 0; + + while (i < this.requireFail.length) { + if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { + return false; + } + + i++; + } + + return true; + }; + /** + * @private + * update the recognizer + * @param {Object} inputData + */ + + + _proto.recognize = function recognize(inputData) { + // make a new copy of the inputData + // so we can change the inputData without messing up the other recognizers + var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing? + + if (!boolOrFn(this.options.enable, [this, inputDataClone])) { + this.reset(); + this.state = STATE_FAILED; + return; + } // reset when we've reached the end + + + if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { + this.state = STATE_POSSIBLE; + } + + this.state = this.process(inputDataClone); // the recognizer has recognized a gesture + // so trigger an event + + if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { + this.tryEmit(inputDataClone); + } + }; + /** + * @private + * return the state of the recognizer + * the actual recognizing happens in this method + * @virtual + * @param {Object} inputData + * @returns {constant} STATE + */ + + /* jshint ignore:start */ + + + _proto.process = function process(inputData) {}; + /* jshint ignore:end */ + + /** + * @private + * return the preferred touch-action + * @virtual + * @returns {Array} + */ + + + _proto.getTouchAction = function getTouchAction() {}; + /** + * @private + * called when the gesture isn't allowed to recognize + * like when another is being recognized or it is disabled + * @virtual + */ + + + _proto.reset = function reset() {}; + + return Recognizer; + }(); + + /** + * @private + * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur + * between the given interval and position. The delay option can be used to recognize multi-taps without firing + * a single tap. + * + * The eventData from the emitted event contains the property `tapCount`, which contains the amount of + * multi-taps being recognized. + * @constructor + * @extends Recognizer + */ + + var TapRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(TapRecognizer, _Recognizer); + + function TapRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Recognizer.call(this, _extends$1({ + event: 'tap', + pointers: 1, + taps: 1, + interval: 300, + // max time between the multi-tap taps + time: 250, + // max time of the pointer to be down (like finger on the screen) + threshold: 9, + // a minimal movement is ok, but keep it low + posThreshold: 10 + }, options)) || this; // previous time and center, + // used for tap counting + + _this.pTime = false; + _this.pCenter = false; + _this._timer = null; + _this._input = null; + _this.count = 0; + return _this; + } + + var _proto = TapRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_MANIPULATION]; + }; + + _proto.process = function process(input) { + var _this2 = this; + + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTouchTime = input.deltaTime < options.time; + this.reset(); + + if (input.eventType & INPUT_START && this.count === 0) { + return this.failTimeout(); + } // we only allow little movement + // and we've reached an end event, so a tap is possible + + + if (validMovement && validTouchTime && validPointers) { + if (input.eventType !== INPUT_END) { + return this.failTimeout(); + } + + var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true; + var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; + this.pTime = input.timeStamp; + this.pCenter = input.center; + + if (!validMultiTap || !validInterval) { + this.count = 1; + } else { + this.count += 1; + } + + this._input = input; // if tap count matches we have recognized it, + // else it has began recognizing... + + var tapCount = this.count % options.taps; + + if (tapCount === 0) { + // no failing requirements, immediately trigger the tap event + // or wait as long as the multitap interval to trigger + if (!this.hasRequireFailures()) { + return STATE_RECOGNIZED; + } else { + this._timer = setTimeout(function () { + _this2.state = STATE_RECOGNIZED; + + _this2.tryEmit(); + }, options.interval); + return STATE_BEGAN; + } + } + } + + return STATE_FAILED; + }; + + _proto.failTimeout = function failTimeout() { + var _this3 = this; + + this._timer = setTimeout(function () { + _this3.state = STATE_FAILED; + }, this.options.interval); + return STATE_FAILED; + }; + + _proto.reset = function reset() { + clearTimeout(this._timer); + }; + + _proto.emit = function emit() { + if (this.state === STATE_RECOGNIZED) { + this._input.tapCount = this.count; + this.manager.emit(this.options.event, this._input); + } + }; + + return TapRecognizer; + }(Recognizer); + + /** + * @private + * This recognizer is just used as a base for the simple attribute recognizers. + * @constructor + * @extends Recognizer + */ + + var AttrRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(AttrRecognizer, _Recognizer); + + function AttrRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _Recognizer.call(this, _extends$1({ + pointers: 1 + }, options)) || this; + } + /** + * @private + * Used to check if it the recognizer receives valid input, like input.distance > 10. + * @memberof AttrRecognizer + * @param {Object} input + * @returns {Boolean} recognized + */ + + + var _proto = AttrRecognizer.prototype; + + _proto.attrTest = function attrTest(input) { + var optionPointers = this.options.pointers; + return optionPointers === 0 || input.pointers.length === optionPointers; + }; + /** + * @private + * Process the input and return the state for the recognizer + * @memberof AttrRecognizer + * @param {Object} input + * @returns {*} State + */ + + + _proto.process = function process(input) { + var state = this.state; + var eventType = input.eventType; + var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); + var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED + + if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { + return state | STATE_CANCELLED; + } else if (isRecognized || isValid) { + if (eventType & INPUT_END) { + return state | STATE_ENDED; + } else if (!(state & STATE_BEGAN)) { + return STATE_BEGAN; + } + + return state | STATE_CHANGED; + } + + return STATE_FAILED; + }; + + return AttrRecognizer; + }(Recognizer); + + /** + * @private + * direction cons to string + * @param {constant} direction + * @returns {String} + */ + + function directionStr(direction) { + if (direction === DIRECTION_DOWN) { + return 'down'; + } else if (direction === DIRECTION_UP) { + return 'up'; + } else if (direction === DIRECTION_LEFT) { + return 'left'; + } else if (direction === DIRECTION_RIGHT) { + return 'right'; + } + + return ''; + } + + /** + * @private + * Pan + * Recognized when the pointer is down and moved in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ + + var PanRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(PanRecognizer, _AttrRecognizer); + + function PanRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _AttrRecognizer.call(this, _extends$1({ + event: 'pan', + threshold: 10, + pointers: 1, + direction: DIRECTION_ALL + }, options)) || this; + _this.pX = null; + _this.pY = null; + return _this; + } + + var _proto = PanRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + var direction = this.options.direction; + var actions = []; + + if (direction & DIRECTION_HORIZONTAL) { + actions.push(TOUCH_ACTION_PAN_Y); + } + + if (direction & DIRECTION_VERTICAL) { + actions.push(TOUCH_ACTION_PAN_X); + } + + return actions; + }; + + _proto.directionTest = function directionTest(input) { + var options = this.options; + var hasMoved = true; + var distance = input.distance; + var direction = input.direction; + var x = input.deltaX; + var y = input.deltaY; // lock to axis? + + if (!(direction & options.direction)) { + if (options.direction & DIRECTION_HORIZONTAL) { + direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + hasMoved = x !== this.pX; + distance = Math.abs(input.deltaX); + } else { + direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN; + hasMoved = y !== this.pY; + distance = Math.abs(input.deltaY); + } + } + + input.direction = direction; + return hasMoved && distance > options.threshold && direction & options.direction; + }; + + _proto.attrTest = function attrTest(input) { + return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call + this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input)); + }; + + _proto.emit = function emit(input) { + this.pX = input.deltaX; + this.pY = input.deltaY; + var direction = directionStr(input.direction); + + if (direction) { + input.additionalEvent = this.options.event + direction; + } + + _AttrRecognizer.prototype.emit.call(this, input); + }; + + return PanRecognizer; + }(AttrRecognizer); + + /** + * @private + * Swipe + * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ + + var SwipeRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(SwipeRecognizer, _AttrRecognizer); + + function SwipeRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'swipe', + threshold: 10, + velocity: 0.3, + direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, + pointers: 1 + }, options)) || this; + } + + var _proto = SwipeRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return PanRecognizer.prototype.getTouchAction.call(this); + }; + + _proto.attrTest = function attrTest(input) { + var direction = this.options.direction; + var velocity; + + if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { + velocity = input.overallVelocity; + } else if (direction & DIRECTION_HORIZONTAL) { + velocity = input.overallVelocityX; + } else if (direction & DIRECTION_VERTICAL) { + velocity = input.overallVelocityY; + } + + return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END; + }; + + _proto.emit = function emit(input) { + var direction = directionStr(input.offsetDirection); + + if (direction) { + this.manager.emit(this.options.event + direction, input); + } + + this.manager.emit(this.options.event, input); + }; + + return SwipeRecognizer; + }(AttrRecognizer); + + /** + * @private + * Pinch + * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). + * @constructor + * @extends AttrRecognizer + */ + + var PinchRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(PinchRecognizer, _AttrRecognizer); + + function PinchRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'pinch', + threshold: 0, + pointers: 2 + }, options)) || this; + } + + var _proto = PinchRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_NONE]; + }; + + _proto.attrTest = function attrTest(input) { + return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); + }; + + _proto.emit = function emit(input) { + if (input.scale !== 1) { + var inOut = input.scale < 1 ? 'in' : 'out'; + input.additionalEvent = this.options.event + inOut; + } + + _AttrRecognizer.prototype.emit.call(this, input); + }; + + return PinchRecognizer; + }(AttrRecognizer); + + /** + * @private + * Rotate + * Recognized when two or more pointer are moving in a circular motion. + * @constructor + * @extends AttrRecognizer + */ + + var RotateRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(RotateRecognizer, _AttrRecognizer); + + function RotateRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'rotate', + threshold: 0, + pointers: 2 + }, options)) || this; + } + + var _proto = RotateRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_NONE]; + }; + + _proto.attrTest = function attrTest(input) { + return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); + }; + + return RotateRecognizer; + }(AttrRecognizer); + + /** + * @private + * Press + * Recognized when the pointer is down for x ms without any movement. + * @constructor + * @extends Recognizer + */ + + var PressRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(PressRecognizer, _Recognizer); + + function PressRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Recognizer.call(this, _extends$1({ + event: 'press', + pointers: 1, + time: 251, + // minimal time of the pointer to be pressed + threshold: 9 + }, options)) || this; + _this._timer = null; + _this._input = null; + return _this; + } + + var _proto = PressRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_AUTO]; + }; + + _proto.process = function process(input) { + var _this2 = this; + + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTime = input.deltaTime > options.time; + this._input = input; // we only allow little movement + // and we've reached an end event, so a tap is possible + + if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) { + this.reset(); + } else if (input.eventType & INPUT_START) { + this.reset(); + this._timer = setTimeout(function () { + _this2.state = STATE_RECOGNIZED; + + _this2.tryEmit(); + }, options.time); + } else if (input.eventType & INPUT_END) { + return STATE_RECOGNIZED; + } + + return STATE_FAILED; + }; + + _proto.reset = function reset() { + clearTimeout(this._timer); + }; + + _proto.emit = function emit(input) { + if (this.state !== STATE_RECOGNIZED) { + return; + } + + if (input && input.eventType & INPUT_END) { + this.manager.emit(this.options.event + "up", input); + } else { + this._input.timeStamp = now(); + this.manager.emit(this.options.event, this._input); + } + }; + + return PressRecognizer; + }(Recognizer); + + var defaults = { + /** + * @private + * set if DOM events are being triggered. + * But this is slower and unused by simple implementations, so disabled by default. + * @type {Boolean} + * @default false + */ + domEvents: false, + + /** + * @private + * The value for the touchAction property/fallback. + * When set to `compute` it will magically set the correct value based on the added recognizers. + * @type {String} + * @default compute + */ + touchAction: TOUCH_ACTION_COMPUTE, + + /** + * @private + * @type {Boolean} + * @default true + */ + enable: true, + + /** + * @private + * EXPERIMENTAL FEATURE -- can be removed/changed + * Change the parent input target element. + * If Null, then it is being set the to main element. + * @type {Null|EventTarget} + * @default null + */ + inputTarget: null, + + /** + * @private + * force an input class + * @type {Null|Function} + * @default null + */ + inputClass: null, + + /** + * @private + * Some CSS properties can be used to improve the working of Hammer. + * Add them to this method and they will be set when creating a new Manager. + * @namespace + */ + cssProps: { + /** + * @private + * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userSelect: "none", + + /** + * @private + * Disable the Windows Phone grippers when pressing an element. + * @type {String} + * @default 'none' + */ + touchSelect: "none", + + /** + * @private + * Disables the default callout shown when you touch and hold a touch target. + * On iOS, when you touch and hold a touch target such as a link, Safari displays + * a callout containing information about the link. This property allows you to disable that callout. + * @type {String} + * @default 'none' + */ + touchCallout: "none", + + /** + * @private + * Specifies whether zooming is enabled. Used by IE10> + * @type {String} + * @default 'none' + */ + contentZooming: "none", + + /** + * @private + * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userDrag: "none", + + /** + * @private + * Overrides the highlight color shown when the user taps a link or a JavaScript + * clickable element in iOS. This property obeys the alpha value, if specified. + * @type {String} + * @default 'rgba(0,0,0,0)' + */ + tapHighlightColor: "rgba(0,0,0,0)" + } + }; + /** + * @private + * Default recognizer setup when calling `Hammer()` + * When creating a new Manager these will be skipped. + * This is separated with other defaults because of tree-shaking. + * @type {Array} + */ + + var preset = [[RotateRecognizer, { + enable: false + }], [PinchRecognizer, { + enable: false + }, ['rotate']], [SwipeRecognizer, { + direction: DIRECTION_HORIZONTAL + }], [PanRecognizer, { + direction: DIRECTION_HORIZONTAL + }, ['swipe']], [TapRecognizer], [TapRecognizer, { + event: 'doubletap', + taps: 2 + }, ['tap']], [PressRecognizer]]; + + var STOP = 1; + var FORCED_STOP = 2; + /** + * @private + * add/remove the css properties as defined in manager.options.cssProps + * @param {Manager} manager + * @param {Boolean} add + */ + + function toggleCssProps(manager, add) { + var element = manager.element; + + if (!element.style) { + return; + } + + var prop; + each(manager.options.cssProps, function (value, name) { + prop = prefixed(element.style, name); + + if (add) { + manager.oldCssProps[prop] = element.style[prop]; + element.style[prop] = value; + } else { + element.style[prop] = manager.oldCssProps[prop] || ""; + } + }); + + if (!add) { + manager.oldCssProps = {}; + } + } + /** + * @private + * trigger dom event + * @param {String} event + * @param {Object} data + */ + + + function triggerDomEvent(event, data) { + var gestureEvent = document.createEvent("Event"); + gestureEvent.initEvent(event, true, true); + gestureEvent.gesture = data; + data.target.dispatchEvent(gestureEvent); + } + /** + * @private + * Manager + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ + + + var Manager = + /*#__PURE__*/ + function () { + function Manager(element, options) { + var _this = this; + + this.options = assign$1({}, defaults, options || {}); + this.options.inputTarget = this.options.inputTarget || element; + this.handlers = {}; + this.session = {}; + this.recognizers = []; + this.oldCssProps = {}; + this.element = element; + this.input = createInputInstance(this); + this.touchAction = new TouchAction(this, this.options.touchAction); + toggleCssProps(this, true); + each(this.options.recognizers, function (item) { + var recognizer = _this.add(new item[0](item[1])); + + item[2] && recognizer.recognizeWith(item[2]); + item[3] && recognizer.requireFailure(item[3]); + }, this); + } + /** + * @private + * set options + * @param {Object} options + * @returns {Manager} + */ + + + var _proto = Manager.prototype; + + _proto.set = function set(options) { + assign$1(this.options, options); // Options that need a little more setup + + if (options.touchAction) { + this.touchAction.update(); + } + + if (options.inputTarget) { + // Clean up existing event listeners and reinitialize + this.input.destroy(); + this.input.target = options.inputTarget; + this.input.init(); + } + + return this; + }; + /** + * @private + * stop recognizing for this session. + * This session will be discarded, when a new [input]start event is fired. + * When forced, the recognizer cycle is stopped immediately. + * @param {Boolean} [force] + */ + + + _proto.stop = function stop(force) { + this.session.stopped = force ? FORCED_STOP : STOP; + }; + /** + * @private + * run the recognizers! + * called by the inputHandler function on every movement of the pointers (touches) + * it walks through all the recognizers and tries to detect the gesture that is being made + * @param {Object} inputData + */ + + + _proto.recognize = function recognize(inputData) { + var session = this.session; + + if (session.stopped) { + return; + } // run the touch-action polyfill + + + this.touchAction.preventDefaults(inputData); + var recognizer; + var recognizers = this.recognizers; // this holds the recognizer that is being recognized. + // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED + // if no recognizer is detecting a thing, it is set to `null` + + var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized + // or when we're in a new session + + if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) { + session.curRecognizer = null; + curRecognizer = null; + } + + var i = 0; + + while (i < recognizers.length) { + recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one. + // 1. allow if the session is NOT forced stopped (see the .stop() method) + // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one + // that is being recognized. + // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. + // this can be setup with the `recognizeWith()` method on the recognizer. + + if (session.stopped !== FORCED_STOP && ( // 1 + !curRecognizer || recognizer === curRecognizer || // 2 + recognizer.canRecognizeWith(curRecognizer))) { + // 3 + recognizer.recognize(inputData); + } else { + recognizer.reset(); + } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the + // current active recognizer. but only if we don't already have an active recognizer + + + if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { + session.curRecognizer = recognizer; + curRecognizer = recognizer; + } + + i++; + } + }; + /** + * @private + * get a recognizer by its event name. + * @param {Recognizer|String} recognizer + * @returns {Recognizer|Null} + */ + + + _proto.get = function get(recognizer) { + if (recognizer instanceof Recognizer) { + return recognizer; + } + + var recognizers = this.recognizers; + + for (var i = 0; i < recognizers.length; i++) { + if (recognizers[i].options.event === recognizer) { + return recognizers[i]; + } + } + + return null; + }; + /** + * @private add a recognizer to the manager + * existing recognizers with the same event name will be removed + * @param {Recognizer} recognizer + * @returns {Recognizer|Manager} + */ + + + _proto.add = function add(recognizer) { + if (invokeArrayArg(recognizer, "add", this)) { + return this; + } // remove existing + + + var existing = this.get(recognizer.options.event); + + if (existing) { + this.remove(existing); + } + + this.recognizers.push(recognizer); + recognizer.manager = this; + this.touchAction.update(); + return recognizer; + }; + /** + * @private + * remove a recognizer by name or instance + * @param {Recognizer|String} recognizer + * @returns {Manager} + */ + + + _proto.remove = function remove(recognizer) { + if (invokeArrayArg(recognizer, "remove", this)) { + return this; + } + + var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists + + if (recognizer) { + var recognizers = this.recognizers; + var index = inArray(recognizers, targetRecognizer); + + if (index !== -1) { + recognizers.splice(index, 1); + this.touchAction.update(); + } + } + + return this; + }; + /** + * @private + * bind event + * @param {String} events + * @param {Function} handler + * @returns {EventEmitter} this + */ + + + _proto.on = function on(events, handler) { + if (events === undefined || handler === undefined) { + return this; + } + + var handlers = this.handlers; + each(splitStr(events), function (event) { + handlers[event] = handlers[event] || []; + handlers[event].push(handler); + }); + return this; + }; + /** + * @private unbind event, leave emit blank to remove all handlers + * @param {String} events + * @param {Function} [handler] + * @returns {EventEmitter} this + */ + + + _proto.off = function off(events, handler) { + if (events === undefined) { + return this; + } + + var handlers = this.handlers; + each(splitStr(events), function (event) { + if (!handler) { + delete handlers[event]; + } else { + handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); + } + }); + return this; + }; + /** + * @private emit event to the listeners + * @param {String} event + * @param {Object} data + */ + + + _proto.emit = function emit(event, data) { + // we also want to trigger dom events + if (this.options.domEvents) { + triggerDomEvent(event, data); + } // no handlers, so skip it all + + + var handlers = this.handlers[event] && this.handlers[event].slice(); + + if (!handlers || !handlers.length) { + return; + } + + data.type = event; + + data.preventDefault = function () { + data.srcEvent.preventDefault(); + }; + + var i = 0; + + while (i < handlers.length) { + handlers[i](data); + i++; + } + }; + /** + * @private + * destroy the manager and unbinds all events + * it doesn't unbind dom events, that is the user own responsibility + */ + + + _proto.destroy = function destroy() { + this.element && toggleCssProps(this, false); + this.handlers = {}; + this.session = {}; + this.input.destroy(); + this.element = null; + }; + + return Manager; + }(); + + var SINGLE_TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL + }; + var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; + var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; + /** + * @private + * Touch events input + * @constructor + * @extends Input + */ + + var SingleTouchInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(SingleTouchInput, _Input); + + function SingleTouchInput() { + var _this; + + var proto = SingleTouchInput.prototype; + proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS; + proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.started = false; + return _this; + } + + var _proto = SingleTouchInput.prototype; + + _proto.handler = function handler(ev) { + var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events? + + if (type === INPUT_START) { + this.started = true; + } + + if (!this.started) { + return; + } + + var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state + + if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { + this.started = false; + } + + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + }; + + return SingleTouchInput; + }(Input); + + function normalizeSingleTouches(ev, type) { + var all = toArray(ev.touches); + var changed = toArray(ev.changedTouches); + + if (type & (INPUT_END | INPUT_CANCEL)) { + all = uniqueArray(all.concat(changed), 'identifier', true); + } + + return [all, changed]; + } + + /** + * @private + * wrap a method with a deprecation warning and stack trace + * @param {Function} method + * @param {String} name + * @param {String} message + * @returns {Function} A new function wrapping the supplied method. + */ + function deprecate(method, name, message) { + var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n"; + return function () { + var e = new Error('get-stack-trace'); + var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; + var log = window.console && (window.console.warn || window.console.log); + + if (log) { + log.call(window.console, deprecationMessage, stack); + } + + return method.apply(this, arguments); + }; + } + + /** + * @private + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} dest + * @param {Object} src + * @param {Boolean} [merge=false] + * @returns {Object} dest + */ + + var extend = deprecate(function (dest, src, merge) { + var keys = Object.keys(src); + var i = 0; + + while (i < keys.length) { + if (!merge || merge && dest[keys[i]] === undefined) { + dest[keys[i]] = src[keys[i]]; + } + + i++; + } + + return dest; + }, 'extend', 'Use `assign`.'); + + /** + * @private + * merge the values from src in the dest. + * means that properties that exist in dest will not be overwritten by src + * @param {Object} dest + * @param {Object} src + * @returns {Object} dest + */ + + var merge = deprecate(function (dest, src) { + return extend(dest, src, true); + }, 'merge', 'Use `assign`.'); + + /** + * @private + * simple class inheritance + * @param {Function} child + * @param {Function} base + * @param {Object} [properties] + */ + + function inherit(child, base, properties) { + var baseP = base.prototype; + var childP; + childP = child.prototype = Object.create(baseP); + childP.constructor = child; + childP._super = baseP; + + if (properties) { + assign$1(childP, properties); + } + } + + /** + * @private + * simple function bind + * @param {Function} fn + * @param {Object} context + * @returns {Function} + */ + function bindFn(fn, context) { + return function boundFn() { + return fn.apply(context, arguments); + }; + } + + /** + * @private + * Simple way to create a manager with a default set of recognizers. + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ + + var Hammer = + /*#__PURE__*/ + function () { + var Hammer = + /** + * @private + * @const {string} + */ + function Hammer(element, options) { + if (options === void 0) { + options = {}; + } + + return new Manager(element, _extends$1({ + recognizers: preset.concat() + }, options)); + }; + + Hammer.VERSION = "2.0.17-rc"; + Hammer.DIRECTION_ALL = DIRECTION_ALL; + Hammer.DIRECTION_DOWN = DIRECTION_DOWN; + Hammer.DIRECTION_LEFT = DIRECTION_LEFT; + Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT; + Hammer.DIRECTION_UP = DIRECTION_UP; + Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + Hammer.DIRECTION_NONE = DIRECTION_NONE; + Hammer.DIRECTION_DOWN = DIRECTION_DOWN; + Hammer.INPUT_START = INPUT_START; + Hammer.INPUT_MOVE = INPUT_MOVE; + Hammer.INPUT_END = INPUT_END; + Hammer.INPUT_CANCEL = INPUT_CANCEL; + Hammer.STATE_POSSIBLE = STATE_POSSIBLE; + Hammer.STATE_BEGAN = STATE_BEGAN; + Hammer.STATE_CHANGED = STATE_CHANGED; + Hammer.STATE_ENDED = STATE_ENDED; + Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED; + Hammer.STATE_CANCELLED = STATE_CANCELLED; + Hammer.STATE_FAILED = STATE_FAILED; + Hammer.Manager = Manager; + Hammer.Input = Input; + Hammer.TouchAction = TouchAction; + Hammer.TouchInput = TouchInput; + Hammer.MouseInput = MouseInput; + Hammer.PointerEventInput = PointerEventInput; + Hammer.TouchMouseInput = TouchMouseInput; + Hammer.SingleTouchInput = SingleTouchInput; + Hammer.Recognizer = Recognizer; + Hammer.AttrRecognizer = AttrRecognizer; + Hammer.Tap = TapRecognizer; + Hammer.Pan = PanRecognizer; + Hammer.Swipe = SwipeRecognizer; + Hammer.Pinch = PinchRecognizer; + Hammer.Rotate = RotateRecognizer; + Hammer.Press = PressRecognizer; + Hammer.on = addEventListeners; + Hammer.off = removeEventListeners; + Hammer.each = each; + Hammer.merge = merge; + Hammer.extend = extend; + Hammer.bindFn = bindFn; + Hammer.assign = assign$1; + Hammer.inherit = inherit; + Hammer.bindFn = bindFn; + Hammer.prefixed = prefixed; + Hammer.toArray = toArray; + Hammer.inArray = inArray; + Hammer.uniqueArray = uniqueArray; + Hammer.splitStr = splitStr; + Hammer.boolOrFn = boolOrFn; + Hammer.hasParent = hasParent; + Hammer.addEventListeners = addEventListeners; + Hammer.removeEventListeners = removeEventListeners; + Hammer.defaults = assign$1({}, defaults, { + preset: preset + }); + return Hammer; + }(); + + /* + 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); + } + } + + /* + Copyright (c) 2017 NAVER Corp. + @egjs/axes project is licensed under the MIT license + + @egjs/axes JavaScript library + https://github.com/naver/egjs-axes + + @version 2.7.1 + */ + + /*! ***************************************************************************** + 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); + }; + + function getInsidePosition(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 + + function isOutside(pos, range) { + return pos < range[0] || pos > range[1]; + } + function getDuration(distance, deceleration) { + var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero + + return duration < 100 ? 0 : duration; + } + function isCircularable(destPos, range, circular) { + return circular[1] && destPos > range[1] || circular[0] && destPos < range[0]; + } + function getCirculatedPos(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; + } + + /* eslint-disable no-new-func, no-nested-ternary */ + var win$1; + + if (typeof window === "undefined") { + // window is undefined in node.js + win$1 = { + navigator: { + userAgent: "" + } + }; + } else { + win$1 = window; + } + + function toArray$1(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; + } + 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$1(dummy.childNodes); + } else { + // Selector + el = toArray$1(document.querySelectorAll(param)); + } + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } else if (param === win$1) { + // window + el = param; + } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) { + // HTMLElement, Document + el = param; + } else if ("jQuery" in win$1 && 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$1.requestAnimationFrame || win$1.webkitRequestAnimationFrame; + var caf = win$1.cancelAnimationFrame || win$1.webkitCancelAnimationFrame; + + if (raf && !caf) { + var keyInfo_1 = {}; + var oldraf_1 = raf; + + raf = function (callback) { + function wrapCallback(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$1.setTimeout(function () { + callback(win$1.performance && win$1.performance.now && win$1.performance.now() || new Date().getTime()); + }, 16); + }; + + caf = win$1.clearTimeout; + } + /** + * A polyfill for the window.requestAnimationFrame() method. + * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame + * @private + */ + + + function requestAnimationFrame(fp) { + return raf(fp); + } + /** + * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method. + * @param {Number} key − The ID value returned through a call to the requestAnimationFrame() method. requestAnimationFrame() 메서드가 반환한 아이디 값 + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame + * @private + */ + + function cancelAnimationFrame(key) { + caf(key); + } + function map(obj, callback) { + var tranformed = {}; + + for (var k in obj) { + k && (tranformed[k] = callback(obj[k], k)); + } + + return tranformed; + } + function filter(obj, callback) { + var filtered = {}; + + for (var k in obj) { + k && callback(obj[k], k) && (filtered[k] = obj[k]); + } + + return filtered; + } + function every(obj, callback) { + for (var k in obj) { + if (k && !callback(obj[k], k)) { + return false; + } + } + + return true; + } + function equal(target, base) { + return every(target, function (v, k) { + return v === base[k]; + }); + } + var roundNumFunc = {}; + function roundNumber(num, roundUnit) { + // Cache for performance + if (!roundNumFunc[roundUnit]) { + roundNumFunc[roundUnit] = getRoundFunc(roundUnit); + } + + return roundNumFunc[roundUnit](num); + } + function roundNumbers(num, roundUnit) { + if (!num || !roundUnit) { + return num; + } + + var isNumber = typeof roundUnit === "number"; + return map(num, function (value, key) { + return roundNumber(value, isNumber ? roundUnit : roundUnit[key]); + }); + } + function getDecimalPlace(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; + } + function inversePow(n) { + // replace Math.pow(10, -n) to solve floating point issue. + // eg. Math.pow(10, -4) => 0.00009999999999999999 + return 1 / Math.pow(10, n); + } + function getRoundFunc(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; + }; + } + + function minMax(value, min, max) { + return Math.max(Math.min(value, max), min); + } + + var AnimationManager = + /*#__PURE__*/ + function () { + function AnimationManager(_a) { + var options = _a.options, + itm = _a.itm, + em = _a.em, + axm = _a.axm; + this.options = options; + this.itm = itm; + this.em = em; + this.axm = axm; + 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 minMax(duration, this.options.minimumDuration, this.options.maximumDuration); + }; + + __proto.createAnimationParam = function (pos, duration, option) { + var depaPos = this.axm.get(); + var destPos = pos; + var inputEvent = option && option.event || null; + return { + depaPos: depaPos, + destPos: destPos, + duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration), + delta: this.axm.getDelta(depaPos, destPos), + inputEvent: inputEvent, + input: option && option.input || null, + isTrusted: !!inputEvent, + done: this.animationEnd + }; + }; + + __proto.grab = function (axes, option) { + if (this._animateParam && axes.length) { + var orgPos_1 = this.axm.get(axes); + var pos = this.axm.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.em.triggerChange(pos, false, orgPos_1, option, !!option); + } + + this._animateParam = null; + this._raf && cancelAnimationFrame(this._raf); + this._raf = null; + this.em.triggerAnimationEnd(!!(option && 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.axm.get(); + var destPos = this.axm.map(pos, function (v, opt) { + return Math.min(opt.range[1], Math.max(opt.range[0], v)); + }); + this.animateTo(destPos, this.getDuration(pos, destPos), option); + }; + + __proto.animationEnd = function () { + var beforeParam = this.getEventInfo(); + this._animateParam = null; // for Circular + + var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + }); + Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + })); + this.itm.setInterrupt(false); + this.em.triggerAnimationEnd(!!beforeParam); + + if (this.axm.isOutside()) { + this.restore(beforeParam); + } else { + this.finish(!!beforeParam); + } + }; + + __proto.finish = function (isTrusted) { + this._animateParam = null; + this.itm.setInterrupt(false); + this.em.triggerFinish(isTrusted); + }; + + __proto.animateLoop = function (param, complete) { + if (param.duration) { + this._animateParam = __assign({}, param); + var info_1 = this._animateParam; + var self_1 = this; + var destPos_1 = info_1.destPos; + var prevPos_1 = info_1.depaPos; + var prevEasingPer_1 = 0; + var directions_1 = map(prevPos_1, function (value, key) { + return value <= destPos_1[key] ? 1 : -1; + }); + var originalIntendedPos_1 = map(destPos_1, function (v) { + return v; + }); + var prevTime_1 = new Date().getTime(); + info_1.startTime = prevTime_1; + + (function loop() { + self_1._raf = null; + var currentTime = new Date().getTime(); + var ratio = (currentTime - info_1.startTime) / param.duration; + var easingPer = self_1.easing(ratio); + var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) { + var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved. + // Recalculate the remaining distance. + // Fix the bouncing phenomenon by changing the range. + + var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular); + + if (nextPos !== circulatedPos) { + // circular + var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]); + destPos_1[key] -= rangeOffset; + prevPos_1[key] -= rangeOffset; + } + + return circulatedPos; + }); + var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1); + prevPos_1 = toPos; + prevTime_1 = currentTime; + prevEasingPer_1 = easingPer; + + if (easingPer >= 1) { + destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1); + + if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) { + self_1.em.triggerChange(destPos_1, true, prevPos_1); + } + + complete(); + return; + } else if (isCanceled) { + self_1.finish(false); + } else { + // animationEnd + self_1._raf = requestAnimationFrame(loop); + } + })(); + } else { + this.em.triggerChange(param.destPos, true); + 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 + + + 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.axm.getAxisOptions(key); + minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val))); + } + + return minRoundUnit || roundUnit; + }; + + __proto.getUserControll = function (param) { + var userWish = param.setTo(); + userWish.destPos = this.axm.get(userWish.destPos); + userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration); + return userWish; + }; + + __proto.animateTo = function (destPos, duration, option) { + var _this = this; + + var param = this.createAnimationParam(destPos, duration, option); + + var depaPos = __assign({}, param.depaPos); + + var retTrigger = this.em.triggerAnimationStart(param); // to control + + var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true. + + if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + })) { + console.warn("You can't stop the 'animation' event when 'circular' is true."); + } + + if (retTrigger && !equal(userWish.destPos, depaPos)) { + var inputEvent = option && option.event || null; + this.animateLoop({ + depaPos: depaPos, + destPos: userWish.destPos, + duration: userWish.duration, + delta: this.axm.getDelta(depaPos, userWish.destPos), + isTrusted: !!inputEvent, + inputEvent: inputEvent, + input: option && option.input || null + }, function () { + return _this.animationEnd(); + }); + } + }; + + __proto.easing = function (p) { + return p > 1 ? 1 : this.options.easing(p); + }; + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + var axes = Object.keys(pos); + this.grab(axes); + var orgPos = this.axm.get(axes); + + if (equal(pos, orgPos)) { + return this; + } + + this.itm.setInterrupt(true); + var movedPos = filter(pos, function (v, k) { + return orgPos[k] !== v; + }); + + if (!Object.keys(movedPos).length) { + return this; + } + + movedPos = this.axm.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.em.triggerChange(movedPos); + this.finish(false); + } + + return this; + }; + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) { + return v + pos[k]; + }), duration); + }; + + return AnimationManager; + }(); + + 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 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 + * @name eg.Axes#hold + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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.triggerHold = function (pos, option) { + var roundPos = this.getRoundPos(pos).roundPos; + this.axes.trigger("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일 경우에 동작한다 + * @name set + * @function + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("change", function(event) { + * event.holding && event.set({x: 10}); + * }); + */ + + /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events. + * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다. + * @name setTo + * @function + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("animationStart", function(event) { + * event.setTo({x: 10}, 2000); + * }); + */ + + /** + * This event is fired when a user release an element on the screen of the device. + * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 + * @name eg.Axes#release + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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} 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 + * 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("release", param); + }; + /** + * This event is fired when coordinate changes. + * @ko 좌표가 변경됐을 때 발생하는 이벤트 + * @name eg.Axes#change + * @event + * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체 + * @property {Object.} pos The coordinate 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @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 + * 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, isAccurate, depaPos, option, holding) { + if (holding === void 0) { + holding = false; + } + + var am = this.am; + var axm = am.axm; + var eventInfo = am.getEventInfo(); + + var _a = this.getRoundPos(pos, depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + var moveTo = axm.moveTo(roundPos, roundDepa); + var inputEvent = option && option.event || eventInfo && eventInfo.event || null; + var param = { + pos: moveTo.pos, + delta: moveTo.delta, + holding: holding, + inputEvent: inputEvent, + isTrusted: !!inputEvent, + input: option && option.input || eventInfo && eventInfo.input || null, + set: inputEvent ? this.createUserControll(moveTo.pos) : function () {} + }; + var result = this.axes.trigger("change", param); + inputEvent && axm.set(param.set()["destPos"]); + return result; + }; + /** + * This event is fired when animation starts. + * @ko 에니메이션이 시작할 때 발생한다. + * @name eg.Axes#animationStart + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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); + return this.axes.trigger("animationStart", param); + }; + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생한다. + * @name eg.Axes#animationEnd + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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("animationEnd", { + isTrusted: isTrusted + }); + }; + /** + * This event is fired when all actions have been completed. + * @ko 에니메이션이 끝났을 때 발생한다. + * @name eg.Axes#finish + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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("finish", { + isTrusted: isTrusted + }); + }; + + __proto.createUserControll = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } // to controll + + + var userControl = { + destPos: __assign({}, pos), + duration: duration + }; + return function (toPos, userDuration) { + toPos && (userControl.destPos = __assign({}, toPos)); + userDuration !== undefined && (userControl.duration = userDuration); + return userControl; + }; + }; + + __proto.setAnimationManager = function (am) { + this.am = am; + }; + + __proto.destroy = function () { + this.axes.off(); + }; + + __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) + }; + }; + + 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) { + !this.options.interruptable && (this._prevented = prevented); + }; + + return InterruptManager; + }(); + + var AxisManager = + /*#__PURE__*/ + function () { + function AxisManager(axis, options) { + var _this = this; + + this.axis = axis; + this.options = options; + + this._complementOptions(); + + this._pos = Object.keys(this.axis).reduce(function (acc, v) { + acc[v] = _this.axis[v].range[0]; + return acc; + }, {}); + } + /** + * set up 'css' expression + * @private + */ + + + var __proto = AxisManager.prototype; + + __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]; + } + }); + }); + }; + + __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({}, 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]; + }; + + return AxisManager; + }(); + + var InputObserver = + /*#__PURE__*/ + function () { + function InputObserver(_a) { + var options = _a.options, + itm = _a.itm, + em = _a.em, + axm = _a.axm, + am = _a.am; + this.isOutside = false; + this.moveDistance = null; + this.isStopped = false; + this.options = options; + this.itm = itm; + this.em = em; + this.axm = axm; + this.am = am; + } // when move pointer is held in outside + + + var __proto = InputObserver.prototype; + + __proto.atOutside = function (pos) { + var _this = this; + + if (this.isOutside) { + return this.axm.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 { + // when start pointer is held in inside + // get a initialization slope value to prevent smooth animation. + var initSlope_1 = this.am.easing(0.00001) / 0.00001; + return this.axm.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.am.easing((min - v) / (out[0] * initSlope_1)) * out[0]; + } else if (v > max) { + // right + return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1]; + } + + return v; + }); + } + }; + + __proto.get = function (input) { + return this.axm.get(input.axes); + }; + + __proto.hold = function (input, event) { + if (this.itm.isInterrupted() || !input.axes.length) { + return; + } + + var changeOption = { + input: input, + event: event + }; + this.isStopped = false; + this.itm.setInterrupt(true); + this.am.grab(input.axes, changeOption); + !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption); + this.isOutside = this.axm.isOutside(input.axes); + this.moveDistance = this.axm.get(input.axes); + }; + + __proto.change = function (input, event, offset) { + if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) { + return v === 0; + })) { + return; + } + + var depaPos = this.moveDistance || this.axm.get(input.axes); + var destPos; // for outside logic + + destPos = map(depaPos, function (v, k) { + return v + (offset[k] || 0); + }); + this.moveDistance && (this.moveDistance = destPos); // from outside to inside + + if (this.isOutside && this.axm.every(depaPos, function (v, opt) { + return !isOutside(v, opt.range); + })) { + this.isOutside = false; + } + + depaPos = this.atOutside(depaPos); + destPos = this.atOutside(destPos); + var isCanceled = !this.em.triggerChange(destPos, false, depaPos, { + input: input, + event: event + }, true); + + if (isCanceled) { + this.isStopped = true; + this.moveDistance = null; + this.am.finish(false); + } + }; + + __proto.release = function (input, event, offset, inputDuration) { + if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) { + return; + } + + var pos = this.axm.get(input.axes); + var depaPos = this.axm.get(); + var destPos = this.axm.get(this.axm.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); + } + })); + var duration = this.am.getDuration(destPos, pos, inputDuration); + + if (duration === 0) { + destPos = __assign({}, depaPos); + } // prepare params + + + var param = { + depaPos: depaPos, + destPos: destPos, + duration: duration, + delta: this.axm.getDelta(depaPos, destPos), + inputEvent: event, + input: input, + isTrusted: true + }; + this.em.triggerRelease(param); + this.moveDistance = null; // to contol + + var userWish = this.am.getUserControll(param); + var isEqual = equal(userWish.destPos, depaPos); + var changeOption = { + input: input, + event: event + }; + + if (isEqual || userWish.duration === 0) { + !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true); + this.itm.setInterrupt(false); + + if (this.axm.isOutside()) { + this.am.restore(changeOption); + } else { + this.em.triggerFinish(true); + } + } else { + this.am.animateTo(userWish.destPos, userWish.duration, changeOption); + } + }; + + return InputObserver; + }(); + + // export const DIRECTION_NONE = 1; + var IOS_EDGE_THRESHOLD = 30; + var IS_IOS_SAFARI = "ontouchstart" in win$1 && 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 ""; + }(); + + /** + * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. + * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @property {Number[]} [range] The coordinate of range 좌표 범위 + * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표 + * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표 + * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다 + * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기 + * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기 + * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to "true" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다 + * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부 + * @property {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 모듈의 옵션 객체 + * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수 + * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간 + * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간 + * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다 + * @property {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가 적용되지 않는다
+ * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
+ **/ + + /** + * @class eg.Axes + * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions. + * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다. + * @extends eg.Component + * + * @param {Object.} 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] 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 + * + * // 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 = {}; + } + + var _this = _super.call(this) || this; + + _this.axis = axis; + _this._inputs = []; + _this.options = __assign({ + easing: function easeOutCubic(x) { + return 1 - Math.pow(1 - x, 3); + }, + interruptable: true, + maximumDuration: Infinity, + minimumDuration: 0, + deceleration: 0.0006, + round: null + }, options); + _this.itm = new InterruptManager(_this.options); + _this.axm = new AxisManager(_this.axis, _this.options); + _this.em = new EventManager(_this); + _this.am = new AnimationManager(_this); + _this.io = new InputObserver(_this); + + _this.em.setAnimationManager(_this.am); + + startPos && _this.em.triggerChange(startPos); + return _this; + } + /** + * Connect the axis of eg.Axes to the inputType. + * @ko eg.Axes의 축과 inputType을 연결한다 + * @method eg.Axes#connect + * @param {(String[]|String)} axes The name of the axis to associate with inputType 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 + * 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); + } // check same element in hammer type for share + + + if ("hammer" in inputType) { + var targets = this._inputs.filter(function (v) { + return v.hammer && v.element === inputType.element; + }); + + if (targets.length) { + inputType.hammer = targets[0].hammer; + } + } + + inputType.mapAxes(mapped); + inputType.connect(this.io); + + this._inputs.push(inputType); + + return this; + }; + /** + * Disconnect the axis of eg.Axes from the inputType. + * @ko eg.Axes의 축과 inputType의 연결을 끊는다. + * @method eg.Axes#disconnect + * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * } + * }); + * + * const input1 = new eg.Axes.PanInput("#area1"); + * const input2 = new eg.Axes.PanInput("#area2"); + * const input3 = new eg.Axes.PanInput("#area3"); + * + * axes.connect("x", input1); + * .connect("x xOther", input2) + * .connect(["xOther", "x"], input3); + * + * axes.disconnect(input1); // disconnects input1 + * axes.disconnect(); // disconnects all of them + */ + + + __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 좌표의 현재 위치를 반환한다 + * @method eg.Axes#get + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Object.} Axis coordinate information 축 좌표 정보 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }); + * + * axes.get(); // {"x": 0, "xOther": -100, "zoom": 50} + * axes.get(["x", "zoom"]); // {"x": 0, "zoom": 50} + */ + + + __proto.get = function (axes) { + return this.axm.get(axes); + }; + /** + * Moves an axis to specific coordinates. + * @ko 좌표를 이동한다. + * @method eg.Axes#setTo + * @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 + * 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.am.setTo(pos, duration); + return this; + }; + /** + * Moves an axis from the current coordinates to specific coordinates. + * @ko 현재 좌표를 기준으로 좌표를 이동한다. + * @method eg.Axes#setBy + * @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 + * 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.am.setBy(pos, duration); + return this; + }; + /** + * Returns whether there is a coordinate in the bounce area of ​​the target axis. + * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다 + * @method eg.Axes#isBounceArea + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }); + * + * axes.isBounceArea(["x"]); + * axes.isBounceArea(["x", "zoom"]); + * axes.isBounceArea(); + */ + + + __proto.isBounceArea = function (axes) { + return this.axm.isOutside(axes); + }; + /** + * Destroys properties, and events used in a module and disconnect all connections to inputTypes. + * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다. + * @method eg.Axes#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + this.em.destroy(); + }; + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.Axes.VERSION; // ex) 3.3.3 + * @memberof eg.Axes + */ + + + Axes.VERSION = "2.7.1"; + /** + * @name eg.Axes.TRANSFORM + * @desc Returns the transform attribute with CSS vendor prefixes. + * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다. + * + * @constant + * @type {String} + * @example + * eg.Axes.TRANSFORM; // "transform" or "webkitTransform" + */ + + Axes.TRANSFORM = TRANSFORM; + /** + * @name eg.Axes.DIRECTION_NONE + * @constant + * @type {Number} + */ + + Axes.DIRECTION_NONE = DIRECTION_NONE; + /** + * @name eg.Axes.DIRECTION_LEFT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_LEFT = DIRECTION_LEFT; + /** + * @name eg.Axes.DIRECTION_RIGHT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_RIGHT = DIRECTION_RIGHT; + /** + * @name eg.Axes.DIRECTION_UP + * @constant + * @type {Number} + */ + + Axes.DIRECTION_UP = DIRECTION_UP; + /** + * @name eg.Axes.DIRECTION_DOWN + * @constant + * @type {Number} + */ + + Axes.DIRECTION_DOWN = DIRECTION_DOWN; + /** + * @name eg.Axes.DIRECTION_HORIZONTAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + /** + * @name eg.Axes.DIRECTION_VERTICAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + /** + * @name eg.Axes.DIRECTION_ALL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_ALL = DIRECTION_ALL; + return Axes; + }(Component); + + var SUPPORT_POINTER_EVENTS$1 = "PointerEvent" in win$1 || "MSPointerEvent" in win$1; + var SUPPORT_TOUCH$1 = ("ontouchstart" in win$1); + var UNIQUEKEY = "_EGJS_AXES_INPUTTYPE_"; + function toAxis(source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + } + function createHammer(element, options) { + try { + // create Hammer + return new Manager(element, __assign({}, options)); + } catch (e) { + return null; + } + } + function convertInputType(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$1; + break; + + case "pointer": + hasPointer = SUPPORT_POINTER_EVENTS$1; + // no default + } + }); + + if (hasPointer) { + return PointerEventInput; + } else if (hasTouch && hasMouse) { + return TouchMouseInput; + } else if (hasTouch) { + return TouchInput; + } else if (hasMouse) { + return MouseInput; + } + + return null; + } + + function getDirectionByAngle(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; + } + function getNextOffset(speeds, deceleration) { + var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]); + var duration = Math.abs(normalSpeed / -deceleration); + return [speeds[0] / 2 * duration, speeds[1] / 2 * duration]; + } + function useDirection(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 모듈의 옵션 객체 + * @property {String[]} [inputType=["touch","mouse", "pointer"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
+ * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율 + * @property {Number} [scale.1=1] vertical axis scale 수직축 배율 + * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90) + * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리 + * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px) + * @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager Hammer.Manager의 옵션 + **/ + + /** + * @class eg.Axes.PanInput + * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes. + * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다. + * + * @example + * const pan = new eg.Axes.PanInput("#area", { + * inputType: ["touch"], + * scale: [1, 1.3], + * }); + * + * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. + * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. + * axes.connect(["something2", "somethingN"], pan); // or axes.connect("something2 somethingN", pan); + * + * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. + * axes.connect(["something1"], pan); // or axes.connect("something1", pan); + * + * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. + * axes.connect(["", "something2"], pan); // or axes.connect(" something2", pan); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module 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) { + this.axes = []; + this.hammer = null; + this.element = null; + this.panRecognizer = null; + this.isRightEdge = false; + this.rightEdgeTimer = 0; + this.panFlag = false; + /** + * Hammer helps you add support for touch gestures to your page + * + * @external Hammer + * @see {@link http://hammerjs.github.io|Hammer.JS} + * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents} + * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS + */ + + if (typeof Manager === "undefined") { + throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/"); + } + + this.element = $(el); + this.options = __assign({ + inputType: ["touch", "mouse", "pointer"], + scale: [1, 1], + thresholdAngle: 45, + threshold: 0, + iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD, + hammerManagerOptions: { + // css properties were removed due to usablility issue + // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html + cssProps: { + userSelect: "none", + touchSelect: "none", + touchCallout: "none", + userDrag: "none" + } + } + }, options); + this.onHammerInput = this.onHammerInput.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) { + var hammerOption = { + direction: this._direction, + threshold: this.options.threshold + }; + + if (this.hammer) { + // for sharing hammer instance. + // hammer remove previous PanRecognizer. + this.removeRecognizer(); + this.dettachEvent(); + } else { + var keyValue = this.element[UNIQUEKEY]; + + if (!keyValue) { + keyValue = String(Math.round(Math.random() * new Date().getTime())); + } + + var inputClass = convertInputType(this.options.inputType); + + if (!inputClass) { + throw new Error("Wrong inputType parameter!"); + } + + this.hammer = createHammer(this.element, __assign({ + inputClass: inputClass + }, this.options.hammerManagerOptions)); + this.element[UNIQUEKEY] = keyValue; + } + + this.panRecognizer = new PanRecognizer(hammerOption); + this.hammer.add(this.panRecognizer); + this.attachEvent(observer); + return this; + }; + + __proto.disconnect = function () { + this.removeRecognizer(); + + if (this.hammer) { + this.dettachEvent(); + } + + this._direction = DIRECTION_NONE; + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.PanInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + + if (this.hammer && this.hammer.recognizers.length === 0) { + this.hammer.destroy(); + } + + delete this.element[UNIQUEKEY]; + this.element = null; + this.hammer = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.PanInput#enable + * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this.hammer && (this.hammer.get("pan").options.enable = true); + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.PanInput#disable + * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this.hammer && (this.hammer.get("pan").options.enable = false); + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.PanInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return !!(this.hammer && this.hammer.get("pan").options.enable); + }; + + __proto.removeRecognizer = function () { + if (this.hammer && this.panRecognizer) { + this.hammer.remove(this.panRecognizer); + this.panRecognizer = null; + } + }; + + __proto.onHammerInput = function (event) { + if (this.isEnable()) { + if (event.isFirst) { + this.panFlag = false; + + if (event.srcEvent.cancelable !== false) { + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + this.observer.hold(this, event); + this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold; + this.panFlag = true; + } + } else if (event.isFinal) { + this.onPanend(event); + } + } + }; + + __proto.onPanmove = function (event) { + var _this = this; + + if (!this.panFlag) { + return; + } + + var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start + + var prevInput = this.hammer.session.prevInput; + + if (prevInput && IS_IOS_SAFARI) { + var swipeLeftToRight = event.center.x < 0; + + if (swipeLeftToRight) { + // iOS swipe left => right + this.onPanend(__assign({}, prevInput, { + velocityX: 0, + velocityY: 0, + offsetX: 0, + offsetY: 0 + })); + return; + } else if (this.isRightEdge) { + clearTimeout(this.rightEdgeTimer); // - is right to left + + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + var swipeRightToLeft = event.deltaX < -edgeThreshold; + + if (swipeRightToLeft) { + this.isRightEdge = false; + } else { + // iOS swipe right => left + this.rightEdgeTimer = window.setTimeout(function () { + _this.onPanend(__assign({}, prevInput, { + velocityX: 0, + velocityY: 0, + offsetX: 0, + offsetY: 0 + })); + }, 100); + } + } + } + /* eslint-disable no-param-reassign */ + + + if (prevInput) { + event.offsetX = event.deltaX - prevInput.deltaX; + event.offsetY = event.deltaY - prevInput.deltaY; + } else { + event.offsetX = 0; + event.offsetY = 0; + } + + var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]); + var prevent = offset.some(function (v) { + return v !== 0; + }); + + if (prevent) { + var srcEvent = event.srcEvent; + + if (srcEvent.cancelable !== false) { + srcEvent.preventDefault(); + } + + srcEvent.stopPropagation(); + } + + event.preventSystemEvent = prevent; + prevent && this.observer.change(this, event, toAxis(this.axes, offset)); + }; + + __proto.onPanend = function (event) { + if (!this.panFlag) { + return; + } + + clearTimeout(this.rightEdgeTimer); + this.panFlag = false; + var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]); + offset = getNextOffset(offset, this.observer.options.deceleration); + this.observer.release(this, event, toAxis(this.axes, offset)); + }; + + __proto.attachEvent = function (observer) { + this.observer = observer; + this.hammer.on("hammer.input", this.onHammerInput).on("panstart panmove", this.onPanmove); + }; + + __proto.dettachEvent = function () { + this.hammer.off("hammer.input", this.onHammerInput).off("panstart panmove", this.onPanmove); + this.observer = null; + }; + + __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; + }; + + return PanInput; + }(); + + /** + * @class eg.Axes.RotatePanInput + * @classdesc 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 + * 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 eg.Axes.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.onHammerInput = function (event) { + if (this.isEnable()) { + if (event.isFirst) { + this.observer.hold(this, event); + this.onPanstart(event); + } else if (event.isFinal) { + this.onPanend(event); + } + } + }; + + __proto.onPanstart = function (event) { + var rect = this.element.getBoundingClientRect(); + /** + * Responsive + */ + // TODO: how to do if element is ellipse not circle. + + this.coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360 + // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin + + this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle. + + this.prevAngle = null; + this.triggerChange(event); + }; + + __proto.onPanmove = function (event) { + this.triggerChange(event); + }; + + __proto.onPanend = function (event) { + this.triggerChange(event); + this.triggerAnimation(event); + }; + + __proto.triggerChange = function (event) { + var angle = this.getAngle(event.center.x, event.center.y); + var quadrant = this.getQuadrant(event.center.x, event.center.y); + var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant); + this.prevAngle = angle; + this.prevQuadrant = quadrant; + + if (diff === 0) { + return; + } + + this.lastDiff = diff; + this.observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise + }; + + __proto.triggerAnimation = function (event) { + var vx = event.velocityX; + var vy = event.velocityY; + var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise + + var duration = Math.abs(velocity / -this.observer.options.deceleration); + var distance = velocity / 2 * duration; + this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle])); + }; + + __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.getAngle = function (posX, posY) { + var _a = this.getPosFromOrigin(posX, posY), + x = _a.x, + y = _a.y; + + var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y); + + return angle < 0 ? 360 + angle : angle; + }; + /** + * Quadrant + * y(+) + * | + * 2 | 1 + * --------------->x(+) + * 3 | 4 + * | + */ + + + __proto.getQuadrant = function (posX, posY) { + 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); + + /* + 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$1(arr, callback) { + var length = arr.length; + + for (var i = 0; i < length; ++i) { + if (callback(arr[i], i)) { + return true; + } + } + + return false; + } + function find$1(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$1(agent) { + var userAgent = agent; + + if (typeof userAgent === "undefined") { + if (typeof navigator === "undefined" || !navigator) { + return ""; + } + + userAgent = navigator.userAgent || ""; + } + + return userAgent.toLowerCase(); + } + function execRegExp$1(pattern, text) { + try { + return new RegExp(pattern, "g").exec(text); + } catch (e) { + return null; + } + } + function hasUserAgentData$1() { + 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$1(versionTest, userAgent) { + var result = execRegExp$1("(" + versionTest + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", userAgent); + return result ? result[3] : ""; + } + function convertVersion$1(text) { + return text.replace(/_/g, "."); + } + function findPreset$1(presets, userAgent) { + var userPreset = null; + var version = "-1"; + some$1(presets, function (preset) { + var result = execRegExp$1("(" + 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$1(preset.versionTest.toLowerCase(), userAgent) || version; + } + + version = convertVersion$1(version); + return true; + }); + return { + preset: userPreset, + version: version + }; + } + function findBrand$1(brands, preset) { + return find$1(brands, function (_a) { + var brand = _a.brand; + return execRegExp$1("" + preset.test, brand.toLowerCase()); + }); + } + + var BROWSER_PRESETS$1 = [{ + 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$1 = [{ + 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$1 = [{ + test: "applewebkit", + id: "webkit" + }]; + var WEBVIEW_PRESETS$1 = [{ + test: "(?=(iphone|ipad))(?!(.*version))", + id: "webview" + }, { + test: "(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))", + id: "webview" + }, { + // test webview + test: "webview", + id: "webview" + }]; + var OS_PRESETS$1 = [{ + 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$1(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$1(WEBVIEW_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }), + chromium: some$1(CHROMIUM_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }) + }; + var os = { + name: "unknown", + version: "-1", + majorVersion: -1 + }; + browser.webkit = !browser.chromium && some$1(WEBKIT_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }); + + if (osData) { + var platform_1 = osData.platform.toLowerCase(); + var result = find$1(OS_PRESETS$1, function (preset) { + return new RegExp("" + preset.test, "g").exec(platform_1); + }); + os.name = result ? result.id : platform_1; + os.version = osData.platformVersion; + } + + some$1(BROWSER_PRESETS$1, function (preset) { + var result = findBrand$1(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$1(os.version); + browser.version = convertVersion$1(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$1(userAgent) { + var nextAgent = getUserAgent$1(userAgent); + var isMobile = !!/mobi/g.exec(nextAgent); + var browser = { + name: "unknown", + version: "-1", + majorVersion: -1, + webview: !!findPreset$1(WEBVIEW_PRESETS$1, nextAgent).preset, + chromium: !!findPreset$1(CHROMIUM_PRESETS$1, nextAgent).preset, + webkit: false + }; + var os = { + name: "unknown", + version: "-1", + majorVersion: -1 + }; + + var _a = findPreset$1(BROWSER_PRESETS$1, nextAgent), + browserPreset = _a.preset, + browserVersion = _a.version; + + var _b = findPreset$1(OS_PRESETS$1, nextAgent), + osPreset = _b.preset, + osVersion = _b.version; + + browser.webkit = !browser.chromium && !!findPreset$1(WEBKIT_PRESETS$1, 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$1(userAgent) { + if (typeof userAgent === "undefined" && hasUserAgentData$1()) { + return parseUserAgentData$1(); + } else { + return parseUserAgent$1(userAgent); + } + } + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + /* eslint-disable no-new-func, no-nested-ternary */ + + var win$2 = typeof window !== "undefined" && window.Math === Math ? window : typeof self !== "undefined" && self.Math === Math ? self : Function("return this")(); + /* eslint-enable no-new-func, no-nested-ternary */ + + var doc = win$2.document; + var agent$2 = agent$1(); + var osName = agent$2.os.name; + var browserName = agent$2.browser.name; + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + win$2.Float32Array = typeof win$2.Float32Array !== "undefined" ? win$2.Float32Array : win$2.Array; + var Float32Array = win$2.Float32Array; + var getComputedStyle = win$2.getComputedStyle; + var userAgent = win$2.navigator.userAgent; + var DeviceMotionEvent = win$2.DeviceMotionEvent; + var devicePixelRatio = win$2.devicePixelRatio; + + var TRANSFORM$1 = function () { + var docStyle = doc.documentElement.style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in docStyle) { + return target[i]; + } + } + + return ""; + }(); // check for will-change support + + + var SUPPORT_WILLCHANGE = win$2.CSS && win$2.CSS.supports && win$2.CSS.supports("will-change", "transform"); + + var VERSION = "3.3.3"; + + /** + * @class eg.view360.SpriteImage + * @classdesc A module that displays a single or continuous image of any one of the "sprite images". SpinViewer internally uses SpriteImage to show each frame of the sprite image. + * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the "Sprite image". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
+ * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpriteImage + * + * var el = document.getElementById("image-div"); + * var sprites = new eg.view360.SpriteImage(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 + * }); + */ + + var SpriteImage = + /*#__PURE__*/ + function () { + var SpriteImage = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpriteImage, _Component); + + function SpriteImage(element, options) { + var _this; + + _this = _Component.call(this) || this; + var opt = options || {}; + _this._el = element; + _this._rowCount = opt.rowCount || 1; + _this._colCount = opt.colCount || 1; + _this._totalCount = _this._rowCount * _this._colCount; // total frames + + _this._width = opt.width || "auto"; + _this._height = opt.height || "auto"; + _this._autoHeight = opt.autoHeight != null ? opt.autoHeight : "true"; // If autoHeight is specified, _height will be overwritten. + + _this._colRow = [0, 0]; + + if (opt.colRow) { + _this._colRow = opt.colRow; + } else if (opt.frameIndex) { + _this.setFrameIndex(opt.frameIndex); + } + + _this._el.style.width = SpriteImage._getSizeString(_this._width); + _this._el.style.height = SpriteImage._getSizeString(_this._height); + + if (!opt.imageUrl) { + setTimeout(function () { + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }, 0); + return _assertThisInitialized(_this); + } + + _this._image = new Image(); + /** + * Event + */ + + _this._image.onload = function () { + _this._bg = SpriteImage._createBgDiv(_this._image, _this._rowCount, _this._colCount, _this._autoHeight); + + _this._el.appendChild(_this._bg); + + _this.setColRow(_this._colRow[0], _this._colRow[1]); + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpriteImage#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * sprites.on({ + * "load" : function(evt) { + * console.log("load event fired - e.target", e.target, "e.bgElement", e.bgElement); + * } + * }); + */ + + + _this.trigger("load", { + target: _this._el, + bgElement: _this._bg + }); + + if (_this._autoPlayReservedInfo) { + _this.play(_this._autoPlayReservedInfo); + + _this._autoPlayReservedInfo = null; + } + }; + + _this._image.onerror = function (e) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpriteImage#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * sprites.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }; + + _this._image.src = opt.imageUrl; + return _this; + } + + SpriteImage._createBgDiv = function _createBgDiv(img, rowCount, colCount, autoHeight) { + var el = document.createElement("div"); + el.style.position = "relative"; + el.style.overflow = "hidden"; + img.style.position = "absolute"; + img.style.width = colCount * 100 + "%"; + img.style.height = rowCount * 100 + "%"; + /** Prevent image from being dragged on IE10, IE11, Safari especially */ + + img.ondragstart = function () { + return false; + }; // img.style.pointerEvents = "none"; + // Use hardware accelerator if available + + + SUPPORT_WILLCHANGE && (img.style.willChange = "transform"); + el.appendChild(img); + var unitWidth = img.width / colCount; + var unitHeight = img.height / rowCount; + + if (autoHeight) { + var r = unitHeight / unitWidth; + el.style.paddingBottom = r * 100 + "%"; + } else { + el.style.height = "100%"; + } + + return el; + } + /** + * Specifies the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정 + * @method eg.view360.SpriteImage#setFrameIndex + * @param {Number} frameIndex frame index of a frame프레임의 인덱스 + * + * @example + * + * sprites.setFrameIndex(0, 1);// col = 0, row = 1 + */ + ; + + var _proto = SpriteImage.prototype; + + _proto.setFrameIndex = function setFrameIndex(index) { + var colRow = this.toColRow(index); + this.setColRow(colRow[0], colRow[1]); + } + /** + * Returns the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환 + * @method eg.view360.SpriteImage#getFrameIndex + * @return {Number} frame index frame 인덱스 + * + * @example + * + * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1 + * + */ + ; + + _proto.getFrameIndex = function getFrameIndex() { + return this._colRow[1] * this._colCount + this._colRow[0]; + } + /** + * Specifies the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정 + * @method eg.view360.SpriteImage#setColRow + * @param {Number} col Column number of a frame프레임의 행값 + * @param {Number} row Row number of a frame프레임의 열값 + * + * @example + * + * sprites.setlColRow(1, 2); // col = 1, row = 2 + */ + ; + + _proto.setColRow = function setColRow(col, row) { + if (row > this._rowCount - 1 || col > this._colCount - 1) { + return; + } + + if (this._image && TRANSFORM$1) { + // NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser? + this._image.style[TRANSFORM$1] = "translate(" + -(col / this._colCount * 100) + "%, " + -(row / this._rowCount * 100) + "%)"; + } + + this._colRow = [col, row]; + } + /** + * Returns the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환 + * @method eg.view360.SpriteImage#gelColRow + * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열 + * + * @example + * + * var colRow = sprites.getlColRow(); + * // colRow = [1, 2] - index of col is 1, index of row is 2 + * + */ + ; + + _proto.getColRow = function getColRow() { + return this._colRow; + }; + + SpriteImage._getSizeString = function _getSizeString(size) { + if (typeof size === "number") { + return size + "px"; + } + + return size; + } + /** + * Stop playing + * @ko play 되고 있던 프레임 재생을 중지합니다. + * @method eg.view360.SpriteImage#stop + * + * @example + * + * viewer.stop(); + * + */ + ; + + _proto.stop = function stop() { + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + } + /** + * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'. + * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다. + * @method eg.view360.SpriteImage#play + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위 + * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복 + * + * @example + * + * viewer.play({angle: 16, playCount: 1}); + * + */ + ; + + _proto.play = function play(_temp) { + var _this2 = this; + + var _ref = _temp === void 0 ? { + interval: 1000 / this._totalCount, + playCount: 0 + } : _temp, + interval = _ref.interval, + playCount = _ref.playCount; + + if (!this._bg) { + this._autoPlayReservedInfo = { + interval: interval, + playCount: playCount + }; + return; + } + + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + + var frameIndex = this.getFrameIndex(); + var count = 0; + var frameCount = 0; // for checking 1 cycle + + this._autoPlayTimer = setInterval(function () { + frameIndex %= _this2._totalCount; + + var colRow = _this2.toColRow(frameIndex); + + _this2.setColRow(colRow[0], colRow[1]); + + frameIndex++; // Done 1 Cycle? + + if (++frameCount === _this2._totalCount) { + frameCount = 0; + count++; + } + + if (playCount > 0 && count === playCount) { + clearInterval(_this2._autoPlayTimer); + } + }, interval); + }; + + _proto.toColRow = function toColRow(frameIndex) { + var colCount = this._colCount; + var rowCount = this._rowCount; + + if (frameIndex < 0) { + return [0, 0]; + } else if (frameIndex >= this._totalCount) { + return [colCount - 1, rowCount - 1]; + } + + var col = frameIndex % colCount; + var row = Math.floor(frameIndex / colCount); // console.log(frameIndex, col, row); + + return [col, row]; + }; + + return SpriteImage; + }(Component); + + SpriteImage.VERSION = VERSION; + return SpriteImage; + }(); + + var DEFAULT_PAN_SCALE = 0.21; + /** + * @class eg.view360.SpinViewer + * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object. + * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpinViewer + * var el = document.getElementById("product-360"); + * var viewer = new eg.view360.SpinViewer(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 //required + * }); + */ + + var SpinViewer = + /*#__PURE__*/ + function () { + var SpinViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpinViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.SpinViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.SpinViewer + */ + function SpinViewer(element, options) { + var _this; + + _this = _Component.call(this) || this; + _this._el = element; + + var opt = _extends({}, options); + + var colCount = opt.colCount || 1; + var rowCount = opt.rowCount || 1; + _this._scale = opt.scale || 1; + _this._panScale = _this._scale * DEFAULT_PAN_SCALE; + _this._frameCount = colCount * rowCount; // Init SpriteImage + + _this._sprites = new SpriteImage(element, opt).on({ + "load": function load(evt) { + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpinViewer#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * viwer.on({ + * "load" : function(evt) { + * this.spinBy(360, {duration: 300}); + * } + * }); + */ + _this.trigger("load", evt); + }, + "imageError": function imageError(evt) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * viewer.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: evt.imageUrl + }); + } + }); // Init Axes + + _this._panInput = new PanInput(_this._el, { + scale: [_this._panScale, _this._panScale] + }); + _this._axes = new Axes({ + angle: { + range: [0, 359], + circular: true + } + }).on({ + "change": function change(evt) { + var curr = Math.floor(evt.pos.angle / (360 / _this._frameCount)); + var frameIndex = _this._frameCount - curr - 1; + + _this._sprites.setFrameIndex(frameIndex); + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#change + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row + * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값 + * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님) + * + * @example + * + * viwer.on({ + * "change" : function(evt) { + * console.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30 + * } + * }); + */ + + + _this.trigger("change", { + frameIndex: frameIndex, + colRow: _this._sprites.getColRow(), + angle: evt.pos.angle + }); + }, + "animationEnd": function animationEnd(evt) { + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생하는 이벤트 + * @name eg.view360.SpinViewer#animationEnd + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Boolean} param.isTrusted 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 + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // evt.isTrusted === true or false + * } + * }); + */ + _this.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + + _this._axes.connect("angle", _this._panInput); + + return _this; + } + /** + * Set spin scale + * @ko scale 을 조정할 수 있는 함수 + * @method eg.view360.SpinViewer#setScale + * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.setScale(2);// It moves twice as much. + */ + + + var _proto = SpinViewer.prototype; + + _proto.setScale = function setScale(scale) { + if (isNaN(scale) || scale < 0) { + return this; + } + + this._scale = scale; + this._panScale = scale * DEFAULT_PAN_SCALE; + this._panInput.options.scale = [this._panScale, this._panScale]; + return this; + } + /** + * Get spin scale + * @ko scale 값을 반환한다. + * @method eg.view360.SpinViewer#getScale + * + * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @example + * + * viewer.getScale();// It returns number + */ + ; + + _proto.getScale = function getScale() { + return this._scale; + } + /** + * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle. + * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinBy + * + * @param {Number} [angle = 0] angle상대적 회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinBy(720, {duration: 500}); + */ + ; + + _proto.spinBy = function spinBy(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setBy({ + angle: angle + }, param.duration); + + return this; + } + /** + * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle). + * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinTo + * + * @param {Number} [angle = 0] angle회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinTo(30, {duration:100}); + */ + ; + + _proto.spinTo = function spinTo(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setTo({ + angle: angle + }, param.duration); + + return this; + } + /** + * Returns current angles + * @ko 현재 각도를 반환한다. + * + * @return {Number} Current angle 현재 각도 + */ + ; + + _proto.getAngle = function getAngle() { + return this._axes.get().angle || 0; + }; + + return SpinViewer; + }(Component); + + SpinViewer.VERSION = VERSION; + return SpinViewer; + }(); + + exports.SpinViewer = SpinViewer; + exports.SpriteImage = SpriteImage; + exports.VERSION = VERSION; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=view360.spinviewer.pkgd.js.map diff --git a/dist/SpinViewer/view360.spinviewer.pkgd.js.map b/dist/SpinViewer/view360.spinviewer.pkgd.js.map new file mode 100644 index 000000000..a22f1c462 --- /dev/null +++ b/dist/SpinViewer/view360.spinviewer.pkgd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.spinviewer.pkgd.js","sources":["../../node_modules/@egjs/component/dist/component.esm.js","../../node_modules/@egjs/hammerjs/dist/hammer.esm.js","../../node_modules/@egjs/axes/node_modules/@egjs/agent/dist/agent.esm.js","../../node_modules/@egjs/axes/dist/axes.esm.js","../../node_modules/@egjs/agent/dist/agent.esm.js","../../src/utils/browser.js","../../src/utils/browserFeature.js","../../src/version.js","../../src/SpinViewer/SpriteImage.js","../../src/SpinViewer/SpinViewer.js"],"sourcesContent":["/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/component project is licensed under the MIT license\n\n@egjs/component JavaScript library\nhttps://naver.github.io/egjs-component\n\n@version 2.1.2\n*/\n/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\n/**\n * A class used to manage events in a component\n * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스\n * @alias eg.Component\n */\n\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Component.VERSION; // ex) 2.0.0\n * @memberof eg.Component\n */\n\n /**\n * @support {\"ie\": \"7+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n */\n function Component() {\n this._eventHandler = {};\n this.options = {};\n }\n /**\n * Triggers a custom event.\n * @ko 커스텀 이벤트를 발생시킨다\n * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름\n * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터\n * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고\n * @example\n class Some extends eg.Component {\n some(){\n \tif(this.trigger(\"beforeHi\")){ // When event call to stop return false.\n \tthis.trigger(\"hi\");// fire hi event.\n \t}\n }\n }\n const some = new Some();\n some.on(\"beforeHi\", (e) => {\n if(condition){\n \te.stop(); // When event call to stop, `hi` event not call.\n }\n });\n some.on(\"hi\", (e) => {\n // `currentTarget` is component instance.\n console.log(some === e.currentTarget); // true\n });\n // If you want to more know event design. You can see article.\n // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F\n */\n\n\n var _proto = Component.prototype;\n\n _proto.trigger = function trigger(eventName, customEvent) {\n if (customEvent === void 0) {\n customEvent = {};\n }\n\n var handlerList = this._eventHandler[eventName] || [];\n var hasHandlerList = handlerList.length > 0;\n\n if (!hasHandlerList) {\n return true;\n } // If detach method call in handler in first time then handler list calls.\n\n\n handlerList = handlerList.concat();\n customEvent.eventType = eventName;\n var isCanceled = false;\n var arg = [customEvent];\n var i = 0;\n\n customEvent.stop = function () {\n isCanceled = true;\n };\n\n customEvent.currentTarget = this;\n\n for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n restParam[_key - 2] = arguments[_key];\n }\n\n if (restParam.length >= 1) {\n arg = arg.concat(restParam);\n }\n\n for (i = 0; handlerList[i]; i++) {\n handlerList[i].apply(this, arg);\n }\n\n return !isCanceled;\n };\n /**\n * Executed event just one time.\n * @ko 이벤트가 한번만 실행된다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n alert(\"hi\");\n }\n thing() {\n this.once(\"hi\", this.hi);\n }\n }\n var some = new Some();\n some.thing();\n some.trigger(\"hi\");\n // fire alert(\"hi\");\n some.trigger(\"hi\");\n // Nothing happens\n */\n\n\n _proto.once = function once(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var i;\n\n for (i in eventHash) {\n this.once(i, eventHash[i]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var self = this;\n this.on(eventName, function listener() {\n for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arg[_key2] = arguments[_key2];\n }\n\n handlerToAttach.apply(self, arg);\n self.off(eventName, listener);\n });\n }\n\n return this;\n };\n /**\n * Checks whether an event has been attached to a component.\n * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다.\n * @param {String} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름\n * @return {Boolean} Indicates whether the event is attached. 이벤트 등록 여부\n * @example\n class Some extends eg.Component {\n some() {\n this.hasOn(\"hi\");// check hi event.\n }\n }\n */\n\n\n _proto.hasOn = function hasOn(eventName) {\n return !!this._eventHandler[eventName];\n };\n /**\n * Attaches an event to a component.\n * @ko 컴포넌트에 이벤트를 등록한다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.on(\"hi\",this.hi); //attach event\n }\n }\n */\n\n\n _proto.on = function on(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.on(name, eventHash[name]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var handlerList = this._eventHandler[eventName];\n\n if (isUndefined(handlerList)) {\n this._eventHandler[eventName] = [];\n handlerList = this._eventHandler[eventName];\n }\n\n handlerList.push(handlerToAttach);\n }\n\n return this;\n };\n /**\n * Detaches an event from the component.\n * @ko 컴포넌트에 등록된 이벤트를 해제한다\n * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름\n * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.off(\"hi\",this.hi); //detach event\n }\n }\n */\n\n\n _proto.off = function off(eventName, handlerToDetach) {\n // All event detach.\n if (isUndefined(eventName)) {\n this._eventHandler = {};\n return this;\n } // All handler of specific event detach.\n\n\n if (isUndefined(handlerToDetach)) {\n if (typeof eventName === \"string\") {\n this._eventHandler[eventName] = undefined;\n return this;\n } else {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.off(name, eventHash[name]);\n }\n\n return this;\n }\n } // The handler of specific event detach.\n\n\n var handlerList = this._eventHandler[eventName];\n\n if (handlerList) {\n var k;\n var handlerFunction;\n\n for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) {\n if (handlerFunction === handlerToDetach) {\n handlerList = handlerList.splice(k, 1);\n break;\n }\n }\n }\n\n return this;\n };\n\n return Component;\n }();\n\n Component.VERSION = \"2.1.2\";\n return Component;\n}();\n\nexport default Component;\n//# sourceMappingURL=component.esm.js.map\n","/*! Hammer.JS - v2.0.17-rc - 2019-12-16\n * http://naver.github.io/egjs\n *\n * Forked By Naver egjs\n * Copyright (c) hammerjs\n * Licensed under the MIT license */\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\n\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\nvar assign$1 = assign;\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = typeof document === \"undefined\" ? {\n style: {}\n} : document.createElement('div');\nvar TYPE_FUNCTION = 'function';\nvar round = Math.round,\n abs = Math.abs;\nvar now = Date.now;\n\n/**\n * @private\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n\nfunction prefixed(obj, property) {\n var prefix;\n var prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n\n i++;\n }\n\n return undefined;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {};\n} else {\n win = window;\n}\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\nfunction getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n\n var touchMap = {};\n var cssSupports = win.CSS && win.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n}\n\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\nvar TOUCH_ACTION_MAP = getTouchActionProps();\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\nvar SUPPORT_TOUCH = 'ontouchstart' in win;\nvar SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\nvar COMPUTE_INTERVAL = 25;\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * @private\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * @private\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n\nfunction boolOrFn(val, args) {\n if (typeof val === TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n\n return val;\n}\n\n/**\n * @private\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * @private\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n } // pan-x OR pan-y\n\n\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n } // manipulation\n\n\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * @private\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n\nvar TouchAction =\n/*#__PURE__*/\nfunction () {\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n /**\n * @private\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n\n\n var _proto = TouchAction.prototype;\n\n _proto.set = function set(value) {\n // find out the touch-action by the event handlers\n if (value === TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n\n this.actions = value.toLowerCase().trim();\n };\n /**\n * @private\n * just re-set the touchAction value\n */\n\n\n _proto.update = function update() {\n this.set(this.manager.options.touchAction);\n };\n /**\n * @private\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n\n\n _proto.compute = function compute() {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n };\n /**\n * @private\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n\n\n _proto.preventDefaults = function preventDefaults(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection; // if the touch action did prevented once this session\n\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n\n if (hasNone) {\n // do not prevent defaults if this is a tap gesture\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {\n return this.preventSrc(srcEvent);\n }\n };\n /**\n * @private\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n\n\n _proto.preventSrc = function preventSrc(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n };\n\n return TouchAction;\n}();\n\n/**\n * @private\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node === parent) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}\n\n/**\n * @private\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n\nfunction getCenter(pointers) {\n var pointersLength = pointers.length; // no need to loop when only one touch\n\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0;\n var y = 0;\n var i = 0;\n\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * @private\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * @private\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * @private\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * @private\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session;\n // jscs throwing error on defalut destructured values and without defaults tests fail\n\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * @private\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * @private\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input;\n var deltaTime = input.timeStamp - last.timeStamp;\n var velocity;\n var velocityX;\n var velocityY;\n var direction;\n\n if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n* @private\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length; // store the first input to calculate the distance and direction\n\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n } // to compute scale and rotation we need to store the multiple touches\n\n\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput,\n firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;\n computeIntervalInputData(session, input); // find the correct target\n\n var target = manager.element;\n var srcEvent = input.srcEvent;\n var srcEventTarget;\n\n if (srcEvent.composedPath) {\n srcEventTarget = srcEvent.composedPath()[0];\n } else if (srcEvent.path) {\n srcEventTarget = srcEvent.path[0];\n } else {\n srcEventTarget = srcEvent.target;\n }\n\n if (hasParent(srcEventTarget, target)) {\n target = srcEventTarget;\n }\n\n input.target = target;\n}\n\n/**\n * @private\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n } // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n\n\n input.eventType = eventType; // compute scale, rotation etc\n\n computeInputData(manager, input); // emit secret event\n\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * @private\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * @private\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n}\n\n/**\n * @private\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n\nvar Input =\n/*#__PURE__*/\nfunction () {\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n }\n /**\n * @private\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n\n\n var _proto = Input.prototype;\n\n _proto.handler = function handler() {};\n /**\n * @private\n * bind the events\n */\n\n\n _proto.init = function init() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n /**\n * @private\n * unbind the events\n */\n\n\n _proto.destroy = function destroy() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n\n return Input;\n}();\n\n/**\n * @private\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n\n while (i < src.length) {\n if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {\n // do not use === here, test fails\n return i;\n }\n\n i++;\n }\n\n return -1;\n }\n}\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n}; // in IE10 the pointer types is defined as an enum\n\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\n};\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive\n\nif (win.MSPointerEvent && !win.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n/**\n * @private\n * Pointer events input\n * @constructor\n * @extends Input\n */\n\n\nvar PointerEventInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(PointerEventInput, _Input);\n\n function PointerEventInput() {\n var _this;\n\n var proto = PointerEventInput.prototype;\n proto.evEl = POINTER_ELEMENT_EVENTS;\n proto.evWin = POINTER_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.store = _this.manager.session.pointerEvents = [];\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = PointerEventInput.prototype;\n\n _proto.handler = function handler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store\n\n var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down\n\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n } // it not found, so the pointer hasn't been down (so it's probably a hover)\n\n\n if (storeIndex < 0) {\n return;\n } // update the event in the store\n\n\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n };\n\n return PointerEventInput;\n}(Input);\n\n/**\n * @private\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * @private\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function (a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n\nvar TouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(TouchInput, _Input);\n\n function TouchInput() {\n var _this;\n\n TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS;\n\n return _this;\n }\n\n var _proto = TouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return TouchInput;\n}(Input);\n\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds; // when there is only one touch, the process can be simplified\n\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i;\n var targetTouches;\n var changedTouches = toArray(ev.changedTouches);\n var changedTargetTouches = [];\n var target = this.target; // get target touches from touches\n\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n }); // collect touches\n\n if (type === INPUT_START) {\n i = 0;\n\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n } // filter changed touches to only contain touches that exist in the collected target ids\n\n\n i = 0;\n\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n } // cleanup removed touches\n\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n/**\n * @private\n * Mouse events input\n * @constructor\n * @extends Input\n */\n\nvar MouseInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(MouseInput, _Input);\n\n function MouseInput() {\n var _this;\n\n var proto = MouseInput.prototype;\n proto.evEl = MOUSE_ELEMENT_EVENTS;\n proto.evWin = MOUSE_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.pressed = false; // mousedown state\n\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = MouseInput.prototype;\n\n _proto.handler = function handler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down\n\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n } // mouse must be down\n\n\n if (!this.pressed) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n };\n\n return MouseInput;\n}(Input);\n\n/**\n * @private\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\nvar DEDUP_TIMEOUT = 2500;\nvar DEDUP_DISTANCE = 25;\n\nfunction setLastTouch(eventData) {\n var _eventData$changedPoi = eventData.changedPointers,\n touch = _eventData$changedPoi[0];\n\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {\n x: touch.clientX,\n y: touch.clientY\n };\n var lts = this.lastTouches;\n this.lastTouches.push(lastTouch);\n\n var removeLastTouch = function removeLastTouch() {\n var i = lts.indexOf(lastTouch);\n\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n}\n\nfunction recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n}\n\nfunction isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX;\n var y = eventData.srcEvent.clientY;\n\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x);\n var dy = Math.abs(y - t.y);\n\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n\n return false;\n}\n\nvar TouchMouseInput =\n/*#__PURE__*/\nfunction () {\n var TouchMouseInput =\n /*#__PURE__*/\n function (_Input) {\n _inheritsLoose(TouchMouseInput, _Input);\n\n function TouchMouseInput(_manager, callback) {\n var _this;\n\n _this = _Input.call(this, _manager, callback) || this;\n\n _this.handler = function (manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;\n var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;\n\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n } // when we're in a touch event, record touches to de-dupe synthetic mouse event\n\n\n if (isTouch) {\n recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) {\n return;\n }\n\n _this.callback(manager, inputEvent, inputData);\n };\n\n _this.touch = new TouchInput(_this.manager, _this.handler);\n _this.mouse = new MouseInput(_this.manager, _this.handler);\n _this.primaryTouch = null;\n _this.lastTouches = [];\n return _this;\n }\n /**\n * @private\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n\n\n var _proto = TouchMouseInput.prototype;\n\n /**\n * @private\n * remove the event listeners\n */\n _proto.destroy = function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n };\n\n return TouchMouseInput;\n }(Input);\n\n return TouchMouseInput;\n}();\n\n/**\n * @private\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n\nfunction createInputInstance(manager) {\n var Type; // let inputClass = manager.options.inputClass;\n\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n\n return new Type(manager, inputHandler);\n}\n\n/**\n * @private\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n\n return false;\n}\n\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * @private\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * @private\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n\n if (manager) {\n return manager.get(otherRecognizer);\n }\n\n return otherRecognizer;\n}\n\n/**\n * @private\n * get a usable string, used as event postfix\n * @param {constant} state\n * @returns {String} state\n */\n\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n\n return '';\n}\n\n/**\n * @private\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n\n/**\n * @private\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n\nvar Recognizer =\n/*#__PURE__*/\nfunction () {\n function Recognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.options = _extends({\n enable: true\n }, options);\n this.id = uniqueId();\n this.manager = null; // default is enable true\n\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n\n\n var _proto = Recognizer.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state\n\n this.manager && this.manager.touchAction.update();\n return this;\n };\n /**\n * @private\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.recognizeWith = function recognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n };\n /**\n * @private\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.requireFailure = function requireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n\n return this;\n };\n /**\n * @private\n * has require failures boolean\n * @returns {boolean}\n */\n\n\n _proto.hasRequireFailures = function hasRequireFailures() {\n return this.requireFail.length > 0;\n };\n /**\n * @private\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n\n\n _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n };\n /**\n * @private\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n\n\n _proto.emit = function emit(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n } // 'panstart' and 'panmove'\n\n\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n } // panend and pancancel\n\n\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n };\n /**\n * @private\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n\n\n _proto.tryEmit = function tryEmit(input) {\n if (this.canEmit()) {\n return this.emit(input);\n } // it's failing anyway\n\n\n this.state = STATE_FAILED;\n };\n /**\n * @private\n * can we emit?\n * @returns {boolean}\n */\n\n\n _proto.canEmit = function canEmit() {\n var i = 0;\n\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n\n i++;\n }\n\n return true;\n };\n /**\n * @private\n * update the recognizer\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing?\n\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n } // reset when we've reached the end\n\n\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone); // the recognizer has recognized a gesture\n // so trigger an event\n\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n };\n /**\n * @private\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {constant} STATE\n */\n\n /* jshint ignore:start */\n\n\n _proto.process = function process(inputData) {};\n /* jshint ignore:end */\n\n /**\n * @private\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n\n\n _proto.getTouchAction = function getTouchAction() {};\n /**\n * @private\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n\n\n _proto.reset = function reset() {};\n\n return Recognizer;\n}();\n\n/**\n * @private\n * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n\nvar TapRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(TapRecognizer, _Recognizer);\n\n function TapRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n // max time between the multi-tap taps\n time: 250,\n // max time of the pointer to be down (like finger on the screen)\n threshold: 9,\n // a minimal movement is ok, but keep it low\n posThreshold: 10\n }, options)) || this; // previous time and center,\n // used for tap counting\n\n _this.pTime = false;\n _this.pCenter = false;\n _this._timer = null;\n _this._input = null;\n _this.count = 0;\n return _this;\n }\n\n var _proto = TapRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_MANIPULATION];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n\n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n } // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType !== INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input; // if tap count matches we have recognized it,\n // else it has began recognizing...\n\n var tapCount = this.count % options.taps;\n\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.interval);\n return STATE_BEGAN;\n }\n }\n }\n\n return STATE_FAILED;\n };\n\n _proto.failTimeout = function failTimeout() {\n var _this3 = this;\n\n this._timer = setTimeout(function () {\n _this3.state = STATE_FAILED;\n }, this.options.interval);\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit() {\n if (this.state === STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return TapRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n\nvar AttrRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(AttrRecognizer, _Recognizer);\n\n function AttrRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _Recognizer.call(this, _extends({\n pointers: 1\n }, options)) || this;\n }\n /**\n * @private\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n\n\n var _proto = AttrRecognizer.prototype;\n\n _proto.attrTest = function attrTest(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n };\n /**\n * @private\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n\n\n _proto.process = function process(input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED\n\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n\n return state | STATE_CHANGED;\n }\n\n return STATE_FAILED;\n };\n\n return AttrRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * direction cons to string\n * @param {constant} direction\n * @returns {String}\n */\n\nfunction directionStr(direction) {\n if (direction === DIRECTION_DOWN) {\n return 'down';\n } else if (direction === DIRECTION_UP) {\n return 'up';\n } else if (direction === DIRECTION_LEFT) {\n return 'left';\n } else if (direction === DIRECTION_RIGHT) {\n return 'right';\n }\n\n return '';\n}\n\n/**\n * @private\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PanRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PanRecognizer, _AttrRecognizer);\n\n function PanRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _AttrRecognizer.call(this, _extends({\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n }, options)) || this;\n _this.pX = null;\n _this.pY = null;\n return _this;\n }\n\n var _proto = PanRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n var direction = this.options.direction;\n var actions = [];\n\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n\n return actions;\n };\n\n _proto.directionTest = function directionTest(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY; // lock to axis?\n\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x !== this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y !== this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n };\n\n _proto.attrTest = function attrTest(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call\n this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));\n };\n\n _proto.emit = function emit(input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PanRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar SwipeRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(SwipeRecognizer, _AttrRecognizer);\n\n function SwipeRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n }, options)) || this;\n }\n\n var _proto = SwipeRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n };\n\n _proto.attrTest = function attrTest(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n };\n\n _proto.emit = function emit(input) {\n var direction = directionStr(input.offsetDirection);\n\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n };\n\n return SwipeRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PinchRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PinchRecognizer, _AttrRecognizer);\n\n function PinchRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'pinch',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = PinchRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n _proto.emit = function emit(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PinchRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar RotateRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(RotateRecognizer, _AttrRecognizer);\n\n function RotateRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'rotate',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = RotateRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n return RotateRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n\nvar PressRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(PressRecognizer, _Recognizer);\n\n function PressRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'press',\n pointers: 1,\n time: 251,\n // minimal time of the pointer to be pressed\n threshold: 9\n }, options)) || this;\n _this._timer = null;\n _this._input = null;\n return _this;\n }\n\n var _proto = PressRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_AUTO];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input; // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.time);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + \"up\", input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return PressRecognizer;\n}(Recognizer);\n\nvar defaults = {\n /**\n * @private\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * @private\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @private\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * @private\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * @private\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * @private\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * @private\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: \"none\",\n\n /**\n * @private\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: \"none\",\n\n /**\n * @private\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: \"none\",\n\n /**\n * @private\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: \"none\",\n\n /**\n * @private\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: \"none\",\n\n /**\n * @private\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: \"rgba(0,0,0,0)\"\n }\n};\n/**\n * @private\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * This is separated with other defaults because of tree-shaking.\n * @type {Array}\n */\n\nvar preset = [[RotateRecognizer, {\n enable: false\n}], [PinchRecognizer, {\n enable: false\n}, ['rotate']], [SwipeRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}], [PanRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}, ['swipe']], [TapRecognizer], [TapRecognizer, {\n event: 'doubletap',\n taps: 2\n}, ['tap']], [PressRecognizer]];\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n/**\n * @private\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n\n if (!element.style) {\n return;\n }\n\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || \"\";\n }\n });\n\n if (!add) {\n manager.oldCssProps = {};\n }\n}\n/**\n * @private\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n\n\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent(\"Event\");\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n/**\n* @private\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\n\nvar Manager =\n/*#__PURE__*/\nfunction () {\n function Manager(element, options) {\n var _this = this;\n\n this.options = assign$1({}, defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = _this.add(new item[0](item[1]));\n\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n\n\n var _proto = Manager.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // Options that need a little more setup\n\n if (options.touchAction) {\n this.touchAction.update();\n }\n\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n\n return this;\n };\n /**\n * @private\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n\n\n _proto.stop = function stop(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n };\n /**\n * @private\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n var session = this.session;\n\n if (session.stopped) {\n return;\n } // run the touch-action polyfill\n\n\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers; // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n\n var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized\n // or when we're in a new session\n\n if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {\n session.curRecognizer = null;\n curRecognizer = null;\n }\n\n var i = 0;\n\n while (i < recognizers.length) {\n recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer === curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n\n\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n session.curRecognizer = recognizer;\n curRecognizer = recognizer;\n }\n\n i++;\n }\n };\n /**\n * @private\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n\n\n _proto.get = function get(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event === recognizer) {\n return recognizers[i];\n }\n }\n\n return null;\n };\n /**\n * @private add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n\n\n _proto.add = function add(recognizer) {\n if (invokeArrayArg(recognizer, \"add\", this)) {\n return this;\n } // remove existing\n\n\n var existing = this.get(recognizer.options.event);\n\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n };\n /**\n * @private\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n\n\n _proto.remove = function remove(recognizer) {\n if (invokeArrayArg(recognizer, \"remove\", this)) {\n return this;\n }\n\n var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists\n\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, targetRecognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n };\n /**\n * @private\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n\n\n _proto.on = function on(events, handler) {\n if (events === undefined || handler === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n };\n /**\n * @private unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n\n\n _proto.off = function off(events, handler) {\n if (events === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n };\n /**\n * @private emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n\n\n _proto.emit = function emit(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n } // no handlers, so skip it all\n\n\n var handlers = this.handlers[event] && this.handlers[event].slice();\n\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n };\n /**\n * @private\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n\n\n _proto.destroy = function destroy() {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n };\n\n return Manager;\n}();\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Touch events input\n * @constructor\n * @extends Input\n */\n\nvar SingleTouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(SingleTouchInput, _Input);\n\n function SingleTouchInput() {\n var _this;\n\n var proto = SingleTouchInput.prototype;\n proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.started = false;\n return _this;\n }\n\n var _proto = SingleTouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?\n\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state\n\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return SingleTouchInput;\n}(Input);\n\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\n/**\n * @private\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = \"DEPRECATED METHOD: \" + name + \"\\n\" + message + \" AT \\n\";\n return function () {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '').replace(/^\\s+at\\s+/gm, '').replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n\n return method.apply(this, arguments);\n };\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n\nvar extend = deprecate(function (dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n\n while (i < keys.length) {\n if (!merge || merge && dest[keys[i]] === undefined) {\n dest[keys[i]] = src[keys[i]];\n }\n\n i++;\n }\n\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * @private\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n\nvar merge = deprecate(function (dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * @private\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n\nfunction inherit(child, base, properties) {\n var baseP = base.prototype;\n var childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign$1(childP, properties);\n }\n}\n\n/**\n * @private\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * @private\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\nvar Hammer =\n/*#__PURE__*/\nfunction () {\n var Hammer =\n /**\n * @private\n * @const {string}\n */\n function Hammer(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n return new Manager(element, _extends({\n recognizers: preset.concat()\n }, options));\n };\n\n Hammer.VERSION = \"2.0.17-rc\";\n Hammer.DIRECTION_ALL = DIRECTION_ALL;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.DIRECTION_LEFT = DIRECTION_LEFT;\n Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;\n Hammer.DIRECTION_UP = DIRECTION_UP;\n Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n Hammer.DIRECTION_NONE = DIRECTION_NONE;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.INPUT_START = INPUT_START;\n Hammer.INPUT_MOVE = INPUT_MOVE;\n Hammer.INPUT_END = INPUT_END;\n Hammer.INPUT_CANCEL = INPUT_CANCEL;\n Hammer.STATE_POSSIBLE = STATE_POSSIBLE;\n Hammer.STATE_BEGAN = STATE_BEGAN;\n Hammer.STATE_CHANGED = STATE_CHANGED;\n Hammer.STATE_ENDED = STATE_ENDED;\n Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;\n Hammer.STATE_CANCELLED = STATE_CANCELLED;\n Hammer.STATE_FAILED = STATE_FAILED;\n Hammer.Manager = Manager;\n Hammer.Input = Input;\n Hammer.TouchAction = TouchAction;\n Hammer.TouchInput = TouchInput;\n Hammer.MouseInput = MouseInput;\n Hammer.PointerEventInput = PointerEventInput;\n Hammer.TouchMouseInput = TouchMouseInput;\n Hammer.SingleTouchInput = SingleTouchInput;\n Hammer.Recognizer = Recognizer;\n Hammer.AttrRecognizer = AttrRecognizer;\n Hammer.Tap = TapRecognizer;\n Hammer.Pan = PanRecognizer;\n Hammer.Swipe = SwipeRecognizer;\n Hammer.Pinch = PinchRecognizer;\n Hammer.Rotate = RotateRecognizer;\n Hammer.Press = PressRecognizer;\n Hammer.on = addEventListeners;\n Hammer.off = removeEventListeners;\n Hammer.each = each;\n Hammer.merge = merge;\n Hammer.extend = extend;\n Hammer.bindFn = bindFn;\n Hammer.assign = assign$1;\n Hammer.inherit = inherit;\n Hammer.bindFn = bindFn;\n Hammer.prefixed = prefixed;\n Hammer.toArray = toArray;\n Hammer.inArray = inArray;\n Hammer.uniqueArray = uniqueArray;\n Hammer.splitStr = splitStr;\n Hammer.boolOrFn = boolOrFn;\n Hammer.hasParent = hasParent;\n Hammer.addEventListeners = addEventListeners;\n Hammer.removeEventListeners = removeEventListeners;\n Hammer.defaults = assign$1({}, defaults, {\n preset: preset\n });\n return Hammer;\n}();\n\n// style loader but by script tag, not by the loader.\n\nvar defaults$1 = Hammer.defaults;\n\nexport default Hammer;\nexport { INPUT_START, INPUT_MOVE, INPUT_END, INPUT_CANCEL, STATE_POSSIBLE, STATE_BEGAN, STATE_CHANGED, STATE_ENDED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_FAILED, DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, Input, TouchAction, TouchInput, MouseInput, PointerEventInput, TouchMouseInput, SingleTouchInput, Recognizer, AttrRecognizer, TapRecognizer as Tap, PanRecognizer as Pan, SwipeRecognizer as Swipe, PinchRecognizer as Pinch, RotateRecognizer as Rotate, PressRecognizer as Press, addEventListeners as on, removeEventListeners as off, each, merge, extend, assign$1 as assign, inherit, bindFn, prefixed, toArray, inArray, uniqueArray, splitStr, boolOrFn, hasParent, addEventListeners, removeEventListeners, defaults$1 as defaults };\n//# sourceMappingURL=hammer.esm.js.map\n","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/axes project is licensed under the MIT license\n\n@egjs/axes JavaScript library\nhttps://github.com/naver/egjs-axes\n\n@version 2.7.1\n*/\nimport { DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, PointerEventInput, TouchMouseInput, TouchInput, MouseInput, Pan, Pinch } from '@egjs/hammerjs';\nimport getAgent from '@egjs/agent';\nimport Component from '@egjs/component';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n};\n\nfunction __extends(d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nfunction getInsidePosition(destPos, range, circular, bounce) {\n var toDestPos = destPos;\n var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]];\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n return toDestPos;\n} // determine outside\n\nfunction isOutside(pos, range) {\n return pos < range[0] || pos > range[1];\n}\nfunction getDuration(distance, deceleration) {\n var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero\n\n return duration < 100 ? 0 : duration;\n}\nfunction isCircularable(destPos, range, circular) {\n return circular[1] && destPos > range[1] || circular[0] && destPos < range[0];\n}\nfunction getCirculatedPos(pos, range, circular) {\n var toPos = pos;\n var min = range[0];\n var max = range[1];\n var length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = (toPos - max) % length + min;\n }\n\n if (circular[0] && pos < min) {\n // left\n toPos = (toPos - min) % length + max;\n }\n\n return toPos;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\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\nfunction toArray(nodes) {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n var el = [];\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n\n return el;\n}\nfunction $(param, multi) {\n if (multi === void 0) {\n multi = false;\n }\n\n var el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n var match = param.match(/^<([a-z]+)\\s*([^>]*)>/); // creating element\n\n if (match) {\n // HTML\n var dummy = document.createElement(\"div\");\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === win) {\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 (\"jQuery\" in win && param instanceof jQuery || param.constructor.prototype.jquery) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map(function (v) {\n return $(v);\n });\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n\n return el;\n}\nvar raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame;\nvar caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;\n\nif (raf && !caf) {\n var keyInfo_1 = {};\n var oldraf_1 = raf;\n\n raf = function (callback) {\n function wrapCallback(timestamp) {\n if (keyInfo_1[key]) {\n callback(timestamp);\n }\n }\n\n var key = oldraf_1(wrapCallback);\n keyInfo_1[key] = true;\n return key;\n };\n\n caf = function (key) {\n delete keyInfo_1[key];\n };\n} else if (!(raf && caf)) {\n raf = function (callback) {\n return win.setTimeout(function () {\n callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime());\n }, 16);\n };\n\n caf = win.clearTimeout;\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 */\n\n\nfunction 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*/\n\nfunction cancelAnimationFrame(key) {\n caf(key);\n}\nfunction map(obj, callback) {\n var tranformed = {};\n\n for (var k in obj) {\n k && (tranformed[k] = callback(obj[k], k));\n }\n\n return tranformed;\n}\nfunction filter(obj, callback) {\n var filtered = {};\n\n for (var k in obj) {\n k && callback(obj[k], k) && (filtered[k] = obj[k]);\n }\n\n return filtered;\n}\nfunction every(obj, callback) {\n for (var k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n\n return true;\n}\nfunction equal(target, base) {\n return every(target, function (v, k) {\n return v === base[k];\n });\n}\nvar roundNumFunc = {};\nfunction roundNumber(num, roundUnit) {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n}\nfunction roundNumbers(num, roundUnit) {\n if (!num || !roundUnit) {\n return num;\n }\n\n var isNumber = typeof roundUnit === \"number\";\n return map(num, function (value, key) {\n return roundNumber(value, isNumber ? roundUnit : roundUnit[key]);\n });\n}\nfunction getDecimalPlace(val) {\n if (!isFinite(val)) {\n return 0;\n }\n\n var v = val + \"\";\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n var p = 0;\n var e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n } // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n\n\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n}\nfunction inversePow(n) {\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}\nfunction getRoundFunc(v) {\n var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n return function (n) {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n}\n\nfunction minMax(value, min, max) {\n return Math.max(Math.min(value, max), min);\n}\n\nvar AnimationManager =\n/*#__PURE__*/\nfunction () {\n function AnimationManager(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n var __proto = AnimationManager.prototype;\n\n __proto.getDuration = function (depaPos, destPos, wishDuration) {\n var _this = this;\n\n var duration;\n\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n var durations_1 = map(destPos, function (v, k) {\n return getDuration(Math.abs(v - depaPos[k]), _this.options.deceleration);\n });\n duration = Object.keys(durations_1).reduce(function (max, v) {\n return Math.max(max, durations_1[v]);\n }, -Infinity);\n }\n\n return minMax(duration, this.options.minimumDuration, this.options.maximumDuration);\n };\n\n __proto.createAnimationParam = function (pos, duration, option) {\n var depaPos = this.axm.get();\n var destPos = pos;\n var inputEvent = option && option.event || null;\n return {\n depaPos: depaPos,\n destPos: destPos,\n duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration),\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: inputEvent,\n input: option && option.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd\n };\n };\n\n __proto.grab = function (axes, option) {\n if (this._animateParam && axes.length) {\n var orgPos_1 = this.axm.get(axes);\n var pos = this.axm.map(orgPos_1, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n });\n\n if (!every(pos, function (v, k) {\n return orgPos_1[k] === v;\n })) {\n this.em.triggerChange(pos, false, orgPos_1, option, !!option);\n }\n\n this._animateParam = null;\n this._raf && cancelAnimationFrame(this._raf);\n this._raf = null;\n this.em.triggerAnimationEnd(!!(option && option.event));\n }\n };\n\n __proto.getEventInfo = function () {\n if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent\n };\n } else {\n return null;\n }\n };\n\n __proto.restore = function (option) {\n var pos = this.axm.get();\n var destPos = this.axm.map(pos, function (v, opt) {\n return Math.min(opt.range[1], Math.max(opt.range[0], v));\n });\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n };\n\n __proto.animationEnd = function () {\n var beforeParam = this.getEventInfo();\n this._animateParam = null; // for Circular\n\n var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n });\n Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n }));\n this.itm.setInterrupt(false);\n this.em.triggerAnimationEnd(!!beforeParam);\n\n if (this.axm.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n };\n\n __proto.finish = function (isTrusted) {\n this._animateParam = null;\n this.itm.setInterrupt(false);\n this.em.triggerFinish(isTrusted);\n };\n\n __proto.animateLoop = function (param, complete) {\n if (param.duration) {\n this._animateParam = __assign({}, param);\n var info_1 = this._animateParam;\n var self_1 = this;\n var destPos_1 = info_1.destPos;\n var prevPos_1 = info_1.depaPos;\n var prevEasingPer_1 = 0;\n var directions_1 = map(prevPos_1, function (value, key) {\n return value <= destPos_1[key] ? 1 : -1;\n });\n var originalIntendedPos_1 = map(destPos_1, function (v) {\n return v;\n });\n var prevTime_1 = new Date().getTime();\n info_1.startTime = prevTime_1;\n\n (function loop() {\n self_1._raf = null;\n var currentTime = new Date().getTime();\n var ratio = (currentTime - info_1.startTime) / param.duration;\n var easingPer = self_1.easing(ratio);\n var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) {\n var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n\n var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular);\n\n if (nextPos !== circulatedPos) {\n // circular\n var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]);\n destPos_1[key] -= rangeOffset;\n prevPos_1[key] -= rangeOffset;\n }\n\n return circulatedPos;\n });\n var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1);\n prevPos_1 = toPos;\n prevTime_1 = currentTime;\n prevEasingPer_1 = easingPer;\n\n if (easingPer >= 1) {\n destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1);\n\n if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) {\n self_1.em.triggerChange(destPos_1, true, prevPos_1);\n }\n\n complete();\n return;\n } else if (isCanceled) {\n self_1.finish(false);\n } else {\n // animationEnd\n self_1._raf = requestAnimationFrame(loop);\n }\n })();\n } else {\n this.em.triggerChange(param.destPos, true);\n complete();\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 *\n * @param originalIntendedPos\n * @param destPos\n */\n\n\n __proto.getFinalPos = function (destPos, originalIntendedPos) {\n var _this = this; // compare destPos and originalIntendedPos\n\n\n var ERROR_LIMIT = 0.000001;\n var finalPos = map(destPos, function (value, key) {\n if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n var roundUnit = _this.getRoundUnit(value, key);\n\n var result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n };\n\n __proto.getRoundUnit = function (val, key) {\n var roundUnit = this.options.round; // manual mode\n\n var minRoundUnit = null; // auto mode\n // auto mode\n\n if (!roundUnit) {\n // Get minimum round unit\n var options = this.axm.getAxisOptions(key);\n minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val)));\n }\n\n return minRoundUnit || roundUnit;\n };\n\n __proto.getUserControll = function (param) {\n var userWish = param.setTo();\n userWish.destPos = this.axm.get(userWish.destPos);\n userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration);\n return userWish;\n };\n\n __proto.animateTo = function (destPos, duration, option) {\n var _this = this;\n\n var param = this.createAnimationParam(destPos, duration, option);\n\n var depaPos = __assign({}, param.depaPos);\n\n var retTrigger = this.em.triggerAnimationStart(param); // to control\n\n var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true.\n\n if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n })) {\n console.warn(\"You can't stop the 'animation' event when 'circular' is true.\");\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n var inputEvent = option && option.event || null;\n this.animateLoop({\n depaPos: depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axm.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent: inputEvent,\n input: option && option.input || null\n }, function () {\n return _this.animationEnd();\n });\n }\n };\n\n __proto.easing = function (p) {\n return p > 1 ? 1 : this.options.easing(p);\n };\n\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n var axes = Object.keys(pos);\n this.grab(axes);\n var orgPos = this.axm.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n\n this.itm.setInterrupt(true);\n var movedPos = filter(pos, function (v, k) {\n return orgPos[k] !== v;\n });\n\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axm.map(movedPos, function (v, opt) {\n var range = opt.range,\n circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular);\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.em.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n };\n\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) {\n return v + pos[k];\n }), duration);\n };\n\n return AnimationManager;\n}();\n\nvar EventManager =\n/*#__PURE__*/\nfunction () {\n function EventManager(axes) {\n this.axes = axes;\n }\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @name eg.Axes#hold\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n var __proto = EventManager.prototype;\n\n __proto.triggerHold = function (pos, option) {\n var roundPos = this.getRoundPos(pos).roundPos;\n this.axes.trigger(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true\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 * @name set\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\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 * @name setTo\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\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 * @name eg.Axes#release\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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} 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 * 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\n __proto.triggerRelease = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n this.axes.trigger(\"release\", param);\n };\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @name eg.Axes#change\n * @event\n * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\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 * 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\n __proto.triggerChange = function (pos, isAccurate, depaPos, option, holding) {\n if (holding === void 0) {\n holding = false;\n }\n\n var am = this.am;\n var axm = am.axm;\n var eventInfo = am.getEventInfo();\n\n var _a = this.getRoundPos(pos, depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n var moveTo = axm.moveTo(roundPos, roundDepa);\n var inputEvent = option && option.event || eventInfo && eventInfo.event || null;\n var param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n holding: holding,\n inputEvent: inputEvent,\n isTrusted: !!inputEvent,\n input: option && option.input || eventInfo && eventInfo.input || null,\n set: inputEvent ? this.createUserControll(moveTo.pos) : function () {}\n };\n var result = this.axes.trigger(\"change\", param);\n inputEvent && axm.set(param.set()[\"destPos\"]);\n return result;\n };\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @name eg.Axes#animationStart\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationStart = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n return this.axes.trigger(\"animationStart\", param);\n };\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#animationEnd\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationEnd = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"animationEnd\", {\n isTrusted: isTrusted\n });\n };\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#finish\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerFinish = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"finish\", {\n isTrusted: isTrusted\n });\n };\n\n __proto.createUserControll = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n } // to controll\n\n\n var userControl = {\n destPos: __assign({}, pos),\n duration: duration\n };\n return function (toPos, userDuration) {\n toPos && (userControl.destPos = __assign({}, toPos));\n userDuration !== undefined && (userControl.duration = userDuration);\n return userControl;\n };\n };\n\n __proto.setAnimationManager = function (am) {\n this.am = am;\n };\n\n __proto.destroy = function () {\n this.axes.off();\n };\n\n __proto.getRoundPos = function (pos, depaPos) {\n // round value if round exist\n var roundUnit = this.axes.options.round; // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit)\n };\n };\n\n return EventManager;\n}();\n\nvar InterruptManager =\n/*#__PURE__*/\nfunction () {\n function InterruptManager(options) {\n this.options = options;\n this._prevented = false; // check whether the animation event was prevented\n }\n\n var __proto = InterruptManager.prototype;\n\n __proto.isInterrupting = function () {\n // when interruptable is 'true', return value is always 'true'.\n return this.options.interruptable || this._prevented;\n };\n\n __proto.isInterrupted = function () {\n return !this.options.interruptable && this._prevented;\n };\n\n __proto.setInterrupt = function (prevented) {\n !this.options.interruptable && (this._prevented = prevented);\n };\n\n return InterruptManager;\n}();\n\nvar AxisManager =\n/*#__PURE__*/\nfunction () {\n function AxisManager(axis, options) {\n var _this = this;\n\n this.axis = axis;\n this.options = options;\n\n this._complementOptions();\n\n this._pos = Object.keys(this.axis).reduce(function (acc, v) {\n acc[v] = _this.axis[v].range[0];\n return acc;\n }, {});\n }\n /**\n * set up 'css' expression\n * @private\n */\n\n\n var __proto = AxisManager.prototype;\n\n __proto._complementOptions = function () {\n var _this = this;\n\n Object.keys(this.axis).forEach(function (axis) {\n _this.axis[axis] = __assign({\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false]\n }, _this.axis[axis]);\n [\"bounce\", \"circular\"].forEach(function (v) {\n var axisOption = _this.axis;\n var 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 __proto.getDelta = function (depaPos, destPos) {\n var fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), function (v, k) {\n return v - fullDepaPos[k];\n });\n };\n\n __proto.get = function (axes) {\n var _this = this;\n\n if (axes && Array.isArray(axes)) {\n return axes.reduce(function (acc, v) {\n if (v && v in _this._pos) {\n acc[v] = _this._pos[v];\n }\n\n return acc;\n }, {});\n } else {\n return __assign({}, this._pos, axes || {});\n }\n };\n\n __proto.moveTo = function (pos, depaPos) {\n if (depaPos === void 0) {\n depaPos = this._pos;\n }\n\n var delta = map(this._pos, function (v, key) {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n this.set(this.map(pos, function (v, opt) {\n return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0;\n }));\n return {\n pos: __assign({}, this._pos),\n delta: delta\n };\n };\n\n __proto.set = function (pos) {\n for (var k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n };\n\n __proto.every = function (pos, callback) {\n var axisOptions = this.axis;\n return every(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.filter = function (pos, callback) {\n var axisOptions = this.axis;\n return filter(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.map = function (pos, callback) {\n var axisOptions = this.axis;\n return map(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.isOutside = function (axes) {\n return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) {\n return !isOutside(v, opt.range);\n });\n };\n\n __proto.getAxisOptions = function (key) {\n return this.axis[key];\n };\n\n return AxisManager;\n}();\n\nvar InputObserver =\n/*#__PURE__*/\nfunction () {\n function InputObserver(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm,\n am = _a.am;\n this.isOutside = false;\n this.moveDistance = null;\n this.isStopped = false;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.am = am;\n } // when move pointer is held in outside\n\n\n var __proto = InputObserver.prototype;\n\n __proto.atOutside = function (pos) {\n var _this = this;\n\n if (this.isOutside) {\n return this.axm.map(pos, function (v, opt) {\n var tn = opt.range[0] - opt.bounce[0];\n var tx = opt.range[1] + opt.bounce[1];\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n // when start pointer is held in inside\n // get a initialization slope value to prevent smooth animation.\n var initSlope_1 = this.am.easing(0.00001) / 0.00001;\n return this.axm.map(pos, function (v, opt) {\n var min = opt.range[0];\n var max = opt.range[1];\n var out = opt.bounce;\n var circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return min - _this.am.easing((min - v) / (out[0] * initSlope_1)) * out[0];\n } else if (v > max) {\n // right\n return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1];\n }\n\n return v;\n });\n }\n };\n\n __proto.get = function (input) {\n return this.axm.get(input.axes);\n };\n\n __proto.hold = function (input, event) {\n if (this.itm.isInterrupted() || !input.axes.length) {\n return;\n }\n\n var changeOption = {\n input: input,\n event: event\n };\n this.isStopped = false;\n this.itm.setInterrupt(true);\n this.am.grab(input.axes, changeOption);\n !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption);\n this.isOutside = this.axm.isOutside(input.axes);\n this.moveDistance = this.axm.get(input.axes);\n };\n\n __proto.change = function (input, event, offset) {\n if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) {\n return v === 0;\n })) {\n return;\n }\n\n var depaPos = this.moveDistance || this.axm.get(input.axes);\n var destPos; // for outside logic\n\n destPos = map(depaPos, function (v, k) {\n return v + (offset[k] || 0);\n });\n this.moveDistance && (this.moveDistance = destPos); // from outside to inside\n\n if (this.isOutside && this.axm.every(depaPos, function (v, opt) {\n return !isOutside(v, opt.range);\n })) {\n this.isOutside = false;\n }\n\n depaPos = this.atOutside(depaPos);\n destPos = this.atOutside(destPos);\n var isCanceled = !this.em.triggerChange(destPos, false, depaPos, {\n input: input,\n event: event\n }, true);\n\n if (isCanceled) {\n this.isStopped = true;\n this.moveDistance = null;\n this.am.finish(false);\n }\n };\n\n __proto.release = function (input, event, offset, inputDuration) {\n if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) {\n return;\n }\n\n var pos = this.axm.get(input.axes);\n var depaPos = this.axm.get();\n var destPos = this.axm.get(this.axm.map(offset, function (v, opt, k) {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce);\n }\n }));\n var duration = this.am.getDuration(destPos, pos, inputDuration);\n\n if (duration === 0) {\n destPos = __assign({}, depaPos);\n } // prepare params\n\n\n var param = {\n depaPos: depaPos,\n destPos: destPos,\n duration: duration,\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: event,\n input: input,\n isTrusted: true\n };\n this.em.triggerRelease(param);\n this.moveDistance = null; // to contol\n\n var userWish = this.am.getUserControll(param);\n var isEqual = equal(userWish.destPos, depaPos);\n var changeOption = {\n input: input,\n event: event\n };\n\n if (isEqual || userWish.duration === 0) {\n !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true);\n this.itm.setInterrupt(false);\n\n if (this.axm.isOutside()) {\n this.am.restore(changeOption);\n } else {\n this.em.triggerFinish(true);\n }\n } else {\n this.am.animateTo(userWish.destPos, userWish.duration, changeOption);\n }\n };\n\n return InputObserver;\n}();\n\n// export const DIRECTION_NONE = 1;\nvar IOS_EDGE_THRESHOLD = 30;\nvar IS_IOS_SAFARI = \"ontouchstart\" in win && getAgent().browser.name === \"safari\";\nvar TRANSFORM = function () {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n\n var bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0]).style;\n var target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n for (var i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n\n return \"\";\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 * @property {Number[]} [range] The coordinate of range 좌표 범위\n * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표\n * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표\n * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to \"true\" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @property {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 * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @property {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가 적용되지 않는다
\n * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
\n**/\n\n/**\n * @class eg.Axes\n * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.\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] 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 *\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\nvar Axes =\n/*#__PURE__*/\nfunction (_super) {\n __extends(Axes, _super);\n\n function Axes(axis, options, startPos) {\n if (axis === void 0) {\n axis = {};\n }\n\n if (options === void 0) {\n options = {};\n }\n\n var _this = _super.call(this) || this;\n\n _this.axis = axis;\n _this._inputs = [];\n _this.options = __assign({\n easing: function easeOutCubic(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 }, options);\n _this.itm = new InterruptManager(_this.options);\n _this.axm = new AxisManager(_this.axis, _this.options);\n _this.em = new EventManager(_this);\n _this.am = new AnimationManager(_this);\n _this.io = new InputObserver(_this);\n\n _this.em.setAnimationManager(_this.am);\n\n startPos && _this.em.triggerChange(startPos);\n return _this;\n }\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @method eg.Axes#connect\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 * 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\n var __proto = Axes.prototype;\n\n __proto.connect = function (axes, inputType) {\n var mapped;\n\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n } // check same instance\n\n\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n } // check same element in hammer type for share\n\n\n if (\"hammer\" in inputType) {\n var targets = this._inputs.filter(function (v) {\n return v.hammer && v.element === inputType.element;\n });\n\n if (targets.length) {\n inputType.hammer = targets[0].hammer;\n }\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.io);\n\n this._inputs.push(inputType);\n\n return this;\n };\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @method eg.Axes#disconnect\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 * 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\n __proto.disconnect = function (inputType) {\n if (inputType) {\n var index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach(function (v) {\n return v.disconnect();\n });\n\n this._inputs = [];\n }\n\n return this;\n };\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @method eg.Axes#get\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\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\n __proto.get = function (axes) {\n return this.axm.get(axes);\n };\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @method eg.Axes#setTo\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 * 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\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setTo(pos, duration);\n return this;\n };\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @method eg.Axes#setBy\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 * 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\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setBy(pos, duration);\n return this;\n };\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @method eg.Axes#isBounceArea\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\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\n __proto.isBounceArea = function (axes) {\n return this.axm.isOutside(axes);\n };\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n * @method eg.Axes#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.em.destroy();\n };\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Axes.VERSION; // ex) 3.3.3\n * @memberof eg.Axes\n */\n\n\n Axes.VERSION = \"2.7.1\";\n /**\n * @name eg.Axes.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 * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n */\n\n Axes.TRANSFORM = TRANSFORM;\n /**\n * @name eg.Axes.DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name eg.Axes.DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name eg.Axes.DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name eg.Axes.DIRECTION_UP\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_UP = DIRECTION_UP;\n /**\n * @name eg.Axes.DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name eg.Axes.DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name eg.Axes.DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name eg.Axes.DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_ALL = DIRECTION_ALL;\n return Axes;\n}(Component);\n\nvar SUPPORT_POINTER_EVENTS = \"PointerEvent\" in win || \"MSPointerEvent\" in win;\nvar SUPPORT_TOUCH = (\"ontouchstart\" in win);\nvar UNIQUEKEY = \"_EGJS_AXES_INPUTTYPE_\";\nfunction toAxis(source, offset) {\n return offset.reduce(function (acc, v, i) {\n if (source[i]) {\n acc[source[i]] = v;\n }\n\n return acc;\n }, {});\n}\nfunction createHammer(element, options) {\n try {\n // create Hammer\n return new Manager(element, __assign({}, options));\n } catch (e) {\n return null;\n }\n}\nfunction convertInputType(inputType) {\n if (inputType === void 0) {\n inputType = [];\n }\n\n var hasTouch = false;\n var hasMouse = false;\n var hasPointer = false;\n inputType.forEach(function (v) {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n\n if (hasPointer) {\n return PointerEventInput;\n } else if (hasTouch && hasMouse) {\n return TouchMouseInput;\n } else if (hasTouch) {\n return TouchInput;\n } else if (hasMouse) {\n return MouseInput;\n }\n\n return null;\n}\n\nfunction getDirectionByAngle(angle, thresholdAngle) {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n\n var toAngle = Math.abs(angle);\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL;\n}\nfunction getNextOffset(speeds, deceleration) {\n var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]);\n var duration = Math.abs(normalSpeed / -deceleration);\n return [speeds[0] / 2 * duration, speeds[1] / 2 * duration];\n}\nfunction useDirection(checkType, direction, userDirection) {\n if (userDirection) {\n return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType);\n } else {\n return !!(direction & checkType);\n }\n}\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @property {String[]} [inputType=[\"touch\",\"mouse\", \"pointer\"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
\n * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율\n * @property {Number} [scale.1=1] vertical axis scale 수직축 배율\n * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PanInput\n * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\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 */\n\nvar PanInput =\n/*#__PURE__*/\nfunction () {\n function PanInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this.panRecognizer = null;\n this.isRightEdge = false;\n this.rightEdgeTimer = 0;\n this.panFlag = false;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PanInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onHammerInput = this.onHammerInput.bind(this);\n this.onPanmove = this.onPanmove.bind(this);\n this.onPanend = this.onPanend.bind(this);\n }\n\n var __proto = PanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n var useHorizontal = !!axes[0];\n var useVertical = !!axes[1];\n\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\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n direction: this._direction,\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PanRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.panRecognizer = new Pan(hammerOption);\n this.hammer.add(this.panRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.dettachEvent();\n }\n\n this._direction = DIRECTION_NONE;\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PanInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PanInput#enable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PanInput#disable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PanInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pan\").options.enable);\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.panRecognizer) {\n this.hammer.remove(this.panRecognizer);\n this.panRecognizer = null;\n }\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.panFlag = false;\n\n if (event.srcEvent.cancelable !== false) {\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n this.observer.hold(this, event);\n this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold;\n this.panFlag = true;\n }\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanmove = function (event) {\n var _this = this;\n\n if (!this.panFlag) {\n return;\n }\n\n var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start\n\n var prevInput = this.hammer.session.prevInput;\n\n if (prevInput && IS_IOS_SAFARI) {\n var swipeLeftToRight = event.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n return;\n } else if (this.isRightEdge) {\n clearTimeout(this.rightEdgeTimer); // - is right to left\n\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n var swipeRightToLeft = event.deltaX < -edgeThreshold;\n\n if (swipeRightToLeft) {\n this.isRightEdge = false;\n } else {\n // iOS swipe right => left\n this.rightEdgeTimer = window.setTimeout(function () {\n _this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n }, 100);\n }\n }\n }\n /* eslint-disable no-param-reassign */\n\n\n if (prevInput) {\n event.offsetX = event.deltaX - prevInput.deltaX;\n event.offsetY = event.deltaY - prevInput.deltaY;\n } else {\n event.offsetX = 0;\n event.offsetY = 0;\n }\n\n var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]);\n var prevent = offset.some(function (v) {\n return v !== 0;\n });\n\n if (prevent) {\n var srcEvent = event.srcEvent;\n\n if (srcEvent.cancelable !== false) {\n srcEvent.preventDefault();\n }\n\n srcEvent.stopPropagation();\n }\n\n event.preventSystemEvent = prevent;\n prevent && this.observer.change(this, event, toAxis(this.axes, offset));\n };\n\n __proto.onPanend = function (event) {\n if (!this.panFlag) {\n return;\n }\n\n clearTimeout(this.rightEdgeTimer);\n this.panFlag = false;\n var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]);\n offset = getNextOffset(offset, this.observer.options.deceleration);\n this.observer.release(this, event, toAxis(this.axes, offset));\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"hammer.input\", this.onHammerInput).on(\"panstart panmove\", this.onPanmove);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"hammer.input\", this.onHammerInput).off(\"panstart panmove\", this.onPanmove);\n this.observer = null;\n };\n\n __proto.getOffset = function (properties, direction) {\n var offset = [0, 0];\n var scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n\n return offset;\n };\n\n return PanInput;\n}();\n\n/**\n * @class eg.Axes.RotatePanInput\n * @classdesc 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)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.
[상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\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 eg.Axes.PanInput\n */\n\nvar RotatePanInput =\n/*#__PURE__*/\nfunction (_super) {\n __extends(RotatePanInput, _super);\n\n function RotatePanInput(el, options) {\n var _this = _super.call(this, el, options) || this;\n\n _this.prevQuadrant = null;\n _this.lastDiff = 0;\n return _this;\n }\n\n var __proto = RotatePanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.observer.hold(this, event);\n this.onPanstart(event);\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanstart = function (event) {\n var rect = this.element.getBoundingClientRect();\n /**\n * Responsive\n */\n // TODO: how to do if element is ellipse not circle.\n\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\n this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle.\n\n this.prevAngle = null;\n this.triggerChange(event);\n };\n\n __proto.onPanmove = function (event) {\n this.triggerChange(event);\n };\n\n __proto.onPanend = function (event) {\n this.triggerChange(event);\n this.triggerAnimation(event);\n };\n\n __proto.triggerChange = function (event) {\n var angle = this.getAngle(event.center.x, event.center.y);\n var quadrant = this.getQuadrant(event.center.x, event.center.y);\n var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant);\n this.prevAngle = angle;\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 __proto.triggerAnimation = function (event) {\n var vx = event.velocityX;\n var vy = event.velocityY;\n var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise\n\n var duration = Math.abs(velocity / -this.observer.options.deceleration);\n var distance = velocity / 2 * duration;\n this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle]));\n };\n\n __proto.getDifference = function (prevAngle, angle, prevQuadrant, quadrant) {\n var diff;\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 __proto.getPosFromOrigin = function (posX, posY) {\n return {\n x: posX - this.rotateOrigin[0],\n y: this.rotateOrigin[1] - posY\n };\n };\n\n __proto.getAngle = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y);\n\n return angle < 0 ? 360 + angle : angle;\n };\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n\n\n __proto.getQuadrant = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var 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\n return q;\n };\n\n return RotatePanInput;\n}(PanInput);\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PinchInput\n * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\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 */\n\nvar PinchInput =\n/*#__PURE__*/\nfunction () {\n function PinchInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this._base = null;\n this._prev = null;\n this.pinchRecognizer = null;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PinchInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onPinchStart = this.onPinchStart.bind(this);\n this.onPinchMove = this.onPinchMove.bind(this);\n this.onPinchEnd = this.onPinchEnd.bind(this);\n }\n\n var __proto = PinchInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PinchRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.pinchRecognizer = new Pinch(hammerOption);\n this.hammer.add(this.pinchRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n this.dettachEvent();\n }\n\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PinchInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.pinchRecognizer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n }\n };\n\n __proto.onPinchStart = function (event) {\n this._base = this.observer.get(this)[this.axes[0]];\n var offset = this.getOffset(event.scale);\n this.observer.hold(this, event);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchMove = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchEnd = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this.observer.release(this, event, toAxis(this.axes, [0]), 0);\n this._base = null;\n this._prev = null;\n };\n\n __proto.getOffset = function (pinchScale, prev) {\n if (prev === void 0) {\n prev = 1;\n }\n\n return this._base * (pinchScale - prev) * this.options.scale;\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"pinchstart\", this.onPinchStart).on(\"pinchmove\", this.onPinchMove).on(\"pinchend\", this.onPinchEnd);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"pinchstart\", this.onPinchStart).off(\"pinchmove\", this.onPinchMove).off(\"pinchend\", this.onPinchEnd);\n this.observer = null;\n this._prev = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PinchInput#enable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PinchInput#disable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PinchInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pinch\").options.enable);\n };\n\n return PinchInput;\n}();\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n**/\n\n/**\n * @class eg.Axes.WheelInput\n * @classdesc 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 * 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 */\n\nvar WheelInput =\n/*#__PURE__*/\nfunction () {\n function WheelInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n useNormalized: true\n }, options);\n this.onWheel = this.onWheel.bind(this);\n }\n\n var __proto = WheelInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent();\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.WheelInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onWheel = function (event) {\n var _this = this;\n\n if (!this._isEnabled) {\n return;\n }\n\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n if (_this._isHolded) {\n _this._isHolded = false;\n\n _this.observer.release(_this, event, toAxis(_this.axes, [0]));\n }\n }, 50);\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.element.addEventListener(\"wheel\", this.onWheel);\n this._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\n this.element.removeEventListener(\"wheel\", this.onWheel);\n this._isEnabled = false;\n this.observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.WheelInput#enable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.WheelInput#disable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.WheelInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return WheelInput;\n}();\n\nvar KEY_LEFT_ARROW = 37;\nvar KEY_A = 65;\nvar KEY_UP_ARROW = 38;\nvar KEY_W = 87;\nvar KEY_RIGHT_ARROW = 39;\nvar KEY_D = 68;\nvar KEY_DOWN_ARROW = 40;\nvar KEY_S = 83;\nvar DIRECTION_REVERSE = -1;\nvar DIRECTION_FORWARD = 1;\nvar DIRECTION_HORIZONTAL$1 = -1;\nvar DIRECTION_VERTICAL$1 = 1;\nvar DELAY = 80;\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @property {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @property {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n**/\n\n/**\n * @class eg.Axes.MoveKeyInput\n * @classdesc 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 * 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 */\n\nvar MoveKeyInput =\n/*#__PURE__*/\nfunction () {\n function MoveKeyInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: [1, 1]\n }, options);\n this.onKeydown = this.onKeydown.bind(this);\n this.onKeyup = this.onKeyup.bind(this);\n }\n\n var __proto = MoveKeyInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent(); // add tabindex=\"0\" to the container for making it focusable\n\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 __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.MoveKeyInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onKeydown = function (e) {\n if (!this._isEnabled) {\n return;\n }\n\n var isMoveKey = true;\n var direction = DIRECTION_FORWARD;\n var move = DIRECTION_HORIZONTAL$1;\n\n switch (e.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL$1;\n break;\n\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL$1;\n break;\n\n default:\n isMoveKey = false;\n }\n\n if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) {\n isMoveKey = false;\n }\n\n if (!isMoveKey) {\n return;\n }\n\n var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction];\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n clearTimeout(this._timer);\n this.observer.change(this, event, toAxis(this.axes, offsets));\n };\n\n __proto.onKeyup = function (e) {\n var _this = this;\n\n if (!this._isHolded) {\n return;\n }\n\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n _this.observer.release(_this, e, toAxis(_this.axes, [0, 0]));\n\n _this._isHolded = false;\n }, DELAY);\n };\n\n __proto.attachEvent = function (observer) {\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._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\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._isEnabled = false;\n this.observer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.MoveKeyInput#enable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.MoveKeyInput#disable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.MoveKeyInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return MoveKeyInput;\n}();\n\nexport default Axes;\nexport { PanInput, RotatePanInput, PinchInput, WheelInput, MoveKeyInput };\n//# sourceMappingURL=axes.esm.js.map\n","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport {TRANSFORM, SUPPORT_WILLCHANGE} from \"../utils/browserFeature\";\nimport {VERSION} from \"../version\";\n/**\n * @class eg.view360.SpriteImage\n * @classdesc A module that displays a single or continuous image of any one of the \"sprite images\". SpinViewer internally uses SpriteImage to show each frame of the sprite image.\n * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the \"Sprite image\". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n *\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpriteImage\n *\n * var el = document.getElementById(\"image-div\");\n * var sprites = new eg.view360.SpriteImage(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24\n * });\n */\nclass SpriteImage extends Component {\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\t\tconst opt = options || {};\n\n\t\tthis._el = element;\n\t\tthis._rowCount = opt.rowCount || 1;\n\t\tthis._colCount = opt.colCount || 1;\n\t\tthis._totalCount = this._rowCount * this._colCount;// total frames\n\t\tthis._width = opt.width || \"auto\";\n\t\tthis._height = opt.height || \"auto\";\n\t\tthis._autoHeight = opt.autoHeight != null ? opt.autoHeight : \"true\"; // If autoHeight is specified, _height will be overwritten.\n\t\tthis._colRow = [0, 0];\n\n\t\tif (opt.colRow) {\n\t\t\tthis._colRow = opt.colRow;\n\t\t} else if (opt.frameIndex) {\n\t\t\tthis.setFrameIndex(opt.frameIndex);\n\t\t}\n\n\t\tthis._el.style.width = SpriteImage._getSizeString(this._width);\n\t\tthis._el.style.height = SpriteImage._getSizeString(this._height);\n\n\t\tif (!opt.imageUrl) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: opt.imageUrl\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._image = new Image();\n\t\t/**\n\t\t * Event\n\t\t */\n\t\tthis._image.onload = () => {\n\t\t\tthis._bg = SpriteImage._createBgDiv(\n\t\t\t\tthis._image, this._rowCount, this._colCount, this._autoHeight);\n\t\t\tthis._el.appendChild(this._bg);\n\t\t\tthis.setColRow(this._colRow[0], this._colRow[1]);\n\n\t\t\t/**\n\t\t\t * Events that occur when component loading is complete\n\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#load\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"load\" : function(evt) {\n\t\t\t *\t\tconsole.log(\"load event fired - e.target\", e.target, \"e.bgElement\", e.bgElement);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"load\", {\n\t\t\t\ttarget: this._el,\n\t\t\t\tbgElement: this._bg\n\t\t\t});\n\n\t\t\tif (this._autoPlayReservedInfo) {\n\t\t\t\tthis.play(this._autoPlayReservedInfo);\n\t\t\t\tthis._autoPlayReservedInfo = null;\n\t\t\t}\n\t\t};\n\n\t\tthis._image.onerror = e => {\n\t\t\t/**\n\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#imageError\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t *\t\t// Error handling\n\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\timageUrl: opt.imageUrl\n\t\t\t});\n\t\t};\n\n\t\tthis._image.src = opt.imageUrl;\n\t}\n\n\tstatic _createBgDiv(img, rowCount, colCount, autoHeight) {\n\t\tconst el = document.createElement(\"div\");\n\n\t\tel.style.position = \"relative\";\n\t\tel.style.overflow = \"hidden\";\n\n\t\timg.style.position = \"absolute\";\n\t\timg.style.width = `${colCount * 100}%`;\n\t\timg.style.height = `${rowCount * 100}%`;\n\t\t/** Prevent image from being dragged on IE10, IE11, Safari especially */\n\t\timg.ondragstart = () => (false); // img.style.pointerEvents = \"none\";\n\t\t// Use hardware accelerator if available\n\t\tSUPPORT_WILLCHANGE && (img.style.willChange = \"transform\");\n\n\t\tel.appendChild(img);\n\n\t\tconst unitWidth = img.width / colCount;\n\t\tconst unitHeight = img.height / rowCount;\n\n\t\tif (autoHeight) {\n\t\t\tconst r = unitHeight / unitWidth;\n\n\t\t\tel.style.paddingBottom = `${r * 100}%`;\n\t\t} else {\n\t\t\tel.style.height = \"100%\";\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/**\n\t * Specifies the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정\n\t * @method eg.view360.SpriteImage#setFrameIndex\n\t * @param {Number} frameIndex frame index of a frame프레임의 인덱스\n\t *\n\t * @example\n\t *\n\t * sprites.setFrameIndex(0, 1);// col = 0, row = 1\n\t */\n\tsetFrameIndex(index) {\n\t\tconst colRow = this.toColRow(index);\n\n\t\tthis.setColRow(colRow[0], colRow[1]);\n\t}\n\n\t/**\n\t * Returns the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환\n\t * @method eg.view360.SpriteImage#getFrameIndex\n\t * @return {Number} frame index frame 인덱스\n\t *\n\t * @example\n\t *\n\t * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1\n\t *\n\t */\n\tgetFrameIndex() {\n\t\treturn this._colRow[1] * this._colCount + this._colRow[0];\n\t}\n\n\t/**\n\t * Specifies the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정\n\t * @method eg.view360.SpriteImage#setColRow\n\t * @param {Number} col Column number of a frame프레임의 행값\n\t * @param {Number} row Row number of a frame프레임의 열값\n\t *\n\t * @example\n\t *\n\t * sprites.setlColRow(1, 2); // col = 1, row = 2\n\t */\n\tsetColRow(col, row) {\n\t\tif (row > this._rowCount - 1 || col > this._colCount - 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._image && TRANSFORM) {\n\t\t\t// NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser?\n\t\t\tthis._image.style[TRANSFORM] = `translate(${-(col / this._colCount * 100)}%, ${-(row / this._rowCount * 100)}%)`;\n\t\t}\n\n\t\tthis._colRow = [col, row];\n\t}\n\n\t/**\n\t * Returns the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환\n\t * @method eg.view360.SpriteImage#gelColRow\n\t * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열\n\t *\n\t * @example\n\t *\n\t * var colRow = sprites.getlColRow();\n\t * // colRow = [1, 2] - index of col is 1, index of row is 2\n\t *\n\t */\n\tgetColRow() {\n\t\treturn this._colRow;\n\t}\n\n\tstatic _getSizeString(size) {\n\t\tif (typeof size === \"number\") {\n\t\t\treturn `${size}px`;\n\t\t}\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Stop playing\n\t * @ko play 되고 있던 프레임 재생을 중지합니다.\n\t * @method eg.view360.SpriteImage#stop\n\t *\n\t * @example\n\t *\n\t * viewer.stop();\n\t *\n\t */\n\tstop() {\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\t}\n\n\t/**\n\t * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'.\n\t * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다.\n\t * @method eg.view360.SpriteImage#play\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위\n\t * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복\n\t *\n\t * @example\n\t *\n\t * viewer.play({angle: 16, playCount: 1});\n\t *\n\t */\n\tplay({interval, playCount} = {interval: 1000 / this._totalCount, playCount: 0}) {\n\t\tif (!this._bg) {\n\t\t\tthis._autoPlayReservedInfo = {interval, playCount};\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\n\t\tlet frameIndex = this.getFrameIndex();\n\t\tlet count = 0;\n\t\tlet frameCount = 0; // for checking 1 cycle\n\n\t\tthis._autoPlayTimer = setInterval(() => {\n\t\t\tframeIndex %= this._totalCount;\n\t\t\tconst colRow = this.toColRow(frameIndex);\n\n\t\t\tthis.setColRow(colRow[0], colRow[1]);\n\t\t\tframeIndex++;\n\n\t\t\t// Done 1 Cycle?\n\t\t\tif (++frameCount === this._totalCount) {\n\t\t\t\tframeCount = 0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (playCount > 0 && count === playCount) {\n\t\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\t}\n\t\t}, interval);\n\t}\n\n\ttoColRow(frameIndex) {\n\t\tconst colCount = this._colCount;\n\t\tconst rowCount = this._rowCount;\n\n\t\tif (frameIndex < 0) {\n\t\t\treturn [0, 0];\n\t\t} else if (frameIndex >= this._totalCount) {\n\t\t\treturn [colCount - 1, rowCount - 1];\n\t\t}\n\n\t\tconst col = frameIndex % colCount;\n\t\tconst row = Math.floor(frameIndex / colCount);\n\n\t\t// console.log(frameIndex, col, row);\n\t\treturn [col, row];\n\t}\n}\n\nexport default SpriteImage;\n","import Component from \"@egjs/component\";\nimport Axes, {PanInput} from \"@egjs/axes\";\nimport SpriteImage from \"./SpriteImage\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_PAN_SCALE = 0.21;\n\n/**\n * @class eg.view360.SpinViewer\n * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object.\n * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpinViewer\n * var el = document.getElementById(\"product-360\");\n * var viewer = new eg.view360.SpinViewer(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24 //required\n * });\n */\nclass SpinViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.SpinViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.SpinViewer\n\t */\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\n\t\tthis._el = element;\n\n\t\tconst opt = Object.assign({}, options);\n\t\tconst colCount = opt.colCount || 1;\n\t\tconst rowCount = opt.rowCount || 1;\n\n\t\tthis._scale = (opt.scale || 1);\n\t\tthis._panScale = this._scale * DEFAULT_PAN_SCALE;\n\n\t\tthis._frameCount = colCount * rowCount;\n\n\t\t// Init SpriteImage\n\t\tthis._sprites = new SpriteImage(element, opt).on({\n\t\t\t\"load\": evt => {\n\t\t\t\t/**\n\t\t\t\t * Events that occur when component loading is complete\n\t\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#load\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"load\" : function(evt) {\n\t\t\t\t *\t\tthis.spinBy(360, {duration: 300});\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"load\", evt);\n\t\t\t},\n\t\t\t\"imageError\": evt => {\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#imageError\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viewer.on({\n\t\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t\t *\t\t// Error handling\n\t\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: evt.imageUrl\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Init Axes\n\t\tthis._panInput = new PanInput(this._el, {\n\t\t\tscale: [this._panScale, this._panScale]\n\t\t});\n\t\tthis._axes = new Axes({\n\t\t\tangle: {\n\t\t\t\trange: [0, 359],\n\t\t\t\tcircular: true\n\t\t\t}\n\t\t}).on({\n\t\t\t\"change\": evt => {\n\t\t\t\tconst curr = Math.floor(evt.pos.angle / (360 / this._frameCount));\n\t\t\t\tconst frameIndex = this._frameCount - curr - 1;\n\n\t\t\t\tthis._sprites.setFrameIndex(frameIndex);\n\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#change\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row\n\t\t\t\t * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값\n\t\t\t\t * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님)\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"change\" : function(evt) {\n\t\t\t\t *\t\tconsole.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"change\", {\n\t\t\t\t\tframeIndex,\n\t\t\t\t\tcolRow: this._sprites.getColRow(),\n\t\t\t\t\tangle: evt.pos.angle\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"animationEnd\": evt => {\n\t\t\t\t/**\n\t\t\t\t * This event is fired when animation ends.\n\t\t\t\t * @ko 에니메이션이 끝났을 때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#animationEnd\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Boolean} param.isTrusted 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\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"animationEnd\" : function(evt) {\n\t\t\t\t *\t\t// evt.isTrusted === true or false\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"animationEnd\", {\n\t\t\t\t\tisTrusted: evt.isTrusted\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._axes.connect(\"angle\", this._panInput);\n\t}\n\n\t/**\n\t * Set spin scale\n\t * @ko scale 을 조정할 수 있는 함수\n\t * @method eg.view360.SpinViewer#setScale\n\t * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.setScale(2);// It moves twice as much.\n\t */\n\tsetScale(scale) {\n\t\tif (isNaN(scale) || scale < 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._scale = scale;\n\t\tthis._panScale = scale * DEFAULT_PAN_SCALE;\n\t\tthis._panInput.options.scale = [this._panScale, this._panScale];\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get spin scale\n\t * @ko scale 값을 반환한다.\n\t * @method eg.view360.SpinViewer#getScale\n\t *\n\t * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @example\n\t *\n\t * viewer.getScale();// It returns number\n\t */\n\tgetScale() {\n\t\treturn this._scale;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle.\n\t * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinBy\n\t *\n\t * @param {Number} [angle = 0] angle상대적 회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinBy(720, {duration: 500});\n\t */\n\tspinBy(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setBy({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle).\n\t * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinTo\n\t *\n\t * @param {Number} [angle = 0] angle회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinTo(30, {duration:100});\n\t */\n\tspinTo(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setTo({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns current angles\n\t * @ko 현재 각도를 반환한다.\n\t *\n\t * @return {Number} Current angle 현재 각도\n\t */\n\tgetAngle() {\n\t\treturn this._axes.get().angle || 0;\n\t}\n}\n\nexport default SpinViewer;\n"],"names":["_extends","_inheritsLoose","_assertThisInitialized","win","toArray","getAgent","SUPPORT_POINTER_EVENTS","SUPPORT_TOUCH","Pan","some","find","getUserAgent","execRegExp","hasUserAgentData","findVersion","convertVersion","findPreset","findBrand","BROWSER_PRESETS","CHROMIUM_PRESETS","WEBKIT_PRESETS","WEBVIEW_PRESETS","OS_PRESETS","parseUserAgentData","parseUserAgent","agent","window","Math","self","Function","doc","document","osName","os","name","browserName","browser","Float32Array","Array","getComputedStyle","userAgent","navigator","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","i","len","length","SUPPORT_WILLCHANGE","CSS","supports","VERSION","SpriteImage","element","options","opt","_el","_rowCount","rowCount","_colCount","colCount","_totalCount","_width","width","_height","height","_autoHeight","autoHeight","_colRow","colRow","frameIndex","setFrameIndex","_getSizeString","imageUrl","setTimeout","trigger","_image","Image","onload","_bg","_createBgDiv","appendChild","setColRow","bgElement","_autoPlayReservedInfo","play","onerror","e","src","img","el","createElement","position","overflow","ondragstart","willChange","unitWidth","unitHeight","r","paddingBottom","index","toColRow","getFrameIndex","col","row","getColRow","size","stop","_autoPlayTimer","clearInterval","interval","playCount","count","frameCount","setInterval","floor","Component","DEFAULT_PAN_SCALE","SpinViewer","_scale","scale","_panScale","_frameCount","_sprites","on","evt","_panInput","PanInput","_axes","Axes","angle","range","circular","curr","pos","isTrusted","connect","setScale","isNaN","getScale","spinBy","param","duration","setBy","spinTo","setTo","getAngle","get"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;;EAEA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,WAAW,CAAC,KAAK,EAAE;EAC5B,EAAE,OAAO,OAAO,KAAK,KAAK,WAAW,CAAC;EACtC,CAAC;EACD;EACA;EACA;EACA;EACA;;;EAGA,IAAI,SAAS;EACb;EACA,YAAY;EACZ,EAAE,IAAI,SAAS;EACf;EACA,EAAE,YAAY;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA,IAAI,SAAS,SAAS,GAAG;EACzB,MAAM,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;EAC9B,MAAM,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;EACxB,KAAK;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;EAGA,IAAI,IAAI,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC;;EAErC,IAAI,MAAM,CAAC,OAAO,GAAG,SAAS,OAAO,CAAC,SAAS,EAAE,WAAW,EAAE;EAC9D,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AAAA,KAAK,EAALA;EAAD,OAAjB,EAA0BW,KAAK,CAACC,QAAhC;;EACA,aAAO,IAAP;EACA;EAED;;;;;;;;aAMAI,WAAA,oBAAW;EACV,aAAO,KAAKlB,KAAL,CAAWmB,GAAX,GAAiBjB,KAAjB,IAA0B,CAAjC;EACA;;;MAjOuBd;;EAAnBE,EAAAA,WAWEnE,UAAUA;WAXZmE;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/SpinViewer/view360.spinviewer.pkgd.min.js b/dist/SpinViewer/view360.spinviewer.pkgd.min.js new file mode 100644 index 000000000..ec1f33df0 --- /dev/null +++ b/dist/SpinViewer/view360.spinviewer.pkgd.min.js @@ -0,0 +1,11 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +All-in-one packaged file for ease use of '@egjs/view360' with below dependencies. +- @egjs/agent ^2.2.1, @egjs/axes ^2.7.1, @egjs/component ^2.1.2, es6-promise ^4.2.5, gl-matrix ^3.1.0, motion-sensors-polyfill ^0.3.1, webvr-polyfill ^0.9.41 +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t.eg=t.eg||{},t.eg.view360={}))}(this,function(t){"use strict";function a(){return(a=Object.assign||function(t){for(var e=1;e=T(e)?t<0?F:z:e<0?H:X}function et(t,e,n){return{x:e/t||0,y:n/t||0}}function nt(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=J(e)),1T(y.y)?y.x:y.y,e.scale=f?(m=f.pointers,$((v=i)[0],v[1],U)/$(m[0],m[1],U)):1,e.rotation=f?(g=f.pointers,K((w=i)[1],w[0],U)+K(g[1],g[0],U)):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==j&&(ST(c.y)?c.x:c.y,o=tt(u,h),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}(n,e);var b,_=t.element,x=e.srcEvent;Q(b=x.composedPath?x.composedPath()[0]:x.path?x.path[0]:x.target,_)&&(_=b),e.target=_}function it(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&D&&i-r==0,s=e&(M|j)&&i-r==0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,nt(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function rt(t){return t.trim().split(/\s+/g)}function ot(e,t,n){q(rt(t),function(t){e.addEventListener(t,n,!1)})}function st(e,t,n){q(rt(t),function(t){e.removeEventListener(t,n,!1)})}function at(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var ut=function(){function t(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){W(e.options.enable,[e])&&n.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&ot(this.element,this.evEl,this.domHandler),this.evTarget&&ot(this.target,this.evTarget,this.domHandler),this.evWin&&ot(at(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&st(this.element,this.evEl,this.domHandler),this.evTarget&&st(this.target,this.evTarget,this.domHandler),this.evWin&&st(at(this.element),this.evWin,this.domHandler)},t}();function ht(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;ie[n]}):i.sort()),i}var gt={touchstart:D,touchmove:2,touchend:M,touchcancel:j},wt=function(e){function n(){var t;return n.prototype.evTarget="touchstart touchmove touchend touchcancel",(t=e.apply(this,arguments)||this).targetIds={},t}return r(n,e),n.prototype.handler=function(t){var e=gt[t.type],n=function(t,e){var n,i,r=mt(t.touches),o=this.targetIds;if(e&(2|D)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=mt(t.changedTouches),a=[],u=this.target;if(i=r.filter(function(t){return Q(t.target,u)}),e===D)for(n=0;ne.threshold&&r&e.direction},e.attrTest=function(t){return At.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=St(t.direction);e&&(t.additionalEvent=this.options.event+e),n.prototype.emit.call(this,t)},t}(At),Mt={domEvents:!1,touchAction:g,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function jt(n,i){var r,o=n.element;o.style&&(q(n.options.cssProps,function(t,e){r=d(o.style,e),i?(n.oldCssProps[r]=o.style[r],o.style[r]=t):o.style[r]=n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}var kt=function(){function t(t,e){var n,i=this;this.options=h({},Mt,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(I?dt:O?wt:C?Et:bt))(n,it),this.touchAction=new G(this,this.options.touchAction),jt(this,!0),q(this.options.recognizers,function(t){var e=i.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return h(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=window.console&&(window.console.warn||window.console.log);return n&&n.call(window.console,r,e),i.apply(this,arguments)}}var zt=Ft(function(t,e,n){for(var i=Object.keys(e),r=0;re[1]}function ne(t,e,n){return n[1]&&t>e[1]||n[0]&&t=n[e]-1e-6&&t<=n[e]+1e-6?n[e]:de(t,i.getRoundUnit(t,e))})},e.getRoundUnit=function(t,e){var n,i=this.options.round,r=null;if(!i){var o=this.axm.getAxisOptions(e);n=Math.max(ve(o.range[0]),ve(o.range[1]),ve(t)),r=1/Math.pow(10,n)}return r||i},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=ge(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this,r=this.createAnimationParam(t,e,n),o=Kt({},r.depaPos),s=this.em.triggerAnimationStart(r),a=this.getUserControll(r);if(!s&&this.axm.every(a.destPos,function(t,e){return ne(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),s&&!fe(a.destPos,o)){var u=n&&n.event||null;this.animateLoop({depaPos:o,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(o,a.destPos),isTrusted:!!u,inputEvent:u,input:n&&n.input||null},function(){return i.animationEnd()})}},e.easing=function(t){return 1]*)>/)){var r=document.createElement("div");r.innerHTML=t,i=re(r.childNodes)}else i=re(document.querySelectorAll(t));n||(i=1<=i.length?i[0]:void 0)}else t===$t?i=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in $t&&t instanceof jQuery||t.constructor.prototype.jquery?i=n?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return e(t)}),n||(i=1<=i.length?i[0]:void 0)):i=t;return i}(t),this.options=Kt({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onHammerInput=this.onHammerInput.bind(this),this.onPanmove=this.onPanmove.bind(this),this.onPanend=this.onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?L:e?Y:n?V:k,this.axes=t},e.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[Re];n=n||String(Math.round(Math.random()*(new Date).getTime()));var i=function(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=Oe;break;case"pointer":i=Ie}}),i?dt:e&&n?Et:e?wt:n?bt:null}(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=function(t,e){try{return new kt(t,Kt({},e))}catch(t){return null}}(this.element,Kt({inputClass:i},this.options.hammerManagerOptions)),this.element[Re]=n}return this.panRecognizer=new Dt(e),this.hammer.add(this.panRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&this.dettachEvent(),this._direction=k,this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[Re],this.element=null,this.hammer=null},e.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},e.removeRecognizer=function(){this.hammer&&this.panRecognizer&&(this.hammer.remove(this.panRecognizer),this.panRecognizer=null)},e.onHammerInput=function(t){if(this.isEnable())if(t.isFirst){if((this.panFlag=!1)!==t.srcEvent.cancelable){var e=this.options.iOSEdgeSwipeThreshold;this.observer.hold(this,t),this.isRightEdge=Ee&&t.center.x>window.innerWidth-e,this.panFlag=!0}}else t.isFinal&&this.onPanend(t)},e.onPanmove=function(t){var e=this;if(this.panFlag){var n=function(t,e){if(e<0||90this._rowCount-1||t>this._colCount-1||(this._image&&Qe&&(this._image.style[Qe]="translate("+-t/this._colCount*100+"%, "+-e/this._rowCount*100+"%)"),this._colRow=[t,e])},t.getColRow=function(){return this._colRow},o._getSizeString=function(t){return"number"==typeof t?t+"px":t},t.stop=function(){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=null)},t.play=function(t){var e=this,n=void 0===t?{interval:1e3/this._totalCount,playCount:0}:t,i=n.interval,r=n.playCount;if(this._bg){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=null);var o=this.getFrameIndex(),s=0,a=0;this._autoPlayTimer=setInterval(function(){o%=e._totalCount;var t=e.toColRow(o);e.setColRow(t[0],t[1]),o++,++a===e._totalCount&&(a=0,s++),0=this._totalCount?[e-1,n-1]:[t%e,Math.floor(t/e)]},o}(e);return t.VERSION=Je,t}(),Ke=function(){var t=function(s){function t(t,e){var i;(i=s.call(this)||this)._el=t;var n=a({},e),r=n.colCount||1,o=n.rowCount||1;return i._scale=n.scale||1,i._panScale=.21*i._scale,i._frameCount=r*o,i._sprites=new $e(t,n).on({load:function(t){i.trigger("load",t)},imageError:function(t){i.trigger("imageError",{imageUrl:t.imageUrl})}}),i._panInput=new De(i._el,{scale:[i._panScale,i._panScale]}),i._axes=new Ce({angle:{range:[0,359],circular:!0}}).on({change:function(t){var e=Math.floor(t.pos.angle/(360/i._frameCount)),n=i._frameCount-e-1;i._sprites.setFrameIndex(n),i.trigger("change",{frameIndex:n,colRow:i._sprites.getColRow(),angle:t.pos.angle})},animationEnd:function(t){i.trigger("animationEnd",{isTrusted:t.isTrusted})}}),i._axes.connect("angle",i._panInput),i}n(t,s);var e=t.prototype;return e.setScale=function(t){return isNaN(t)||t<0||(this._scale=t,this._panScale=.21*t,this._panInput.options.scale=[this._panScale,this._panScale]),this},e.getScale=function(){return this._scale},e.spinBy=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setBy({angle:t},e.duration),this},e.spinTo=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setTo({angle:t},e.duration),this},e.getAngle=function(){return this._axes.get().angle||0},t}(e);return t.VERSION=Je,t}();t.SpinViewer=Ke,t.SpriteImage=$e,t.VERSION=Je,Object.defineProperty(t,"__esModule",{value:!0})}); +//# sourceMappingURL=view360.spinviewer.pkgd.min.js.map diff --git a/dist/SpinViewer/view360.spinviewer.pkgd.min.js.map b/dist/SpinViewer/view360.spinviewer.pkgd.min.js.map new file mode 100644 index 000000000..41cab71fe --- /dev/null +++ b/dist/SpinViewer/view360.spinviewer.pkgd.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.spinviewer.pkgd.min.js","sources":["../../node_modules/@egjs/component/dist/component.esm.js","../../node_modules/@egjs/hammerjs/dist/hammer.esm.js","../../node_modules/@egjs/axes/node_modules/@egjs/agent/dist/agent.esm.js","../../node_modules/@egjs/axes/dist/axes.esm.js","../../node_modules/@egjs/agent/dist/agent.esm.js","../../src/utils/browser.js","../../src/utils/browserFeature.js","../../src/version.js","../../src/SpinViewer/SpriteImage.js","../../src/SpinViewer/SpinViewer.js"],"sourcesContent":["/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/component project is licensed under the MIT license\n\n@egjs/component JavaScript library\nhttps://naver.github.io/egjs-component\n\n@version 2.1.2\n*/\n/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\n/**\n * A class used to manage events in a component\n * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스\n * @alias eg.Component\n */\n\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Component.VERSION; // ex) 2.0.0\n * @memberof eg.Component\n */\n\n /**\n * @support {\"ie\": \"7+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n */\n function Component() {\n this._eventHandler = {};\n this.options = {};\n }\n /**\n * Triggers a custom event.\n * @ko 커스텀 이벤트를 발생시킨다\n * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름\n * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터\n * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고\n * @example\n class Some extends eg.Component {\n some(){\n \tif(this.trigger(\"beforeHi\")){ // When event call to stop return false.\n \tthis.trigger(\"hi\");// fire hi event.\n \t}\n }\n }\n const some = new Some();\n some.on(\"beforeHi\", (e) => {\n if(condition){\n \te.stop(); // When event call to stop, `hi` event not call.\n }\n });\n some.on(\"hi\", (e) => {\n // `currentTarget` is component instance.\n console.log(some === e.currentTarget); // true\n });\n // If you want to more know event design. You can see article.\n // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F\n */\n\n\n var _proto = Component.prototype;\n\n _proto.trigger = function trigger(eventName, customEvent) {\n if (customEvent === void 0) {\n customEvent = {};\n }\n\n var handlerList = this._eventHandler[eventName] || [];\n var hasHandlerList = handlerList.length > 0;\n\n if (!hasHandlerList) {\n return true;\n } // If detach method call in handler in first time then handler list calls.\n\n\n handlerList = handlerList.concat();\n customEvent.eventType = eventName;\n var isCanceled = false;\n var arg = [customEvent];\n var i = 0;\n\n customEvent.stop = function () {\n isCanceled = true;\n };\n\n customEvent.currentTarget = this;\n\n for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n restParam[_key - 2] = arguments[_key];\n }\n\n if (restParam.length >= 1) {\n arg = arg.concat(restParam);\n }\n\n for (i = 0; handlerList[i]; i++) {\n handlerList[i].apply(this, arg);\n }\n\n return !isCanceled;\n };\n /**\n * Executed event just one time.\n * @ko 이벤트가 한번만 실행된다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n alert(\"hi\");\n }\n thing() {\n this.once(\"hi\", this.hi);\n }\n }\n var some = new Some();\n some.thing();\n some.trigger(\"hi\");\n // fire alert(\"hi\");\n some.trigger(\"hi\");\n // Nothing happens\n */\n\n\n _proto.once = function once(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var i;\n\n for (i in eventHash) {\n this.once(i, eventHash[i]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var self = this;\n this.on(eventName, function listener() {\n for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arg[_key2] = arguments[_key2];\n }\n\n handlerToAttach.apply(self, arg);\n self.off(eventName, listener);\n });\n }\n\n return this;\n };\n /**\n * Checks whether an event has been attached to a component.\n * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다.\n * @param {String} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름\n * @return {Boolean} Indicates whether the event is attached. 이벤트 등록 여부\n * @example\n class Some extends eg.Component {\n some() {\n this.hasOn(\"hi\");// check hi event.\n }\n }\n */\n\n\n _proto.hasOn = function hasOn(eventName) {\n return !!this._eventHandler[eventName];\n };\n /**\n * Attaches an event to a component.\n * @ko 컴포넌트에 이벤트를 등록한다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.on(\"hi\",this.hi); //attach event\n }\n }\n */\n\n\n _proto.on = function on(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.on(name, eventHash[name]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var handlerList = this._eventHandler[eventName];\n\n if (isUndefined(handlerList)) {\n this._eventHandler[eventName] = [];\n handlerList = this._eventHandler[eventName];\n }\n\n handlerList.push(handlerToAttach);\n }\n\n return this;\n };\n /**\n * Detaches an event from the component.\n * @ko 컴포넌트에 등록된 이벤트를 해제한다\n * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름\n * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.off(\"hi\",this.hi); //detach event\n }\n }\n */\n\n\n _proto.off = function off(eventName, handlerToDetach) {\n // All event detach.\n if (isUndefined(eventName)) {\n this._eventHandler = {};\n return this;\n } // All handler of specific event detach.\n\n\n if (isUndefined(handlerToDetach)) {\n if (typeof eventName === \"string\") {\n this._eventHandler[eventName] = undefined;\n return this;\n } else {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.off(name, eventHash[name]);\n }\n\n return this;\n }\n } // The handler of specific event detach.\n\n\n var handlerList = this._eventHandler[eventName];\n\n if (handlerList) {\n var k;\n var handlerFunction;\n\n for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) {\n if (handlerFunction === handlerToDetach) {\n handlerList = handlerList.splice(k, 1);\n break;\n }\n }\n }\n\n return this;\n };\n\n return Component;\n }();\n\n Component.VERSION = \"2.1.2\";\n return Component;\n}();\n\nexport default Component;\n//# sourceMappingURL=component.esm.js.map\n","/*! Hammer.JS - v2.0.17-rc - 2019-12-16\n * http://naver.github.io/egjs\n *\n * Forked By Naver egjs\n * Copyright (c) hammerjs\n * Licensed under the MIT license */\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\n\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\nvar assign$1 = assign;\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = typeof document === \"undefined\" ? {\n style: {}\n} : document.createElement('div');\nvar TYPE_FUNCTION = 'function';\nvar round = Math.round,\n abs = Math.abs;\nvar now = Date.now;\n\n/**\n * @private\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n\nfunction prefixed(obj, property) {\n var prefix;\n var prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n\n i++;\n }\n\n return undefined;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {};\n} else {\n win = window;\n}\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\nfunction getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n\n var touchMap = {};\n var cssSupports = win.CSS && win.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n}\n\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\nvar TOUCH_ACTION_MAP = getTouchActionProps();\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\nvar SUPPORT_TOUCH = 'ontouchstart' in win;\nvar SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\nvar COMPUTE_INTERVAL = 25;\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * @private\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * @private\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n\nfunction boolOrFn(val, args) {\n if (typeof val === TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n\n return val;\n}\n\n/**\n * @private\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * @private\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n } // pan-x OR pan-y\n\n\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n } // manipulation\n\n\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * @private\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n\nvar TouchAction =\n/*#__PURE__*/\nfunction () {\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n /**\n * @private\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n\n\n var _proto = TouchAction.prototype;\n\n _proto.set = function set(value) {\n // find out the touch-action by the event handlers\n if (value === TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n\n this.actions = value.toLowerCase().trim();\n };\n /**\n * @private\n * just re-set the touchAction value\n */\n\n\n _proto.update = function update() {\n this.set(this.manager.options.touchAction);\n };\n /**\n * @private\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n\n\n _proto.compute = function compute() {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n };\n /**\n * @private\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n\n\n _proto.preventDefaults = function preventDefaults(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection; // if the touch action did prevented once this session\n\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n\n if (hasNone) {\n // do not prevent defaults if this is a tap gesture\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {\n return this.preventSrc(srcEvent);\n }\n };\n /**\n * @private\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n\n\n _proto.preventSrc = function preventSrc(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n };\n\n return TouchAction;\n}();\n\n/**\n * @private\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node === parent) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}\n\n/**\n * @private\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n\nfunction getCenter(pointers) {\n var pointersLength = pointers.length; // no need to loop when only one touch\n\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0;\n var y = 0;\n var i = 0;\n\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * @private\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * @private\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * @private\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * @private\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session;\n // jscs throwing error on defalut destructured values and without defaults tests fail\n\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * @private\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * @private\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input;\n var deltaTime = input.timeStamp - last.timeStamp;\n var velocity;\n var velocityX;\n var velocityY;\n var direction;\n\n if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n* @private\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length; // store the first input to calculate the distance and direction\n\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n } // to compute scale and rotation we need to store the multiple touches\n\n\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput,\n firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;\n computeIntervalInputData(session, input); // find the correct target\n\n var target = manager.element;\n var srcEvent = input.srcEvent;\n var srcEventTarget;\n\n if (srcEvent.composedPath) {\n srcEventTarget = srcEvent.composedPath()[0];\n } else if (srcEvent.path) {\n srcEventTarget = srcEvent.path[0];\n } else {\n srcEventTarget = srcEvent.target;\n }\n\n if (hasParent(srcEventTarget, target)) {\n target = srcEventTarget;\n }\n\n input.target = target;\n}\n\n/**\n * @private\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n } // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n\n\n input.eventType = eventType; // compute scale, rotation etc\n\n computeInputData(manager, input); // emit secret event\n\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * @private\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * @private\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n}\n\n/**\n * @private\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n\nvar Input =\n/*#__PURE__*/\nfunction () {\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n }\n /**\n * @private\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n\n\n var _proto = Input.prototype;\n\n _proto.handler = function handler() {};\n /**\n * @private\n * bind the events\n */\n\n\n _proto.init = function init() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n /**\n * @private\n * unbind the events\n */\n\n\n _proto.destroy = function destroy() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n\n return Input;\n}();\n\n/**\n * @private\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n\n while (i < src.length) {\n if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {\n // do not use === here, test fails\n return i;\n }\n\n i++;\n }\n\n return -1;\n }\n}\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n}; // in IE10 the pointer types is defined as an enum\n\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\n};\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive\n\nif (win.MSPointerEvent && !win.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n/**\n * @private\n * Pointer events input\n * @constructor\n * @extends Input\n */\n\n\nvar PointerEventInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(PointerEventInput, _Input);\n\n function PointerEventInput() {\n var _this;\n\n var proto = PointerEventInput.prototype;\n proto.evEl = POINTER_ELEMENT_EVENTS;\n proto.evWin = POINTER_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.store = _this.manager.session.pointerEvents = [];\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = PointerEventInput.prototype;\n\n _proto.handler = function handler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store\n\n var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down\n\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n } // it not found, so the pointer hasn't been down (so it's probably a hover)\n\n\n if (storeIndex < 0) {\n return;\n } // update the event in the store\n\n\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n };\n\n return PointerEventInput;\n}(Input);\n\n/**\n * @private\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * @private\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function (a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n\nvar TouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(TouchInput, _Input);\n\n function TouchInput() {\n var _this;\n\n TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS;\n\n return _this;\n }\n\n var _proto = TouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return TouchInput;\n}(Input);\n\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds; // when there is only one touch, the process can be simplified\n\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i;\n var targetTouches;\n var changedTouches = toArray(ev.changedTouches);\n var changedTargetTouches = [];\n var target = this.target; // get target touches from touches\n\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n }); // collect touches\n\n if (type === INPUT_START) {\n i = 0;\n\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n } // filter changed touches to only contain touches that exist in the collected target ids\n\n\n i = 0;\n\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n } // cleanup removed touches\n\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n/**\n * @private\n * Mouse events input\n * @constructor\n * @extends Input\n */\n\nvar MouseInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(MouseInput, _Input);\n\n function MouseInput() {\n var _this;\n\n var proto = MouseInput.prototype;\n proto.evEl = MOUSE_ELEMENT_EVENTS;\n proto.evWin = MOUSE_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.pressed = false; // mousedown state\n\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = MouseInput.prototype;\n\n _proto.handler = function handler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down\n\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n } // mouse must be down\n\n\n if (!this.pressed) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n };\n\n return MouseInput;\n}(Input);\n\n/**\n * @private\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\nvar DEDUP_TIMEOUT = 2500;\nvar DEDUP_DISTANCE = 25;\n\nfunction setLastTouch(eventData) {\n var _eventData$changedPoi = eventData.changedPointers,\n touch = _eventData$changedPoi[0];\n\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {\n x: touch.clientX,\n y: touch.clientY\n };\n var lts = this.lastTouches;\n this.lastTouches.push(lastTouch);\n\n var removeLastTouch = function removeLastTouch() {\n var i = lts.indexOf(lastTouch);\n\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n}\n\nfunction recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n}\n\nfunction isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX;\n var y = eventData.srcEvent.clientY;\n\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x);\n var dy = Math.abs(y - t.y);\n\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n\n return false;\n}\n\nvar TouchMouseInput =\n/*#__PURE__*/\nfunction () {\n var TouchMouseInput =\n /*#__PURE__*/\n function (_Input) {\n _inheritsLoose(TouchMouseInput, _Input);\n\n function TouchMouseInput(_manager, callback) {\n var _this;\n\n _this = _Input.call(this, _manager, callback) || this;\n\n _this.handler = function (manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;\n var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;\n\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n } // when we're in a touch event, record touches to de-dupe synthetic mouse event\n\n\n if (isTouch) {\n recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) {\n return;\n }\n\n _this.callback(manager, inputEvent, inputData);\n };\n\n _this.touch = new TouchInput(_this.manager, _this.handler);\n _this.mouse = new MouseInput(_this.manager, _this.handler);\n _this.primaryTouch = null;\n _this.lastTouches = [];\n return _this;\n }\n /**\n * @private\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n\n\n var _proto = TouchMouseInput.prototype;\n\n /**\n * @private\n * remove the event listeners\n */\n _proto.destroy = function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n };\n\n return TouchMouseInput;\n }(Input);\n\n return TouchMouseInput;\n}();\n\n/**\n * @private\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n\nfunction createInputInstance(manager) {\n var Type; // let inputClass = manager.options.inputClass;\n\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n\n return new Type(manager, inputHandler);\n}\n\n/**\n * @private\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n\n return false;\n}\n\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * @private\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * @private\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n\n if (manager) {\n return manager.get(otherRecognizer);\n }\n\n return otherRecognizer;\n}\n\n/**\n * @private\n * get a usable string, used as event postfix\n * @param {constant} state\n * @returns {String} state\n */\n\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n\n return '';\n}\n\n/**\n * @private\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n\n/**\n * @private\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n\nvar Recognizer =\n/*#__PURE__*/\nfunction () {\n function Recognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.options = _extends({\n enable: true\n }, options);\n this.id = uniqueId();\n this.manager = null; // default is enable true\n\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n\n\n var _proto = Recognizer.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state\n\n this.manager && this.manager.touchAction.update();\n return this;\n };\n /**\n * @private\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.recognizeWith = function recognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n };\n /**\n * @private\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.requireFailure = function requireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n\n return this;\n };\n /**\n * @private\n * has require failures boolean\n * @returns {boolean}\n */\n\n\n _proto.hasRequireFailures = function hasRequireFailures() {\n return this.requireFail.length > 0;\n };\n /**\n * @private\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n\n\n _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n };\n /**\n * @private\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n\n\n _proto.emit = function emit(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n } // 'panstart' and 'panmove'\n\n\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n } // panend and pancancel\n\n\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n };\n /**\n * @private\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n\n\n _proto.tryEmit = function tryEmit(input) {\n if (this.canEmit()) {\n return this.emit(input);\n } // it's failing anyway\n\n\n this.state = STATE_FAILED;\n };\n /**\n * @private\n * can we emit?\n * @returns {boolean}\n */\n\n\n _proto.canEmit = function canEmit() {\n var i = 0;\n\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n\n i++;\n }\n\n return true;\n };\n /**\n * @private\n * update the recognizer\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing?\n\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n } // reset when we've reached the end\n\n\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone); // the recognizer has recognized a gesture\n // so trigger an event\n\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n };\n /**\n * @private\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {constant} STATE\n */\n\n /* jshint ignore:start */\n\n\n _proto.process = function process(inputData) {};\n /* jshint ignore:end */\n\n /**\n * @private\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n\n\n _proto.getTouchAction = function getTouchAction() {};\n /**\n * @private\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n\n\n _proto.reset = function reset() {};\n\n return Recognizer;\n}();\n\n/**\n * @private\n * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n\nvar TapRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(TapRecognizer, _Recognizer);\n\n function TapRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n // max time between the multi-tap taps\n time: 250,\n // max time of the pointer to be down (like finger on the screen)\n threshold: 9,\n // a minimal movement is ok, but keep it low\n posThreshold: 10\n }, options)) || this; // previous time and center,\n // used for tap counting\n\n _this.pTime = false;\n _this.pCenter = false;\n _this._timer = null;\n _this._input = null;\n _this.count = 0;\n return _this;\n }\n\n var _proto = TapRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_MANIPULATION];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n\n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n } // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType !== INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input; // if tap count matches we have recognized it,\n // else it has began recognizing...\n\n var tapCount = this.count % options.taps;\n\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.interval);\n return STATE_BEGAN;\n }\n }\n }\n\n return STATE_FAILED;\n };\n\n _proto.failTimeout = function failTimeout() {\n var _this3 = this;\n\n this._timer = setTimeout(function () {\n _this3.state = STATE_FAILED;\n }, this.options.interval);\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit() {\n if (this.state === STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return TapRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n\nvar AttrRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(AttrRecognizer, _Recognizer);\n\n function AttrRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _Recognizer.call(this, _extends({\n pointers: 1\n }, options)) || this;\n }\n /**\n * @private\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n\n\n var _proto = AttrRecognizer.prototype;\n\n _proto.attrTest = function attrTest(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n };\n /**\n * @private\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n\n\n _proto.process = function process(input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED\n\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n\n return state | STATE_CHANGED;\n }\n\n return STATE_FAILED;\n };\n\n return AttrRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * direction cons to string\n * @param {constant} direction\n * @returns {String}\n */\n\nfunction directionStr(direction) {\n if (direction === DIRECTION_DOWN) {\n return 'down';\n } else if (direction === DIRECTION_UP) {\n return 'up';\n } else if (direction === DIRECTION_LEFT) {\n return 'left';\n } else if (direction === DIRECTION_RIGHT) {\n return 'right';\n }\n\n return '';\n}\n\n/**\n * @private\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PanRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PanRecognizer, _AttrRecognizer);\n\n function PanRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _AttrRecognizer.call(this, _extends({\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n }, options)) || this;\n _this.pX = null;\n _this.pY = null;\n return _this;\n }\n\n var _proto = PanRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n var direction = this.options.direction;\n var actions = [];\n\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n\n return actions;\n };\n\n _proto.directionTest = function directionTest(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY; // lock to axis?\n\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x !== this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y !== this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n };\n\n _proto.attrTest = function attrTest(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call\n this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));\n };\n\n _proto.emit = function emit(input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PanRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar SwipeRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(SwipeRecognizer, _AttrRecognizer);\n\n function SwipeRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n }, options)) || this;\n }\n\n var _proto = SwipeRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n };\n\n _proto.attrTest = function attrTest(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n };\n\n _proto.emit = function emit(input) {\n var direction = directionStr(input.offsetDirection);\n\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n };\n\n return SwipeRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PinchRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PinchRecognizer, _AttrRecognizer);\n\n function PinchRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'pinch',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = PinchRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n _proto.emit = function emit(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PinchRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar RotateRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(RotateRecognizer, _AttrRecognizer);\n\n function RotateRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'rotate',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = RotateRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n return RotateRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n\nvar PressRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(PressRecognizer, _Recognizer);\n\n function PressRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'press',\n pointers: 1,\n time: 251,\n // minimal time of the pointer to be pressed\n threshold: 9\n }, options)) || this;\n _this._timer = null;\n _this._input = null;\n return _this;\n }\n\n var _proto = PressRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_AUTO];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input; // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.time);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + \"up\", input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return PressRecognizer;\n}(Recognizer);\n\nvar defaults = {\n /**\n * @private\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * @private\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @private\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * @private\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * @private\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * @private\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * @private\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: \"none\",\n\n /**\n * @private\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: \"none\",\n\n /**\n * @private\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: \"none\",\n\n /**\n * @private\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: \"none\",\n\n /**\n * @private\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: \"none\",\n\n /**\n * @private\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: \"rgba(0,0,0,0)\"\n }\n};\n/**\n * @private\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * This is separated with other defaults because of tree-shaking.\n * @type {Array}\n */\n\nvar preset = [[RotateRecognizer, {\n enable: false\n}], [PinchRecognizer, {\n enable: false\n}, ['rotate']], [SwipeRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}], [PanRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}, ['swipe']], [TapRecognizer], [TapRecognizer, {\n event: 'doubletap',\n taps: 2\n}, ['tap']], [PressRecognizer]];\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n/**\n * @private\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n\n if (!element.style) {\n return;\n }\n\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || \"\";\n }\n });\n\n if (!add) {\n manager.oldCssProps = {};\n }\n}\n/**\n * @private\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n\n\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent(\"Event\");\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n/**\n* @private\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\n\nvar Manager =\n/*#__PURE__*/\nfunction () {\n function Manager(element, options) {\n var _this = this;\n\n this.options = assign$1({}, defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = _this.add(new item[0](item[1]));\n\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n\n\n var _proto = Manager.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // Options that need a little more setup\n\n if (options.touchAction) {\n this.touchAction.update();\n }\n\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n\n return this;\n };\n /**\n * @private\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n\n\n _proto.stop = function stop(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n };\n /**\n * @private\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n var session = this.session;\n\n if (session.stopped) {\n return;\n } // run the touch-action polyfill\n\n\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers; // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n\n var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized\n // or when we're in a new session\n\n if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {\n session.curRecognizer = null;\n curRecognizer = null;\n }\n\n var i = 0;\n\n while (i < recognizers.length) {\n recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer === curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n\n\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n session.curRecognizer = recognizer;\n curRecognizer = recognizer;\n }\n\n i++;\n }\n };\n /**\n * @private\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n\n\n _proto.get = function get(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event === recognizer) {\n return recognizers[i];\n }\n }\n\n return null;\n };\n /**\n * @private add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n\n\n _proto.add = function add(recognizer) {\n if (invokeArrayArg(recognizer, \"add\", this)) {\n return this;\n } // remove existing\n\n\n var existing = this.get(recognizer.options.event);\n\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n };\n /**\n * @private\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n\n\n _proto.remove = function remove(recognizer) {\n if (invokeArrayArg(recognizer, \"remove\", this)) {\n return this;\n }\n\n var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists\n\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, targetRecognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n };\n /**\n * @private\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n\n\n _proto.on = function on(events, handler) {\n if (events === undefined || handler === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n };\n /**\n * @private unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n\n\n _proto.off = function off(events, handler) {\n if (events === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n };\n /**\n * @private emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n\n\n _proto.emit = function emit(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n } // no handlers, so skip it all\n\n\n var handlers = this.handlers[event] && this.handlers[event].slice();\n\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n };\n /**\n * @private\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n\n\n _proto.destroy = function destroy() {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n };\n\n return Manager;\n}();\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Touch events input\n * @constructor\n * @extends Input\n */\n\nvar SingleTouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(SingleTouchInput, _Input);\n\n function SingleTouchInput() {\n var _this;\n\n var proto = SingleTouchInput.prototype;\n proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.started = false;\n return _this;\n }\n\n var _proto = SingleTouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?\n\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state\n\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return SingleTouchInput;\n}(Input);\n\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\n/**\n * @private\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = \"DEPRECATED METHOD: \" + name + \"\\n\" + message + \" AT \\n\";\n return function () {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '').replace(/^\\s+at\\s+/gm, '').replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n\n return method.apply(this, arguments);\n };\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n\nvar extend = deprecate(function (dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n\n while (i < keys.length) {\n if (!merge || merge && dest[keys[i]] === undefined) {\n dest[keys[i]] = src[keys[i]];\n }\n\n i++;\n }\n\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * @private\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n\nvar merge = deprecate(function (dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * @private\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n\nfunction inherit(child, base, properties) {\n var baseP = base.prototype;\n var childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign$1(childP, properties);\n }\n}\n\n/**\n * @private\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * @private\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\nvar Hammer =\n/*#__PURE__*/\nfunction () {\n var Hammer =\n /**\n * @private\n * @const {string}\n */\n function Hammer(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n return new Manager(element, _extends({\n recognizers: preset.concat()\n }, options));\n };\n\n Hammer.VERSION = \"2.0.17-rc\";\n Hammer.DIRECTION_ALL = DIRECTION_ALL;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.DIRECTION_LEFT = DIRECTION_LEFT;\n Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;\n Hammer.DIRECTION_UP = DIRECTION_UP;\n Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n Hammer.DIRECTION_NONE = DIRECTION_NONE;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.INPUT_START = INPUT_START;\n Hammer.INPUT_MOVE = INPUT_MOVE;\n Hammer.INPUT_END = INPUT_END;\n Hammer.INPUT_CANCEL = INPUT_CANCEL;\n Hammer.STATE_POSSIBLE = STATE_POSSIBLE;\n Hammer.STATE_BEGAN = STATE_BEGAN;\n Hammer.STATE_CHANGED = STATE_CHANGED;\n Hammer.STATE_ENDED = STATE_ENDED;\n Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;\n Hammer.STATE_CANCELLED = STATE_CANCELLED;\n Hammer.STATE_FAILED = STATE_FAILED;\n Hammer.Manager = Manager;\n Hammer.Input = Input;\n Hammer.TouchAction = TouchAction;\n Hammer.TouchInput = TouchInput;\n Hammer.MouseInput = MouseInput;\n Hammer.PointerEventInput = PointerEventInput;\n Hammer.TouchMouseInput = TouchMouseInput;\n Hammer.SingleTouchInput = SingleTouchInput;\n Hammer.Recognizer = Recognizer;\n Hammer.AttrRecognizer = AttrRecognizer;\n Hammer.Tap = TapRecognizer;\n Hammer.Pan = PanRecognizer;\n Hammer.Swipe = SwipeRecognizer;\n Hammer.Pinch = PinchRecognizer;\n Hammer.Rotate = RotateRecognizer;\n Hammer.Press = PressRecognizer;\n Hammer.on = addEventListeners;\n Hammer.off = removeEventListeners;\n Hammer.each = each;\n Hammer.merge = merge;\n Hammer.extend = extend;\n Hammer.bindFn = bindFn;\n Hammer.assign = assign$1;\n Hammer.inherit = inherit;\n Hammer.bindFn = bindFn;\n Hammer.prefixed = prefixed;\n Hammer.toArray = toArray;\n Hammer.inArray = inArray;\n Hammer.uniqueArray = uniqueArray;\n Hammer.splitStr = splitStr;\n Hammer.boolOrFn = boolOrFn;\n Hammer.hasParent = hasParent;\n Hammer.addEventListeners = addEventListeners;\n Hammer.removeEventListeners = removeEventListeners;\n Hammer.defaults = assign$1({}, defaults, {\n preset: preset\n });\n return Hammer;\n}();\n\n// style loader but by script tag, not by the loader.\n\nvar defaults$1 = Hammer.defaults;\n\nexport default Hammer;\nexport { INPUT_START, INPUT_MOVE, INPUT_END, INPUT_CANCEL, STATE_POSSIBLE, STATE_BEGAN, STATE_CHANGED, STATE_ENDED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_FAILED, DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, Input, TouchAction, TouchInput, MouseInput, PointerEventInput, TouchMouseInput, SingleTouchInput, Recognizer, AttrRecognizer, TapRecognizer as Tap, PanRecognizer as Pan, SwipeRecognizer as Swipe, PinchRecognizer as Pinch, RotateRecognizer as Rotate, PressRecognizer as Press, addEventListeners as on, removeEventListeners as off, each, merge, extend, assign$1 as assign, inherit, bindFn, prefixed, toArray, inArray, uniqueArray, splitStr, boolOrFn, hasParent, addEventListeners, removeEventListeners, defaults$1 as defaults };\n//# sourceMappingURL=hammer.esm.js.map\n","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/axes project is licensed under the MIT license\n\n@egjs/axes JavaScript library\nhttps://github.com/naver/egjs-axes\n\n@version 2.7.1\n*/\nimport { DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, PointerEventInput, TouchMouseInput, TouchInput, MouseInput, Pan, Pinch } from '@egjs/hammerjs';\nimport getAgent from '@egjs/agent';\nimport Component from '@egjs/component';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n};\n\nfunction __extends(d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nfunction getInsidePosition(destPos, range, circular, bounce) {\n var toDestPos = destPos;\n var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]];\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n return toDestPos;\n} // determine outside\n\nfunction isOutside(pos, range) {\n return pos < range[0] || pos > range[1];\n}\nfunction getDuration(distance, deceleration) {\n var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero\n\n return duration < 100 ? 0 : duration;\n}\nfunction isCircularable(destPos, range, circular) {\n return circular[1] && destPos > range[1] || circular[0] && destPos < range[0];\n}\nfunction getCirculatedPos(pos, range, circular) {\n var toPos = pos;\n var min = range[0];\n var max = range[1];\n var length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = (toPos - max) % length + min;\n }\n\n if (circular[0] && pos < min) {\n // left\n toPos = (toPos - min) % length + max;\n }\n\n return toPos;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\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\nfunction toArray(nodes) {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n var el = [];\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n\n return el;\n}\nfunction $(param, multi) {\n if (multi === void 0) {\n multi = false;\n }\n\n var el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n var match = param.match(/^<([a-z]+)\\s*([^>]*)>/); // creating element\n\n if (match) {\n // HTML\n var dummy = document.createElement(\"div\");\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === win) {\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 (\"jQuery\" in win && param instanceof jQuery || param.constructor.prototype.jquery) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map(function (v) {\n return $(v);\n });\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n\n return el;\n}\nvar raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame;\nvar caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;\n\nif (raf && !caf) {\n var keyInfo_1 = {};\n var oldraf_1 = raf;\n\n raf = function (callback) {\n function wrapCallback(timestamp) {\n if (keyInfo_1[key]) {\n callback(timestamp);\n }\n }\n\n var key = oldraf_1(wrapCallback);\n keyInfo_1[key] = true;\n return key;\n };\n\n caf = function (key) {\n delete keyInfo_1[key];\n };\n} else if (!(raf && caf)) {\n raf = function (callback) {\n return win.setTimeout(function () {\n callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime());\n }, 16);\n };\n\n caf = win.clearTimeout;\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 */\n\n\nfunction 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*/\n\nfunction cancelAnimationFrame(key) {\n caf(key);\n}\nfunction map(obj, callback) {\n var tranformed = {};\n\n for (var k in obj) {\n k && (tranformed[k] = callback(obj[k], k));\n }\n\n return tranformed;\n}\nfunction filter(obj, callback) {\n var filtered = {};\n\n for (var k in obj) {\n k && callback(obj[k], k) && (filtered[k] = obj[k]);\n }\n\n return filtered;\n}\nfunction every(obj, callback) {\n for (var k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n\n return true;\n}\nfunction equal(target, base) {\n return every(target, function (v, k) {\n return v === base[k];\n });\n}\nvar roundNumFunc = {};\nfunction roundNumber(num, roundUnit) {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n}\nfunction roundNumbers(num, roundUnit) {\n if (!num || !roundUnit) {\n return num;\n }\n\n var isNumber = typeof roundUnit === \"number\";\n return map(num, function (value, key) {\n return roundNumber(value, isNumber ? roundUnit : roundUnit[key]);\n });\n}\nfunction getDecimalPlace(val) {\n if (!isFinite(val)) {\n return 0;\n }\n\n var v = val + \"\";\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n var p = 0;\n var e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n } // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n\n\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n}\nfunction inversePow(n) {\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}\nfunction getRoundFunc(v) {\n var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n return function (n) {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n}\n\nfunction minMax(value, min, max) {\n return Math.max(Math.min(value, max), min);\n}\n\nvar AnimationManager =\n/*#__PURE__*/\nfunction () {\n function AnimationManager(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n var __proto = AnimationManager.prototype;\n\n __proto.getDuration = function (depaPos, destPos, wishDuration) {\n var _this = this;\n\n var duration;\n\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n var durations_1 = map(destPos, function (v, k) {\n return getDuration(Math.abs(v - depaPos[k]), _this.options.deceleration);\n });\n duration = Object.keys(durations_1).reduce(function (max, v) {\n return Math.max(max, durations_1[v]);\n }, -Infinity);\n }\n\n return minMax(duration, this.options.minimumDuration, this.options.maximumDuration);\n };\n\n __proto.createAnimationParam = function (pos, duration, option) {\n var depaPos = this.axm.get();\n var destPos = pos;\n var inputEvent = option && option.event || null;\n return {\n depaPos: depaPos,\n destPos: destPos,\n duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration),\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: inputEvent,\n input: option && option.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd\n };\n };\n\n __proto.grab = function (axes, option) {\n if (this._animateParam && axes.length) {\n var orgPos_1 = this.axm.get(axes);\n var pos = this.axm.map(orgPos_1, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n });\n\n if (!every(pos, function (v, k) {\n return orgPos_1[k] === v;\n })) {\n this.em.triggerChange(pos, false, orgPos_1, option, !!option);\n }\n\n this._animateParam = null;\n this._raf && cancelAnimationFrame(this._raf);\n this._raf = null;\n this.em.triggerAnimationEnd(!!(option && option.event));\n }\n };\n\n __proto.getEventInfo = function () {\n if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent\n };\n } else {\n return null;\n }\n };\n\n __proto.restore = function (option) {\n var pos = this.axm.get();\n var destPos = this.axm.map(pos, function (v, opt) {\n return Math.min(opt.range[1], Math.max(opt.range[0], v));\n });\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n };\n\n __proto.animationEnd = function () {\n var beforeParam = this.getEventInfo();\n this._animateParam = null; // for Circular\n\n var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n });\n Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n }));\n this.itm.setInterrupt(false);\n this.em.triggerAnimationEnd(!!beforeParam);\n\n if (this.axm.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n };\n\n __proto.finish = function (isTrusted) {\n this._animateParam = null;\n this.itm.setInterrupt(false);\n this.em.triggerFinish(isTrusted);\n };\n\n __proto.animateLoop = function (param, complete) {\n if (param.duration) {\n this._animateParam = __assign({}, param);\n var info_1 = this._animateParam;\n var self_1 = this;\n var destPos_1 = info_1.destPos;\n var prevPos_1 = info_1.depaPos;\n var prevEasingPer_1 = 0;\n var directions_1 = map(prevPos_1, function (value, key) {\n return value <= destPos_1[key] ? 1 : -1;\n });\n var originalIntendedPos_1 = map(destPos_1, function (v) {\n return v;\n });\n var prevTime_1 = new Date().getTime();\n info_1.startTime = prevTime_1;\n\n (function loop() {\n self_1._raf = null;\n var currentTime = new Date().getTime();\n var ratio = (currentTime - info_1.startTime) / param.duration;\n var easingPer = self_1.easing(ratio);\n var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) {\n var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n\n var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular);\n\n if (nextPos !== circulatedPos) {\n // circular\n var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]);\n destPos_1[key] -= rangeOffset;\n prevPos_1[key] -= rangeOffset;\n }\n\n return circulatedPos;\n });\n var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1);\n prevPos_1 = toPos;\n prevTime_1 = currentTime;\n prevEasingPer_1 = easingPer;\n\n if (easingPer >= 1) {\n destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1);\n\n if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) {\n self_1.em.triggerChange(destPos_1, true, prevPos_1);\n }\n\n complete();\n return;\n } else if (isCanceled) {\n self_1.finish(false);\n } else {\n // animationEnd\n self_1._raf = requestAnimationFrame(loop);\n }\n })();\n } else {\n this.em.triggerChange(param.destPos, true);\n complete();\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 *\n * @param originalIntendedPos\n * @param destPos\n */\n\n\n __proto.getFinalPos = function (destPos, originalIntendedPos) {\n var _this = this; // compare destPos and originalIntendedPos\n\n\n var ERROR_LIMIT = 0.000001;\n var finalPos = map(destPos, function (value, key) {\n if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n var roundUnit = _this.getRoundUnit(value, key);\n\n var result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n };\n\n __proto.getRoundUnit = function (val, key) {\n var roundUnit = this.options.round; // manual mode\n\n var minRoundUnit = null; // auto mode\n // auto mode\n\n if (!roundUnit) {\n // Get minimum round unit\n var options = this.axm.getAxisOptions(key);\n minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val)));\n }\n\n return minRoundUnit || roundUnit;\n };\n\n __proto.getUserControll = function (param) {\n var userWish = param.setTo();\n userWish.destPos = this.axm.get(userWish.destPos);\n userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration);\n return userWish;\n };\n\n __proto.animateTo = function (destPos, duration, option) {\n var _this = this;\n\n var param = this.createAnimationParam(destPos, duration, option);\n\n var depaPos = __assign({}, param.depaPos);\n\n var retTrigger = this.em.triggerAnimationStart(param); // to control\n\n var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true.\n\n if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n })) {\n console.warn(\"You can't stop the 'animation' event when 'circular' is true.\");\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n var inputEvent = option && option.event || null;\n this.animateLoop({\n depaPos: depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axm.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent: inputEvent,\n input: option && option.input || null\n }, function () {\n return _this.animationEnd();\n });\n }\n };\n\n __proto.easing = function (p) {\n return p > 1 ? 1 : this.options.easing(p);\n };\n\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n var axes = Object.keys(pos);\n this.grab(axes);\n var orgPos = this.axm.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n\n this.itm.setInterrupt(true);\n var movedPos = filter(pos, function (v, k) {\n return orgPos[k] !== v;\n });\n\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axm.map(movedPos, function (v, opt) {\n var range = opt.range,\n circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular);\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.em.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n };\n\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) {\n return v + pos[k];\n }), duration);\n };\n\n return AnimationManager;\n}();\n\nvar EventManager =\n/*#__PURE__*/\nfunction () {\n function EventManager(axes) {\n this.axes = axes;\n }\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @name eg.Axes#hold\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n var __proto = EventManager.prototype;\n\n __proto.triggerHold = function (pos, option) {\n var roundPos = this.getRoundPos(pos).roundPos;\n this.axes.trigger(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true\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 * @name set\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\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 * @name setTo\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\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 * @name eg.Axes#release\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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} 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 * 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\n __proto.triggerRelease = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n this.axes.trigger(\"release\", param);\n };\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @name eg.Axes#change\n * @event\n * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\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 * 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\n __proto.triggerChange = function (pos, isAccurate, depaPos, option, holding) {\n if (holding === void 0) {\n holding = false;\n }\n\n var am = this.am;\n var axm = am.axm;\n var eventInfo = am.getEventInfo();\n\n var _a = this.getRoundPos(pos, depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n var moveTo = axm.moveTo(roundPos, roundDepa);\n var inputEvent = option && option.event || eventInfo && eventInfo.event || null;\n var param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n holding: holding,\n inputEvent: inputEvent,\n isTrusted: !!inputEvent,\n input: option && option.input || eventInfo && eventInfo.input || null,\n set: inputEvent ? this.createUserControll(moveTo.pos) : function () {}\n };\n var result = this.axes.trigger(\"change\", param);\n inputEvent && axm.set(param.set()[\"destPos\"]);\n return result;\n };\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @name eg.Axes#animationStart\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationStart = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n return this.axes.trigger(\"animationStart\", param);\n };\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#animationEnd\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationEnd = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"animationEnd\", {\n isTrusted: isTrusted\n });\n };\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#finish\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerFinish = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"finish\", {\n isTrusted: isTrusted\n });\n };\n\n __proto.createUserControll = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n } // to controll\n\n\n var userControl = {\n destPos: __assign({}, pos),\n duration: duration\n };\n return function (toPos, userDuration) {\n toPos && (userControl.destPos = __assign({}, toPos));\n userDuration !== undefined && (userControl.duration = userDuration);\n return userControl;\n };\n };\n\n __proto.setAnimationManager = function (am) {\n this.am = am;\n };\n\n __proto.destroy = function () {\n this.axes.off();\n };\n\n __proto.getRoundPos = function (pos, depaPos) {\n // round value if round exist\n var roundUnit = this.axes.options.round; // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit)\n };\n };\n\n return EventManager;\n}();\n\nvar InterruptManager =\n/*#__PURE__*/\nfunction () {\n function InterruptManager(options) {\n this.options = options;\n this._prevented = false; // check whether the animation event was prevented\n }\n\n var __proto = InterruptManager.prototype;\n\n __proto.isInterrupting = function () {\n // when interruptable is 'true', return value is always 'true'.\n return this.options.interruptable || this._prevented;\n };\n\n __proto.isInterrupted = function () {\n return !this.options.interruptable && this._prevented;\n };\n\n __proto.setInterrupt = function (prevented) {\n !this.options.interruptable && (this._prevented = prevented);\n };\n\n return InterruptManager;\n}();\n\nvar AxisManager =\n/*#__PURE__*/\nfunction () {\n function AxisManager(axis, options) {\n var _this = this;\n\n this.axis = axis;\n this.options = options;\n\n this._complementOptions();\n\n this._pos = Object.keys(this.axis).reduce(function (acc, v) {\n acc[v] = _this.axis[v].range[0];\n return acc;\n }, {});\n }\n /**\n * set up 'css' expression\n * @private\n */\n\n\n var __proto = AxisManager.prototype;\n\n __proto._complementOptions = function () {\n var _this = this;\n\n Object.keys(this.axis).forEach(function (axis) {\n _this.axis[axis] = __assign({\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false]\n }, _this.axis[axis]);\n [\"bounce\", \"circular\"].forEach(function (v) {\n var axisOption = _this.axis;\n var 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 __proto.getDelta = function (depaPos, destPos) {\n var fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), function (v, k) {\n return v - fullDepaPos[k];\n });\n };\n\n __proto.get = function (axes) {\n var _this = this;\n\n if (axes && Array.isArray(axes)) {\n return axes.reduce(function (acc, v) {\n if (v && v in _this._pos) {\n acc[v] = _this._pos[v];\n }\n\n return acc;\n }, {});\n } else {\n return __assign({}, this._pos, axes || {});\n }\n };\n\n __proto.moveTo = function (pos, depaPos) {\n if (depaPos === void 0) {\n depaPos = this._pos;\n }\n\n var delta = map(this._pos, function (v, key) {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n this.set(this.map(pos, function (v, opt) {\n return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0;\n }));\n return {\n pos: __assign({}, this._pos),\n delta: delta\n };\n };\n\n __proto.set = function (pos) {\n for (var k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n };\n\n __proto.every = function (pos, callback) {\n var axisOptions = this.axis;\n return every(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.filter = function (pos, callback) {\n var axisOptions = this.axis;\n return filter(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.map = function (pos, callback) {\n var axisOptions = this.axis;\n return map(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.isOutside = function (axes) {\n return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) {\n return !isOutside(v, opt.range);\n });\n };\n\n __proto.getAxisOptions = function (key) {\n return this.axis[key];\n };\n\n return AxisManager;\n}();\n\nvar InputObserver =\n/*#__PURE__*/\nfunction () {\n function InputObserver(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm,\n am = _a.am;\n this.isOutside = false;\n this.moveDistance = null;\n this.isStopped = false;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.am = am;\n } // when move pointer is held in outside\n\n\n var __proto = InputObserver.prototype;\n\n __proto.atOutside = function (pos) {\n var _this = this;\n\n if (this.isOutside) {\n return this.axm.map(pos, function (v, opt) {\n var tn = opt.range[0] - opt.bounce[0];\n var tx = opt.range[1] + opt.bounce[1];\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n // when start pointer is held in inside\n // get a initialization slope value to prevent smooth animation.\n var initSlope_1 = this.am.easing(0.00001) / 0.00001;\n return this.axm.map(pos, function (v, opt) {\n var min = opt.range[0];\n var max = opt.range[1];\n var out = opt.bounce;\n var circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return min - _this.am.easing((min - v) / (out[0] * initSlope_1)) * out[0];\n } else if (v > max) {\n // right\n return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1];\n }\n\n return v;\n });\n }\n };\n\n __proto.get = function (input) {\n return this.axm.get(input.axes);\n };\n\n __proto.hold = function (input, event) {\n if (this.itm.isInterrupted() || !input.axes.length) {\n return;\n }\n\n var changeOption = {\n input: input,\n event: event\n };\n this.isStopped = false;\n this.itm.setInterrupt(true);\n this.am.grab(input.axes, changeOption);\n !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption);\n this.isOutside = this.axm.isOutside(input.axes);\n this.moveDistance = this.axm.get(input.axes);\n };\n\n __proto.change = function (input, event, offset) {\n if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) {\n return v === 0;\n })) {\n return;\n }\n\n var depaPos = this.moveDistance || this.axm.get(input.axes);\n var destPos; // for outside logic\n\n destPos = map(depaPos, function (v, k) {\n return v + (offset[k] || 0);\n });\n this.moveDistance && (this.moveDistance = destPos); // from outside to inside\n\n if (this.isOutside && this.axm.every(depaPos, function (v, opt) {\n return !isOutside(v, opt.range);\n })) {\n this.isOutside = false;\n }\n\n depaPos = this.atOutside(depaPos);\n destPos = this.atOutside(destPos);\n var isCanceled = !this.em.triggerChange(destPos, false, depaPos, {\n input: input,\n event: event\n }, true);\n\n if (isCanceled) {\n this.isStopped = true;\n this.moveDistance = null;\n this.am.finish(false);\n }\n };\n\n __proto.release = function (input, event, offset, inputDuration) {\n if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) {\n return;\n }\n\n var pos = this.axm.get(input.axes);\n var depaPos = this.axm.get();\n var destPos = this.axm.get(this.axm.map(offset, function (v, opt, k) {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce);\n }\n }));\n var duration = this.am.getDuration(destPos, pos, inputDuration);\n\n if (duration === 0) {\n destPos = __assign({}, depaPos);\n } // prepare params\n\n\n var param = {\n depaPos: depaPos,\n destPos: destPos,\n duration: duration,\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: event,\n input: input,\n isTrusted: true\n };\n this.em.triggerRelease(param);\n this.moveDistance = null; // to contol\n\n var userWish = this.am.getUserControll(param);\n var isEqual = equal(userWish.destPos, depaPos);\n var changeOption = {\n input: input,\n event: event\n };\n\n if (isEqual || userWish.duration === 0) {\n !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true);\n this.itm.setInterrupt(false);\n\n if (this.axm.isOutside()) {\n this.am.restore(changeOption);\n } else {\n this.em.triggerFinish(true);\n }\n } else {\n this.am.animateTo(userWish.destPos, userWish.duration, changeOption);\n }\n };\n\n return InputObserver;\n}();\n\n// export const DIRECTION_NONE = 1;\nvar IOS_EDGE_THRESHOLD = 30;\nvar IS_IOS_SAFARI = \"ontouchstart\" in win && getAgent().browser.name === \"safari\";\nvar TRANSFORM = function () {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n\n var bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0]).style;\n var target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n for (var i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n\n return \"\";\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 * @property {Number[]} [range] The coordinate of range 좌표 범위\n * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표\n * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표\n * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to \"true\" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @property {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 * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @property {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가 적용되지 않는다
\n * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
\n**/\n\n/**\n * @class eg.Axes\n * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.\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] 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 *\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\nvar Axes =\n/*#__PURE__*/\nfunction (_super) {\n __extends(Axes, _super);\n\n function Axes(axis, options, startPos) {\n if (axis === void 0) {\n axis = {};\n }\n\n if (options === void 0) {\n options = {};\n }\n\n var _this = _super.call(this) || this;\n\n _this.axis = axis;\n _this._inputs = [];\n _this.options = __assign({\n easing: function easeOutCubic(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 }, options);\n _this.itm = new InterruptManager(_this.options);\n _this.axm = new AxisManager(_this.axis, _this.options);\n _this.em = new EventManager(_this);\n _this.am = new AnimationManager(_this);\n _this.io = new InputObserver(_this);\n\n _this.em.setAnimationManager(_this.am);\n\n startPos && _this.em.triggerChange(startPos);\n return _this;\n }\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @method eg.Axes#connect\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 * 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\n var __proto = Axes.prototype;\n\n __proto.connect = function (axes, inputType) {\n var mapped;\n\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n } // check same instance\n\n\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n } // check same element in hammer type for share\n\n\n if (\"hammer\" in inputType) {\n var targets = this._inputs.filter(function (v) {\n return v.hammer && v.element === inputType.element;\n });\n\n if (targets.length) {\n inputType.hammer = targets[0].hammer;\n }\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.io);\n\n this._inputs.push(inputType);\n\n return this;\n };\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @method eg.Axes#disconnect\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 * 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\n __proto.disconnect = function (inputType) {\n if (inputType) {\n var index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach(function (v) {\n return v.disconnect();\n });\n\n this._inputs = [];\n }\n\n return this;\n };\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @method eg.Axes#get\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\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\n __proto.get = function (axes) {\n return this.axm.get(axes);\n };\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @method eg.Axes#setTo\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 * 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\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setTo(pos, duration);\n return this;\n };\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @method eg.Axes#setBy\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 * 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\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setBy(pos, duration);\n return this;\n };\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @method eg.Axes#isBounceArea\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\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\n __proto.isBounceArea = function (axes) {\n return this.axm.isOutside(axes);\n };\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n * @method eg.Axes#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.em.destroy();\n };\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Axes.VERSION; // ex) 3.3.3\n * @memberof eg.Axes\n */\n\n\n Axes.VERSION = \"2.7.1\";\n /**\n * @name eg.Axes.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 * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n */\n\n Axes.TRANSFORM = TRANSFORM;\n /**\n * @name eg.Axes.DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name eg.Axes.DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name eg.Axes.DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name eg.Axes.DIRECTION_UP\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_UP = DIRECTION_UP;\n /**\n * @name eg.Axes.DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name eg.Axes.DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name eg.Axes.DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name eg.Axes.DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_ALL = DIRECTION_ALL;\n return Axes;\n}(Component);\n\nvar SUPPORT_POINTER_EVENTS = \"PointerEvent\" in win || \"MSPointerEvent\" in win;\nvar SUPPORT_TOUCH = (\"ontouchstart\" in win);\nvar UNIQUEKEY = \"_EGJS_AXES_INPUTTYPE_\";\nfunction toAxis(source, offset) {\n return offset.reduce(function (acc, v, i) {\n if (source[i]) {\n acc[source[i]] = v;\n }\n\n return acc;\n }, {});\n}\nfunction createHammer(element, options) {\n try {\n // create Hammer\n return new Manager(element, __assign({}, options));\n } catch (e) {\n return null;\n }\n}\nfunction convertInputType(inputType) {\n if (inputType === void 0) {\n inputType = [];\n }\n\n var hasTouch = false;\n var hasMouse = false;\n var hasPointer = false;\n inputType.forEach(function (v) {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n\n if (hasPointer) {\n return PointerEventInput;\n } else if (hasTouch && hasMouse) {\n return TouchMouseInput;\n } else if (hasTouch) {\n return TouchInput;\n } else if (hasMouse) {\n return MouseInput;\n }\n\n return null;\n}\n\nfunction getDirectionByAngle(angle, thresholdAngle) {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n\n var toAngle = Math.abs(angle);\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL;\n}\nfunction getNextOffset(speeds, deceleration) {\n var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]);\n var duration = Math.abs(normalSpeed / -deceleration);\n return [speeds[0] / 2 * duration, speeds[1] / 2 * duration];\n}\nfunction useDirection(checkType, direction, userDirection) {\n if (userDirection) {\n return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType);\n } else {\n return !!(direction & checkType);\n }\n}\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @property {String[]} [inputType=[\"touch\",\"mouse\", \"pointer\"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
\n * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율\n * @property {Number} [scale.1=1] vertical axis scale 수직축 배율\n * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PanInput\n * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\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 */\n\nvar PanInput =\n/*#__PURE__*/\nfunction () {\n function PanInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this.panRecognizer = null;\n this.isRightEdge = false;\n this.rightEdgeTimer = 0;\n this.panFlag = false;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PanInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onHammerInput = this.onHammerInput.bind(this);\n this.onPanmove = this.onPanmove.bind(this);\n this.onPanend = this.onPanend.bind(this);\n }\n\n var __proto = PanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n var useHorizontal = !!axes[0];\n var useVertical = !!axes[1];\n\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\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n direction: this._direction,\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PanRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.panRecognizer = new Pan(hammerOption);\n this.hammer.add(this.panRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.dettachEvent();\n }\n\n this._direction = DIRECTION_NONE;\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PanInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PanInput#enable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PanInput#disable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PanInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pan\").options.enable);\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.panRecognizer) {\n this.hammer.remove(this.panRecognizer);\n this.panRecognizer = null;\n }\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.panFlag = false;\n\n if (event.srcEvent.cancelable !== false) {\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n this.observer.hold(this, event);\n this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold;\n this.panFlag = true;\n }\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanmove = function (event) {\n var _this = this;\n\n if (!this.panFlag) {\n return;\n }\n\n var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start\n\n var prevInput = this.hammer.session.prevInput;\n\n if (prevInput && IS_IOS_SAFARI) {\n var swipeLeftToRight = event.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n return;\n } else if (this.isRightEdge) {\n clearTimeout(this.rightEdgeTimer); // - is right to left\n\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n var swipeRightToLeft = event.deltaX < -edgeThreshold;\n\n if (swipeRightToLeft) {\n this.isRightEdge = false;\n } else {\n // iOS swipe right => left\n this.rightEdgeTimer = window.setTimeout(function () {\n _this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n }, 100);\n }\n }\n }\n /* eslint-disable no-param-reassign */\n\n\n if (prevInput) {\n event.offsetX = event.deltaX - prevInput.deltaX;\n event.offsetY = event.deltaY - prevInput.deltaY;\n } else {\n event.offsetX = 0;\n event.offsetY = 0;\n }\n\n var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]);\n var prevent = offset.some(function (v) {\n return v !== 0;\n });\n\n if (prevent) {\n var srcEvent = event.srcEvent;\n\n if (srcEvent.cancelable !== false) {\n srcEvent.preventDefault();\n }\n\n srcEvent.stopPropagation();\n }\n\n event.preventSystemEvent = prevent;\n prevent && this.observer.change(this, event, toAxis(this.axes, offset));\n };\n\n __proto.onPanend = function (event) {\n if (!this.panFlag) {\n return;\n }\n\n clearTimeout(this.rightEdgeTimer);\n this.panFlag = false;\n var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]);\n offset = getNextOffset(offset, this.observer.options.deceleration);\n this.observer.release(this, event, toAxis(this.axes, offset));\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"hammer.input\", this.onHammerInput).on(\"panstart panmove\", this.onPanmove);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"hammer.input\", this.onHammerInput).off(\"panstart panmove\", this.onPanmove);\n this.observer = null;\n };\n\n __proto.getOffset = function (properties, direction) {\n var offset = [0, 0];\n var scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n\n return offset;\n };\n\n return PanInput;\n}();\n\n/**\n * @class eg.Axes.RotatePanInput\n * @classdesc 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)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.
[상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\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 eg.Axes.PanInput\n */\n\nvar RotatePanInput =\n/*#__PURE__*/\nfunction (_super) {\n __extends(RotatePanInput, _super);\n\n function RotatePanInput(el, options) {\n var _this = _super.call(this, el, options) || this;\n\n _this.prevQuadrant = null;\n _this.lastDiff = 0;\n return _this;\n }\n\n var __proto = RotatePanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.observer.hold(this, event);\n this.onPanstart(event);\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanstart = function (event) {\n var rect = this.element.getBoundingClientRect();\n /**\n * Responsive\n */\n // TODO: how to do if element is ellipse not circle.\n\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\n this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle.\n\n this.prevAngle = null;\n this.triggerChange(event);\n };\n\n __proto.onPanmove = function (event) {\n this.triggerChange(event);\n };\n\n __proto.onPanend = function (event) {\n this.triggerChange(event);\n this.triggerAnimation(event);\n };\n\n __proto.triggerChange = function (event) {\n var angle = this.getAngle(event.center.x, event.center.y);\n var quadrant = this.getQuadrant(event.center.x, event.center.y);\n var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant);\n this.prevAngle = angle;\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 __proto.triggerAnimation = function (event) {\n var vx = event.velocityX;\n var vy = event.velocityY;\n var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise\n\n var duration = Math.abs(velocity / -this.observer.options.deceleration);\n var distance = velocity / 2 * duration;\n this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle]));\n };\n\n __proto.getDifference = function (prevAngle, angle, prevQuadrant, quadrant) {\n var diff;\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 __proto.getPosFromOrigin = function (posX, posY) {\n return {\n x: posX - this.rotateOrigin[0],\n y: this.rotateOrigin[1] - posY\n };\n };\n\n __proto.getAngle = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y);\n\n return angle < 0 ? 360 + angle : angle;\n };\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n\n\n __proto.getQuadrant = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var 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\n return q;\n };\n\n return RotatePanInput;\n}(PanInput);\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PinchInput\n * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\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 */\n\nvar PinchInput =\n/*#__PURE__*/\nfunction () {\n function PinchInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this._base = null;\n this._prev = null;\n this.pinchRecognizer = null;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PinchInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onPinchStart = this.onPinchStart.bind(this);\n this.onPinchMove = this.onPinchMove.bind(this);\n this.onPinchEnd = this.onPinchEnd.bind(this);\n }\n\n var __proto = PinchInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PinchRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.pinchRecognizer = new Pinch(hammerOption);\n this.hammer.add(this.pinchRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n this.dettachEvent();\n }\n\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PinchInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.pinchRecognizer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n }\n };\n\n __proto.onPinchStart = function (event) {\n this._base = this.observer.get(this)[this.axes[0]];\n var offset = this.getOffset(event.scale);\n this.observer.hold(this, event);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchMove = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchEnd = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this.observer.release(this, event, toAxis(this.axes, [0]), 0);\n this._base = null;\n this._prev = null;\n };\n\n __proto.getOffset = function (pinchScale, prev) {\n if (prev === void 0) {\n prev = 1;\n }\n\n return this._base * (pinchScale - prev) * this.options.scale;\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"pinchstart\", this.onPinchStart).on(\"pinchmove\", this.onPinchMove).on(\"pinchend\", this.onPinchEnd);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"pinchstart\", this.onPinchStart).off(\"pinchmove\", this.onPinchMove).off(\"pinchend\", this.onPinchEnd);\n this.observer = null;\n this._prev = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PinchInput#enable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PinchInput#disable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PinchInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pinch\").options.enable);\n };\n\n return PinchInput;\n}();\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n**/\n\n/**\n * @class eg.Axes.WheelInput\n * @classdesc 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 * 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 */\n\nvar WheelInput =\n/*#__PURE__*/\nfunction () {\n function WheelInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n useNormalized: true\n }, options);\n this.onWheel = this.onWheel.bind(this);\n }\n\n var __proto = WheelInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent();\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.WheelInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onWheel = function (event) {\n var _this = this;\n\n if (!this._isEnabled) {\n return;\n }\n\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n if (_this._isHolded) {\n _this._isHolded = false;\n\n _this.observer.release(_this, event, toAxis(_this.axes, [0]));\n }\n }, 50);\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.element.addEventListener(\"wheel\", this.onWheel);\n this._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\n this.element.removeEventListener(\"wheel\", this.onWheel);\n this._isEnabled = false;\n this.observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.WheelInput#enable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.WheelInput#disable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.WheelInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return WheelInput;\n}();\n\nvar KEY_LEFT_ARROW = 37;\nvar KEY_A = 65;\nvar KEY_UP_ARROW = 38;\nvar KEY_W = 87;\nvar KEY_RIGHT_ARROW = 39;\nvar KEY_D = 68;\nvar KEY_DOWN_ARROW = 40;\nvar KEY_S = 83;\nvar DIRECTION_REVERSE = -1;\nvar DIRECTION_FORWARD = 1;\nvar DIRECTION_HORIZONTAL$1 = -1;\nvar DIRECTION_VERTICAL$1 = 1;\nvar DELAY = 80;\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @property {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @property {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n**/\n\n/**\n * @class eg.Axes.MoveKeyInput\n * @classdesc 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 * 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 */\n\nvar MoveKeyInput =\n/*#__PURE__*/\nfunction () {\n function MoveKeyInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: [1, 1]\n }, options);\n this.onKeydown = this.onKeydown.bind(this);\n this.onKeyup = this.onKeyup.bind(this);\n }\n\n var __proto = MoveKeyInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent(); // add tabindex=\"0\" to the container for making it focusable\n\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 __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.MoveKeyInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onKeydown = function (e) {\n if (!this._isEnabled) {\n return;\n }\n\n var isMoveKey = true;\n var direction = DIRECTION_FORWARD;\n var move = DIRECTION_HORIZONTAL$1;\n\n switch (e.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL$1;\n break;\n\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL$1;\n break;\n\n default:\n isMoveKey = false;\n }\n\n if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) {\n isMoveKey = false;\n }\n\n if (!isMoveKey) {\n return;\n }\n\n var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction];\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n clearTimeout(this._timer);\n this.observer.change(this, event, toAxis(this.axes, offsets));\n };\n\n __proto.onKeyup = function (e) {\n var _this = this;\n\n if (!this._isHolded) {\n return;\n }\n\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n _this.observer.release(_this, e, toAxis(_this.axes, [0, 0]));\n\n _this._isHolded = false;\n }, DELAY);\n };\n\n __proto.attachEvent = function (observer) {\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._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\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._isEnabled = false;\n this.observer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.MoveKeyInput#enable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.MoveKeyInput#disable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.MoveKeyInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return MoveKeyInput;\n}();\n\nexport default Axes;\nexport { PanInput, RotatePanInput, PinchInput, WheelInput, MoveKeyInput };\n//# sourceMappingURL=axes.esm.js.map\n","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport {TRANSFORM, SUPPORT_WILLCHANGE} from \"../utils/browserFeature\";\nimport {VERSION} from \"../version\";\n/**\n * @class eg.view360.SpriteImage\n * @classdesc A module that displays a single or continuous image of any one of the \"sprite images\". SpinViewer internally uses SpriteImage to show each frame of the sprite image.\n * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the \"Sprite image\". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n *\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpriteImage\n *\n * var el = document.getElementById(\"image-div\");\n * var sprites = new eg.view360.SpriteImage(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24\n * });\n */\nclass SpriteImage extends Component {\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\t\tconst opt = options || {};\n\n\t\tthis._el = element;\n\t\tthis._rowCount = opt.rowCount || 1;\n\t\tthis._colCount = opt.colCount || 1;\n\t\tthis._totalCount = this._rowCount * this._colCount;// total frames\n\t\tthis._width = opt.width || \"auto\";\n\t\tthis._height = opt.height || \"auto\";\n\t\tthis._autoHeight = opt.autoHeight != null ? opt.autoHeight : \"true\"; // If autoHeight is specified, _height will be overwritten.\n\t\tthis._colRow = [0, 0];\n\n\t\tif (opt.colRow) {\n\t\t\tthis._colRow = opt.colRow;\n\t\t} else if (opt.frameIndex) {\n\t\t\tthis.setFrameIndex(opt.frameIndex);\n\t\t}\n\n\t\tthis._el.style.width = SpriteImage._getSizeString(this._width);\n\t\tthis._el.style.height = SpriteImage._getSizeString(this._height);\n\n\t\tif (!opt.imageUrl) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: opt.imageUrl\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._image = new Image();\n\t\t/**\n\t\t * Event\n\t\t */\n\t\tthis._image.onload = () => {\n\t\t\tthis._bg = SpriteImage._createBgDiv(\n\t\t\t\tthis._image, this._rowCount, this._colCount, this._autoHeight);\n\t\t\tthis._el.appendChild(this._bg);\n\t\t\tthis.setColRow(this._colRow[0], this._colRow[1]);\n\n\t\t\t/**\n\t\t\t * Events that occur when component loading is complete\n\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#load\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"load\" : function(evt) {\n\t\t\t *\t\tconsole.log(\"load event fired - e.target\", e.target, \"e.bgElement\", e.bgElement);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"load\", {\n\t\t\t\ttarget: this._el,\n\t\t\t\tbgElement: this._bg\n\t\t\t});\n\n\t\t\tif (this._autoPlayReservedInfo) {\n\t\t\t\tthis.play(this._autoPlayReservedInfo);\n\t\t\t\tthis._autoPlayReservedInfo = null;\n\t\t\t}\n\t\t};\n\n\t\tthis._image.onerror = e => {\n\t\t\t/**\n\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#imageError\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t *\t\t// Error handling\n\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\timageUrl: opt.imageUrl\n\t\t\t});\n\t\t};\n\n\t\tthis._image.src = opt.imageUrl;\n\t}\n\n\tstatic _createBgDiv(img, rowCount, colCount, autoHeight) {\n\t\tconst el = document.createElement(\"div\");\n\n\t\tel.style.position = \"relative\";\n\t\tel.style.overflow = \"hidden\";\n\n\t\timg.style.position = \"absolute\";\n\t\timg.style.width = `${colCount * 100}%`;\n\t\timg.style.height = `${rowCount * 100}%`;\n\t\t/** Prevent image from being dragged on IE10, IE11, Safari especially */\n\t\timg.ondragstart = () => (false); // img.style.pointerEvents = \"none\";\n\t\t// Use hardware accelerator if available\n\t\tSUPPORT_WILLCHANGE && (img.style.willChange = \"transform\");\n\n\t\tel.appendChild(img);\n\n\t\tconst unitWidth = img.width / colCount;\n\t\tconst unitHeight = img.height / rowCount;\n\n\t\tif (autoHeight) {\n\t\t\tconst r = unitHeight / unitWidth;\n\n\t\t\tel.style.paddingBottom = `${r * 100}%`;\n\t\t} else {\n\t\t\tel.style.height = \"100%\";\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/**\n\t * Specifies the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정\n\t * @method eg.view360.SpriteImage#setFrameIndex\n\t * @param {Number} frameIndex frame index of a frame프레임의 인덱스\n\t *\n\t * @example\n\t *\n\t * sprites.setFrameIndex(0, 1);// col = 0, row = 1\n\t */\n\tsetFrameIndex(index) {\n\t\tconst colRow = this.toColRow(index);\n\n\t\tthis.setColRow(colRow[0], colRow[1]);\n\t}\n\n\t/**\n\t * Returns the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환\n\t * @method eg.view360.SpriteImage#getFrameIndex\n\t * @return {Number} frame index frame 인덱스\n\t *\n\t * @example\n\t *\n\t * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1\n\t *\n\t */\n\tgetFrameIndex() {\n\t\treturn this._colRow[1] * this._colCount + this._colRow[0];\n\t}\n\n\t/**\n\t * Specifies the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정\n\t * @method eg.view360.SpriteImage#setColRow\n\t * @param {Number} col Column number of a frame프레임의 행값\n\t * @param {Number} row Row number of a frame프레임의 열값\n\t *\n\t * @example\n\t *\n\t * sprites.setlColRow(1, 2); // col = 1, row = 2\n\t */\n\tsetColRow(col, row) {\n\t\tif (row > this._rowCount - 1 || col > this._colCount - 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._image && TRANSFORM) {\n\t\t\t// NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser?\n\t\t\tthis._image.style[TRANSFORM] = `translate(${-(col / this._colCount * 100)}%, ${-(row / this._rowCount * 100)}%)`;\n\t\t}\n\n\t\tthis._colRow = [col, row];\n\t}\n\n\t/**\n\t * Returns the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환\n\t * @method eg.view360.SpriteImage#gelColRow\n\t * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열\n\t *\n\t * @example\n\t *\n\t * var colRow = sprites.getlColRow();\n\t * // colRow = [1, 2] - index of col is 1, index of row is 2\n\t *\n\t */\n\tgetColRow() {\n\t\treturn this._colRow;\n\t}\n\n\tstatic _getSizeString(size) {\n\t\tif (typeof size === \"number\") {\n\t\t\treturn `${size}px`;\n\t\t}\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Stop playing\n\t * @ko play 되고 있던 프레임 재생을 중지합니다.\n\t * @method eg.view360.SpriteImage#stop\n\t *\n\t * @example\n\t *\n\t * viewer.stop();\n\t *\n\t */\n\tstop() {\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\t}\n\n\t/**\n\t * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'.\n\t * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다.\n\t * @method eg.view360.SpriteImage#play\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위\n\t * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복\n\t *\n\t * @example\n\t *\n\t * viewer.play({angle: 16, playCount: 1});\n\t *\n\t */\n\tplay({interval, playCount} = {interval: 1000 / this._totalCount, playCount: 0}) {\n\t\tif (!this._bg) {\n\t\t\tthis._autoPlayReservedInfo = {interval, playCount};\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\n\t\tlet frameIndex = this.getFrameIndex();\n\t\tlet count = 0;\n\t\tlet frameCount = 0; // for checking 1 cycle\n\n\t\tthis._autoPlayTimer = setInterval(() => {\n\t\t\tframeIndex %= this._totalCount;\n\t\t\tconst colRow = this.toColRow(frameIndex);\n\n\t\t\tthis.setColRow(colRow[0], colRow[1]);\n\t\t\tframeIndex++;\n\n\t\t\t// Done 1 Cycle?\n\t\t\tif (++frameCount === this._totalCount) {\n\t\t\t\tframeCount = 0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (playCount > 0 && count === playCount) {\n\t\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\t}\n\t\t}, interval);\n\t}\n\n\ttoColRow(frameIndex) {\n\t\tconst colCount = this._colCount;\n\t\tconst rowCount = this._rowCount;\n\n\t\tif (frameIndex < 0) {\n\t\t\treturn [0, 0];\n\t\t} else if (frameIndex >= this._totalCount) {\n\t\t\treturn [colCount - 1, rowCount - 1];\n\t\t}\n\n\t\tconst col = frameIndex % colCount;\n\t\tconst row = Math.floor(frameIndex / colCount);\n\n\t\t// console.log(frameIndex, col, row);\n\t\treturn [col, row];\n\t}\n}\n\nexport default SpriteImage;\n","import Component from \"@egjs/component\";\nimport Axes, {PanInput} from \"@egjs/axes\";\nimport SpriteImage from \"./SpriteImage\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_PAN_SCALE = 0.21;\n\n/**\n * @class eg.view360.SpinViewer\n * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object.\n * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpinViewer\n * var el = document.getElementById(\"product-360\");\n * var viewer = new eg.view360.SpinViewer(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24 //required\n * });\n */\nclass SpinViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.SpinViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.SpinViewer\n\t */\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\n\t\tthis._el = element;\n\n\t\tconst opt = Object.assign({}, options);\n\t\tconst colCount = opt.colCount || 1;\n\t\tconst rowCount = opt.rowCount || 1;\n\n\t\tthis._scale = (opt.scale || 1);\n\t\tthis._panScale = this._scale * DEFAULT_PAN_SCALE;\n\n\t\tthis._frameCount = colCount * rowCount;\n\n\t\t// Init SpriteImage\n\t\tthis._sprites = new SpriteImage(element, opt).on({\n\t\t\t\"load\": evt => {\n\t\t\t\t/**\n\t\t\t\t * Events that occur when component loading is complete\n\t\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#load\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"load\" : function(evt) {\n\t\t\t\t *\t\tthis.spinBy(360, {duration: 300});\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"load\", evt);\n\t\t\t},\n\t\t\t\"imageError\": evt => {\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#imageError\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viewer.on({\n\t\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t\t *\t\t// Error handling\n\t\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: evt.imageUrl\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Init Axes\n\t\tthis._panInput = new PanInput(this._el, {\n\t\t\tscale: [this._panScale, this._panScale]\n\t\t});\n\t\tthis._axes = new Axes({\n\t\t\tangle: {\n\t\t\t\trange: [0, 359],\n\t\t\t\tcircular: true\n\t\t\t}\n\t\t}).on({\n\t\t\t\"change\": evt => {\n\t\t\t\tconst curr = Math.floor(evt.pos.angle / (360 / this._frameCount));\n\t\t\t\tconst frameIndex = this._frameCount - curr - 1;\n\n\t\t\t\tthis._sprites.setFrameIndex(frameIndex);\n\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#change\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row\n\t\t\t\t * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값\n\t\t\t\t * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님)\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"change\" : function(evt) {\n\t\t\t\t *\t\tconsole.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"change\", {\n\t\t\t\t\tframeIndex,\n\t\t\t\t\tcolRow: this._sprites.getColRow(),\n\t\t\t\t\tangle: evt.pos.angle\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"animationEnd\": evt => {\n\t\t\t\t/**\n\t\t\t\t * This event is fired when animation ends.\n\t\t\t\t * @ko 에니메이션이 끝났을 때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#animationEnd\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Boolean} param.isTrusted 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\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"animationEnd\" : function(evt) {\n\t\t\t\t *\t\t// evt.isTrusted === true or false\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"animationEnd\", {\n\t\t\t\t\tisTrusted: evt.isTrusted\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._axes.connect(\"angle\", this._panInput);\n\t}\n\n\t/**\n\t * Set spin scale\n\t * @ko scale 을 조정할 수 있는 함수\n\t * @method eg.view360.SpinViewer#setScale\n\t * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.setScale(2);// It moves twice as much.\n\t */\n\tsetScale(scale) {\n\t\tif (isNaN(scale) || scale < 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._scale = scale;\n\t\tthis._panScale = scale * DEFAULT_PAN_SCALE;\n\t\tthis._panInput.options.scale = [this._panScale, this._panScale];\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get spin scale\n\t * @ko scale 값을 반환한다.\n\t * @method eg.view360.SpinViewer#getScale\n\t *\n\t * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @example\n\t *\n\t * viewer.getScale();// It returns number\n\t */\n\tgetScale() {\n\t\treturn this._scale;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle.\n\t * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinBy\n\t *\n\t * @param {Number} [angle = 0] angle상대적 회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinBy(720, {duration: 500});\n\t */\n\tspinBy(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setBy({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle).\n\t * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinTo\n\t *\n\t * @param {Number} [angle = 0] angle회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinTo(30, {duration:100});\n\t */\n\tspinTo(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setTo({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns current angles\n\t * @ko 현재 각도를 반환한다.\n\t *\n\t * @return {Number} Current angle 현재 각도\n\t */\n\tgetAngle() {\n\t\treturn this._axes.get().angle || 0;\n\t}\n}\n\nexport default SpinViewer;\n"],"names":["isUndefined","value","Component","this","_eventHandler","options","_proto","prototype","trigger","eventName","customEvent","handlerList","length","concat","eventType","isCanceled","arg","i","stop","currentTarget","_len","arguments","restParam","Array","_key","apply","once","handlerToAttach","eventHash","self","on","listener","_len2","_key2","off","hasOn","name","push","handlerToDetach","undefined","k","handlerFunction","splice","VERSION","_extends","Object","assign","target","source","key","hasOwnProperty","call","_inheritsLoose","subClass","superClass","create","constructor","__proto__","_assertThisInitialized","ReferenceError","win","assign$1","TypeError","output","index","nextKey","VENDOR_PREFIXES","TEST_ELEMENT","document","style","createElement","TYPE_FUNCTION","round","Math","abs","now","Date","prefixed","obj","property","prefix","prop","camelProp","toUpperCase","slice","window","PREFIXED_TOUCH_ACTION","NATIVE_TOUCH_ACTION","TOUCH_ACTION_COMPUTE","TOUCH_ACTION_AUTO","TOUCH_ACTION_MANIPULATION","TOUCH_ACTION_NONE","TOUCH_ACTION_PAN_X","TOUCH_ACTION_PAN_Y","TOUCH_ACTION_MAP","touchMap","cssSupports","CSS","supports","forEach","val","getTouchActionProps","SUPPORT_TOUCH","SUPPORT_POINTER_EVENTS","SUPPORT_ONLY_TOUCH","test","navigator","userAgent","INPUT_TYPE_TOUCH","INPUT_TYPE_MOUSE","COMPUTE_INTERVAL","INPUT_START","INPUT_END","INPUT_CANCEL","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DIRECTION_DOWN","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","DIRECTION_ALL","PROPS_XY","PROPS_CLIENT_XY","each","iterator","context","boolOrFn","args","inStr","str","find","indexOf","TouchAction","manager","set","compute","element","actions","toLowerCase","trim","update","touchAction","recognizers","recognizer","enable","getTouchAction","hasPanX","hasPanY","cleanTouchActions","join","preventDefaults","input","srcEvent","direction","offsetDirection","session","prevented","preventDefault","hasNone","isTapPointer","pointers","isTapMovement","distance","isTapTouchTime","deltaTime","preventSrc","hasParent","node","parent","parentNode","getCenter","pointersLength","x","clientX","y","clientY","simpleCloneInputData","timeStamp","center","deltaX","deltaY","getDistance","p1","p2","props","sqrt","getAngle","atan2","PI","getDirection","getVelocity","computeInputData","firstInput","firstMultiple","offset","prevDelta","prevInput","offsetCenter","angle","offsetDelta","start","end","overallVelocity","overallVelocityX","overallVelocityY","scale","rotation","maxPointers","velocity","velocityX","velocityY","last","lastInterval","v","computeIntervalInputData","srcEventTarget","composedPath","path","inputHandler","pointersLen","changedPointersLen","changedPointers","isFirst","isFinal","emit","recognize","splitStr","split","addEventListeners","types","handler","type","addEventListener","removeEventListeners","removeEventListener","getWindowForElement","doc","ownerDocument","defaultView","parentWindow","Input","callback","inputTarget","domHandler","ev","init","evEl","evTarget","evWin","destroy","inArray","src","findByKey","POINTER_INPUT_MAP","pointerdown","pointermove","pointerup","pointercancel","pointerout","IE10_POINTER_TYPE_ENUM","2","3","4","5","POINTER_ELEMENT_EVENTS","POINTER_WINDOW_EVENTS","MSPointerEvent","PointerEvent","PointerEventInput","_Input","_this","proto","store","pointerEvents","removePointer","eventTypeNormalized","replace","pointerType","isTouch","storeIndex","pointerId","button","toArray","uniqueArray","sort","results","values","a","b","TOUCH_INPUT_MAP","touchstart","touchmove","touchend","touchcancel","TouchInput","targetIds","touches","targetTouches","allTouches","identifier","changedTouches","changedTargetTouches","filter","touch","MOUSE_INPUT_MAP","mousedown","mousemove","mouseup","MouseInput","pressed","which","DEDUP_TIMEOUT","DEDUP_DISTANCE","setLastTouch","eventData","primaryTouch","lastTouch","lts","lastTouches","setTimeout","TouchMouseInput","_manager","inputEvent","inputData","isMouse","sourceCapabilities","firesTouchEvents","t","dx","dy","mouse","invokeArrayArg","fn","isArray","_uniqueId","getRecognizerByNameIfManager","otherRecognizer","get","stateStr","state","Recognizer","id","simultaneous","requireFail","recognizeWith","dropRecognizeWith","requireFailure","dropRequireFailure","hasRequireFailures","canRecognizeWith","event","additionalEvent","tryEmit","canEmit","inputDataClone","reset","process","AttrRecognizer","_Recognizer","attrTest","optionPointers","isRecognized","isValid","directionStr","PanRecognizer","_AttrRecognizer","threshold","pX","pY","directionTest","hasMoved","defaults","domEvents","inputClass","cssProps","userSelect","touchSelect","touchCallout","contentZooming","userDrag","tapHighlightColor","toggleCssProps","add","oldCssProps","Manager","handlers","item","force","stopped","curRecognizer","existing","remove","targetRecognizer","events","data","gestureEvent","createEvent","initEvent","gesture","dispatchEvent","deprecate","method","message","deprecationMessage","e","Error","stack","log","console","warn","extend","dest","merge","keys","some","arr","execRegExp","pattern","text","RegExp","exec","convertVersion","findPreset","presets","userPreset","version","preset","versionTest","result","brand","versionAlias","findBrand","brands","_a","BROWSER_PRESETS","CHROMIUM_PRESETS","WEBKIT_PRESETS","WEBVIEW_PRESETS","OS_PRESETS","parseUserAgent","nextAgent","agent","getUserAgent","isMobile","browser","majorVersion","webview","chromium","webkit","os","browserPreset","browserVersion","_b","osPreset","osVersion","parseInt","isHints","extendStatics","d","setPrototypeOf","p","__extends","__","__assign","s","n","getInsidePosition","destPos","range","circular","bounce","toDestPos","targetRange","max","min","isOutside","pos","isCircularable","getCirculatedPos","toPos","nodes","el","len","raf","requestAnimationFrame","webkitRequestAnimationFrame","caf","cancelAnimationFrame","webkitCancelAnimationFrame","keyInfo_1","oldraf_1","timestamp","performance","getTime","clearTimeout","map","tranformed","filtered","every","equal","base","roundNumFunc","roundNumber","num","roundUnit","pow","getDecimalPlace","roundNumbers","isNumber","isFinite","minMax","AnimationManager","itm","em","axm","animationEnd","bind","__proto","getDuration","depaPos","wishDuration","duration","durations_1","deceleration","reduce","Infinity","minimumDuration","maximumDuration","createAnimationParam","option","delta","getDelta","isTrusted","done","grab","axes","_animateParam","orgPos_1","opt","triggerChange","_raf","triggerAnimationEnd","getEventInfo","restore","animateTo","beforeParam","circularTargets","setTo","setInterrupt","finish","triggerFinish","animateLoop","param","complete","info_1","self_1","destPos_1","prevPos_1","prevEasingPer_1","directions_1","originalIntendedPos_1","prevTime_1","startTime","loop","currentTime","ratio","easingPer","easing","nextPos","circulatedPos","rangeOffset","getFinalPos","originalIntendedPos","getRoundUnit","minRoundUnit","getAxisOptions","getUserControll","userWish","retTrigger","triggerAnimationStart","orgPos","movedPos","setBy","EventManager","triggerHold","roundPos","getRoundPos","triggerRelease","roundDepa","createUserControll","isAccurate","holding","am","eventInfo","moveTo","userControl","userDuration","setAnimationManager","InterruptManager","_prevented","isInterrupting","interruptable","isInterrupted","AxisManager","axis","_complementOptions","_pos","acc","axisOption","fullDepaPos","axisOptions","InputObserver","moveDistance","isStopped","atOutside","tn","tx","initSlope_1","out","hold","changeOption","change","release","inputDuration","isEqual","IS_IOS_SAFARI","userAgentData","uaList","hasUserAgentData","osData","mobile","firstBrand","platform_1","platform","platformVersion","uaFullVersion","parseUserAgentData","TRANSFORM","bodyStyle","head","getElementsByTagName","Axes","_super","startPos","_inputs","io","connect","inputType","mapped","disconnect","targets","hammer","mapAxes","isBounceArea","UNIQUEKEY","toAxis","useDirection","checkType","userDirection","PanInput","panRecognizer","isRightEdge","rightEdgeTimer","panFlag","$","multi","match","dummy","innerHTML","childNodes","querySelectorAll","nodeName","nodeType","jQuery","jquery","thresholdAngle","iOSEdgeSwipeThreshold","hammerManagerOptions","onHammerInput","onPanmove","onPanend","useHorizontal","useVertical","_direction","observer","hammerOption","removeRecognizer","dettachEvent","keyValue","String","random","hasTouch","hasMouse","hasPointer","convertInputType","createHammer","Pan","attachEvent","disable","isEnable","cancelable","edgeThreshold","innerWidth","toAngle","getDirectionByAngle","offsetX","offsetY","getOffset","prevent","stopPropagation","preventSystemEvent","speeds","normalSpeed","properties","Function","Float32Array","getComputedStyle","DeviceMotionEvent","devicePixelRatio","docStyle","documentElement","SUPPORT_WILLCHANGE","SpriteImage","_el","_rowCount","rowCount","_colCount","colCount","_totalCount","_width","width","_height","height","_autoHeight","autoHeight","_colRow","colRow","frameIndex","setFrameIndex","_getSizeString","imageUrl","_image","Image","onload","_bg","_createBgDiv","appendChild","setColRow","bgElement","_autoPlayReservedInfo","play","onerror","img","position","overflow","ondragstart","willChange","unitWidth","unitHeight","r","paddingBottom","toColRow","getFrameIndex","col","row","getColRow","size","_autoPlayTimer","clearInterval","interval","playCount","count","frameCount","setInterval","_this2","floor","SpinViewer","_scale","_panScale","_frameCount","_sprites","evt","_panInput","_axes","curr","setScale","isNaN","getScale","spinBy","spinTo"],"mappings":";;;;;;;;;2fAaA,SAASA,EAAYC,GACnB,YAAwB,IAAVA,EAShB,IAAIC,EAEJ,WACE,IAAIA,EAEJ,WAeE,SAASA,IACPC,KAAKC,cAAgB,GACrBD,KAAKE,QAAU,GA+BjB,IAAIC,EAASJ,EAAUK,UA+MvB,OA7MAD,EAAOE,QAAU,SAAiBC,EAAWC,QACvB,IAAhBA,IACFA,EAAc,IAGhB,IAAIC,EAAcR,KAAKC,cAAcK,IAAc,GAGnD,KAF0C,EAArBE,EAAYC,QAG/B,OAAO,EAITD,EAAcA,EAAYE,SAC1BH,EAAYI,UAAYL,EACxB,IAAIM,GAAa,EACbC,EAAM,CAACN,GACPO,EAAI,EAERP,EAAYQ,KAAO,WACjBH,GAAa,GAGfL,EAAYS,cAAgBhB,KAE5B,IAAK,IAAIiB,EAAOC,UAAUT,OAAQU,EAAY,IAAIC,MAAa,EAAPH,EAAWA,EAAO,EAAI,GAAII,EAAO,EAAGA,EAAOJ,EAAMI,IACvGF,EAAUE,EAAO,GAAKH,UAAUG,GAOlC,IAJwB,GAApBF,EAAUV,SACZI,EAAMA,EAAIH,OAAOS,IAGdL,EAAI,EAAGN,EAAYM,GAAIA,IAC1BN,EAAYM,GAAGQ,MAAMtB,KAAMa,GAG7B,OAAQD,GA0BVT,EAAOoB,KAAO,SAAcjB,EAAWkB,GACrC,GAAyB,iBAAdlB,GAA0BT,EAAY2B,GAAkB,CACjE,IACIV,EADAW,EAAYnB,EAGhB,IAAKQ,KAAKW,EACRzB,KAAKuB,KAAKT,EAAGW,EAAUX,IAGzB,OAAOd,KACF,GAAyB,iBAAdM,GAAqD,mBAApBkB,EAAgC,CACjF,IAAIE,EAAO1B,KACXA,KAAK2B,GAAGrB,EAAW,SAASsB,IAC1B,IAA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AQld,EAAK8f,SAASf,YACtBvjB,MAAOukB,EAAIjT,IAAItR,sBAGD,SAAAukB,KAiBVtwB,QAAQ,eAAgB,CAC5B6gB,UAAWyP,EAAIzP,iBAKb2P,MAAMzI,QAAQ,QAASxX,EAAKggB,+CAelCG,SAAA,SAASpkB,UACJqkB,MAAMrkB,IAAUA,EAAQ,SAIvB4jB,OAAS5jB,OACT6jB,UAxLmB,IAwLP7jB,OACZikB,UAAU1wB,QAAQyM,MAAQ,CAAC3M,KAAKwwB,UAAWxwB,KAAKwwB,YAL7CxwB,QAqBTixB,SAAA,kBACQjxB,KAAKuwB,UAkBbW,OAAA,SAAO9kB,EAAWkW,mBAAXlW,IAAAA,EAAQ,YAAGkW,IAAAA,EAAQ,CAAC/B,SAAU,SAC/BsQ,MAAMzM,MAAM,CAAChY,MAAAA,GAAQkW,EAAM/B,UACzBvgB,QAkBRmxB,OAAA,SAAO/kB,EAAWkW,mBAAXlW,IAAAA,EAAQ,YAAGkW,IAAAA,EAAQ,CAAC/B,SAAU,SAC/BsQ,MAAM5O,MAAM,CAAC7V,MAAAA,GAAQkW,EAAM/B,UACzBvgB,QASRwL,SAAA,kBACQxL,KAAK6wB,MAAM9b,MAAM3I,OAAS,MAhOVrM,UAAnBuwB,EAWE9tB,QAAUA,GAXZ8tB"} \ No newline at end of file diff --git a/dist/view360.esm.js b/dist/view360.esm.js new file mode 100644 index 000000000..6c340e417 --- /dev/null +++ b/dist/view360.esm.js @@ -0,0 +1,6393 @@ +import PosePredictor from 'webvr-polyfill/src/sensor-fusion/pose-predictor'; +import Util from 'webvr-polyfill/src/util'; +import MathUtil from 'webvr-polyfill/src/math-util'; +import ComplementaryFilter from 'webvr-polyfill/src/sensor-fusion/complementary-filter'; +import Agent from '@egjs/agent'; +import _ESPromise from 'es6-promise'; +import { vec2, vec3, quat, glMatrix, mat4, mat3 } from 'gl-matrix'; +import Axes, { PanInput, PinchInput, MoveKeyInput, WheelInput } from '@egjs/axes'; +import Component from '@egjs/component'; + +function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } +} + +function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; +} + +function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); +} + +function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; +} + +function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; +} + +/** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ +/* eslint-disable no-new-func, no-nested-ternary */ + +var win = typeof window !== "undefined" && window.Math === Math ? window : typeof self !== "undefined" && self.Math === Math ? self : Function("return this")(); +/* eslint-enable no-new-func, no-nested-ternary */ + +var doc = win.document; +var agent = Agent(); +var osName = agent.os.name; +var browserName = agent.browser.name; +var IS_IOS = osName === "ios"; +var IS_SAFARI_ON_DESKTOP = osName === "mac" && browserName === "safari"; + +/** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ +win.Float32Array = typeof win.Float32Array !== "undefined" ? win.Float32Array : win.Array; +var Float32Array$1 = win.Float32Array; +var getComputedStyle = win.getComputedStyle; +var userAgent = win.navigator.userAgent; +var SUPPORT_TOUCH = "ontouchstart" in win; +var SUPPORT_DEVICEMOTION = "ondevicemotion" in win; +var DeviceMotionEvent = win.DeviceMotionEvent; +var devicePixelRatio = win.devicePixelRatio; + +var TRANSFORM = function () { + var docStyle = doc.documentElement.style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in docStyle) { + return target[i]; + } + } + + return ""; +}(); // check for will-change support + + +var SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports && win.CSS.supports("will-change", "transform"); +var WEBXR_SUPPORTED = false; + +var checkXRSupport = function checkXRSupport() { + if (!navigator.xr) { + return; + } + + if (navigator.xr.isSessionSupported) { + navigator.xr.isSessionSupported("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } else if (navigator.xr.supportsSession) { + navigator.xr.supportsSession("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } +}; + +/** + * Original Code + * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js + * Math Util + * modified by egjs + */ + +function quatToVec3(quaternion) { + var baseV = vec3.fromValues(0, 0, 1); + vec3.transformQuat(baseV, baseV, quaternion); + return baseV; +} + +function toDegree(a) { + return a * 180 / Math.PI; +} + +var util = {}; + +util.isPowerOfTwo = function (n) { + return n && (n & n - 1) === 0; +}; + +util.extractPitchFromQuat = function (quaternion) { + var baseV = quatToVec3(quaternion); + return -1 * Math.atan2(baseV[1], Math.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2))); +}; + +util.hypot = Math.hypot || function (x, y) { + return Math.sqrt(x * x + y * y); +}; // implement reference +// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식 +// calculating angle between two vectors : http://darkpgmr.tistory.com/121 + + +var ROTATE_CONSTANT = { + PITCH_DELTA: 1, + YAW_DELTA_BY_ROLL: 2, + YAW_DELTA_BY_YAW: 3 +}; +ROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = { + targetAxis: [0, 1, 0], + meshPoint: [0, 0, 1] +}; +ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = { + targetAxis: [0, 1, 0], + meshPoint: [1, 0, 0] +}; +ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = { + targetAxis: [1, 0, 0], + meshPoint: [0, 0, 1] +}; + +function getRotationDelta(prevQ, curQ, rotateKind) { + var targetAxis = vec3.fromValues(ROTATE_CONSTANT[rotateKind].targetAxis[0], ROTATE_CONSTANT[rotateKind].targetAxis[1], ROTATE_CONSTANT[rotateKind].targetAxis[2]); + var meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint; + var prevQuaternion = quat.clone(prevQ); + var curQuaternion = quat.clone(curQ); + quat.normalize(prevQuaternion, prevQuaternion); + quat.normalize(curQuaternion, curQuaternion); + var prevPoint = vec3.fromValues(0, 0, 1); + var curPoint = vec3.fromValues(0, 0, 1); + vec3.transformQuat(prevPoint, prevPoint, prevQuaternion); + vec3.transformQuat(curPoint, curPoint, curQuaternion); + vec3.transformQuat(targetAxis, targetAxis, curQuaternion); + var rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint)); + var rotateDirection = rotateDistance > 0 ? 1 : -1; // when counter clock wise, use vec3.fromValues(0,1,0) + // when clock wise, use vec3.fromValues(0,-1,0) + // const meshPoint1 = vec3.fromValues(0, 0, 0); + + var meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + var meshPoint3; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + meshPoint3 = vec3.fromValues(0, rotateDirection, 0); + } else { + meshPoint3 = vec3.fromValues(rotateDirection, 0, 0); + } + + vec3.transformQuat(meshPoint2, meshPoint2, curQuaternion); + vec3.transformQuat(meshPoint3, meshPoint3, curQuaternion); + var vecU = meshPoint2; + var vecV = meshPoint3; + var vecN = vec3.create(); + vec3.cross(vecN, vecU, vecV); + vec3.normalize(vecN, vecN); + var coefficientA = vecN[0]; + var coefficientB = vecN[1]; + var coefficientC = vecN[2]; // const coefficientD = -1 * vec3.dot(vecN, meshPoint1); + // a point on the plane + + curPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + vec3.transformQuat(curPoint, curPoint, curQuaternion); // a point should project on the plane + + prevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + vec3.transformQuat(prevPoint, prevPoint, prevQuaternion); // distance between prevPoint and the plane + + var distance = Math.abs(prevPoint[0] * coefficientA + prevPoint[1] * coefficientB + prevPoint[2] * coefficientC); + var projectedPrevPoint = vec3.create(); + vec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance)); + var trigonometricRatio = (projectedPrevPoint[0] * curPoint[0] + projectedPrevPoint[1] * curPoint[1] + projectedPrevPoint[2] * curPoint[2]) / (vec3.length(projectedPrevPoint) * vec3.length(curPoint)); // defensive block + + trigonometricRatio > 1 && (trigonometricRatio = 1); + var theta = Math.acos(trigonometricRatio); + var crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint); + distance = coefficientA * crossVec[0] + coefficientB * crossVec[1] + coefficientC * crossVec[2]; + var thetaDirection; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + thetaDirection = distance > 0 ? 1 : -1; + } else { + thetaDirection = distance < 0 ? 1 : -1; + } + + var deltaRadian = theta * thetaDirection * rotateDirection; + return toDegree(deltaRadian); +} + +function angleBetweenVec2(v1, v2) { + var det = v1[0] * v2[1] - v2[0] * v1[1]; + var theta = -Math.atan2(det, vec2.dot(v1, v2)); + return theta; +} + +util.yawOffsetBetween = function (viewDir, targetDir) { + var viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]); + var targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]); + vec2.normalize(viewDirXZ, viewDirXZ); + vec2.normalize(targetDirXZ, targetDirXZ); + var theta = -angleBetweenVec2(viewDirXZ, targetDirXZ); + return theta; +}; + +util.toDegree = toDegree; +util.getRotationDelta = getRotationDelta; +util.angleBetweenVec2 = angleBetweenVec2; + +function toAxis(source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); +} + +/** + * Returns a number value indiciating the version of Chrome being used, + * or otherwise `null` if not on Chrome. + * + * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19 + */ + +/** + * In Chrome m65, `devicemotion` events are broken but subsequently fixed + * in 65.0.3325.148. Since many browsers use Chromium, ensure that + * we scope this detection by branch and build numbers to provide + * a proper fallback. + * https://github.com/immersive-web/webvr-polyfill/issues/307 + */ + +var version = -1; // It should not be null because it will be compared with number + +var branch = null; +var build = null; +var match = /Chrome\/([0-9]+)\.(?:[0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(userAgent); + +if (match) { + version = parseInt(match[1], 10); + branch = match[2]; + build = match[3]; +} + +var CHROME_VERSION = version; +var IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === "3325" && parseInt(build, 10) < 148; +var IS_ANDROID = /Android/i.test(userAgent); +var CONTROL_MODE_VR = 1; +var CONTROL_MODE_YAWPITCH = 2; +var TOUCH_DIRECTION_NONE = 1; +var TOUCH_DIRECTION_YAW = 2; +var TOUCH_DIRECTION_PITCH = 4; +var TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH; +/* Const for MovableCoord */ + +var MC_DECELERATION = 0.0014; +var MC_MAXIMUM_DURATION = 1000; +var MC_BIND_SCALE = [0.20, 0.20]; +var MAX_FIELD_OF_VIEW = 110; +var PAN_SCALE = 320; // const DELTA_THRESHOLD = 0.015; + +var YAW_RANGE_HALF = 180; +var PITCH_RANGE_HALF = 90; +var CIRCULAR_PITCH_RANGE_HALF = 180; +var GYRO_MODE = { + NONE: "none", + YAWPITCH: "yawPitch", + VR: "VR" +}; + +var STILLNESS_THRESHOLD = 200; // millisecond + +var DeviceMotion = +/*#__PURE__*/ +function (_Component) { + _inheritsLoose(DeviceMotion, _Component); + + function DeviceMotion() { + var _this; + + _this = _Component.call(this) || this; + _this._onDeviceMotion = _this._onDeviceMotion.bind(_assertThisInitialized(_this)); + _this._onDeviceOrientation = _this._onDeviceOrientation.bind(_assertThisInitialized(_this)); + _this._onChromeWithoutDeviceMotion = _this._onChromeWithoutDeviceMotion.bind(_assertThisInitialized(_this)); + _this.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION; + _this.isAndroid = IS_ANDROID; + _this.stillGyroVec = vec3.create(); + _this.rawGyroVec = vec3.create(); + _this.adjustedGyroVec = vec3.create(); + _this._timer = null; + _this.lastDevicemotionTimestamp = 0; + _this._isEnabled = false; + + _this.enable(); + + return _this; + } + + var _proto = DeviceMotion.prototype; + + _proto._onChromeWithoutDeviceMotion = function _onChromeWithoutDeviceMotion(e) { + var alpha = e.alpha, + beta = e.beta, + gamma = e.gamma; // There is deviceorientation event trigged with empty values + // on Headless Chrome. + + if (alpha === null) { + return; + } // convert to radian + + + alpha = (alpha || 0) * Math.PI / 180; + beta = (beta || 0) * Math.PI / 180; + gamma = (gamma || 0) * Math.PI / 180; + this.trigger("devicemotion", { + inputEvent: { + deviceorientation: { + alpha: alpha, + beta: beta, + gamma: -gamma + } + } + }); + }; + + _proto._onDeviceOrientation = function _onDeviceOrientation() { + var _this2 = this; + + this._timer && clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (new Date().getTime() - _this2.lastDevicemotionTimestamp < STILLNESS_THRESHOLD) { + vec3.copy(_this2.stillGyroVec, _this2.rawGyroVec); + } + }, STILLNESS_THRESHOLD); + }; + + _proto._onDeviceMotion = function _onDeviceMotion(e) { + // desktop chrome triggers devicemotion event with empthy sensor values. + // Those events should ignored. + var isGyroSensorAvailable = !(e.rotationRate.alpha == null); + var isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null); + + if (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) { + return; + } + + var devicemotionEvent = _extends({}, e); + + devicemotionEvent.interval = e.interval; + devicemotionEvent.timeStamp = e.timeStamp; + devicemotionEvent.type = e.type; + devicemotionEvent.rotationRate = { + alpha: e.rotationRate.alpha, + beta: e.rotationRate.beta, + gamma: e.rotationRate.gamma + }; + devicemotionEvent.accelerationIncludingGravity = { + x: e.accelerationIncludingGravity.x, + y: e.accelerationIncludingGravity.y, + z: e.accelerationIncludingGravity.z + }; + devicemotionEvent.acceleration = { + x: e.acceleration.x, + y: e.acceleration.y, + z: e.acceleration.z + }; + + if (this.isAndroid) { + vec3.set(this.rawGyroVec, e.rotationRate.alpha || 0, e.rotationRate.beta || 0, e.rotationRate.gamma || 0); + vec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec); + this.lastDevicemotionTimestamp = new Date().getTime(); + devicemotionEvent.adjustedRotationRate = { + alpha: this.adjustedGyroVec[0], + beta: this.adjustedGyroVec[1], + gamma: this.adjustedGyroVec[2] + }; + } + + this.trigger("devicemotion", { + inputEvent: devicemotionEvent + }); + }; + + _proto.enable = function enable() { + if (this.isAndroid) { + win.addEventListener("deviceorientation", this._onDeviceOrientation); + } + + if (this.isWithoutDeviceMotion) { + win.addEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + } else { + win.addEventListener("devicemotion", this._onDeviceMotion); + } + + this._isEnabled = true; + }; + + _proto.disable = function disable() { + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + win.removeEventListener("devicemotion", this._onDeviceMotion); + this._isEnabled = false; + }; + + return DeviceMotion; +}(Component); + +ComplementaryFilter.prototype.run_ = function () { + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - this.previousGyroMeasurement.timestampS; // Convert gyro rotation vector to a quaternion delta. + + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + + var invFilterQ = new MathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + + var deltaQ = new MathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + + var targetQ = new MathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); // SLERP factor: 0 is pure gyro, 1 is pure accel. + + this.filterQ.slerp(targetQ, 1 - this.kFilter); + this.previousFilterQ.copy(this.filterQ); + + if (!this.isFilterQuaternionInitialized) { + this.isFilterQuaternionInitialized = true; + } +}; + +ComplementaryFilter.prototype.getOrientation = function () { + if (this.isFilterQuaternionInitialized) { + return this.filterQ; + } else { + return null; + } +}; + +var K_FILTER = 0.98; +var PREDICTION_TIME_S = 0.040; + +var FusionPoseSensor = +/*#__PURE__*/ +function (_Component) { + _inheritsLoose(FusionPoseSensor, _Component); + + function FusionPoseSensor() { + var _this; + + _this = _Component.call(this) || this; + _this.deviceMotion = new DeviceMotion(); + _this.accelerometer = new MathUtil.Vector3(); + _this.gyroscope = new MathUtil.Vector3(); + _this._onDeviceMotionChange = _this._onDeviceMotionChange.bind(_assertThisInitialized(_this)); + _this._onScreenOrientationChange = _this._onScreenOrientationChange.bind(_assertThisInitialized(_this)); + _this.filter = new ComplementaryFilter(K_FILTER); + _this.posePredictor = new PosePredictor(PREDICTION_TIME_S); + _this.filterToWorldQ = new MathUtil.Quaternion(); + _this.isFirefoxAndroid = Util.isFirefoxAndroid(); // This includes iPhone & iPad(both desktop and mobile mode) ref #326 + + _this.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP; // Ref https://github.com/immersive-web/cardboard-vr-display/issues/18 + + _this.isChromeUsingDegrees = CHROME_VERSION >= 66; + _this._isEnabled = false; // Set the filter to world transform, depending on OS. + + if (_this.isIOS) { + _this.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2); + } else { + _this.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2); + } + + _this.inverseWorldToScreenQ = new MathUtil.Quaternion(); + _this.worldToScreenQ = new MathUtil.Quaternion(); + _this.originalPoseAdjustQ = new MathUtil.Quaternion(); + + _this.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), -win.orientation * Math.PI / 180); + + _this._setScreenTransform(); // Adjust this filter for being in landscape mode. + + + if (Util.isLandscapeMode()) { + _this.filterToWorldQ.multiply(_this.inverseWorldToScreenQ); + } // Keep track of a reset transform for resetSensor. + + + _this.resetQ = new MathUtil.Quaternion(); + + _this.deviceMotion.on("devicemotion", _this._onDeviceMotionChange); + + _this.enable(); + + return _this; + } + + var _proto = FusionPoseSensor.prototype; + + _proto.enable = function enable() { + if (this.isEnabled()) { + return; + } + + this.deviceMotion.enable(); + this._isEnabled = true; + win.addEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.disable = function disable() { + if (!this.isEnabled()) { + return; + } + + this.deviceMotion.disable(); + this._isEnabled = false; + win.removeEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.isEnabled = function isEnabled() { + return this._isEnabled; + }; + + _proto.destroy = function destroy() { + this.disable(); + this.deviceMotion = null; + }; + + _proto._triggerChange = function _triggerChange() { + var orientation = this.getOrientation(); // if orientation is not prepared. don't trigger change event + + if (!orientation) { + return; + } + + if (!this._prevOrientation) { + this._prevOrientation = orientation; + return; + } + + if (quat.equals(this._prevOrientation, orientation)) { + return; + } + + this.trigger("change", { + quaternion: orientation + }); + }; + + _proto.getOrientation = function getOrientation() { + var _this2 = this; + + var orientation; // Hack around using deviceorientation instead of devicemotion + + if (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) { + this.deviceOrientationFixQ = this.deviceOrientationFixQ || function () { + var y = new MathUtil.Quaternion().setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -_this2._alpha); + return y; + }(); + + orientation = this._deviceOrientationQ; + var out = new MathUtil.Quaternion(); + out.copy(orientation); + out.multiply(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.worldToScreenQ); + out.multiplyQuaternions(this.deviceOrientationFixQ, out); // return quaternion as glmatrix quaternion object + + var out_ = quat.fromValues(out.x, out.y, out.z, out.w); + return quat.normalize(out_, out_); + } else { + // Convert from filter space to the the same system used by the + // deviceorientation event. + orientation = this.filter.getOrientation(); + + if (!orientation) { + return null; + } + + var _out = this._convertFusionToPredicted(orientation); // return quaternion as glmatrix quaternion object + + + var _out_ = quat.fromValues(_out.x, _out.y, _out.z, _out.w); + + return quat.normalize(_out_, _out_); + } + }; + + _proto._convertFusionToPredicted = function _convertFusionToPredicted(orientation) { + // Predict orientation. + this.predictedQ = this.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS); // Convert to THREE coordinate system: -Z forward, Y up, X right. + + var out = new MathUtil.Quaternion(); + out.copy(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.predictedQ); + out.multiply(this.worldToScreenQ); + return out; + }; + + _proto._onDeviceMotionChange = function _onDeviceMotionChange(_ref) { + var inputEvent = _ref.inputEvent; + var deviceorientation = inputEvent.deviceorientation; + var deviceMotion = inputEvent; + var accGravity = deviceMotion.accelerationIncludingGravity; + var rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate; + var timestampS = deviceMotion.timeStamp / 1000; + + if (deviceorientation) { + if (!this._alpha) { + this._alpha = deviceorientation.alpha; + } + + this._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion(); + + this._deviceOrientationQ.setFromEulerYXZ(deviceorientation.beta, deviceorientation.alpha, deviceorientation.gamma); + + this._triggerChange(); + } else { + // Firefox Android timeStamp returns one thousandth of a millisecond. + if (this.isFirefoxAndroid) { + timestampS /= 1000; + } + + this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); + this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); // Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate` + // is reported in degrees, so we first convert to radians. + + if (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) { + this.gyroscope.multiplyScalar(Math.PI / 180); + } + + this.filter.addAccelMeasurement(this.accelerometer, timestampS); + this.filter.addGyroMeasurement(this.gyroscope, timestampS); + + this._triggerChange(); + + this.previousTimestampS = timestampS; + } + }; + + _proto._onScreenOrientationChange = function _onScreenOrientationChange(screenOrientation) { + this._setScreenTransform(win.orientation); + }; + + _proto._setScreenTransform = function _setScreenTransform() { + this.worldToScreenQ.set(0, 0, 0, 1); + var orientation = win.orientation; + + switch (orientation) { + case 0: + break; + + case 90: + case -90: + case 180: + this.worldToScreenQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI); + break; + + default: + break; + } + + this.inverseWorldToScreenQ.copy(this.worldToScreenQ); + this.inverseWorldToScreenQ.inverse(); + }; + + return FusionPoseSensor; +}(Component); + +function getDeltaYaw$1(prvQ, curQ) { + var yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW); + var yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) * Math.sin(util.extractPitchFromQuat(curQ)); + return yawDeltaByRoll + yawDeltaByYaw; +} + +function getDeltaPitch$1(prvQ, curQ) { + var pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA); + return pitchDelta; +} + +var TiltMotionInput = +/*#__PURE__*/ +function (_Component) { + _inheritsLoose(TiltMotionInput, _Component); + + function TiltMotionInput(el, options) { + var _this; + + _this = _Component.call(this) || this; + _this.element = el; + _this._prevQuaternion = null; + _this._quaternion = null; + _this.fusionPoseSensor = null; + _this.options = _extends({ + scale: 1, + threshold: 0 + }, options); + _this._onPoseChange = _this._onPoseChange.bind(_assertThisInitialized(_this)); + return _this; + } + + var _proto = TiltMotionInput.prototype; + + _proto.mapAxes = function mapAxes(axes) { + this.axes = axes; + }; + + _proto.connect = function connect(observer) { + if (this.observer) { + return this; + } + + this.observer = observer; + this.fusionPoseSensor = new FusionPoseSensor(); + this.fusionPoseSensor.enable(); + + this._attachEvent(); + + return this; + }; + + _proto.disconnect = function disconnect() { + if (!this.observer) { + return this; + } + + this._dettachEvent(); + + this.fusionPoseSensor.disable(); + this.fusionPoseSensor.destroy(); + this.fusionPoseSensor = null; + this.observer = null; + return this; + }; + + _proto.destroy = function destroy() { + this.disconnect(); + this.element = null; + this.options = null; + this.axes = null; + this._prevQuaternion = null; + this._quaternion = null; + }; + + _proto._onPoseChange = function _onPoseChange(event) { + if (!this._prevQuaternion) { + this._prevQuaternion = quat.clone(event.quaternion); + this._quaternion = quat.clone(event.quaternion); + return; + } + + quat.copy(this._prevQuaternion, this._quaternion); + quat.copy(this._quaternion, event.quaternion); + this.observer.change(this, event, toAxis(this.axes, [getDeltaYaw$1(this._prevQuaternion, this._quaternion), getDeltaPitch$1(this._prevQuaternion, this._quaternion)])); + }; + + _proto._attachEvent = function _attachEvent() { + this.fusionPoseSensor.on("change", this._onPoseChange); + }; + + _proto._dettachEvent = function _dettachEvent() { + this.fusionPoseSensor.off("change", this._onPoseChange); + }; + + return TiltMotionInput; +}(Component); + +var screenRotationAngleInst = null; +var refCount = 0; + +var ScreenRotationAngle = +/*#__PURE__*/ +function () { + function ScreenRotationAngle() { + refCount++; + + if (screenRotationAngleInst) { + return screenRotationAngleInst; + } + /* eslint-disable */ + + + screenRotationAngleInst = this; + /* eslint-enable */ + + this._onDeviceOrientation = this._onDeviceOrientation.bind(this); + this._onOrientationChange = this._onOrientationChange.bind(this); + this._spinR = 0; + this._screenOrientationAngle = 0; + win.addEventListener("deviceorientation", this._onDeviceOrientation); + win.addEventListener("orientationchange", this._onOrientationChange); + } + + var _proto = ScreenRotationAngle.prototype; + + _proto._onDeviceOrientation = function _onDeviceOrientation(e) { + if (e.beta === null || e.gamma === null) { + // (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it. + return; + } // Radian + + + var betaR = glMatrix.toRadian(e.beta); + var gammaR = glMatrix.toRadian(e.gamma); + /* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */ + + this._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR)); + }; + + _proto._onOrientationChange = function _onOrientationChange(e) { + if (win.screen && win.screen.orientation && win.screen.orientation.angle !== undefined) { + this._screenOrientationAngle = screen.orientation.angle; + } else if (win.orientation !== undefined) { + /* iOS */ + this._screenOrientationAngle = win.orientation >= 0 ? win.orientation : 360 + win.orientation; + } + }; + + _proto.getRadian = function getRadian() { + // Join with screen orientation + // this._testVal = this._spinR + ", " + this._screenOrientationAngle + ", " + window.orientation; + return this._spinR + glMatrix.toRadian(this._screenOrientationAngle); + }; + + _proto.unref = function unref() { + if (--refCount > 0) { + return; + } + + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("orientationchange", this._onOrientationChange); + this._spinR = 0; + this._screenOrientationAngle = 0; + /* eslint-disable */ + + screenRotationAngleInst = null; + /* eslint-enable */ + + refCount = 0; + }; + + return ScreenRotationAngle; +}(); + +/** + * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle. + * + * The reason for using this function is that in VR mode, + * the roll angle is adjusted in the direction opposite to the screen rotation angle. + * + * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move. + * @extends PanInput + */ + +var RotationPanInput = +/*#__PURE__*/ +function (_PanInput) { + _inheritsLoose(RotationPanInput, _PanInput); + + /** + * Constructor + * + * @private + * @param {HTMLElement} el target element + * @param {Object} [options] The option object + * @param {Boolean} [options.useRotation] Whether to use rotation(or VR) + */ + function RotationPanInput(el, options) { + var _this; + + _this = _PanInput.call(this, el, options) || this; + _this._useRotation = false; + _this._screenRotationAngle = null; + + _this.setUseRotation(!!(options && options.useRotation)); + + _this._userDirection = Axes.DIRECTION_ALL; + return _this; + } + + var _proto = RotationPanInput.prototype; + + _proto.setUseRotation = function setUseRotation(useRotation) { + this._useRotation = useRotation; + + if (this._screenRotationAngle) { + this._screenRotationAngle.unref(); + + this._screenRotationAngle = null; + } + + if (this._useRotation) { + this._screenRotationAngle = new ScreenRotationAngle(); + } + }; + + _proto.connect = function connect(observer) { + // User intetened direction + this._userDirection = this._direction; // In VR Mode, Use ALL direction if direction is not none + // Because horizontal and vertical is changed dynamically by screen rotation. + // this._direction is used to initialize hammerjs + + if (this._useRotation && this._direction & Axes.DIRECTION_ALL) { + this._direction = Axes.DIRECTION_HORIZONTAL; + } + + _PanInput.prototype.connect.call(this, observer); + }; + + _proto.getOffset = function getOffset(properties, useDirection) { + if (this._useRotation === false) { + return _PanInput.prototype.getOffset.call(this, properties, useDirection); + } + + var offset = _PanInput.prototype.getOffset.call(this, properties, [true, true]); + + var newOffset = [0, 0]; + + var theta = this._screenRotationAngle.getRadian(); + + var cosTheta = Math.cos(theta); + var sinTheta = Math.sin(theta); // RotateZ + + newOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta; + newOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta; // Use only user allowed direction. + + if (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) { + newOffset[0] = 0; + } else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) { + newOffset[1] = 0; + } + + return newOffset; + }; + + _proto.destroy = function destroy() { + if (this._useRotation) { + this._screenRotationAngle && this._screenRotationAngle.unref(); + } + + _PanInput.prototype.destroy.call(this); + }; + + return RotationPanInput; +}(PanInput); + +var Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0); + +var DeviceQuaternion = +/*#__PURE__*/ +function (_Component) { + _inheritsLoose(DeviceQuaternion, _Component); + + function DeviceQuaternion() { + var _this; + + _this = _Component.call(this) || this; + _this._fusionPoseSensor = new FusionPoseSensor(); + _this._quaternion = quat.create(); + + _this._fusionPoseSensor.enable(); + + _this._fusionPoseSensor.on("change", function (e) { + _this._quaternion = e.quaternion; + + _this.trigger("change", { + isTrusted: true + }); + }); + + return _this; + } + + var _proto = DeviceQuaternion.prototype; + + _proto.getCombinedQuaternion = function getCombinedQuaternion(yaw) { + var yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw)); + var conj = quat.conjugate(quat.create(), this._quaternion); // Multiply pitch quaternion -> device quaternion -> yaw quaternion + + var outQ = quat.multiply(quat.create(), conj, yawQ); + return outQ; + }; + + _proto.destroy = function destroy() { + // detach all event handler + this.off(); + + if (this._fusionPoseSensor) { + this._fusionPoseSensor.off(); + + this._fusionPoseSensor.destroy(); + + this._fusionPoseSensor = null; + } + }; + + return DeviceQuaternion; +}(Component); + +var VERSION = "3.3.3"; + +var DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF]; +var DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF]; +var CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF]; +/** + * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates. + * + * @alias eg.YawPitchControl + * @extends eg.Component + * + * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + */ + +var YawPitchControl = +/*#__PURE__*/ +function () { + var YawPitchControl = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(YawPitchControl, _Component); + + // Expose DeviceOrientationControls sub module for test purpose + + /** + * @param {Object} options The option object of the eg.YawPitch module + * @param {Element}[options.element=null] element A base element for the eg.YawPitch module + * @param {Number} [options.yaw=0] initial yaw (degree) + * @param {Number} [options.pitch=0] initial pitch (degree) + * @param {Number} [options.fov=65] initial field of view (degree) + * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown + * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available + * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. + * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move) + * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw + * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch + * @param {Array} [options.fovRange=[30, 110] Range of FOV + * @param {Number} [options.aspectRatio=1] Aspect Ratio + */ + function YawPitchControl(options) { + var _this; + + _this = _Component.call(this) || this; + + var opt = _extends({ + element: null, + yaw: 0, + pitch: 0, + fov: 65, + showPolePoint: false, + useZoom: true, + useKeyboard: true, + gyroMode: GYRO_MODE.YAWPITCH, + touchDirection: TOUCH_DIRECTION_ALL, + yawRange: DEFAULT_YAW_RANGE, + pitchRange: DEFAULT_PITCH_RANGE, + fovRange: [30, 110], + aspectRatio: 1 + /* TODO: Need Mandatory? */ + + }, options); + + _this._element = opt.element; + _this._initialFov = opt.fov; + _this._enabled = false; + _this._isAnimating = false; + _this._deviceQuaternion = null; + + _this._initAxes(opt); + + _this.option(opt); + + return _this; + } + + var _proto = YawPitchControl.prototype; + + _proto._initAxes = function _initAxes(opt) { + var _this2 = this; + + var yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio); + + var pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint); + + var useRotation = opt.gyroMode === GYRO_MODE.VR; + this.axesPanInput = new RotationPanInput(this._element, { + useRotation: useRotation + }); + this.axesWheelInput = new WheelInput(this._element, { + scale: -4 + }); + this.axesTiltMotionInput = null; + this.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, { + scale: -1 + }) : null; + this.axesMoveKeyInput = new MoveKeyInput(this._element, { + scale: [-6, 6] + }); + this.axes = new Axes({ + yaw: { + range: yRange, + circular: YawPitchControl.isCircular(yRange), + bounce: [0, 0] + }, + pitch: { + range: pRange, + circular: YawPitchControl.isCircular(pRange), + bounce: [0, 0] + }, + fov: { + range: opt.fovRange, + circular: [false, false], + bounce: [0, 0] + } + }, { + deceleration: MC_DECELERATION, + maximumDuration: MC_MAXIMUM_DURATION + }, { + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }).on({ + hold: function hold(evt) { + // Restore maximumDuration not to be spin too mush. + _this2.axes.options.maximumDuration = MC_MAXIMUM_DURATION; + + _this2.trigger("hold", { + isTrusted: evt.isTrusted + }); + }, + change: function change(evt) { + if (evt.delta.fov !== 0) { + _this2._updateControlScale(evt); + + _this2.updatePanScale(); + } + + _this2._triggerChange(evt); + }, + release: function release(evt) { + _this2._triggerChange(evt); + }, + animationStart: function animationStart(evt) {}, + animationEnd: function animationEnd(evt) { + _this2.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + } + /** + * Update Pan Scale + * + * Scale(Sensitivity) values of panning is related with fov and height. + * If at least one of them is changed, this function need to be called. + * @param {*} param + */ + ; + + _proto.updatePanScale = function updatePanScale(param) { + if (param === void 0) { + param = {}; + } + + var fov = this.axes.get().fov; + var areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10); + var scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight; + this.axesPanInput.options.scale = [scale, scale]; + this.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW; + return this; + } + /* + * Override component's option method + * to call method for updating values which is affected by option change. + * + * @param {*} args + */ + ; + + _proto.option = function option() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var argLen = args.length; // Getter + + if (argLen === 0) { + return this._getOptions(); + } else if (argLen === 1 && typeof args[0] === "string") { + return this._getOptions(args[0]); + } // Setter + + + var beforeOptions = _extends({}, this.options); + + var newOptions = {}; + var changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList. + + if (argLen === 1) { + changedKeyList = Object.keys(args[0]); + newOptions = _extends({}, args[0]); + } else if (argLen >= 2) { + changedKeyList.push(args[0]); + newOptions[args[0]] = args[1]; + } + + this._setOptions(this._getValidatedOptions(newOptions)); + + this._applyOptions(changedKeyList, beforeOptions); + + return this; + }; + + _proto._getValidatedOptions = function _getValidatedOptions(newOptions) { + if (newOptions.yawRange) { + newOptions.yawRange = this._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio); + } + + if (newOptions.pitchRange) { + newOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov); + } + + return newOptions; + }; + + _proto._getOptions = function _getOptions(key) { + var value; + + if (typeof key === "string") { + value = this.options[key]; + } else if (arguments.length === 0) { + value = this.options; + } + + return value; + }; + + _proto._setOptions = function _setOptions(options) { + for (var key in options) { + this.options[key] = options[key]; + } + }; + + _proto._applyOptions = function _applyOptions(keys, prevOptions) { + var options = this.options; + var axes = this.axes; + var isVR = options.gyroMode === GYRO_MODE.VR; + var isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH; // If it's VR mode, restrict user interaction to yaw direction only + + var touchDirection = isVR ? TOUCH_DIRECTION_YAW & options.touchDirection : options.touchDirection; // If one of below is changed, call updateControlScale() + + if (keys.some(function (key) { + return key === "showPolePoint" || key === "fov" || key === "aspectRatio" || key === "yawRange" || key === "pitchRange"; + })) { + // If fov is changed, update pan scale + if (keys.indexOf("fov") >= 0) { + axes.setTo({ + "fov": options.fov + }); + this.updatePanScale(); + } + + this._updateControlScale(); + } + + if (keys.some(function (key) { + return key === "fovRange"; + })) { + var fovRange = options.fovRange; + var prevFov = axes.get().fov; + var nextFov = axes.get().fov; + vec2.copy(axes.axis.fov.range, fovRange); + + if (nextFov < fovRange[0]) { + nextFov = fovRange[0]; + } else if (prevFov > fovRange[1]) { + nextFov = fovRange[1]; + } + + if (prevFov !== nextFov) { + axes.setTo({ + fov: nextFov + }, 0); + + this._updateControlScale(); + + this.updatePanScale(); + } + } + + if (keys.some(function (key) { + return key === "gyroMode"; + }) && SUPPORT_DEVICEMOTION) { + // Disconnect first + if (this.axesTiltMotionInput) { + this.axes.disconnect(this.axesTiltMotionInput); + this.axesTiltMotionInput.destroy(); + this.axesTiltMotionInput = null; + } + + if (this._deviceQuaternion) { + this._deviceQuaternion.destroy(); + + this._deviceQuaternion = null; + } + + if (isVR) { + this._initDeviceQuaternion(); + } else if (isYawPitch) { + this.axesTiltMotionInput = new TiltMotionInput(this._element); + this.axes.connect(["yaw", "pitch"], this.axesTiltMotionInput); + } + + this.axesPanInput.setUseRotation(isVR); + } + + if (keys.some(function (key) { + return key === "useKeyboard"; + })) { + var useKeyboard = options.useKeyboard; + + if (useKeyboard) { + axes.connect(["yaw", "pitch"], this.axesMoveKeyInput); + } else { + axes.disconnect(this.axesMoveKeyInput); + } + } + + if (keys.some(function (key) { + return key === "useZoom"; + })) { + var useZoom = options.useZoom; // Disconnect first + + axes.disconnect(this.axesWheelInput); + + if (useZoom) { + axes.connect(["fov"], this.axesWheelInput); + } + } + + this._togglePinchInputByOption(options.touchDirection, options.useZoom); + + if (keys.some(function (key) { + return key === "touchDirection"; + })) { + this._enabled && this._enableTouch(touchDirection); + } + }; + + _proto._togglePinchInputByOption = function _togglePinchInputByOption(touchDirection, useZoom) { + if (this.axesPinchInput) { + // disconnect first + this.axes.disconnect(this.axesPinchInput); // If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll. + + if (useZoom && touchDirection === TOUCH_DIRECTION_ALL && // TODO: Get rid of using private property of axes instance. + this.axes._inputs.indexOf(this.axesPinchInput) === -1) { + this.axes.connect(["fov"], this.axesPinchInput); + } + } + }; + + _proto._enableTouch = function _enableTouch(direction) { + // Disconnect first + this.axesPanInput && this.axes.disconnect(this.axesPanInput); + var yawEnabled = direction & TOUCH_DIRECTION_YAW ? "yaw" : null; + var pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? "pitch" : null; + this.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput); + }; + + _proto._initDeviceQuaternion = function _initDeviceQuaternion() { + var _this3 = this; + + this._deviceQuaternion = new DeviceQuaternion(); + + this._deviceQuaternion.on("change", function (e) { + _this3._triggerChange(e); + }); + }; + + _proto._getValidYawRange = function _getValidYawRange(newYawRange, newFov, newAspectRatio) { + var ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1); + var fov = newFov || this.axes.get().fov; + var horizontalFov = fov * ratio; + var isValid = newYawRange[1] - newYawRange[0] >= horizontalFov; + + if (isValid) { + return newYawRange; + } else { + return this.options.yawRange || DEFAULT_YAW_RANGE; + } + }; + + _proto._getValidPitchRange = function _getValidPitchRange(newPitchRange, newFov) { + var fov = newFov || this.axes.get().fov; + var isValid = newPitchRange[1] - newPitchRange[0] >= fov; + + if (isValid) { + return newPitchRange; + } else { + return this.options.pitchRange || DEFAULT_PITCH_RANGE; + } + }; + + YawPitchControl.isCircular = function isCircular(range) { + return range[1] - range[0] < 360 ? [false, false] : [true, true]; + } + /** + * Update yaw/pitch min/max by 5 factor + * + * 1. showPolePoint + * 2. fov + * 3. yawRange + * 4. pitchRange + * 5. aspectRatio + * + * If one of above is changed, call this function + */ + ; + + _proto._updateControlScale = function _updateControlScale(changeEvt) { + var opt = this.options; + var fov = this.axes.get().fov; + + var pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint); + + var yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio); // TODO: If not changed!? + + + var pos = this.axes.get(); + var y = pos.yaw; + var p = pos.pitch; + vec2.copy(this.axes.axis.yaw.range, yRange); + vec2.copy(this.axes.axis.pitch.range, pRange); + this.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange); + this.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange); + /** + * update yaw/pitch by it's range. + */ + + if (y < yRange[0]) { + y = yRange[0]; + } else if (y > yRange[1]) { + y = yRange[1]; + } + + if (p < pRange[0]) { + p = pRange[0]; + } else if (p > pRange[1]) { + p = pRange[1]; + } + + if (changeEvt) { + changeEvt.set({ + yaw: y, + pitch: p + }); + } + + this.axes.setTo({ + yaw: y, + pitch: p + }, 0); + return this; + }; + + _proto._updatePitchRange = function _updatePitchRange(pitchRange, fov, showPolePoint) { + if (this.options.gyroMode === GYRO_MODE.VR) { + // Circular pitch on VR + return CIRCULAR_PITCH_RANGE; + } + + var verticalAngle = pitchRange[1] - pitchRange[0]; + var halfFov = fov / 2; + var isPanorama = verticalAngle < 180; + + if (showPolePoint && !isPanorama) { + // Use full pinch range + return pitchRange.concat(); + } // Round value as movableCood do. + + + return [pitchRange[0] + halfFov, pitchRange[1] - halfFov]; + }; + + _proto._updateYawRange = function _updateYawRange(yawRange, fov, aspectRatio) { + if (this.options.gyroMode === GYRO_MODE.VR) { + return DEFAULT_YAW_RANGE; + } + + var horizontalAngle = yawRange[1] - yawRange[0]; + /** + * Full 360 Mode + */ + + if (horizontalAngle >= 360) { + // Don't limit yaw range on Full 360 mode. + return yawRange.concat(); + } + /** + * Panorama mode + */ + // Ref : https://github.com/naver/egjs-view360/issues/290 + + + var halfHorizontalFov = util.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2)))); // Round value as movableCood do. + + return [yawRange[0] + halfHorizontalFov, yawRange[1] - halfHorizontalFov]; + }; + + _proto._triggerChange = function _triggerChange(evt) { + var pos = this.axes.get(); + var opt = this.options; + var event = { + targetElement: opt.element, + isTrusted: evt.isTrusted + }; + event.yaw = pos.yaw; + event.pitch = pos.pitch; + event.fov = pos.fov; + + if (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) { + event.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + } + + this.trigger("change", event); + } // TODO: makes constant to be logic + ; + + YawPitchControl.adjustAspectRatio = function adjustAspectRatio(input) { + var inputRange = [0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670, 0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19, 1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26, 2.30, 2.60, 3.00, 5.00, 6.00]; + var outputRange = [0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710, 0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15, 1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72, 1.82, 1.92, 2.00, 2.24, 2.30]; + var rangeIdx = -1; + + for (var i = 0; i < inputRange.length - 1; i++) { + if (inputRange[i] <= input && inputRange[i + 1] >= input) { + rangeIdx = i; + break; + } + } + + if (rangeIdx === -1) { + if (inputRange[0] > input) { + return outputRange[0]; + } else { + return outputRange[outputRange[0].length - 1]; + } + } + + var inputA = inputRange[rangeIdx]; + var inputB = inputRange[rangeIdx + 1]; + var outputA = outputRange[rangeIdx]; + var outputB = outputRange[rangeIdx + 1]; + return YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA)); + }; + + YawPitchControl.lerp = function lerp(a, b, fraction) { + return a + fraction * (b - a); + } + /** + * Enable YawPitch functionality + * + * @method eg.YawPitch#enable + */ + ; + + _proto.enable = function enable() { + if (this._enabled) { + return this; + } + + this._enabled = true; // touchDirection is decided by parameter is valid string (Ref. Axes.connect) + + this._applyOptions(Object.keys(this.options), this.options); // TODO: Is this code is needed? Check later. + + + this.updatePanScale(); + return this; + } + /** + * Disable YawPitch functionality + * + * @method eg.YawPitch#disable + */ + ; + + _proto.disable = function disable(persistOrientation) { + if (!this._enabled) { + return this; + } // TODO: Check peristOrientation is needed! + + + if (!persistOrientation) { + this._resetOrientation(); + } + + this.axes.disconnect(); + this._enabled = false; + return this; + }; + + _proto._resetOrientation = function _resetOrientation() { + var opt = this.options; + this.axes.setTo({ + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }, 0); + return this; + } + /** + * Set one or more of yaw, pitch, fov + * + * @param {Object} coordinate yaw, pitch, fov + * @param {Number} duration Animation duration. if it is above 0 then it's animated. + */ + ; + + _proto.lookAt = function lookAt(_ref, duration) { + var yaw = _ref.yaw, + pitch = _ref.pitch, + fov = _ref.fov; + var pos = this.axes.get(); + var y = yaw === undefined ? 0 : yaw - pos.yaw; + var p = pitch === undefined ? 0 : pitch - pos.pitch; + var f = fov === undefined ? 0 : fov - pos.fov; // Allow duration of animation to have more than MC_MAXIMUM_DURATION. + + this.axes.options.maximumDuration = Infinity; + this.axes.setBy({ + yaw: y, + pitch: p, + fov: f + }, duration); + }; + + _proto.getYawPitch = function getYawPitch() { + var yawPitch = this.axes.get(); + return { + yaw: yawPitch.yaw, + pitch: yawPitch.pitch + }; + }; + + _proto.getFov = function getFov() { + return this.axes.get().fov; + }; + + _proto.getQuaternion = function getQuaternion() { + var pos = this.axes.get(); + return this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + }; + + _proto.shouldRenderWithQuaternion = function shouldRenderWithQuaternion() { + return this.options.gyroMode === GYRO_MODE.VR; + } + /** + * Destroys objects + */ + ; + + _proto.destroy = function destroy() { + this.axes && this.axes.destroy(); + this.axisPanInput && this.axisPanInput.destroy(); + this.axesWheelInput && this.axesWheelInput.destroy(); + this.axesTiltMotionInput && this.axesTiltMotionInput.destroy(); + this.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy(); + this.axesPinchInput && this.axesPinchInput.destroy(); + this.axesMoveKeyInput && this.axesMoveKeyInput.destroy(); + this._deviceQuaternion && this._deviceQuaternion.destroy(); + }; + + return YawPitchControl; + }(Component); + + YawPitchControl.VERSION = VERSION; + YawPitchControl.CONTROL_MODE_VR = CONTROL_MODE_VR; + YawPitchControl.CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH; + YawPitchControl.TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL; + YawPitchControl.TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW; + YawPitchControl.TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH; + YawPitchControl.TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE; + return YawPitchControl; +}(); + +var _Promise = typeof Promise === 'undefined' ? _ESPromise.Promise : Promise; +var STATUS = { + "NONE": 0, + "LOADING": 1, + "LOADED": 2, + "ERROR": 3 +}; +var EVENT = { + "READYSTATECHANGE": "readystatechange" +}; + +var ImageLoader = +/*#__PURE__*/ +function () { + var ImageLoader = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(ImageLoader, _Component); + + function ImageLoader(image) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + _this._image = null; + _this._onceHandlers = []; + _this._loadStatus = STATUS.NONE; + image && _this.set(image); + return _this; + } + + var _proto = ImageLoader.prototype; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise(function (res, rej) { + if (!_this2._image) { + rej("ImageLoader: image is not defiend"); + } else if (_this2._loadStatus === STATUS.LOADED) { + res(_this2.getElement()); + } else if (_this2._loadStatus === STATUS.LOADING) { + /* Check isMaybeLoaded() first because there may have + posibilities that image already loaded before get is called. + for example calling get on external image onload callback.*/ + if (ImageLoader.isMaybeLoaded(_this2._image)) { + _this2._loadStatus = STATUS.LOADED; + res(_this2.getElement()); + } else { + _this2.on(EVENT.READYSTATECHANGE, function (e) { + if (e.type === STATUS.LOADED) { + res(_this2.getElement()); + } else { + rej("ImageLoader: failed to load images."); + } + }); + } + } else { + rej("ImageLoader: failed to load images"); + } + }); + } + /** + * @param image img element or img url or array of img element or array of img url + */ + ; + + _proto.set = function set(image) { + var _this3 = this; + + this._loadStatus = STATUS.LOADING; + this._image = ImageLoader.createElement(image); + + if (ImageLoader.isMaybeLoaded(this._image)) { + this._loadStatus = STATUS.LOADED; + return; + } + + this.onceLoaded(this._image, function () { + _this3._loadStatus = STATUS.LOADED; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.LOADED + }); + }, function () { + _this3._loadStatus = STATUS.ERROR; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.ERROR + }); + }); + }; + + ImageLoader.createElement = function createElement(image) { + var images = image instanceof Array ? image : [image]; + return images.map(function (img) { + var _img = img; + + if (typeof img === "string") { + _img = new Image(); + _img.crossOrigin = "anonymous"; + _img.src = img; + } + + return _img; + }); + }; + + _proto.getElement = function getElement() { + return this._image.length === 1 ? this._image[0] : this._image; + }; + + ImageLoader.isMaybeLoaded = function isMaybeLoaded(image) { + var result = false; + + if (image instanceof Image) { + result = image.complete && image.naturalWidth !== 0; + } else if (image instanceof Array) { + result = !image.some(function (img) { + return !img.complete || img.naturalWidth === 0; + }); + } + + return result; + }; + + _proto.onceLoaded = function onceLoaded(target, onload, onerror) { + var _this4 = this; + + var targets = target instanceof Array ? target : [target]; + var targetsNotLoaded = targets.filter(function (img) { + return !ImageLoader.isMaybeLoaded(img); + }); + var loadPromises = targetsNotLoaded.map(function (img) { + return new _Promise(function (res, rej) { + _this4._once(img, "load", function () { + return res(img); + }); + + _this4._once(img, "error", function () { + return rej(img); + }); + }); + }); + + _Promise.all(loadPromises).then(function (result) { + return onload(targets.length === 1 ? targets[0] : targets); + }, function (reason) { + return onerror(reason); + }); + }; + + _proto._once = function _once(target, type, listener) { + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + + target.addEventListener(type, fn); + + this._onceHandlers.push({ + target: target, + type: type, + fn: fn + }); + }; + + _proto.getStatus = function getStatus() { + return this._loadStatus; + }; + + _proto.destroy = function destroy() { + this._onceHandlers.forEach(function (handler) { + handler.target.removeEventListener(handler.type, handler.fn); + }); + + this._onceHandlers = []; + this._image.src = ""; + this._image = null; + this._loadStatus = STATUS.NONE; + }; + + return ImageLoader; + }(Component); + + ImageLoader.STATUS = STATUS; + return ImageLoader; +}(); + +var _Promise$1 = typeof Promise === 'undefined' ? _ESPromise.Promise : Promise; + +// import Agent from "@egjs/agent"; + +/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */ +var READY_STATUS = { + HAVE_NOTHING: 0, + // no information whether or not the audio/video is ready + HAVE_METADATA: 1, + // HAVE_METADATA - metadata for the audio/video is ready + HAVE_CURRENT_DATA: 2, + // data for the current playback position is available, but not enough data to play next frame/millisecond + HAVE_FUTURE_DATA: 3, + // data for the current and at least the next frame is available + HAVE_ENOUGH_DATA: 4, + // enough data available to start playing + // below is custom status for failed to load status + LOADING_FAILED: -1 +}; +var READYSTATECHANGE_EVENT_NAME = {}; +READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = "loadedmetadata"; +READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = "loadeddata"; +READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = "canplay"; +READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = "canplaythrough"; + +var VideoLoader = +/*#__PURE__*/ +function () { + function VideoLoader(video) { + this._handlers = []; + this._sourceCount = 0; // on iOS safari, 'loadeddata' will not triggered unless the user hits play, + // so used 'loadedmetadata' instead. + + this._thresholdReadyState = READY_STATUS.HAVE_METADATA; + this._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState]; + this._loadStatus = video && video.readyState || READY_STATUS.HAVE_NOTHING; + this._onerror = this._onerror.bind(this); + video && this.set(video); + } + + var _proto = VideoLoader.prototype; + + _proto._onerror = function _onerror() { + this._errorCount++; + + if (this._errorCount >= this._sourceCount) { + this._loadStatus = READY_STATUS.LOADING_FAILED; + + this._detachErrorHandler(this._onerror); + } + } + /** + * + * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src} + */ + ; + + _proto._appendSourceElement = function _appendSourceElement(videoUrl) { + var videoSrc; + var videoType; + + if (typeof videoUrl === "object") { + videoSrc = videoUrl.src; + videoType = videoUrl.type; + } else if (typeof videoUrl === "string") { + videoSrc = videoUrl; + } + + if (!videoSrc) { + return false; + } + + var sourceElement = document.createElement("source"); + sourceElement.src = videoSrc; + videoType && (sourceElement.type = videoType); + + this._video.appendChild(sourceElement); + + return true; + }; + + _proto.set = function set(video) { + var _this = this; + + this._reset(); // reset resources. + + + if (!video) { + return; + } + + if (video instanceof HTMLVideoElement) { + // video tag + this._video = video; + } else if (typeof video === "string" || typeof video === "object") { + // url + this._video = document.createElement("video"); + + this._video.setAttribute("crossorigin", "anonymous"); + + this._video.setAttribute("webkit-playsinline", ""); + + this._video.setAttribute("playsinline", ""); + + if (video instanceof Array) { + video.forEach(function (v) { + return _this._appendSourceElement(v); + }); + } else { + this._appendSourceElement(video); + } + + this._sourceCount = this._video.querySelectorAll("source").length; + + if (this._sourceCount > 0) { + if (this._video.readyState < this._thresholdReadyState) { + this._video.load(); // attach loading error listener + + + this._attachErrorHandler(this._onerror); + } + } else { + this._video = null; + } + } + }; + + _proto._attachErrorHandler = function _attachErrorHandler(handler) { + this._video.addEventListener("error", handler); + + this._sources = this._video.querySelectorAll("source"); + [].forEach.call(this._sources, function (source) { + source.addEventListener("error", handler); + }); + }; + + _proto._detachErrorHandler = function _detachErrorHandler(handler) { + this._video.removeEventListener("error", handler); + + [].forEach.call(this._sources, function (source) { + source.removeEventListener("error", handler); + }); + }; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise$1(function (res, rej) { + if (!_this2._video) { + rej("VideoLoader: video is undefined"); + } else if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + rej("VideoLoader: video source is invalid"); + } else if (_this2._video.readyState >= _this2._thresholdReadyState) { + res(_this2._video); + } else { + // check errorCnt and reject + var rejector = function rejector() { + if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + _this2._detachErrorHandler(rejector); + + rej("VideoLoader: video source is invalid"); + } + }; + + _this2._attachErrorHandler(rejector); + + _this2._once(_this2._thresholdEventName, function () { + return res(_this2._video); + }); + } + }); + }; + + _proto.getElement = function getElement() { + return this._video; + }; + + _proto.destroy = function destroy() { + this._reset(); + }; + + _proto._reset = function _reset() { + var _this3 = this; + + this._handlers.forEach(function (handler) { + _this3._video.removeEventListener(handler.type, handler.fn); + }); + + this._handlers = []; + this._video = null; + this._sourceCount = 0; + this._errorCount = 0; + }; + + _proto._once = function _once(type, listener) { + var target = this._video; + + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + /* By useCapture mode enabled, you can capture the error event being fired on source(child)*/ + + + target.addEventListener(type, fn, true); + + this._handlers.push({ + type: type, + fn: fn + }); + }; + + return VideoLoader; +}(); + +var WEBGL_ERROR_CODE = { + "0": "NO_ERROR", + "1280": "INVALID_ENUM", + "1281": "INVALID_VALUE", + "1282": "INVALID_OPERATION", + "1285": "OUT_OF_MEMORY", + "1286": "INVALID_FRAMEBUFFER_OPERATION", + "37442": "CONTEXT_LOST_WEBGL" +}; +var webglAvailability = null; +var MAX_TEXTURE_SIZE_FOR_TEST = null; + +var WebGLUtils = +/*#__PURE__*/ +function () { + function WebGLUtils() {} + + WebGLUtils.createShader = function createShader(gl, type, source) { + var shader = gl.createShader(type); + gl.shaderSource(shader, source); + gl.compileShader(shader); + var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS); + + if (success) { + return shader; + } else { + // eslint-disable-next-line + console.error(gl.getShaderInfoLog(shader)); + } + + return null; + }; + + WebGLUtils.createProgram = function createProgram(gl, vertexShader, fragmentShader) { + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + gl.linkProgram(program); + gl.detachShader(program, vertexShader); + gl.detachShader(program, fragmentShader); + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + var success = gl.getProgramParameter(program, gl.LINK_STATUS); + + if (success) { + return program; + } + + gl.deleteProgram(program); + return null; + }; + + WebGLUtils.initBuffer = function initBuffer(gl, target + /* bind point */ + , data, itemSize, attr) { + var buffer = gl.createBuffer(); + gl.bindBuffer(target, buffer); + gl.bufferData(target, data, gl.STATIC_DRAW); + + if (buffer) { + buffer.itemSize = itemSize; + buffer.numItems = data.length / itemSize; + } + + if (attr !== undefined) { + gl.enableVertexAttribArray(attr); + gl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0); + } + + return buffer; + }; + + WebGLUtils.getWebglContext = function getWebglContext(canvas, userContextAttributes) { + var webglIdentifiers = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"]; + var context = null; + + var contextAttributes = _extends({ + preserveDrawingBuffer: false, + antialias: false, + xrCompatible: true + }, userContextAttributes); + + function onWebglcontextcreationerror(e) { + return e.statusMessage; + } + + canvas.addEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + + for (var i = 0; i < webglIdentifiers.length; i++) { + try { + context = canvas.getContext(webglIdentifiers[i], contextAttributes); + } catch (t) {} + + if (context) { + break; + } + } + + canvas.removeEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + return context; + }; + + WebGLUtils.createTexture = function createTexture(gl, textureTarget) { + var texture = gl.createTexture(); + gl.bindTexture(textureTarget, texture); + gl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.bindTexture(textureTarget, null); + return texture; + } + /** + * Returns the webgl availability of the current browser. + * @method WebGLUtils#isWebGLAvailable + * @retuen {Boolean} isWebGLAvailable + */ + ; + + WebGLUtils.isWebGLAvailable = function isWebGLAvailable() { + if (webglAvailability === null) { + var canvas = document.createElement("canvas"); + var webglContext = WebGLUtils.getWebglContext(canvas); + webglAvailability = !!webglContext; // webglContext Resource forced collection + + if (webglContext) { + var loseContextExtension = webglContext.getExtension("WEBGL_lose_context"); + loseContextExtension && loseContextExtension.loseContext(); + } + } + + return webglAvailability; + } + /** + * Returns whether webgl is stable in the current browser. + * @method WebGLUtils#isStableWebGL + * @retuen {Boolean} isStableWebGL + */ + ; + + WebGLUtils.isStableWebGL = function isStableWebGL() { + var agentInfo = Agent(); + var isStableWebgl = true; + + if (agentInfo.os.name === "android") { + var version = parseFloat(agentInfo.os.version); + + if (version <= 4.3) { + isStableWebgl = false; + } else if (version === 4.4) { + if (agentInfo.browser.name !== "chrome") { + isStableWebgl = false; + } + } + } + + return isStableWebgl; + }; + + WebGLUtils.getErrorNameFromWebGLErrorCode = function getErrorNameFromWebGLErrorCode(code) { + if (!(code in WEBGL_ERROR_CODE)) { + return "UNKNOWN_ERROR"; + } + + return WEBGL_ERROR_CODE[code]; + } + /** + * This function is wrapper for texImage2D to handle exceptions on texImage2D. + * Purpose is to prevent service from being stopped by script error. + * + * @param {*} gl + * @param {*} target + * @param {*} pixels + */ + ; + + WebGLUtils.texImage2D = function texImage2D(gl, target, pixels) { + try { + gl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + } catch (error) { + /* eslint-disable no-console */ + console.error("WebGLUtils.texImage2D error:", error); + /* eslint-enable no-console */ + } + }; + + WebGLUtils.getMaxTextureSize = function getMaxTextureSize(gl) { + // WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test + return MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE); + }; + + return WebGLUtils; +}(); + +var agent$1 = Agent(); +var isIE11 = agent$1.browser.name === "ie" && agent$1.browser.majorVersion === 11; +var EVENTS = { + ERROR: "error" +}; +/** + * + * Extends Component for firing errors occurs internally. + */ + +var Renderer = +/*#__PURE__*/ +function () { + var Renderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(Renderer, _Component); + + function Renderer() { + var _this; + + _this = _Component.call(this) || this; + _this._forceDimension = null; + _this._pixelCanvas = null; + _this._pixelContext = null; + return _this; + } + + var _proto = Renderer.prototype; + + _proto.render = function render(_ref) { + var gl = _ref.gl, + shaderProgram = _ref.shaderProgram, + indexBuffer = _ref.indexBuffer, + mvMatrix = _ref.mvMatrix, + pMatrix = _ref.pMatrix; + gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix); + gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix); + + if (indexBuffer) { + gl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0); + } + } // Define interface for Renderers + + /** + * Following MUST BE DEFINED on Child of Renderer + * + * DATA + * + * - getVertexPositionData + * - getIndexData + * - getTextureCoordData + * + * SOURCE + * + * - getVertexShaderSource + * - getFragmentShaderSource + * + * TEXTURE + * + * - bindTexture + */ + ; + + _proto.getDimension = function getDimension(pixelSource) { + var width = pixelSource.naturalWidth || pixelSource.videoWidth; + var height = pixelSource.naturalHeight || pixelSource.videoHeight; + return { + width: width, + height: height + }; + } + /** + * Update data used by shader + * - + * + * + * @param {*} param + */ + ; + + _proto.updateShaderData = function updateShaderData(param) {} + /* + * Update following data in implementation layer. + * If the data is not changed, it does not need to implement this function. + * + * - _VERTEX_POSITION_DATA + * - _TEXTURE_COORD_DATA + * - _INDEX_DATA + */ + + /** + * + * @param {HTMLImageElement | HTMLVideoElement} image + * @param {Object = {width, height}} forceDimension Forced dimension to resize + */ + ; + + _proto._initPixelSource = function _initPixelSource(image, forceDimension) { + var isIE11Video = isIE11 && image instanceof HTMLVideoElement; + + if (isIE11Video || forceDimension) { + var _ref2 = forceDimension || this.getDimension(image), + width = _ref2.width, + height = _ref2.height; + + this._pixelCanvas = document.createElement("canvas"); + this._pixelCanvas.width = width; + this._pixelCanvas.height = height; + this._pixelContext = this._pixelCanvas.getContext("2d"); + } + + this._forceDimension = forceDimension; + }; + + _proto._getPixelSource = function _getPixelSource(image) { + if (!this._pixelCanvas) { + return image; + } + /** + * IE11 && Video + * or + * Dimension is forced (Image is larger than texture size.) + */ + + + var contentDimension = this.getDimension(image); + var textureDimension = this._forceDimension || contentDimension; + + if (this._pixelCanvas.width !== textureDimension.width) { + this._pixelCanvas.width = textureDimension.width; + } + + if (this._pixelCanvas.height !== textureDimension.height) { + this._pixelCanvas.height = textureDimension.height; + } + + if (this._forceDimension) { + this._pixelContext.drawImage(image, 0, 0, contentDimension.width, contentDimension.height, 0, 0, textureDimension.width, textureDimension.height); + } else { + this._pixelContext.drawImage(image, 0, 0); + } + + return this._pixelCanvas; + }; + + _proto._extractTileConfig = function _extractTileConfig(imageConfig) { + var tileConfig = Array.isArray(imageConfig.tileConfig) ? imageConfig.tileConfig : Array.apply(void 0, Array(6)).map(function () { + return imageConfig.tileConfig; + }); + tileConfig = tileConfig.map(function (config) { + return _extends({ + flipHorizontal: false, + rotation: 0 + }, config); + }); + return tileConfig; + }; + + _proto._triggerError = function _triggerError(error) { + /* eslint-disable no-console */ + console.error("Renderer Error:", error); + /* eslint-enable no-console */ + + this.trigger(EVENTS.ERROR, { + message: typeof error === "string" ? error : error.message + }); + }; + + return Renderer; + }(Component); + + Renderer.EVENTS = EVENTS; + return Renderer; +}(); + +var CubeRenderer = +/*#__PURE__*/ +function () { + var CubeRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeRenderer, _Renderer); + + function CubeRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + CubeRenderer._VERTEX_POSITION_DATA = CubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // top + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // bottom + 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + return CubeRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + if (CubeRenderer._INDEX_DATA) { + return CubeRenderer._INDEX_DATA; + } + + var indexData = []; + var vertexPositionData = this.getVertexPositionData(); + + for (var i = 0; i < vertexPositionData.length / 3; i += 4) { + indexData.push(i, i + 2, i + 1, i, i + 3, i + 2); + } + + CubeRenderer._INDEX_DATA = indexData; + return indexData; + }; + + CubeRenderer.extractOrder = function extractOrder(imageConfig) { + return imageConfig.order || "RLUDBF"; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var vertexOrder = "BFUDRL"; + var order = CubeRenderer.extractOrder(imageConfig); + var base = this.getVertexPositionData(); + + var tileConfig = this._extractTileConfig(imageConfig); + + var elemSize = 3; + var vertexPerTile = 4; + var textureCoordData = vertexOrder.split("").map(function (face) { + return tileConfig[order.indexOf(face)]; + }).map(function (config, i) { + var rotation = parseInt(config.rotation / 90, 10); + var ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2]; + + for (var r = 0; r < Math.abs(rotation); r++) { + if (config.flipHorizontal && rotation > 0 || !config.flipHorizontal && rotation < 0) { + ordermap_.push(ordermap_.shift()); + } else { + ordermap_.unshift(ordermap_.pop()); + } + } + + var elemPerTile = elemSize * vertexPerTile; + var tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile); + var tileTemp = []; + + for (var j = 0; j < vertexPerTile; j++) { + tileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize); + } + + return tileTemp; + }).join().split(",").map(function (v) { + return parseInt(v, 10); + }); + return textureCoordData; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image, imageConfig) { + var baseOrder = "RLUDBF"; + var order = CubeRenderer.extractOrder(imageConfig); + var orderMap = {}; + order.split("").forEach(function (v, i) { + orderMap[v] = i; + }); + + try { + if (image instanceof Array) { + for (var surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) { + var tileIdx = orderMap[baseOrder[surfaceIdx]]; + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]); + } + } else { + var maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image); + + for (var _surfaceIdx = 0; _surfaceIdx < 6; _surfaceIdx++) { + var _tileIdx = orderMap[baseOrder[_surfaceIdx]]; + var tile = this.extractTileFromImage(image, _tileIdx, maxCubeMapTextureSize); + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + _surfaceIdx, tile); + } + } + } catch (e) { + this._triggerError(e); + } + }; + + _proto.bindTexture = function bindTexture(gl, texture, image, imageConfig) { + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + this.updateTexture(gl, image, imageConfig); + }; + + _proto.getSourceTileSize = function getSourceTileSize(image) { + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var aspectRatio = width / height; + var inputTextureSize; + + if (aspectRatio === 1 / 6) { + inputTextureSize = width; + } else if (aspectRatio === 6) { + inputTextureSize = height; + } else if (aspectRatio === 2 / 3) { + inputTextureSize = width / 2; + } else { + inputTextureSize = width / 3; + } + + return inputTextureSize; + }; + + _proto.extractTileFromImage = function extractTileFromImage(image, tileIdx, outputTextureSize) { + var _this$getDimension2 = this.getDimension(image), + width = _this$getDimension2.width; + + var inputTextureSize = this.getSourceTileSize(image); + var canvas = document.createElement("canvas"); + canvas.width = outputTextureSize; + canvas.height = outputTextureSize; + var context = canvas.getContext("2d"); + var tilePerRow = width / inputTextureSize; + var x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow); + var y = parseInt(tileIdx / tilePerRow, 10) * inputTextureSize; + context.drawImage(image, x, y, inputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize); + return canvas; + }; + + _proto.getMaxCubeMapTextureSize = function getMaxCubeMapTextureSize(gl, image) { + var agent = Agent(); + var maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); + + var _imageWidth = this.getSourceTileSize(image); + + if (agent.browser.name === "ie" && agent.browser.majorVersion === 11) { + if (!util.isPowerOfTwo(_imageWidth)) { + for (var i = 1; i < maxCubeMapTextureSize; i *= 2) { + if (i < _imageWidth) { + continue; + } else { + _imageWidth = i; + break; + } + } + } + } + + if (agent.os.name === "ios") { + var majorVersion = agent.os.majorVersion; // ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다. + + if (majorVersion === 9) { + _imageWidth = 1024; + } // ios 8 의 경우 텍스쳐 최대사이즈는 512 이다. + + + if (majorVersion === 8) { + _imageWidth = 512; + } + } // maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수 + + + return Math.min(maxCubeMapTextureSize, _imageWidth); + }; + + return CubeRenderer; + }(Renderer); + + CubeRenderer._VERTEX_POSITION_DATA = null; + CubeRenderer._INDEX_DATA = null; + return CubeRenderer; +}(); + +var CubeStripRenderer = +/*#__PURE__*/ +function (_Renderer) { + _inheritsLoose(CubeStripRenderer, _Renderer); + + function CubeStripRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeStripRenderer.prototype; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"; + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + if (!this._vertices) { + this._vertices = [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // up + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // down + -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + } + + return this._vertices; + }; + + _proto.getIndexData = function getIndexData() { + var _this = this; + + // TODO: 한번만 계산하도록 수정하기 + var indices = function () { + var indexData = []; + + for (var i = 0; i < _this._vertices.length / 3; i += 4) { + indexData.push(i, i + 1, i + 2, i, i + 2, i + 3); + } + + return indexData; + }(); + + return indices; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var _this2 = this; + + // TODO: make it cols, rows as config. + var cols = 3; + var rows = 2; + var order = imageConfig.order || "RLUDFB"; + var coords = []; // 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다. + + for (var r = rows - 1; r >= 0; r--) { + for (var c = 0; c < cols; c++) { + var coord = [c / cols, r / rows, (c + 1) / cols, r / rows, (c + 1) / cols, (r + 1) / rows, c / cols, (r + 1) / rows]; + coords.push(coord); + } + } + + var tileConfigs = this._extractTileConfig(imageConfig); // Transform Coord By Flip & Rotation + + + coords = coords // shrink coord to avoid pixel bleeding + .map(function (coord) { + return _this2._shrinkCoord(coord); + }).map(function (coord, i) { + return _this2._transformCoord(coord, tileConfigs[i]); + }); // vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치 + + return "BFUDRL".split("").map(function (face) { + return order.indexOf(face); + }).map(function (index) { + return coords[index]; + }).reduce(function (acc, val) { + return acc.concat(val); + }, []); + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto._transformCoord = function _transformCoord(coord, tileConfig) { + var newCoord = coord.slice(); + + if (tileConfig.flipHorizontal) { + newCoord = this._flipHorizontalCoord(newCoord); + } + + if (tileConfig.rotation) { + newCoord = this._rotateCoord(newCoord, tileConfig.rotation); + } + + return newCoord; + }; + + _proto._shrinkCoord = function _shrinkCoord(coord) { + var SHRINK_Y = 0.00; + var SHRINK_X = 0.00; + return [coord[0] + SHRINK_X, coord[1] + SHRINK_Y, coord[2] - SHRINK_X, coord[3] + SHRINK_Y, coord[4] - SHRINK_X, coord[5] - SHRINK_Y, coord[6] + SHRINK_X, coord[7] - SHRINK_Y]; + }; + + _proto._rotateCoord = function _rotateCoord(coord, rotationAngle) { + var SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord. + + var shiftCount = parseInt(rotationAngle / 90, 10) % 4; + + if (shiftCount === 0) { + return coord; + } + + var moved; + var rotatedCoord = []; + + if (shiftCount > 0) { + moved = coord.splice(0, shiftCount * SIZE); + rotatedCoord = coord.concat(moved); + } else { + moved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE); + rotatedCoord = moved.concat(coord); + } + + return rotatedCoord; + }; + + _proto._flipHorizontalCoord = function _flipHorizontalCoord(coord) { + return [coord[2], coord[3], coord[0], coord[1], coord[6], coord[7], coord[4], coord[5]]; + }; + + return CubeStripRenderer; +}(Renderer); + +/** + * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide}) + * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고) + * @namespace + * @name GYRO_MODE + * @memberof eg.view360.PanoViewer + */ +/** + * Constant value for errors + * @ko 에러에 대한 상수 값 + * @namespace + * @name ERROR_TYPE + * @memberof eg.view360.PanoViewer + */ + +var ERROR_TYPE = { + /** + * Unsupported device + * @ko 미지원 기기 + * @name INVALID_DEVICE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 10 + */ + INVALID_DEVICE: 10, + + /** + * Webgl not support + * @ko WEBGL 미지원 + * @name NO_WEBGL + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 11 + */ + NO_WEBGL: 11, + + /** + * Failed to load image + * @ko 이미지 로드 실패 + * @name FAIL_IMAGE_LOAD + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 12 + */ + FAIL_IMAGE_LOAD: 12, + + /** + * Failed to bind texture + * @ko 텍스쳐 바인딩 실패 + * @name FAIL_BIND_TEXTURE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 13 + */ + FAIL_BIND_TEXTURE: 13, + + /** + * Only one resource(image or video) should be specified + * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * @name INVALID_RESOURCE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 14 + */ + INVALID_RESOURCE: 14, + + /** + * WebGL context lost occurred + * @ko WebGL context lost 발생 + * @name RENDERING_CONTEXT_LOST + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 15 + */ + RENDERING_CONTEXT_LOST: 15 +}; +/** + * Constant value for events + * @ko 이벤트에 대한 상수 값 + * @namespace + * @name EVENTS + * @memberof eg.view360.PanoViewer + */ + +var EVENTS$1 = { + /** + * Events that is fired when PanoViewer is ready to show image and handle user interaction. + * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트 + * @name READY + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default ready + */ + READY: "ready", + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name VIEW_CHANGE + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default viewChange + */ + VIEW_CHANGE: "viewChange", + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name ANIMATION_END + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default animationEnd + */ + ANIMATION_END: "animationEnd", + + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name ERROR + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default error + */ + ERROR: "error" +}; +/** + * Constant value for projection type + * @ko 프로젝션 타입 대한 상수 값 + * @namespace + * @name PROJECTION_TYPE + * @memberof eg.view360.PanoViewer + */ + +var PROJECTION_TYPE = { + /** + * Constant value for equirectangular type. + * @ko equirectangular 에 대한 상수 값. + * @name EQUIRECTANGULAR + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default equirectangular + */ + EQUIRECTANGULAR: "equirectangular", + + /** + * Constant value for cubemap type. + * @ko cubemap 에 대한 상수 값. + * @name CUBEMAP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubemap + */ + CUBEMAP: "cubemap", + + /** + * Constant value for cubestrip type. + * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC. + * + * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다. + * @name CUBESTRIP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubestrip + */ + CUBESTRIP: "cubestrip", + + /** + * Constant value for PANORAMA type. + * + * PANORAMA is a format for a panorma image which is taken from smartphone. + * + * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다. + * + * @name PANORAMA + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default panorama + */ + PANORAMA: "panorama", + + /** + * Constant value for EQUI_STEREOSCOPY type. + * + * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present. + * + * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다. + * + * @name STEREOSCOPIC_EQUI + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default stereoequi + */ + STEREOSCOPIC_EQUI: "stereoequi" +}; +/** + * A constant value for the format of the stereoscopic equirectangular projection type. + * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값 + * @namespace + * @name STEREO_FORMAT + * @memberof eg.view360.PanoViewer + */ + +var STEREO_FORMAT = { + /** + * A constant value for format of top bottom stereoscopic 360 equirectangular projection. + * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name TOP_BOTTOM + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dv" + */ + TOP_BOTTOM: "3dv", + + /** + * A constant value for format of left right stereoscopic 360 equirectangular projection. + * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name LEFT_RIGHT + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dh" + */ + LEFT_RIGHT: "3dh", + + /** + * A constant value specifying media is not in stereoscopic format. + * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값. + * @name NONE + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "" + */ + NONE: "" +}; + +var latitudeBands = 60; +var longitudeBands = 60; +var radius = 2; +var ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI; +var textureCoordData = []; +var vertexPositionData = []; +var indexData = []; +var latIdx; +var lngIdx; + +for (latIdx = 0; latIdx <= latitudeBands; latIdx++) { + var theta = (latIdx / latitudeBands - 0.5) * Math.PI; + var sinTheta = Math.sin(theta); + var cosTheta = Math.cos(theta); + + for (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) { + var phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN; + var sinPhi = Math.sin(phi); + var cosPhi = Math.cos(phi); + var x = cosPhi * cosTheta; + var y = sinTheta; + var z = sinPhi * cosTheta; + var u = lngIdx / longitudeBands; + var v = latIdx / latitudeBands; + textureCoordData.push(u, v); + vertexPositionData.push(radius * x, radius * y, radius * z); + + if (lngIdx !== longitudeBands && latIdx !== latitudeBands) { + var a = latIdx * (longitudeBands + 1) + lngIdx; + var b = a + longitudeBands + 1; + indexData.push(a, b, a + 1, b, b + 1, a + 1); + } + } +} + +var SphereRenderer = +/*#__PURE__*/ +function () { + var SphereRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(SphereRenderer, _Renderer); + + function SphereRenderer(format) { + var _this; + + _this = _Renderer.call(this) || this; + _this._stereoFormat = format; + return _this; + } + + var _proto = SphereRenderer.prototype; + + _proto.render = function render(ctx) { + var gl = ctx.gl, + shaderProgram = ctx.shaderProgram; + var leftEyeScaleOffset; + var rightEyeScaleOffset; + + switch (this._stereoFormat) { + case STEREO_FORMAT.TOP_BOTTOM: + leftEyeScaleOffset = [1, 0.5, 0, 0]; + rightEyeScaleOffset = [1, 0.5, 0, 0.5]; + break; + + case STEREO_FORMAT.LEFT_RIGHT: + leftEyeScaleOffset = [0.5, 1, 0, 0]; + rightEyeScaleOffset = [0.5, 1, 0.5, 0]; + break; + + default: + leftEyeScaleOffset = [1, 1, 0, 0]; + rightEyeScaleOffset = [1, 1, 0, 0]; + } + + var uTexScaleOffset = gl.getUniformLocation(shaderProgram, "uTexScaleOffset"); + gl.uniform4fv(uTexScaleOffset, [].concat(leftEyeScaleOffset, rightEyeScaleOffset)); + + _Renderer.prototype.render.call(this, ctx); + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + return SphereRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return SphereRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return SphereRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + return SphereRenderer; + }(Renderer); + + SphereRenderer._VERTEX_POSITION_DATA = vertexPositionData; + SphereRenderer._TEXTURE_COORD_DATA = textureCoordData; + SphereRenderer._INDEX_DATA = indexData; + return SphereRenderer; +}(); + +var MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6; +var longitudeBands$1 = 60; +var textureCoordData$1 = []; +var vertexPositionData$1 = []; +var indexData$1 = []; + +var CylinderRenderer = +/*#__PURE__*/ +function () { + var CylinderRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CylinderRenderer, _Renderer); + + function CylinderRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CylinderRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + return CylinderRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return CylinderRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return CylinderRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + var resizeDimension; + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device texture limit(" + maxSize + "))"); // Request resizing texture. + + /** + * TODO: Is it need to apply on another projection type? + */ + + + resizeDimension = width > height ? { + width: maxSize, + height: maxSize * height / width + } : { + width: maxSize * width / height, + height: maxSize + }; + } // Pixel Source for IE11 & Video or resizing needed + + + this._initPixelSource(image, resizeDimension); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto.updateShaderData = function updateShaderData(_ref) { + var _ref$imageAspectRatio = _ref.imageAspectRatio, + imageAspectRatio = _ref$imageAspectRatio === void 0 ? MIN_ASPECT_RATIO_FOR_FULL_PANORAMA : _ref$imageAspectRatio; + var lngIdx; + var cylinderMaxRadian; + var halfCylinderY; + var rotated; + var aspectRatio; // Exception case: orientation is rotated. + + if (imageAspectRatio < 1) { + /** + * If rotated is true, we assume that image is rotated counter clockwise. + * TODO: If there's other rotation, it is need to implement by each rotation. + */ + rotated = true; + aspectRatio = 1 / imageAspectRatio; + } else { + rotated = false; + aspectRatio = imageAspectRatio; + } + + if (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) { + var fov = 360 / aspectRatio; + cylinderMaxRadian = 2 * Math.PI; // 360 deg + + halfCylinderY = Math.tan(glMatrix.toRadian(fov / 2)); + } else { + cylinderMaxRadian = aspectRatio; + halfCylinderY = 0.5; // Range of cylinder is [-0.5, 0.5] to make height to 1. + } // intialize shader data before update + + + textureCoordData$1.length = 0; + vertexPositionData$1.length = 0; + indexData$1.length = 0; + var CYLIDER_Y = [-halfCylinderY, halfCylinderY]; + var startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360) + // console.log("cylinderMaxRadian:", glMatrix.toDegree(cylinderMaxRadian), "CYLIDER_Y", CYLIDER_Y, "start angle", glMatrix.toDegree(startAngleForCenterAlign)); + + for (var yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength + /* bottom & top */ + ; yIdx++) { + for (lngIdx = 0; lngIdx <= longitudeBands$1; lngIdx++) { + var angle = startAngleForCenterAlign + lngIdx / longitudeBands$1 * cylinderMaxRadian; + var x = Math.cos(angle); + var y = CYLIDER_Y[yIdx]; + var z = Math.sin(angle); + var u = void 0; + var v = void 0; + + if (rotated) { + // Rotated 90 degree (counter clock wise) + u = 1 - yIdx; // yLength - yIdx; + + v = lngIdx / longitudeBands$1; + } else { + // // Normal case (Not rotated) + u = lngIdx / longitudeBands$1; + v = yIdx; + } + + textureCoordData$1.push(u, v); + vertexPositionData$1.push(x, y, z); + + if (yIdx === 0 && lngIdx < longitudeBands$1) { + var a = lngIdx; + var b = a + longitudeBands$1 + 1; + indexData$1.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + }; + + return CylinderRenderer; + }(Renderer); + + CylinderRenderer._VERTEX_POSITION_DATA = vertexPositionData$1; + CylinderRenderer._TEXTURE_COORD_DATA = textureCoordData$1; + CylinderRenderer._INDEX_DATA = indexData$1; + return CylinderRenderer; +}(); + +var _Promise$2 = typeof Promise === 'undefined' ? _ESPromise.Promise : Promise; +var VR_DISPLAY_PRESENT_CHANGE = "vrdisplaypresentchange"; +var DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1]; +var DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1]; +var EYES = { + LEFT: "left", + RIGHT: "right" +}; + +var VRManager = +/*#__PURE__*/ +function () { + var VRManager = + /*#__PURE__*/ + function () { + _createClass(VRManager, [{ + key: "context", + get: function get() { + return this._vrDisplay; + } + }]); + + function VRManager() { + var _this = this; + + this.destroy = function () { + var vrDisplay = _this._vrDisplay; + + _this.removeEndCallback(_this.destroy); + + if (vrDisplay && vrDisplay.isPresenting) { + vrDisplay.exitPresent(); + } + + _this._clear(); + }; + + this._frameData = new window.VRFrameData(); + + this._clear(); + } + + var _proto = VRManager.prototype; + + _proto.canRender = function canRender() { + return Boolean(this._vrDisplay); + }; + + _proto.beforeRender = function beforeRender(gl) { + // Render to the default backbuffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + }; + + _proto.afterRender = function afterRender() { + this._vrDisplay.submitFrame(); + }; + + _proto.getEyeParams = function getEyeParams(gl) { + var display = this._vrDisplay; + var halfWidth = gl.drawingBufferWidth * 0.5; + var height = gl.drawingBufferHeight; + var frameData = this._frameData; + display.getFrameData(frameData); + var leftMVMatrix = frameData.leftViewMatrix; + var rightMVMatrix = frameData.rightViewMatrix; + mat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset); + mat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset); + return [{ + viewport: [0, 0, halfWidth, height], + mvMatrix: leftMVMatrix, + pMatrix: frameData.leftProjectionMatrix + }, { + viewport: [halfWidth, 0, halfWidth, height], + mvMatrix: rightMVMatrix, + pMatrix: frameData.rightProjectionMatrix + }]; + }; + + _proto.isPresenting = function isPresenting() { + return Boolean(this._vrDisplay && this._vrDisplay.isPresenting); + }; + + _proto.addEndCallback = function addEndCallback(callback) { + window.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + window.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.requestPresent = function requestPresent(canvas) { + var _this2 = this; + + return new _Promise$2(function (resolve, reject) { + navigator.getVRDisplays().then(function (displays) { + var vrDisplay = displays.length && displays[0]; + + if (!vrDisplay) { + reject(new Error("No displays available.")); + return; + } + + if (!vrDisplay.capabilities.canPresent) { + reject(new Error("Display lacking capability to present.")); + return; + } + + vrDisplay.requestPresent([{ + source: canvas + }]).then(function () { + var leftEye = vrDisplay.getEyeParameters(EYES.LEFT); + var rightEye = vrDisplay.getEyeParameters(EYES.RIGHT); + canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2; + canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight); + + _this2._setDisplay(vrDisplay); + + resolve(); + }); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setDisplay = function _setDisplay(vrDisplay) { + this._vrDisplay = vrDisplay; + var layers = vrDisplay.getLayers(); + + if (layers.length) { + var layer = layers[0]; + this._leftBounds = layer.leftBounds; + this._rightBounds = layer.rightBounds; + } + + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._vrDisplay = null; + this._leftBounds = DEFAULT_LEFT_BOUNDS; + this._rightBounds = DEFAULT_RIGHT_BOUNDS; + this._yawOffset = 0; + }; + + return VRManager; + }(); + + return VRManager; +}(); + +var XR_REFERENCE_SPACE = "local"; + +var XRManager = +/*#__PURE__*/ +function () { + var XRManager = + /*#__PURE__*/ + function () { + _createClass(XRManager, [{ + key: "context", + get: function get() { + return this._xrSession; + } + }]); + + function XRManager() { + var _this = this; + + this.destroy = function () { + var xrSession = _this._xrSession; + + _this.removeEndCallback(_this.destroy); + + if (xrSession) { + // Capture to avoid errors + xrSession.end().then(function () {}, function () {}); + } + + _this._clear(); + }; + + this._clear(); + } + + var _proto = XRManager.prototype; + + _proto.canRender = function canRender(frame) { + var pose = frame.getViewerPose(this._xrRefSpace); + return Boolean(pose); + }; + + _proto.beforeRender = function beforeRender(gl, frame) { + var session = frame.session; + var baseLayer = session.renderState.baseLayer; + gl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer); + }; + + _proto.afterRender = function afterRender() {}; + + _proto.getEyeParams = function getEyeParams(gl, frame) { + var _this2 = this; + + var session = frame.session; + var pose = frame.getViewerPose(this._xrRefSpace); + + if (!pose) { + // Can't render + return null; + } + + var glLayer = session.renderState.baseLayer; + return pose.views.map(function (view) { + var viewport = glLayer.getViewport(view); + var mvMatrix = view.transform.inverse.matrix; + + if (IS_SAFARI_ON_DESKTOP) { + mat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180)); + } + + mat4.rotateY(mvMatrix, mvMatrix, _this2._yawOffset); + return { + viewport: [viewport.x, viewport.y, viewport.width, viewport.height], + mvMatrix: mvMatrix, + pMatrix: view.projectionMatrix + }; + }); + }; + + _proto.isPresenting = function isPresenting() { + return this._presenting; + }; + + _proto.addEndCallback = function addEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.addEventListener("end", callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.removeEventListener("end", callback); + }; + + _proto.requestPresent = function requestPresent(canvas, gl) { + var _this3 = this; + + return navigator.xr.requestSession("immersive-vr", { + requiredFeatures: [XR_REFERENCE_SPACE] + }).then(function (session) { + var xrLayer = new window.XRWebGLLayer(session, gl); + session.updateRenderState({ + baseLayer: xrLayer + }); + return session.requestReferenceSpace(XR_REFERENCE_SPACE).then(function (refSpace) { + _this3._setSession(session, xrLayer, refSpace); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setSession = function _setSession(session, xrLayer, refSpace) { + this._xrSession = session; + this._xrLayer = xrLayer; + this._xrRefSpace = refSpace; + this._presenting = true; + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._xrSession = null; + this._xrLayer = null; + this._xrRefSpace = null; + this._presenting = false; + this._yawOffset = 0; + }; + + return XRManager; + }(); + + return XRManager; +}(); + +var WebGLAnimator = +/*#__PURE__*/ +function () { + var WebGLAnimator = + /*#__PURE__*/ + function () { + function WebGLAnimator() { + var _this = this; + + this._onLoop = function () { + _this._callback.apply(_this, arguments); + + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + }; + + this._onLoopNextTick = function () { + var before = performance.now(); + + _this._callback.apply(_this, arguments); + + var diff = performance.now() - before; + + if (_this._rafTimer >= 0) { + clearTimeout(_this._rafTimer); + _this._rafTimer = -1; + } + /** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */ + + + if (diff < 16) { + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + } else { + /** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/ + _this._rafTimer = setTimeout(_this._onLoop, 0); + } + }; + + this._callback = null; + this._context = window; + this._rafId = -1; + this._rafTimer = -1; + } + + var _proto = WebGLAnimator.prototype; + + _proto.setCallback = function setCallback(callback) { + this._callback = callback; + }; + + _proto.setContext = function setContext(context) { + this._context = context; + }; + + _proto.start = function start() { + var context = this._context; + var callback = this._callback; // No context / callback set + + if (!context || !callback) return; // Animation already started + + if (this._rafId >= 0 || this._rafTimer >= 0) return; + + if (IS_SAFARI_ON_DESKTOP) { + this._rafId = context.requestAnimationFrame(this._onLoopNextTick); + } else { + this._rafId = context.requestAnimationFrame(this._onLoop); + } + }; + + _proto.stop = function stop() { + if (this._rafId >= 0) { + this._context.cancelAnimationFrame(this._rafId); + } + + if (this._rafTimer >= 0) { + clearTimeout(this._rafTimer); + } + + this._rafId = -1; + this._rafTimer = -1; + } + /** + * There can be more than 1 argument when we use XRSession's raf + */ + ; + + return WebGLAnimator; + }(); + + return WebGLAnimator; +}(); + +var _Promise$3 = typeof Promise === 'undefined' ? _ESPromise.Promise : Promise; +var ImageType = PROJECTION_TYPE; +var DEVICE_PIXEL_RATIO = devicePixelRatio || 1; // DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다. + +if (DEVICE_PIXEL_RATIO > 2) { + DEVICE_PIXEL_RATIO = 2; +} // define custom events name + +/** + * TODO: how to manage events/errortype with PanoViewer + * + * I think renderer events should be seperated from viewer events although it has same name. + */ + + +var EVENTS$2 = { + BIND_TEXTURE: "bindTexture", + IMAGE_LOADED: "imageLoaded", + ERROR: "error", + RENDERING_CONTEXT_LOST: "renderingContextLost", + RENDERING_CONTEXT_RESTORE: "renderingContextRestore" +}; +var ERROR_TYPE$1 = { + INVALID_DEVICE: 10, + NO_WEBGL: 11, + FAIL_IMAGE_LOAD: 12, + RENDERER_ERROR: 13 +}; + +var PanoImageRenderer = +/*#__PURE__*/ +function () { + var PanoImageRenderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoImageRenderer, _Component); + + function PanoImageRenderer(image, width, height, isVideo, sphericalConfig, renderingContextAttributes) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + + _this._renderStereo = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var eyeParams = vr.getEyeParams(gl, frame); + if (!eyeParams) return; + vr.beforeRender(gl, frame); // Render both eyes + + for (var _i = 0, _arr = [0, 1]; _i < _arr.length; _i++) { + var eyeIndex = _arr[_i]; + var eyeParam = eyeParams[eyeIndex]; + _this.mvMatrix = eyeParam.mvMatrix; + _this.pMatrix = eyeParam.pMatrix; + gl.viewport.apply(gl, eyeParam.viewport); + gl.uniform1f(_this.shaderProgram.uEye, eyeIndex); + + _this._bindBuffers(); + + _this._draw(); + } + + vr.afterRender(); + }; + + _this.exitVR = function () { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; + if (!vr) return; + vr.removeEndCallback(_this.exitVR); + vr.destroy(); + _this._vr = null; // Restore canvas & context on iOS + + if (IS_IOS) { + _this._restoreStyle(); + } + + _this.updateViewportDimensions(_this.width, _this.height); + + _this._updateViewport(); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + _this._bindBuffers(); + + _this._shouldForceDraw = true; + animator.stop(); + animator.setContext(window); + animator.setCallback(_this._render.bind(_assertThisInitialized(_this))); + animator.start(); + }; + + _this._onFirstVRFrame = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; // If rendering is not ready, wait for next frame + + if (!vr.canRender(frame)) return; + var minusZDir = vec3.fromValues(0, 0, -1); + var eyeParam = vr.getEyeParams(gl, frame)[0]; // Extract only rotation + + var mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix); + var pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix); + var mvInv = mat3.invert(mat3.create(), mvMatrix); + var pInv = mat3.invert(mat3.create(), pMatrix); + var viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv); + vec3.transformMat3(viewDir, viewDir, mvInv); + var yawOffset = util.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1)); + + if (yawOffset === 0) { + // If the yawOffset is exactly 0, then device sensor is not ready + // So read it again until it has any value in it + return; + } + + vr.setYawOffset(yawOffset); + animator.setCallback(_this._renderStereo); + }; + + _this.sphericalConfig = sphericalConfig; + _this.fieldOfView = sphericalConfig.fieldOfView; + _this.width = width; + _this.height = height; + _this._lastQuaternion = null; + _this._lastYaw = null; + _this._lastPitch = null; + _this._lastFieldOfView = null; + _this.pMatrix = mat4.create(); + _this.mvMatrix = mat4.create(); // initialzie pMatrix + + mat4.perspective(_this.pMatrix, glMatrix.toRadian(_this.fieldOfView), width / height, 0.1, 100); + _this.textureCoordBuffer = null; + _this.vertexBuffer = null; + _this.indexBuffer = null; + _this.canvas = _this._initCanvas(width, height); + + _this._setDefaultCanvasStyle(); + + _this._wrapper = null; // canvas wrapper + + _this._wrapperOrigStyle = null; + _this._renderingContextAttributes = renderingContextAttributes; + _this._image = null; + _this._imageConfig = null; + _this._imageIsReady = false; + _this._shouldForceDraw = false; + _this._keepUpdate = false; // Flag to specify 'continuous update' on video even when still. + + _this._onContentLoad = _this._onContentLoad.bind(_assertThisInitialized(_this)); + _this._onContentError = _this._onContentError.bind(_assertThisInitialized(_this)); + _this._animator = new WebGLAnimator(); // VR/XR manager + + _this._vr = null; + + if (image) { + _this.setImage({ + image: image, + imageType: sphericalConfig.imageType, + isVideo: isVideo, + cubemapConfig: sphericalConfig.cubemapConfig + }); + } + + return _this; + } // FIXME: Please refactor me to have more loose connection to yawpitchcontrol + + + var _proto = PanoImageRenderer.prototype; + + _proto.setYawPitchControl = function setYawPitchControl(yawPitchControl) { + this._yawPitchControl = yawPitchControl; + }; + + _proto.getContent = function getContent() { + return this._image; + }; + + _proto.setImage = function setImage(_ref) { + var image = _ref.image, + imageType = _ref.imageType, + _ref$isVideo = _ref.isVideo, + isVideo = _ref$isVideo === void 0 ? false : _ref$isVideo, + cubemapConfig = _ref.cubemapConfig; + this._imageIsReady = false; + this._isVideo = isVideo; + this._imageConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only */ + order: imageType === ImageType.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, cubemapConfig); + + this._setImageType(imageType); + + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + if (isVideo) { + this._contentLoader = new VideoLoader(); + this._keepUpdate = true; + } else { + this._contentLoader = new ImageLoader(); + this._keepUpdate = false; + } // img element or img url + + + this._contentLoader.set(image); // 이미지의 사이즈를 캐시한다. + // image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed. + + + this._image = this._contentLoader.getElement(); + return this._contentLoader.get().then(this._onContentLoad, this._onContentError)["catch"](function (e) { + return setTimeout(function () { + throw e; + }); + }); // Prevent exceptions from being isolated in promise chain. + }; + + _proto._setImageType = function _setImageType(imageType) { + var _this2 = this; + + if (!imageType || this._imageType === imageType) { + return; + } + + this._imageType = imageType; + this._isCubeMap = imageType === ImageType.CUBEMAP; + + if (this._renderer) { + this._renderer.off(); + } + + switch (imageType) { + case ImageType.CUBEMAP: + this._renderer = new CubeRenderer(); + break; + + case ImageType.CUBESTRIP: + this._renderer = new CubeStripRenderer(); + break; + + case ImageType.PANORAMA: + this._renderer = new CylinderRenderer(); + break; + + case ImageType.STEREOSCOPIC_EQUI: + this._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat); + break; + + default: + this._renderer = new SphereRenderer(STEREO_FORMAT.NONE); + break; + } + + this._renderer.on(Renderer.EVENTS.ERROR, function (e) { + _this2.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.RENDERER_ERROR, + message: e.message + }); + }); + + this._initWebGL(); + }; + + _proto._initCanvas = function _initCanvas(width, height) { + var canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + this._onWebglcontextlost = this._onWebglcontextlost.bind(this); + this._onWebglcontextrestored = this._onWebglcontextrestored.bind(this); + canvas.addEventListener("webglcontextlost", this._onWebglcontextlost); + canvas.addEventListener("webglcontextrestored", this._onWebglcontextrestored); + return canvas; + }; + + _proto._setDefaultCanvasStyle = function _setDefaultCanvasStyle() { + var canvas = this.canvas; + canvas.style.bottom = 0; + canvas.style.left = 0; + canvas.style.right = 0; + canvas.style.top = 0; + canvas.style.margin = "auto"; + canvas.style.maxHeight = "100%"; + canvas.style.maxWidth = "100%"; + canvas.style.outline = "none"; + canvas.style.position = "absolute"; + }; + + _proto._onContentError = function _onContentError(error) { + this._imageIsReady = false; + this._image = null; + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.FAIL_IMAGE_LOAD, + message: "failed to load image" + }); + return false; + }; + + _proto._triggerContentLoad = function _triggerContentLoad() { + this.trigger(EVENTS$2.IMAGE_LOADED, { + content: this._image, + isVideo: this._isVideo, + projectionType: this._imageType + }); + }; + + _proto._onContentLoad = function _onContentLoad(image) { + this._imageIsReady = true; + + this._triggerContentLoad(); + + return true; + }; + + _proto.isImageLoaded = function isImageLoaded() { + return !!this._image && this._imageIsReady && (!this._isVideo || this._image.readyState >= 2 + /* HAVE_CURRENT_DATA */ + ); + }; + + _proto.bindTexture = function bindTexture() { + var _this3 = this; + + return new _Promise$3(function (res, rej) { + if (!_this3._contentLoader) { + rej("ImageLoader is not initialized"); + return; + } + + _this3._contentLoader.get().then(function () { + _this3._bindTexture(); + }, rej).then(res); + }); + } // 부모 엘리먼트에 canvas 를 붙임 + ; + + _proto.attachTo = function attachTo(parentElement) { + this.detach(); + parentElement.appendChild(this.canvas); + this._wrapper = parentElement; + }; + + _proto.forceContextLoss = function forceContextLoss() { + if (this.hasRenderingContext()) { + var loseContextExtension = this.context.getExtension("WEBGL_lose_context"); + + if (loseContextExtension) { + loseContextExtension.loseContext(); + } + } + } // 부모 엘리먼트에서 canvas 를 제거 + ; + + _proto.detach = function detach() { + if (this.canvas.parentElement) { + this.canvas.parentElement.removeChild(this.canvas); + } + }; + + _proto.destroy = function destroy() { + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + this._animator.stop(); + + this.detach(); + this.forceContextLoss(); + this.off(); + this.canvas.removeEventListener("webglcontextlost", this._onWebglcontextlost); + this.canvas.removeEventListener("webglcontextrestored", this._onWebglcontextrestored); + }; + + _proto.hasRenderingContext = function hasRenderingContext() { + if (!(this.context && !this.context.isContextLost())) { + return false; + } else if (this.context && !this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) { + return false; + } + + return true; + }; + + _proto._initShaderProgram = function _initShaderProgram() { + var gl = this.context; + + if (this.shaderProgram) { + gl.deleteProgram(this.shaderProgram); + this.shaderProgram = null; + } + + var renderer = this._renderer; + var vsSource = renderer.getVertexShaderSource(); + var fsSource = renderer.getFragmentShaderSource(); + var vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource); + var fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource); + var shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader); + + if (!shaderProgram) { + throw new Error("Failed to intialize shaders: " + WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())); + } + + gl.useProgram(shaderProgram); + shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); + gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute); + shaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix"); + shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); + shaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); + shaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); + shaderProgram.uEye = gl.getUniformLocation(shaderProgram, "uEye"); + gl.enableVertexAttribArray(shaderProgram.textureCoordAttribute); // clear buffer + + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); // Use TEXTURE0 + + gl.uniform1i(shaderProgram.samplerUniform, 0); + this.shaderProgram = shaderProgram; + }; + + _proto._onWebglcontextlost = function _onWebglcontextlost(e) { + e.preventDefault(); + this.trigger(EVENTS$2.RENDERING_CONTEXT_LOST); + }; + + _proto._onWebglcontextrestored = function _onWebglcontextrestored(e) { + this._initWebGL(); + + this.trigger(EVENTS$2.RENDERING_CONTEXT_RESTORE); + }; + + _proto.updateFieldOfView = function updateFieldOfView(fieldOfView) { + this.fieldOfView = fieldOfView; + + this._updateViewport(); + }; + + _proto.updateViewportDimensions = function updateViewportDimensions(width, height) { + var viewPortChanged = false; + this.width = width; + this.height = height; + var w = width * DEVICE_PIXEL_RATIO; + var h = height * DEVICE_PIXEL_RATIO; + + if (w !== this.canvas.width) { + this.canvas.width = w; + viewPortChanged = true; + } + + if (h !== this.canvas.height) { + this.canvas.height = h; + viewPortChanged = true; + } + + if (!viewPortChanged) { + return; + } + + this._updateViewport(); + + this._shouldForceDraw = true; + }; + + _proto._updateViewport = function _updateViewport() { + mat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), this.canvas.width / this.canvas.height, 0.1, 100); + this.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight); + }; + + _proto._initWebGL = function _initWebGL() { + var gl; // TODO: Following code does need to be executed only if width/height, cubicStrip property is changed. + + try { + this._initRenderingContext(); + + gl = this.context; + this.updateViewportDimensions(this.width, this.height); + + this._initShaderProgram(); + } catch (e) { + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.NO_WEBGL, + message: "no webgl support" + }); + this.destroy(); + console.error(e); // eslint-disable-line no-console + + return; + } // 캔버스를 투명으로 채운다. + + + gl.clearColor(0, 0, 0, 0); + var textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D; + + if (this.texture) { + gl.deleteTexture(this.texture); + } + + this.texture = WebGLUtils.createTexture(gl, textureTarget); + + if (this._imageType === ImageType.CUBESTRIP) { + // TODO: Apply following options on other projection type. + gl.enable(gl.CULL_FACE); // gl.enable(gl.DEPTH_TEST); + } + }; + + _proto._initRenderingContext = function _initRenderingContext() { + if (this.hasRenderingContext()) { + return; + } + + if (!window.WebGLRenderingContext) { + throw new Error("WebGLRenderingContext not available."); + } + + this.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes); + + if (!this.context) { + throw new Error("Failed to acquire 3D rendering context"); + } + }; + + _proto._initBuffers = function _initBuffers() { + var vertexPositionData = this._renderer.getVertexPositionData(); + + var indexData = this._renderer.getIndexData(); + + var textureCoordData = this._renderer.getTextureCoordData(this._imageConfig); + + var gl = this.context; + this.vertexBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3, this.shaderProgram.vertexPositionAttribute); + this.indexBuffer = WebGLUtils.initBuffer(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1); + this.textureCoordBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2, this.shaderProgram.textureCoordAttribute); + + this._bindBuffers(); + }; + + _proto._bindTexture = function _bindTexture() { + // Detect if it is EAC Format while CUBESTRIP mode. + // We assume it is EAC if image is not 3/2 ratio. + if (this._imageType === ImageType.CUBESTRIP) { + var _this$_renderer$getDi = this._renderer.getDimension(this._image), + width = _this$_renderer$getDi.width, + height = _this$_renderer$getDi.height; + + var isEAC = width && height && width / height !== 1.5; + this.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, "uIsEAC"), isEAC); + } else if (this._imageType === ImageType.PANORAMA) { + var _this$_renderer$getDi2 = this._renderer.getDimension(this._image), + _width = _this$_renderer$getDi2.width, + _height = _this$_renderer$getDi2.height; + + var imageAspectRatio = _width && _height && _width / _height; + + this._renderer.updateShaderData({ + imageAspectRatio: imageAspectRatio + }); + } // intialize shader buffers after image is loaded.(by updateShaderData) + // because buffer may be differ by image size.(eg. CylinderRenderer) + + + this._initBuffers(); + + this._renderer.bindTexture(this.context, this.texture, this._image, this._imageConfig); + + this._shouldForceDraw = true; + this.trigger(EVENTS$2.BIND_TEXTURE); + }; + + _proto._updateTexture = function _updateTexture() { + this._renderer.updateTexture(this.context, this._image, this._imageConfig); + }; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + if (doUpdate && this.isImageLoaded() === false) { + // Force to draw a frame after image is loaded on render() + this._shouldForceDraw = true; + } + + this._keepUpdate = doUpdate; + }; + + _proto.startRender = function startRender() { + this._animator.setCallback(this._render.bind(this)); + + this._animator.start(); + }; + + _proto.stopRender = function stopRender() { + this._animator.stop(); + }; + + _proto.renderWithQuaternion = function renderWithQuaternion(quaternion, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // updatefieldOfView only if fieldOfView is changed. + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + this.mvMatrix = mat4.fromQuat(mat4.create(), quaternion); + + this._draw(); + + this._lastQuaternion = quat.clone(quaternion); + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto.renderWithYawPitch = function renderWithYawPitch(yaw, pitch, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastYaw !== null && this._lastYaw === yaw && this._lastPitch !== null && this._lastPitch === pitch && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출 + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + mat4.identity(this.mvMatrix); + mat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch)); + mat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw)); + + this._draw(); + + this._lastYaw = yaw; + this._lastPitch = pitch; + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto._render = function _render() { + var yawPitchControl = this._yawPitchControl; + var fov = yawPitchControl.getFov(); + + if (yawPitchControl.shouldRenderWithQuaternion()) { + var quaternion = yawPitchControl.getQuaternion(); + this.renderWithQuaternion(quaternion, fov); + } else { + var yawPitch = yawPitchControl.getYawPitch(); + this.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov); + } + }; + + _proto._bindBuffers = function _bindBuffers() { + var gl = this.context; + var program = this.shaderProgram; + var vertexBuffer = this.vertexBuffer; + var textureCoordBuffer = this.textureCoordBuffer; + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + gl.enableVertexAttribArray(program.vertexPositionAttribute); + gl.vertexAttribPointer(program.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer); + gl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer); + gl.enableVertexAttribArray(program.textureCoordAttribute); + gl.vertexAttribPointer(program.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0); + }; + + _proto._draw = function _draw() { + if (this._isVideo && this._keepUpdate) { + this._updateTexture(); + } + + this._renderer.render({ + gl: this.context, + shaderProgram: this.shaderProgram, + indexBuffer: this.indexBuffer, + mvMatrix: this.mvMatrix, + pMatrix: this.pMatrix + }); + } + /** + * Returns projection renderer by each type + */ + ; + + _proto.getProjectionRenderer = function getProjectionRenderer() { + return this._renderer; + } + /** + * @return Promise + */ + ; + + _proto.enterVR = function enterVR() { + var vr = this._vr; + + if (!WEBXR_SUPPORTED && !navigator.getVRDisplays) { + return _Promise$3.reject("VR is not available on this browser."); + } + + if (vr && vr.isPresenting()) { + return _Promise$3.resolve("VR already enabled."); + } + + return this._requestPresent(); + }; + + _proto._requestPresent = function _requestPresent() { + var _this4 = this; + + var gl = this.context; + var canvas = this.canvas; + var animator = this._animator; + this._vr = WEBXR_SUPPORTED ? new XRManager() : new VRManager(); + var vr = this._vr; + animator.stop(); + return new _Promise$3(function (resolve, reject) { + vr.requestPresent(canvas, gl).then(function () { + vr.addEndCallback(_this4.exitVR); + animator.setContext(vr.context); + animator.setCallback(_this4._onFirstVRFrame); + + if (IS_IOS) { + _this4._setWrapperFullscreen(); + } + + _this4._shouldForceDraw = true; + animator.start(); + resolve("success"); + })["catch"](function (e) { + vr.destroy(); + _this4._vr = null; + animator.start(); + reject(e); + }); + }); + }; + + _proto._setWrapperFullscreen = function _setWrapperFullscreen() { + var wrapper = this._wrapper; + if (!wrapper) return; + this._wrapperOrigStyle = wrapper.getAttribute("style"); + var wrapperStyle = wrapper.style; + wrapperStyle.width = "100vw"; + wrapperStyle.height = "100vh"; + wrapperStyle.position = "fixed"; + wrapperStyle.left = "0"; + wrapperStyle.top = "0"; + wrapperStyle.zIndex = "9999"; + }; + + _proto._restoreStyle = function _restoreStyle() { + var wrapper = this._wrapper; + var canvas = this.canvas; + if (!wrapper) return; + + if (this._wrapperOrigStyle) { + wrapper.setAttribute("style", this._wrapperOrigStyle); + } else { + wrapper.removeAttribute("style"); + } + + this._wrapperOrigStyle = null; // Restore canvas style + + canvas.removeAttribute("style"); + + this._setDefaultCanvasStyle(); + }; + + return PanoImageRenderer; + }(Component); + + PanoImageRenderer.EVENTS = EVENTS$2; + PanoImageRenderer.ERROR_TYPE = ERROR_TYPE$1; + return PanoImageRenderer; +}(); + +var _Promise$4 = typeof Promise === 'undefined' ? _ESPromise.Promise : Promise; + +var PanoViewer = +/*#__PURE__*/ +function () { + var PanoViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.PanoViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.PanoViewer + */ + // It should be deprecated! + + /** + * Constant value for touch directions + * @ko 터치 방향에 대한 상수 값. + * @namespace + * @name TOUCH_DIRECTION + * @memberof eg.view360.PanoViewer + */ + + /** + * @classdesc 360 media viewer + * @ko 360 미디어 뷰어 + * @class + * @name eg.view360.PanoViewer + * @extends eg.Component + * + * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트 + * @param {Object} config + * + * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
+ * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다. + * @param {Object} [config.cubemapConfig.order = "RLUDBF"(ProjectionType === CUBEMAP) | "RLUDFB" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서 + * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다. + * @param {String} [config.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
+ * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위) + * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위) + * + * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위) + * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위) + * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위) + * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다 + * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다. + * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키 + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE}
+ * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위 + * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위 + * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위 + * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
+ * + * @example + * // PanoViewer Creation + * // create PanoViewer with option + * var PanoViewer = eg.view360.PanoViewer; + * // Area where the image will be displayed(HTMLElement) + * var container = document.getElementById("myPanoViewer"); + * + * var panoViewer = new PanoViewer(container, { + * // If projectionType is not specified, the default is "equirectangular". + * // Specifies an image of the "equirectangular" type. + * image: "/path/to/image/image.jpg" + *}); + * + * @example + * // Cubemap Config Setting Example + * // For support Youtube EAC projection, You should set cubemapConfig as follows. + * cubemapConfig: { + * order: "LFRDBU", + * tileConfig: [ + * tileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}] + * ] + * } + */ + function PanoViewer(container, options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Component.call(this) || this; // Raises the error event if webgl is not supported. + + if (!WebGLUtils.isWebGLAvailable()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.NO_WEBGL, + message: "no webgl support" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!WebGLUtils.isStableWebGL()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_DEVICE, + message: "blacklisted browser" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!!options.image && !!options.video) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_RESOURCE, + message: "Specifying multi resouces(both image and video) is not valid." + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } // Check XR support at not when imported, but when created. + // This is intended to make polyfills easier to use. + + + checkXRSupport(); + _this._container = container; + _this._image = options.image || options.video; + _this._isVideo = !!options.video; + _this._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + _this._cubemapConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/ + order: _this._projectionType === PROJECTION_TYPE.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, options.cubemapConfig); + _this._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; // If the width and height are not provided, will use the size of the container. + + _this._width = options.width || parseInt(window.getComputedStyle(container).width, 10); + _this._height = options.height || parseInt(window.getComputedStyle(container).height, 10); + /** + * Cache the direction for the performance in renderLoop + * + * This value should be updated by "change" event of YawPitchControl. + */ + + _this._yaw = options.yaw || 0; + _this._pitch = options.pitch || 0; + _this._fov = options.fov || 65; + _this._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH; + _this._quaternion = null; + _this._aspectRatio = _this._height !== 0 ? _this._width / _this._height : 1; + var fovRange = options.fovRange || [30, 110]; + var touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ? options.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL; + + var yawPitchConfig = _extends(options, { + element: container, + yaw: _this._yaw, + pitch: _this._pitch, + fov: _this._fov, + gyroMode: _this._gyroMode, + fovRange: fovRange, + aspectRatio: _this._aspectRatio, + touchDirection: touchDirection + }); + + _this._isReady = false; + + _this._initYawPitchControl(yawPitchConfig); + + _this._initRenderer(_this._yaw, _this._pitch, _this._fov, _this._projectionType, _this._cubemapConfig); + + return _this; + } + /** + * Get the video element that the viewer is currently playing. You can use this for playback. + * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다. + * @method eg.view360.PanoViewer#getVideo + * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement + * @example + * var videoTag = panoViewer.getVideo(); + * videoTag.play(); // play video! + */ + + + var _proto = PanoViewer.prototype; + + _proto.getVideo = function getVideo() { + if (!this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the video information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setVideo + * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정) + * @param {Object} param + * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}("equirectangular")] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setVideo("/path/to/video/video.mp4", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR + * }); + */ + ; + + _proto.setVideo = function setVideo(video, param) { + if (param === void 0) { + param = {}; + } + + if (video) { + this.setImage(video, { + projectionType: param.projectionType, + isVideo: true, + cubemapConfig: param.cubemapConfig, + stereoFormat: param.stereoFormat + }); + } + + return this; + } + /** + * Get the image information that the viewer is currently using. + * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다. + * @method eg.view360.PanoViewer#getImage + * @return {Image} Image Object이미지 객체 + * @example + * var imageObj = panoViewer.getImage(); + */ + ; + + _proto.getImage = function getImage() { + if (this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the image information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setImage + * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.) + * @param {Object} param Additional information이미지 추가 정보 + * @param {String} [param.projectionType="equirectangular"] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setImage("/path/to/image/image.png", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP + * }); + */ + ; + + _proto.setImage = function setImage(image, param) { + if (param === void 0) { + param = {}; + } + + var cubemapConfig = _extends({ + order: "RLUDBF", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, param.cubemapConfig); + + var stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; + var isVideo = !!param.isVideo; + + if (this._image && this._isVideo !== isVideo) { + /* eslint-disable no-console */ + console.warn("Currently not supporting to change content type(Image <--> Video)"); + /* eslint-enable no-console */ + + return this; + } + + if (image) { + this._image = image; + this._isVideo = isVideo; + this._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + this._cubemapConfig = cubemapConfig; + this._stereoFormat = stereoFormat; + + this._deactivate(); + + this._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig); + } + + return this; + } + /** + * Set whether the renderer always updates the texture and renders. + * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다. + * + * @method eg.view360.PanoViewer#keepUpdate + * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다. + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + this._photoSphereRenderer.keepUpdate(doUpdate); + + return this; + } + /** + * Get projection type (equirectangular/cube) + * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다. + * + * @method eg.view360.PanoViewer#getProjectionType + * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE} + */ + ; + + _proto.getProjectionType = function getProjectionType() { + return this._projectionType; + } + /** + * Activate the device's motion sensor, and return the Promise whether the sensor is enabled + * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element. + * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다. + * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * @method eg.view360.PanoViewer#enableSensor + * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다. + */ + ; + + _proto.enableSensor = function enableSensor() { + return new _Promise$4(function (resolve, reject) { + if (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === "function") { + DeviceMotionEvent.requestPermission().then(function (permissionState) { + if (permissionState === "granted") { + resolve(); + } else { + reject(new Error("permission denied")); + } + })["catch"](function (e) { + // This can happen when this method wasn't triggered by user interaction + reject(e); + }); + } else { + resolve(); + } + }); + } + /** + * Disable the device's motion sensor. + * @ko 디바이스의 모션 센서를 비활성화합니다. + * @deprecated + * @method eg.view360.PanoViewer#disableSensor + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.disableSensor = function disableSensor() { + return this; + } + /** + * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred). + * This method must be used in the context of user interaction, like onclick callback on the button element. + * It can be rejected when an enabling device sensor fails or image/video is still loading("ready" event not triggered). + * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다) + * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우("ready"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다. + * @method eg.view360.PanoViewer#enterVR + * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error) + */ + ; + + _proto.enterVR = function enterVR() { + var _this2 = this; + + if (!this._isReady) { + return _Promise$4.reject(new Error("PanoViewer is not ready to show image.")); + } + + return new _Promise$4(function (resolve, reject) { + _this2.enableSensor().then(function () { + return _this2._photoSphereRenderer.enterVR(); + }).then(function (res) { + return resolve(res); + })["catch"](function (e) { + return reject(e); + }); + }); + } + /** + * Exit VR stereo rendering mode. + * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다. + * + * @method eg.view360.PanoViewer#exitVR + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.exitVR = function exitVR() { + this._photoSphereRenderer.exitVR(); + + return this; + } // TODO: Remove parameters as they're just using private values + ; + + _proto._initRenderer = function _initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) { + var _this3 = this; + + this._photoSphereRenderer = new PanoImageRenderer(this._image, this._width, this._height, this._isVideo, { + initialYaw: yaw, + initialPitch: pitch, + fieldOfView: fov, + imageType: projectionType, + cubemapConfig: cubemapConfig, + stereoFormat: this._stereoFormat + }); + + this._photoSphereRenderer.setYawPitchControl(this._yawPitchControl); + + this._bindRendererHandler(); + + this._photoSphereRenderer.bindTexture().then(function () { + return _this3._activate(); + })["catch"](function () { + _this3._triggerEvent(EVENTS$1.ERROR, { + type: ERROR_TYPE.FAIL_BIND_TEXTURE, + message: "failed to bind texture" + }); + }); + } + /** + * update values of YawPitchControl if needed. + * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image. + * + * This function should be called after isReady status is true. + */ + ; + + _proto._updateYawPitchIfNeeded = function _updateYawPitchIfNeeded() { + if (this._projectionType === PanoViewer.ProjectionType.PANORAMA) { + // update fov by aspect ratio + var image = this._photoSphereRenderer.getContent(); + + var imageAspectRatio = image.naturalWidth / image.naturalHeight; + var isCircular; + var yawSize; + var maxFov; // If height is larger than width, then we assume it's rotated by 90 degree. + + if (imageAspectRatio < 1) { + // So inverse the aspect ratio. + imageAspectRatio = 1 / imageAspectRatio; + } + + if (imageAspectRatio < 6) { + yawSize = util.toDegree(imageAspectRatio); + isCircular = false; // 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5 + + maxFov = util.toDegree(Math.atan(0.5)) * 2; + } else { + yawSize = 360; + isCircular = true; + maxFov = 360 / imageAspectRatio; // Make it 5 fixed as axes does. + } // console.log("_updateYawPitchIfNeeded", maxFov, "aspectRatio", image.naturalWidth, image.naturalHeight, "yawSize", yawSize); + + + var minFov = this._yawPitchControl.option("fovRange")[0]; // this option should be called after fov is set. + + + this._yawPitchControl.option({ + "fov": maxFov, + + /* parameter for internal validation for pitchrange */ + "yawRange": [-yawSize / 2, yawSize / 2], + isCircular: isCircular, + "pitchRange": [-maxFov / 2, maxFov / 2], + "fovRange": [minFov, maxFov] + }); + + this.lookAt({ + fov: maxFov + }); + } + }; + + _proto._bindRendererHandler = function _bindRendererHandler() { + var _this4 = this; + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, function (e) { + _this4.trigger(EVENTS$1.ERROR, e); + }); + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, function (e) { + _this4._deactivate(); + + _this4.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.RENDERING_CONTEXT_LOST, + message: "webgl rendering context lost" + }); + }); + }; + + _proto._initYawPitchControl = function _initYawPitchControl(yawPitchConfig) { + var _this5 = this; + + this._yawPitchControl = new YawPitchControl(yawPitchConfig); + + this._yawPitchControl.on(EVENTS$1.ANIMATION_END, function (e) { + _this5._triggerEvent(EVENTS$1.ANIMATION_END, e); + }); + + this._yawPitchControl.on("change", function (e) { + _this5._yaw = e.yaw; + _this5._pitch = e.pitch; + _this5._fov = e.fov; + _this5._quaternion = e.quaternion; + + _this5._triggerEvent(EVENTS$1.VIEW_CHANGE, e); + }); + }; + + _proto._triggerEvent = function _triggerEvent(name, param) { + var evt = param || {}; + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name eg.view360.PanoViewer#error + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.type Error type + * 10: INVALID_DEVICE: Unsupported device + * 11: NO_WEBGL: Webgl not support + * 12, FAIL_IMAGE_LOAD: Failed to load image + * 13: FAIL_BIND_TEXTURE: Failed to bind texture + * 14: INVALID_RESOURCE: Only one resource(image or video) should be specified + * 15: RENDERING_CONTEXT_LOST: WebGL context lost occurred + * 에러 종류 + * 10: INVALID_DEVICE: 미지원 기기 + * 11: NO_WEBGL: WEBGL 미지원 + * 12, FAIL_IMAGE_LOAD: 이미지 로드 실패 + * 13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패 + * 14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * 15: RENDERING_CONTEXT_LOST: WebGL context lost 발생 + * + * @param {String} param.message Error message 에러 메시지 + * @see {@link eg.view360.PanoViewer.ERROR_TYPE} + * @example + * + * viwer.on({ + * "error" : function(evt) { + * // evt.type === 13 + * // evt.message === "failed to bind texture" + * }); + * + * // constant can be used + * viwer.on({ + * eg.view360.PanoViewer.EVENTS.ERROR : function(evt) { + * // evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE + * // evt.message === "failed to bind texture" + * }); + */ + + /** + * Events that is fired when PanoViewer is ready to go. + * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트 + * @name eg.view360.PanoViewer#ready + * @event + * + * @example + * + * viwer.on({ + * "ready" : function(evt) { + * // PanoViewer is ready to show image and handle user interaction. + * }); + */ + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#viewChange + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.yaw yawyaw + * @param {Number} param.pitch pitch pitch + * @param {Number} param.fov Field of view (fov) 화각 + * @example + * + * viwer.on({ + * "viewChange" : function(evt) { + * //evt.yaw, evt.pitch, evt.fov is available. + * }); + */ + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#animationEnd + * @event + * @example + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // animation is ended. + * }); + */ + + return this.trigger(name, evt); + } + /** + * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}. + * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다. + * @method eg.view360.PanoViewer#setUseZoom + * @param {Boolean} useZoom + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseZoom = function setUseZoom(useZoom) { + typeof useZoom === "boolean" && this._yawPitchControl.option("useZoom", useZoom); + return this; + } + /** + * When true, enables the keyboard move key control: awsd, arrow keys + * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키) + * @method eg.view360.PanoViewer#setUseKeyboard + * @param {Boolean} useKeyboard + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseKeyboard = function setUseKeyboard(useKeyboard) { + this._yawPitchControl.option("useKeyboard", useKeyboard); + + return this; + } + /** + * Enables control through device motion. ("none", "yawPitch", "VR") + * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR") + * @method eg.view360.PanoViewer#setGyroMode + * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE} + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setGyroMode("yawPitch"); + * //equivalent + * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH); + */ + ; + + _proto.setGyroMode = function setGyroMode(gyroMode) { + this._yawPitchControl.option("gyroMode", gyroMode); + + return this; + } + /** + * Set the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 설정합니다. + * @method eg.view360.PanoViewer#setFovRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setFovRange([50, 90]); + */ + ; + + _proto.setFovRange = function setFovRange(range) { + this._yawPitchControl.option("fovRange", range); + + return this; + } + /** + * Getting the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 반환합니다. + * @method eg.view360.PanoViewer#getFovRange + * @return {Array} + * @example + * var range = panoViewer.getFovRange(); //[50, 90] + */ + ; + + _proto.getFovRange = function getFovRange() { + return this._yawPitchControl.option("fovRange"); + } + /** + * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size. + * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다. + * @method eg.view360.PanoViewer#updateViewportDimensions + * @param {Object} [size] + * @param {Number} [size.width=width of container] + * @param {Number} [size.height=height of container] + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.updateViewportDimensions = function updateViewportDimensions(size) { + if (size === void 0) { + size = { + width: undefined, + height: undefined + }; + } + + if (!this._isReady) { + return this; + } + + var containerSize; + + if (size.width === undefined || size.height === undefined) { + containerSize = window.getComputedStyle(this._container); + } + + var width = size.width || parseInt(containerSize.width, 10); + var height = size.height || parseInt(containerSize.height, 10); // Skip if viewport is not changed. + + if (width === this._width && height === this._height) { + return this; + } + + this._width = width; + this._height = height; + this._aspectRatio = width / height; + + this._photoSphereRenderer.updateViewportDimensions(width, height); + + this._yawPitchControl.option("aspectRatio", this._aspectRatio); + + this._yawPitchControl.updatePanScale({ + height: height + }); + + this.lookAt({}, 0); + return this; + } + /** + * Get the current field of view(FOV) + * @ko 현재 field of view(FOV) 값을 반환합니다. + * @method eg.view360.PanoViewer#getFov + * @return {Number} + */ + ; + + _proto.getFov = function getFov() { + return this._fov; + } + /** + * Get the horizontal field of view in degree + */ + ; + + _proto._getHFov = function _getHFov() { + return util.toDegree(2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2))); + } + /** + * Get current yaw value + * @ko 현재 yaw 값을 반환합니다. + * @method eg.view360.PanoViewer#getYaw + * @return {Number} + */ + ; + + _proto.getYaw = function getYaw() { + return this._yaw; + } + /** + * Get current pitch value + * @ko 현재 pitch 값을 반환합니다. + * @method eg.view360.PanoViewer#getPitch + * @return {Number} + */ + ; + + _proto.getPitch = function getPitch() { + return this._pitch; + } + /** + * Get the range of controllable Yaw values + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#getYawRange + * @return {Array} + */ + ; + + _proto.getYawRange = function getYawRange() { + return this._yawPitchControl.option("yawRange"); + } + /** + * Get the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다. + * @method eg.view360.PanoViewer#getPitchRange + * @return {Array} + */ + ; + + _proto.getPitchRange = function getPitchRange() { + return this._yawPitchControl.option("pitchRange"); + } + /** + * Set the range of controllable yaw + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#setYawRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setYawRange([-90, 90]); + */ + ; + + _proto.setYawRange = function setYawRange(yawRange) { + this._yawPitchControl.option("yawRange", yawRange); + + return this; + } + /** + * Set the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 설정합니다. + * @method eg.view360.PanoViewer#setPitchRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setPitchRange([-40, 40]); + */ + ; + + _proto.setPitchRange = function setPitchRange(pitchRange) { + this._yawPitchControl.option("pitchRange", pitchRange); + + return this; + } + /** + * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed. + * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다. + * @method eg.view360.PanoViewer#setShowPolePoint + * @param {Boolean} showPolePoint + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setShowPolePoint = function setShowPolePoint(showPolePoint) { + this._yawPitchControl.option("showPolePoint", showPolePoint); + + return this; + } + /** + * Set a new view by setting camera configuration. Any parameters not specified remain the same. + * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다. + * @method eg.view360.PanoViewer#lookAt + * @param {Object} orientation + * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위) + * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위) + * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위) + * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초) + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * // Change the yaw angle (absolute angle) to 30 degrees for one second. + * panoViewer.lookAt({yaw: 30}, 1000); + */ + ; + + _proto.lookAt = function lookAt(orientation, duration) { + if (!this._isReady) { + return this; + } + + var yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw; + var pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch; + + var pitchRange = this._yawPitchControl.option("pitchRange"); + + var verticalAngleOfImage = pitchRange[1] - pitchRange[0]; + var fov = orientation.fov !== undefined ? orientation.fov : this._fov; + + if (verticalAngleOfImage < fov) { + fov = verticalAngleOfImage; + } + + this._yawPitchControl.lookAt({ + yaw: yaw, + pitch: pitch, + fov: fov + }, duration); + + if (duration === 0) { + this._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov); + } + + return this; + }; + + _proto._activate = function _activate() { + this._photoSphereRenderer.attachTo(this._container); + + this._yawPitchControl.enable(); + + this.updateViewportDimensions(); + this._isReady = true; // update yawPitchControl after isReady status is true. + + this._updateYawPitchIfNeeded(); + + this._triggerEvent(EVENTS$1.READY); + + this._photoSphereRenderer.startRender(); + } + /** + * Destroy webgl context and block user interaction and stop rendering + */ + ; + + _proto._deactivate = function _deactivate() { + if (this._isReady) { + this._photoSphereRenderer.stopRender(); + + this._yawPitchControl.disable(); + + this._isReady = false; + } + + if (this._photoSphereRenderer) { + this._photoSphereRenderer.destroy(); + + this._photoSphereRenderer = null; + } + }; + + PanoViewer._isValidTouchDirection = function _isValidTouchDirection(direction) { + return direction === PanoViewer.TOUCH_DIRECTION.NONE || direction === PanoViewer.TOUCH_DIRECTION.YAW || direction === PanoViewer.TOUCH_DIRECTION.PITCH || direction === PanoViewer.TOUCH_DIRECTION.ALL; + } + /** + * Set touch direction by which user can control. + * @ko 사용자가 조작가능한 터치 방향을 지정합니다. + * @method eg.view360.PanoViewer#setTouchDirection + * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @return {eg.view360.PanoViewer} PanoViewer instance + * @example + * + * panoViewer = new PanoViewer(el); + * // Limit the touch direction to the yaw direction only. + * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW); + */ + ; + + _proto.setTouchDirection = function setTouchDirection(direction) { + if (PanoViewer._isValidTouchDirection(direction)) { + this._yawPitchControl.option("touchDirection", direction); + } + + return this; + } + /** + * Returns touch direction by which user can control + * @ko 사용자가 조작가능한 터치 방향을 반환한다. + * @method eg.view360.PanoViewer#getTouchDirection + * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @example + * + * panoViewer = new PanoViewer(el); + * // Returns the current touch direction. + * var dir = panoViewer.getTouchDirection(); + */ + ; + + _proto.getTouchDirection = function getTouchDirection() { + return this._yawPitchControl.option("touchDirection"); + } + /** + * Destroy viewer. Remove all registered event listeners and remove viewer canvas. + * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다. + * @method eg.view360.PanoViewer#destroy + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.destroy = function destroy() { + this._deactivate(); + + if (this._yawPitchControl) { + this._yawPitchControl.destroy(); + + this._yawPitchControl = null; + } + + return this; + } + /** + * Check whether the current environment can execute PanoViewer + * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다. + * @function isSupported + * @memberof eg.view360.PanoViewer + * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부 + * @static + */ + ; + + PanoViewer.isSupported = function isSupported() { + return WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL(); + } + /** + * Check whether the current environment supports the WebGL + * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다. + * @function isWebGLAvailable + * @memberof eg.view360.PanoViewer + * @return {Boolean} WebGL support WebGL 지원여부 + * @static + */ + ; + + PanoViewer.isWebGLAvailable = function isWebGLAvailable() { + return WebGLUtils.isWebGLAvailable(); + } + /** + * Check whether the current environment supports the gyro sensor. + * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다. + * @function isGyroSensorAvailable + * @memberof eg.view360.PanoViewer + * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수 + * @static + */ + ; + + PanoViewer.isGyroSensorAvailable = function isGyroSensorAvailable(callback) { + if (!DeviceMotionEvent) { + callback && callback(false); + return; + } + + var onDeviceMotionChange; + + function checkGyro() { + return new _Promise$4(function (res, rej) { + onDeviceMotionChange = function onDeviceMotionChange(deviceMotion) { + var isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null); + res(isGyroSensorAvailable); + }; + + window.addEventListener("devicemotion", onDeviceMotionChange); + }); + } + + function timeout() { + return new _Promise$4(function (res, rej) { + setTimeout(function () { + return res(false); + }, 1000); + }); + } + + _Promise$4.race([checkGyro(), timeout()]).then(function (isGyroSensorAvailable) { + window.removeEventListener("devicemotion", onDeviceMotionChange); + callback && callback(isGyroSensorAvailable); + + PanoViewer.isGyroSensorAvailable = function (fb) { + fb && fb(isGyroSensorAvailable); + return isGyroSensorAvailable; + }; + }); + }; + + return PanoViewer; + }(Component); + + PanoViewer.VERSION = VERSION; + PanoViewer.ERROR_TYPE = ERROR_TYPE; + PanoViewer.EVENTS = EVENTS$1; + PanoViewer.PROJECTION_TYPE = PROJECTION_TYPE; + PanoViewer.GYRO_MODE = GYRO_MODE; + PanoViewer.ProjectionType = PROJECTION_TYPE; + PanoViewer.STEREO_FORMAT = STEREO_FORMAT; + PanoViewer.TOUCH_DIRECTION = { + /** + * Constant value for none direction. + * @ko none 방향에 대한 상수 값. + * @name NONE + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 1 + */ + NONE: YawPitchControl.TOUCH_DIRECTION_NONE, + + /** + * Constant value for horizontal(yaw) direction. + * @ko horizontal(yaw) 방향에 대한 상수 값. + * @name YAW + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 6 + */ + YAW: YawPitchControl.TOUCH_DIRECTION_YAW, + + /** + * Constant value for vertical direction. + * @ko vertical(pitch) 방향에 대한 상수 값. + * @name PITCH + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 24 + */ + PITCH: YawPitchControl.TOUCH_DIRECTION_PITCH, + + /** + * Constant value for all direction. + * @ko all 방향에 대한 상수 값. + * @name ALL + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 30 + */ + ALL: YawPitchControl.TOUCH_DIRECTION_ALL + }; + return PanoViewer; +}(); + +/** + * @class eg.view360.SpriteImage + * @classdesc A module that displays a single or continuous image of any one of the "sprite images". SpinViewer internally uses SpriteImage to show each frame of the sprite image. + * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the "Sprite image". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
+ * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpriteImage + * + * var el = document.getElementById("image-div"); + * var sprites = new eg.view360.SpriteImage(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 + * }); + */ + +var SpriteImage = +/*#__PURE__*/ +function () { + var SpriteImage = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpriteImage, _Component); + + function SpriteImage(element, options) { + var _this; + + _this = _Component.call(this) || this; + var opt = options || {}; + _this._el = element; + _this._rowCount = opt.rowCount || 1; + _this._colCount = opt.colCount || 1; + _this._totalCount = _this._rowCount * _this._colCount; // total frames + + _this._width = opt.width || "auto"; + _this._height = opt.height || "auto"; + _this._autoHeight = opt.autoHeight != null ? opt.autoHeight : "true"; // If autoHeight is specified, _height will be overwritten. + + _this._colRow = [0, 0]; + + if (opt.colRow) { + _this._colRow = opt.colRow; + } else if (opt.frameIndex) { + _this.setFrameIndex(opt.frameIndex); + } + + _this._el.style.width = SpriteImage._getSizeString(_this._width); + _this._el.style.height = SpriteImage._getSizeString(_this._height); + + if (!opt.imageUrl) { + setTimeout(function () { + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }, 0); + return _assertThisInitialized(_this); + } + + _this._image = new Image(); + /** + * Event + */ + + _this._image.onload = function () { + _this._bg = SpriteImage._createBgDiv(_this._image, _this._rowCount, _this._colCount, _this._autoHeight); + + _this._el.appendChild(_this._bg); + + _this.setColRow(_this._colRow[0], _this._colRow[1]); + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpriteImage#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * sprites.on({ + * "load" : function(evt) { + * console.log("load event fired - e.target", e.target, "e.bgElement", e.bgElement); + * } + * }); + */ + + + _this.trigger("load", { + target: _this._el, + bgElement: _this._bg + }); + + if (_this._autoPlayReservedInfo) { + _this.play(_this._autoPlayReservedInfo); + + _this._autoPlayReservedInfo = null; + } + }; + + _this._image.onerror = function (e) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpriteImage#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * sprites.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }; + + _this._image.src = opt.imageUrl; + return _this; + } + + SpriteImage._createBgDiv = function _createBgDiv(img, rowCount, colCount, autoHeight) { + var el = document.createElement("div"); + el.style.position = "relative"; + el.style.overflow = "hidden"; + img.style.position = "absolute"; + img.style.width = colCount * 100 + "%"; + img.style.height = rowCount * 100 + "%"; + /** Prevent image from being dragged on IE10, IE11, Safari especially */ + + img.ondragstart = function () { + return false; + }; // img.style.pointerEvents = "none"; + // Use hardware accelerator if available + + + SUPPORT_WILLCHANGE && (img.style.willChange = "transform"); + el.appendChild(img); + var unitWidth = img.width / colCount; + var unitHeight = img.height / rowCount; + + if (autoHeight) { + var r = unitHeight / unitWidth; + el.style.paddingBottom = r * 100 + "%"; + } else { + el.style.height = "100%"; + } + + return el; + } + /** + * Specifies the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정 + * @method eg.view360.SpriteImage#setFrameIndex + * @param {Number} frameIndex frame index of a frame프레임의 인덱스 + * + * @example + * + * sprites.setFrameIndex(0, 1);// col = 0, row = 1 + */ + ; + + var _proto = SpriteImage.prototype; + + _proto.setFrameIndex = function setFrameIndex(index) { + var colRow = this.toColRow(index); + this.setColRow(colRow[0], colRow[1]); + } + /** + * Returns the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환 + * @method eg.view360.SpriteImage#getFrameIndex + * @return {Number} frame index frame 인덱스 + * + * @example + * + * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1 + * + */ + ; + + _proto.getFrameIndex = function getFrameIndex() { + return this._colRow[1] * this._colCount + this._colRow[0]; + } + /** + * Specifies the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정 + * @method eg.view360.SpriteImage#setColRow + * @param {Number} col Column number of a frame프레임의 행값 + * @param {Number} row Row number of a frame프레임의 열값 + * + * @example + * + * sprites.setlColRow(1, 2); // col = 1, row = 2 + */ + ; + + _proto.setColRow = function setColRow(col, row) { + if (row > this._rowCount - 1 || col > this._colCount - 1) { + return; + } + + if (this._image && TRANSFORM) { + // NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser? + this._image.style[TRANSFORM] = "translate(" + -(col / this._colCount * 100) + "%, " + -(row / this._rowCount * 100) + "%)"; + } + + this._colRow = [col, row]; + } + /** + * Returns the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환 + * @method eg.view360.SpriteImage#gelColRow + * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열 + * + * @example + * + * var colRow = sprites.getlColRow(); + * // colRow = [1, 2] - index of col is 1, index of row is 2 + * + */ + ; + + _proto.getColRow = function getColRow() { + return this._colRow; + }; + + SpriteImage._getSizeString = function _getSizeString(size) { + if (typeof size === "number") { + return size + "px"; + } + + return size; + } + /** + * Stop playing + * @ko play 되고 있던 프레임 재생을 중지합니다. + * @method eg.view360.SpriteImage#stop + * + * @example + * + * viewer.stop(); + * + */ + ; + + _proto.stop = function stop() { + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + } + /** + * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'. + * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다. + * @method eg.view360.SpriteImage#play + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위 + * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복 + * + * @example + * + * viewer.play({angle: 16, playCount: 1}); + * + */ + ; + + _proto.play = function play(_temp) { + var _this2 = this; + + var _ref = _temp === void 0 ? { + interval: 1000 / this._totalCount, + playCount: 0 + } : _temp, + interval = _ref.interval, + playCount = _ref.playCount; + + if (!this._bg) { + this._autoPlayReservedInfo = { + interval: interval, + playCount: playCount + }; + return; + } + + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + + var frameIndex = this.getFrameIndex(); + var count = 0; + var frameCount = 0; // for checking 1 cycle + + this._autoPlayTimer = setInterval(function () { + frameIndex %= _this2._totalCount; + + var colRow = _this2.toColRow(frameIndex); + + _this2.setColRow(colRow[0], colRow[1]); + + frameIndex++; // Done 1 Cycle? + + if (++frameCount === _this2._totalCount) { + frameCount = 0; + count++; + } + + if (playCount > 0 && count === playCount) { + clearInterval(_this2._autoPlayTimer); + } + }, interval); + }; + + _proto.toColRow = function toColRow(frameIndex) { + var colCount = this._colCount; + var rowCount = this._rowCount; + + if (frameIndex < 0) { + return [0, 0]; + } else if (frameIndex >= this._totalCount) { + return [colCount - 1, rowCount - 1]; + } + + var col = frameIndex % colCount; + var row = Math.floor(frameIndex / colCount); // console.log(frameIndex, col, row); + + return [col, row]; + }; + + return SpriteImage; + }(Component); + + SpriteImage.VERSION = VERSION; + return SpriteImage; +}(); + +var DEFAULT_PAN_SCALE = 0.21; +/** + * @class eg.view360.SpinViewer + * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object. + * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpinViewer + * var el = document.getElementById("product-360"); + * var viewer = new eg.view360.SpinViewer(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 //required + * }); + */ + +var SpinViewer = +/*#__PURE__*/ +function () { + var SpinViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpinViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.SpinViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.SpinViewer + */ + function SpinViewer(element, options) { + var _this; + + _this = _Component.call(this) || this; + _this._el = element; + + var opt = _extends({}, options); + + var colCount = opt.colCount || 1; + var rowCount = opt.rowCount || 1; + _this._scale = opt.scale || 1; + _this._panScale = _this._scale * DEFAULT_PAN_SCALE; + _this._frameCount = colCount * rowCount; // Init SpriteImage + + _this._sprites = new SpriteImage(element, opt).on({ + "load": function load(evt) { + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpinViewer#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * viwer.on({ + * "load" : function(evt) { + * this.spinBy(360, {duration: 300}); + * } + * }); + */ + _this.trigger("load", evt); + }, + "imageError": function imageError(evt) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * viewer.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: evt.imageUrl + }); + } + }); // Init Axes + + _this._panInput = new PanInput(_this._el, { + scale: [_this._panScale, _this._panScale] + }); + _this._axes = new Axes({ + angle: { + range: [0, 359], + circular: true + } + }).on({ + "change": function change(evt) { + var curr = Math.floor(evt.pos.angle / (360 / _this._frameCount)); + var frameIndex = _this._frameCount - curr - 1; + + _this._sprites.setFrameIndex(frameIndex); + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#change + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row + * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값 + * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님) + * + * @example + * + * viwer.on({ + * "change" : function(evt) { + * console.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30 + * } + * }); + */ + + + _this.trigger("change", { + frameIndex: frameIndex, + colRow: _this._sprites.getColRow(), + angle: evt.pos.angle + }); + }, + "animationEnd": function animationEnd(evt) { + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생하는 이벤트 + * @name eg.view360.SpinViewer#animationEnd + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Boolean} param.isTrusted 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 + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // evt.isTrusted === true or false + * } + * }); + */ + _this.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + + _this._axes.connect("angle", _this._panInput); + + return _this; + } + /** + * Set spin scale + * @ko scale 을 조정할 수 있는 함수 + * @method eg.view360.SpinViewer#setScale + * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.setScale(2);// It moves twice as much. + */ + + + var _proto = SpinViewer.prototype; + + _proto.setScale = function setScale(scale) { + if (isNaN(scale) || scale < 0) { + return this; + } + + this._scale = scale; + this._panScale = scale * DEFAULT_PAN_SCALE; + this._panInput.options.scale = [this._panScale, this._panScale]; + return this; + } + /** + * Get spin scale + * @ko scale 값을 반환한다. + * @method eg.view360.SpinViewer#getScale + * + * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @example + * + * viewer.getScale();// It returns number + */ + ; + + _proto.getScale = function getScale() { + return this._scale; + } + /** + * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle. + * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinBy + * + * @param {Number} [angle = 0] angle상대적 회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinBy(720, {duration: 500}); + */ + ; + + _proto.spinBy = function spinBy(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setBy({ + angle: angle + }, param.duration); + + return this; + } + /** + * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle). + * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinTo + * + * @param {Number} [angle = 0] angle회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinTo(30, {duration:100}); + */ + ; + + _proto.spinTo = function spinTo(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setTo({ + angle: angle + }, param.duration); + + return this; + } + /** + * Returns current angles + * @ko 현재 각도를 반환한다. + * + * @return {Number} Current angle 현재 각도 + */ + ; + + _proto.getAngle = function getAngle() { + return this._axes.get().angle || 0; + }; + + return SpinViewer; + }(Component); + + SpinViewer.VERSION = VERSION; + return SpinViewer; +}(); + +export { PanoViewer, SpinViewer, SpriteImage, VERSION }; diff --git a/dist/view360.js b/dist/view360.js new file mode 100644 index 000000000..05c021804 --- /dev/null +++ b/dist/view360.js @@ -0,0 +1,8686 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@egjs/agent'), require('gl-matrix'), require('@egjs/axes'), require('@egjs/component')) : + typeof define === 'function' && define.amd ? define(['exports', '@egjs/agent', 'gl-matrix', '@egjs/axes', '@egjs/component'], factory) : + (factory((global.eg = global.eg || {}, global.eg.view360 = {}),global.eg.Agent,global.glMatrix,global.eg.Axes,global.eg.Component)); +}(this, (function (exports,Agent,glMatrix,Axes,Component) { 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); + } + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var es6Promise = createCommonjsModule(function (module, exports) { + /*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ + + (function (global, factory) { + module.exports = factory(); + }(commonjsGlobal, (function () { + function objectOrFunction(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); + } + + function isFunction(x) { + return typeof x === 'function'; + } + + + + var _isArray = void 0; + if (Array.isArray) { + _isArray = Array.isArray; + } else { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } + + var isArray = _isArray; + + var len = 0; + var vertxNext = void 0; + var customSchedulerFn = void 0; + + var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } + }; + + function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; + } + + function setAsap(asapFn) { + asap = asapFn; + } + + var browserWindow = typeof window !== 'undefined' ? window : undefined; + var browserGlobal = browserWindow || {}; + var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; + var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + + // node + function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; + } + + // vertx + function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); + } + + function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; + } + + // web worker + function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; + } + + function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; + } + + var queue = new Array(1000); + function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; + } + + function attemptVertx() { + try { + var vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } + } + + var scheduleFlush = void 0; + // Decide what async method to use to triggering processing of queued callbacks: + if (isNode) { + scheduleFlush = useNextTick(); + } else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); + } else if (isWorker) { + scheduleFlush = useMessageChannel(); + } else if (browserWindow === undefined && typeof commonjsRequire === 'function') { + scheduleFlush = attemptVertx(); + } else { + scheduleFlush = useSetTimeout(); + } + + function then(onFulfillment, onRejection) { + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + + if (_state) { + var callback = arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + } + + /** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + function resolve$1(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + resolve(promise, object); + return promise; + } + + var PROMISE_ID = Math.random().toString(36).substring(2); + + function noop() {} + + var PENDING = void 0; + var FULFILLED = 1; + var REJECTED = 2; + + function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { + try { + then$$1.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } + } + + function handleForeignThenable(promise, thenable, then$$1) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then$$1, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); + } + + function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return resolve(promise, value); + }, function (reason) { + return reject(promise, reason); + }); + } + } + + function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$1 === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); + } else { + fulfill(promise, maybeThenable); + } + } + } + + function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + var then$$1 = void 0; + try { + then$$1 = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then$$1); + } else { + fulfill(promise, value); + } + } + + function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); + } + + function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } + } + + function reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); + } + + function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } + } + + function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = void 0, + callback = void 0, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = void 0, + error = void 0, + succeeded = true; + + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + + if (promise._state !== PENDING) ; else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } + } + + function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch (e) { + reject(promise, e); + } + } + + var id = 0; + function nextId() { + return id++; + } + + function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; + } + + function validationError() { + return new Error('Array Methods must be provided an Array'); + } + + var Enumerator = function () { + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + + Enumerator.prototype._enumerate = function _enumerate(input) { + for (var i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + }; + + Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { + var c = this._instanceConstructor; + var resolve$$1 = c.resolve; + + + if (resolve$$1 === resolve$1) { + var _then = void 0; + var error = void 0; + var didError = false; + try { + _then = entry.then; + } catch (e) { + didError = true; + error = e; + } + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise$1) { + var promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, _then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$1(entry), i); + } + }; + + Enumerator.prototype._settledAt = function _settledAt(state, i, value) { + var promise = this.promise; + + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + + Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + + return Enumerator; + }(); + + /** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static + */ + function all(entries) { + return new Enumerator(this, entries).promise; + } + + /** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. + */ + function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } + } + + /** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. + */ + function reject$1(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + reject(promise, reason); + return promise; + } + + function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor + */ + + var Promise$1 = function () { + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + Chaining + -------- + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + Assimilation + ------------ + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + If the assimliated promise rejects, then the downstream promise will also reject. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + Simple Example + -------------- + Synchronous Example + ```javascript + let result; + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + Promise Example; + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + Advanced Example + -------------- + Synchronous Example + ```javascript + let author, books; + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + function foundBooks(books) { + } + function failure(reason) { + } + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + Promise Example; + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + + + Promise.prototype.catch = function _catch(onRejection) { + return this.then(null, onRejection); + }; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + Synchronous example: + + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + + Asynchronous example: + + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + + @method finally + @param {Function} callback + @return {Promise} + */ + + + Promise.prototype.finally = function _finally(callback) { + var promise = this; + var constructor = promise.constructor; + + if (isFunction(callback)) { + return promise.then(function (value) { + return constructor.resolve(callback()).then(function () { + return value; + }); + }, function (reason) { + return constructor.resolve(callback()).then(function () { + throw reason; + }); + }); + } + + return promise.then(callback, callback); + }; + + return Promise; + }(); + + Promise$1.prototype.then = then; + Promise$1.all = all; + Promise$1.race = race; + Promise$1.resolve = resolve$1; + Promise$1.reject = reject$1; + Promise$1._setScheduler = setScheduler; + Promise$1._setAsap = setAsap; + Promise$1._asap = asap; + + /*global self*/ + function polyfill() { + var local = void 0; + + if (typeof commonjsGlobal !== 'undefined') { + local = commonjsGlobal; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise$1; + } + + // Strange compat.. + Promise$1.polyfill = polyfill; + Promise$1.Promise = Promise$1; + + return Promise$1; + + }))); + + + + + }); + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + /* eslint-disable no-new-func, no-nested-ternary */ + + var win = typeof window !== "undefined" && window.Math === Math ? window : typeof self !== "undefined" && self.Math === Math ? self : Function("return this")(); + /* eslint-enable no-new-func, no-nested-ternary */ + + var doc = win.document; + var agent = Agent(); + var osName = agent.os.name; + var browserName = agent.browser.name; + var IS_IOS = osName === "ios"; + var IS_SAFARI_ON_DESKTOP = osName === "mac" && browserName === "safari"; + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + win.Float32Array = typeof win.Float32Array !== "undefined" ? win.Float32Array : win.Array; + var Float32Array$1 = win.Float32Array; + var getComputedStyle = win.getComputedStyle; + var userAgent = win.navigator.userAgent; + var SUPPORT_TOUCH = "ontouchstart" in win; + var SUPPORT_DEVICEMOTION = "ondevicemotion" in win; + var DeviceMotionEvent = win.DeviceMotionEvent; + var devicePixelRatio = win.devicePixelRatio; + + var TRANSFORM = function () { + var docStyle = doc.documentElement.style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in docStyle) { + return target[i]; + } + } + + return ""; + }(); // check for will-change support + + + var SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports && win.CSS.supports("will-change", "transform"); + var WEBXR_SUPPORTED = false; + + var checkXRSupport = function checkXRSupport() { + if (!navigator.xr) { + return; + } + + if (navigator.xr.isSessionSupported) { + navigator.xr.isSessionSupported("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } else if (navigator.xr.supportsSession) { + navigator.xr.supportsSession("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } + }; + + /** + * Original Code + * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js + * Math Util + * modified by egjs + */ + + function quatToVec3(quaternion) { + var baseV = glMatrix.vec3.fromValues(0, 0, 1); + glMatrix.vec3.transformQuat(baseV, baseV, quaternion); + return baseV; + } + + function toDegree(a) { + return a * 180 / Math.PI; + } + + var util = {}; + + util.isPowerOfTwo = function (n) { + return n && (n & n - 1) === 0; + }; + + util.extractPitchFromQuat = function (quaternion) { + var baseV = quatToVec3(quaternion); + return -1 * Math.atan2(baseV[1], Math.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2))); + }; + + util.hypot = Math.hypot || function (x, y) { + return Math.sqrt(x * x + y * y); + }; // implement reference + // the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식 + // calculating angle between two vectors : http://darkpgmr.tistory.com/121 + + + var ROTATE_CONSTANT = { + PITCH_DELTA: 1, + YAW_DELTA_BY_ROLL: 2, + YAW_DELTA_BY_YAW: 3 + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = { + targetAxis: [0, 1, 0], + meshPoint: [0, 0, 1] + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = { + targetAxis: [0, 1, 0], + meshPoint: [1, 0, 0] + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = { + targetAxis: [1, 0, 0], + meshPoint: [0, 0, 1] + }; + + function getRotationDelta(prevQ, curQ, rotateKind) { + var targetAxis = glMatrix.vec3.fromValues(ROTATE_CONSTANT[rotateKind].targetAxis[0], ROTATE_CONSTANT[rotateKind].targetAxis[1], ROTATE_CONSTANT[rotateKind].targetAxis[2]); + var meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint; + var prevQuaternion = glMatrix.quat.clone(prevQ); + var curQuaternion = glMatrix.quat.clone(curQ); + glMatrix.quat.normalize(prevQuaternion, prevQuaternion); + glMatrix.quat.normalize(curQuaternion, curQuaternion); + var prevPoint = glMatrix.vec3.fromValues(0, 0, 1); + var curPoint = glMatrix.vec3.fromValues(0, 0, 1); + glMatrix.vec3.transformQuat(prevPoint, prevPoint, prevQuaternion); + glMatrix.vec3.transformQuat(curPoint, curPoint, curQuaternion); + glMatrix.vec3.transformQuat(targetAxis, targetAxis, curQuaternion); + var rotateDistance = glMatrix.vec3.dot(targetAxis, glMatrix.vec3.cross(glMatrix.vec3.create(), prevPoint, curPoint)); + var rotateDirection = rotateDistance > 0 ? 1 : -1; // when counter clock wise, use vec3.fromValues(0,1,0) + // when clock wise, use vec3.fromValues(0,-1,0) + // const meshPoint1 = vec3.fromValues(0, 0, 0); + + var meshPoint2 = glMatrix.vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + var meshPoint3; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + meshPoint3 = glMatrix.vec3.fromValues(0, rotateDirection, 0); + } else { + meshPoint3 = glMatrix.vec3.fromValues(rotateDirection, 0, 0); + } + + glMatrix.vec3.transformQuat(meshPoint2, meshPoint2, curQuaternion); + glMatrix.vec3.transformQuat(meshPoint3, meshPoint3, curQuaternion); + var vecU = meshPoint2; + var vecV = meshPoint3; + var vecN = glMatrix.vec3.create(); + glMatrix.vec3.cross(vecN, vecU, vecV); + glMatrix.vec3.normalize(vecN, vecN); + var coefficientA = vecN[0]; + var coefficientB = vecN[1]; + var coefficientC = vecN[2]; // const coefficientD = -1 * vec3.dot(vecN, meshPoint1); + // a point on the plane + + curPoint = glMatrix.vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + glMatrix.vec3.transformQuat(curPoint, curPoint, curQuaternion); // a point should project on the plane + + prevPoint = glMatrix.vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]); + glMatrix.vec3.transformQuat(prevPoint, prevPoint, prevQuaternion); // distance between prevPoint and the plane + + var distance = Math.abs(prevPoint[0] * coefficientA + prevPoint[1] * coefficientB + prevPoint[2] * coefficientC); + var projectedPrevPoint = glMatrix.vec3.create(); + glMatrix.vec3.subtract(projectedPrevPoint, prevPoint, glMatrix.vec3.scale(glMatrix.vec3.create(), vecN, distance)); + var trigonometricRatio = (projectedPrevPoint[0] * curPoint[0] + projectedPrevPoint[1] * curPoint[1] + projectedPrevPoint[2] * curPoint[2]) / (glMatrix.vec3.length(projectedPrevPoint) * glMatrix.vec3.length(curPoint)); // defensive block + + trigonometricRatio > 1 && (trigonometricRatio = 1); + var theta = Math.acos(trigonometricRatio); + var crossVec = glMatrix.vec3.cross(glMatrix.vec3.create(), curPoint, projectedPrevPoint); + distance = coefficientA * crossVec[0] + coefficientB * crossVec[1] + coefficientC * crossVec[2]; + var thetaDirection; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + thetaDirection = distance > 0 ? 1 : -1; + } else { + thetaDirection = distance < 0 ? 1 : -1; + } + + var deltaRadian = theta * thetaDirection * rotateDirection; + return toDegree(deltaRadian); + } + + function angleBetweenVec2(v1, v2) { + var det = v1[0] * v2[1] - v2[0] * v1[1]; + var theta = -Math.atan2(det, glMatrix.vec2.dot(v1, v2)); + return theta; + } + + util.yawOffsetBetween = function (viewDir, targetDir) { + var viewDirXZ = glMatrix.vec2.fromValues(viewDir[0], viewDir[2]); + var targetDirXZ = glMatrix.vec2.fromValues(targetDir[0], targetDir[2]); + glMatrix.vec2.normalize(viewDirXZ, viewDirXZ); + glMatrix.vec2.normalize(targetDirXZ, targetDirXZ); + var theta = -angleBetweenVec2(viewDirXZ, targetDirXZ); + return theta; + }; + + util.toDegree = toDegree; + util.getRotationDelta = getRotationDelta; + util.angleBetweenVec2 = angleBetweenVec2; + + function toAxis(source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + } + + /* + * Copyright 2016 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + var MathUtil = window.MathUtil || {}; + + MathUtil.degToRad = Math.PI / 180; + MathUtil.radToDeg = 180 / Math.PI; + + // Some minimal math functionality borrowed from THREE.Math and stripped down + // for the purposes of this library. + + + MathUtil.Vector2 = function ( x, y ) { + this.x = x || 0; + this.y = y || 0; + }; + + MathUtil.Vector2.prototype = { + constructor: MathUtil.Vector2, + + set: function ( x, y ) { + this.x = x; + this.y = y; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + + return this; + }, + + subVectors: function ( a, b ) { + this.x = a.x - b.x; + this.y = a.y - b.y; + + return this; + }, + }; + + MathUtil.Vector3 = function ( x, y, z ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + }; + + MathUtil.Vector3.prototype = { + constructor: MathUtil.Vector3, + + set: function ( x, y, z ) { + this.x = x; + this.y = y; + this.z = z; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + + return this; + }, + + length: function () { + return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); + }, + + normalize: function () { + var scalar = this.length(); + + if ( scalar !== 0 ) { + var invScalar = 1 / scalar; + + this.multiplyScalar(invScalar); + } else { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + multiplyScalar: function ( scalar ) { + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; + }, + + applyQuaternion: function ( q ) { + var x = this.x; + var y = this.y; + var z = this.z; + + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + + // calculate quat * vector + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = - qx * x - qy * y - qz * z; + + // calculate result * inverse quat + this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; + this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; + this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; + + return this; + }, + + dot: function ( v ) { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + crossVectors: function ( a, b ) { + var ax = a.x, ay = a.y, az = a.z; + var bx = b.x, by = b.y, bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + }; + + MathUtil.Quaternion = function ( x, y, z, w ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = ( w !== undefined ) ? w : 1; + }; + + MathUtil.Quaternion.prototype = { + constructor: MathUtil.Quaternion, + + set: function ( x, y, z, w ) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + + return this; + }, + + copy: function ( quaternion ) { + this.x = quaternion.x; + this.y = quaternion.y; + this.z = quaternion.z; + this.w = quaternion.w; + + return this; + }, + + setFromEulerXYZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 + s1 * s2 * c3; + this.w = c1 * c2 * c3 - s1 * s2 * s3; + + return this; + }, + + setFromEulerYXZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 - s1 * s2 * c3; + this.w = c1 * c2 * c3 + s1 * s2 * s3; + + return this; + }, + + setFromAxisAngle: function ( axis, angle ) { + // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm + // assumes axis is normalized + + var halfAngle = angle / 2, s = Math.sin( halfAngle ); + + this.x = axis.x * s; + this.y = axis.y * s; + this.z = axis.z * s; + this.w = Math.cos( halfAngle ); + + return this; + }, + + multiply: function ( q ) { + return this.multiplyQuaternions( this, q ); + }, + + multiplyQuaternions: function ( a, b ) { + // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm + + var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w; + var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w; + + this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; + this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; + this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; + this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; + + return this; + }, + + inverse: function () { + this.x *= -1; + this.y *= -1; + this.z *= -1; + + this.normalize(); + + return this; + }, + + normalize: function () { + var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); + + if ( l === 0 ) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } else { + l = 1 / l; + + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + + return this; + }, + + slerp: function ( qb, t ) { + if ( t === 0 ) return this; + if ( t === 1 ) return this.copy( qb ); + + var x = this.x, y = this.y, z = this.z, w = this.w; + + // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + + var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z; + + if ( cosHalfTheta < 0 ) { + this.w = - qb.w; + this.x = - qb.x; + this.y = - qb.y; + this.z = - qb.z; + + cosHalfTheta = - cosHalfTheta; + } else { + this.copy( qb ); + } + + if ( cosHalfTheta >= 1.0 ) { + this.w = w; + this.x = x; + this.y = y; + this.z = z; + + return this; + } + + var halfTheta = Math.acos( cosHalfTheta ); + var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); + + if ( Math.abs( sinHalfTheta ) < 0.001 ) { + this.w = 0.5 * ( w + this.w ); + this.x = 0.5 * ( x + this.x ); + this.y = 0.5 * ( y + this.y ); + this.z = 0.5 * ( z + this.z ); + + return this; + } + + var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, + ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; + + this.w = ( w * ratioA + this.w * ratioB ); + this.x = ( x * ratioA + this.x * ratioB ); + this.y = ( y * ratioA + this.y * ratioB ); + this.z = ( z * ratioA + this.z * ratioB ); + + return this; + }, + + setFromUnitVectors: function () { + // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final + // assumes direction vectors vFrom and vTo are normalized + + var v1, r; + var EPS = 0.000001; + + return function ( vFrom, vTo ) { + if ( v1 === undefined ) v1 = new MathUtil.Vector3(); + + r = vFrom.dot( vTo ) + 1; + + if ( r < EPS ) { + r = 0; + + if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { + v1.set( - vFrom.y, vFrom.x, 0 ); + } else { + v1.set( 0, - vFrom.z, vFrom.y ); + } + } else { + v1.crossVectors( vFrom, vTo ); + } + + this.x = v1.x; + this.y = v1.y; + this.z = v1.z; + this.w = r; + + this.normalize(); + + return this; + } + }(), + }; + + var mathUtil = MathUtil; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + var Util = window.Util || {}; + + Util.MIN_TIMESTEP = 0.001; + Util.MAX_TIMESTEP = 1; + + Util.base64 = function(mimeType, base64) { + return 'data:' + mimeType + ';base64,' + base64; + }; + + Util.clamp = function(value, min, max) { + return Math.min(Math.max(min, value), max); + }; + + Util.lerp = function(a, b, t) { + return a + ((b - a) * t); + }; + + /** + * Light polyfill for `Promise.race`. Returns + * a promise that resolves when the first promise + * provided resolves. + * + * @param {Array} promises + */ + Util.race = function(promises) { + if (Promise.race) { + return Promise.race(promises); + } + + return new Promise(function (resolve, reject) { + for (var i = 0; i < promises.length; i++) { + promises[i].then(resolve, reject); + } + }); + }; + + Util.isIOS = (function() { + var isIOS = /iPad|iPhone|iPod/.test(navigator.platform); + return function() { + return isIOS; + }; + })(); + + Util.isWebViewAndroid = (function() { + var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 && + navigator.userAgent.indexOf('Android') !== -1 && + navigator.userAgent.indexOf('Chrome') !== -1; + return function() { + return isWebViewAndroid; + }; + })(); + + Util.isSafari = (function() { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + return function() { + return isSafari; + }; + })(); + + Util.isFirefoxAndroid = (function() { + var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 && + navigator.userAgent.indexOf('Android') !== -1; + return function() { + return isFirefoxAndroid; + }; + })(); + + Util.isR7 = (function() { + var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1; + return function() { + return isR7; + }; + })(); + + Util.isLandscapeMode = function() { + var rtn = (window.orientation == 90 || window.orientation == -90); + return Util.isR7() ? !rtn : rtn; + }; + + // Helper method to validate the time steps of sensor timestamps. + Util.isTimestampDeltaValid = function(timestampDeltaS) { + if (isNaN(timestampDeltaS)) { + return false; + } + if (timestampDeltaS <= Util.MIN_TIMESTEP) { + return false; + } + if (timestampDeltaS > Util.MAX_TIMESTEP) { + return false; + } + return true; + }; + + Util.getScreenWidth = function() { + return Math.max(window.screen.width, window.screen.height) * + window.devicePixelRatio; + }; + + Util.getScreenHeight = function() { + return Math.min(window.screen.width, window.screen.height) * + window.devicePixelRatio; + }; + + Util.requestFullscreen = function(element) { + if (Util.isWebViewAndroid()) { + return false; + } + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else { + return false; + } + + return true; + }; + + Util.exitFullscreen = function() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else { + return false; + } + + return true; + }; + + Util.getFullscreenElement = function() { + return document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement; + }; + + Util.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) { + // No error checking for brevity. + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, vertexSource); + gl.compileShader(vertexShader); + + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, fragmentSource); + gl.compileShader(fragmentShader); + + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + + for (var attribName in attribLocationMap) + gl.bindAttribLocation(program, attribLocationMap[attribName], attribName); + + gl.linkProgram(program); + + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + + return program; + }; + + Util.getProgramUniforms = function(gl, program) { + var uniforms = {}; + var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + var uniformName = ''; + for (var i = 0; i < uniformCount; i++) { + var uniformInfo = gl.getActiveUniform(program, i); + uniformName = uniformInfo.name.replace('[0]', ''); + uniforms[uniformName] = gl.getUniformLocation(program, uniformName); + } + return uniforms; + }; + + Util.orthoMatrix = function (out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + }; + + Util.copyArray = function (source, dest) { + for (var i = 0, n = source.length; i < n; i++) { + dest[i] = source[i]; + } + }; + + Util.isMobile = function() { + var check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera); + return check; + }; + + Util.extend = function(dest, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dest[key] = src[key]; + } + } + + return dest; + }; + + Util.safariCssSizeWorkaround = function(canvas) { + // TODO(smus): Remove this workaround when Safari for iOS is fixed. + // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556). + // + // "To the last I grapple with thee; + // from hell's heart I stab at thee; + // for hate's sake I spit my last breath at thee." + // -- Moby Dick, by Herman Melville + if (Util.isIOS()) { + var width = canvas.style.width; + var height = canvas.style.height; + canvas.style.width = (parseInt(width) + 1) + 'px'; + canvas.style.height = (parseInt(height)) + 'px'; + setTimeout(function() { + canvas.style.width = width; + canvas.style.height = height; + }, 100); + } + + // Debug only. + window.Util = Util; + window.canvas = canvas; + }; + + Util.isDebug = function() { + return Util.getQueryParameter('debug'); + }; + + Util.getQueryParameter = function(name) { + var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); + }; + + Util.frameDataFromPose = (function() { + var piOver180 = Math.PI / 180.0; + var rad45 = Math.PI * 0.25; + + // Borrowed from glMatrix. + function mat4_perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45), + downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45), + leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45), + rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; + } + + function mat4_fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; + } + function mat4_translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; + } + function mat4_invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; + } + var defaultOrientation = new Float32Array([0, 0, 0, 1]); + var defaultPosition = new Float32Array([0, 0, 0]); + + function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) { + mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar); + + var orientation = pose.orientation || defaultOrientation; + var position = pose.position || defaultPosition; + + mat4_fromRotationTranslation(view, orientation, position); + if (parameters) + mat4_translate(view, view, parameters.offset); + mat4_invert(view, view); + } + + return function(frameData, pose, vrDisplay) { + if (!frameData || !pose) + return false; + + frameData.pose = pose; + frameData.timestamp = pose.timestamp; + + updateEyeMatrices( + frameData.leftProjectionMatrix, frameData.leftViewMatrix, + pose, vrDisplay.getEyeParameters("left"), vrDisplay); + updateEyeMatrices( + frameData.rightProjectionMatrix, frameData.rightViewMatrix, + pose, vrDisplay.getEyeParameters("right"), vrDisplay); + + return true; + }; + })(); + + Util.isInsideCrossDomainIFrame = function() { + var isFramed = (window.self !== window.top); + var refDomain = Util.getDomainFromUrl(document.referrer); + var thisDomain = Util.getDomainFromUrl(window.location.href); + + return isFramed && (refDomain !== thisDomain); + }; + + // From http://stackoverflow.com/a/23945027. + Util.getDomainFromUrl = function(url) { + var domain; + // Find & remove protocol (http, ftp, etc.) and get domain. + if (url.indexOf("://") > -1) { + domain = url.split('/')[2]; + } + else { + domain = url.split('/')[0]; + } + + //find & remove port number + domain = domain.split(':')[0]; + + return domain; + }; + + var util$1 = Util; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + /** + * Given an orientation and the gyroscope data, predicts the future orientation + * of the head. This makes rendering appear faster. + * + * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf + * + * @param {Number} predictionTimeS time from head movement to the appearance of + * the corresponding image. + */ + function PosePredictor(predictionTimeS) { + this.predictionTimeS = predictionTimeS; + + // The quaternion corresponding to the previous state. + this.previousQ = new mathUtil.Quaternion(); + // Previous time a prediction occurred. + this.previousTimestampS = null; + + // The delta quaternion that adjusts the current pose. + this.deltaQ = new mathUtil.Quaternion(); + // The output quaternion. + this.outQ = new mathUtil.Quaternion(); + } + + PosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) { + if (!this.previousTimestampS) { + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return currentQ; + } + + // Calculate axis and angle based on gyroscope rotation rate data. + var axis = new mathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + + var angularSpeed = gyro.length(); + + // If we're rotating slowly, don't do prediction. + if (angularSpeed < mathUtil.degToRad * 20) { + if (util$1.isDebug()) { + console.log('Moving slowly, at %s deg/s: no prediction', + (mathUtil.radToDeg * angularSpeed).toFixed(1)); + } + this.outQ.copy(currentQ); + this.previousQ.copy(currentQ); + return this.outQ; + } + + // Get the predicted angle based on the time delta and latency. + var deltaT = timestampS - this.previousTimestampS; + var predictAngle = angularSpeed * this.predictionTimeS; + + this.deltaQ.setFromAxisAngle(axis, predictAngle); + this.outQ.copy(this.previousQ); + this.outQ.multiply(this.deltaQ); + + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + + return this.outQ; + }; + + + var posePredictor = PosePredictor; + + /** + * Returns a number value indiciating the version of Chrome being used, + * or otherwise `null` if not on Chrome. + * + * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19 + */ + + /** + * In Chrome m65, `devicemotion` events are broken but subsequently fixed + * in 65.0.3325.148. Since many browsers use Chromium, ensure that + * we scope this detection by branch and build numbers to provide + * a proper fallback. + * https://github.com/immersive-web/webvr-polyfill/issues/307 + */ + + var version = -1; // It should not be null because it will be compared with number + + var branch = null; + var build = null; + var match = /Chrome\/([0-9]+)\.(?:[0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(userAgent); + + if (match) { + version = parseInt(match[1], 10); + branch = match[2]; + build = match[3]; + } + + var CHROME_VERSION = version; + var IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === "3325" && parseInt(build, 10) < 148; + var IS_ANDROID = /Android/i.test(userAgent); + var CONTROL_MODE_VR = 1; + var CONTROL_MODE_YAWPITCH = 2; + var TOUCH_DIRECTION_NONE = 1; + var TOUCH_DIRECTION_YAW = 2; + var TOUCH_DIRECTION_PITCH = 4; + var TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH; + /* Const for MovableCoord */ + + var MC_DECELERATION = 0.0014; + var MC_MAXIMUM_DURATION = 1000; + var MC_BIND_SCALE = [0.20, 0.20]; + var MAX_FIELD_OF_VIEW = 110; + var PAN_SCALE = 320; // const DELTA_THRESHOLD = 0.015; + + var YAW_RANGE_HALF = 180; + var PITCH_RANGE_HALF = 90; + var CIRCULAR_PITCH_RANGE_HALF = 180; + var GYRO_MODE = { + NONE: "none", + YAWPITCH: "yawPitch", + VR: "VR" + }; + + var STILLNESS_THRESHOLD = 200; // millisecond + + var DeviceMotion = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(DeviceMotion, _Component); + + function DeviceMotion() { + var _this; + + _this = _Component.call(this) || this; + _this._onDeviceMotion = _this._onDeviceMotion.bind(_assertThisInitialized(_this)); + _this._onDeviceOrientation = _this._onDeviceOrientation.bind(_assertThisInitialized(_this)); + _this._onChromeWithoutDeviceMotion = _this._onChromeWithoutDeviceMotion.bind(_assertThisInitialized(_this)); + _this.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION; + _this.isAndroid = IS_ANDROID; + _this.stillGyroVec = glMatrix.vec3.create(); + _this.rawGyroVec = glMatrix.vec3.create(); + _this.adjustedGyroVec = glMatrix.vec3.create(); + _this._timer = null; + _this.lastDevicemotionTimestamp = 0; + _this._isEnabled = false; + + _this.enable(); + + return _this; + } + + var _proto = DeviceMotion.prototype; + + _proto._onChromeWithoutDeviceMotion = function _onChromeWithoutDeviceMotion(e) { + var alpha = e.alpha, + beta = e.beta, + gamma = e.gamma; // There is deviceorientation event trigged with empty values + // on Headless Chrome. + + if (alpha === null) { + return; + } // convert to radian + + + alpha = (alpha || 0) * Math.PI / 180; + beta = (beta || 0) * Math.PI / 180; + gamma = (gamma || 0) * Math.PI / 180; + this.trigger("devicemotion", { + inputEvent: { + deviceorientation: { + alpha: alpha, + beta: beta, + gamma: -gamma + } + } + }); + }; + + _proto._onDeviceOrientation = function _onDeviceOrientation() { + var _this2 = this; + + this._timer && clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (new Date().getTime() - _this2.lastDevicemotionTimestamp < STILLNESS_THRESHOLD) { + glMatrix.vec3.copy(_this2.stillGyroVec, _this2.rawGyroVec); + } + }, STILLNESS_THRESHOLD); + }; + + _proto._onDeviceMotion = function _onDeviceMotion(e) { + // desktop chrome triggers devicemotion event with empthy sensor values. + // Those events should ignored. + var isGyroSensorAvailable = !(e.rotationRate.alpha == null); + var isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null); + + if (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) { + return; + } + + var devicemotionEvent = _extends({}, e); + + devicemotionEvent.interval = e.interval; + devicemotionEvent.timeStamp = e.timeStamp; + devicemotionEvent.type = e.type; + devicemotionEvent.rotationRate = { + alpha: e.rotationRate.alpha, + beta: e.rotationRate.beta, + gamma: e.rotationRate.gamma + }; + devicemotionEvent.accelerationIncludingGravity = { + x: e.accelerationIncludingGravity.x, + y: e.accelerationIncludingGravity.y, + z: e.accelerationIncludingGravity.z + }; + devicemotionEvent.acceleration = { + x: e.acceleration.x, + y: e.acceleration.y, + z: e.acceleration.z + }; + + if (this.isAndroid) { + glMatrix.vec3.set(this.rawGyroVec, e.rotationRate.alpha || 0, e.rotationRate.beta || 0, e.rotationRate.gamma || 0); + glMatrix.vec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec); + this.lastDevicemotionTimestamp = new Date().getTime(); + devicemotionEvent.adjustedRotationRate = { + alpha: this.adjustedGyroVec[0], + beta: this.adjustedGyroVec[1], + gamma: this.adjustedGyroVec[2] + }; + } + + this.trigger("devicemotion", { + inputEvent: devicemotionEvent + }); + }; + + _proto.enable = function enable() { + if (this.isAndroid) { + win.addEventListener("deviceorientation", this._onDeviceOrientation); + } + + if (this.isWithoutDeviceMotion) { + win.addEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + } else { + win.addEventListener("devicemotion", this._onDeviceMotion); + } + + this._isEnabled = true; + }; + + _proto.disable = function disable() { + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + win.removeEventListener("devicemotion", this._onDeviceMotion); + this._isEnabled = false; + }; + + return DeviceMotion; + }(Component); + + function SensorSample(sample, timestampS) { + this.set(sample, timestampS); + } + SensorSample.prototype.set = function(sample, timestampS) { + this.sample = sample; + this.timestampS = timestampS; + }; + + SensorSample.prototype.copy = function(sensorSample) { + this.set(sensorSample.sample, sensorSample.timestampS); + }; + + var sensorSample = SensorSample; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + /** + * An implementation of a simple complementary filter, which fuses gyroscope and + * accelerometer data from the 'devicemotion' event. + * + * Accelerometer data is very noisy, but stable over the long term. + * Gyroscope data is smooth, but tends to drift over the long term. + * + * This fusion is relatively simple: + * 1. Get orientation estimates from accelerometer by applying a low-pass filter + * on that data. + * 2. Get orientation estimates from gyroscope by integrating over time. + * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the + * short term. + */ + function ComplementaryFilter(kFilter) { + this.kFilter = kFilter; + + // Raw sensor measurements. + this.currentAccelMeasurement = new sensorSample(); + this.currentGyroMeasurement = new sensorSample(); + this.previousGyroMeasurement = new sensorSample(); + + // Set default look direction to be in the correct direction. + if (util$1.isIOS()) { + this.filterQ = new mathUtil.Quaternion(-1, 0, 0, 1); + } else { + this.filterQ = new mathUtil.Quaternion(1, 0, 0, 1); + } + this.previousFilterQ = new mathUtil.Quaternion(); + this.previousFilterQ.copy(this.filterQ); + + // Orientation based on the accelerometer. + this.accelQ = new mathUtil.Quaternion(); + // Whether or not the orientation has been initialized. + this.isOrientationInitialized = false; + // Running estimate of gravity based on the current orientation. + this.estimatedGravity = new mathUtil.Vector3(); + // Measured gravity based on accelerometer. + this.measuredGravity = new mathUtil.Vector3(); + + // Debug only quaternion of gyro-based orientation. + this.gyroIntegralQ = new mathUtil.Quaternion(); + } + + ComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) { + this.currentAccelMeasurement.set(vector, timestampS); + }; + + ComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) { + this.currentGyroMeasurement.set(vector, timestampS); + + var deltaT = timestampS - this.previousGyroMeasurement.timestampS; + if (util$1.isTimestampDeltaValid(deltaT)) { + this.run_(); + } + + this.previousGyroMeasurement.copy(this.currentGyroMeasurement); + }; + + ComplementaryFilter.prototype.run_ = function() { + + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - + this.previousGyroMeasurement.timestampS; + + // Convert gyro rotation vector to a quaternion delta. + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); + + // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); + + // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + var invFilterQ = new mathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); + + // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + var deltaQ = new mathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); + + if (util$1.isDebug()) { + console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)', + mathUtil.radToDeg * util$1.getQuaternionAngle(deltaQ), + (this.estimatedGravity.x).toFixed(1), + (this.estimatedGravity.y).toFixed(1), + (this.estimatedGravity.z).toFixed(1), + (this.measuredGravity.x).toFixed(1), + (this.measuredGravity.y).toFixed(1), + (this.measuredGravity.z).toFixed(1)); + } + + // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + var targetQ = new mathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); + + // SLERP factor: 0 is pure gyro, 1 is pure accel. + this.filterQ.slerp(targetQ, 1 - this.kFilter); + + this.previousFilterQ.copy(this.filterQ); + }; + + ComplementaryFilter.prototype.getOrientation = function() { + return this.filterQ; + }; + + ComplementaryFilter.prototype.accelToQuaternion_ = function(accel) { + var normAccel = new mathUtil.Vector3(); + normAccel.copy(accel); + normAccel.normalize(); + var quat = new mathUtil.Quaternion(); + quat.setFromUnitVectors(new mathUtil.Vector3(0, 0, -1), normAccel); + quat.inverse(); + return quat; + }; + + ComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) { + // Extract axis and angle from the gyroscope data. + var quat = new mathUtil.Quaternion(); + var axis = new mathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + quat.setFromAxisAngle(axis, gyro.length() * dt); + return quat; + }; + + + var complementaryFilter = ComplementaryFilter; + + complementaryFilter.prototype.run_ = function () { + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - this.previousGyroMeasurement.timestampS; // Convert gyro rotation vector to a quaternion delta. + + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + + var invFilterQ = new mathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + + var deltaQ = new mathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + + var targetQ = new mathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); // SLERP factor: 0 is pure gyro, 1 is pure accel. + + this.filterQ.slerp(targetQ, 1 - this.kFilter); + this.previousFilterQ.copy(this.filterQ); + + if (!this.isFilterQuaternionInitialized) { + this.isFilterQuaternionInitialized = true; + } + }; + + complementaryFilter.prototype.getOrientation = function () { + if (this.isFilterQuaternionInitialized) { + return this.filterQ; + } else { + return null; + } + }; + + var K_FILTER = 0.98; + var PREDICTION_TIME_S = 0.040; + + var FusionPoseSensor = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(FusionPoseSensor, _Component); + + function FusionPoseSensor() { + var _this; + + _this = _Component.call(this) || this; + _this.deviceMotion = new DeviceMotion(); + _this.accelerometer = new mathUtil.Vector3(); + _this.gyroscope = new mathUtil.Vector3(); + _this._onDeviceMotionChange = _this._onDeviceMotionChange.bind(_assertThisInitialized(_this)); + _this._onScreenOrientationChange = _this._onScreenOrientationChange.bind(_assertThisInitialized(_this)); + _this.filter = new complementaryFilter(K_FILTER); + _this.posePredictor = new posePredictor(PREDICTION_TIME_S); + _this.filterToWorldQ = new mathUtil.Quaternion(); + _this.isFirefoxAndroid = util$1.isFirefoxAndroid(); // This includes iPhone & iPad(both desktop and mobile mode) ref #326 + + _this.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP; // Ref https://github.com/immersive-web/cardboard-vr-display/issues/18 + + _this.isChromeUsingDegrees = CHROME_VERSION >= 66; + _this._isEnabled = false; // Set the filter to world transform, depending on OS. + + if (_this.isIOS) { + _this.filterToWorldQ.setFromAxisAngle(new mathUtil.Vector3(1, 0, 0), Math.PI / 2); + } else { + _this.filterToWorldQ.setFromAxisAngle(new mathUtil.Vector3(1, 0, 0), -Math.PI / 2); + } + + _this.inverseWorldToScreenQ = new mathUtil.Quaternion(); + _this.worldToScreenQ = new mathUtil.Quaternion(); + _this.originalPoseAdjustQ = new mathUtil.Quaternion(); + + _this.originalPoseAdjustQ.setFromAxisAngle(new mathUtil.Vector3(0, 0, 1), -win.orientation * Math.PI / 180); + + _this._setScreenTransform(); // Adjust this filter for being in landscape mode. + + + if (util$1.isLandscapeMode()) { + _this.filterToWorldQ.multiply(_this.inverseWorldToScreenQ); + } // Keep track of a reset transform for resetSensor. + + + _this.resetQ = new mathUtil.Quaternion(); + + _this.deviceMotion.on("devicemotion", _this._onDeviceMotionChange); + + _this.enable(); + + return _this; + } + + var _proto = FusionPoseSensor.prototype; + + _proto.enable = function enable() { + if (this.isEnabled()) { + return; + } + + this.deviceMotion.enable(); + this._isEnabled = true; + win.addEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.disable = function disable() { + if (!this.isEnabled()) { + return; + } + + this.deviceMotion.disable(); + this._isEnabled = false; + win.removeEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.isEnabled = function isEnabled() { + return this._isEnabled; + }; + + _proto.destroy = function destroy() { + this.disable(); + this.deviceMotion = null; + }; + + _proto._triggerChange = function _triggerChange() { + var orientation = this.getOrientation(); // if orientation is not prepared. don't trigger change event + + if (!orientation) { + return; + } + + if (!this._prevOrientation) { + this._prevOrientation = orientation; + return; + } + + if (glMatrix.quat.equals(this._prevOrientation, orientation)) { + return; + } + + this.trigger("change", { + quaternion: orientation + }); + }; + + _proto.getOrientation = function getOrientation() { + var _this2 = this; + + var orientation; // Hack around using deviceorientation instead of devicemotion + + if (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) { + this.deviceOrientationFixQ = this.deviceOrientationFixQ || function () { + var y = new mathUtil.Quaternion().setFromAxisAngle(new mathUtil.Vector3(0, 1, 0), -_this2._alpha); + return y; + }(); + + orientation = this._deviceOrientationQ; + var out = new mathUtil.Quaternion(); + out.copy(orientation); + out.multiply(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.worldToScreenQ); + out.multiplyQuaternions(this.deviceOrientationFixQ, out); // return quaternion as glmatrix quaternion object + + var out_ = glMatrix.quat.fromValues(out.x, out.y, out.z, out.w); + return glMatrix.quat.normalize(out_, out_); + } else { + // Convert from filter space to the the same system used by the + // deviceorientation event. + orientation = this.filter.getOrientation(); + + if (!orientation) { + return null; + } + + var _out = this._convertFusionToPredicted(orientation); // return quaternion as glmatrix quaternion object + + + var _out_ = glMatrix.quat.fromValues(_out.x, _out.y, _out.z, _out.w); + + return glMatrix.quat.normalize(_out_, _out_); + } + }; + + _proto._convertFusionToPredicted = function _convertFusionToPredicted(orientation) { + // Predict orientation. + this.predictedQ = this.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS); // Convert to THREE coordinate system: -Z forward, Y up, X right. + + var out = new mathUtil.Quaternion(); + out.copy(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.predictedQ); + out.multiply(this.worldToScreenQ); + return out; + }; + + _proto._onDeviceMotionChange = function _onDeviceMotionChange(_ref) { + var inputEvent = _ref.inputEvent; + var deviceorientation = inputEvent.deviceorientation; + var deviceMotion = inputEvent; + var accGravity = deviceMotion.accelerationIncludingGravity; + var rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate; + var timestampS = deviceMotion.timeStamp / 1000; + + if (deviceorientation) { + if (!this._alpha) { + this._alpha = deviceorientation.alpha; + } + + this._deviceOrientationQ = this._deviceOrientationQ || new mathUtil.Quaternion(); + + this._deviceOrientationQ.setFromEulerYXZ(deviceorientation.beta, deviceorientation.alpha, deviceorientation.gamma); + + this._triggerChange(); + } else { + // Firefox Android timeStamp returns one thousandth of a millisecond. + if (this.isFirefoxAndroid) { + timestampS /= 1000; + } + + this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); + this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); // Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate` + // is reported in degrees, so we first convert to radians. + + if (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) { + this.gyroscope.multiplyScalar(Math.PI / 180); + } + + this.filter.addAccelMeasurement(this.accelerometer, timestampS); + this.filter.addGyroMeasurement(this.gyroscope, timestampS); + + this._triggerChange(); + + this.previousTimestampS = timestampS; + } + }; + + _proto._onScreenOrientationChange = function _onScreenOrientationChange(screenOrientation) { + this._setScreenTransform(win.orientation); + }; + + _proto._setScreenTransform = function _setScreenTransform() { + this.worldToScreenQ.set(0, 0, 0, 1); + var orientation = win.orientation; + + switch (orientation) { + case 0: + break; + + case 90: + case -90: + case 180: + this.worldToScreenQ.setFromAxisAngle(new mathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI); + break; + + default: + break; + } + + this.inverseWorldToScreenQ.copy(this.worldToScreenQ); + this.inverseWorldToScreenQ.inverse(); + }; + + return FusionPoseSensor; + }(Component); + + function getDeltaYaw$1(prvQ, curQ) { + var yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW); + var yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) * Math.sin(util.extractPitchFromQuat(curQ)); + return yawDeltaByRoll + yawDeltaByYaw; + } + + function getDeltaPitch$1(prvQ, curQ) { + var pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA); + return pitchDelta; + } + + var TiltMotionInput = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(TiltMotionInput, _Component); + + function TiltMotionInput(el, options) { + var _this; + + _this = _Component.call(this) || this; + _this.element = el; + _this._prevQuaternion = null; + _this._quaternion = null; + _this.fusionPoseSensor = null; + _this.options = _extends({ + scale: 1, + threshold: 0 + }, options); + _this._onPoseChange = _this._onPoseChange.bind(_assertThisInitialized(_this)); + return _this; + } + + var _proto = TiltMotionInput.prototype; + + _proto.mapAxes = function mapAxes(axes) { + this.axes = axes; + }; + + _proto.connect = function connect(observer) { + if (this.observer) { + return this; + } + + this.observer = observer; + this.fusionPoseSensor = new FusionPoseSensor(); + this.fusionPoseSensor.enable(); + + this._attachEvent(); + + return this; + }; + + _proto.disconnect = function disconnect() { + if (!this.observer) { + return this; + } + + this._dettachEvent(); + + this.fusionPoseSensor.disable(); + this.fusionPoseSensor.destroy(); + this.fusionPoseSensor = null; + this.observer = null; + return this; + }; + + _proto.destroy = function destroy() { + this.disconnect(); + this.element = null; + this.options = null; + this.axes = null; + this._prevQuaternion = null; + this._quaternion = null; + }; + + _proto._onPoseChange = function _onPoseChange(event) { + if (!this._prevQuaternion) { + this._prevQuaternion = glMatrix.quat.clone(event.quaternion); + this._quaternion = glMatrix.quat.clone(event.quaternion); + return; + } + + glMatrix.quat.copy(this._prevQuaternion, this._quaternion); + glMatrix.quat.copy(this._quaternion, event.quaternion); + this.observer.change(this, event, toAxis(this.axes, [getDeltaYaw$1(this._prevQuaternion, this._quaternion), getDeltaPitch$1(this._prevQuaternion, this._quaternion)])); + }; + + _proto._attachEvent = function _attachEvent() { + this.fusionPoseSensor.on("change", this._onPoseChange); + }; + + _proto._dettachEvent = function _dettachEvent() { + this.fusionPoseSensor.off("change", this._onPoseChange); + }; + + return TiltMotionInput; + }(Component); + + var screenRotationAngleInst = null; + var refCount = 0; + + var ScreenRotationAngle = + /*#__PURE__*/ + function () { + function ScreenRotationAngle() { + refCount++; + + if (screenRotationAngleInst) { + return screenRotationAngleInst; + } + /* eslint-disable */ + + + screenRotationAngleInst = this; + /* eslint-enable */ + + this._onDeviceOrientation = this._onDeviceOrientation.bind(this); + this._onOrientationChange = this._onOrientationChange.bind(this); + this._spinR = 0; + this._screenOrientationAngle = 0; + win.addEventListener("deviceorientation", this._onDeviceOrientation); + win.addEventListener("orientationchange", this._onOrientationChange); + } + + var _proto = ScreenRotationAngle.prototype; + + _proto._onDeviceOrientation = function _onDeviceOrientation(e) { + if (e.beta === null || e.gamma === null) { + // (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it. + return; + } // Radian + + + var betaR = glMatrix.glMatrix.toRadian(e.beta); + var gammaR = glMatrix.glMatrix.toRadian(e.gamma); + /* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */ + + this._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR)); + }; + + _proto._onOrientationChange = function _onOrientationChange(e) { + if (win.screen && win.screen.orientation && win.screen.orientation.angle !== undefined) { + this._screenOrientationAngle = screen.orientation.angle; + } else if (win.orientation !== undefined) { + /* iOS */ + this._screenOrientationAngle = win.orientation >= 0 ? win.orientation : 360 + win.orientation; + } + }; + + _proto.getRadian = function getRadian() { + // Join with screen orientation + // this._testVal = this._spinR + ", " + this._screenOrientationAngle + ", " + window.orientation; + return this._spinR + glMatrix.glMatrix.toRadian(this._screenOrientationAngle); + }; + + _proto.unref = function unref() { + if (--refCount > 0) { + return; + } + + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("orientationchange", this._onOrientationChange); + this._spinR = 0; + this._screenOrientationAngle = 0; + /* eslint-disable */ + + screenRotationAngleInst = null; + /* eslint-enable */ + + refCount = 0; + }; + + return ScreenRotationAngle; + }(); + + /** + * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle. + * + * The reason for using this function is that in VR mode, + * the roll angle is adjusted in the direction opposite to the screen rotation angle. + * + * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move. + * @extends PanInput + */ + + var RotationPanInput = + /*#__PURE__*/ + function (_PanInput) { + _inheritsLoose(RotationPanInput, _PanInput); + + /** + * Constructor + * + * @private + * @param {HTMLElement} el target element + * @param {Object} [options] The option object + * @param {Boolean} [options.useRotation] Whether to use rotation(or VR) + */ + function RotationPanInput(el, options) { + var _this; + + _this = _PanInput.call(this, el, options) || this; + _this._useRotation = false; + _this._screenRotationAngle = null; + + _this.setUseRotation(!!(options && options.useRotation)); + + _this._userDirection = Axes.DIRECTION_ALL; + return _this; + } + + var _proto = RotationPanInput.prototype; + + _proto.setUseRotation = function setUseRotation(useRotation) { + this._useRotation = useRotation; + + if (this._screenRotationAngle) { + this._screenRotationAngle.unref(); + + this._screenRotationAngle = null; + } + + if (this._useRotation) { + this._screenRotationAngle = new ScreenRotationAngle(); + } + }; + + _proto.connect = function connect(observer) { + // User intetened direction + this._userDirection = this._direction; // In VR Mode, Use ALL direction if direction is not none + // Because horizontal and vertical is changed dynamically by screen rotation. + // this._direction is used to initialize hammerjs + + if (this._useRotation && this._direction & Axes.DIRECTION_ALL) { + this._direction = Axes.DIRECTION_HORIZONTAL; + } + + _PanInput.prototype.connect.call(this, observer); + }; + + _proto.getOffset = function getOffset(properties, useDirection) { + if (this._useRotation === false) { + return _PanInput.prototype.getOffset.call(this, properties, useDirection); + } + + var offset = _PanInput.prototype.getOffset.call(this, properties, [true, true]); + + var newOffset = [0, 0]; + + var theta = this._screenRotationAngle.getRadian(); + + var cosTheta = Math.cos(theta); + var sinTheta = Math.sin(theta); // RotateZ + + newOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta; + newOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta; // Use only user allowed direction. + + if (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) { + newOffset[0] = 0; + } else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) { + newOffset[1] = 0; + } + + return newOffset; + }; + + _proto.destroy = function destroy() { + if (this._useRotation) { + this._screenRotationAngle && this._screenRotationAngle.unref(); + } + + _PanInput.prototype.destroy.call(this); + }; + + return RotationPanInput; + }(Axes.PanInput); + + var Y_AXIS_VECTOR = glMatrix.vec3.fromValues(0, 1, 0); + + var DeviceQuaternion = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(DeviceQuaternion, _Component); + + function DeviceQuaternion() { + var _this; + + _this = _Component.call(this) || this; + _this._fusionPoseSensor = new FusionPoseSensor(); + _this._quaternion = glMatrix.quat.create(); + + _this._fusionPoseSensor.enable(); + + _this._fusionPoseSensor.on("change", function (e) { + _this._quaternion = e.quaternion; + + _this.trigger("change", { + isTrusted: true + }); + }); + + return _this; + } + + var _proto = DeviceQuaternion.prototype; + + _proto.getCombinedQuaternion = function getCombinedQuaternion(yaw) { + var yawQ = glMatrix.quat.setAxisAngle(glMatrix.quat.create(), Y_AXIS_VECTOR, glMatrix.glMatrix.toRadian(-yaw)); + var conj = glMatrix.quat.conjugate(glMatrix.quat.create(), this._quaternion); // Multiply pitch quaternion -> device quaternion -> yaw quaternion + + var outQ = glMatrix.quat.multiply(glMatrix.quat.create(), conj, yawQ); + return outQ; + }; + + _proto.destroy = function destroy() { + // detach all event handler + this.off(); + + if (this._fusionPoseSensor) { + this._fusionPoseSensor.off(); + + this._fusionPoseSensor.destroy(); + + this._fusionPoseSensor = null; + } + }; + + return DeviceQuaternion; + }(Component); + + var VERSION = "3.3.3"; + + var DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF]; + var DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF]; + var CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF]; + /** + * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates. + * + * @alias eg.YawPitchControl + * @extends eg.Component + * + * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + */ + + var YawPitchControl = + /*#__PURE__*/ + function () { + var YawPitchControl = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(YawPitchControl, _Component); + + // Expose DeviceOrientationControls sub module for test purpose + + /** + * @param {Object} options The option object of the eg.YawPitch module + * @param {Element}[options.element=null] element A base element for the eg.YawPitch module + * @param {Number} [options.yaw=0] initial yaw (degree) + * @param {Number} [options.pitch=0] initial pitch (degree) + * @param {Number} [options.fov=65] initial field of view (degree) + * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown + * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available + * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. + * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move) + * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw + * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch + * @param {Array} [options.fovRange=[30, 110] Range of FOV + * @param {Number} [options.aspectRatio=1] Aspect Ratio + */ + function YawPitchControl(options) { + var _this; + + _this = _Component.call(this) || this; + + var opt = _extends({ + element: null, + yaw: 0, + pitch: 0, + fov: 65, + showPolePoint: false, + useZoom: true, + useKeyboard: true, + gyroMode: GYRO_MODE.YAWPITCH, + touchDirection: TOUCH_DIRECTION_ALL, + yawRange: DEFAULT_YAW_RANGE, + pitchRange: DEFAULT_PITCH_RANGE, + fovRange: [30, 110], + aspectRatio: 1 + /* TODO: Need Mandatory? */ + + }, options); + + _this._element = opt.element; + _this._initialFov = opt.fov; + _this._enabled = false; + _this._isAnimating = false; + _this._deviceQuaternion = null; + + _this._initAxes(opt); + + _this.option(opt); + + return _this; + } + + var _proto = YawPitchControl.prototype; + + _proto._initAxes = function _initAxes(opt) { + var _this2 = this; + + var yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio); + + var pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint); + + var useRotation = opt.gyroMode === GYRO_MODE.VR; + this.axesPanInput = new RotationPanInput(this._element, { + useRotation: useRotation + }); + this.axesWheelInput = new Axes.WheelInput(this._element, { + scale: -4 + }); + this.axesTiltMotionInput = null; + this.axesPinchInput = SUPPORT_TOUCH ? new Axes.PinchInput(this._element, { + scale: -1 + }) : null; + this.axesMoveKeyInput = new Axes.MoveKeyInput(this._element, { + scale: [-6, 6] + }); + this.axes = new Axes({ + yaw: { + range: yRange, + circular: YawPitchControl.isCircular(yRange), + bounce: [0, 0] + }, + pitch: { + range: pRange, + circular: YawPitchControl.isCircular(pRange), + bounce: [0, 0] + }, + fov: { + range: opt.fovRange, + circular: [false, false], + bounce: [0, 0] + } + }, { + deceleration: MC_DECELERATION, + maximumDuration: MC_MAXIMUM_DURATION + }, { + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }).on({ + hold: function hold(evt) { + // Restore maximumDuration not to be spin too mush. + _this2.axes.options.maximumDuration = MC_MAXIMUM_DURATION; + + _this2.trigger("hold", { + isTrusted: evt.isTrusted + }); + }, + change: function change(evt) { + if (evt.delta.fov !== 0) { + _this2._updateControlScale(evt); + + _this2.updatePanScale(); + } + + _this2._triggerChange(evt); + }, + release: function release(evt) { + _this2._triggerChange(evt); + }, + animationStart: function animationStart(evt) {}, + animationEnd: function animationEnd(evt) { + _this2.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + } + /** + * Update Pan Scale + * + * Scale(Sensitivity) values of panning is related with fov and height. + * If at least one of them is changed, this function need to be called. + * @param {*} param + */ + ; + + _proto.updatePanScale = function updatePanScale(param) { + if (param === void 0) { + param = {}; + } + + var fov = this.axes.get().fov; + var areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10); + var scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight; + this.axesPanInput.options.scale = [scale, scale]; + this.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW; + return this; + } + /* + * Override component's option method + * to call method for updating values which is affected by option change. + * + * @param {*} args + */ + ; + + _proto.option = function option() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var argLen = args.length; // Getter + + if (argLen === 0) { + return this._getOptions(); + } else if (argLen === 1 && typeof args[0] === "string") { + return this._getOptions(args[0]); + } // Setter + + + var beforeOptions = _extends({}, this.options); + + var newOptions = {}; + var changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList. + + if (argLen === 1) { + changedKeyList = Object.keys(args[0]); + newOptions = _extends({}, args[0]); + } else if (argLen >= 2) { + changedKeyList.push(args[0]); + newOptions[args[0]] = args[1]; + } + + this._setOptions(this._getValidatedOptions(newOptions)); + + this._applyOptions(changedKeyList, beforeOptions); + + return this; + }; + + _proto._getValidatedOptions = function _getValidatedOptions(newOptions) { + if (newOptions.yawRange) { + newOptions.yawRange = this._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio); + } + + if (newOptions.pitchRange) { + newOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov); + } + + return newOptions; + }; + + _proto._getOptions = function _getOptions(key) { + var value; + + if (typeof key === "string") { + value = this.options[key]; + } else if (arguments.length === 0) { + value = this.options; + } + + return value; + }; + + _proto._setOptions = function _setOptions(options) { + for (var key in options) { + this.options[key] = options[key]; + } + }; + + _proto._applyOptions = function _applyOptions(keys, prevOptions) { + var options = this.options; + var axes = this.axes; + var isVR = options.gyroMode === GYRO_MODE.VR; + var isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH; // If it's VR mode, restrict user interaction to yaw direction only + + var touchDirection = isVR ? TOUCH_DIRECTION_YAW & options.touchDirection : options.touchDirection; // If one of below is changed, call updateControlScale() + + if (keys.some(function (key) { + return key === "showPolePoint" || key === "fov" || key === "aspectRatio" || key === "yawRange" || key === "pitchRange"; + })) { + // If fov is changed, update pan scale + if (keys.indexOf("fov") >= 0) { + axes.setTo({ + "fov": options.fov + }); + this.updatePanScale(); + } + + this._updateControlScale(); + } + + if (keys.some(function (key) { + return key === "fovRange"; + })) { + var fovRange = options.fovRange; + var prevFov = axes.get().fov; + var nextFov = axes.get().fov; + glMatrix.vec2.copy(axes.axis.fov.range, fovRange); + + if (nextFov < fovRange[0]) { + nextFov = fovRange[0]; + } else if (prevFov > fovRange[1]) { + nextFov = fovRange[1]; + } + + if (prevFov !== nextFov) { + axes.setTo({ + fov: nextFov + }, 0); + + this._updateControlScale(); + + this.updatePanScale(); + } + } + + if (keys.some(function (key) { + return key === "gyroMode"; + }) && SUPPORT_DEVICEMOTION) { + // Disconnect first + if (this.axesTiltMotionInput) { + this.axes.disconnect(this.axesTiltMotionInput); + this.axesTiltMotionInput.destroy(); + this.axesTiltMotionInput = null; + } + + if (this._deviceQuaternion) { + this._deviceQuaternion.destroy(); + + this._deviceQuaternion = null; + } + + if (isVR) { + this._initDeviceQuaternion(); + } else if (isYawPitch) { + this.axesTiltMotionInput = new TiltMotionInput(this._element); + this.axes.connect(["yaw", "pitch"], this.axesTiltMotionInput); + } + + this.axesPanInput.setUseRotation(isVR); + } + + if (keys.some(function (key) { + return key === "useKeyboard"; + })) { + var useKeyboard = options.useKeyboard; + + if (useKeyboard) { + axes.connect(["yaw", "pitch"], this.axesMoveKeyInput); + } else { + axes.disconnect(this.axesMoveKeyInput); + } + } + + if (keys.some(function (key) { + return key === "useZoom"; + })) { + var useZoom = options.useZoom; // Disconnect first + + axes.disconnect(this.axesWheelInput); + + if (useZoom) { + axes.connect(["fov"], this.axesWheelInput); + } + } + + this._togglePinchInputByOption(options.touchDirection, options.useZoom); + + if (keys.some(function (key) { + return key === "touchDirection"; + })) { + this._enabled && this._enableTouch(touchDirection); + } + }; + + _proto._togglePinchInputByOption = function _togglePinchInputByOption(touchDirection, useZoom) { + if (this.axesPinchInput) { + // disconnect first + this.axes.disconnect(this.axesPinchInput); // If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll. + + if (useZoom && touchDirection === TOUCH_DIRECTION_ALL && // TODO: Get rid of using private property of axes instance. + this.axes._inputs.indexOf(this.axesPinchInput) === -1) { + this.axes.connect(["fov"], this.axesPinchInput); + } + } + }; + + _proto._enableTouch = function _enableTouch(direction) { + // Disconnect first + this.axesPanInput && this.axes.disconnect(this.axesPanInput); + var yawEnabled = direction & TOUCH_DIRECTION_YAW ? "yaw" : null; + var pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? "pitch" : null; + this.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput); + }; + + _proto._initDeviceQuaternion = function _initDeviceQuaternion() { + var _this3 = this; + + this._deviceQuaternion = new DeviceQuaternion(); + + this._deviceQuaternion.on("change", function (e) { + _this3._triggerChange(e); + }); + }; + + _proto._getValidYawRange = function _getValidYawRange(newYawRange, newFov, newAspectRatio) { + var ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1); + var fov = newFov || this.axes.get().fov; + var horizontalFov = fov * ratio; + var isValid = newYawRange[1] - newYawRange[0] >= horizontalFov; + + if (isValid) { + return newYawRange; + } else { + return this.options.yawRange || DEFAULT_YAW_RANGE; + } + }; + + _proto._getValidPitchRange = function _getValidPitchRange(newPitchRange, newFov) { + var fov = newFov || this.axes.get().fov; + var isValid = newPitchRange[1] - newPitchRange[0] >= fov; + + if (isValid) { + return newPitchRange; + } else { + return this.options.pitchRange || DEFAULT_PITCH_RANGE; + } + }; + + YawPitchControl.isCircular = function isCircular(range) { + return range[1] - range[0] < 360 ? [false, false] : [true, true]; + } + /** + * Update yaw/pitch min/max by 5 factor + * + * 1. showPolePoint + * 2. fov + * 3. yawRange + * 4. pitchRange + * 5. aspectRatio + * + * If one of above is changed, call this function + */ + ; + + _proto._updateControlScale = function _updateControlScale(changeEvt) { + var opt = this.options; + var fov = this.axes.get().fov; + + var pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint); + + var yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio); // TODO: If not changed!? + + + var pos = this.axes.get(); + var y = pos.yaw; + var p = pos.pitch; + glMatrix.vec2.copy(this.axes.axis.yaw.range, yRange); + glMatrix.vec2.copy(this.axes.axis.pitch.range, pRange); + this.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange); + this.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange); + /** + * update yaw/pitch by it's range. + */ + + if (y < yRange[0]) { + y = yRange[0]; + } else if (y > yRange[1]) { + y = yRange[1]; + } + + if (p < pRange[0]) { + p = pRange[0]; + } else if (p > pRange[1]) { + p = pRange[1]; + } + + if (changeEvt) { + changeEvt.set({ + yaw: y, + pitch: p + }); + } + + this.axes.setTo({ + yaw: y, + pitch: p + }, 0); + return this; + }; + + _proto._updatePitchRange = function _updatePitchRange(pitchRange, fov, showPolePoint) { + if (this.options.gyroMode === GYRO_MODE.VR) { + // Circular pitch on VR + return CIRCULAR_PITCH_RANGE; + } + + var verticalAngle = pitchRange[1] - pitchRange[0]; + var halfFov = fov / 2; + var isPanorama = verticalAngle < 180; + + if (showPolePoint && !isPanorama) { + // Use full pinch range + return pitchRange.concat(); + } // Round value as movableCood do. + + + return [pitchRange[0] + halfFov, pitchRange[1] - halfFov]; + }; + + _proto._updateYawRange = function _updateYawRange(yawRange, fov, aspectRatio) { + if (this.options.gyroMode === GYRO_MODE.VR) { + return DEFAULT_YAW_RANGE; + } + + var horizontalAngle = yawRange[1] - yawRange[0]; + /** + * Full 360 Mode + */ + + if (horizontalAngle >= 360) { + // Don't limit yaw range on Full 360 mode. + return yawRange.concat(); + } + /** + * Panorama mode + */ + // Ref : https://github.com/naver/egjs-view360/issues/290 + + + var halfHorizontalFov = util.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.glMatrix.toRadian(fov / 2)))); // Round value as movableCood do. + + return [yawRange[0] + halfHorizontalFov, yawRange[1] - halfHorizontalFov]; + }; + + _proto._triggerChange = function _triggerChange(evt) { + var pos = this.axes.get(); + var opt = this.options; + var event = { + targetElement: opt.element, + isTrusted: evt.isTrusted + }; + event.yaw = pos.yaw; + event.pitch = pos.pitch; + event.fov = pos.fov; + + if (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) { + event.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + } + + this.trigger("change", event); + } // TODO: makes constant to be logic + ; + + YawPitchControl.adjustAspectRatio = function adjustAspectRatio(input) { + var inputRange = [0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670, 0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19, 1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26, 2.30, 2.60, 3.00, 5.00, 6.00]; + var outputRange = [0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710, 0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15, 1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72, 1.82, 1.92, 2.00, 2.24, 2.30]; + var rangeIdx = -1; + + for (var i = 0; i < inputRange.length - 1; i++) { + if (inputRange[i] <= input && inputRange[i + 1] >= input) { + rangeIdx = i; + break; + } + } + + if (rangeIdx === -1) { + if (inputRange[0] > input) { + return outputRange[0]; + } else { + return outputRange[outputRange[0].length - 1]; + } + } + + var inputA = inputRange[rangeIdx]; + var inputB = inputRange[rangeIdx + 1]; + var outputA = outputRange[rangeIdx]; + var outputB = outputRange[rangeIdx + 1]; + return YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA)); + }; + + YawPitchControl.lerp = function lerp(a, b, fraction) { + return a + fraction * (b - a); + } + /** + * Enable YawPitch functionality + * + * @method eg.YawPitch#enable + */ + ; + + _proto.enable = function enable() { + if (this._enabled) { + return this; + } + + this._enabled = true; // touchDirection is decided by parameter is valid string (Ref. Axes.connect) + + this._applyOptions(Object.keys(this.options), this.options); // TODO: Is this code is needed? Check later. + + + this.updatePanScale(); + return this; + } + /** + * Disable YawPitch functionality + * + * @method eg.YawPitch#disable + */ + ; + + _proto.disable = function disable(persistOrientation) { + if (!this._enabled) { + return this; + } // TODO: Check peristOrientation is needed! + + + if (!persistOrientation) { + this._resetOrientation(); + } + + this.axes.disconnect(); + this._enabled = false; + return this; + }; + + _proto._resetOrientation = function _resetOrientation() { + var opt = this.options; + this.axes.setTo({ + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }, 0); + return this; + } + /** + * Set one or more of yaw, pitch, fov + * + * @param {Object} coordinate yaw, pitch, fov + * @param {Number} duration Animation duration. if it is above 0 then it's animated. + */ + ; + + _proto.lookAt = function lookAt(_ref, duration) { + var yaw = _ref.yaw, + pitch = _ref.pitch, + fov = _ref.fov; + var pos = this.axes.get(); + var y = yaw === undefined ? 0 : yaw - pos.yaw; + var p = pitch === undefined ? 0 : pitch - pos.pitch; + var f = fov === undefined ? 0 : fov - pos.fov; // Allow duration of animation to have more than MC_MAXIMUM_DURATION. + + this.axes.options.maximumDuration = Infinity; + this.axes.setBy({ + yaw: y, + pitch: p, + fov: f + }, duration); + }; + + _proto.getYawPitch = function getYawPitch() { + var yawPitch = this.axes.get(); + return { + yaw: yawPitch.yaw, + pitch: yawPitch.pitch + }; + }; + + _proto.getFov = function getFov() { + return this.axes.get().fov; + }; + + _proto.getQuaternion = function getQuaternion() { + var pos = this.axes.get(); + return this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + }; + + _proto.shouldRenderWithQuaternion = function shouldRenderWithQuaternion() { + return this.options.gyroMode === GYRO_MODE.VR; + } + /** + * Destroys objects + */ + ; + + _proto.destroy = function destroy() { + this.axes && this.axes.destroy(); + this.axisPanInput && this.axisPanInput.destroy(); + this.axesWheelInput && this.axesWheelInput.destroy(); + this.axesTiltMotionInput && this.axesTiltMotionInput.destroy(); + this.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy(); + this.axesPinchInput && this.axesPinchInput.destroy(); + this.axesMoveKeyInput && this.axesMoveKeyInput.destroy(); + this._deviceQuaternion && this._deviceQuaternion.destroy(); + }; + + return YawPitchControl; + }(Component); + + YawPitchControl.VERSION = VERSION; + YawPitchControl.CONTROL_MODE_VR = CONTROL_MODE_VR; + YawPitchControl.CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH; + YawPitchControl.TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL; + YawPitchControl.TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW; + YawPitchControl.TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH; + YawPitchControl.TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE; + return YawPitchControl; + }(); + + var _Promise = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var STATUS = { + "NONE": 0, + "LOADING": 1, + "LOADED": 2, + "ERROR": 3 + }; + var EVENT = { + "READYSTATECHANGE": "readystatechange" + }; + + var ImageLoader = + /*#__PURE__*/ + function () { + var ImageLoader = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(ImageLoader, _Component); + + function ImageLoader(image) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + _this._image = null; + _this._onceHandlers = []; + _this._loadStatus = STATUS.NONE; + image && _this.set(image); + return _this; + } + + var _proto = ImageLoader.prototype; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise(function (res, rej) { + if (!_this2._image) { + rej("ImageLoader: image is not defiend"); + } else if (_this2._loadStatus === STATUS.LOADED) { + res(_this2.getElement()); + } else if (_this2._loadStatus === STATUS.LOADING) { + /* Check isMaybeLoaded() first because there may have + posibilities that image already loaded before get is called. + for example calling get on external image onload callback.*/ + if (ImageLoader.isMaybeLoaded(_this2._image)) { + _this2._loadStatus = STATUS.LOADED; + res(_this2.getElement()); + } else { + _this2.on(EVENT.READYSTATECHANGE, function (e) { + if (e.type === STATUS.LOADED) { + res(_this2.getElement()); + } else { + rej("ImageLoader: failed to load images."); + } + }); + } + } else { + rej("ImageLoader: failed to load images"); + } + }); + } + /** + * @param image img element or img url or array of img element or array of img url + */ + ; + + _proto.set = function set(image) { + var _this3 = this; + + this._loadStatus = STATUS.LOADING; + this._image = ImageLoader.createElement(image); + + if (ImageLoader.isMaybeLoaded(this._image)) { + this._loadStatus = STATUS.LOADED; + return; + } + + this.onceLoaded(this._image, function () { + _this3._loadStatus = STATUS.LOADED; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.LOADED + }); + }, function () { + _this3._loadStatus = STATUS.ERROR; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.ERROR + }); + }); + }; + + ImageLoader.createElement = function createElement(image) { + var images = image instanceof Array ? image : [image]; + return images.map(function (img) { + var _img = img; + + if (typeof img === "string") { + _img = new Image(); + _img.crossOrigin = "anonymous"; + _img.src = img; + } + + return _img; + }); + }; + + _proto.getElement = function getElement() { + return this._image.length === 1 ? this._image[0] : this._image; + }; + + ImageLoader.isMaybeLoaded = function isMaybeLoaded(image) { + var result = false; + + if (image instanceof Image) { + result = image.complete && image.naturalWidth !== 0; + } else if (image instanceof Array) { + result = !image.some(function (img) { + return !img.complete || img.naturalWidth === 0; + }); + } + + return result; + }; + + _proto.onceLoaded = function onceLoaded(target, onload, onerror) { + var _this4 = this; + + var targets = target instanceof Array ? target : [target]; + var targetsNotLoaded = targets.filter(function (img) { + return !ImageLoader.isMaybeLoaded(img); + }); + var loadPromises = targetsNotLoaded.map(function (img) { + return new _Promise(function (res, rej) { + _this4._once(img, "load", function () { + return res(img); + }); + + _this4._once(img, "error", function () { + return rej(img); + }); + }); + }); + + _Promise.all(loadPromises).then(function (result) { + return onload(targets.length === 1 ? targets[0] : targets); + }, function (reason) { + return onerror(reason); + }); + }; + + _proto._once = function _once(target, type, listener) { + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + + target.addEventListener(type, fn); + + this._onceHandlers.push({ + target: target, + type: type, + fn: fn + }); + }; + + _proto.getStatus = function getStatus() { + return this._loadStatus; + }; + + _proto.destroy = function destroy() { + this._onceHandlers.forEach(function (handler) { + handler.target.removeEventListener(handler.type, handler.fn); + }); + + this._onceHandlers = []; + this._image.src = ""; + this._image = null; + this._loadStatus = STATUS.NONE; + }; + + return ImageLoader; + }(Component); + + ImageLoader.STATUS = STATUS; + return ImageLoader; + }(); + + var _Promise$1 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + + // import Agent from "@egjs/agent"; + + /* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */ + var READY_STATUS = { + HAVE_NOTHING: 0, + // no information whether or not the audio/video is ready + HAVE_METADATA: 1, + // HAVE_METADATA - metadata for the audio/video is ready + HAVE_CURRENT_DATA: 2, + // data for the current playback position is available, but not enough data to play next frame/millisecond + HAVE_FUTURE_DATA: 3, + // data for the current and at least the next frame is available + HAVE_ENOUGH_DATA: 4, + // enough data available to start playing + // below is custom status for failed to load status + LOADING_FAILED: -1 + }; + var READYSTATECHANGE_EVENT_NAME = {}; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = "loadedmetadata"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = "loadeddata"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = "canplay"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = "canplaythrough"; + + var VideoLoader = + /*#__PURE__*/ + function () { + function VideoLoader(video) { + this._handlers = []; + this._sourceCount = 0; // on iOS safari, 'loadeddata' will not triggered unless the user hits play, + // so used 'loadedmetadata' instead. + + this._thresholdReadyState = READY_STATUS.HAVE_METADATA; + this._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState]; + this._loadStatus = video && video.readyState || READY_STATUS.HAVE_NOTHING; + this._onerror = this._onerror.bind(this); + video && this.set(video); + } + + var _proto = VideoLoader.prototype; + + _proto._onerror = function _onerror() { + this._errorCount++; + + if (this._errorCount >= this._sourceCount) { + this._loadStatus = READY_STATUS.LOADING_FAILED; + + this._detachErrorHandler(this._onerror); + } + } + /** + * + * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src} + */ + ; + + _proto._appendSourceElement = function _appendSourceElement(videoUrl) { + var videoSrc; + var videoType; + + if (typeof videoUrl === "object") { + videoSrc = videoUrl.src; + videoType = videoUrl.type; + } else if (typeof videoUrl === "string") { + videoSrc = videoUrl; + } + + if (!videoSrc) { + return false; + } + + var sourceElement = document.createElement("source"); + sourceElement.src = videoSrc; + videoType && (sourceElement.type = videoType); + + this._video.appendChild(sourceElement); + + return true; + }; + + _proto.set = function set(video) { + var _this = this; + + this._reset(); // reset resources. + + + if (!video) { + return; + } + + if (video instanceof HTMLVideoElement) { + // video tag + this._video = video; + } else if (typeof video === "string" || typeof video === "object") { + // url + this._video = document.createElement("video"); + + this._video.setAttribute("crossorigin", "anonymous"); + + this._video.setAttribute("webkit-playsinline", ""); + + this._video.setAttribute("playsinline", ""); + + if (video instanceof Array) { + video.forEach(function (v) { + return _this._appendSourceElement(v); + }); + } else { + this._appendSourceElement(video); + } + + this._sourceCount = this._video.querySelectorAll("source").length; + + if (this._sourceCount > 0) { + if (this._video.readyState < this._thresholdReadyState) { + this._video.load(); // attach loading error listener + + + this._attachErrorHandler(this._onerror); + } + } else { + this._video = null; + } + } + }; + + _proto._attachErrorHandler = function _attachErrorHandler(handler) { + this._video.addEventListener("error", handler); + + this._sources = this._video.querySelectorAll("source"); + [].forEach.call(this._sources, function (source) { + source.addEventListener("error", handler); + }); + }; + + _proto._detachErrorHandler = function _detachErrorHandler(handler) { + this._video.removeEventListener("error", handler); + + [].forEach.call(this._sources, function (source) { + source.removeEventListener("error", handler); + }); + }; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise$1(function (res, rej) { + if (!_this2._video) { + rej("VideoLoader: video is undefined"); + } else if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + rej("VideoLoader: video source is invalid"); + } else if (_this2._video.readyState >= _this2._thresholdReadyState) { + res(_this2._video); + } else { + // check errorCnt and reject + var rejector = function rejector() { + if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + _this2._detachErrorHandler(rejector); + + rej("VideoLoader: video source is invalid"); + } + }; + + _this2._attachErrorHandler(rejector); + + _this2._once(_this2._thresholdEventName, function () { + return res(_this2._video); + }); + } + }); + }; + + _proto.getElement = function getElement() { + return this._video; + }; + + _proto.destroy = function destroy() { + this._reset(); + }; + + _proto._reset = function _reset() { + var _this3 = this; + + this._handlers.forEach(function (handler) { + _this3._video.removeEventListener(handler.type, handler.fn); + }); + + this._handlers = []; + this._video = null; + this._sourceCount = 0; + this._errorCount = 0; + }; + + _proto._once = function _once(type, listener) { + var target = this._video; + + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + /* By useCapture mode enabled, you can capture the error event being fired on source(child)*/ + + + target.addEventListener(type, fn, true); + + this._handlers.push({ + type: type, + fn: fn + }); + }; + + return VideoLoader; + }(); + + var WEBGL_ERROR_CODE = { + "0": "NO_ERROR", + "1280": "INVALID_ENUM", + "1281": "INVALID_VALUE", + "1282": "INVALID_OPERATION", + "1285": "OUT_OF_MEMORY", + "1286": "INVALID_FRAMEBUFFER_OPERATION", + "37442": "CONTEXT_LOST_WEBGL" + }; + var webglAvailability = null; + var MAX_TEXTURE_SIZE_FOR_TEST = null; + + var WebGLUtils = + /*#__PURE__*/ + function () { + function WebGLUtils() {} + + WebGLUtils.createShader = function createShader(gl, type, source) { + var shader = gl.createShader(type); + gl.shaderSource(shader, source); + gl.compileShader(shader); + var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS); + + if (success) { + return shader; + } else { + // eslint-disable-next-line + console.error(gl.getShaderInfoLog(shader)); + } + + return null; + }; + + WebGLUtils.createProgram = function createProgram(gl, vertexShader, fragmentShader) { + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + gl.linkProgram(program); + gl.detachShader(program, vertexShader); + gl.detachShader(program, fragmentShader); + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + var success = gl.getProgramParameter(program, gl.LINK_STATUS); + + if (success) { + return program; + } + + gl.deleteProgram(program); + return null; + }; + + WebGLUtils.initBuffer = function initBuffer(gl, target + /* bind point */ + , data, itemSize, attr) { + var buffer = gl.createBuffer(); + gl.bindBuffer(target, buffer); + gl.bufferData(target, data, gl.STATIC_DRAW); + + if (buffer) { + buffer.itemSize = itemSize; + buffer.numItems = data.length / itemSize; + } + + if (attr !== undefined) { + gl.enableVertexAttribArray(attr); + gl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0); + } + + return buffer; + }; + + WebGLUtils.getWebglContext = function getWebglContext(canvas, userContextAttributes) { + var webglIdentifiers = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"]; + var context = null; + + var contextAttributes = _extends({ + preserveDrawingBuffer: false, + antialias: false, + xrCompatible: true + }, userContextAttributes); + + function onWebglcontextcreationerror(e) { + return e.statusMessage; + } + + canvas.addEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + + for (var i = 0; i < webglIdentifiers.length; i++) { + try { + context = canvas.getContext(webglIdentifiers[i], contextAttributes); + } catch (t) {} + + if (context) { + break; + } + } + + canvas.removeEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + return context; + }; + + WebGLUtils.createTexture = function createTexture(gl, textureTarget) { + var texture = gl.createTexture(); + gl.bindTexture(textureTarget, texture); + gl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.bindTexture(textureTarget, null); + return texture; + } + /** + * Returns the webgl availability of the current browser. + * @method WebGLUtils#isWebGLAvailable + * @retuen {Boolean} isWebGLAvailable + */ + ; + + WebGLUtils.isWebGLAvailable = function isWebGLAvailable() { + if (webglAvailability === null) { + var canvas = document.createElement("canvas"); + var webglContext = WebGLUtils.getWebglContext(canvas); + webglAvailability = !!webglContext; // webglContext Resource forced collection + + if (webglContext) { + var loseContextExtension = webglContext.getExtension("WEBGL_lose_context"); + loseContextExtension && loseContextExtension.loseContext(); + } + } + + return webglAvailability; + } + /** + * Returns whether webgl is stable in the current browser. + * @method WebGLUtils#isStableWebGL + * @retuen {Boolean} isStableWebGL + */ + ; + + WebGLUtils.isStableWebGL = function isStableWebGL() { + var agentInfo = Agent(); + var isStableWebgl = true; + + if (agentInfo.os.name === "android") { + var version = parseFloat(agentInfo.os.version); + + if (version <= 4.3) { + isStableWebgl = false; + } else if (version === 4.4) { + if (agentInfo.browser.name !== "chrome") { + isStableWebgl = false; + } + } + } + + return isStableWebgl; + }; + + WebGLUtils.getErrorNameFromWebGLErrorCode = function getErrorNameFromWebGLErrorCode(code) { + if (!(code in WEBGL_ERROR_CODE)) { + return "UNKNOWN_ERROR"; + } + + return WEBGL_ERROR_CODE[code]; + } + /** + * This function is wrapper for texImage2D to handle exceptions on texImage2D. + * Purpose is to prevent service from being stopped by script error. + * + * @param {*} gl + * @param {*} target + * @param {*} pixels + */ + ; + + WebGLUtils.texImage2D = function texImage2D(gl, target, pixels) { + try { + gl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + } catch (error) { + /* eslint-disable no-console */ + console.error("WebGLUtils.texImage2D error:", error); + /* eslint-enable no-console */ + } + }; + + WebGLUtils.getMaxTextureSize = function getMaxTextureSize(gl) { + // WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test + return MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE); + }; + + return WebGLUtils; + }(); + + var agent$1 = Agent(); + var isIE11 = agent$1.browser.name === "ie" && agent$1.browser.majorVersion === 11; + var EVENTS = { + ERROR: "error" + }; + /** + * + * Extends Component for firing errors occurs internally. + */ + + var Renderer = + /*#__PURE__*/ + function () { + var Renderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(Renderer, _Component); + + function Renderer() { + var _this; + + _this = _Component.call(this) || this; + _this._forceDimension = null; + _this._pixelCanvas = null; + _this._pixelContext = null; + return _this; + } + + var _proto = Renderer.prototype; + + _proto.render = function render(_ref) { + var gl = _ref.gl, + shaderProgram = _ref.shaderProgram, + indexBuffer = _ref.indexBuffer, + mvMatrix = _ref.mvMatrix, + pMatrix = _ref.pMatrix; + gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix); + gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix); + + if (indexBuffer) { + gl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0); + } + } // Define interface for Renderers + + /** + * Following MUST BE DEFINED on Child of Renderer + * + * DATA + * + * - getVertexPositionData + * - getIndexData + * - getTextureCoordData + * + * SOURCE + * + * - getVertexShaderSource + * - getFragmentShaderSource + * + * TEXTURE + * + * - bindTexture + */ + ; + + _proto.getDimension = function getDimension(pixelSource) { + var width = pixelSource.naturalWidth || pixelSource.videoWidth; + var height = pixelSource.naturalHeight || pixelSource.videoHeight; + return { + width: width, + height: height + }; + } + /** + * Update data used by shader + * - + * + * + * @param {*} param + */ + ; + + _proto.updateShaderData = function updateShaderData(param) {} + /* + * Update following data in implementation layer. + * If the data is not changed, it does not need to implement this function. + * + * - _VERTEX_POSITION_DATA + * - _TEXTURE_COORD_DATA + * - _INDEX_DATA + */ + + /** + * + * @param {HTMLImageElement | HTMLVideoElement} image + * @param {Object = {width, height}} forceDimension Forced dimension to resize + */ + ; + + _proto._initPixelSource = function _initPixelSource(image, forceDimension) { + var isIE11Video = isIE11 && image instanceof HTMLVideoElement; + + if (isIE11Video || forceDimension) { + var _ref2 = forceDimension || this.getDimension(image), + width = _ref2.width, + height = _ref2.height; + + this._pixelCanvas = document.createElement("canvas"); + this._pixelCanvas.width = width; + this._pixelCanvas.height = height; + this._pixelContext = this._pixelCanvas.getContext("2d"); + } + + this._forceDimension = forceDimension; + }; + + _proto._getPixelSource = function _getPixelSource(image) { + if (!this._pixelCanvas) { + return image; + } + /** + * IE11 && Video + * or + * Dimension is forced (Image is larger than texture size.) + */ + + + var contentDimension = this.getDimension(image); + var textureDimension = this._forceDimension || contentDimension; + + if (this._pixelCanvas.width !== textureDimension.width) { + this._pixelCanvas.width = textureDimension.width; + } + + if (this._pixelCanvas.height !== textureDimension.height) { + this._pixelCanvas.height = textureDimension.height; + } + + if (this._forceDimension) { + this._pixelContext.drawImage(image, 0, 0, contentDimension.width, contentDimension.height, 0, 0, textureDimension.width, textureDimension.height); + } else { + this._pixelContext.drawImage(image, 0, 0); + } + + return this._pixelCanvas; + }; + + _proto._extractTileConfig = function _extractTileConfig(imageConfig) { + var tileConfig = Array.isArray(imageConfig.tileConfig) ? imageConfig.tileConfig : Array.apply(void 0, Array(6)).map(function () { + return imageConfig.tileConfig; + }); + tileConfig = tileConfig.map(function (config) { + return _extends({ + flipHorizontal: false, + rotation: 0 + }, config); + }); + return tileConfig; + }; + + _proto._triggerError = function _triggerError(error) { + /* eslint-disable no-console */ + console.error("Renderer Error:", error); + /* eslint-enable no-console */ + + this.trigger(EVENTS.ERROR, { + message: typeof error === "string" ? error : error.message + }); + }; + + return Renderer; + }(Component); + + Renderer.EVENTS = EVENTS; + return Renderer; + }(); + + var CubeRenderer = + /*#__PURE__*/ + function () { + var CubeRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeRenderer, _Renderer); + + function CubeRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + CubeRenderer._VERTEX_POSITION_DATA = CubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // top + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // bottom + 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + return CubeRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + if (CubeRenderer._INDEX_DATA) { + return CubeRenderer._INDEX_DATA; + } + + var indexData = []; + var vertexPositionData = this.getVertexPositionData(); + + for (var i = 0; i < vertexPositionData.length / 3; i += 4) { + indexData.push(i, i + 2, i + 1, i, i + 3, i + 2); + } + + CubeRenderer._INDEX_DATA = indexData; + return indexData; + }; + + CubeRenderer.extractOrder = function extractOrder(imageConfig) { + return imageConfig.order || "RLUDBF"; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var vertexOrder = "BFUDRL"; + var order = CubeRenderer.extractOrder(imageConfig); + var base = this.getVertexPositionData(); + + var tileConfig = this._extractTileConfig(imageConfig); + + var elemSize = 3; + var vertexPerTile = 4; + var textureCoordData = vertexOrder.split("").map(function (face) { + return tileConfig[order.indexOf(face)]; + }).map(function (config, i) { + var rotation = parseInt(config.rotation / 90, 10); + var ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2]; + + for (var r = 0; r < Math.abs(rotation); r++) { + if (config.flipHorizontal && rotation > 0 || !config.flipHorizontal && rotation < 0) { + ordermap_.push(ordermap_.shift()); + } else { + ordermap_.unshift(ordermap_.pop()); + } + } + + var elemPerTile = elemSize * vertexPerTile; + var tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile); + var tileTemp = []; + + for (var j = 0; j < vertexPerTile; j++) { + tileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize); + } + + return tileTemp; + }).join().split(",").map(function (v) { + return parseInt(v, 10); + }); + return textureCoordData; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image, imageConfig) { + var baseOrder = "RLUDBF"; + var order = CubeRenderer.extractOrder(imageConfig); + var orderMap = {}; + order.split("").forEach(function (v, i) { + orderMap[v] = i; + }); + + try { + if (image instanceof Array) { + for (var surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) { + var tileIdx = orderMap[baseOrder[surfaceIdx]]; + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]); + } + } else { + var maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image); + + for (var _surfaceIdx = 0; _surfaceIdx < 6; _surfaceIdx++) { + var _tileIdx = orderMap[baseOrder[_surfaceIdx]]; + var tile = this.extractTileFromImage(image, _tileIdx, maxCubeMapTextureSize); + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + _surfaceIdx, tile); + } + } + } catch (e) { + this._triggerError(e); + } + }; + + _proto.bindTexture = function bindTexture(gl, texture, image, imageConfig) { + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + this.updateTexture(gl, image, imageConfig); + }; + + _proto.getSourceTileSize = function getSourceTileSize(image) { + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var aspectRatio = width / height; + var inputTextureSize; + + if (aspectRatio === 1 / 6) { + inputTextureSize = width; + } else if (aspectRatio === 6) { + inputTextureSize = height; + } else if (aspectRatio === 2 / 3) { + inputTextureSize = width / 2; + } else { + inputTextureSize = width / 3; + } + + return inputTextureSize; + }; + + _proto.extractTileFromImage = function extractTileFromImage(image, tileIdx, outputTextureSize) { + var _this$getDimension2 = this.getDimension(image), + width = _this$getDimension2.width; + + var inputTextureSize = this.getSourceTileSize(image); + var canvas = document.createElement("canvas"); + canvas.width = outputTextureSize; + canvas.height = outputTextureSize; + var context = canvas.getContext("2d"); + var tilePerRow = width / inputTextureSize; + var x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow); + var y = parseInt(tileIdx / tilePerRow, 10) * inputTextureSize; + context.drawImage(image, x, y, inputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize); + return canvas; + }; + + _proto.getMaxCubeMapTextureSize = function getMaxCubeMapTextureSize(gl, image) { + var agent = Agent(); + var maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); + + var _imageWidth = this.getSourceTileSize(image); + + if (agent.browser.name === "ie" && agent.browser.majorVersion === 11) { + if (!util.isPowerOfTwo(_imageWidth)) { + for (var i = 1; i < maxCubeMapTextureSize; i *= 2) { + if (i < _imageWidth) { + continue; + } else { + _imageWidth = i; + break; + } + } + } + } + + if (agent.os.name === "ios") { + var majorVersion = agent.os.majorVersion; // ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다. + + if (majorVersion === 9) { + _imageWidth = 1024; + } // ios 8 의 경우 텍스쳐 최대사이즈는 512 이다. + + + if (majorVersion === 8) { + _imageWidth = 512; + } + } // maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수 + + + return Math.min(maxCubeMapTextureSize, _imageWidth); + }; + + return CubeRenderer; + }(Renderer); + + CubeRenderer._VERTEX_POSITION_DATA = null; + CubeRenderer._INDEX_DATA = null; + return CubeRenderer; + }(); + + var CubeStripRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeStripRenderer, _Renderer); + + function CubeStripRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeStripRenderer.prototype; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"; + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + if (!this._vertices) { + this._vertices = [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // up + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // down + -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + } + + return this._vertices; + }; + + _proto.getIndexData = function getIndexData() { + var _this = this; + + // TODO: 한번만 계산하도록 수정하기 + var indices = function () { + var indexData = []; + + for (var i = 0; i < _this._vertices.length / 3; i += 4) { + indexData.push(i, i + 1, i + 2, i, i + 2, i + 3); + } + + return indexData; + }(); + + return indices; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var _this2 = this; + + // TODO: make it cols, rows as config. + var cols = 3; + var rows = 2; + var order = imageConfig.order || "RLUDFB"; + var coords = []; // 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다. + + for (var r = rows - 1; r >= 0; r--) { + for (var c = 0; c < cols; c++) { + var coord = [c / cols, r / rows, (c + 1) / cols, r / rows, (c + 1) / cols, (r + 1) / rows, c / cols, (r + 1) / rows]; + coords.push(coord); + } + } + + var tileConfigs = this._extractTileConfig(imageConfig); // Transform Coord By Flip & Rotation + + + coords = coords // shrink coord to avoid pixel bleeding + .map(function (coord) { + return _this2._shrinkCoord(coord); + }).map(function (coord, i) { + return _this2._transformCoord(coord, tileConfigs[i]); + }); // vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치 + + return "BFUDRL".split("").map(function (face) { + return order.indexOf(face); + }).map(function (index) { + return coords[index]; + }).reduce(function (acc, val) { + return acc.concat(val); + }, []); + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto._transformCoord = function _transformCoord(coord, tileConfig) { + var newCoord = coord.slice(); + + if (tileConfig.flipHorizontal) { + newCoord = this._flipHorizontalCoord(newCoord); + } + + if (tileConfig.rotation) { + newCoord = this._rotateCoord(newCoord, tileConfig.rotation); + } + + return newCoord; + }; + + _proto._shrinkCoord = function _shrinkCoord(coord) { + var SHRINK_Y = 0.00; + var SHRINK_X = 0.00; + return [coord[0] + SHRINK_X, coord[1] + SHRINK_Y, coord[2] - SHRINK_X, coord[3] + SHRINK_Y, coord[4] - SHRINK_X, coord[5] - SHRINK_Y, coord[6] + SHRINK_X, coord[7] - SHRINK_Y]; + }; + + _proto._rotateCoord = function _rotateCoord(coord, rotationAngle) { + var SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord. + + var shiftCount = parseInt(rotationAngle / 90, 10) % 4; + + if (shiftCount === 0) { + return coord; + } + + var moved; + var rotatedCoord = []; + + if (shiftCount > 0) { + moved = coord.splice(0, shiftCount * SIZE); + rotatedCoord = coord.concat(moved); + } else { + moved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE); + rotatedCoord = moved.concat(coord); + } + + return rotatedCoord; + }; + + _proto._flipHorizontalCoord = function _flipHorizontalCoord(coord) { + return [coord[2], coord[3], coord[0], coord[1], coord[6], coord[7], coord[4], coord[5]]; + }; + + return CubeStripRenderer; + }(Renderer); + + /** + * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide}) + * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고) + * @namespace + * @name GYRO_MODE + * @memberof eg.view360.PanoViewer + */ + /** + * Constant value for errors + * @ko 에러에 대한 상수 값 + * @namespace + * @name ERROR_TYPE + * @memberof eg.view360.PanoViewer + */ + + var ERROR_TYPE = { + /** + * Unsupported device + * @ko 미지원 기기 + * @name INVALID_DEVICE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 10 + */ + INVALID_DEVICE: 10, + + /** + * Webgl not support + * @ko WEBGL 미지원 + * @name NO_WEBGL + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 11 + */ + NO_WEBGL: 11, + + /** + * Failed to load image + * @ko 이미지 로드 실패 + * @name FAIL_IMAGE_LOAD + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 12 + */ + FAIL_IMAGE_LOAD: 12, + + /** + * Failed to bind texture + * @ko 텍스쳐 바인딩 실패 + * @name FAIL_BIND_TEXTURE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 13 + */ + FAIL_BIND_TEXTURE: 13, + + /** + * Only one resource(image or video) should be specified + * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * @name INVALID_RESOURCE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 14 + */ + INVALID_RESOURCE: 14, + + /** + * WebGL context lost occurred + * @ko WebGL context lost 발생 + * @name RENDERING_CONTEXT_LOST + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 15 + */ + RENDERING_CONTEXT_LOST: 15 + }; + /** + * Constant value for events + * @ko 이벤트에 대한 상수 값 + * @namespace + * @name EVENTS + * @memberof eg.view360.PanoViewer + */ + + var EVENTS$1 = { + /** + * Events that is fired when PanoViewer is ready to show image and handle user interaction. + * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트 + * @name READY + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default ready + */ + READY: "ready", + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name VIEW_CHANGE + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default viewChange + */ + VIEW_CHANGE: "viewChange", + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name ANIMATION_END + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default animationEnd + */ + ANIMATION_END: "animationEnd", + + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name ERROR + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default error + */ + ERROR: "error" + }; + /** + * Constant value for projection type + * @ko 프로젝션 타입 대한 상수 값 + * @namespace + * @name PROJECTION_TYPE + * @memberof eg.view360.PanoViewer + */ + + var PROJECTION_TYPE = { + /** + * Constant value for equirectangular type. + * @ko equirectangular 에 대한 상수 값. + * @name EQUIRECTANGULAR + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default equirectangular + */ + EQUIRECTANGULAR: "equirectangular", + + /** + * Constant value for cubemap type. + * @ko cubemap 에 대한 상수 값. + * @name CUBEMAP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubemap + */ + CUBEMAP: "cubemap", + + /** + * Constant value for cubestrip type. + * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC. + * + * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다. + * @name CUBESTRIP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubestrip + */ + CUBESTRIP: "cubestrip", + + /** + * Constant value for PANORAMA type. + * + * PANORAMA is a format for a panorma image which is taken from smartphone. + * + * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다. + * + * @name PANORAMA + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default panorama + */ + PANORAMA: "panorama", + + /** + * Constant value for EQUI_STEREOSCOPY type. + * + * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present. + * + * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다. + * + * @name STEREOSCOPIC_EQUI + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default stereoequi + */ + STEREOSCOPIC_EQUI: "stereoequi" + }; + /** + * A constant value for the format of the stereoscopic equirectangular projection type. + * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값 + * @namespace + * @name STEREO_FORMAT + * @memberof eg.view360.PanoViewer + */ + + var STEREO_FORMAT = { + /** + * A constant value for format of top bottom stereoscopic 360 equirectangular projection. + * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name TOP_BOTTOM + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dv" + */ + TOP_BOTTOM: "3dv", + + /** + * A constant value for format of left right stereoscopic 360 equirectangular projection. + * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name LEFT_RIGHT + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dh" + */ + LEFT_RIGHT: "3dh", + + /** + * A constant value specifying media is not in stereoscopic format. + * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값. + * @name NONE + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "" + */ + NONE: "" + }; + + var latitudeBands = 60; + var longitudeBands = 60; + var radius = 2; + var ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI; + var textureCoordData = []; + var vertexPositionData = []; + var indexData = []; + var latIdx; + var lngIdx; + + for (latIdx = 0; latIdx <= latitudeBands; latIdx++) { + var theta = (latIdx / latitudeBands - 0.5) * Math.PI; + var sinTheta = Math.sin(theta); + var cosTheta = Math.cos(theta); + + for (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) { + var phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN; + var sinPhi = Math.sin(phi); + var cosPhi = Math.cos(phi); + var x = cosPhi * cosTheta; + var y = sinTheta; + var z = sinPhi * cosTheta; + var u = lngIdx / longitudeBands; + var v = latIdx / latitudeBands; + textureCoordData.push(u, v); + vertexPositionData.push(radius * x, radius * y, radius * z); + + if (lngIdx !== longitudeBands && latIdx !== latitudeBands) { + var a = latIdx * (longitudeBands + 1) + lngIdx; + var b = a + longitudeBands + 1; + indexData.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + + var SphereRenderer = + /*#__PURE__*/ + function () { + var SphereRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(SphereRenderer, _Renderer); + + function SphereRenderer(format) { + var _this; + + _this = _Renderer.call(this) || this; + _this._stereoFormat = format; + return _this; + } + + var _proto = SphereRenderer.prototype; + + _proto.render = function render(ctx) { + var gl = ctx.gl, + shaderProgram = ctx.shaderProgram; + var leftEyeScaleOffset; + var rightEyeScaleOffset; + + switch (this._stereoFormat) { + case STEREO_FORMAT.TOP_BOTTOM: + leftEyeScaleOffset = [1, 0.5, 0, 0]; + rightEyeScaleOffset = [1, 0.5, 0, 0.5]; + break; + + case STEREO_FORMAT.LEFT_RIGHT: + leftEyeScaleOffset = [0.5, 1, 0, 0]; + rightEyeScaleOffset = [0.5, 1, 0.5, 0]; + break; + + default: + leftEyeScaleOffset = [1, 1, 0, 0]; + rightEyeScaleOffset = [1, 1, 0, 0]; + } + + var uTexScaleOffset = gl.getUniformLocation(shaderProgram, "uTexScaleOffset"); + gl.uniform4fv(uTexScaleOffset, [].concat(leftEyeScaleOffset, rightEyeScaleOffset)); + + _Renderer.prototype.render.call(this, ctx); + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + return SphereRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return SphereRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return SphereRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + return SphereRenderer; + }(Renderer); + + SphereRenderer._VERTEX_POSITION_DATA = vertexPositionData; + SphereRenderer._TEXTURE_COORD_DATA = textureCoordData; + SphereRenderer._INDEX_DATA = indexData; + return SphereRenderer; + }(); + + var MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6; + var longitudeBands$1 = 60; + var textureCoordData$1 = []; + var vertexPositionData$1 = []; + var indexData$1 = []; + + var CylinderRenderer = + /*#__PURE__*/ + function () { + var CylinderRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CylinderRenderer, _Renderer); + + function CylinderRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CylinderRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + return CylinderRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return CylinderRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return CylinderRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + var resizeDimension; + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device texture limit(" + maxSize + "))"); // Request resizing texture. + + /** + * TODO: Is it need to apply on another projection type? + */ + + + resizeDimension = width > height ? { + width: maxSize, + height: maxSize * height / width + } : { + width: maxSize * width / height, + height: maxSize + }; + } // Pixel Source for IE11 & Video or resizing needed + + + this._initPixelSource(image, resizeDimension); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto.updateShaderData = function updateShaderData(_ref) { + var _ref$imageAspectRatio = _ref.imageAspectRatio, + imageAspectRatio = _ref$imageAspectRatio === void 0 ? MIN_ASPECT_RATIO_FOR_FULL_PANORAMA : _ref$imageAspectRatio; + var lngIdx; + var cylinderMaxRadian; + var halfCylinderY; + var rotated; + var aspectRatio; // Exception case: orientation is rotated. + + if (imageAspectRatio < 1) { + /** + * If rotated is true, we assume that image is rotated counter clockwise. + * TODO: If there's other rotation, it is need to implement by each rotation. + */ + rotated = true; + aspectRatio = 1 / imageAspectRatio; + } else { + rotated = false; + aspectRatio = imageAspectRatio; + } + + if (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) { + var fov = 360 / aspectRatio; + cylinderMaxRadian = 2 * Math.PI; // 360 deg + + halfCylinderY = Math.tan(glMatrix.glMatrix.toRadian(fov / 2)); + } else { + cylinderMaxRadian = aspectRatio; + halfCylinderY = 0.5; // Range of cylinder is [-0.5, 0.5] to make height to 1. + } // intialize shader data before update + + + textureCoordData$1.length = 0; + vertexPositionData$1.length = 0; + indexData$1.length = 0; + var CYLIDER_Y = [-halfCylinderY, halfCylinderY]; + var startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360) + // console.log("cylinderMaxRadian:", glMatrix.toDegree(cylinderMaxRadian), "CYLIDER_Y", CYLIDER_Y, "start angle", glMatrix.toDegree(startAngleForCenterAlign)); + + for (var yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength + /* bottom & top */ + ; yIdx++) { + for (lngIdx = 0; lngIdx <= longitudeBands$1; lngIdx++) { + var angle = startAngleForCenterAlign + lngIdx / longitudeBands$1 * cylinderMaxRadian; + var x = Math.cos(angle); + var y = CYLIDER_Y[yIdx]; + var z = Math.sin(angle); + var u = void 0; + var v = void 0; + + if (rotated) { + // Rotated 90 degree (counter clock wise) + u = 1 - yIdx; // yLength - yIdx; + + v = lngIdx / longitudeBands$1; + } else { + // // Normal case (Not rotated) + u = lngIdx / longitudeBands$1; + v = yIdx; + } + + textureCoordData$1.push(u, v); + vertexPositionData$1.push(x, y, z); + + if (yIdx === 0 && lngIdx < longitudeBands$1) { + var a = lngIdx; + var b = a + longitudeBands$1 + 1; + indexData$1.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + }; + + return CylinderRenderer; + }(Renderer); + + CylinderRenderer._VERTEX_POSITION_DATA = vertexPositionData$1; + CylinderRenderer._TEXTURE_COORD_DATA = textureCoordData$1; + CylinderRenderer._INDEX_DATA = indexData$1; + return CylinderRenderer; + }(); + + var _Promise$2 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var VR_DISPLAY_PRESENT_CHANGE = "vrdisplaypresentchange"; + var DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1]; + var DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1]; + var EYES = { + LEFT: "left", + RIGHT: "right" + }; + + var VRManager = + /*#__PURE__*/ + function () { + var VRManager = + /*#__PURE__*/ + function () { + _createClass(VRManager, [{ + key: "context", + get: function get() { + return this._vrDisplay; + } + }]); + + function VRManager() { + var _this = this; + + this.destroy = function () { + var vrDisplay = _this._vrDisplay; + + _this.removeEndCallback(_this.destroy); + + if (vrDisplay && vrDisplay.isPresenting) { + vrDisplay.exitPresent(); + } + + _this._clear(); + }; + + this._frameData = new window.VRFrameData(); + + this._clear(); + } + + var _proto = VRManager.prototype; + + _proto.canRender = function canRender() { + return Boolean(this._vrDisplay); + }; + + _proto.beforeRender = function beforeRender(gl) { + // Render to the default backbuffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + }; + + _proto.afterRender = function afterRender() { + this._vrDisplay.submitFrame(); + }; + + _proto.getEyeParams = function getEyeParams(gl) { + var display = this._vrDisplay; + var halfWidth = gl.drawingBufferWidth * 0.5; + var height = gl.drawingBufferHeight; + var frameData = this._frameData; + display.getFrameData(frameData); + var leftMVMatrix = frameData.leftViewMatrix; + var rightMVMatrix = frameData.rightViewMatrix; + glMatrix.mat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset); + glMatrix.mat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset); + return [{ + viewport: [0, 0, halfWidth, height], + mvMatrix: leftMVMatrix, + pMatrix: frameData.leftProjectionMatrix + }, { + viewport: [halfWidth, 0, halfWidth, height], + mvMatrix: rightMVMatrix, + pMatrix: frameData.rightProjectionMatrix + }]; + }; + + _proto.isPresenting = function isPresenting() { + return Boolean(this._vrDisplay && this._vrDisplay.isPresenting); + }; + + _proto.addEndCallback = function addEndCallback(callback) { + window.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + window.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.requestPresent = function requestPresent(canvas) { + var _this2 = this; + + return new _Promise$2(function (resolve, reject) { + navigator.getVRDisplays().then(function (displays) { + var vrDisplay = displays.length && displays[0]; + + if (!vrDisplay) { + reject(new Error("No displays available.")); + return; + } + + if (!vrDisplay.capabilities.canPresent) { + reject(new Error("Display lacking capability to present.")); + return; + } + + vrDisplay.requestPresent([{ + source: canvas + }]).then(function () { + var leftEye = vrDisplay.getEyeParameters(EYES.LEFT); + var rightEye = vrDisplay.getEyeParameters(EYES.RIGHT); + canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2; + canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight); + + _this2._setDisplay(vrDisplay); + + resolve(); + }); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setDisplay = function _setDisplay(vrDisplay) { + this._vrDisplay = vrDisplay; + var layers = vrDisplay.getLayers(); + + if (layers.length) { + var layer = layers[0]; + this._leftBounds = layer.leftBounds; + this._rightBounds = layer.rightBounds; + } + + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._vrDisplay = null; + this._leftBounds = DEFAULT_LEFT_BOUNDS; + this._rightBounds = DEFAULT_RIGHT_BOUNDS; + this._yawOffset = 0; + }; + + return VRManager; + }(); + + return VRManager; + }(); + + var XR_REFERENCE_SPACE = "local"; + + var XRManager = + /*#__PURE__*/ + function () { + var XRManager = + /*#__PURE__*/ + function () { + _createClass(XRManager, [{ + key: "context", + get: function get() { + return this._xrSession; + } + }]); + + function XRManager() { + var _this = this; + + this.destroy = function () { + var xrSession = _this._xrSession; + + _this.removeEndCallback(_this.destroy); + + if (xrSession) { + // Capture to avoid errors + xrSession.end().then(function () {}, function () {}); + } + + _this._clear(); + }; + + this._clear(); + } + + var _proto = XRManager.prototype; + + _proto.canRender = function canRender(frame) { + var pose = frame.getViewerPose(this._xrRefSpace); + return Boolean(pose); + }; + + _proto.beforeRender = function beforeRender(gl, frame) { + var session = frame.session; + var baseLayer = session.renderState.baseLayer; + gl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer); + }; + + _proto.afterRender = function afterRender() {}; + + _proto.getEyeParams = function getEyeParams(gl, frame) { + var _this2 = this; + + var session = frame.session; + var pose = frame.getViewerPose(this._xrRefSpace); + + if (!pose) { + // Can't render + return null; + } + + var glLayer = session.renderState.baseLayer; + return pose.views.map(function (view) { + var viewport = glLayer.getViewport(view); + var mvMatrix = view.transform.inverse.matrix; + + if (IS_SAFARI_ON_DESKTOP) { + glMatrix.mat4.rotateX(mvMatrix, mvMatrix, glMatrix.glMatrix.toRadian(180)); + } + + glMatrix.mat4.rotateY(mvMatrix, mvMatrix, _this2._yawOffset); + return { + viewport: [viewport.x, viewport.y, viewport.width, viewport.height], + mvMatrix: mvMatrix, + pMatrix: view.projectionMatrix + }; + }); + }; + + _proto.isPresenting = function isPresenting() { + return this._presenting; + }; + + _proto.addEndCallback = function addEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.addEventListener("end", callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.removeEventListener("end", callback); + }; + + _proto.requestPresent = function requestPresent(canvas, gl) { + var _this3 = this; + + return navigator.xr.requestSession("immersive-vr", { + requiredFeatures: [XR_REFERENCE_SPACE] + }).then(function (session) { + var xrLayer = new window.XRWebGLLayer(session, gl); + session.updateRenderState({ + baseLayer: xrLayer + }); + return session.requestReferenceSpace(XR_REFERENCE_SPACE).then(function (refSpace) { + _this3._setSession(session, xrLayer, refSpace); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setSession = function _setSession(session, xrLayer, refSpace) { + this._xrSession = session; + this._xrLayer = xrLayer; + this._xrRefSpace = refSpace; + this._presenting = true; + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._xrSession = null; + this._xrLayer = null; + this._xrRefSpace = null; + this._presenting = false; + this._yawOffset = 0; + }; + + return XRManager; + }(); + + return XRManager; + }(); + + var WebGLAnimator = + /*#__PURE__*/ + function () { + var WebGLAnimator = + /*#__PURE__*/ + function () { + function WebGLAnimator() { + var _this = this; + + this._onLoop = function () { + _this._callback.apply(_this, arguments); + + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + }; + + this._onLoopNextTick = function () { + var before = performance.now(); + + _this._callback.apply(_this, arguments); + + var diff = performance.now() - before; + + if (_this._rafTimer >= 0) { + clearTimeout(_this._rafTimer); + _this._rafTimer = -1; + } + /** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */ + + + if (diff < 16) { + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + } else { + /** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/ + _this._rafTimer = setTimeout(_this._onLoop, 0); + } + }; + + this._callback = null; + this._context = window; + this._rafId = -1; + this._rafTimer = -1; + } + + var _proto = WebGLAnimator.prototype; + + _proto.setCallback = function setCallback(callback) { + this._callback = callback; + }; + + _proto.setContext = function setContext(context) { + this._context = context; + }; + + _proto.start = function start() { + var context = this._context; + var callback = this._callback; // No context / callback set + + if (!context || !callback) return; // Animation already started + + if (this._rafId >= 0 || this._rafTimer >= 0) return; + + if (IS_SAFARI_ON_DESKTOP) { + this._rafId = context.requestAnimationFrame(this._onLoopNextTick); + } else { + this._rafId = context.requestAnimationFrame(this._onLoop); + } + }; + + _proto.stop = function stop() { + if (this._rafId >= 0) { + this._context.cancelAnimationFrame(this._rafId); + } + + if (this._rafTimer >= 0) { + clearTimeout(this._rafTimer); + } + + this._rafId = -1; + this._rafTimer = -1; + } + /** + * There can be more than 1 argument when we use XRSession's raf + */ + ; + + return WebGLAnimator; + }(); + + return WebGLAnimator; + }(); + + var _Promise$3 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var ImageType = PROJECTION_TYPE; + var DEVICE_PIXEL_RATIO = devicePixelRatio || 1; // DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다. + + if (DEVICE_PIXEL_RATIO > 2) { + DEVICE_PIXEL_RATIO = 2; + } // define custom events name + + /** + * TODO: how to manage events/errortype with PanoViewer + * + * I think renderer events should be seperated from viewer events although it has same name. + */ + + + var EVENTS$2 = { + BIND_TEXTURE: "bindTexture", + IMAGE_LOADED: "imageLoaded", + ERROR: "error", + RENDERING_CONTEXT_LOST: "renderingContextLost", + RENDERING_CONTEXT_RESTORE: "renderingContextRestore" + }; + var ERROR_TYPE$1 = { + INVALID_DEVICE: 10, + NO_WEBGL: 11, + FAIL_IMAGE_LOAD: 12, + RENDERER_ERROR: 13 + }; + + var PanoImageRenderer = + /*#__PURE__*/ + function () { + var PanoImageRenderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoImageRenderer, _Component); + + function PanoImageRenderer(image, width, height, isVideo, sphericalConfig, renderingContextAttributes) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + + _this._renderStereo = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var eyeParams = vr.getEyeParams(gl, frame); + if (!eyeParams) return; + vr.beforeRender(gl, frame); // Render both eyes + + for (var _i = 0, _arr = [0, 1]; _i < _arr.length; _i++) { + var eyeIndex = _arr[_i]; + var eyeParam = eyeParams[eyeIndex]; + _this.mvMatrix = eyeParam.mvMatrix; + _this.pMatrix = eyeParam.pMatrix; + gl.viewport.apply(gl, eyeParam.viewport); + gl.uniform1f(_this.shaderProgram.uEye, eyeIndex); + + _this._bindBuffers(); + + _this._draw(); + } + + vr.afterRender(); + }; + + _this.exitVR = function () { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; + if (!vr) return; + vr.removeEndCallback(_this.exitVR); + vr.destroy(); + _this._vr = null; // Restore canvas & context on iOS + + if (IS_IOS) { + _this._restoreStyle(); + } + + _this.updateViewportDimensions(_this.width, _this.height); + + _this._updateViewport(); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + _this._bindBuffers(); + + _this._shouldForceDraw = true; + animator.stop(); + animator.setContext(window); + animator.setCallback(_this._render.bind(_assertThisInitialized(_this))); + animator.start(); + }; + + _this._onFirstVRFrame = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; // If rendering is not ready, wait for next frame + + if (!vr.canRender(frame)) return; + var minusZDir = glMatrix.vec3.fromValues(0, 0, -1); + var eyeParam = vr.getEyeParams(gl, frame)[0]; // Extract only rotation + + var mvMatrix = glMatrix.mat3.fromMat4(glMatrix.mat3.create(), eyeParam.mvMatrix); + var pMatrix = glMatrix.mat3.fromMat4(glMatrix.mat3.create(), eyeParam.pMatrix); + var mvInv = glMatrix.mat3.invert(glMatrix.mat3.create(), mvMatrix); + var pInv = glMatrix.mat3.invert(glMatrix.mat3.create(), pMatrix); + var viewDir = glMatrix.vec3.transformMat3(glMatrix.vec3.create(), minusZDir, pInv); + glMatrix.vec3.transformMat3(viewDir, viewDir, mvInv); + var yawOffset = util.yawOffsetBetween(viewDir, glMatrix.vec3.fromValues(0, 0, 1)); + + if (yawOffset === 0) { + // If the yawOffset is exactly 0, then device sensor is not ready + // So read it again until it has any value in it + return; + } + + vr.setYawOffset(yawOffset); + animator.setCallback(_this._renderStereo); + }; + + _this.sphericalConfig = sphericalConfig; + _this.fieldOfView = sphericalConfig.fieldOfView; + _this.width = width; + _this.height = height; + _this._lastQuaternion = null; + _this._lastYaw = null; + _this._lastPitch = null; + _this._lastFieldOfView = null; + _this.pMatrix = glMatrix.mat4.create(); + _this.mvMatrix = glMatrix.mat4.create(); // initialzie pMatrix + + glMatrix.mat4.perspective(_this.pMatrix, glMatrix.glMatrix.toRadian(_this.fieldOfView), width / height, 0.1, 100); + _this.textureCoordBuffer = null; + _this.vertexBuffer = null; + _this.indexBuffer = null; + _this.canvas = _this._initCanvas(width, height); + + _this._setDefaultCanvasStyle(); + + _this._wrapper = null; // canvas wrapper + + _this._wrapperOrigStyle = null; + _this._renderingContextAttributes = renderingContextAttributes; + _this._image = null; + _this._imageConfig = null; + _this._imageIsReady = false; + _this._shouldForceDraw = false; + _this._keepUpdate = false; // Flag to specify 'continuous update' on video even when still. + + _this._onContentLoad = _this._onContentLoad.bind(_assertThisInitialized(_this)); + _this._onContentError = _this._onContentError.bind(_assertThisInitialized(_this)); + _this._animator = new WebGLAnimator(); // VR/XR manager + + _this._vr = null; + + if (image) { + _this.setImage({ + image: image, + imageType: sphericalConfig.imageType, + isVideo: isVideo, + cubemapConfig: sphericalConfig.cubemapConfig + }); + } + + return _this; + } // FIXME: Please refactor me to have more loose connection to yawpitchcontrol + + + var _proto = PanoImageRenderer.prototype; + + _proto.setYawPitchControl = function setYawPitchControl(yawPitchControl) { + this._yawPitchControl = yawPitchControl; + }; + + _proto.getContent = function getContent() { + return this._image; + }; + + _proto.setImage = function setImage(_ref) { + var image = _ref.image, + imageType = _ref.imageType, + _ref$isVideo = _ref.isVideo, + isVideo = _ref$isVideo === void 0 ? false : _ref$isVideo, + cubemapConfig = _ref.cubemapConfig; + this._imageIsReady = false; + this._isVideo = isVideo; + this._imageConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only */ + order: imageType === ImageType.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, cubemapConfig); + + this._setImageType(imageType); + + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + if (isVideo) { + this._contentLoader = new VideoLoader(); + this._keepUpdate = true; + } else { + this._contentLoader = new ImageLoader(); + this._keepUpdate = false; + } // img element or img url + + + this._contentLoader.set(image); // 이미지의 사이즈를 캐시한다. + // image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed. + + + this._image = this._contentLoader.getElement(); + return this._contentLoader.get().then(this._onContentLoad, this._onContentError)["catch"](function (e) { + return setTimeout(function () { + throw e; + }); + }); // Prevent exceptions from being isolated in promise chain. + }; + + _proto._setImageType = function _setImageType(imageType) { + var _this2 = this; + + if (!imageType || this._imageType === imageType) { + return; + } + + this._imageType = imageType; + this._isCubeMap = imageType === ImageType.CUBEMAP; + + if (this._renderer) { + this._renderer.off(); + } + + switch (imageType) { + case ImageType.CUBEMAP: + this._renderer = new CubeRenderer(); + break; + + case ImageType.CUBESTRIP: + this._renderer = new CubeStripRenderer(); + break; + + case ImageType.PANORAMA: + this._renderer = new CylinderRenderer(); + break; + + case ImageType.STEREOSCOPIC_EQUI: + this._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat); + break; + + default: + this._renderer = new SphereRenderer(STEREO_FORMAT.NONE); + break; + } + + this._renderer.on(Renderer.EVENTS.ERROR, function (e) { + _this2.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.RENDERER_ERROR, + message: e.message + }); + }); + + this._initWebGL(); + }; + + _proto._initCanvas = function _initCanvas(width, height) { + var canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + this._onWebglcontextlost = this._onWebglcontextlost.bind(this); + this._onWebglcontextrestored = this._onWebglcontextrestored.bind(this); + canvas.addEventListener("webglcontextlost", this._onWebglcontextlost); + canvas.addEventListener("webglcontextrestored", this._onWebglcontextrestored); + return canvas; + }; + + _proto._setDefaultCanvasStyle = function _setDefaultCanvasStyle() { + var canvas = this.canvas; + canvas.style.bottom = 0; + canvas.style.left = 0; + canvas.style.right = 0; + canvas.style.top = 0; + canvas.style.margin = "auto"; + canvas.style.maxHeight = "100%"; + canvas.style.maxWidth = "100%"; + canvas.style.outline = "none"; + canvas.style.position = "absolute"; + }; + + _proto._onContentError = function _onContentError(error) { + this._imageIsReady = false; + this._image = null; + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.FAIL_IMAGE_LOAD, + message: "failed to load image" + }); + return false; + }; + + _proto._triggerContentLoad = function _triggerContentLoad() { + this.trigger(EVENTS$2.IMAGE_LOADED, { + content: this._image, + isVideo: this._isVideo, + projectionType: this._imageType + }); + }; + + _proto._onContentLoad = function _onContentLoad(image) { + this._imageIsReady = true; + + this._triggerContentLoad(); + + return true; + }; + + _proto.isImageLoaded = function isImageLoaded() { + return !!this._image && this._imageIsReady && (!this._isVideo || this._image.readyState >= 2 + /* HAVE_CURRENT_DATA */ + ); + }; + + _proto.bindTexture = function bindTexture() { + var _this3 = this; + + return new _Promise$3(function (res, rej) { + if (!_this3._contentLoader) { + rej("ImageLoader is not initialized"); + return; + } + + _this3._contentLoader.get().then(function () { + _this3._bindTexture(); + }, rej).then(res); + }); + } // 부모 엘리먼트에 canvas 를 붙임 + ; + + _proto.attachTo = function attachTo(parentElement) { + this.detach(); + parentElement.appendChild(this.canvas); + this._wrapper = parentElement; + }; + + _proto.forceContextLoss = function forceContextLoss() { + if (this.hasRenderingContext()) { + var loseContextExtension = this.context.getExtension("WEBGL_lose_context"); + + if (loseContextExtension) { + loseContextExtension.loseContext(); + } + } + } // 부모 엘리먼트에서 canvas 를 제거 + ; + + _proto.detach = function detach() { + if (this.canvas.parentElement) { + this.canvas.parentElement.removeChild(this.canvas); + } + }; + + _proto.destroy = function destroy() { + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + this._animator.stop(); + + this.detach(); + this.forceContextLoss(); + this.off(); + this.canvas.removeEventListener("webglcontextlost", this._onWebglcontextlost); + this.canvas.removeEventListener("webglcontextrestored", this._onWebglcontextrestored); + }; + + _proto.hasRenderingContext = function hasRenderingContext() { + if (!(this.context && !this.context.isContextLost())) { + return false; + } else if (this.context && !this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) { + return false; + } + + return true; + }; + + _proto._initShaderProgram = function _initShaderProgram() { + var gl = this.context; + + if (this.shaderProgram) { + gl.deleteProgram(this.shaderProgram); + this.shaderProgram = null; + } + + var renderer = this._renderer; + var vsSource = renderer.getVertexShaderSource(); + var fsSource = renderer.getFragmentShaderSource(); + var vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource); + var fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource); + var shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader); + + if (!shaderProgram) { + throw new Error("Failed to intialize shaders: " + WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())); + } + + gl.useProgram(shaderProgram); + shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); + gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute); + shaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix"); + shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); + shaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); + shaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); + shaderProgram.uEye = gl.getUniformLocation(shaderProgram, "uEye"); + gl.enableVertexAttribArray(shaderProgram.textureCoordAttribute); // clear buffer + + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); // Use TEXTURE0 + + gl.uniform1i(shaderProgram.samplerUniform, 0); + this.shaderProgram = shaderProgram; + }; + + _proto._onWebglcontextlost = function _onWebglcontextlost(e) { + e.preventDefault(); + this.trigger(EVENTS$2.RENDERING_CONTEXT_LOST); + }; + + _proto._onWebglcontextrestored = function _onWebglcontextrestored(e) { + this._initWebGL(); + + this.trigger(EVENTS$2.RENDERING_CONTEXT_RESTORE); + }; + + _proto.updateFieldOfView = function updateFieldOfView(fieldOfView) { + this.fieldOfView = fieldOfView; + + this._updateViewport(); + }; + + _proto.updateViewportDimensions = function updateViewportDimensions(width, height) { + var viewPortChanged = false; + this.width = width; + this.height = height; + var w = width * DEVICE_PIXEL_RATIO; + var h = height * DEVICE_PIXEL_RATIO; + + if (w !== this.canvas.width) { + this.canvas.width = w; + viewPortChanged = true; + } + + if (h !== this.canvas.height) { + this.canvas.height = h; + viewPortChanged = true; + } + + if (!viewPortChanged) { + return; + } + + this._updateViewport(); + + this._shouldForceDraw = true; + }; + + _proto._updateViewport = function _updateViewport() { + glMatrix.mat4.perspective(this.pMatrix, glMatrix.glMatrix.toRadian(this.fieldOfView), this.canvas.width / this.canvas.height, 0.1, 100); + this.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight); + }; + + _proto._initWebGL = function _initWebGL() { + var gl; // TODO: Following code does need to be executed only if width/height, cubicStrip property is changed. + + try { + this._initRenderingContext(); + + gl = this.context; + this.updateViewportDimensions(this.width, this.height); + + this._initShaderProgram(); + } catch (e) { + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.NO_WEBGL, + message: "no webgl support" + }); + this.destroy(); + console.error(e); // eslint-disable-line no-console + + return; + } // 캔버스를 투명으로 채운다. + + + gl.clearColor(0, 0, 0, 0); + var textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D; + + if (this.texture) { + gl.deleteTexture(this.texture); + } + + this.texture = WebGLUtils.createTexture(gl, textureTarget); + + if (this._imageType === ImageType.CUBESTRIP) { + // TODO: Apply following options on other projection type. + gl.enable(gl.CULL_FACE); // gl.enable(gl.DEPTH_TEST); + } + }; + + _proto._initRenderingContext = function _initRenderingContext() { + if (this.hasRenderingContext()) { + return; + } + + if (!window.WebGLRenderingContext) { + throw new Error("WebGLRenderingContext not available."); + } + + this.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes); + + if (!this.context) { + throw new Error("Failed to acquire 3D rendering context"); + } + }; + + _proto._initBuffers = function _initBuffers() { + var vertexPositionData = this._renderer.getVertexPositionData(); + + var indexData = this._renderer.getIndexData(); + + var textureCoordData = this._renderer.getTextureCoordData(this._imageConfig); + + var gl = this.context; + this.vertexBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3, this.shaderProgram.vertexPositionAttribute); + this.indexBuffer = WebGLUtils.initBuffer(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1); + this.textureCoordBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2, this.shaderProgram.textureCoordAttribute); + + this._bindBuffers(); + }; + + _proto._bindTexture = function _bindTexture() { + // Detect if it is EAC Format while CUBESTRIP mode. + // We assume it is EAC if image is not 3/2 ratio. + if (this._imageType === ImageType.CUBESTRIP) { + var _this$_renderer$getDi = this._renderer.getDimension(this._image), + width = _this$_renderer$getDi.width, + height = _this$_renderer$getDi.height; + + var isEAC = width && height && width / height !== 1.5; + this.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, "uIsEAC"), isEAC); + } else if (this._imageType === ImageType.PANORAMA) { + var _this$_renderer$getDi2 = this._renderer.getDimension(this._image), + _width = _this$_renderer$getDi2.width, + _height = _this$_renderer$getDi2.height; + + var imageAspectRatio = _width && _height && _width / _height; + + this._renderer.updateShaderData({ + imageAspectRatio: imageAspectRatio + }); + } // intialize shader buffers after image is loaded.(by updateShaderData) + // because buffer may be differ by image size.(eg. CylinderRenderer) + + + this._initBuffers(); + + this._renderer.bindTexture(this.context, this.texture, this._image, this._imageConfig); + + this._shouldForceDraw = true; + this.trigger(EVENTS$2.BIND_TEXTURE); + }; + + _proto._updateTexture = function _updateTexture() { + this._renderer.updateTexture(this.context, this._image, this._imageConfig); + }; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + if (doUpdate && this.isImageLoaded() === false) { + // Force to draw a frame after image is loaded on render() + this._shouldForceDraw = true; + } + + this._keepUpdate = doUpdate; + }; + + _proto.startRender = function startRender() { + this._animator.setCallback(this._render.bind(this)); + + this._animator.start(); + }; + + _proto.stopRender = function stopRender() { + this._animator.stop(); + }; + + _proto.renderWithQuaternion = function renderWithQuaternion(quaternion, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastQuaternion && glMatrix.quat.exactEquals(this._lastQuaternion, quaternion) && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // updatefieldOfView only if fieldOfView is changed. + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + this.mvMatrix = glMatrix.mat4.fromQuat(glMatrix.mat4.create(), quaternion); + + this._draw(); + + this._lastQuaternion = glMatrix.quat.clone(quaternion); + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto.renderWithYawPitch = function renderWithYawPitch(yaw, pitch, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastYaw !== null && this._lastYaw === yaw && this._lastPitch !== null && this._lastPitch === pitch && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출 + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + glMatrix.mat4.identity(this.mvMatrix); + glMatrix.mat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.glMatrix.toRadian(pitch)); + glMatrix.mat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.glMatrix.toRadian(yaw)); + + this._draw(); + + this._lastYaw = yaw; + this._lastPitch = pitch; + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto._render = function _render() { + var yawPitchControl = this._yawPitchControl; + var fov = yawPitchControl.getFov(); + + if (yawPitchControl.shouldRenderWithQuaternion()) { + var quaternion = yawPitchControl.getQuaternion(); + this.renderWithQuaternion(quaternion, fov); + } else { + var yawPitch = yawPitchControl.getYawPitch(); + this.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov); + } + }; + + _proto._bindBuffers = function _bindBuffers() { + var gl = this.context; + var program = this.shaderProgram; + var vertexBuffer = this.vertexBuffer; + var textureCoordBuffer = this.textureCoordBuffer; + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + gl.enableVertexAttribArray(program.vertexPositionAttribute); + gl.vertexAttribPointer(program.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer); + gl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer); + gl.enableVertexAttribArray(program.textureCoordAttribute); + gl.vertexAttribPointer(program.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0); + }; + + _proto._draw = function _draw() { + if (this._isVideo && this._keepUpdate) { + this._updateTexture(); + } + + this._renderer.render({ + gl: this.context, + shaderProgram: this.shaderProgram, + indexBuffer: this.indexBuffer, + mvMatrix: this.mvMatrix, + pMatrix: this.pMatrix + }); + } + /** + * Returns projection renderer by each type + */ + ; + + _proto.getProjectionRenderer = function getProjectionRenderer() { + return this._renderer; + } + /** + * @return Promise + */ + ; + + _proto.enterVR = function enterVR() { + var vr = this._vr; + + if (!WEBXR_SUPPORTED && !navigator.getVRDisplays) { + return _Promise$3.reject("VR is not available on this browser."); + } + + if (vr && vr.isPresenting()) { + return _Promise$3.resolve("VR already enabled."); + } + + return this._requestPresent(); + }; + + _proto._requestPresent = function _requestPresent() { + var _this4 = this; + + var gl = this.context; + var canvas = this.canvas; + var animator = this._animator; + this._vr = WEBXR_SUPPORTED ? new XRManager() : new VRManager(); + var vr = this._vr; + animator.stop(); + return new _Promise$3(function (resolve, reject) { + vr.requestPresent(canvas, gl).then(function () { + vr.addEndCallback(_this4.exitVR); + animator.setContext(vr.context); + animator.setCallback(_this4._onFirstVRFrame); + + if (IS_IOS) { + _this4._setWrapperFullscreen(); + } + + _this4._shouldForceDraw = true; + animator.start(); + resolve("success"); + })["catch"](function (e) { + vr.destroy(); + _this4._vr = null; + animator.start(); + reject(e); + }); + }); + }; + + _proto._setWrapperFullscreen = function _setWrapperFullscreen() { + var wrapper = this._wrapper; + if (!wrapper) return; + this._wrapperOrigStyle = wrapper.getAttribute("style"); + var wrapperStyle = wrapper.style; + wrapperStyle.width = "100vw"; + wrapperStyle.height = "100vh"; + wrapperStyle.position = "fixed"; + wrapperStyle.left = "0"; + wrapperStyle.top = "0"; + wrapperStyle.zIndex = "9999"; + }; + + _proto._restoreStyle = function _restoreStyle() { + var wrapper = this._wrapper; + var canvas = this.canvas; + if (!wrapper) return; + + if (this._wrapperOrigStyle) { + wrapper.setAttribute("style", this._wrapperOrigStyle); + } else { + wrapper.removeAttribute("style"); + } + + this._wrapperOrigStyle = null; // Restore canvas style + + canvas.removeAttribute("style"); + + this._setDefaultCanvasStyle(); + }; + + return PanoImageRenderer; + }(Component); + + PanoImageRenderer.EVENTS = EVENTS$2; + PanoImageRenderer.ERROR_TYPE = ERROR_TYPE$1; + return PanoImageRenderer; + }(); + + var _Promise$4 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + + var PanoViewer = + /*#__PURE__*/ + function () { + var PanoViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.PanoViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.PanoViewer + */ + // It should be deprecated! + + /** + * Constant value for touch directions + * @ko 터치 방향에 대한 상수 값. + * @namespace + * @name TOUCH_DIRECTION + * @memberof eg.view360.PanoViewer + */ + + /** + * @classdesc 360 media viewer + * @ko 360 미디어 뷰어 + * @class + * @name eg.view360.PanoViewer + * @extends eg.Component + * + * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트 + * @param {Object} config + * + * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
+ * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다. + * @param {Object} [config.cubemapConfig.order = "RLUDBF"(ProjectionType === CUBEMAP) | "RLUDFB" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서 + * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다. + * @param {String} [config.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
+ * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위) + * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위) + * + * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위) + * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위) + * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위) + * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다 + * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다. + * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키 + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE}
+ * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위 + * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위 + * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위 + * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
+ * + * @example + * // PanoViewer Creation + * // create PanoViewer with option + * var PanoViewer = eg.view360.PanoViewer; + * // Area where the image will be displayed(HTMLElement) + * var container = document.getElementById("myPanoViewer"); + * + * var panoViewer = new PanoViewer(container, { + * // If projectionType is not specified, the default is "equirectangular". + * // Specifies an image of the "equirectangular" type. + * image: "/path/to/image/image.jpg" + *}); + * + * @example + * // Cubemap Config Setting Example + * // For support Youtube EAC projection, You should set cubemapConfig as follows. + * cubemapConfig: { + * order: "LFRDBU", + * tileConfig: [ + * tileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}] + * ] + * } + */ + function PanoViewer(container, options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Component.call(this) || this; // Raises the error event if webgl is not supported. + + if (!WebGLUtils.isWebGLAvailable()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.NO_WEBGL, + message: "no webgl support" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!WebGLUtils.isStableWebGL()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_DEVICE, + message: "blacklisted browser" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!!options.image && !!options.video) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_RESOURCE, + message: "Specifying multi resouces(both image and video) is not valid." + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } // Check XR support at not when imported, but when created. + // This is intended to make polyfills easier to use. + + + checkXRSupport(); + _this._container = container; + _this._image = options.image || options.video; + _this._isVideo = !!options.video; + _this._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + _this._cubemapConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/ + order: _this._projectionType === PROJECTION_TYPE.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, options.cubemapConfig); + _this._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; // If the width and height are not provided, will use the size of the container. + + _this._width = options.width || parseInt(window.getComputedStyle(container).width, 10); + _this._height = options.height || parseInt(window.getComputedStyle(container).height, 10); + /** + * Cache the direction for the performance in renderLoop + * + * This value should be updated by "change" event of YawPitchControl. + */ + + _this._yaw = options.yaw || 0; + _this._pitch = options.pitch || 0; + _this._fov = options.fov || 65; + _this._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH; + _this._quaternion = null; + _this._aspectRatio = _this._height !== 0 ? _this._width / _this._height : 1; + var fovRange = options.fovRange || [30, 110]; + var touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ? options.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL; + + var yawPitchConfig = _extends(options, { + element: container, + yaw: _this._yaw, + pitch: _this._pitch, + fov: _this._fov, + gyroMode: _this._gyroMode, + fovRange: fovRange, + aspectRatio: _this._aspectRatio, + touchDirection: touchDirection + }); + + _this._isReady = false; + + _this._initYawPitchControl(yawPitchConfig); + + _this._initRenderer(_this._yaw, _this._pitch, _this._fov, _this._projectionType, _this._cubemapConfig); + + return _this; + } + /** + * Get the video element that the viewer is currently playing. You can use this for playback. + * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다. + * @method eg.view360.PanoViewer#getVideo + * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement + * @example + * var videoTag = panoViewer.getVideo(); + * videoTag.play(); // play video! + */ + + + var _proto = PanoViewer.prototype; + + _proto.getVideo = function getVideo() { + if (!this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the video information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setVideo + * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정) + * @param {Object} param + * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}("equirectangular")] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setVideo("/path/to/video/video.mp4", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR + * }); + */ + ; + + _proto.setVideo = function setVideo(video, param) { + if (param === void 0) { + param = {}; + } + + if (video) { + this.setImage(video, { + projectionType: param.projectionType, + isVideo: true, + cubemapConfig: param.cubemapConfig, + stereoFormat: param.stereoFormat + }); + } + + return this; + } + /** + * Get the image information that the viewer is currently using. + * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다. + * @method eg.view360.PanoViewer#getImage + * @return {Image} Image Object이미지 객체 + * @example + * var imageObj = panoViewer.getImage(); + */ + ; + + _proto.getImage = function getImage() { + if (this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the image information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setImage + * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.) + * @param {Object} param Additional information이미지 추가 정보 + * @param {String} [param.projectionType="equirectangular"] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setImage("/path/to/image/image.png", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP + * }); + */ + ; + + _proto.setImage = function setImage(image, param) { + if (param === void 0) { + param = {}; + } + + var cubemapConfig = _extends({ + order: "RLUDBF", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, param.cubemapConfig); + + var stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; + var isVideo = !!param.isVideo; + + if (this._image && this._isVideo !== isVideo) { + /* eslint-disable no-console */ + console.warn("Currently not supporting to change content type(Image <--> Video)"); + /* eslint-enable no-console */ + + return this; + } + + if (image) { + this._image = image; + this._isVideo = isVideo; + this._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + this._cubemapConfig = cubemapConfig; + this._stereoFormat = stereoFormat; + + this._deactivate(); + + this._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig); + } + + return this; + } + /** + * Set whether the renderer always updates the texture and renders. + * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다. + * + * @method eg.view360.PanoViewer#keepUpdate + * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다. + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + this._photoSphereRenderer.keepUpdate(doUpdate); + + return this; + } + /** + * Get projection type (equirectangular/cube) + * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다. + * + * @method eg.view360.PanoViewer#getProjectionType + * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE} + */ + ; + + _proto.getProjectionType = function getProjectionType() { + return this._projectionType; + } + /** + * Activate the device's motion sensor, and return the Promise whether the sensor is enabled + * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element. + * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다. + * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * @method eg.view360.PanoViewer#enableSensor + * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다. + */ + ; + + _proto.enableSensor = function enableSensor() { + return new _Promise$4(function (resolve, reject) { + if (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === "function") { + DeviceMotionEvent.requestPermission().then(function (permissionState) { + if (permissionState === "granted") { + resolve(); + } else { + reject(new Error("permission denied")); + } + })["catch"](function (e) { + // This can happen when this method wasn't triggered by user interaction + reject(e); + }); + } else { + resolve(); + } + }); + } + /** + * Disable the device's motion sensor. + * @ko 디바이스의 모션 센서를 비활성화합니다. + * @deprecated + * @method eg.view360.PanoViewer#disableSensor + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.disableSensor = function disableSensor() { + return this; + } + /** + * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred). + * This method must be used in the context of user interaction, like onclick callback on the button element. + * It can be rejected when an enabling device sensor fails or image/video is still loading("ready" event not triggered). + * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다) + * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우("ready"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다. + * @method eg.view360.PanoViewer#enterVR + * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error) + */ + ; + + _proto.enterVR = function enterVR() { + var _this2 = this; + + if (!this._isReady) { + return _Promise$4.reject(new Error("PanoViewer is not ready to show image.")); + } + + return new _Promise$4(function (resolve, reject) { + _this2.enableSensor().then(function () { + return _this2._photoSphereRenderer.enterVR(); + }).then(function (res) { + return resolve(res); + })["catch"](function (e) { + return reject(e); + }); + }); + } + /** + * Exit VR stereo rendering mode. + * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다. + * + * @method eg.view360.PanoViewer#exitVR + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.exitVR = function exitVR() { + this._photoSphereRenderer.exitVR(); + + return this; + } // TODO: Remove parameters as they're just using private values + ; + + _proto._initRenderer = function _initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) { + var _this3 = this; + + this._photoSphereRenderer = new PanoImageRenderer(this._image, this._width, this._height, this._isVideo, { + initialYaw: yaw, + initialPitch: pitch, + fieldOfView: fov, + imageType: projectionType, + cubemapConfig: cubemapConfig, + stereoFormat: this._stereoFormat + }); + + this._photoSphereRenderer.setYawPitchControl(this._yawPitchControl); + + this._bindRendererHandler(); + + this._photoSphereRenderer.bindTexture().then(function () { + return _this3._activate(); + })["catch"](function () { + _this3._triggerEvent(EVENTS$1.ERROR, { + type: ERROR_TYPE.FAIL_BIND_TEXTURE, + message: "failed to bind texture" + }); + }); + } + /** + * update values of YawPitchControl if needed. + * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image. + * + * This function should be called after isReady status is true. + */ + ; + + _proto._updateYawPitchIfNeeded = function _updateYawPitchIfNeeded() { + if (this._projectionType === PanoViewer.ProjectionType.PANORAMA) { + // update fov by aspect ratio + var image = this._photoSphereRenderer.getContent(); + + var imageAspectRatio = image.naturalWidth / image.naturalHeight; + var isCircular; + var yawSize; + var maxFov; // If height is larger than width, then we assume it's rotated by 90 degree. + + if (imageAspectRatio < 1) { + // So inverse the aspect ratio. + imageAspectRatio = 1 / imageAspectRatio; + } + + if (imageAspectRatio < 6) { + yawSize = util.toDegree(imageAspectRatio); + isCircular = false; // 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5 + + maxFov = util.toDegree(Math.atan(0.5)) * 2; + } else { + yawSize = 360; + isCircular = true; + maxFov = 360 / imageAspectRatio; // Make it 5 fixed as axes does. + } // console.log("_updateYawPitchIfNeeded", maxFov, "aspectRatio", image.naturalWidth, image.naturalHeight, "yawSize", yawSize); + + + var minFov = this._yawPitchControl.option("fovRange")[0]; // this option should be called after fov is set. + + + this._yawPitchControl.option({ + "fov": maxFov, + + /* parameter for internal validation for pitchrange */ + "yawRange": [-yawSize / 2, yawSize / 2], + isCircular: isCircular, + "pitchRange": [-maxFov / 2, maxFov / 2], + "fovRange": [minFov, maxFov] + }); + + this.lookAt({ + fov: maxFov + }); + } + }; + + _proto._bindRendererHandler = function _bindRendererHandler() { + var _this4 = this; + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, function (e) { + _this4.trigger(EVENTS$1.ERROR, e); + }); + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, function (e) { + _this4._deactivate(); + + _this4.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.RENDERING_CONTEXT_LOST, + message: "webgl rendering context lost" + }); + }); + }; + + _proto._initYawPitchControl = function _initYawPitchControl(yawPitchConfig) { + var _this5 = this; + + this._yawPitchControl = new YawPitchControl(yawPitchConfig); + + this._yawPitchControl.on(EVENTS$1.ANIMATION_END, function (e) { + _this5._triggerEvent(EVENTS$1.ANIMATION_END, e); + }); + + this._yawPitchControl.on("change", function (e) { + _this5._yaw = e.yaw; + _this5._pitch = e.pitch; + _this5._fov = e.fov; + _this5._quaternion = e.quaternion; + + _this5._triggerEvent(EVENTS$1.VIEW_CHANGE, e); + }); + }; + + _proto._triggerEvent = function _triggerEvent(name, param) { + var evt = param || {}; + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name eg.view360.PanoViewer#error + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.type Error type + * 10: INVALID_DEVICE: Unsupported device + * 11: NO_WEBGL: Webgl not support + * 12, FAIL_IMAGE_LOAD: Failed to load image + * 13: FAIL_BIND_TEXTURE: Failed to bind texture + * 14: INVALID_RESOURCE: Only one resource(image or video) should be specified + * 15: RENDERING_CONTEXT_LOST: WebGL context lost occurred + * 에러 종류 + * 10: INVALID_DEVICE: 미지원 기기 + * 11: NO_WEBGL: WEBGL 미지원 + * 12, FAIL_IMAGE_LOAD: 이미지 로드 실패 + * 13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패 + * 14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * 15: RENDERING_CONTEXT_LOST: WebGL context lost 발생 + * + * @param {String} param.message Error message 에러 메시지 + * @see {@link eg.view360.PanoViewer.ERROR_TYPE} + * @example + * + * viwer.on({ + * "error" : function(evt) { + * // evt.type === 13 + * // evt.message === "failed to bind texture" + * }); + * + * // constant can be used + * viwer.on({ + * eg.view360.PanoViewer.EVENTS.ERROR : function(evt) { + * // evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE + * // evt.message === "failed to bind texture" + * }); + */ + + /** + * Events that is fired when PanoViewer is ready to go. + * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트 + * @name eg.view360.PanoViewer#ready + * @event + * + * @example + * + * viwer.on({ + * "ready" : function(evt) { + * // PanoViewer is ready to show image and handle user interaction. + * }); + */ + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#viewChange + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.yaw yawyaw + * @param {Number} param.pitch pitch pitch + * @param {Number} param.fov Field of view (fov) 화각 + * @example + * + * viwer.on({ + * "viewChange" : function(evt) { + * //evt.yaw, evt.pitch, evt.fov is available. + * }); + */ + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#animationEnd + * @event + * @example + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // animation is ended. + * }); + */ + + return this.trigger(name, evt); + } + /** + * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}. + * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다. + * @method eg.view360.PanoViewer#setUseZoom + * @param {Boolean} useZoom + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseZoom = function setUseZoom(useZoom) { + typeof useZoom === "boolean" && this._yawPitchControl.option("useZoom", useZoom); + return this; + } + /** + * When true, enables the keyboard move key control: awsd, arrow keys + * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키) + * @method eg.view360.PanoViewer#setUseKeyboard + * @param {Boolean} useKeyboard + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseKeyboard = function setUseKeyboard(useKeyboard) { + this._yawPitchControl.option("useKeyboard", useKeyboard); + + return this; + } + /** + * Enables control through device motion. ("none", "yawPitch", "VR") + * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR") + * @method eg.view360.PanoViewer#setGyroMode + * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE} + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setGyroMode("yawPitch"); + * //equivalent + * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH); + */ + ; + + _proto.setGyroMode = function setGyroMode(gyroMode) { + this._yawPitchControl.option("gyroMode", gyroMode); + + return this; + } + /** + * Set the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 설정합니다. + * @method eg.view360.PanoViewer#setFovRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setFovRange([50, 90]); + */ + ; + + _proto.setFovRange = function setFovRange(range) { + this._yawPitchControl.option("fovRange", range); + + return this; + } + /** + * Getting the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 반환합니다. + * @method eg.view360.PanoViewer#getFovRange + * @return {Array} + * @example + * var range = panoViewer.getFovRange(); //[50, 90] + */ + ; + + _proto.getFovRange = function getFovRange() { + return this._yawPitchControl.option("fovRange"); + } + /** + * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size. + * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다. + * @method eg.view360.PanoViewer#updateViewportDimensions + * @param {Object} [size] + * @param {Number} [size.width=width of container] + * @param {Number} [size.height=height of container] + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.updateViewportDimensions = function updateViewportDimensions(size) { + if (size === void 0) { + size = { + width: undefined, + height: undefined + }; + } + + if (!this._isReady) { + return this; + } + + var containerSize; + + if (size.width === undefined || size.height === undefined) { + containerSize = window.getComputedStyle(this._container); + } + + var width = size.width || parseInt(containerSize.width, 10); + var height = size.height || parseInt(containerSize.height, 10); // Skip if viewport is not changed. + + if (width === this._width && height === this._height) { + return this; + } + + this._width = width; + this._height = height; + this._aspectRatio = width / height; + + this._photoSphereRenderer.updateViewportDimensions(width, height); + + this._yawPitchControl.option("aspectRatio", this._aspectRatio); + + this._yawPitchControl.updatePanScale({ + height: height + }); + + this.lookAt({}, 0); + return this; + } + /** + * Get the current field of view(FOV) + * @ko 현재 field of view(FOV) 값을 반환합니다. + * @method eg.view360.PanoViewer#getFov + * @return {Number} + */ + ; + + _proto.getFov = function getFov() { + return this._fov; + } + /** + * Get the horizontal field of view in degree + */ + ; + + _proto._getHFov = function _getHFov() { + return util.toDegree(2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.glMatrix.toRadian(this._fov) / 2))); + } + /** + * Get current yaw value + * @ko 현재 yaw 값을 반환합니다. + * @method eg.view360.PanoViewer#getYaw + * @return {Number} + */ + ; + + _proto.getYaw = function getYaw() { + return this._yaw; + } + /** + * Get current pitch value + * @ko 현재 pitch 값을 반환합니다. + * @method eg.view360.PanoViewer#getPitch + * @return {Number} + */ + ; + + _proto.getPitch = function getPitch() { + return this._pitch; + } + /** + * Get the range of controllable Yaw values + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#getYawRange + * @return {Array} + */ + ; + + _proto.getYawRange = function getYawRange() { + return this._yawPitchControl.option("yawRange"); + } + /** + * Get the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다. + * @method eg.view360.PanoViewer#getPitchRange + * @return {Array} + */ + ; + + _proto.getPitchRange = function getPitchRange() { + return this._yawPitchControl.option("pitchRange"); + } + /** + * Set the range of controllable yaw + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#setYawRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setYawRange([-90, 90]); + */ + ; + + _proto.setYawRange = function setYawRange(yawRange) { + this._yawPitchControl.option("yawRange", yawRange); + + return this; + } + /** + * Set the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 설정합니다. + * @method eg.view360.PanoViewer#setPitchRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setPitchRange([-40, 40]); + */ + ; + + _proto.setPitchRange = function setPitchRange(pitchRange) { + this._yawPitchControl.option("pitchRange", pitchRange); + + return this; + } + /** + * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed. + * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다. + * @method eg.view360.PanoViewer#setShowPolePoint + * @param {Boolean} showPolePoint + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setShowPolePoint = function setShowPolePoint(showPolePoint) { + this._yawPitchControl.option("showPolePoint", showPolePoint); + + return this; + } + /** + * Set a new view by setting camera configuration. Any parameters not specified remain the same. + * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다. + * @method eg.view360.PanoViewer#lookAt + * @param {Object} orientation + * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위) + * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위) + * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위) + * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초) + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * // Change the yaw angle (absolute angle) to 30 degrees for one second. + * panoViewer.lookAt({yaw: 30}, 1000); + */ + ; + + _proto.lookAt = function lookAt(orientation, duration) { + if (!this._isReady) { + return this; + } + + var yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw; + var pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch; + + var pitchRange = this._yawPitchControl.option("pitchRange"); + + var verticalAngleOfImage = pitchRange[1] - pitchRange[0]; + var fov = orientation.fov !== undefined ? orientation.fov : this._fov; + + if (verticalAngleOfImage < fov) { + fov = verticalAngleOfImage; + } + + this._yawPitchControl.lookAt({ + yaw: yaw, + pitch: pitch, + fov: fov + }, duration); + + if (duration === 0) { + this._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov); + } + + return this; + }; + + _proto._activate = function _activate() { + this._photoSphereRenderer.attachTo(this._container); + + this._yawPitchControl.enable(); + + this.updateViewportDimensions(); + this._isReady = true; // update yawPitchControl after isReady status is true. + + this._updateYawPitchIfNeeded(); + + this._triggerEvent(EVENTS$1.READY); + + this._photoSphereRenderer.startRender(); + } + /** + * Destroy webgl context and block user interaction and stop rendering + */ + ; + + _proto._deactivate = function _deactivate() { + if (this._isReady) { + this._photoSphereRenderer.stopRender(); + + this._yawPitchControl.disable(); + + this._isReady = false; + } + + if (this._photoSphereRenderer) { + this._photoSphereRenderer.destroy(); + + this._photoSphereRenderer = null; + } + }; + + PanoViewer._isValidTouchDirection = function _isValidTouchDirection(direction) { + return direction === PanoViewer.TOUCH_DIRECTION.NONE || direction === PanoViewer.TOUCH_DIRECTION.YAW || direction === PanoViewer.TOUCH_DIRECTION.PITCH || direction === PanoViewer.TOUCH_DIRECTION.ALL; + } + /** + * Set touch direction by which user can control. + * @ko 사용자가 조작가능한 터치 방향을 지정합니다. + * @method eg.view360.PanoViewer#setTouchDirection + * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @return {eg.view360.PanoViewer} PanoViewer instance + * @example + * + * panoViewer = new PanoViewer(el); + * // Limit the touch direction to the yaw direction only. + * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW); + */ + ; + + _proto.setTouchDirection = function setTouchDirection(direction) { + if (PanoViewer._isValidTouchDirection(direction)) { + this._yawPitchControl.option("touchDirection", direction); + } + + return this; + } + /** + * Returns touch direction by which user can control + * @ko 사용자가 조작가능한 터치 방향을 반환한다. + * @method eg.view360.PanoViewer#getTouchDirection + * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @example + * + * panoViewer = new PanoViewer(el); + * // Returns the current touch direction. + * var dir = panoViewer.getTouchDirection(); + */ + ; + + _proto.getTouchDirection = function getTouchDirection() { + return this._yawPitchControl.option("touchDirection"); + } + /** + * Destroy viewer. Remove all registered event listeners and remove viewer canvas. + * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다. + * @method eg.view360.PanoViewer#destroy + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.destroy = function destroy() { + this._deactivate(); + + if (this._yawPitchControl) { + this._yawPitchControl.destroy(); + + this._yawPitchControl = null; + } + + return this; + } + /** + * Check whether the current environment can execute PanoViewer + * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다. + * @function isSupported + * @memberof eg.view360.PanoViewer + * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부 + * @static + */ + ; + + PanoViewer.isSupported = function isSupported() { + return WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL(); + } + /** + * Check whether the current environment supports the WebGL + * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다. + * @function isWebGLAvailable + * @memberof eg.view360.PanoViewer + * @return {Boolean} WebGL support WebGL 지원여부 + * @static + */ + ; + + PanoViewer.isWebGLAvailable = function isWebGLAvailable() { + return WebGLUtils.isWebGLAvailable(); + } + /** + * Check whether the current environment supports the gyro sensor. + * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다. + * @function isGyroSensorAvailable + * @memberof eg.view360.PanoViewer + * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수 + * @static + */ + ; + + PanoViewer.isGyroSensorAvailable = function isGyroSensorAvailable(callback) { + if (!DeviceMotionEvent) { + callback && callback(false); + return; + } + + var onDeviceMotionChange; + + function checkGyro() { + return new _Promise$4(function (res, rej) { + onDeviceMotionChange = function onDeviceMotionChange(deviceMotion) { + var isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null); + res(isGyroSensorAvailable); + }; + + window.addEventListener("devicemotion", onDeviceMotionChange); + }); + } + + function timeout() { + return new _Promise$4(function (res, rej) { + setTimeout(function () { + return res(false); + }, 1000); + }); + } + + _Promise$4.race([checkGyro(), timeout()]).then(function (isGyroSensorAvailable) { + window.removeEventListener("devicemotion", onDeviceMotionChange); + callback && callback(isGyroSensorAvailable); + + PanoViewer.isGyroSensorAvailable = function (fb) { + fb && fb(isGyroSensorAvailable); + return isGyroSensorAvailable; + }; + }); + }; + + return PanoViewer; + }(Component); + + PanoViewer.VERSION = VERSION; + PanoViewer.ERROR_TYPE = ERROR_TYPE; + PanoViewer.EVENTS = EVENTS$1; + PanoViewer.PROJECTION_TYPE = PROJECTION_TYPE; + PanoViewer.GYRO_MODE = GYRO_MODE; + PanoViewer.ProjectionType = PROJECTION_TYPE; + PanoViewer.STEREO_FORMAT = STEREO_FORMAT; + PanoViewer.TOUCH_DIRECTION = { + /** + * Constant value for none direction. + * @ko none 방향에 대한 상수 값. + * @name NONE + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 1 + */ + NONE: YawPitchControl.TOUCH_DIRECTION_NONE, + + /** + * Constant value for horizontal(yaw) direction. + * @ko horizontal(yaw) 방향에 대한 상수 값. + * @name YAW + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 6 + */ + YAW: YawPitchControl.TOUCH_DIRECTION_YAW, + + /** + * Constant value for vertical direction. + * @ko vertical(pitch) 방향에 대한 상수 값. + * @name PITCH + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 24 + */ + PITCH: YawPitchControl.TOUCH_DIRECTION_PITCH, + + /** + * Constant value for all direction. + * @ko all 방향에 대한 상수 값. + * @name ALL + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 30 + */ + ALL: YawPitchControl.TOUCH_DIRECTION_ALL + }; + return PanoViewer; + }(); + + /** + * @class eg.view360.SpriteImage + * @classdesc A module that displays a single or continuous image of any one of the "sprite images". SpinViewer internally uses SpriteImage to show each frame of the sprite image. + * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the "Sprite image". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
+ * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpriteImage + * + * var el = document.getElementById("image-div"); + * var sprites = new eg.view360.SpriteImage(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 + * }); + */ + + var SpriteImage = + /*#__PURE__*/ + function () { + var SpriteImage = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpriteImage, _Component); + + function SpriteImage(element, options) { + var _this; + + _this = _Component.call(this) || this; + var opt = options || {}; + _this._el = element; + _this._rowCount = opt.rowCount || 1; + _this._colCount = opt.colCount || 1; + _this._totalCount = _this._rowCount * _this._colCount; // total frames + + _this._width = opt.width || "auto"; + _this._height = opt.height || "auto"; + _this._autoHeight = opt.autoHeight != null ? opt.autoHeight : "true"; // If autoHeight is specified, _height will be overwritten. + + _this._colRow = [0, 0]; + + if (opt.colRow) { + _this._colRow = opt.colRow; + } else if (opt.frameIndex) { + _this.setFrameIndex(opt.frameIndex); + } + + _this._el.style.width = SpriteImage._getSizeString(_this._width); + _this._el.style.height = SpriteImage._getSizeString(_this._height); + + if (!opt.imageUrl) { + setTimeout(function () { + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }, 0); + return _assertThisInitialized(_this); + } + + _this._image = new Image(); + /** + * Event + */ + + _this._image.onload = function () { + _this._bg = SpriteImage._createBgDiv(_this._image, _this._rowCount, _this._colCount, _this._autoHeight); + + _this._el.appendChild(_this._bg); + + _this.setColRow(_this._colRow[0], _this._colRow[1]); + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpriteImage#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * sprites.on({ + * "load" : function(evt) { + * console.log("load event fired - e.target", e.target, "e.bgElement", e.bgElement); + * } + * }); + */ + + + _this.trigger("load", { + target: _this._el, + bgElement: _this._bg + }); + + if (_this._autoPlayReservedInfo) { + _this.play(_this._autoPlayReservedInfo); + + _this._autoPlayReservedInfo = null; + } + }; + + _this._image.onerror = function (e) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpriteImage#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * sprites.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }; + + _this._image.src = opt.imageUrl; + return _this; + } + + SpriteImage._createBgDiv = function _createBgDiv(img, rowCount, colCount, autoHeight) { + var el = document.createElement("div"); + el.style.position = "relative"; + el.style.overflow = "hidden"; + img.style.position = "absolute"; + img.style.width = colCount * 100 + "%"; + img.style.height = rowCount * 100 + "%"; + /** Prevent image from being dragged on IE10, IE11, Safari especially */ + + img.ondragstart = function () { + return false; + }; // img.style.pointerEvents = "none"; + // Use hardware accelerator if available + + + SUPPORT_WILLCHANGE && (img.style.willChange = "transform"); + el.appendChild(img); + var unitWidth = img.width / colCount; + var unitHeight = img.height / rowCount; + + if (autoHeight) { + var r = unitHeight / unitWidth; + el.style.paddingBottom = r * 100 + "%"; + } else { + el.style.height = "100%"; + } + + return el; + } + /** + * Specifies the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정 + * @method eg.view360.SpriteImage#setFrameIndex + * @param {Number} frameIndex frame index of a frame프레임의 인덱스 + * + * @example + * + * sprites.setFrameIndex(0, 1);// col = 0, row = 1 + */ + ; + + var _proto = SpriteImage.prototype; + + _proto.setFrameIndex = function setFrameIndex(index) { + var colRow = this.toColRow(index); + this.setColRow(colRow[0], colRow[1]); + } + /** + * Returns the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환 + * @method eg.view360.SpriteImage#getFrameIndex + * @return {Number} frame index frame 인덱스 + * + * @example + * + * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1 + * + */ + ; + + _proto.getFrameIndex = function getFrameIndex() { + return this._colRow[1] * this._colCount + this._colRow[0]; + } + /** + * Specifies the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정 + * @method eg.view360.SpriteImage#setColRow + * @param {Number} col Column number of a frame프레임의 행값 + * @param {Number} row Row number of a frame프레임의 열값 + * + * @example + * + * sprites.setlColRow(1, 2); // col = 1, row = 2 + */ + ; + + _proto.setColRow = function setColRow(col, row) { + if (row > this._rowCount - 1 || col > this._colCount - 1) { + return; + } + + if (this._image && TRANSFORM) { + // NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser? + this._image.style[TRANSFORM] = "translate(" + -(col / this._colCount * 100) + "%, " + -(row / this._rowCount * 100) + "%)"; + } + + this._colRow = [col, row]; + } + /** + * Returns the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환 + * @method eg.view360.SpriteImage#gelColRow + * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열 + * + * @example + * + * var colRow = sprites.getlColRow(); + * // colRow = [1, 2] - index of col is 1, index of row is 2 + * + */ + ; + + _proto.getColRow = function getColRow() { + return this._colRow; + }; + + SpriteImage._getSizeString = function _getSizeString(size) { + if (typeof size === "number") { + return size + "px"; + } + + return size; + } + /** + * Stop playing + * @ko play 되고 있던 프레임 재생을 중지합니다. + * @method eg.view360.SpriteImage#stop + * + * @example + * + * viewer.stop(); + * + */ + ; + + _proto.stop = function stop() { + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + } + /** + * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'. + * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다. + * @method eg.view360.SpriteImage#play + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위 + * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복 + * + * @example + * + * viewer.play({angle: 16, playCount: 1}); + * + */ + ; + + _proto.play = function play(_temp) { + var _this2 = this; + + var _ref = _temp === void 0 ? { + interval: 1000 / this._totalCount, + playCount: 0 + } : _temp, + interval = _ref.interval, + playCount = _ref.playCount; + + if (!this._bg) { + this._autoPlayReservedInfo = { + interval: interval, + playCount: playCount + }; + return; + } + + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + + var frameIndex = this.getFrameIndex(); + var count = 0; + var frameCount = 0; // for checking 1 cycle + + this._autoPlayTimer = setInterval(function () { + frameIndex %= _this2._totalCount; + + var colRow = _this2.toColRow(frameIndex); + + _this2.setColRow(colRow[0], colRow[1]); + + frameIndex++; // Done 1 Cycle? + + if (++frameCount === _this2._totalCount) { + frameCount = 0; + count++; + } + + if (playCount > 0 && count === playCount) { + clearInterval(_this2._autoPlayTimer); + } + }, interval); + }; + + _proto.toColRow = function toColRow(frameIndex) { + var colCount = this._colCount; + var rowCount = this._rowCount; + + if (frameIndex < 0) { + return [0, 0]; + } else if (frameIndex >= this._totalCount) { + return [colCount - 1, rowCount - 1]; + } + + var col = frameIndex % colCount; + var row = Math.floor(frameIndex / colCount); // console.log(frameIndex, col, row); + + return [col, row]; + }; + + return SpriteImage; + }(Component); + + SpriteImage.VERSION = VERSION; + return SpriteImage; + }(); + + var DEFAULT_PAN_SCALE = 0.21; + /** + * @class eg.view360.SpinViewer + * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object. + * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpinViewer + * var el = document.getElementById("product-360"); + * var viewer = new eg.view360.SpinViewer(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 //required + * }); + */ + + var SpinViewer = + /*#__PURE__*/ + function () { + var SpinViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpinViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.SpinViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.SpinViewer + */ + function SpinViewer(element, options) { + var _this; + + _this = _Component.call(this) || this; + _this._el = element; + + var opt = _extends({}, options); + + var colCount = opt.colCount || 1; + var rowCount = opt.rowCount || 1; + _this._scale = opt.scale || 1; + _this._panScale = _this._scale * DEFAULT_PAN_SCALE; + _this._frameCount = colCount * rowCount; // Init SpriteImage + + _this._sprites = new SpriteImage(element, opt).on({ + "load": function load(evt) { + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpinViewer#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * viwer.on({ + * "load" : function(evt) { + * this.spinBy(360, {duration: 300}); + * } + * }); + */ + _this.trigger("load", evt); + }, + "imageError": function imageError(evt) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * viewer.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: evt.imageUrl + }); + } + }); // Init Axes + + _this._panInput = new Axes.PanInput(_this._el, { + scale: [_this._panScale, _this._panScale] + }); + _this._axes = new Axes({ + angle: { + range: [0, 359], + circular: true + } + }).on({ + "change": function change(evt) { + var curr = Math.floor(evt.pos.angle / (360 / _this._frameCount)); + var frameIndex = _this._frameCount - curr - 1; + + _this._sprites.setFrameIndex(frameIndex); + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#change + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row + * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값 + * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님) + * + * @example + * + * viwer.on({ + * "change" : function(evt) { + * console.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30 + * } + * }); + */ + + + _this.trigger("change", { + frameIndex: frameIndex, + colRow: _this._sprites.getColRow(), + angle: evt.pos.angle + }); + }, + "animationEnd": function animationEnd(evt) { + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생하는 이벤트 + * @name eg.view360.SpinViewer#animationEnd + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Boolean} param.isTrusted 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 + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // evt.isTrusted === true or false + * } + * }); + */ + _this.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + + _this._axes.connect("angle", _this._panInput); + + return _this; + } + /** + * Set spin scale + * @ko scale 을 조정할 수 있는 함수 + * @method eg.view360.SpinViewer#setScale + * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.setScale(2);// It moves twice as much. + */ + + + var _proto = SpinViewer.prototype; + + _proto.setScale = function setScale(scale) { + if (isNaN(scale) || scale < 0) { + return this; + } + + this._scale = scale; + this._panScale = scale * DEFAULT_PAN_SCALE; + this._panInput.options.scale = [this._panScale, this._panScale]; + return this; + } + /** + * Get spin scale + * @ko scale 값을 반환한다. + * @method eg.view360.SpinViewer#getScale + * + * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @example + * + * viewer.getScale();// It returns number + */ + ; + + _proto.getScale = function getScale() { + return this._scale; + } + /** + * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle. + * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinBy + * + * @param {Number} [angle = 0] angle상대적 회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinBy(720, {duration: 500}); + */ + ; + + _proto.spinBy = function spinBy(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setBy({ + angle: angle + }, param.duration); + + return this; + } + /** + * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle). + * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinTo + * + * @param {Number} [angle = 0] angle회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinTo(30, {duration:100}); + */ + ; + + _proto.spinTo = function spinTo(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setTo({ + angle: angle + }, param.duration); + + return this; + } + /** + * Returns current angles + * @ko 현재 각도를 반환한다. + * + * @return {Number} Current angle 현재 각도 + */ + ; + + _proto.getAngle = function getAngle() { + return this._axes.get().angle || 0; + }; + + return SpinViewer; + }(Component); + + SpinViewer.VERSION = VERSION; + return SpinViewer; + }(); + + exports.PanoViewer = PanoViewer; + exports.SpinViewer = SpinViewer; + exports.SpriteImage = SpriteImage; + exports.VERSION = VERSION; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=view360.js.map diff --git a/dist/view360.js.map b/dist/view360.js.map new file mode 100644 index 000000000..5ca0608d0 --- /dev/null +++ b/dist/view360.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.js","sources":["../node_modules/es6-promise/dist/es6-promise.js","../src/utils/browser.js","../src/utils/browserFeature.js","../src/utils/math-util.js","../src/YawPitchControl/utils.js","../node_modules/webvr-polyfill/src/math-util.js","../node_modules/webvr-polyfill/src/util.js","../node_modules/webvr-polyfill/src/sensor-fusion/pose-predictor.js","../src/YawPitchControl/consts.js","../src/YawPitchControl/input/DeviceMotion.js","../node_modules/webvr-polyfill/src/sensor-fusion/sensor-sample.js","../node_modules/webvr-polyfill/src/sensor-fusion/complementary-filter.js","../src/YawPitchControl/input/ComplementaryFilter.js","../src/YawPitchControl/input/FusionPoseSensor.js","../src/YawPitchControl/input/TiltMotionInput.js","../src/YawPitchControl/ScreenRotationAngle.js","../src/YawPitchControl/input/RotationPanInput.js","../src/YawPitchControl/DeviceQuaternion.js","../src/version.js","../src/YawPitchControl/YawPitchControl.js","../src/PanoImageRenderer/ImageLoader.js","../src/PanoImageRenderer/VideoLoader.js","../src/PanoImageRenderer/WebGLUtils.js","../src/PanoImageRenderer/renderer/Renderer.js","../src/PanoImageRenderer/renderer/CubeRenderer.js","../src/PanoImageRenderer/renderer/CubeStripRenderer.js","../src/PanoViewer/consts.js","../src/PanoImageRenderer/renderer/SphereRenderer.js","../src/PanoImageRenderer/renderer/CylinderRenderer.js","../src/PanoImageRenderer/vr/VRManager.js","../src/PanoImageRenderer/vr/XRManager.js","../src/PanoImageRenderer/WebGLAnimator.js","../src/PanoImageRenderer/PanoImageRenderer.js","../src/PanoViewer/PanoViewer.js","../src/SpinViewer/SpriteImage.js","../src/SpinViewer/SpinViewer.js"],"sourcesContent":["/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.ES6Promise = factory());\n}(this, (function () { 'use strict';\n\nfunction objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n}\n\nfunction isFunction(x) {\n return typeof x === 'function';\n}\n\n\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve$1(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n try {\n then$$1.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then$$1) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then$$1, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$1) {\n if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$1 === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$1)) {\n handleForeignThenable(promise, maybeThenable, then$$1);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then$$1 = void 0;\n try {\n then$$1 = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then$$1);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n}\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve$$1 = c.resolve;\n\n\n if (resolve$$1 === resolve$1) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise$1) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$1) {\n return resolve$$1(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$1(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject$1(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n//# sourceMappingURL=es6-promise.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","/**\n * Original Code\n * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js\n * Math Util\n * modified by egjs\n */\n/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.2\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n// Some minimal math functionality borrowed from gl-Matrix and stripped down\n// for the purposes of this library.\n\nimport {vec2, vec3, quat} from \"gl-matrix\";\n\nfunction quatToVec3(quaternion) {\n\tconst baseV = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(baseV, baseV, quaternion);\n\treturn baseV;\n}\n\nfunction toDegree(a){\n\treturn a * 180 / Math.PI;\n}\n\nconst util = {};\n\nutil.isPowerOfTwo = function(n) {\n\treturn n && (n & (n - 1)) === 0;\n};\n\nutil.extractPitchFromQuat = function(quaternion) {\n\tconst baseV = quatToVec3(quaternion);\n\n\treturn -1 * Math.atan2(\n\t\tbaseV[1],\n\t\tMath.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2)));\n};\n\nutil.hypot = Math.hypot || function(x, y) {\n\treturn Math.sqrt(x * x + y * y);\n};\n\n// implement reference\n// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식\n// calculating angle between two vectors : http://darkpgmr.tistory.com/121\nconst ROTATE_CONSTANT = {\n\tPITCH_DELTA: 1,\n\tYAW_DELTA_BY_ROLL: 2,\n\tYAW_DELTA_BY_YAW: 3,\n};\n\nROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [0, 0, 1],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [1, 0, 0],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = {\n\ttargetAxis: [1, 0, 0],\n\tmeshPoint: [0, 0, 1],\n};\n\nfunction getRotationDelta(prevQ, curQ, rotateKind) {\n\tconst targetAxis = vec3.fromValues(\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[0],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[1],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[2]\n\t);\n\tconst meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint;\n\n\tconst prevQuaternion = quat.clone(prevQ);\n\tconst curQuaternion = quat.clone(curQ);\n\n\tquat.normalize(prevQuaternion, prevQuaternion);\n\tquat.normalize(curQuaternion, curQuaternion);\n\n\tlet prevPoint = vec3.fromValues(0, 0, 1);\n\tlet curPoint = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\tvec3.transformQuat(targetAxis, targetAxis, curQuaternion);\n\n\tconst rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint));\n\tconst rotateDirection = rotateDistance > 0 ? 1 : -1;\n\n\t// when counter clock wise, use vec3.fromValues(0,1,0)\n\t// when clock wise, use vec3.fromValues(0,-1,0)\n\t// const meshPoint1 = vec3.fromValues(0, 0, 0);\n\tconst meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\n\tlet meshPoint3;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tmeshPoint3 = vec3.fromValues(0, rotateDirection, 0);\n\t} else {\n\t\tmeshPoint3 = vec3.fromValues(rotateDirection, 0, 0);\n\t}\n\n\tvec3.transformQuat(meshPoint2, meshPoint2, curQuaternion);\n\tvec3.transformQuat(meshPoint3, meshPoint3, curQuaternion);\n\n\tconst vecU = meshPoint2;\n\tconst vecV = meshPoint3;\n\tconst vecN = vec3.create();\n\n\tvec3.cross(vecN, vecU, vecV);\n\tvec3.normalize(vecN, vecN);\n\n\tconst coefficientA = vecN[0];\n\tconst coefficientB = vecN[1];\n\tconst coefficientC = vecN[2];\n//\tconst coefficientD = -1 * vec3.dot(vecN, meshPoint1);\n\n\t// a point on the plane\n\tcurPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\n\t// a point should project on the plane\n\tprevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\n\t// distance between prevPoint and the plane\n\tlet distance = Math.abs(\n\t\tprevPoint[0] * coefficientA +\n\t\tprevPoint[1] * coefficientB +\n\t\tprevPoint[2] * coefficientC\n\t);\n\n\tconst projectedPrevPoint = vec3.create();\n\n\tvec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance));\n\n\tlet trigonometricRatio =\n\t\t(projectedPrevPoint[0] * curPoint[0] +\n\t\tprojectedPrevPoint[1] * curPoint[1] +\n\t\tprojectedPrevPoint[2] * curPoint[2]) /\n\t\t(vec3.length(projectedPrevPoint) * vec3.length(curPoint));\n\n\t// defensive block\n\ttrigonometricRatio > 1 && (trigonometricRatio = 1);\n\n\tconst theta = Math.acos(trigonometricRatio);\n\n\tconst crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint);\n\n\tdistance =\n\t\tcoefficientA * crossVec[0] +\n\t\tcoefficientB * crossVec[1] +\n\t\tcoefficientC * crossVec[2];\n\n\tlet thetaDirection;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tthetaDirection = distance > 0 ? 1 : -1;\n\t} else {\n\t\tthetaDirection = distance < 0 ? 1 : -1;\n\t}\n\n\tconst deltaRadian = theta * thetaDirection * rotateDirection;\n\n\treturn toDegree(deltaRadian);\n}\n\nfunction angleBetweenVec2(v1, v2) {\n\tconst det = v1[0] * v2[1] - v2[0] * v1[1];\n\tconst theta = -Math.atan2(det, vec2.dot(v1, v2));\n\treturn theta;\n}\n\nutil.yawOffsetBetween = function(viewDir, targetDir) {\n\tconst viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]);\n\tconst targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]);\n\n\tvec2.normalize(viewDirXZ, viewDirXZ);\n\tvec2.normalize(targetDirXZ, targetDirXZ);\n\n\tconst theta = -angleBetweenVec2(viewDirXZ, targetDirXZ);\n\n\treturn theta;\n}\n\nutil.toDegree = toDegree;\nutil.getRotationDelta = getRotationDelta;\nutil.angleBetweenVec2 = angleBetweenVec2;\n\nexport {\n\tutil,\n\tROTATE_CONSTANT,\n};\n","import {\n\tutil as mathUtil,\n\tROTATE_CONSTANT,\n} from \"../utils/math-util\";\n\nexport function toAxis(source, offset) {\n\treturn offset.reduce((acc, v, i) => {\n\t\tif (source[i]) {\n\t\t\tacc[source[i]] = v;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(mathUtil.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nexport function getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n","/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar MathUtil = window.MathUtil || {};\n\nMathUtil.degToRad = Math.PI / 180;\nMathUtil.radToDeg = 180 / Math.PI;\n\n// Some minimal math functionality borrowed from THREE.Math and stripped down\n// for the purposes of this library.\n\n\nMathUtil.Vector2 = function ( x, y ) {\n this.x = x || 0;\n this.y = y || 0;\n};\n\nMathUtil.Vector2.prototype = {\n constructor: MathUtil.Vector2,\n\n set: function ( x, y ) {\n this.x = x;\n this.y = y;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n\n return this;\n },\n\n subVectors: function ( a, b ) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n\n return this;\n },\n};\n\nMathUtil.Vector3 = function ( x, y, z ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n};\n\nMathUtil.Vector3.prototype = {\n constructor: MathUtil.Vector3,\n\n set: function ( x, y, z ) {\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n\n return this;\n },\n\n length: function () {\n return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n },\n\n normalize: function () {\n var scalar = this.length();\n\n if ( scalar !== 0 ) {\n var invScalar = 1 / scalar;\n\n this.multiplyScalar(invScalar);\n } else {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return this;\n },\n\n multiplyScalar: function ( scalar ) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n },\n\n applyQuaternion: function ( q ) {\n var x = this.x;\n var y = this.y;\n var z = this.z;\n\n var qx = q.x;\n var qy = q.y;\n var qz = q.z;\n var qw = q.w;\n\n // calculate quat * vector\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = - qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n return this;\n },\n\n dot: function ( v ) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n },\n\n crossVectors: function ( a, b ) {\n var ax = a.x, ay = a.y, az = a.z;\n var bx = b.x, by = b.y, bz = b.z;\n\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n\n return this;\n },\n};\n\nMathUtil.Quaternion = function ( x, y, z, w ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = ( w !== undefined ) ? w : 1;\n};\n\nMathUtil.Quaternion.prototype = {\n constructor: MathUtil.Quaternion,\n\n set: function ( x, y, z, w ) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n\n return this;\n },\n\n copy: function ( quaternion ) {\n this.x = quaternion.x;\n this.y = quaternion.y;\n this.z = quaternion.z;\n this.w = quaternion.w;\n\n return this;\n },\n\n setFromEulerXYZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n\n return this;\n },\n\n setFromEulerYXZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n\n return this;\n },\n\n setFromAxisAngle: function ( axis, angle ) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n\n var halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n this.x = axis.x * s;\n this.y = axis.y * s;\n this.z = axis.z * s;\n this.w = Math.cos( halfAngle );\n\n return this;\n },\n\n multiply: function ( q ) {\n return this.multiplyQuaternions( this, q );\n },\n\n multiplyQuaternions: function ( a, b ) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;\n var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;\n\n this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n return this;\n },\n\n inverse: function () {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n\n this.normalize();\n\n return this;\n },\n\n normalize: function () {\n var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n if ( l === 0 ) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 1;\n } else {\n l = 1 / l;\n\n this.x = this.x * l;\n this.y = this.y * l;\n this.z = this.z * l;\n this.w = this.w * l;\n }\n\n return this;\n },\n\n slerp: function ( qb, t ) {\n if ( t === 0 ) return this;\n if ( t === 1 ) return this.copy( qb );\n\n var x = this.x, y = this.y, z = this.z, w = this.w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z;\n\n if ( cosHalfTheta < 0 ) {\n this.w = - qb.w;\n this.x = - qb.x;\n this.y = - qb.y;\n this.z = - qb.z;\n\n cosHalfTheta = - cosHalfTheta;\n } else {\n this.copy( qb );\n }\n\n if ( cosHalfTheta >= 1.0 ) {\n this.w = w;\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n var halfTheta = Math.acos( cosHalfTheta );\n var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\n\n if ( Math.abs( sinHalfTheta ) < 0.001 ) {\n this.w = 0.5 * ( w + this.w );\n this.x = 0.5 * ( x + this.x );\n this.y = 0.5 * ( y + this.y );\n this.z = 0.5 * ( z + this.z );\n\n return this;\n }\n\n var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n this.w = ( w * ratioA + this.w * ratioB );\n this.x = ( x * ratioA + this.x * ratioB );\n this.y = ( y * ratioA + this.y * ratioB );\n this.z = ( z * ratioA + this.z * ratioB );\n\n return this;\n },\n\n setFromUnitVectors: function () {\n // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\n // assumes direction vectors vFrom and vTo are normalized\n\n var v1, r;\n var EPS = 0.000001;\n\n return function ( vFrom, vTo ) {\n if ( v1 === undefined ) v1 = new MathUtil.Vector3();\n\n r = vFrom.dot( vTo ) + 1;\n\n if ( r < EPS ) {\n r = 0;\n\n if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n v1.set( - vFrom.y, vFrom.x, 0 );\n } else {\n v1.set( 0, - vFrom.z, vFrom.y );\n }\n } else {\n v1.crossVectors( vFrom, vTo );\n }\n\n this.x = v1.x;\n this.y = v1.y;\n this.z = v1.z;\n this.w = r;\n\n this.normalize();\n\n return this;\n }\n }(),\n};\n\nmodule.exports = MathUtil;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Util = window.Util || {};\n\nUtil.MIN_TIMESTEP = 0.001;\nUtil.MAX_TIMESTEP = 1;\n\nUtil.base64 = function(mimeType, base64) {\n return 'data:' + mimeType + ';base64,' + base64;\n};\n\nUtil.clamp = function(value, min, max) {\n return Math.min(Math.max(min, value), max);\n};\n\nUtil.lerp = function(a, b, t) {\n return a + ((b - a) * t);\n};\n\n/**\n * Light polyfill for `Promise.race`. Returns\n * a promise that resolves when the first promise\n * provided resolves.\n *\n * @param {Array} promises\n */\nUtil.race = function(promises) {\n if (Promise.race) {\n return Promise.race(promises);\n }\n\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < promises.length; i++) {\n promises[i].then(resolve, reject);\n }\n });\n};\n\nUtil.isIOS = (function() {\n var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);\n return function() {\n return isIOS;\n };\n})();\n\nUtil.isWebViewAndroid = (function() {\n var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1 &&\n navigator.userAgent.indexOf('Chrome') !== -1;\n return function() {\n return isWebViewAndroid;\n };\n})();\n\nUtil.isSafari = (function() {\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n return function() {\n return isSafari;\n };\n})();\n\nUtil.isFirefoxAndroid = (function() {\n var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1;\n return function() {\n return isFirefoxAndroid;\n };\n})();\n\nUtil.isR7 = (function() {\n var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1;\n return function() {\n return isR7;\n };\n})();\n\nUtil.isLandscapeMode = function() {\n var rtn = (window.orientation == 90 || window.orientation == -90);\n return Util.isR7() ? !rtn : rtn;\n};\n\n// Helper method to validate the time steps of sensor timestamps.\nUtil.isTimestampDeltaValid = function(timestampDeltaS) {\n if (isNaN(timestampDeltaS)) {\n return false;\n }\n if (timestampDeltaS <= Util.MIN_TIMESTEP) {\n return false;\n }\n if (timestampDeltaS > Util.MAX_TIMESTEP) {\n return false;\n }\n return true;\n};\n\nUtil.getScreenWidth = function() {\n return Math.max(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.getScreenHeight = function() {\n return Math.min(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.requestFullscreen = function(element) {\n if (Util.isWebViewAndroid()) {\n return false;\n }\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.exitFullscreen = function() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.getFullscreenElement = function() {\n return document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullScreenElement ||\n document.msFullscreenElement;\n};\n\nUtil.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) {\n // No error checking for brevity.\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n for (var attribName in attribLocationMap)\n gl.bindAttribLocation(program, attribLocationMap[attribName], attribName);\n\n gl.linkProgram(program);\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n};\n\nUtil.getProgramUniforms = function(gl, program) {\n var uniforms = {};\n var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n var uniformName = '';\n for (var i = 0; i < uniformCount; i++) {\n var uniformInfo = gl.getActiveUniform(program, i);\n uniformName = uniformInfo.name.replace('[0]', '');\n uniforms[uniformName] = gl.getUniformLocation(program, uniformName);\n }\n return uniforms;\n};\n\nUtil.orthoMatrix = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\nUtil.copyArray = function (source, dest) {\n for (var i = 0, n = source.length; i < n; i++) {\n dest[i] = source[i];\n }\n};\n\nUtil.isMobile = function() {\n var check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);\n return check;\n};\n\nUtil.extend = function(dest, src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n\n return dest;\n}\n\nUtil.safariCssSizeWorkaround = function(canvas) {\n // TODO(smus): Remove this workaround when Safari for iOS is fixed.\n // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556).\n //\n // \"To the last I grapple with thee;\n // from hell's heart I stab at thee;\n // for hate's sake I spit my last breath at thee.\"\n // -- Moby Dick, by Herman Melville\n if (Util.isIOS()) {\n var width = canvas.style.width;\n var height = canvas.style.height;\n canvas.style.width = (parseInt(width) + 1) + 'px';\n canvas.style.height = (parseInt(height)) + 'px';\n setTimeout(function() {\n canvas.style.width = width;\n canvas.style.height = height;\n }, 100);\n }\n\n // Debug only.\n window.Util = Util;\n window.canvas = canvas;\n};\n\nUtil.isDebug = function() {\n return Util.getQueryParameter('debug');\n};\n\nUtil.getQueryParameter = function(name) {\n var name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n results = regex.exec(location.search);\n return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n};\n\nUtil.frameDataFromPose = (function() {\n var piOver180 = Math.PI / 180.0;\n var rad45 = Math.PI * 0.25;\n\n // Borrowed from glMatrix.\n function mat4_perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45),\n downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45),\n leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45),\n rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n\n function mat4_fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n };\n\n function mat4_translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n };\n\n function mat4_invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n };\n\n var defaultOrientation = new Float32Array([0, 0, 0, 1]);\n var defaultPosition = new Float32Array([0, 0, 0]);\n\n function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) {\n mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar);\n\n var orientation = pose.orientation || defaultOrientation;\n var position = pose.position || defaultPosition;\n\n mat4_fromRotationTranslation(view, orientation, position);\n if (parameters)\n mat4_translate(view, view, parameters.offset);\n mat4_invert(view, view);\n }\n\n return function(frameData, pose, vrDisplay) {\n if (!frameData || !pose)\n return false;\n\n frameData.pose = pose;\n frameData.timestamp = pose.timestamp;\n\n updateEyeMatrices(\n frameData.leftProjectionMatrix, frameData.leftViewMatrix,\n pose, vrDisplay.getEyeParameters(\"left\"), vrDisplay);\n updateEyeMatrices(\n frameData.rightProjectionMatrix, frameData.rightViewMatrix,\n pose, vrDisplay.getEyeParameters(\"right\"), vrDisplay);\n\n return true;\n };\n})();\n\nUtil.isInsideCrossDomainIFrame = function() {\n var isFramed = (window.self !== window.top);\n var refDomain = Util.getDomainFromUrl(document.referrer);\n var thisDomain = Util.getDomainFromUrl(window.location.href);\n\n return isFramed && (refDomain !== thisDomain);\n};\n\n// From http://stackoverflow.com/a/23945027.\nUtil.getDomainFromUrl = function(url) {\n var domain;\n // Find & remove protocol (http, ftp, etc.) and get domain.\n if (url.indexOf(\"://\") > -1) {\n domain = url.split('/')[2];\n }\n else {\n domain = url.split('/')[0];\n }\n\n //find & remove port number\n domain = domain.split(':')[0];\n\n return domain;\n}\n\nmodule.exports = Util;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar MathUtil = require('../math-util');\nvar Util = require('../util');\n\n/**\n * Given an orientation and the gyroscope data, predicts the future orientation\n * of the head. This makes rendering appear faster.\n *\n * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf\n *\n * @param {Number} predictionTimeS time from head movement to the appearance of\n * the corresponding image.\n */\nfunction PosePredictor(predictionTimeS) {\n this.predictionTimeS = predictionTimeS;\n\n // The quaternion corresponding to the previous state.\n this.previousQ = new MathUtil.Quaternion();\n // Previous time a prediction occurred.\n this.previousTimestampS = null;\n\n // The delta quaternion that adjusts the current pose.\n this.deltaQ = new MathUtil.Quaternion();\n // The output quaternion.\n this.outQ = new MathUtil.Quaternion();\n}\n\nPosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) {\n if (!this.previousTimestampS) {\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n return currentQ;\n }\n\n // Calculate axis and angle based on gyroscope rotation rate data.\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n\n var angularSpeed = gyro.length();\n\n // If we're rotating slowly, don't do prediction.\n if (angularSpeed < MathUtil.degToRad * 20) {\n if (Util.isDebug()) {\n console.log('Moving slowly, at %s deg/s: no prediction',\n (MathUtil.radToDeg * angularSpeed).toFixed(1));\n }\n this.outQ.copy(currentQ);\n this.previousQ.copy(currentQ);\n return this.outQ;\n }\n\n // Get the predicted angle based on the time delta and latency.\n var deltaT = timestampS - this.previousTimestampS;\n var predictAngle = angularSpeed * this.predictionTimeS;\n\n this.deltaQ.setFromAxisAngle(axis, predictAngle);\n this.outQ.copy(this.previousQ);\n this.outQ.multiply(this.deltaQ);\n\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n\n return this.outQ;\n};\n\n\nmodule.exports = PosePredictor;\n","import {userAgent} from \"../utils/browserFeature\";\n/**\n * Returns a number value indiciating the version of Chrome being used,\n * or otherwise `null` if not on Chrome.\n *\n * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19\n */\n/**\n * In Chrome m65, `devicemotion` events are broken but subsequently fixed\n * in 65.0.3325.148. Since many browsers use Chromium, ensure that\n * we scope this detection by branch and build numbers to provide\n * a proper fallback.\n * https://github.com/immersive-web/webvr-polyfill/issues/307\n */\nlet version = -1; // It should not be null because it will be compared with number\nlet branch = null;\nlet build = null;\n\nconst match = /Chrome\\/([0-9]+)\\.(?:[0-9]*)\\.([0-9]*)\\.([0-9]*)/i.exec(userAgent);\n\nif (match) {\n\tversion = parseInt(match[1], 10);\n\tbranch = match[2];\n\tbuild = match[3];\n}\n\nconst CHROME_VERSION = version;\nconst IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === \"3325\" && parseInt(build, 10) < 148;\nconst IS_ANDROID = /Android/i.test(userAgent);\n\nconst CONTROL_MODE_VR = 1;\nconst CONTROL_MODE_YAWPITCH = 2;\n\nconst TOUCH_DIRECTION_NONE = 1;\nconst TOUCH_DIRECTION_YAW = 2;\nconst TOUCH_DIRECTION_PITCH = 4;\nconst TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH;\n\n/* Const for MovableCoord */\nconst MC_DECELERATION = 0.0014;\nconst MC_MAXIMUM_DURATION = 1000;\nconst MC_BIND_SCALE = [0.20, 0.20];\n\nconst MIN_FIELD_OF_VIEW = 20;\nconst MAX_FIELD_OF_VIEW = 110;\nconst PAN_SCALE = 320;\n\n// const DELTA_THRESHOLD = 0.015;\n// const DELTA_THRESHOLD = 0.09; // Note4\n// const DELTA_THRESHOLD = 0.0825;\n// const DELTA_THRESHOLD = 0.075;\n// const DELTA_THRESHOLD = 0.06;\n// const DELTA_THRESHOLD = 0.045;\nconst DELTA_THRESHOLD = 0.0375; // Note2\n\nconst YAW_RANGE_HALF = 180;\nconst PITCH_RANGE_HALF = 90;\nconst CIRCULAR_PITCH_RANGE_HALF = 180;\nconst PINCH_EVENTS = \"pinchstart pinchmove pinchend\";\n\nconst KEYMAP = {\n\tLEFT_ARROW: 37,\n\tA: 65,\n\tUP_ARROW: 38,\n\tW: 87,\n\tRIGHT_ARROW: 39,\n\tD: 68,\n\tDOWN_ARROW: 40,\n\tS: 83,\n};\n\nconst GYRO_MODE = {\n\tNONE: \"none\",\n\tYAWPITCH: \"yawPitch\",\n\tVR: \"VR\"\n};\n\nexport {\n\tGYRO_MODE,\n\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\n\tTOUCH_DIRECTION_NONE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMIN_FIELD_OF_VIEW,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tDELTA_THRESHOLD,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tPINCH_EVENTS,\n\tKEYMAP,\n\n\tCHROME_VERSION,\n\tIS_CHROME_WITHOUT_DEVICE_MOTION,\n\tIS_ANDROID\n};\n","import Component from \"@egjs/component\";\nimport {vec3} from \"gl-matrix\";\nimport {window} from \"../../utils/browser\";\nimport {IS_CHROME_WITHOUT_DEVICE_MOTION, IS_ANDROID} from \"../consts\";\n\nconst STILLNESS_THRESHOLD = 200; // millisecond\n\nexport default class DeviceMotion extends Component {\n\tconstructor() {\n\t\tsuper();\n\t\tthis._onDeviceMotion = this._onDeviceMotion.bind(this);\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onChromeWithoutDeviceMotion = this._onChromeWithoutDeviceMotion.bind(this);\n\n\t\tthis.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION;\n\t\tthis.isAndroid = IS_ANDROID;\n\n\t\tthis.stillGyroVec = vec3.create();\n\t\tthis.rawGyroVec = vec3.create();\n\t\tthis.adjustedGyroVec = vec3.create();\n\n\t\tthis._timer = null;\n\n\t\tthis.lastDevicemotionTimestamp = 0;\n\t\tthis._isEnabled = false;\n\t\tthis.enable();\n\t}\n\t_onChromeWithoutDeviceMotion(e) {\n\t\tlet {alpha, beta, gamma} = e;\n\n\t\t// There is deviceorientation event trigged with empty values\n\t\t// on Headless Chrome.\n\t\tif (alpha === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// convert to radian\n\t\talpha = (alpha || 0) * Math.PI / 180;\n\t\tbeta = (beta || 0) * Math.PI / 180;\n\t\tgamma = (gamma || 0) * Math.PI / 180;\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: {\n\t\t\t\tdeviceorientation: {\n\t\t\t\t\talpha,\n\t\t\t\t\tbeta,\n\t\t\t\t\tgamma: -gamma\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t_onDeviceOrientation() {\n\t\tthis._timer && clearTimeout(this._timer);\n\t\tthis._timer = setTimeout(() => {\n\t\t\tif ((new Date().getTime() - this.lastDevicemotionTimestamp) < STILLNESS_THRESHOLD) {\n\t\t\t\tvec3.copy(this.stillGyroVec, this.rawGyroVec);\n\t\t\t}\n\t\t}, STILLNESS_THRESHOLD);\n\t}\n\t_onDeviceMotion(e) {\n\t\t// desktop chrome triggers devicemotion event with empthy sensor values.\n\t\t// Those events should ignored.\n\t\tconst isGyroSensorAvailable = !(e.rotationRate.alpha == null);\n\t\tconst isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null);\n\n\t\tif (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst devicemotionEvent = Object.assign({}, e);\n\n\t\tdevicemotionEvent.interval = e.interval;\n\t\tdevicemotionEvent.timeStamp = e.timeStamp;\n\t\tdevicemotionEvent.type = e.type;\n\t\tdevicemotionEvent.rotationRate = {\n\t\t\talpha: e.rotationRate.alpha,\n\t\t\tbeta: e.rotationRate.beta,\n\t\t\tgamma: e.rotationRate.gamma,\n\t\t};\n\t\tdevicemotionEvent.accelerationIncludingGravity = {\n\t\t\tx: e.accelerationIncludingGravity.x,\n\t\t\ty: e.accelerationIncludingGravity.y,\n\t\t\tz: e.accelerationIncludingGravity.z,\n\t\t};\n\t\tdevicemotionEvent.acceleration = {\n\t\t\tx: e.acceleration.x,\n\t\t\ty: e.acceleration.y,\n\t\t\tz: e.acceleration.z,\n\t\t};\n\n\t\tif (this.isAndroid) {\n\t\t\tvec3.set(\n\t\t\t\tthis.rawGyroVec,\n\t\t\t\te.rotationRate.alpha || 0,\n\t\t\t\te.rotationRate.beta || 0,\n\t\t\t\te.rotationRate.gamma || 0);\n\t\t\tvec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec);\n\t\t\tthis.lastDevicemotionTimestamp = new Date().getTime();\n\n\t\t\tdevicemotionEvent.adjustedRotationRate = {\n\t\t\t\talpha: this.adjustedGyroVec[0],\n\t\t\t\tbeta: this.adjustedGyroVec[1],\n\t\t\t\tgamma: this.adjustedGyroVec[2]};\n\t\t}\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: devicemotionEvent\n\t\t});\n\t}\n\tenable() {\n\t\tif (this.isAndroid) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\t}\n\t\tif (this.isWithoutDeviceMotion) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\t} else {\n\t\t\twindow.addEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\t}\n\t\tthis._isEnabled = true;\n\t}\n\tdisable() {\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\twindow.removeEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\tthis._isEnabled = false;\n\t}\n}\n","function SensorSample(sample, timestampS) {\n this.set(sample, timestampS);\n};\n\nSensorSample.prototype.set = function(sample, timestampS) {\n this.sample = sample;\n this.timestampS = timestampS;\n};\n\nSensorSample.prototype.copy = function(sensorSample) {\n this.set(sensorSample.sample, sensorSample.timestampS);\n};\n\nmodule.exports = SensorSample;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar SensorSample = require('./sensor-sample.js');\nvar MathUtil = require('../math-util.js');\nvar Util = require('../util.js');\n\n/**\n * An implementation of a simple complementary filter, which fuses gyroscope and\n * accelerometer data from the 'devicemotion' event.\n *\n * Accelerometer data is very noisy, but stable over the long term.\n * Gyroscope data is smooth, but tends to drift over the long term.\n *\n * This fusion is relatively simple:\n * 1. Get orientation estimates from accelerometer by applying a low-pass filter\n * on that data.\n * 2. Get orientation estimates from gyroscope by integrating over time.\n * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the\n * short term.\n */\nfunction ComplementaryFilter(kFilter) {\n this.kFilter = kFilter;\n\n // Raw sensor measurements.\n this.currentAccelMeasurement = new SensorSample();\n this.currentGyroMeasurement = new SensorSample();\n this.previousGyroMeasurement = new SensorSample();\n\n // Set default look direction to be in the correct direction.\n if (Util.isIOS()) {\n this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1);\n } else {\n this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1);\n }\n this.previousFilterQ = new MathUtil.Quaternion();\n this.previousFilterQ.copy(this.filterQ);\n\n // Orientation based on the accelerometer.\n this.accelQ = new MathUtil.Quaternion();\n // Whether or not the orientation has been initialized.\n this.isOrientationInitialized = false;\n // Running estimate of gravity based on the current orientation.\n this.estimatedGravity = new MathUtil.Vector3();\n // Measured gravity based on accelerometer.\n this.measuredGravity = new MathUtil.Vector3();\n\n // Debug only quaternion of gyro-based orientation.\n this.gyroIntegralQ = new MathUtil.Quaternion();\n}\n\nComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) {\n this.currentAccelMeasurement.set(vector, timestampS);\n};\n\nComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {\n this.currentGyroMeasurement.set(vector, timestampS);\n\n var deltaT = timestampS - this.previousGyroMeasurement.timestampS;\n if (Util.isTimestampDeltaValid(deltaT)) {\n this.run_();\n }\n\n this.previousGyroMeasurement.copy(this.currentGyroMeasurement);\n};\n\nComplementaryFilter.prototype.run_ = function() {\n\n if (!this.isOrientationInitialized) {\n this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n this.previousFilterQ.copy(this.accelQ);\n this.isOrientationInitialized = true;\n return;\n }\n\n var deltaT = this.currentGyroMeasurement.timestampS -\n this.previousGyroMeasurement.timestampS;\n\n // Convert gyro rotation vector to a quaternion delta.\n var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n this.gyroIntegralQ.multiply(gyroDeltaQ);\n\n // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n this.filterQ.copy(this.previousFilterQ);\n this.filterQ.multiply(gyroDeltaQ);\n\n // Calculate the delta between the current estimated gravity and the real\n // gravity vector from accelerometer.\n var invFilterQ = new MathUtil.Quaternion();\n invFilterQ.copy(this.filterQ);\n invFilterQ.inverse();\n\n this.estimatedGravity.set(0, 0, -1);\n this.estimatedGravity.applyQuaternion(invFilterQ);\n this.estimatedGravity.normalize();\n\n this.measuredGravity.copy(this.currentAccelMeasurement.sample);\n this.measuredGravity.normalize();\n\n // Compare estimated gravity with measured gravity, get the delta quaternion\n // between the two.\n var deltaQ = new MathUtil.Quaternion();\n deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n deltaQ.inverse();\n\n if (Util.isDebug()) {\n console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)',\n MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ),\n (this.estimatedGravity.x).toFixed(1),\n (this.estimatedGravity.y).toFixed(1),\n (this.estimatedGravity.z).toFixed(1),\n (this.measuredGravity.x).toFixed(1),\n (this.measuredGravity.y).toFixed(1),\n (this.measuredGravity.z).toFixed(1));\n }\n\n // Calculate the SLERP target: current orientation plus the measured-estimated\n // quaternion delta.\n var targetQ = new MathUtil.Quaternion();\n targetQ.copy(this.filterQ);\n targetQ.multiply(deltaQ);\n\n // SLERP factor: 0 is pure gyro, 1 is pure accel.\n this.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n this.previousFilterQ.copy(this.filterQ);\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n return this.filterQ;\n};\n\nComplementaryFilter.prototype.accelToQuaternion_ = function(accel) {\n var normAccel = new MathUtil.Vector3();\n normAccel.copy(accel);\n normAccel.normalize();\n var quat = new MathUtil.Quaternion();\n quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel);\n quat.inverse();\n return quat;\n};\n\nComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) {\n // Extract axis and angle from the gyroscope data.\n var quat = new MathUtil.Quaternion();\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n quat.setFromAxisAngle(axis, gyro.length() * dt);\n return quat;\n};\n\n\nmodule.exports = ComplementaryFilter;\n","import MathUtil from \"webvr-polyfill/src/math-util\";\nimport ComplementaryFilter from \"webvr-polyfill/src/sensor-fusion/complementary-filter\";\n\nComplementaryFilter.prototype.run_ = function() {\n\tif (!this.isOrientationInitialized) {\n\t\tthis.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n\t\tthis.previousFilterQ.copy(this.accelQ);\n\t\tthis.isOrientationInitialized = true;\n\t\treturn;\n\t}\n\n\tconst deltaT = this.currentGyroMeasurement.timestampS -\n\tthis.previousGyroMeasurement.timestampS;\n\n\t// Convert gyro rotation vector to a quaternion delta.\n\tconst gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n\n\tthis.gyroIntegralQ.multiply(gyroDeltaQ);\n\n\t// filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n\tthis.filterQ.copy(this.previousFilterQ);\n\tthis.filterQ.multiply(gyroDeltaQ);\n\n\t// Calculate the delta between the current estimated gravity and the real\n\t// gravity vector from accelerometer.\n\tconst invFilterQ = new MathUtil.Quaternion();\n\n\tinvFilterQ.copy(this.filterQ);\n\tinvFilterQ.inverse();\n\n\tthis.estimatedGravity.set(0, 0, -1);\n\tthis.estimatedGravity.applyQuaternion(invFilterQ);\n\tthis.estimatedGravity.normalize();\n\n\tthis.measuredGravity.copy(this.currentAccelMeasurement.sample);\n\tthis.measuredGravity.normalize();\n\n\t// Compare estimated gravity with measured gravity, get the delta quaternion\n\t// between the two.\n\tconst deltaQ = new MathUtil.Quaternion();\n\n\tdeltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n\tdeltaQ.inverse();\n\n\t// Calculate the SLERP target: current orientation plus the measured-estimated\n\t// quaternion delta.\n\tconst targetQ = new MathUtil.Quaternion();\n\n\ttargetQ.copy(this.filterQ);\n\ttargetQ.multiply(deltaQ);\n\n\t// SLERP factor: 0 is pure gyro, 1 is pure accel.\n\tthis.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n\tthis.previousFilterQ.copy(this.filterQ);\n\n\tif (!this.isFilterQuaternionInitialized) {\n\t\tthis.isFilterQuaternionInitialized = true;\n\t}\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n\tif (this.isFilterQuaternionInitialized) {\n\t\treturn this.filterQ;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexport default ComplementaryFilter;\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport PosePredictor from \"webvr-polyfill/src/sensor-fusion/pose-predictor\";\nimport MathUtil from \"webvr-polyfill/src/math-util\";\nimport Util from \"webvr-polyfill/src/util\";\nimport {window, IS_IOS, IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\nimport DeviceMotion from \"./DeviceMotion\";\nimport ComplementaryFilter from \"./ComplementaryFilter\";\nimport {CHROME_VERSION} from \"../consts\";\n\nconst K_FILTER = 0.98;\nconst PREDICTION_TIME_S = 0.040;\n\nexport default class FusionPoseSensor extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.deviceMotion = new DeviceMotion();\n\n\t\tthis.accelerometer = new MathUtil.Vector3();\n\t\tthis.gyroscope = new MathUtil.Vector3();\n\n\t\tthis._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);\n\t\tthis._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);\n\n\t\tthis.filter = new ComplementaryFilter(K_FILTER);\n\t\tthis.posePredictor = new PosePredictor(PREDICTION_TIME_S);\n\n\t\tthis.filterToWorldQ = new MathUtil.Quaternion();\n\n\t\tthis.isFirefoxAndroid = Util.isFirefoxAndroid();\n\t\t// This includes iPhone & iPad(both desktop and mobile mode) ref #326\n\t\tthis.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP;\n\n\t\t// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18\n\t\tthis.isChromeUsingDegrees = CHROME_VERSION >= 66;\n\n\t\tthis._isEnabled = false;\n\n\t\t// Set the filter to world transform, depending on OS.\n\t\tif (this.isIOS) {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);\n\t\t} else {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);\n\t\t}\n\n\t\tthis.inverseWorldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.worldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1),\n\t\t\t-window.orientation * Math.PI / 180);\n\n\t\tthis._setScreenTransform();\n\t\t// Adjust this filter for being in landscape mode.\n\t\tif (Util.isLandscapeMode()) {\n\t\t\tthis.filterToWorldQ.multiply(this.inverseWorldToScreenQ);\n\t\t}\n\n\t\t// Keep track of a reset transform for resetSensor.\n\t\tthis.resetQ = new MathUtil.Quaternion();\n\n\t\tthis.deviceMotion.on(\"devicemotion\", this._onDeviceMotionChange);\n\t\tthis.enable();\n\t}\n\tenable() {\n\t\tif (this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.enable();\n\t\tthis._isEnabled = true;\n\t\twindow.addEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tdisable() {\n\t\tif (!this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.disable();\n\t\tthis._isEnabled = false;\n\t\twindow.removeEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tisEnabled() {\n\t\treturn this._isEnabled;\n\t}\n\tdestroy() {\n\t\tthis.disable();\n\t\tthis.deviceMotion = null;\n\t}\n\t_triggerChange() {\n\t\tconst orientation = this.getOrientation();\n\n\t\t// if orientation is not prepared. don't trigger change event\n\t\tif (!orientation) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._prevOrientation) {\n\t\t\tthis._prevOrientation = orientation;\n\t\t\treturn;\n\t\t}\n\n\t\tif (quat.equals(this._prevOrientation, orientation)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.trigger(\"change\", {quaternion: orientation});\n\t}\n\tgetOrientation() {\n\t\tlet orientation;\n\n\t\t// Hack around using deviceorientation instead of devicemotion\n\t\tif (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) {\n\t\t\tthis.deviceOrientationFixQ = this.deviceOrientationFixQ || (() => {\n\t\t\t\tconst y = new MathUtil.Quaternion()\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -this._alpha);\n\n\t\t\t\treturn y;\n\t\t\t})();\n\n\t\t\torientation = this._deviceOrientationQ;\n\t\t\tconst out = new MathUtil.Quaternion();\n\n\t\t\tout.copy(orientation);\n\t\t\tout.multiply(this.filterToWorldQ);\n\t\t\tout.multiply(this.resetQ);\n\t\t\tout.multiply(this.worldToScreenQ);\n\t\t\tout.multiplyQuaternions(this.deviceOrientationFixQ, out);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t} else {\n\t\t\t// Convert from filter space to the the same system used by the\n\t\t\t// deviceorientation event.\n\t\t\torientation = this.filter.getOrientation();\n\n\t\t\tif (!orientation) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst out = this._convertFusionToPredicted(orientation);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t}\n\t}\n\t_convertFusionToPredicted(orientation) {\n\t\t// Predict orientation.\n\t\tthis.predictedQ =\n\t\t\tthis.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS);\n\n\t\t// Convert to THREE coordinate system: -Z forward, Y up, X right.\n\t\tconst out = new MathUtil.Quaternion();\n\n\t\tout.copy(this.filterToWorldQ);\n\t\tout.multiply(this.resetQ);\n\t\tout.multiply(this.predictedQ);\n\t\tout.multiply(this.worldToScreenQ);\n\n\t\treturn out;\n\t}\n\t_onDeviceMotionChange({inputEvent}) {\n\t\tconst deviceorientation = inputEvent.deviceorientation;\n\t\tconst deviceMotion = inputEvent;\n\t\tconst accGravity = deviceMotion.accelerationIncludingGravity;\n\t\tconst rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate;\n\t\tlet timestampS = deviceMotion.timeStamp / 1000;\n\n\t\tif (deviceorientation) {\n\t\t\tif (!this._alpha) {\n\t\t\t\tthis._alpha = deviceorientation.alpha;\n\t\t\t}\n\t\t\tthis._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion();\n\t\t\tthis._deviceOrientationQ.setFromEulerYXZ(\n\t\t\t\tdeviceorientation.beta,\n\t\t\t\tdeviceorientation.alpha,\n\t\t\t\tdeviceorientation.gamma\n\t\t\t);\n\n\t\t\tthis._triggerChange();\n\t\t} else {\n\t\t\t// Firefox Android timeStamp returns one thousandth of a millisecond.\n\t\t\tif (this.isFirefoxAndroid) {\n\t\t\t\ttimestampS /= 1000;\n\t\t\t}\n\n\t\t\tthis.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z);\n\t\t\tthis.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma);\n\n\t\t\t// Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate`\n\t\t\t// is reported in degrees, so we first convert to radians.\n\t\t\tif (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) {\n\t\t\t\tthis.gyroscope.multiplyScalar(Math.PI / 180);\n\t\t\t}\n\n\t\t\tthis.filter.addAccelMeasurement(this.accelerometer, timestampS);\n\t\t\tthis.filter.addGyroMeasurement(this.gyroscope, timestampS);\n\n\t\t\tthis._triggerChange();\n\n\t\t\tthis.previousTimestampS = timestampS;\n\t\t}\n\t}\n\t_onScreenOrientationChange(screenOrientation) {\n\t\tthis._setScreenTransform(window.orientation);\n\t}\n\t_setScreenTransform() {\n\t\tthis.worldToScreenQ.set(0, 0, 0, 1);\n\n\t\tconst orientation = window.orientation;\n\n\t\tswitch (orientation) {\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tcase 90:\n\t\t\tcase -90:\n\t\t\tcase 180:\n\t\t\t\tthis.worldToScreenQ\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.inverseWorldToScreenQ.copy(this.worldToScreenQ);\n\t\tthis.inverseWorldToScreenQ.inverse();\n\t}\n}\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport {toAxis} from \"../utils\";\nimport FusionPoseSensor from \"./FusionPoseSensor\";\nimport {util, ROTATE_CONSTANT} from \"../../utils/math-util\";\n\nfunction getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(util.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nfunction getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n\nexport default class TiltMotionInput extends Component {\n\tconstructor(el, options) {\n\t\tsuper();\n\t\tthis.element = el;\n\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\n\t\tthis.fusionPoseSensor = null;\n\n\t\tthis.options = Object.assign({\n\t\t\tscale: 1,\n\t\t\tthreshold: 0,\n\t\t}, options);\n\n\t\tthis._onPoseChange = this._onPoseChange.bind(this);\n\t}\n\tmapAxes(axes) {\n\t\tthis.axes = axes;\n\t}\n\tconnect(observer) {\n\t\tif (this.observer) {\n\t\t\treturn this;\n\t\t}\n\t\tthis.observer = observer;\n\t\tthis.fusionPoseSensor = new FusionPoseSensor();\n\t\tthis.fusionPoseSensor.enable();\n\t\tthis._attachEvent();\n\t\treturn this;\n\t}\n\tdisconnect() {\n\t\tif (!this.observer) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._dettachEvent();\n\t\tthis.fusionPoseSensor.disable();\n\t\tthis.fusionPoseSensor.destroy();\n\t\tthis.fusionPoseSensor = null;\n\t\tthis.observer = null;\n\t\treturn this;\n\t}\n\tdestroy() {\n\t\tthis.disconnect();\n\t\tthis.element = null;\n\t\tthis.options = null;\n\t\tthis.axes = null;\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\t}\n\t_onPoseChange(event) {\n\t\tif (!this._prevQuaternion) {\n\t\t\tthis._prevQuaternion = quat.clone(event.quaternion);\n\t\t\tthis._quaternion = quat.clone(event.quaternion);\n\t\t\treturn;\n\t\t}\n\n\t\tquat.copy(this._prevQuaternion, this._quaternion);\n\t\tquat.copy(this._quaternion, event.quaternion);\n\n\t\tthis.observer.change(this, event, toAxis(this.axes, [\n\t\t\tgetDeltaYaw(this._prevQuaternion, this._quaternion),\n\t\t\tgetDeltaPitch(this._prevQuaternion, this._quaternion)\n\t\t]));\n\t}\n\t_attachEvent() {\n\t\tthis.fusionPoseSensor.on(\"change\", this._onPoseChange);\n\t}\n\t_dettachEvent() {\n\t\tthis.fusionPoseSensor.off(\"change\", this._onPoseChange);\n\t}\n}\n","import {glMatrix} from \"gl-matrix\";\nimport {window} from \"../utils/browser\";\n\n// Singleton\nlet screenRotationAngleInst = null;\nlet refCount = 0;\n\nexport default class ScreenRotationAngle {\n\tconstructor() {\n\t\trefCount++;\n\n\t\tif (screenRotationAngleInst) {\n\t\t\treturn screenRotationAngleInst;\n\t\t}\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = this;\n\t\t/* eslint-enable */\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onOrientationChange = this._onOrientationChange.bind(this);\n\n\t\tthis._spinR = 0;\n\n\t\tthis._screenOrientationAngle = 0;\n\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.addEventListener(\"orientationchange\", this._onOrientationChange);\n\t}\n\n\t_onDeviceOrientation(e) {\n\t\tif (e.beta === null || e.gamma === null) {\n\t\t\t// (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it.\n\t\t\treturn;\n\t\t}\n\n\t\t// Radian\n\t\tconst betaR = glMatrix.toRadian(e.beta);\n\t\tconst gammaR = glMatrix.toRadian(e.gamma);\n\n\t\t/* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */\n\t\tthis._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR));\n\t}\n\n\t_onOrientationChange(e) {\n\t\tif (window.screen && window.screen.orientation && window.screen.orientation.angle !== undefined) {\n\t\t\tthis._screenOrientationAngle = screen.orientation.angle;\n\t\t} else if (window.orientation !== undefined) {\n\t\t\t/* iOS */\n\t\t\tthis._screenOrientationAngle = window.orientation >= 0 ?\n\t\t\t\twindow.orientation : 360 + window.orientation;\n\t\t}\n\t}\n\n\tgetRadian() {\n\t\t// Join with screen orientation\n\t\t// this._testVal = this._spinR + \", \" + this._screenOrientationAngle + \", \" + window.orientation;\n\t\treturn this._spinR + glMatrix.toRadian(this._screenOrientationAngle);\n\t}\n\n\tunref() {\n\t\tif (--refCount > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"orientationchange\", this._onOrientationChange);\n\n\t\tthis._spinR = 0;\n\t\tthis._screenOrientationAngle = 0;\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = null;\n\t\t/* eslint-enable */\n\t\trefCount = 0;\n\t}\n}\n","import Axes, {PanInput} from \"@egjs/axes\";\nimport ScreenRotationAngle from \"../ScreenRotationAngle\";\n\n/**\n * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle.\n *\n * The reason for using this function is that in VR mode,\n * the roll angle is adjusted in the direction opposite to the screen rotation angle.\n *\n * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.\n * @extends PanInput\n */\nexport default class RotationPanInput extends PanInput {\n\t/**\n\t * Constructor\n\t *\n\t * @private\n\t * @param {HTMLElement} el target element\n\t * @param {Object} [options] The option object\n\t * @param {Boolean} [options.useRotation] Whether to use rotation(or VR)\n\t */\n\tconstructor(el, options) {\n\t\tsuper(el, options);\n\n\t\tthis._useRotation = false;\n\t\tthis._screenRotationAngle = null;\n\n\t\tthis.setUseRotation(!!(options && options.useRotation));\n\n\t\tthis._userDirection = Axes.DIRECTION_ALL;\n\t}\n\n\tsetUseRotation(useRotation) {\n\t\tthis._useRotation = useRotation;\n\n\t\tif (this._screenRotationAngle) {\n\t\t\tthis._screenRotationAngle.unref();\n\t\t\tthis._screenRotationAngle = null;\n\t\t}\n\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle = new ScreenRotationAngle();\n\t\t}\n\t}\n\n\tconnect(observer) {\n\t\t// User intetened direction\n\t\tthis._userDirection = this._direction;\n\n\t\t// In VR Mode, Use ALL direction if direction is not none\n\t\t// Because horizontal and vertical is changed dynamically by screen rotation.\n\t\t// this._direction is used to initialize hammerjs\n\t\tif (this._useRotation && (this._direction & Axes.DIRECTION_ALL)) {\n\t\t\tthis._direction = Axes.DIRECTION_HORIZONTAL;\n\t\t}\n\n\t\tsuper.connect(observer);\n\t}\n\n\tgetOffset(properties, useDirection) {\n\t\tif (this._useRotation === false) {\n\t\t\treturn super.getOffset(properties, useDirection);\n\t\t}\n\n\t\tconst offset = super.getOffset(properties, [true, true]);\n\t\tconst newOffset = [0, 0];\n\n\t\tconst theta = this._screenRotationAngle.getRadian();\n\n\t\tconst cosTheta = Math.cos(theta);\n\t\tconst sinTheta = Math.sin(theta);\n\n\t\t// RotateZ\n\t\tnewOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta;\n\t\tnewOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta;\n\n\t\t// Use only user allowed direction.\n\t\tif (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) {\n\t\t\tnewOffset[0] = 0;\n\t\t} else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) {\n\t\t\tnewOffset[1] = 0;\n\t\t}\n\n\t\treturn newOffset;\n\t}\n\n\tdestroy() {\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle && this._screenRotationAngle.unref();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n\n/**\n * Override getDirectionByAngle to return DIRECTION_ALL\n * Ref: https://github.com/naver/egjs-axes/issues/99\n *\n * But we obey axes's rule. If axes's rule is problem, let's apply following code.\n */\n// PanInput.getDirectionByAngle = function (angle, thresholdAngle) {\n// \treturn DIRECTION_ALL;\n// };\n","import Component from \"@egjs/component\";\nimport {vec3, glMatrix, quat} from \"gl-matrix\";\nimport FusionPoseSensor from \"./input/FusionPoseSensor\";\n\nconst Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0);\n\nexport default class DeviceQuaternion extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._fusionPoseSensor = new FusionPoseSensor();\n\t\tthis._quaternion = quat.create();\n\n\t\tthis._fusionPoseSensor.enable();\n\t\tthis._fusionPoseSensor.on(\"change\", e => {\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis.trigger(\"change\", {isTrusted: true});\n\t\t});\n\t}\n\n\tgetCombinedQuaternion(yaw) {\n\t\tconst yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw));\n\t\tconst conj = quat.conjugate(quat.create(), this._quaternion);\n\t\t// Multiply pitch quaternion -> device quaternion -> yaw quaternion\n\t\tconst outQ = quat.multiply(quat.create(), conj, yawQ);\n\n\t\treturn outQ;\n\t}\n\n\tdestroy() {\n\t\t// detach all event handler\n\t\tthis.off();\n\n\t\tif (this._fusionPoseSensor) {\n\t\t\tthis._fusionPoseSensor.off();\n\t\t\tthis._fusionPoseSensor.destroy();\n\t\t\tthis._fusionPoseSensor = null;\n\t\t}\n\t}\n}\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport Axes, {PinchInput, MoveKeyInput, WheelInput} from \"@egjs/axes\";\nimport {vec2, glMatrix} from \"gl-matrix\";\nimport {getComputedStyle, SUPPORT_TOUCH, SUPPORT_DEVICEMOTION} from \"../utils/browserFeature\";\nimport TiltMotionInput from \"./input/TiltMotionInput\";\nimport RotationPanInput from \"./input/RotationPanInput\";\nimport DeviceQuaternion from \"./DeviceQuaternion\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {\n\tGYRO_MODE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\tTOUCH_DIRECTION_NONE,\n} from \"./consts\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF];\nconst DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF];\nconst CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF];\n\n/**\n * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates.\n *\n * @alias eg.YawPitchControl\n * @extends eg.Component\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n */\nclass YawPitchControl extends Component {\n\tstatic VERSION = VERSION;\n\t// Expose DeviceOrientationControls sub module for test purpose\n\tstatic CONTROL_MODE_VR = CONTROL_MODE_VR;\n\tstatic CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH;\n\tstatic TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL;\n\tstatic TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW;\n\tstatic TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH;\n\tstatic TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE;\n\t/**\n\t * @param {Object} options The option object of the eg.YawPitch module\n\t * @param {Element}[options.element=null] element A base element for the eg.YawPitch module\n\t * @param {Number} [options.yaw=0] initial yaw (degree)\n\t * @param {Number} [options.pitch=0] initial pitch (degree)\n\t * @param {Number} [options.fov=65] initial field of view (degree)\n\t * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown\n\t * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available\n\t * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion.\n\t * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move)\n\t * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw\n\t * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch\n\t * @param {Array} [options.fovRange=[30, 110] Range of FOV\n\t * @param {Number} [options.aspectRatio=1] Aspect Ratio\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\n\t\tconst opt = Object.assign({\n\t\t\telement: null,\n\t\t\tyaw: 0,\n\t\t\tpitch: 0,\n\t\t\tfov: 65,\n\t\t\tshowPolePoint: false,\n\t\t\tuseZoom: true,\n\t\t\tuseKeyboard: true,\n\t\t\tgyroMode: GYRO_MODE.YAWPITCH,\n\t\t\ttouchDirection: TOUCH_DIRECTION_ALL,\n\t\t\tyawRange: DEFAULT_YAW_RANGE,\n\t\t\tpitchRange: DEFAULT_PITCH_RANGE,\n\t\t\tfovRange: [30, 110],\n\t\t\taspectRatio: 1, /* TODO: Need Mandatory? */\n\t\t}, options);\n\n\t\tthis._element = opt.element;\n\t\tthis._initialFov = opt.fov;\n\t\tthis._enabled = false;\n\t\tthis._isAnimating = false;\n\t\tthis._deviceQuaternion = null;\n\n\t\tthis._initAxes(opt);\n\t\tthis.option(opt);\n\t}\n\n\t_initAxes(opt) {\n\t\tconst yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio);\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint);\n\t\tconst useRotation = opt.gyroMode === GYRO_MODE.VR;\n\n\t\tthis.axesPanInput = new RotationPanInput(this._element, {useRotation});\n\t\tthis.axesWheelInput = new WheelInput(this._element, {scale: -4});\n\t\tthis.axesTiltMotionInput = null;\n\t\tthis.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, {scale: -1}) : null;\n\t\tthis.axesMoveKeyInput = new MoveKeyInput(this._element, {scale: [-6, 6]});\n\n\t\tthis.axes = new Axes({\n\t\t\tyaw: {\n\t\t\t\trange: yRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(yRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tpitch: {\n\t\t\t\trange: pRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(pRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tfov: {\n\t\t\t\trange: opt.fovRange,\n\t\t\t\tcircular: [false, false],\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t}, {\n\t\t\tdeceleration: MC_DECELERATION,\n\t\t\tmaximumDuration: MC_MAXIMUM_DURATION\n\t\t}, {\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov\n\t\t}).on({\n\t\t\thold: evt => {\n\t\t\t\t// Restore maximumDuration not to be spin too mush.\n\t\t\t\tthis.axes.options.maximumDuration = MC_MAXIMUM_DURATION;\n\n\t\t\t\tthis.trigger(\"hold\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t\tchange: evt => {\n\t\t\t\tif (evt.delta.fov !== 0) {\n\t\t\t\t\tthis._updateControlScale(evt);\n\t\t\t\t\tthis.updatePanScale();\n\t\t\t\t}\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\trelease: evt => {\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\tanimationStart: evt => {\n\t\t\t},\n\t\t\tanimationEnd: evt => {\n\t\t\t\tthis.trigger(\"animationEnd\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Update Pan Scale\n\t *\n\t * Scale(Sensitivity) values of panning is related with fov and height.\n\t * If at least one of them is changed, this function need to be called.\n\t * @param {*} param\n\t */\n\tupdatePanScale(param = {}) {\n\t\tconst fov = this.axes.get().fov;\n\t\tconst areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);\n\t\tconst scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight;\n\n\t\tthis.axesPanInput.options.scale = [scale, scale];\n\t\tthis.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW;\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * Override component's option method\n\t * to call method for updating values which is affected by option change.\n\t *\n\t * @param {*} args\n\t */\n\toption(...args) {\n\t\tconst argLen = args.length;\n\n\t\t// Getter\n\t\tif (argLen === 0) {\n\t\t\treturn this._getOptions();\n\t\t} else if (argLen === 1 && typeof args[0] === \"string\") {\n\t\t\treturn this._getOptions(args[0]);\n\t\t}\n\n\t\t// Setter\n\t\tconst beforeOptions = Object.assign({}, this.options);\n\t\tlet newOptions = {};\n\t\tlet changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList.\n\n\t\tif (argLen === 1) {\n\t\t\tchangedKeyList = Object.keys(args[0]);\n\t\t\tnewOptions = Object.assign({}, args[0]);\n\t\t} else if (argLen >= 2) {\n\t\t\tchangedKeyList.push(args[0]);\n\t\t\tnewOptions[args[0]] = args[1];\n\t\t}\n\n\t\tthis._setOptions(this._getValidatedOptions(newOptions));\n\t\tthis._applyOptions(changedKeyList, beforeOptions);\n\t\treturn this;\n\t}\n\n\t_getValidatedOptions(newOptions) {\n\t\tif (newOptions.yawRange) {\n\t\t\tnewOptions.yawRange =\n\t\t\t\tthis._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio);\n\t\t}\n\t\tif (newOptions.pitchRange) {\n\t\t\tnewOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov);\n\t\t}\n\t\treturn newOptions;\n\t}\n\n\t_getOptions(key) {\n\t\tlet value;\n\n\t\tif (typeof key === \"string\") {\n\t\t\tvalue = this.options[key];\n\t\t} else if (arguments.length === 0) {\n\t\t\tvalue = this.options;\n\t\t}\n\t\treturn value;\n\t}\n\n\t_setOptions(options) {\n\t\tfor (const key in options) {\n\t\t\tthis.options[key] = options[key];\n\t\t}\n\t}\n\n\t_applyOptions(keys, prevOptions) {\n\t\tconst options = this.options;\n\t\tconst axes = this.axes;\n\t\tconst isVR = options.gyroMode === GYRO_MODE.VR;\n\t\tconst isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH;\n\t\t// If it's VR mode, restrict user interaction to yaw direction only\n\t\tconst touchDirection = isVR ?\n\t\t\t(TOUCH_DIRECTION_YAW & options.touchDirection) :\n\t\t\toptions.touchDirection;\n\n\t\t// If one of below is changed, call updateControlScale()\n\t\tif (keys.some(key =>\n\t\t\tkey === \"showPolePoint\" || key === \"fov\" || key === \"aspectRatio\" ||\n\t\t\tkey === \"yawRange\" || key === \"pitchRange\"\n\t\t)) {\n\t\t\t// If fov is changed, update pan scale\n\t\t\tif (keys.indexOf(\"fov\") >= 0) {\n\t\t\t\taxes.setTo({\"fov\": options.fov});\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\n\t\t\tthis._updateControlScale();\n\t\t}\n\n\t\tif (keys.some(key => key === \"fovRange\")) {\n\t\t\tconst fovRange = options.fovRange;\n\t\t\tconst prevFov = axes.get().fov;\n\t\t\tlet nextFov = axes.get().fov;\n\n\t\t\tvec2.copy(axes.axis.fov.range, fovRange);\n\n\t\t\tif (nextFov < fovRange[0]) {\n\t\t\t\tnextFov = fovRange[0];\n\t\t\t} else if (prevFov > fovRange[1]) {\n\t\t\t\tnextFov = fovRange[1];\n\t\t\t}\n\n\t\t\tif (prevFov !== nextFov) {\n\t\t\t\taxes.setTo({\n\t\t\t\t\tfov: nextFov\n\t\t\t\t}, 0);\n\t\t\t\tthis._updateControlScale();\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"gyroMode\") && SUPPORT_DEVICEMOTION) {\n\t\t\t// Disconnect first\n\t\t\tif (this.axesTiltMotionInput) {\n\t\t\t\tthis.axes.disconnect(this.axesTiltMotionInput);\n\t\t\t\tthis.axesTiltMotionInput.destroy();\n\t\t\t\tthis.axesTiltMotionInput = null;\n\t\t\t}\n\n\t\t\tif (this._deviceQuaternion) {\n\t\t\t\tthis._deviceQuaternion.destroy();\n\t\t\t\tthis._deviceQuaternion = null;\n\t\t\t}\n\n\t\t\tif (isVR) {\n\t\t\t\tthis._initDeviceQuaternion();\n\t\t\t} else if (isYawPitch) {\n\t\t\t\tthis.axesTiltMotionInput = new TiltMotionInput(this._element);\n\t\t\t\tthis.axes.connect([\"yaw\", \"pitch\"], this.axesTiltMotionInput);\n\t\t\t}\n\n\t\t\tthis.axesPanInput.setUseRotation(isVR);\n\t\t}\n\n\t\tif (keys.some(key => key === \"useKeyboard\")) {\n\t\t\tconst useKeyboard = options.useKeyboard;\n\n\t\t\tif (useKeyboard) {\n\t\t\t\taxes.connect([\"yaw\", \"pitch\"], this.axesMoveKeyInput);\n\t\t\t} else {\n\t\t\t\taxes.disconnect(this.axesMoveKeyInput);\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"useZoom\")) {\n\t\t\tconst useZoom = options.useZoom;\n\n\t\t\t// Disconnect first\n\t\t\taxes.disconnect(this.axesWheelInput);\n\t\t\tif (useZoom) {\n\t\t\t\taxes.connect([\"fov\"], this.axesWheelInput);\n\t\t\t}\n\t\t}\n\n\t\tthis._togglePinchInputByOption(options.touchDirection, options.useZoom);\n\n\t\tif (keys.some(key => key === \"touchDirection\")) {\n\t\t\tthis._enabled && this._enableTouch(touchDirection);\n\t\t}\n\t}\n\n\t_togglePinchInputByOption(touchDirection, useZoom) {\n\t\tif (this.axesPinchInput) {\n\t\t\t// disconnect first\n\t\t\tthis.axes.disconnect(this.axesPinchInput);\n\n\t\t\t// If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll.\n\t\t\tif (\n\t\t\t\tuseZoom &&\n\t\t\t\ttouchDirection === TOUCH_DIRECTION_ALL &&\n\t\t\t\t// TODO: Get rid of using private property of axes instance.\n\t\t\t\tthis.axes._inputs.indexOf(this.axesPinchInput) === -1\n\t\t\t) {\n\t\t\t\tthis.axes.connect([\"fov\"], this.axesPinchInput);\n\t\t\t}\n\t\t}\n\t}\n\n\t_enableTouch(direction) {\n\t\t// Disconnect first\n\t\tthis.axesPanInput && this.axes.disconnect(this.axesPanInput);\n\n\t\tconst yawEnabled = direction & TOUCH_DIRECTION_YAW ? \"yaw\" : null;\n\t\tconst pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? \"pitch\" : null;\n\n\t\tthis.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput);\n\t}\n\n\t_initDeviceQuaternion() {\n\t\tthis._deviceQuaternion = new DeviceQuaternion();\n\t\tthis._deviceQuaternion.on(\"change\", e => {\n\t\t\tthis._triggerChange(e);\n\t\t});\n\t}\n\n\t_getValidYawRange(newYawRange, newFov, newAspectRatio) {\n\t\tconst ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1);\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst horizontalFov = fov * ratio;\n\t\tconst isValid = newYawRange[1] - newYawRange[0] >= horizontalFov;\n\n\t\tif (isValid) {\n\t\t\treturn newYawRange;\n\t\t} else {\n\t\t\treturn this.options.yawRange || DEFAULT_YAW_RANGE;\n\t\t}\n\t}\n\n\t_getValidPitchRange(newPitchRange, newFov) {\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst isValid = newPitchRange[1] - newPitchRange[0] >= fov;\n\n\t\tif (isValid) {\n\t\t\treturn newPitchRange;\n\t\t} else {\n\t\t\treturn this.options.pitchRange || DEFAULT_PITCH_RANGE;\n\t\t}\n\t}\n\n\tstatic isCircular(range) {\n\t\treturn range[1] - range[0] < 360 ? [false, false] : [true, true];\n\t}\n\n\t/**\n\t * Update yaw/pitch min/max by 5 factor\n\t *\n\t * 1. showPolePoint\n\t * 2. fov\n\t * 3. yawRange\n\t * 4. pitchRange\n\t * 5. aspectRatio\n\t *\n\t * If one of above is changed, call this function\n\t */\n\t_updateControlScale(changeEvt) {\n\t\tconst opt = this.options;\n\t\tconst fov = this.axes.get().fov;\n\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint);\n\t\tconst yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio);\n\n\t\t// TODO: If not changed!?\n\t\tconst pos = this.axes.get();\n\t\tlet y = pos.yaw;\n\t\tlet p = pos.pitch;\n\n\t\tvec2.copy(this.axes.axis.yaw.range, yRange);\n\t\tvec2.copy(this.axes.axis.pitch.range, pRange);\n\t\tthis.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange);\n\t\tthis.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange);\n\n\t\t/**\n\t\t * update yaw/pitch by it's range.\n\t\t */\n\t\tif (y < yRange[0]) {\n\t\t\ty = yRange[0];\n\t\t} else if (y > yRange[1]) {\n\t\t\ty = yRange[1];\n\t\t}\n\n\t\tif (p < pRange[0]) {\n\t\t\tp = pRange[0];\n\t\t} else if (p > pRange[1]) {\n\t\t\tp = pRange[1];\n\t\t}\n\n\t\tif (changeEvt) {\n\t\t\tchangeEvt.set({\n\t\t\t\tyaw: y,\n\t\t\t\tpitch: p,\n\t\t\t});\n\t\t}\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\t_updatePitchRange(pitchRange, fov, showPolePoint) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\t// Circular pitch on VR\n\t\t\treturn CIRCULAR_PITCH_RANGE;\n\t\t}\n\n\t\tconst verticalAngle = pitchRange[1] - pitchRange[0];\n\t\tconst halfFov = fov / 2;\n\t\tconst isPanorama = verticalAngle < 180;\n\n\t\tif (showPolePoint && !isPanorama) {\n\t\t\t// Use full pinch range\n\t\t\treturn pitchRange.concat();\n\t\t}\n\n\t\t// Round value as movableCood do.\n\t\treturn [pitchRange[0] + halfFov, pitchRange[1] - halfFov];\n\t}\n\n\t_updateYawRange(yawRange, fov, aspectRatio) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\treturn DEFAULT_YAW_RANGE;\n\t\t}\n\n\t\tconst horizontalAngle = yawRange[1] - yawRange[0];\n\n\t\t/**\n\t\t * Full 360 Mode\n\t\t */\n\t\tif (horizontalAngle >= 360) {\n\t\t\t// Don't limit yaw range on Full 360 mode.\n\t\t\treturn yawRange.concat();\n\t\t}\n\n\t\t/**\n\t\t * Panorama mode\n\t\t */\n\t\t// Ref : https://github.com/naver/egjs-view360/issues/290\n\t\tconst halfHorizontalFov =\n\t\t\tmathUtil.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2))));\n\n\t\t// Round value as movableCood do.\n\t\treturn [\n\t\t\tyawRange[0] + halfHorizontalFov,\n\t\t\tyawRange[1] - halfHorizontalFov\n\t\t];\n\t}\n\n\t_triggerChange(evt) {\n\t\tconst pos = this.axes.get();\n\t\tconst opt = this.options;\n\t\tconst event = {\n\t\t\ttargetElement: opt.element,\n\t\t\tisTrusted: evt.isTrusted,\n\t\t};\n\n\t\tevent.yaw = pos.yaw;\n\t\tevent.pitch = pos.pitch;\n\t\tevent.fov = pos.fov;\n\n\t\tif (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) {\n\t\t\tevent.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t\t}\n\t\tthis.trigger(\"change\", event);\n\t}\n\n\t// TODO: makes constant to be logic\n\tstatic adjustAspectRatio(input) {\n\t\tconst inputRange = [\n\t\t\t0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670,\n\t\t\t0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19,\n\t\t\t1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26,\n\t\t\t2.30, 2.60, 3.00, 5.00, 6.00\n\t\t];\n\t\tconst outputRange = [\n\t\t\t0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710,\n\t\t\t0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15,\n\t\t\t1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72,\n\t\t\t1.82, 1.92, 2.00, 2.24, 2.30\n\t\t];\n\n\t\tlet rangeIdx = -1;\n\n\t\tfor (let i = 0; i < inputRange.length - 1; i++) {\n\t\t\tif (inputRange[i] <= input && inputRange[i + 1] >= input) {\n\t\t\t\trangeIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (rangeIdx === -1) {\n\t\t\tif (inputRange[0] > input) {\n\t\t\t\treturn outputRange[0];\n\t\t\t} else {\n\t\t\t\treturn outputRange[outputRange[0].length - 1];\n\t\t\t}\n\t\t}\n\n\t\tconst inputA = inputRange[rangeIdx];\n\t\tconst inputB = inputRange[rangeIdx + 1];\n\t\tconst outputA = outputRange[rangeIdx];\n\t\tconst outputB = outputRange[rangeIdx + 1];\n\n\t\treturn YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA));\n\t}\n\n\tstatic lerp(a, b, fraction) {\n\t\treturn a + fraction * (b - a);\n\t}\n\n\t/**\n\t * Enable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#enable\n\t */\n\tenable() {\n\t\tif (this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._enabled = true;\n\n\t\t// touchDirection is decided by parameter is valid string (Ref. Axes.connect)\n\t\tthis._applyOptions(Object.keys(this.options), this.options);\n\n\t\t// TODO: Is this code is needed? Check later.\n\t\tthis.updatePanScale();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Disable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#disable\n\t */\n\tdisable(persistOrientation) {\n\t\tif (!this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// TODO: Check peristOrientation is needed!\n\t\tif (!persistOrientation) {\n\t\t\tthis._resetOrientation();\n\t\t}\n\t\tthis.axes.disconnect();\n\t\tthis._enabled = false;\n\t\treturn this;\n\t}\n\n\t_resetOrientation() {\n\t\tconst opt = this.options;\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Set one or more of yaw, pitch, fov\n\t *\n\t * @param {Object} coordinate yaw, pitch, fov\n\t * @param {Number} duration Animation duration. if it is above 0 then it's animated.\n\t */\n\tlookAt({yaw, pitch, fov}, duration) {\n\t\tconst pos = this.axes.get();\n\n\t\tconst y = yaw === undefined ? 0 : yaw - pos.yaw;\n\t\tconst p = pitch === undefined ? 0 : pitch - pos.pitch;\n\t\tconst f = fov === undefined ? 0 : fov - pos.fov;\n\n\t\t// Allow duration of animation to have more than MC_MAXIMUM_DURATION.\n\t\tthis.axes.options.maximumDuration = Infinity;\n\n\t\tthis.axes.setBy({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t\tfov: f\n\t\t}, duration);\n\t}\n\n\tgetYawPitch() {\n\t\tconst yawPitch = this.axes.get();\n\n\t\treturn {\n\t\t\tyaw: yawPitch.yaw,\n\t\t\tpitch: yawPitch.pitch,\n\t\t};\n\t}\n\n\tgetFov() {\n\t\treturn this.axes.get().fov;\n\t}\n\n\tgetQuaternion() {\n\t\tconst pos = this.axes.get();\n\n\t\treturn this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t}\n\n\tshouldRenderWithQuaternion() {\n\t\treturn this.options.gyroMode === GYRO_MODE.VR;\n\t}\n\n\t/**\n\t * Destroys objects\n\t */\n\tdestroy() {\n\t\tthis.axes && this.axes.destroy();\n\t\tthis.axisPanInput && this.axisPanInput.destroy();\n\t\tthis.axesWheelInput && this.axesWheelInput.destroy();\n\t\tthis.axesTiltMotionInput && this.axesTiltMotionInput.destroy();\n\t\tthis.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy();\n\t\tthis.axesPinchInput && this.axesPinchInput.destroy();\n\t\tthis.axesMoveKeyInput && this.axesMoveKeyInput.destroy();\n\t\tthis._deviceQuaternion && this._deviceQuaternion.destroy();\n\t}\n}\n\nexport default YawPitchControl;\n","import Component from \"@egjs/component\";\n\nconst STATUS = {\n\t\"NONE\": 0,\n\t\"LOADING\": 1,\n\t\"LOADED\": 2,\n\t\"ERROR\": 3\n};\n\nconst EVENT = {\n\t\"READYSTATECHANGE\": \"readystatechange\"\n};\n\nclass ImageLoader extends Component {\n\tstatic STATUS = STATUS;\n\tconstructor(image) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis._image = null;\n\t\tthis._onceHandlers = [];\n\t\tthis._loadStatus = STATUS.NONE;\n\n\t\timage && this.set(image);\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._image) {\n\t\t\t\trej(\"ImageLoader: image is not defiend\");\n\t\t\t} else if (this._loadStatus === STATUS.LOADED) {\n\t\t\t\tres(this.getElement());\n\t\t\t} else if (this._loadStatus === STATUS.LOADING) {\n\t\t\t\t/* Check isMaybeLoaded() first because there may have\n\t\t\t\t\tposibilities that image already loaded before get is called.\n\t\t\t\t\tfor example calling get on external image onload callback.*/\n\t\t\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\t\tres(this.getElement());\n\t\t\t\t} else {\n\t\t\t\t\tthis.on(EVENT.READYSTATECHANGE, e => {\n\t\t\t\t\t\tif (e.type === STATUS.LOADED) {\n\t\t\t\t\t\t\tres(this.getElement());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trej(\"ImageLoader: failed to load images.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trej(\"ImageLoader: failed to load images\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param image img element or img url or array of img element or array of img url\n\t */\n\tset(image) {\n\t\tthis._loadStatus = STATUS.LOADING;\n\n\t\tthis._image = ImageLoader.createElement(image);\n\n\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.onceLoaded(\n\t\t\tthis._image,\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.LOADED\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.ERROR;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.ERROR\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tstatic createElement(image) {\n\t\tconst images = image instanceof Array ? image : [image];\n\n\t\treturn images.map(img => {\n\t\t\tlet _img = img;\n\n\t\t\tif (typeof img === \"string\") {\n\t\t\t\t_img = new Image();\n\t\t\t\t_img.crossOrigin = \"anonymous\";\n\t\t\t\t_img.src = img;\n\t\t\t}\n\t\t\treturn _img;\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._image.length === 1 ? this._image[0] : this._image;\n\t}\n\n\tstatic isMaybeLoaded(image) {\n\t\tlet result = false;\n\n\t\tif (image instanceof Image) {\n\t\t\tresult = image.complete && image.naturalWidth !== 0;\n\t\t} else if (image instanceof Array) {\n\t\t\tresult = !image.some(img => !img.complete || img.naturalWidth === 0);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonceLoaded(target, onload, onerror) {\n\t\tconst targets = target instanceof Array ? target : [target];\n\t\tconst targetsNotLoaded = targets.filter(img => !ImageLoader.isMaybeLoaded(img));\n\t\tconst loadPromises = targetsNotLoaded.map(img => new Promise((res, rej) => {\n\t\t\tthis._once(img, \"load\", () => (res(img)));\n\t\t\tthis._once(img, \"error\", () => (rej(img)));\n\t\t}));\n\n\t\tPromise.all(loadPromises).then(\n\t\t\tresult => (onload(targets.length === 1 ? targets[0] : targets)),\n\t\t\treason => (onerror(reason))\n\t\t);\n\t}\n\n\t_once(target, type, listener) {\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\ttarget.addEventListener(type, fn);\n\t\tthis._onceHandlers.push({target, type, fn});\n\t}\n\n\tgetStatus() {\n\t\treturn this._loadStatus;\n\t}\n\n\tdestroy() {\n\t\tthis._onceHandlers.forEach(handler => {\n\t\t\thandler.target.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._onceHandlers = [];\n\t\tthis._image.src = \"\";\n\t\tthis._image = null;\n\t\tthis._loadStatus = STATUS.NONE;\n\t}\n}\n\nexport default ImageLoader;\n","// import Agent from \"@egjs/agent\";\n\n/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */\nconst READY_STATUS = {\n\tHAVE_NOTHING: 0, // no information whether or not the audio/video is ready\n\tHAVE_METADATA: 1, // HAVE_METADATA - metadata for the audio/video is ready\n\tHAVE_CURRENT_DATA: 2, // data for the current playback position is available, but not enough data to play next frame/millisecond\n\tHAVE_FUTURE_DATA: 3, // data for the current and at least the next frame is available\n\tHAVE_ENOUGH_DATA: 4, // enough data available to start playing\n\t// below is custom status for failed to load status\n\tLOADING_FAILED: -1\n};\n\nconst READYSTATECHANGE_EVENT_NAME = {};\n\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = \"loadedmetadata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = \"loadeddata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = \"canplay\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = \"canplaythrough\";\n\nexport default class VideoLoader {\n\tconstructor(video) {\n\t\tthis._handlers = [];\n\t\tthis._sourceCount = 0;\n\n\t\t// on iOS safari, 'loadeddata' will not triggered unless the user hits play,\n\t\t// so used 'loadedmetadata' instead.\n\t\tthis._thresholdReadyState = READY_STATUS.HAVE_METADATA;\n\t\tthis._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState];\n\n\t\tthis._loadStatus = (video && video.readyState) || READY_STATUS.HAVE_NOTHING;\n\n\t\tthis._onerror = this._onerror.bind(this);\n\n\t\tvideo && this.set(video);\n\t}\n\n\t_onerror() {\n\t\tthis._errorCount++;\n\t\tif (this._errorCount >= this._sourceCount) {\n\t\t\tthis._loadStatus = READY_STATUS.LOADING_FAILED;\n\t\t\tthis._detachErrorHandler(this._onerror);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src}\n\t */\n\t_appendSourceElement(videoUrl) {\n\t\tlet videoSrc;\n\t\tlet videoType;\n\n\t\tif (typeof videoUrl === \"object\") {\n\t\t\tvideoSrc = videoUrl.src;\n\t\t\tvideoType = videoUrl.type;\n\t\t} else if (typeof videoUrl === \"string\") {\n\t\t\tvideoSrc = videoUrl;\n\t\t}\n\n\t\tif (!videoSrc) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst sourceElement = document.createElement(\"source\");\n\n\t\tsourceElement.src = videoSrc;\n\t\tvideoType && (sourceElement.type = videoType);\n\n\t\tthis._video.appendChild(sourceElement);\n\t\treturn true;\n\t}\n\n\tset(video) {\n\t\tthis._reset(); // reset resources.\n\n\t\tif (!video) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (video instanceof HTMLVideoElement) {\n\t\t\t// video tag\n\t\t\tthis._video = video;\n\t\t} else if (typeof video === \"string\" || typeof video === \"object\") {\n\t\t\t// url\n\t\t\tthis._video = document.createElement(\"video\");\n\t\t\tthis._video.setAttribute(\"crossorigin\", \"anonymous\");\n\t\t\tthis._video.setAttribute(\"webkit-playsinline\", \"\");\n\t\t\tthis._video.setAttribute(\"playsinline\", \"\");\n\n\t\t\tif (video instanceof Array) {\n\t\t\t\tvideo.forEach(v => this._appendSourceElement(v));\n\t\t\t} else {\n\t\t\t\tthis._appendSourceElement(video);\n\t\t\t}\n\n\t\t\tthis._sourceCount = this._video.querySelectorAll(\"source\").length;\n\n\t\t\tif (this._sourceCount > 0) {\n\t\t\t\tif (this._video.readyState < this._thresholdReadyState) {\n\t\t\t\t\tthis._video.load();\n\t\t\t\t\t// attach loading error listener\n\t\t\t\t\tthis._attachErrorHandler(this._onerror);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._video = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t_attachErrorHandler(handler) {\n\t\tthis._video.addEventListener(\"error\", handler);\n\t\tthis._sources = this._video.querySelectorAll(\"source\");\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.addEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\t_detachErrorHandler(handler) {\n\t\tthis._video.removeEventListener(\"error\", handler);\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.removeEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._video) {\n\t\t\t\trej(\"VideoLoader: video is undefined\");\n\t\t\t} else if (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t} else if (this._video.readyState >= this._thresholdReadyState) {\n\t\t\t\tres(this._video);\n\t\t\t} else {\n\t\t\t\t// check errorCnt and reject\n\t\t\t\tconst rejector = () => {\n\t\t\t\t\tif (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\t\t\tthis._detachErrorHandler(rejector);\n\t\t\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis._attachErrorHandler(rejector);\n\t\t\t\tthis._once(this._thresholdEventName, () => res(this._video));\n\t\t\t}\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._video;\n\t}\n\n\tdestroy() {\n\t\tthis._reset();\n\t}\n\n\t_reset() {\n\t\tthis._handlers.forEach(handler => {\n\t\t\tthis._video.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._handlers = [];\n\t\tthis._video = null;\n\n\t\tthis._sourceCount = 0;\n\t\tthis._errorCount = 0;\n\t}\n\n\t_once(type, listener) {\n\t\tconst target = this._video;\n\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\t/* By useCapture mode enabled, you can capture the error event being fired on source(child)*/\n\t\ttarget.addEventListener(type, fn, true);\n\t\tthis._handlers.push({type, fn});\n\t}\n}\n","import agent from \"@egjs/agent\";\n\nconst WEBGL_ERROR_CODE = {\n\t\"0\": \"NO_ERROR\",\n\t\"1280\": \"INVALID_ENUM\",\n\t\"1281\": \"INVALID_VALUE\",\n\t\"1282\": \"INVALID_OPERATION\",\n\t\"1285\": \"OUT_OF_MEMORY\",\n\t\"1286\": \"INVALID_FRAMEBUFFER_OPERATION\",\n\t\"37442\": \"CONTEXT_LOST_WEBGL\"\n};\n\nlet webglAvailability = null;\nlet MAX_TEXTURE_SIZE_FOR_TEST = null;\n\nexport default class WebGLUtils {\n\tstatic createShader(gl, type, source) {\n\t\tconst shader = gl.createShader(type);\n\n\t\tgl.shaderSource(shader, source);\n\t\tgl.compileShader(shader);\n\t\tconst success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n\t\tif (success) {\n\t\t\treturn shader;\n\t\t} else {\n\t\t\t// eslint-disable-next-line\n\t\t\tconsole.error(gl.getShaderInfoLog(shader));\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic createProgram(gl, vertexShader, fragmentShader) {\n\t\tconst program = gl.createProgram();\n\n\t\tgl.attachShader(program, vertexShader);\n\t\tgl.attachShader(program, fragmentShader);\n\t\tgl.linkProgram(program);\n\n\t\tgl.detachShader(program, vertexShader);\n\t\tgl.detachShader(program, fragmentShader);\n\t\tgl.deleteShader(vertexShader);\n\t\tgl.deleteShader(fragmentShader);\n\n\t\tconst success = gl.getProgramParameter(program, gl.LINK_STATUS);\n\n\t\tif (success) {\n\t\t\treturn program;\n\t\t}\n\n\t\tgl.deleteProgram(program);\n\t\treturn null;\n\t}\n\n\tstatic initBuffer(gl, target /* bind point */, data, itemSize, attr) {\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer(target, buffer);\n\t\tgl.bufferData(target, data, gl.STATIC_DRAW);\n\n\t\tif (buffer) {\n\t\t\tbuffer.itemSize = itemSize;\n\t\t\tbuffer.numItems = data.length / itemSize;\n\t\t}\n\n\t\tif (attr !== undefined) {\n\t\t\tgl.enableVertexAttribArray(attr);\n\t\t\tgl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\tstatic getWebglContext(canvas, userContextAttributes) {\n\t\tconst webglIdentifiers = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n\t\tlet context = null;\n\t\tconst contextAttributes = Object.assign({\n\t\t\tpreserveDrawingBuffer: false,\n\t\t\tantialias: false,\n\t\t\txrCompatible: true\n\t\t}, userContextAttributes);\n\n\t\tfunction onWebglcontextcreationerror(e) {\n\t\t\treturn e.statusMessage;\n\t\t}\n\n\t\tcanvas.addEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\tfor (let i = 0; i < webglIdentifiers.length; i++) {\n\t\t\ttry {\n\t\t\t\tcontext = canvas.getContext(webglIdentifiers[i], contextAttributes);\n\t\t\t} catch (t) {}\n\t\t\tif (context) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcanvas.removeEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\treturn context;\n\t}\n\n\tstatic createTexture(gl, textureTarget) {\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture(textureTarget, texture);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(textureTarget, null);\n\n\t\treturn texture;\n\t}\n\n\t/**\n\t * Returns the webgl availability of the current browser.\n\t * @method WebGLUtils#isWebGLAvailable\n\t * @retuen {Boolean} isWebGLAvailable\n\t */\n\tstatic isWebGLAvailable() {\n\t\tif (webglAvailability === null) {\n\t\t\tconst canvas = document.createElement(\"canvas\");\n\t\t\tconst webglContext = WebGLUtils.getWebglContext(canvas);\n\n\t\t\twebglAvailability = !!webglContext;\n\n\t\t\t// webglContext Resource forced collection\n\t\t\tif (webglContext) {\n\t\t\t\tconst loseContextExtension = webglContext.getExtension(\"WEBGL_lose_context\");\n\n\t\t\t\tloseContextExtension && loseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t\treturn webglAvailability;\n\t}\n\n\t/**\n\t * Returns whether webgl is stable in the current browser.\n\t * @method WebGLUtils#isStableWebGL\n\t * @retuen {Boolean} isStableWebGL\n\t */\n\tstatic isStableWebGL() {\n\t\tconst agentInfo = agent();\n\t\tlet isStableWebgl = true;\n\n\t\tif (agentInfo.os.name === \"android\") {\n\t\t\tconst version = parseFloat(agentInfo.os.version);\n\n\t\t\tif (version <= 4.3) {\n\t\t\t\tisStableWebgl = false;\n\t\t\t} else if (version === 4.4) {\n\t\t\t\tif (agentInfo.browser.name !== \"chrome\") {\n\t\t\t\t\tisStableWebgl = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isStableWebgl;\n\t}\n\n\tstatic getErrorNameFromWebGLErrorCode(code) {\n\t\tif (!(code in WEBGL_ERROR_CODE)) {\n\t\t\treturn \"UNKNOWN_ERROR\";\n\t\t}\n\n\t\treturn WEBGL_ERROR_CODE[code];\n\t}\n\n\n\t/**\n\t * This function is wrapper for texImage2D to handle exceptions on texImage2D.\n\t * Purpose is to prevent service from being stopped by script error.\n\t *\n\t * @param {*} gl\n\t * @param {*} target\n\t * @param {*} pixels\n\t */\n\tstatic texImage2D(gl, target, pixels) {\n\t\ttry {\n\t\t\tgl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\t\t} catch (error) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.error(\"WebGLUtils.texImage2D error:\", error);\n\t\t\t/* eslint-enable no-console */\n\t\t}\n\t}\n\n\tstatic getMaxTextureSize(gl) {\n\t\t// WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test\n\t\treturn MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\t}\n}\n\n/**\n * This function should not be used in service code. It's provided only for test purpose.\n * It should be set to null or 0 when test is done.\n *\n * @param {Number} size\n */\nfunction setMaxTextureSizeForTestOnlyPurpose(size) {\n\tMAX_TEXTURE_SIZE_FOR_TEST = size;\n}\n\nexport {\n\tsetMaxTextureSizeForTestOnlyPurpose\n};\n","import Component from \"@egjs/component\";\nimport Agent from \"@egjs/agent\";\n\nconst agent = Agent();\nconst isIE11 = agent.browser.name === \"ie\" && agent.browser.majorVersion === 11;\n\nconst EVENTS = {\n\tERROR: \"error\"\n};\n\n/**\n *\n * Extends Component for firing errors occurs internally.\n */\nclass Renderer extends Component {\n\tstatic EVENTS = EVENTS;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._forceDimension = null;\n\t\tthis._pixelCanvas = null;\n\t\tthis._pixelContext = null;\n\t}\n\n\trender({gl, shaderProgram, indexBuffer, mvMatrix, pMatrix}) {\n\t\tgl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n\t\tgl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n\n\t\tif (indexBuffer) {\n\t\t\tgl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n\t\t}\n\t}\n\n\t// Define interface for Renderers\n\t/**\n\t * Following MUST BE DEFINED on Child of Renderer\n\t *\n\t * DATA\n\t *\n\t * - getVertexPositionData\n\t * - getIndexData\n\t * - getTextureCoordData\n\t *\n\t * SOURCE\n\t *\n\t * - getVertexShaderSource\n\t * - getFragmentShaderSource\n\t *\n\t * TEXTURE\n\t *\n\t * - bindTexture\n\t */\n\tgetDimension(pixelSource) {\n\t\tconst width = pixelSource.naturalWidth || pixelSource.videoWidth;\n\t\tconst height = pixelSource.naturalHeight || pixelSource.videoHeight;\n\n\t\treturn {width, height};\n\t}\n\n\t/**\n\t * Update data used by shader\n\t * \t-\n\t *\n\t *\n\t * @param {*} param\n\t */\n\tupdateShaderData(param) {\n\t\t/*\n\t\t* Update following data in implementation layer.\n\t\t* If the data is not changed, it does not need to implement this function.\n\t\t*\n\t\t* - _VERTEX_POSITION_DATA\n\t\t* - _TEXTURE_COORD_DATA\n\t\t* - _INDEX_DATA\n\t\t*/\n\t}\n\n\t/**\n\t *\n\t * @param {HTMLImageElement | HTMLVideoElement} image\n\t * @param {Object = {width, height}} forceDimension Forced dimension to resize\n\t */\n\t_initPixelSource(image, forceDimension) {\n\t\tconst isIE11Video = isIE11 && (image instanceof HTMLVideoElement);\n\n\t\tif (isIE11Video || forceDimension) {\n\t\t\tconst {width, height} = forceDimension || this.getDimension(image);\n\n\t\t\tthis._pixelCanvas = document.createElement(\"canvas\");\n\t\t\tthis._pixelCanvas.width = width;\n\t\t\tthis._pixelCanvas.height = height;\n\t\t\tthis._pixelContext = this._pixelCanvas.getContext(\"2d\");\n\t\t}\n\t\tthis._forceDimension = forceDimension;\n\t}\n\n\t_getPixelSource(image) {\n\t\tif (!this._pixelCanvas) {\n\t\t\treturn image;\n\t\t}\n\n\t\t/**\n\t\t * IE11 && Video\n\t\t * or\n\t\t * Dimension is forced (Image is larger than texture size.)\n\t\t */\n\t\tconst contentDimension = this.getDimension(image);\n\t\tconst textureDimension = this._forceDimension || contentDimension;\n\n\t\tif (this._pixelCanvas.width !== textureDimension.width) {\n\t\t\tthis._pixelCanvas.width = textureDimension.width;\n\t\t}\n\n\t\tif (this._pixelCanvas.height !== textureDimension.height) {\n\t\t\tthis._pixelCanvas.height = textureDimension.height;\n\t\t}\n\n\t\tif (this._forceDimension) {\n\t\t\tthis._pixelContext.drawImage(image,\n\t\t\t\t0, 0, contentDimension.width, contentDimension.height,\n\t\t\t\t0, 0, textureDimension.width, textureDimension.height);\n\t\t} else {\n\t\t\tthis._pixelContext.drawImage(image, 0, 0);\n\t\t}\n\n\t\treturn this._pixelCanvas;\n\t}\n\n\t_extractTileConfig(imageConfig) {\n\t\tlet tileConfig =\n\t\t\tArray.isArray(imageConfig.tileConfig) ?\n\t\t\t\timageConfig.tileConfig : Array(...Array(6)).map(() => imageConfig.tileConfig);\n\n\t\ttileConfig = tileConfig.map(\n\t\t\tconfig => Object.assign({\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}, config)\n\t\t);\n\n\t\treturn tileConfig;\n\t}\n\n\t_triggerError(error) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.error(\"Renderer Error:\", error);\n\t\t/* eslint-enable no-console */\n\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\tmessage: typeof error === \"string\" ? error : error.message\n\t\t});\n\t}\n}\n\nexport default Renderer;\n","import Agent from \"@egjs/agent\";\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {util as mathUtil} from \"../../utils/math-util.js\";\n\nclass CubeRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = null;\n\tstatic _INDEX_DATA = null;\n\tgetVertexPositionData() {\n\t\tCubeRenderer._VERTEX_POSITION_DATA =\n\t\t\tCubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// top\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// bottom\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\n\t\treturn CubeRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\tif (CubeRenderer._INDEX_DATA) {\n\t\t\treturn CubeRenderer._INDEX_DATA;\n\t\t}\n\n\t\tconst indexData = [];\n\t\tconst vertexPositionData = this.getVertexPositionData();\n\n\t\tfor (let i = 0; i < (vertexPositionData.length / 3); i += 4) {\n\t\t\tindexData.push(\n\t\t\t\ti,\n\t\t\t\ti + 2,\n\t\t\t\ti + 1,\n\t\t\t\ti,\n\t\t\t\ti + 3,\n\t\t\t\ti + 2\n\t\t\t);\n\t\t}\n\n\t\tCubeRenderer._INDEX_DATA = indexData;\n\t\treturn indexData;\n\t}\n\n\tstatic extractOrder(imageConfig) {\n\t\treturn imageConfig.order || \"RLUDBF\";\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\tconst vertexOrder = \"BFUDRL\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst base = this.getVertexPositionData();\n\t\tconst tileConfig = this._extractTileConfig(imageConfig);\n\t\tconst elemSize = 3;\n\t\tconst vertexPerTile = 4;\n\t\tconst textureCoordData =\n\t\t\tvertexOrder.split(\"\")\n\t\t\t\t.map(face => tileConfig[order.indexOf(face)])\n\t\t\t\t.map((config, i) => {\n\t\t\t\t\tconst rotation = parseInt(config.rotation / 90, 10);\n\t\t\t\t\tconst ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2];\n\n\t\t\t\t\tfor (let r = 0; r < Math.abs(rotation); r++) {\n\t\t\t\t\t\tif ((config.flipHorizontal && rotation > 0) ||\n\t\t\t\t\t\t\t(!config.flipHorizontal && rotation < 0)) {\n\t\t\t\t\t\t\tordermap_.push(ordermap_.shift());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tordermap_.unshift(ordermap_.pop());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst elemPerTile = elemSize * vertexPerTile;\n\t\t\t\t\tconst tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile);\n\t\t\t\t\tconst tileTemp = [];\n\n\t\t\t\t\tfor (let j = 0; j < vertexPerTile; j++) {\n\t\t\t\t\t\ttileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize);\n\t\t\t\t\t}\n\t\t\t\t\treturn tileTemp;\n\t\t\t\t})\n\t\t\t\t.join()\n\t\t\t\t.split(\",\")\n\t\t\t\t.map(v => parseInt(v, 10));\n\n\t\treturn textureCoordData;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}`;\n\t}\n\n\tupdateTexture(gl, image, imageConfig) {\n\t\tconst baseOrder = \"RLUDBF\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst orderMap = {};\n\n\t\torder.split(\"\").forEach((v, i) => {\n\t\t\torderMap[v] = i;\n\t\t});\n\n\t\ttry {\n\t\t\tif (image instanceof Array) {\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image);\n\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\t\t\t\t\tconst tile = this.extractTileFromImage(\n\t\t\t\t\t\timage, tileIdx, maxCubeMapTextureSize\n\t\t\t\t\t);\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, tile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis._triggerError(e);\n\t\t}\n\t}\n\n\tbindTexture(gl, texture, image, imageConfig) {\n\t\tgl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\t\tthis.updateTexture(gl, image, imageConfig);\n\t}\n\n\tgetSourceTileSize(image) {\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst aspectRatio = width / height;\n\t\tlet inputTextureSize;\n\n\t\tif (aspectRatio === 1 / 6) {\n\t\t\tinputTextureSize = width;\n\t\t} else if (aspectRatio === 6) {\n\t\t\tinputTextureSize = height;\n\t\t} else if (aspectRatio === 2 / 3) {\n\t\t\tinputTextureSize = width / 2;\n\t\t} else {\n\t\t\tinputTextureSize = width / 3;\n\t\t}\n\t\treturn inputTextureSize;\n\t}\n\n\textractTileFromImage(image, tileIdx, outputTextureSize) {\n\t\tconst {width} = this.getDimension(image);\n\t\tconst inputTextureSize = this.getSourceTileSize(image);\n\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = outputTextureSize;\n\t\tcanvas.height = outputTextureSize;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tconst tilePerRow = width / inputTextureSize;\n\n\t\tconst x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow);\n\t\tconst y = parseInt(tileIdx / tilePerRow, 10) * (inputTextureSize);\n\n\t\tcontext.drawImage(\n\t\t\timage, x, y,\n\t\t\tinputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize\n\t\t);\n\t\treturn canvas;\n\t}\n\n\tgetMaxCubeMapTextureSize(gl, image) {\n\t\tconst agent = Agent();\n\t\tconst maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n\t\tlet _imageWidth = this.getSourceTileSize(image);\n\n\t\tif (agent.browser.name === \"ie\" && agent.browser.majorVersion === 11) {\n\t\t\tif (!mathUtil.isPowerOfTwo(_imageWidth)) {\n\t\t\t\tfor (let i = 1; i < maxCubeMapTextureSize; i *= 2) {\n\t\t\t\t\tif (i < _imageWidth) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_imageWidth = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (agent.os.name === \"ios\") {\n\t\t\tconst majorVersion = agent.os.majorVersion;\n\n\t\t\t// ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다.\n\t\t\tif (majorVersion === 9) {\n\t\t\t\t_imageWidth = 1024;\n\t\t\t}\n\t\t\t// ios 8 의 경우 텍스쳐 최대사이즈는 512 이다.\n\t\t\tif (majorVersion === 8) {\n\t\t\t\t_imageWidth = 512;\n\t\t\t}\n\t\t}\n\t\t// maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수\n\t\treturn Math.min(maxCubeMapTextureSize, _imageWidth);\n\t}\n}\n\nexport default CubeRenderer;\n","\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\n\nexport default class CubeStripRenderer extends Renderer {\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}`;\n\t}\n\n\tgetVertexPositionData() {\n\t\tif (!this._vertices) {\n\t\t\tthis._vertices = [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// up\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// down\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\t\t}\n\n\t\treturn this._vertices;\n\t}\n\n\tgetIndexData() {\n\t\t// TODO: 한번만 계산하도록 수정하기\n\t\tconst indices = (() => {\n\t\t\tconst indexData = [];\n\n\t\t\tfor (let i = 0; i < (this._vertices.length / 3); i += 4) {\n\t\t\t\tindexData.push(\n\t\t\t\t\ti,\n\t\t\t\t\ti + 1,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti + 3\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn indexData;\n\t\t})();\n\n\t\treturn indices;\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\t// TODO: make it cols, rows as config.\n\t\tconst cols = 3;\n\t\tconst rows = 2;\n\t\tconst order = imageConfig.order || \"RLUDFB\";\n\t\tlet coords = [];\n\n\t\t// 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다.\n\t\tfor (let r = rows - 1; r >= 0; r--) {\n\t\t\tfor (let c = 0; c < cols; c++) {\n\t\t\t\tconst coord = [\n\t\t\t\t\tc / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, (r + 1) / rows,\n\t\t\t\t\tc / cols, (r + 1) / rows\n\t\t\t\t];\n\n\t\t\t\tcoords.push(coord);\n\t\t\t}\n\t\t}\n\n\t\tconst tileConfigs = this._extractTileConfig(imageConfig);\n\n\t\t// Transform Coord By Flip & Rotation\n\t\tcoords = coords\n\t\t// shrink coord to avoid pixel bleeding\n\t\t\t.map(coord => this._shrinkCoord(coord))\n\t\t\t.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));\n\n\t\t// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치\n\t\treturn \"BFUDRL\".split(\"\")\n\t\t\t.map(face => order.indexOf(face))\n\t\t\t.map(index => coords[index])\n\t\t\t.reduce((acc, val) => acc.concat(val), []);\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\t_transformCoord(coord, tileConfig) {\n\t\tlet newCoord = coord.slice();\n\n\t\tif (tileConfig.flipHorizontal) {\n\t\t\tnewCoord = this._flipHorizontalCoord(newCoord);\n\t\t}\n\n\t\tif (tileConfig.rotation) {\n\t\t\tnewCoord = this._rotateCoord(newCoord, tileConfig.rotation);\n\t\t}\n\n\t\treturn newCoord;\n\t}\n\n\t_shrinkCoord(coord) {\n\t\tconst SHRINK_Y = 0.00;\n\t\tconst SHRINK_X = 0.00;\n\n\t\treturn [\n\t\t\tcoord[0] + SHRINK_X, coord[1] + SHRINK_Y,\n\t\t\tcoord[2] - SHRINK_X, coord[3] + SHRINK_Y,\n\t\t\tcoord[4] - SHRINK_X, coord[5] - SHRINK_Y,\n\t\t\tcoord[6] + SHRINK_X, coord[7] - SHRINK_Y\n\t\t];\n\t}\n\n\t_rotateCoord(coord, rotationAngle) {\n\t\tconst SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord.\n\t\tconst shiftCount = parseInt(rotationAngle / 90, 10) % 4;\n\n\t\tif (shiftCount === 0) {\n\t\t\treturn coord;\n\t\t}\n\n\t\tlet moved;\n\t\tlet rotatedCoord = [];\n\n\t\tif (shiftCount > 0) {\n\t\t\tmoved = coord.splice(0, shiftCount * SIZE);\n\t\t\trotatedCoord = coord.concat(moved);\n\t\t} else {\n\t\t\tmoved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE);\n\t\t\trotatedCoord = moved.concat(coord);\n\t\t}\n\n\t\treturn rotatedCoord;\n\t}\n\n\t_flipHorizontalCoord(coord) {\n\t\treturn [\n\t\t\tcoord[2], coord[3],\n\t\t\tcoord[0], coord[1],\n\t\t\tcoord[6], coord[7],\n\t\t\tcoord[4], coord[5]\n\t\t];\n\t}\n}\n","/**\n * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide})\n * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고)\n * @namespace\n * @name GYRO_MODE\n * @memberof eg.view360.PanoViewer\n */\n/**\n * Disable gyro\n * @ko gyro 비활성화\n * @name NONE\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"none\"\n */\n/**\n * YawPitch Mode\n * @ko YawPitch Mode\n * @name YAWPITCH\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"yawPitch\"\n */\n/**\n * VR Mode\n * @ko VR Mode\n * @name VR\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"VR\"\n */\nimport {GYRO_MODE} from \"../YawPitchControl/consts\";\n\n/**\n * Constant value for errors\n * @ko 에러에 대한 상수 값\n * @namespace\n * @name ERROR_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst ERROR_TYPE = {\n\t/**\n\t * Unsupported device\n\t * @ko 미지원 기기\n\t * @name INVALID_DEVICE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 10\n\t */\n\tINVALID_DEVICE: 10,\n\t/**\n\t * Webgl not support\n\t * @ko WEBGL 미지원\n\t * @name NO_WEBGL\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 11\n\t */\n\tNO_WEBGL: 11,\n\t/**\n\t * Failed to load image\n\t * @ko 이미지 로드 실패\n\t * @name FAIL_IMAGE_LOAD\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 12\n\t */\n\tFAIL_IMAGE_LOAD: 12,\n\t/**\n\t * Failed to bind texture\n\t * @ko 텍스쳐 바인딩 실패\n\t * @name FAIL_BIND_TEXTURE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 13\n\t */\n\tFAIL_BIND_TEXTURE: 13,\n\t/**\n\t * Only one resource(image or video) should be specified\n\t * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t * @name INVALID_RESOURCE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 14\n\t */\n\tINVALID_RESOURCE: 14,\n\t/**\n\t * WebGL context lost occurred\n\t * @ko WebGL context lost 발생\n\t * @name RENDERING_CONTEXT_LOST\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 15\n\t */\n\tRENDERING_CONTEXT_LOST: 15,\n};\n\n/**\n * Constant value for events\n * @ko 이벤트에 대한 상수 값\n * @namespace\n * @name EVENTS\n * @memberof eg.view360.PanoViewer\n */\nconst EVENTS = {\n\t/**\n\t * Events that is fired when PanoViewer is ready to show image and handle user interaction.\n\t * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트\n\t * @name READY\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default ready\n\t */\n\tREADY: \"ready\",\n\t/**\n\t * Events that is fired when direction or fov is changed.\n\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t * @name VIEW_CHANGE\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default viewChange\n\t */\n\tVIEW_CHANGE: \"viewChange\",\n\t/**\n\t * Events that is fired when animation which is triggered by inertia is ended.\n\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t * @name ANIMATION_END\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default animationEnd\n\t */\n\tANIMATION_END: \"animationEnd\",\n\t/**\n\t * Events that is fired when error occurs\n\t * @ko 에러 발생 시 발생하는 이벤트\n\t * @name ERROR\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default error\n\t */\n\tERROR: \"error\"\n};\n\n/**\n * Constant value for projection type\n * @ko 프로젝션 타입 대한 상수 값\n * @namespace\n * @name PROJECTION_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst PROJECTION_TYPE = {\n\t/**\n\t * Constant value for equirectangular type.\n\t * @ko equirectangular 에 대한 상수 값.\n\t * @name EQUIRECTANGULAR\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default equirectangular\n\t */\n\tEQUIRECTANGULAR: \"equirectangular\",\n\t/**\n\t * Constant value for cubemap type.\n\t * @ko cubemap 에 대한 상수 값.\n\t * @name CUBEMAP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubemap\n\t */\n\tCUBEMAP: \"cubemap\",\n\t/**\n\t * Constant value for cubestrip type.\n\t * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC.\n\t *\n\t * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다.\n\t * @name CUBESTRIP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubestrip\n\t */\n\tCUBESTRIP: \"cubestrip\",\n\t/**\n\t * Constant value for PANORAMA type.\n\t *\n\t * PANORAMA is a format for a panorma image which is taken from smartphone.\n\t *\n\t * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다.\n\t *\n\t * @name PANORAMA\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default panorama\n\t */\n\tPANORAMA: \"panorama\",\n\t/**\n\t * Constant value for EQUI_STEREOSCOPY type.\n\t *\n\t * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present.\n\t *\n\t * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다.\n\t *\n\t * @name STEREOSCOPIC_EQUI\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default stereoequi\n\t */\n\tSTEREOSCOPIC_EQUI: \"stereoequi\",\n};\n\n/**\n * A constant value for the format of the stereoscopic equirectangular projection type.\n * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값\n * @namespace\n * @name STEREO_FORMAT\n * @memberof eg.view360.PanoViewer\n */\nconst STEREO_FORMAT = {\n\t/**\n\t * A constant value for format of top bottom stereoscopic 360 equirectangular projection.\n\t * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name TOP_BOTTOM\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dv\"\n\t */\n\tTOP_BOTTOM: \"3dv\",\n\t/**\n\t * A constant value for format of left right stereoscopic 360 equirectangular projection.\n\t * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name LEFT_RIGHT\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dh\"\n\t */\n\tLEFT_RIGHT: \"3dh\",\n\t/**\n\t * A constant value specifying media is not in stereoscopic format.\n\t * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값.\n\t * @name NONE\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"\"\n\t */\n\tNONE: \"\",\n};\n\nexport {\n\tGYRO_MODE,\n\tEVENTS,\n\tERROR_TYPE,\n\tPROJECTION_TYPE,\n\tSTEREO_FORMAT\n};\n","import Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {STEREO_FORMAT} from \"../../PanoViewer/consts\";\n\nconst latitudeBands = 60;\nconst longitudeBands = 60;\nconst radius = 2;\nconst ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\nlet latIdx;\nlet lngIdx;\n\nfor (latIdx = 0; latIdx <= latitudeBands; latIdx++) {\n\tconst theta = (latIdx / latitudeBands - 0.5) * Math.PI;\n\tconst sinTheta = Math.sin(theta);\n\tconst cosTheta = Math.cos(theta);\n\n\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\tconst phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN;\n\t\tconst sinPhi = Math.sin(phi);\n\t\tconst cosPhi = Math.cos(phi);\n\t\tconst x = cosPhi * cosTheta;\n\t\tconst y = sinTheta;\n\t\tconst z = sinPhi * cosTheta;\n\t\tconst u = lngIdx / longitudeBands;\n\t\tconst v = latIdx / latitudeBands;\n\n\t\ttextureCoordData.push(u, v);\n\t\tvertexPositionData.push(radius * x, radius * y, radius * z);\n\n\t\tif (lngIdx !== longitudeBands && latIdx !== latitudeBands) {\n\t\t\tconst a = latIdx * (longitudeBands + 1) + lngIdx;\n\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t}\n\t}\n}\n\nclass SphereRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tconstructor(format) {\n\t\tsuper();\n\n\t\tthis._stereoFormat = format;\n\t}\n\n\trender(ctx) {\n\t\tconst {gl, shaderProgram} = ctx;\n\n\t\tlet leftEyeScaleOffset;\n\t\tlet rightEyeScaleOffset;\n\n\t\tswitch (this._stereoFormat) {\n\t\t\tcase STEREO_FORMAT.TOP_BOTTOM:\n\t\t\t\tleftEyeScaleOffset = [1, 0.5, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 0.5, 0, 0.5];\n\t\t\t\tbreak;\n\t\t\tcase STEREO_FORMAT.LEFT_RIGHT:\n\t\t\t\tleftEyeScaleOffset = [0.5, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [0.5, 1, 0.5, 0];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tleftEyeScaleOffset = [1, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 1, 0, 0];\n\t\t}\n\n\t\tconst uTexScaleOffset = gl.getUniformLocation(shaderProgram, \"uTexScaleOffset\");\n\n\t\tgl.uniform4fv(uTexScaleOffset, [...leftEyeScaleOffset, ...rightEyeScaleOffset]);\n\n\t\tsuper.render(ctx);\n\t}\n\n\tgetVertexPositionData() {\n\t\treturn SphereRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn SphereRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn SphereRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n}\n\nexport default SphereRenderer;\n","import {glMatrix} from \"gl-matrix\";\nimport Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\n\n// const latitudeBands = 60;\nconst MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6;\nconst longitudeBands = 60;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\n\nclass CylinderRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tgetVertexPositionData() {\n\t\treturn CylinderRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn CylinderRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn CylinderRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\t\tlet resizeDimension;\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device texture limit(${maxSize}))`);\n\n\t\t\t// Request resizing texture.\n\t\t\t/**\n\t\t\t * TODO: Is it need to apply on another projection type?\n\t\t\t */\n\t\t\tresizeDimension = width > height ?\n\t\t\t\t{width: maxSize, height: maxSize * height / width} :\n\t\t\t\t{width: maxSize * width / height, height: maxSize};\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video or resizing needed\n\t\tthis._initPixelSource(image, resizeDimension);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\tupdateShaderData({imageAspectRatio = MIN_ASPECT_RATIO_FOR_FULL_PANORAMA}) {\n\t\tlet lngIdx;\n\t\tlet cylinderMaxRadian;\n\t\tlet halfCylinderY;\n\t\tlet rotated;\n\t\tlet aspectRatio;\n\n\t\t// Exception case: orientation is rotated.\n\t\tif (imageAspectRatio < 1) {\n\t\t\t/**\n\t\t\t * If rotated is true, we assume that image is rotated counter clockwise.\n\t\t\t * TODO: If there's other rotation, it is need to implement by each rotation.\n\t\t\t */\n\t\t\trotated = true;\n\t\t\taspectRatio = 1 / imageAspectRatio;\n\t\t} else {\n\t\t\trotated = false;\n\t\t\taspectRatio = imageAspectRatio;\n\t\t}\n\n\t\tif (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) {\n\t\t\tconst fov = 360 / aspectRatio;\n\n\t\t\tcylinderMaxRadian = 2 * Math.PI; // 360 deg\n\t\t\thalfCylinderY = Math.tan(glMatrix.toRadian(fov / 2));\n\t\t} else {\n\t\t\tcylinderMaxRadian = aspectRatio;\n\t\t\thalfCylinderY = 0.5;// Range of cylinder is [-0.5, 0.5] to make height to 1.\n\t\t}\n\n\t\t// intialize shader data before update\n\t\ttextureCoordData.length = 0;\n\t\tvertexPositionData.length = 0;\n\t\tindexData.length = 0;\n\n\t\tconst CYLIDER_Y = [-halfCylinderY, halfCylinderY];\n\t\tconst startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360)\n\n\t\t// console.log(\"cylinderMaxRadian:\", glMatrix.toDegree(cylinderMaxRadian), \"CYLIDER_Y\", CYLIDER_Y, \"start angle\", glMatrix.toDegree(startAngleForCenterAlign));\n\t\tfor (let yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength/* bottom & top */; yIdx++) {\n\t\t\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\t\t\tconst angle = startAngleForCenterAlign + (lngIdx / longitudeBands * cylinderMaxRadian);\n\t\t\t\tconst x = Math.cos(angle);\n\t\t\t\tconst y = CYLIDER_Y[yIdx];\n\t\t\t\tconst z = Math.sin(angle);\n\t\t\t\tlet u;\n\t\t\t\tlet v;\n\n\t\t\t\tif (rotated) {\n\t\t\t\t\t// Rotated 90 degree (counter clock wise)\n\t\t\t\t\tu = 1 - yIdx; // yLength - yIdx;\n\t\t\t\t\tv = lngIdx / longitudeBands;\n\t\t\t\t} else {\n\t\t\t\t// \t// Normal case (Not rotated)\n\t\t\t\t\tu = lngIdx / longitudeBands;\n\t\t\t\t\tv = yIdx;\n\t\t\t\t}\n\n\t\t\t\ttextureCoordData.push(u, v);\n\t\t\t\tvertexPositionData.push(x, y, z);\n\n\t\t\t\tif (yIdx === 0 && lngIdx < longitudeBands) {\n\t\t\t\t\tconst a = lngIdx;\n\t\t\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default CylinderRenderer;\n","import {mat4} from \"gl-matrix\";\n\nconst VR_DISPLAY_PRESENT_CHANGE = \"vrdisplaypresentchange\";\nconst DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1];\nconst DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1];\nconst EYES = {\n\tLEFT: \"left\",\n\tRIGHT: \"right\"\n};\n\nclass VRManager {\n\tget context() { return this._vrDisplay; }\n\n\tconstructor() {\n\t\tthis._frameData = new window.VRFrameData();\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst vrDisplay = this._vrDisplay;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (vrDisplay && vrDisplay.isPresenting) {\n\t\t\tvrDisplay.exitPresent();\n\t\t}\n\n\t\tthis._clear();\n\t}\n\n\tcanRender() {\n\t\treturn Boolean(this._vrDisplay);\n\t}\n\n\tbeforeRender(gl) {\n\t\t// Render to the default backbuffer\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t}\n\n\tafterRender() {\n\t\tthis._vrDisplay.submitFrame();\n\t}\n\n\tgetEyeParams(gl) {\n\t\tconst display = this._vrDisplay;\n\t\tconst halfWidth = gl.drawingBufferWidth * 0.5;\n\t\tconst height = gl.drawingBufferHeight;\n\t\tconst frameData = this._frameData;\n\n\t\tdisplay.getFrameData(frameData);\n\n\t\tconst leftMVMatrix = frameData.leftViewMatrix;\n\t\tconst rightMVMatrix = frameData.rightViewMatrix;\n\n\t\tmat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset);\n\t\tmat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tviewport: [0, 0, halfWidth, height],\n\t\t\t\tmvMatrix: leftMVMatrix,\n\t\t\t\tpMatrix: frameData.leftProjectionMatrix,\n\t\t\t},\n\t\t\t{\n\t\t\t\tviewport: [halfWidth, 0, halfWidth, height],\n\t\t\t\tmvMatrix: rightMVMatrix,\n\t\t\t\tpMatrix: frameData.rightProjectionMatrix,\n\t\t\t}\n\t\t];\n\t}\n\n\tisPresenting() {\n\t\treturn Boolean(this._vrDisplay && this._vrDisplay.isPresenting);\n\t}\n\n\taddEndCallback(callback) {\n\t\twindow.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\twindow.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\trequestPresent(canvas) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tnavigator.getVRDisplays().then(displays => {\n\t\t\t\tconst vrDisplay = displays.length && displays[0];\n\n\t\t\t\tif (!vrDisplay) {\n\t\t\t\t\treject(new Error(\"No displays available.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!vrDisplay.capabilities.canPresent) {\n\t\t\t\t\treject(new Error(\"Display lacking capability to present.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvrDisplay.requestPresent([{source: canvas}]).then(() => {\n\t\t\t\t\tconst leftEye = vrDisplay.getEyeParameters(EYES.LEFT);\n\t\t\t\t\tconst rightEye = vrDisplay.getEyeParameters(EYES.RIGHT);\n\n\t\t\t\t\tcanvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;\n\t\t\t\t\tcanvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);\n\n\t\t\t\t\tthis._setDisplay(vrDisplay);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setDisplay(vrDisplay) {\n\t\tthis._vrDisplay = vrDisplay;\n\n\t\tconst layers = vrDisplay.getLayers();\n\n\t\tif (layers.length) {\n\t\t\tconst layer = layers[0];\n\n\t\t\tthis._leftBounds = layer.leftBounds;\n\t\t\tthis._rightBounds = layer.rightBounds;\n\t\t}\n\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._vrDisplay = null;\n\t\tthis._leftBounds = DEFAULT_LEFT_BOUNDS;\n\t\tthis._rightBounds = DEFAULT_RIGHT_BOUNDS;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default VRManager;\n","import {mat4, glMatrix} from \"gl-matrix\";\nimport {IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\n\nconst XR_REFERENCE_SPACE = \"local\";\n\nclass XRManager {\n\tget context() { return this._xrSession; }\n\n\tconstructor() {\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst xrSession = this._xrSession;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (xrSession) {\n\t\t\t// Capture to avoid errors\n\t\t\txrSession.end().then(() => {}, () => {});\n\t\t}\n\t\tthis._clear();\n\t}\n\n\tcanRender(frame) {\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\treturn Boolean(pose);\n\t}\n\n\tbeforeRender(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst baseLayer = session.renderState.baseLayer;\n\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer);\n\t}\n\n\tafterRender() {}\n\n\tgetEyeParams(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\tif (!pose) {\n\t\t\t// Can't render\n\t\t\treturn null;\n\t\t}\n\n\t\tconst glLayer = session.renderState.baseLayer;\n\n\t\treturn pose.views.map(view => {\n\t\t\tconst viewport = glLayer.getViewport(view);\n\t\t\tconst mvMatrix = view.transform.inverse.matrix;\n\n\t\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\t\tmat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180));\n\t\t\t}\n\n\t\t\tmat4.rotateY(mvMatrix, mvMatrix, this._yawOffset);\n\n\t\t\treturn {\n\t\t\t\tviewport: [viewport.x, viewport.y, viewport.width, viewport.height],\n\t\t\t\tmvMatrix,\n\t\t\t\tpMatrix: view.projectionMatrix\n\t\t\t};\n\t\t});\n\t}\n\n\tisPresenting() {\n\t\treturn this._presenting;\n\t}\n\n\taddEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.addEventListener(\"end\", callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.removeEventListener(\"end\", callback);\n\t}\n\n\trequestPresent(canvas, gl) {\n\t\treturn navigator.xr.requestSession(\"immersive-vr\", {\n\t\t\trequiredFeatures: [XR_REFERENCE_SPACE],\n\t\t}).then(session => {\n\t\t\tconst xrLayer = new window.XRWebGLLayer(session, gl);\n\n\t\t\tsession.updateRenderState({baseLayer: xrLayer});\n\t\t\treturn session.requestReferenceSpace(XR_REFERENCE_SPACE)\n\t\t\t\t.then(refSpace => {\n\t\t\t\t\tthis._setSession(session, xrLayer, refSpace);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setSession(session, xrLayer, refSpace) {\n\t\tthis._xrSession = session;\n\t\tthis._xrLayer = xrLayer;\n\t\tthis._xrRefSpace = refSpace;\n\t\tthis._presenting = true;\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._xrSession = null;\n\t\tthis._xrLayer = null;\n\t\tthis._xrRefSpace = null;\n\t\tthis._presenting = false;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default XRManager;\n","import {IS_SAFARI_ON_DESKTOP} from \"../utils/browser\";\n\nclass WebGLAnimator {\n\tconstructor() {\n\t\tthis._callback = null;\n\t\tthis._context = window;\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\tsetCallback(callback) {\n\t\tthis._callback = callback;\n\t}\n\n\tsetContext(context) {\n\t\tthis._context = context;\n\t}\n\n\tstart() {\n\t\tconst context = this._context;\n\t\tconst callback = this._callback;\n\n\t\t// No context / callback set\n\t\tif (!context || !callback) return;\n\t\t// Animation already started\n\t\tif (this._rafId >= 0 || this._rafTimer >= 0) return;\n\n\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoopNextTick);\n\t\t} else {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoop);\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this._rafId >= 0) {\n\t\t\tthis._context.cancelAnimationFrame(this._rafId);\n\t\t}\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t}\n\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\t/**\n\t * There can be more than 1 argument when we use XRSession's raf\n\t */\n\t_onLoop = (...args) => {\n\t\tthis._callback(...args);\n\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t}\n\n\t/**\n\t * MacOS X Safari Bug Fix\n\t * This code guarantees that rendering should be occurred.\n\t *\n\t * In MacOS X(10.14.2), Safari (12.0.2)\n\t * The requestAnimationFrame(RAF) callback is called just after previous RAF callback without term\n\t * only if requestAnimationFrame is called for next frame while updating frame is delayed (~over 2ms)\n\t * So browser cannot render the frame and may be freezing.\n\t */\n\t_onLoopNextTick = (...args) => {\n\t\tconst before = performance.now();\n\n\t\tthis._callback(...args);\n\n\t\tconst diff = performance.now() - before;\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t\tthis._rafTimer = -1;\n\t\t}\n\n\t\t/** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */\n\t\tif (diff < 16) {\n\t\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t\t} else {\n\t\t\t/** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/\n\t\t\tthis._rafTimer = setTimeout(this._onLoop, 0);\n\t\t}\n\t}\n}\n\nexport default WebGLAnimator;\n","import Component from \"@egjs/component\";\nimport {glMatrix, vec3, mat3, mat4, quat} from \"gl-matrix\";\nimport ImageLoader from \"./ImageLoader\";\nimport VideoLoader from \"./VideoLoader\";\nimport WebGLUtils from \"./WebGLUtils\";\nimport Renderer from \"./renderer/Renderer\";\nimport CubeRenderer from \"./renderer/CubeRenderer\";\nimport CubeStripRenderer from \"./renderer/CubeStripRenderer\";\nimport SphereRenderer from \"./renderer/SphereRenderer\";\nimport CylinderRenderer from \"./renderer/CylinderRenderer\";\nimport VRManager from \"./vr/VRManager\";\nimport XRManager from \"./vr/XRManager\";\nimport WebGLAnimator from \"./WebGLAnimator\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {devicePixelRatio, WEBXR_SUPPORTED} from \"../utils/browserFeature\";\nimport {PROJECTION_TYPE, STEREO_FORMAT} from \"../PanoViewer/consts\";\nimport {IS_IOS} from \"../utils/browser\";\n\nconst ImageType = PROJECTION_TYPE;\n\nlet DEVICE_PIXEL_RATIO = devicePixelRatio || 1;\n\n// DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다.\nif (DEVICE_PIXEL_RATIO > 2) {\n\tDEVICE_PIXEL_RATIO = 2;\n}\n\n// define custom events name\n/**\n * TODO: how to manage events/errortype with PanoViewer\n *\n * I think renderer events should be seperated from viewer events although it has same name.\n */\nconst EVENTS = {\n\tBIND_TEXTURE: \"bindTexture\",\n\tIMAGE_LOADED: \"imageLoaded\",\n\tERROR: \"error\",\n\tRENDERING_CONTEXT_LOST: \"renderingContextLost\",\n\tRENDERING_CONTEXT_RESTORE: \"renderingContextRestore\",\n};\n\nconst ERROR_TYPE = {\n\tINVALID_DEVICE: 10,\n\tNO_WEBGL: 11,\n\tFAIL_IMAGE_LOAD: 12,\n\tRENDERER_ERROR: 13\n};\n\nclass PanoImageRenderer extends Component {\n\tstatic EVENTS = EVENTS;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\n\tconstructor(\n\t\timage, width, height, isVideo, sphericalConfig, renderingContextAttributes\n\t) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis.sphericalConfig = sphericalConfig;\n\t\tthis.fieldOfView = sphericalConfig.fieldOfView;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tthis._lastQuaternion = null;\n\t\tthis._lastYaw = null;\n\t\tthis._lastPitch = null;\n\t\tthis._lastFieldOfView = null;\n\n\t\tthis.pMatrix = mat4.create();\n\t\tthis.mvMatrix = mat4.create();\n\n\t\t// initialzie pMatrix\n\t\tmat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), width / height, 0.1, 100);\n\n\t\tthis.textureCoordBuffer = null;\n\t\tthis.vertexBuffer = null;\n\t\tthis.indexBuffer = null;\n\n\t\tthis.canvas = this._initCanvas(width, height);\n\t\tthis._setDefaultCanvasStyle();\n\t\tthis._wrapper = null; // canvas wrapper\n\t\tthis._wrapperOrigStyle = null;\n\n\t\tthis._renderingContextAttributes = renderingContextAttributes;\n\t\tthis._image = null;\n\t\tthis._imageConfig = null;\n\t\tthis._imageIsReady = false;\n\t\tthis._shouldForceDraw = false;\n\t\tthis._keepUpdate = false; // Flag to specify 'continuous update' on video even when still.\n\n\t\tthis._onContentLoad = this._onContentLoad.bind(this);\n\t\tthis._onContentError = \tthis._onContentError.bind(this);\n\n\t\tthis._animator = new WebGLAnimator();\n\n\t\t// VR/XR manager\n\t\tthis._vr = null;\n\n\t\tif (image) {\n\t\t\tthis.setImage({\n\t\t\t\timage,\n\t\t\t\timageType: sphericalConfig.imageType,\n\t\t\t\tisVideo,\n\t\t\t\tcubemapConfig: sphericalConfig.cubemapConfig\n\t\t\t});\n\t\t}\n\t}\n\n\t// FIXME: Please refactor me to have more loose connection to yawpitchcontrol\n\tsetYawPitchControl(yawPitchControl) {\n\t\tthis._yawPitchControl = yawPitchControl;\n\t}\n\n\tgetContent() {\n\t\treturn this._image;\n\t}\n\n\tsetImage({image, imageType, isVideo = false, cubemapConfig}) {\n\t\tthis._imageIsReady = false;\n\t\tthis._isVideo = isVideo;\n\t\tthis._imageConfig = Object.assign(\n\t\t\t{\n\t\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only */\n\t\t\t\torder: (imageType === ImageType.CUBEMAP) ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\t\ttileConfig: {\n\t\t\t\t\tflipHorizontal: false,\n\t\t\t\t\trotation: 0\n\t\t\t\t}\n\t\t\t},\n\t\t\tcubemapConfig\n\t\t);\n\t\tthis._setImageType(imageType);\n\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tif (isVideo) {\n\t\t\tthis._contentLoader = new VideoLoader();\n\t\t\tthis._keepUpdate = true;\n\t\t} else {\n\t\t\tthis._contentLoader = new ImageLoader();\n\t\t\tthis._keepUpdate = false;\n\t\t}\n\n\t\t// img element or img url\n\t\tthis._contentLoader.set(image);\n\n\t\t// 이미지의 사이즈를 캐시한다.\n\t\t// image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed.\n\t\tthis._image = this._contentLoader.getElement();\n\n\t\treturn this._contentLoader.get()\n\t\t\t.then(this._onContentLoad, this._onContentError)\n\t\t\t.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.\n\t}\n\n\t_setImageType(imageType) {\n\t\tif (!imageType || this._imageType === imageType) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._imageType = imageType;\n\t\tthis._isCubeMap = imageType === ImageType.CUBEMAP;\n\n\t\tif (this._renderer) {\n\t\t\tthis._renderer.off();\n\t\t}\n\n\t\tswitch (imageType) {\n\t\t\tcase ImageType.CUBEMAP:\n\t\t\t\tthis._renderer = new CubeRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.CUBESTRIP:\n\t\t\t\tthis._renderer = new CubeStripRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.PANORAMA:\n\t\t\t\tthis._renderer = new CylinderRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.STEREOSCOPIC_EQUI:\n\t\t\t\tthis._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis._renderer = new SphereRenderer(STEREO_FORMAT.NONE);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis._renderer.on(Renderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERER_ERROR,\n\t\t\t\tmessage: e.message\n\t\t\t});\n\t\t});\n\n\t\tthis._initWebGL();\n\t}\n\n\t_initCanvas(width, height) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\n\t\tthis._onWebglcontextlost = this._onWebglcontextlost.bind(this);\n\t\tthis._onWebglcontextrestored = this._onWebglcontextrestored.bind(this);\n\n\t\tcanvas.addEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tcanvas.addEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\n\t\treturn canvas;\n\t}\n\n\t_setDefaultCanvasStyle() {\n\t\tconst canvas = this.canvas;\n\n\t\tcanvas.style.bottom = 0;\n\t\tcanvas.style.left = 0;\n\t\tcanvas.style.right = 0;\n\t\tcanvas.style.top = 0;\n\t\tcanvas.style.margin = \"auto\";\n\t\tcanvas.style.maxHeight = \"100%\";\n\t\tcanvas.style.maxWidth = \"100%\";\n\t\tcanvas.style.outline = \"none\";\n\t\tcanvas.style.position = \"absolute\";\n\t}\n\n\t_onContentError(error) {\n\t\tthis._imageIsReady = false;\n\t\tthis._image = null;\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\ttype: ERROR_TYPE.FAIL_IMAGE_LOAD,\n\t\t\tmessage: \"failed to load image\"\n\t\t});\n\n\t\treturn false;\n\t}\n\n\t_triggerContentLoad() {\n\t\tthis.trigger(EVENTS.IMAGE_LOADED, {\n\t\t\tcontent: this._image,\n\t\t\tisVideo: this._isVideo,\n\t\t\tprojectionType: this._imageType\n\t\t});\n\t}\n\t_onContentLoad(image) {\n\t\tthis._imageIsReady = true;\n\n\t\tthis._triggerContentLoad();\n\t\treturn true;\n\t}\n\n\tisImageLoaded() {\n\t\treturn !!this._image && this._imageIsReady &&\n\t\t\t(!this._isVideo || this._image.readyState >= 2 /* HAVE_CURRENT_DATA */);\n\t}\n\n\tbindTexture() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._contentLoader) {\n\t\t\t\trej(\"ImageLoader is not initialized\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._contentLoader.get()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis._bindTexture();\n\t\t\t\t}, rej)\n\t\t\t\t.then(res);\n\t\t});\n\t}\n\n\t// 부모 엘리먼트에 canvas 를 붙임\n\tattachTo(parentElement) {\n\t\tthis.detach();\n\t\tparentElement.appendChild(this.canvas);\n\t\tthis._wrapper = parentElement;\n\t}\n\n\tforceContextLoss() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\tconst loseContextExtension = this.context.getExtension(\"WEBGL_lose_context\");\n\n\t\t\tif (loseContextExtension) {\n\t\t\t\tloseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t}\n\n\t// 부모 엘리먼트에서 canvas 를 제거\n\tdetach() {\n\t\tif (this.canvas.parentElement) {\n\t\t\tthis.canvas.parentElement.removeChild(this.canvas);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tthis._animator.stop();\n\t\tthis.detach();\n\t\tthis.forceContextLoss();\n\n\t\tthis.off();\n\n\t\tthis.canvas.removeEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tthis.canvas.removeEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\t}\n\n\thasRenderingContext() {\n\t\tif (!(this.context && !this.context.isContextLost())) {\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tthis.context &&\n\t\t\t!this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t_initShaderProgram() {\n\t\tconst gl = this.context;\n\n\t\tif (this.shaderProgram) {\n\t\t\tgl.deleteProgram(this.shaderProgram);\n\t\t\tthis.shaderProgram = null;\n\t\t}\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst vsSource = renderer.getVertexShaderSource();\n\t\tconst fsSource = renderer.getFragmentShaderSource();\n\n\t\tconst vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource);\n\t\tconst fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource);\n\n\t\tconst shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader);\n\n\t\tif (!shaderProgram) {\n\t\t\tthrow new Error(`Failed to intialize shaders: ${WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())}`);\n\t\t}\n\n\t\tgl.useProgram(shaderProgram);\n\t\tshaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\");\n\t\tgl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);\n\t\tshaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, \"uPMatrix\");\n\t\tshaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, \"uMVMatrix\");\n\t\tshaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, \"uSampler\");\n\t\tshaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, \"aTextureCoord\");\n\t\tshaderProgram.uEye = gl.getUniformLocation(shaderProgram, \"uEye\");\n\n\t\tgl.enableVertexAttribArray(shaderProgram.textureCoordAttribute);\n\n\t\t// clear buffer\n\t\tgl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n\t\t// Use TEXTURE0\n\t\tgl.uniform1i(shaderProgram.samplerUniform, 0);\n\n\t\tthis.shaderProgram = shaderProgram;\n\t}\n\n\t_onWebglcontextlost(e) {\n\t\te.preventDefault();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_LOST);\n\t}\n\n\t_onWebglcontextrestored(e) {\n\t\tthis._initWebGL();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_RESTORE);\n\t}\n\n\tupdateFieldOfView(fieldOfView) {\n\t\tthis.fieldOfView = fieldOfView;\n\t\tthis._updateViewport();\n\t}\n\n\tupdateViewportDimensions(width, height) {\n\t\tlet viewPortChanged = false;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tconst w = width * DEVICE_PIXEL_RATIO;\n\t\tconst h = height * DEVICE_PIXEL_RATIO;\n\n\t\tif (w !== this.canvas.width) {\n\t\t\tthis.canvas.width = w;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (h !== this.canvas.height) {\n\t\t\tthis.canvas.height = h;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (!viewPortChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._updateViewport();\n\t\tthis._shouldForceDraw = true;\n\t}\n\n\t_updateViewport() {\n\t\tmat4.perspective(\n\t\t\tthis.pMatrix,\n\t\t\tglMatrix.toRadian(this.fieldOfView),\n\t\t\tthis.canvas.width / this.canvas.height,\n\t\t\t0.1,\n\t\t\t100);\n\n\t\tthis.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight);\n\t}\n\n\t_initWebGL() {\n\t\tlet gl;\n\n\t\t// TODO: Following code does need to be executed only if width/height, cubicStrip property is changed.\n\t\ttry {\n\t\t\tthis._initRenderingContext();\n\t\t\tgl = this.context;\n\n\t\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\t\tthis._initShaderProgram();\n\t\t} catch (e) {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\tmessage: \"no webgl support\"\n\t\t\t});\n\t\t\tthis.destroy();\n\t\t\tconsole.error(e); // eslint-disable-line no-console\n\t\t\treturn;\n\t\t}\n\t\t// 캔버스를 투명으로 채운다.\n\t\tgl.clearColor(0, 0, 0, 0);\n\t\tconst textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n\n\t\tif (this.texture) {\n\t\t\tgl.deleteTexture(this.texture);\n\t\t}\n\n\t\tthis.texture = WebGLUtils.createTexture(gl, textureTarget);\n\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\t// TODO: Apply following options on other projection type.\n\t\t\tgl.enable(gl.CULL_FACE);\n\t\t\t// gl.enable(gl.DEPTH_TEST);\n\t\t}\n\t}\n\n\t_initRenderingContext() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!window.WebGLRenderingContext) {\n\t\t\tthrow new Error(\"WebGLRenderingContext not available.\");\n\t\t}\n\n\t\tthis.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes);\n\n\t\tif (!this.context) {\n\t\t\tthrow new Error(\"Failed to acquire 3D rendering context\");\n\t\t}\n\t}\n\n\t_initBuffers() {\n\t\tconst vertexPositionData = this._renderer.getVertexPositionData();\n\t\tconst indexData = this._renderer.getIndexData();\n\t\tconst textureCoordData = this._renderer.getTextureCoordData(this._imageConfig);\n\t\tconst gl = this.context;\n\n\t\tthis.vertexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3,\n\t\t\tthis.shaderProgram.vertexPositionAttribute);\n\n\t\tthis.indexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1);\n\n\t\tthis.textureCoordBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2,\n\t\t\tthis.shaderProgram.textureCoordAttribute);\n\n\t\tthis._bindBuffers();\n\t}\n\n\t_bindTexture() {\n\t\t// Detect if it is EAC Format while CUBESTRIP mode.\n\t\t// We assume it is EAC if image is not 3/2 ratio.\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst isEAC = width && height && width / height !== 1.5;\n\n\t\t\tthis.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, \"uIsEAC\"), isEAC);\n\t\t} else if (this._imageType === ImageType.PANORAMA) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst imageAspectRatio = width && height && width / height;\n\n\t\t\tthis._renderer.updateShaderData({imageAspectRatio});\n\t\t}\n\n\t\t// intialize shader buffers after image is loaded.(by updateShaderData)\n\t\t// because buffer may be differ by image size.(eg. CylinderRenderer)\n\t\tthis._initBuffers();\n\n\t\tthis._renderer.bindTexture(\n\t\t\tthis.context,\n\t\t\tthis.texture,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t\tthis._shouldForceDraw = true;\n\n\t\tthis.trigger(EVENTS.BIND_TEXTURE);\n\t}\n\n\t_updateTexture() {\n\t\tthis._renderer.updateTexture(\n\t\t\tthis.context,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t}\n\n\tkeepUpdate(doUpdate) {\n\t\tif (doUpdate && this.isImageLoaded() === false) {\n\t\t\t// Force to draw a frame after image is loaded on render()\n\t\t\tthis._shouldForceDraw = true;\n\t\t}\n\n\t\tthis._keepUpdate = doUpdate;\n\t}\n\n\tstartRender() {\n\t\tthis._animator.setCallback(this._render.bind(this));\n\t\tthis._animator.start();\n\t}\n\n\tstopRender() {\n\t\tthis._animator.stop();\n\t}\n\n\trenderWithQuaternion(quaternion, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\tthis._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) &&\n\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// updatefieldOfView only if fieldOfView is changed.\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tthis.mvMatrix = mat4.fromQuat(mat4.create(), quaternion);\n\n\t\tthis._draw();\n\n\t\tthis._lastQuaternion = quat.clone(quaternion);\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\trenderWithYawPitch(yaw, pitch, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\t\tthis._lastYaw !== null && this._lastYaw === yaw &&\n\t\t\t\tthis._lastPitch !== null && this._lastPitch === pitch &&\n\t\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch));\n\t\tmat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw));\n\n\t\tthis._draw();\n\n\t\tthis._lastYaw = yaw;\n\t\tthis._lastPitch = pitch;\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\t_render() {\n\t\tconst yawPitchControl = this._yawPitchControl;\n\t\tconst fov = yawPitchControl.getFov();\n\n\t\tif (yawPitchControl.shouldRenderWithQuaternion()) {\n\t\t\tconst quaternion = yawPitchControl.getQuaternion();\n\n\t\t\tthis.renderWithQuaternion(quaternion, fov);\n\t\t} else {\n\t\t\tconst yawPitch = yawPitchControl.getYawPitch();\n\n\t\t\tthis.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov);\n\t\t}\n\t}\n\n\t_renderStereo = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\n\t\tconst eyeParams = vr.getEyeParams(gl, frame);\n\n\t\tif (!eyeParams) return;\n\n\t\tvr.beforeRender(gl, frame);\n\n\t\t// Render both eyes\n\t\tfor (const eyeIndex of [0, 1]) {\n\t\t\tconst eyeParam = eyeParams[eyeIndex];\n\n\t\t\tthis.mvMatrix = eyeParam.mvMatrix;\n\t\t\tthis.pMatrix = eyeParam.pMatrix;\n\n\t\t\tgl.viewport(...eyeParam.viewport);\n\t\t\tgl.uniform1f(this.shaderProgram.uEye, eyeIndex);\n\n\t\t\tthis._bindBuffers();\n\t\t\tthis._draw();\n\t\t}\n\n\t\tvr.afterRender();\n\t}\n\n\t_bindBuffers() {\n\t\tconst gl = this.context;\n\t\tconst program = this.shaderProgram;\n\n\t\tconst vertexBuffer = this.vertexBuffer;\n\t\tconst textureCoordBuffer = this.textureCoordBuffer;\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\t\tgl.enableVertexAttribArray(program.vertexPositionAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\n\t\tgl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\t\tgl.enableVertexAttribArray(program.textureCoordAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\t}\n\n\t_draw() {\n\t\tif (this._isVideo && this._keepUpdate) {\n\t\t\tthis._updateTexture();\n\t\t}\n\n\t\tthis._renderer.render({\n\t\t\tgl: this.context,\n\t\t\tshaderProgram: this.shaderProgram,\n\t\t\tindexBuffer: this.indexBuffer,\n\t\t\tmvMatrix: this.mvMatrix,\n\t\t\tpMatrix: this.pMatrix,\n\t\t});\n\t}\n\n\t/**\n\t * Returns projection renderer by each type\n\t */\n\tgetProjectionRenderer() {\n\t\treturn this._renderer;\n\t}\n\n\t/**\n\t * @return Promise\n\t */\n\tenterVR() {\n\t\tconst vr = this._vr;\n\n\t\tif (!WEBXR_SUPPORTED && !navigator.getVRDisplays) {\n\t\t\treturn Promise.reject(\"VR is not available on this browser.\");\n\t\t}\n\t\tif (vr && vr.isPresenting()) {\n\t\t\treturn Promise.resolve(\"VR already enabled.\");\n\t\t}\n\n\t\treturn this._requestPresent();\n\t}\n\n\texitVR = () => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\tif (!vr) return;\n\n\t\tvr.removeEndCallback(this.exitVR);\n\t\tvr.destroy();\n\t\tthis._vr = null;\n\n\t\t// Restore canvas & context on iOS\n\t\tif (IS_IOS) {\n\t\t\tthis._restoreStyle();\n\t\t}\n\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\tthis._updateViewport();\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t\tthis._bindBuffers();\n\t\tthis._shouldForceDraw = true;\n\n\t\tanimator.stop();\n\t\tanimator.setContext(window);\n\t\tanimator.setCallback(this._render.bind(this));\n\t\tanimator.start();\n\t}\n\n\t_requestPresent() {\n\t\tconst gl = this.context;\n\t\tconst canvas = this.canvas;\n\t\tconst animator = this._animator;\n\n\t\tthis._vr = WEBXR_SUPPORTED ?\n\t\t\tnew XRManager() :\n\t\t\tnew VRManager();\n\n\t\tconst vr = this._vr;\n\n\t\tanimator.stop();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvr.requestPresent(canvas, gl)\n\t\t\t\t.then(() => {\n\t\t\t\t\tvr.addEndCallback(this.exitVR);\n\t\t\t\t\tanimator.setContext(vr.context);\n\t\t\t\t\tanimator.setCallback(this._onFirstVRFrame);\n\n\t\t\t\t\tif (IS_IOS) {\n\t\t\t\t\t\tthis._setWrapperFullscreen();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shouldForceDraw = true;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\tresolve(\"success\");\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tvr.destroy();\n\t\t\t\t\tthis._vr = null;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t});\n\t}\n\n\t_onFirstVRFrame = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\t// If rendering is not ready, wait for next frame\n\t\tif (!vr.canRender(frame)) return;\n\n\t\tconst minusZDir = vec3.fromValues(0, 0, -1);\n\t\tconst eyeParam = vr.getEyeParams(gl, frame)[0];\n\t\t// Extract only rotation\n\t\tconst mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix);\n\t\tconst pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix);\n\n\t\tconst mvInv = mat3.invert(mat3.create(), mvMatrix);\n\t\tconst pInv = mat3.invert(mat3.create(), pMatrix);\n\t\tconst viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv);\n\n\t\tvec3.transformMat3(viewDir, viewDir, mvInv);\n\n\t\tconst yawOffset = mathUtil.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1));\n\n\t\tif (yawOffset === 0) {\n\t\t\t// If the yawOffset is exactly 0, then device sensor is not ready\n\t\t\t// So read it again until it has any value in it\n\t\t\treturn;\n\t\t}\n\n\t\tvr.setYawOffset(yawOffset);\n\t\tanimator.setCallback(this._renderStereo);\n\t}\n\n\t_setWrapperFullscreen() {\n\t\tconst wrapper = this._wrapper;\n\n\t\tif (!wrapper) return;\n\n\t\tthis._wrapperOrigStyle = wrapper.getAttribute(\"style\");\n\t\tconst wrapperStyle = wrapper.style;\n\n\t\twrapperStyle.width = \"100vw\";\n\t\twrapperStyle.height = \"100vh\";\n\t\twrapperStyle.position = \"fixed\";\n\t\twrapperStyle.left = \"0\";\n\t\twrapperStyle.top = \"0\";\n\t\twrapperStyle.zIndex = \"9999\";\n\t}\n\n\t_restoreStyle() {\n\t\tconst wrapper = this._wrapper;\n\t\tconst canvas = this.canvas;\n\n\t\tif (!wrapper) return;\n\n\t\tif (this._wrapperOrigStyle) {\n\t\t\twrapper.setAttribute(\"style\", this._wrapperOrigStyle);\n\t\t} else {\n\t\t\twrapper.removeAttribute(\"style\");\n\t\t}\n\n\t\tthis._wrapperOrigStyle = null;\n\n\t\t// Restore canvas style\n\t\tcanvas.removeAttribute(\"style\");\n\t\tthis._setDefaultCanvasStyle();\n\t}\n}\n\nexport default PanoImageRenderer;\n","import Component from \"@egjs/component\";\nimport {glMatrix} from \"gl-matrix\";\nimport {\n\tDeviceMotionEvent, checkXRSupport\n} from \"../utils/browserFeature\";\n\nimport YawPitchControl from \"../YawPitchControl/YawPitchControl\";\nimport PanoImageRenderer from \"../PanoImageRenderer/PanoImageRenderer\";\nimport WebGLUtils from \"../PanoImageRenderer/WebGLUtils\";\nimport {ERROR_TYPE, EVENTS, GYRO_MODE, PROJECTION_TYPE, STEREO_FORMAT} from \"./consts\";\nimport {util as mathUtil} from \"../utils/math-util.js\";\nimport {VERSION} from \"../version\";\n\nclass PanoViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.PanoViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic VERSION = VERSION;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\tstatic EVENTS = EVENTS;\n\tstatic PROJECTION_TYPE = PROJECTION_TYPE;\n\tstatic GYRO_MODE = GYRO_MODE;\n\t// It should be deprecated!\n\tstatic ProjectionType = PROJECTION_TYPE;\n\tstatic STEREO_FORMAT = STEREO_FORMAT;\n\t/**\n\t * Constant value for touch directions\n\t * @ko 터치 방향에 대한 상수 값.\n\t * @namespace\n\t * @name TOUCH_DIRECTION\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic TOUCH_DIRECTION = {\n\t\t/**\n\t\t * Constant value for none direction.\n\t\t * @ko none 방향에 대한 상수 값.\n\t\t * @name NONE\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 1\n\t\t */\n\t\tNONE: YawPitchControl.TOUCH_DIRECTION_NONE,\n\t\t/**\n\t\t * Constant value for horizontal(yaw) direction.\n\t\t * @ko horizontal(yaw) 방향에 대한 상수 값.\n\t\t * @name YAW\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 6\n\t\t */\n\t\tYAW: YawPitchControl.TOUCH_DIRECTION_YAW,\n\t\t/**\n\t\t * Constant value for vertical direction.\n\t\t * @ko vertical(pitch) 방향에 대한 상수 값.\n\t\t * @name PITCH\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 24\n\t\t */\n\t\tPITCH: YawPitchControl.TOUCH_DIRECTION_PITCH,\n\t\t/**\n\t\t * Constant value for all direction.\n\t\t * @ko all 방향에 대한 상수 값.\n\t\t * @name ALL\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 30\n\t\t */\n\t\tALL: YawPitchControl.TOUCH_DIRECTION_ALL\n\t};\n\n\t/**\n\t * @classdesc 360 media viewer\n\t * @ko 360 미디어 뷰어\n\t * @class\n\t * @name eg.view360.PanoViewer\n\t * @extends eg.Component\n\t *\n\t * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트\n\t * @param {Object} config\n\t *\n\t * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
\n\t * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.\n\t * @param {Object} [config.cubemapConfig.order = \"RLUDBF\"(ProjectionType === CUBEMAP) | \"RLUDFB\" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서\n\t * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.\n\t * @param {String} [config.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
\n\t * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위)\n\t * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위)\n\t *\n\t * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위)\n\t * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위)\n\t * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위)\n\t * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다\n\t * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다.\n\t * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE}
\n\t * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위\n\t * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위\n\t * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위\n\t * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
\n\t *\n\t * @example\n\t * // PanoViewer Creation\n\t * // create PanoViewer with option\n\t * var PanoViewer = eg.view360.PanoViewer;\n\t * // Area where the image will be displayed(HTMLElement)\n\t * var container = document.getElementById(\"myPanoViewer\");\n\t *\n\t * var panoViewer = new PanoViewer(container, {\n\t * // If projectionType is not specified, the default is \"equirectangular\".\n\t * // Specifies an image of the \"equirectangular\" type.\n\t * image: \"/path/to/image/image.jpg\"\n\t *});\n\t *\n\t * @example\n\t * // Cubemap Config Setting Example\n\t * // For support Youtube EAC projection, You should set cubemapConfig as follows.\n\t * cubemapConfig: {\n\t * \torder: \"LFRDBU\",\n\t * \ttileConfig: [\n\t * \t\ttileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}]\n\t * \t]\n\t * }\n\t */\n\tconstructor(container, options = {}) {\n\t\tsuper();\n\n\t\t// Raises the error event if webgl is not supported.\n\t\tif (!WebGLUtils.isWebGLAvailable()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\t\tmessage: \"no webgl support\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!WebGLUtils.isStableWebGL()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_DEVICE,\n\t\t\t\t\tmessage: \"blacklisted browser\"\n\t\t\t\t});\n\t\t\t}, 0);\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!!options.image && !!options.video) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_RESOURCE,\n\t\t\t\t\tmessage: \"Specifying multi resouces(both image and video) is not valid.\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\t// Check XR support at not when imported, but when created.\n\t\t// This is intended to make polyfills easier to use.\n\t\tcheckXRSupport();\n\n\t\tthis._container = container;\n\t\tthis._image = options.image || options.video;\n\t\tthis._isVideo = !!options.video;\n\t\tthis._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\tthis._cubemapConfig = Object.assign({\n\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/\n\t\t\torder: this._projectionType === PROJECTION_TYPE.CUBEMAP ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, options.cubemapConfig);\n\t\tthis._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\n\t\t// If the width and height are not provided, will use the size of the container.\n\t\tthis._width = options.width || parseInt(window.getComputedStyle(container).width, 10);\n\t\tthis._height = options.height || parseInt(window.getComputedStyle(container).height, 10);\n\n\t\t/**\n\t\t * Cache the direction for the performance in renderLoop\n\t\t *\n\t\t * This value should be updated by \"change\" event of YawPitchControl.\n\t\t */\n\t\tthis._yaw = options.yaw || 0;\n\t\tthis._pitch = options.pitch || 0;\n\t\tthis._fov = options.fov || 65;\n\n\t\tthis._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH;\n\t\tthis._quaternion = null;\n\n\t\tthis._aspectRatio = this._height !== 0 ? this._width / this._height : 1;\n\t\tconst fovRange = options.fovRange || [30, 110];\n\t\tconst touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ?\n\t\t\toptions.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL;\n\t\tconst yawPitchConfig = Object.assign(options, {\n\t\t\telement: container,\n\t\t\tyaw: this._yaw,\n\t\t\tpitch: this._pitch,\n\t\t\tfov: this._fov,\n\t\t\tgyroMode: this._gyroMode,\n\t\t\tfovRange,\n\t\t\taspectRatio: this._aspectRatio,\n\t\t\ttouchDirection\n\t\t});\n\n\t\tthis._isReady = false;\n\n\t\tthis._initYawPitchControl(yawPitchConfig);\n\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t}\n\n\t/**\n\t * Get the video element that the viewer is currently playing. You can use this for playback.\n\t * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다.\n\t * @method eg.view360.PanoViewer#getVideo\n\t * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement\n\t * @example\n\t * var videoTag = panoViewer.getVideo();\n\t * videoTag.play(); // play video!\n\t */\n\tgetVideo() {\n\t\tif (!this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the video information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setVideo\n\t * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정)\n\t * @param {Object} param\n\t * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}(\"equirectangular\")] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setVideo(\"/path/to/video/video.mp4\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR\n\t * });\n\t */\n\tsetVideo(video, param = {}) {\n\t\tif (video) {\n\t\t\tthis.setImage(video, {\n\t\t\t\tprojectionType: param.projectionType,\n\t\t\t\tisVideo: true,\n\t\t\t\tcubemapConfig: param.cubemapConfig,\n\t\t\t\tstereoFormat: param.stereoFormat\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the image information that the viewer is currently using.\n\t * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다.\n\t * @method eg.view360.PanoViewer#getImage\n\t * @return {Image} Image Object이미지 객체\n\t * @example\n\t * var imageObj = panoViewer.getImage();\n\t */\n\tgetImage() {\n\t\tif (this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the image information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setImage\n\t * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.)\n\t * @param {Object} param Additional information이미지 추가 정보\n\t * @param {String} [param.projectionType=\"equirectangular\"] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setImage(\"/path/to/image/image.png\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP\n\t * });\n\t */\n\tsetImage(image, param = {}) {\n\t\tconst cubemapConfig = Object.assign({\n\t\t\torder: \"RLUDBF\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, param.cubemapConfig);\n\t\tconst stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\t\tconst isVideo = !!(param.isVideo);\n\n\t\tif (this._image && this._isVideo !== isVideo) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.warn(\"Currently not supporting to change content type(Image <--> Video)\");\n\t\t\t/* eslint-enable no-console */\n\t\t\treturn this;\n\t\t}\n\n\t\tif (image) {\n\t\t\tthis._image = image;\n\t\t\tthis._isVideo = isVideo;\n\t\t\tthis._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\t\tthis._cubemapConfig = cubemapConfig;\n\t\t\tthis._stereoFormat = stereoFormat;\n\n\t\t\tthis._deactivate();\n\t\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set whether the renderer always updates the texture and renders.\n\t * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다.\n\t *\n\t * @method eg.view360.PanoViewer#keepUpdate\n\t * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다.\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tkeepUpdate(doUpdate) {\n\t\tthis._photoSphereRenderer.keepUpdate(doUpdate);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get projection type (equirectangular/cube)\n\t * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#getProjectionType\n\t * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE}\n\t */\n\tgetProjectionType() {\n\t\treturn this._projectionType;\n\t}\n\n\t/**\n\t * Activate the device's motion sensor, and return the Promise whether the sensor is enabled\n\t * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element.\n\t * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다.\n\t * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * @method eg.view360.PanoViewer#enableSensor\n\t * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다.\n\t */\n\tenableSensor() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\") {\n\t\t\t\tDeviceMotionEvent.requestPermission().then(permissionState => {\n\t\t\t\t\tif (permissionState === \"granted\") {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(new Error(\"permission denied\"));\n\t\t\t\t\t}\n\t\t\t\t}).catch(e => {\n\t\t\t\t\t// This can happen when this method wasn't triggered by user interaction\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disable the device's motion sensor.\n\t * @ko 디바이스의 모션 센서를 비활성화합니다.\n\t * @deprecated\n\t * @method eg.view360.PanoViewer#disableSensor\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdisableSensor() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred).\n\t * This method must be used in the context of user interaction, like onclick callback on the button element.\n\t * It can be rejected when an enabling device sensor fails or image/video is still loading(\"ready\" event not triggered).\n\t * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다)\n\t * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우(\"ready\"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다.\n\t * @method eg.view360.PanoViewer#enterVR\n\t * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error)\n\t */\n\tenterVR() {\n\t\tif (!this._isReady) {\n\t\t\treturn Promise.reject(new Error(\"PanoViewer is not ready to show image.\"));\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.enableSensor()\n\t\t\t\t.then(() => this._photoSphereRenderer.enterVR())\n\t\t\t\t.then(res => resolve(res))\n\t\t\t\t.catch(e => reject(e));\n\t\t});\n\t}\n\n\t/**\n\t * Exit VR stereo rendering mode.\n\t * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#exitVR\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\texitVR() {\n\t\tthis._photoSphereRenderer.exitVR();\n\t\treturn this;\n\t}\n\n\t// TODO: Remove parameters as they're just using private values\n\t_initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) {\n\t\tthis._photoSphereRenderer = new PanoImageRenderer(\n\t\t\tthis._image,\n\t\t\tthis._width,\n\t\t\tthis._height,\n\t\t\tthis._isVideo,\n\t\t\t{\n\t\t\t\tinitialYaw: yaw,\n\t\t\t\tinitialPitch: pitch,\n\t\t\t\tfieldOfView: fov,\n\t\t\t\timageType: projectionType,\n\t\t\t\tcubemapConfig,\n\t\t\t\tstereoFormat: this._stereoFormat\n\t\t\t},\n\t\t);\n\t\tthis._photoSphereRenderer.setYawPitchControl(this._yawPitchControl);\n\n\t\tthis._bindRendererHandler();\n\n\t\tthis._photoSphereRenderer\n\t\t\t.bindTexture()\n\t\t\t.then(() => this._activate())\n\t\t\t.catch(() => {\n\t\t\t\tthis._triggerEvent(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.FAIL_BIND_TEXTURE,\n\t\t\t\t\tmessage: \"failed to bind texture\"\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * update values of YawPitchControl if needed.\n\t * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image.\n\t *\n\t * This function should be called after isReady status is true.\n\t */\n\t_updateYawPitchIfNeeded() {\n\t\tif (this._projectionType === PanoViewer.ProjectionType.PANORAMA) {\n\t\t\t// update fov by aspect ratio\n\t\t\tconst image = this._photoSphereRenderer.getContent();\n\t\t\tlet imageAspectRatio = image.naturalWidth / image.naturalHeight;\n\t\t\tlet isCircular;\n\t\t\tlet yawSize;\n\t\t\tlet maxFov;\n\n\t\t\t// If height is larger than width, then we assume it's rotated by 90 degree.\n\t\t\tif (imageAspectRatio < 1) {\n\t\t\t\t// So inverse the aspect ratio.\n\t\t\t\timageAspectRatio = 1 / imageAspectRatio;\n\t\t\t}\n\n\t\t\tif (imageAspectRatio < 6) {\n\t\t\t\tyawSize = mathUtil.toDegree(imageAspectRatio);\n\t\t\t\tisCircular = false;\n\t\t\t\t// 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5\n\t\t\t\tmaxFov = mathUtil.toDegree(Math.atan(0.5)) * 2;\n\t\t\t} else {\n\t\t\t\tyawSize = 360;\n\t\t\t\tisCircular = true;\n\t\t\t\tmaxFov = (360 / imageAspectRatio); // Make it 5 fixed as axes does.\n\t\t\t}\n\n\t\t\t// console.log(\"_updateYawPitchIfNeeded\", maxFov, \"aspectRatio\", image.naturalWidth, image.naturalHeight, \"yawSize\", yawSize);\n\t\t\tconst minFov = (this._yawPitchControl.option(\"fovRange\"))[0];\n\n\t\t\t// this option should be called after fov is set.\n\t\t\tthis._yawPitchControl.option({\n\t\t\t\t\"fov\": maxFov, /* parameter for internal validation for pitchrange */\n\t\t\t\t\"yawRange\": [-yawSize / 2, yawSize / 2],\n\t\t\t\tisCircular,\n\t\t\t\t\"pitchRange\": [-maxFov / 2, maxFov / 2],\n\t\t\t\t\"fovRange\": [minFov, maxFov]\n\t\t\t});\n\t\t\tthis.lookAt({fov: maxFov});\n\t\t}\n\t}\n\n\t_bindRendererHandler() {\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, e);\n\t\t});\n\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, e => {\n\t\t\tthis._deactivate();\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERING_CONTEXT_LOST,\n\t\t\t\tmessage: \"webgl rendering context lost\"\n\t\t\t});\n\t\t});\n\t}\n\n\t_initYawPitchControl(yawPitchConfig) {\n\t\tthis._yawPitchControl = new YawPitchControl(yawPitchConfig);\n\n\t\tthis._yawPitchControl.on(EVENTS.ANIMATION_END, e => {\n\t\t\tthis._triggerEvent(EVENTS.ANIMATION_END, e);\n\t\t});\n\n\t\tthis._yawPitchControl.on(\"change\", e => {\n\t\t\tthis._yaw = e.yaw;\n\t\t\tthis._pitch = e.pitch;\n\t\t\tthis._fov = e.fov;\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis._triggerEvent(EVENTS.VIEW_CHANGE, e);\n\t\t});\n\t}\n\n\t_triggerEvent(name, param) {\n\t\tconst evt = param || {};\n\n\t\t/**\n\t\t * Events that is fired when error occurs\n\t\t * @ko 에러 발생 시 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#error\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.type Error type\n\t\t * \t\t10: INVALID_DEVICE: Unsupported device\n\t\t * \t\t11: NO_WEBGL: Webgl not support\n\t\t * \t\t12, FAIL_IMAGE_LOAD: Failed to load image\n\t\t * \t\t13: FAIL_BIND_TEXTURE: Failed to bind texture\n\t\t * \t\t14: INVALID_RESOURCE: Only one resource(image or video) should be specified\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost occurred\n\t\t * 에러 종류\n\t\t * \t\t10: INVALID_DEVICE: 미지원 기기\n\t\t * \t\t11: NO_WEBGL: WEBGL 미지원\n\t\t * \t\t12, FAIL_IMAGE_LOAD: 이미지 로드 실패\n\t\t * \t\t13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패\n\t\t * \t\t14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost 발생\n\t\t * \n\t\t * @param {String} param.message Error message 에러 메시지\n\t\t * @see {@link eg.view360.PanoViewer.ERROR_TYPE}\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"error\" : function(evt) {\n\t\t *\t\t// evt.type === 13\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t *\n\t\t * // constant can be used\n\t\t * viwer.on({\n\t\t *\teg.view360.PanoViewer.EVENTS.ERROR : function(evt) {\n\t\t *\t\t// evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when PanoViewer is ready to go.\n\t\t * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#ready\n\t\t * @event\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"ready\" : function(evt) {\n\t\t *\t\t// PanoViewer is ready to show image and handle user interaction.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when direction or fov is changed.\n\t\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#viewChange\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.yaw yawyaw\n\t\t * @param {Number} param.pitch pitch pitch\n\t\t * @param {Number} param.fov Field of view (fov) 화각\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"viewChange\" : function(evt) {\n\t\t *\t\t//evt.yaw, evt.pitch, evt.fov is available.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when animation which is triggered by inertia is ended.\n\t\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#animationEnd\n\t\t * @event\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"animationEnd\" : function(evt) {\n\t\t *\t\t// animation is ended.\n\t\t * });\n\t\t */\n\t\treturn this.trigger(name, evt);\n\t}\n\n\t/**\n\t * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}.\n\t * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다.\n\t * @method eg.view360.PanoViewer#setUseZoom\n\t * @param {Boolean} useZoom\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseZoom(useZoom) {\n\t\ttypeof useZoom === \"boolean\" && this._yawPitchControl.option(\"useZoom\", useZoom);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * When true, enables the keyboard move key control: awsd, arrow keys\n\t * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키)\n\t * @method eg.view360.PanoViewer#setUseKeyboard\n\t * @param {Boolean} useKeyboard\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseKeyboard(useKeyboard) {\n\t\tthis._yawPitchControl.option(\"useKeyboard\", useKeyboard);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")\n\t * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")\n\t * @method eg.view360.PanoViewer#setGyroMode\n\t * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE}\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setGyroMode(\"yawPitch\");\n\t * //equivalent\n\t * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH);\n\t */\n\tsetGyroMode(gyroMode) {\n\t\tthis._yawPitchControl.option(\"gyroMode\", gyroMode);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setFovRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setFovRange([50, 90]);\n\t */\n\tsetFovRange(range) {\n\t\tthis._yawPitchControl.option(\"fovRange\", range);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Getting the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFovRange\n\t * @return {Array}\n\t * @example\n\t * var range = panoViewer.getFovRange(); //[50, 90]\n\t */\n\tgetFovRange() {\n\t\treturn this._yawPitchControl.option(\"fovRange\");\n\t}\n\n\t/**\n\t * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size.\n\t * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다.\n\t * @method eg.view360.PanoViewer#updateViewportDimensions\n\t * @param {Object} [size]\n\t * @param {Number} [size.width=width of container]\n\t * @param {Number} [size.height=height of container]\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tupdateViewportDimensions(size = {width: undefined, height: undefined}) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet containerSize;\n\n\t\tif (size.width === undefined || size.height === undefined) {\n\t\t\tcontainerSize = window.getComputedStyle(this._container);\n\t\t}\n\n\t\tconst width = size.width || parseInt(containerSize.width, 10);\n\t\tconst height = size.height || parseInt(containerSize.height, 10);\n\n\t\t// Skip if viewport is not changed.\n\t\tif (width === this._width && height === this._height) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tthis._aspectRatio = width / height;\n\t\tthis._photoSphereRenderer.updateViewportDimensions(width, height);\n\t\tthis._yawPitchControl.option(\"aspectRatio\", this._aspectRatio);\n\t\tthis._yawPitchControl.updatePanScale({height});\n\n\t\tthis.lookAt({}, 0);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the current field of view(FOV)\n\t * @ko 현재 field of view(FOV) 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFov\n\t * @return {Number}\n\t */\n\tgetFov() {\n\t\treturn this._fov;\n\t}\n\n\t/**\n\t * Get the horizontal field of view in degree\n\t */\n\t_getHFov() {\n\t\treturn mathUtil.toDegree(\n\t\t\t2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2)));\n\t}\n\n\t/**\n\t * Get current yaw value\n\t * @ko 현재 yaw 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYaw\n\t * @return {Number}\n\t */\n\tgetYaw() {\n\t\treturn this._yaw;\n\t}\n\n\t/**\n\t * Get current pitch value\n\t * @ko 현재 pitch 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getPitch\n\t * @return {Number}\n\t */\n\tgetPitch() {\n\t\treturn this._pitch;\n\t}\n\n\t/**\n\t * Get the range of controllable Yaw values\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYawRange\n\t * @return {Array}\n\t */\n\tgetYawRange() {\n\t\treturn this._yawPitchControl.option(\"yawRange\");\n\t}\n\n\t/**\n\t * Get the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다.\n\t * @method eg.view360.PanoViewer#getPitchRange\n\t * @return {Array}\n\t */\n\tgetPitchRange() {\n\t\treturn this._yawPitchControl.option(\"pitchRange\");\n\t}\n\n\t/**\n\t * Set the range of controllable yaw\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#setYawRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setYawRange([-90, 90]);\n\t */\n\tsetYawRange(yawRange) {\n\t\tthis._yawPitchControl.option(\"yawRange\", yawRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setPitchRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setPitchRange([-40, 40]);\n\t */\n\tsetPitchRange(pitchRange) {\n\t\tthis._yawPitchControl.option(\"pitchRange\", pitchRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed.\n\t * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다.\n\t * @method eg.view360.PanoViewer#setShowPolePoint\n\t * @param {Boolean} showPolePoint\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetShowPolePoint(showPolePoint) {\n\t\tthis._yawPitchControl.option(\"showPolePoint\", showPolePoint);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a new view by setting camera configuration. Any parameters not specified remain the same.\n\t * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다.\n\t * @method eg.view360.PanoViewer#lookAt\n\t * @param {Object} orientation\n\t * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위)\n\t * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위)\n\t * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위)\n\t * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초)\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * // Change the yaw angle (absolute angle) to 30 degrees for one second.\n\t * panoViewer.lookAt({yaw: 30}, 1000);\n\t */\n\tlookAt(orientation, duration) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw;\n\t\tconst pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch;\n\t\tconst pitchRange = this._yawPitchControl.option(\"pitchRange\");\n\t\tconst verticalAngleOfImage = pitchRange[1] - pitchRange[0];\n\t\tlet fov = orientation.fov !== undefined ? orientation.fov : this._fov;\n\n\t\tif (verticalAngleOfImage < fov) {\n\t\t\tfov = verticalAngleOfImage;\n\t\t}\n\n\t\tthis._yawPitchControl.lookAt({yaw, pitch, fov}, duration);\n\n\t\tif (duration === 0) {\n\t\t\tthis._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_activate() {\n\t\tthis._photoSphereRenderer.attachTo(this._container);\n\t\tthis._yawPitchControl.enable();\n\n\t\tthis.updateViewportDimensions();\n\n\t\tthis._isReady = true;\n\n\t\t// update yawPitchControl after isReady status is true.\n\t\tthis._updateYawPitchIfNeeded();\n\n\t\tthis._triggerEvent(EVENTS.READY);\n\t\tthis._photoSphereRenderer.startRender();\n\t}\n\n\t/**\n\t * Destroy webgl context and block user interaction and stop rendering\n\t */\n\t_deactivate() {\n\t\tif (this._isReady) {\n\t\t\tthis._photoSphereRenderer.stopRender();\n\t\t\tthis._yawPitchControl.disable();\n\t\t\tthis._isReady = false;\n\t\t}\n\n\t\tif (this._photoSphereRenderer) {\n\t\t\tthis._photoSphereRenderer.destroy();\n\t\t\tthis._photoSphereRenderer = null;\n\t\t}\n\t}\n\n\tstatic _isValidTouchDirection(direction) {\n\t\treturn direction === PanoViewer.TOUCH_DIRECTION.NONE ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.YAW ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.PITCH ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.ALL;\n\t}\n\n\t/**\n\t * Set touch direction by which user can control.\n\t * @ko 사용자가 조작가능한 터치 방향을 지정합니다.\n\t * @method eg.view360.PanoViewer#setTouchDirection\n\t * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @return {eg.view360.PanoViewer} PanoViewer instance\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Limit the touch direction to the yaw direction only.\n\t * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW);\n\t */\n\tsetTouchDirection(direction) {\n\t\tif (PanoViewer._isValidTouchDirection(direction)) {\n\t\t\tthis._yawPitchControl.option(\"touchDirection\", direction);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns touch direction by which user can control\n\t * @ko 사용자가 조작가능한 터치 방향을 반환한다.\n\t * @method eg.view360.PanoViewer#getTouchDirection\n\t * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Returns the current touch direction.\n\t * var dir = panoViewer.getTouchDirection();\n\t */\n\tgetTouchDirection() {\n\t\treturn this._yawPitchControl.option(\"touchDirection\");\n\t}\n\n\t/**\n\t * Destroy viewer. Remove all registered event listeners and remove viewer canvas.\n\t * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다.\n\t * @method eg.view360.PanoViewer#destroy\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdestroy() {\n\t\tthis._deactivate();\n\n\t\tif (this._yawPitchControl) {\n\t\t\tthis._yawPitchControl.destroy();\n\t\t\tthis._yawPitchControl = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check whether the current environment can execute PanoViewer\n\t * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다.\n\t * @function isSupported\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부\n\t * @static\n\t */\n\tstatic isSupported() {\n\t\treturn WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the WebGL\n\t * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다.\n\t * @function isWebGLAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} WebGL support WebGL 지원여부\n\t * @static\n\t */\n\tstatic isWebGLAvailable() {\n\t\treturn WebGLUtils.isWebGLAvailable();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the gyro sensor.\n\t * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다.\n\t * @function isGyroSensorAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수\n\t * @static\n\t */\n\tstatic isGyroSensorAvailable(callback) {\n\t\tif (!DeviceMotionEvent) {\n\t\t\tcallback && callback(false);\n\t\t\treturn;\n\t\t}\n\n\t\tlet onDeviceMotionChange;\n\n\t\tfunction checkGyro() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tonDeviceMotionChange = function(deviceMotion) {\n\t\t\t\t\tconst isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null);\n\n\t\t\t\t\tres(isGyroSensorAvailable);\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener(\"devicemotion\", onDeviceMotionChange);\n\t\t\t});\n\t\t}\n\n\t\tfunction timeout() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tsetTimeout(() => res(false), 1000);\n\t\t\t});\n\t\t}\n\n\t\tPromise.race([checkGyro(), timeout()]).then(isGyroSensorAvailable => {\n\t\t\twindow.removeEventListener(\"devicemotion\", onDeviceMotionChange);\n\n\t\t\tcallback && callback(isGyroSensorAvailable);\n\n\t\t\tPanoViewer.isGyroSensorAvailable = function(fb) {\n\t\t\t\tfb && fb(isGyroSensorAvailable);\n\t\t\t\treturn isGyroSensorAvailable;\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport default PanoViewer;\n","import Component from \"@egjs/component\";\nimport {TRANSFORM, SUPPORT_WILLCHANGE} from \"../utils/browserFeature\";\nimport {VERSION} from \"../version\";\n/**\n * @class eg.view360.SpriteImage\n * @classdesc A module that displays a single or continuous image of any one of the \"sprite images\". SpinViewer internally uses SpriteImage to show each frame of the sprite image.\n * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the \"Sprite image\". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n *\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpriteImage\n *\n * var el = document.getElementById(\"image-div\");\n * var sprites = new eg.view360.SpriteImage(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24\n * });\n */\nclass SpriteImage extends Component {\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\t\tconst opt = options || {};\n\n\t\tthis._el = element;\n\t\tthis._rowCount = opt.rowCount || 1;\n\t\tthis._colCount = opt.colCount || 1;\n\t\tthis._totalCount = this._rowCount * this._colCount;// total frames\n\t\tthis._width = opt.width || \"auto\";\n\t\tthis._height = opt.height || \"auto\";\n\t\tthis._autoHeight = opt.autoHeight != null ? opt.autoHeight : \"true\"; // If autoHeight is specified, _height will be overwritten.\n\t\tthis._colRow = [0, 0];\n\n\t\tif (opt.colRow) {\n\t\t\tthis._colRow = opt.colRow;\n\t\t} else if (opt.frameIndex) {\n\t\t\tthis.setFrameIndex(opt.frameIndex);\n\t\t}\n\n\t\tthis._el.style.width = SpriteImage._getSizeString(this._width);\n\t\tthis._el.style.height = SpriteImage._getSizeString(this._height);\n\n\t\tif (!opt.imageUrl) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: opt.imageUrl\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._image = new Image();\n\t\t/**\n\t\t * Event\n\t\t */\n\t\tthis._image.onload = () => {\n\t\t\tthis._bg = SpriteImage._createBgDiv(\n\t\t\t\tthis._image, this._rowCount, this._colCount, this._autoHeight);\n\t\t\tthis._el.appendChild(this._bg);\n\t\t\tthis.setColRow(this._colRow[0], this._colRow[1]);\n\n\t\t\t/**\n\t\t\t * Events that occur when component loading is complete\n\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#load\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"load\" : function(evt) {\n\t\t\t *\t\tconsole.log(\"load event fired - e.target\", e.target, \"e.bgElement\", e.bgElement);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"load\", {\n\t\t\t\ttarget: this._el,\n\t\t\t\tbgElement: this._bg\n\t\t\t});\n\n\t\t\tif (this._autoPlayReservedInfo) {\n\t\t\t\tthis.play(this._autoPlayReservedInfo);\n\t\t\t\tthis._autoPlayReservedInfo = null;\n\t\t\t}\n\t\t};\n\n\t\tthis._image.onerror = e => {\n\t\t\t/**\n\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#imageError\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t *\t\t// Error handling\n\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\timageUrl: opt.imageUrl\n\t\t\t});\n\t\t};\n\n\t\tthis._image.src = opt.imageUrl;\n\t}\n\n\tstatic _createBgDiv(img, rowCount, colCount, autoHeight) {\n\t\tconst el = document.createElement(\"div\");\n\n\t\tel.style.position = \"relative\";\n\t\tel.style.overflow = \"hidden\";\n\n\t\timg.style.position = \"absolute\";\n\t\timg.style.width = `${colCount * 100}%`;\n\t\timg.style.height = `${rowCount * 100}%`;\n\t\t/** Prevent image from being dragged on IE10, IE11, Safari especially */\n\t\timg.ondragstart = () => (false); // img.style.pointerEvents = \"none\";\n\t\t// Use hardware accelerator if available\n\t\tSUPPORT_WILLCHANGE && (img.style.willChange = \"transform\");\n\n\t\tel.appendChild(img);\n\n\t\tconst unitWidth = img.width / colCount;\n\t\tconst unitHeight = img.height / rowCount;\n\n\t\tif (autoHeight) {\n\t\t\tconst r = unitHeight / unitWidth;\n\n\t\t\tel.style.paddingBottom = `${r * 100}%`;\n\t\t} else {\n\t\t\tel.style.height = \"100%\";\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/**\n\t * Specifies the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정\n\t * @method eg.view360.SpriteImage#setFrameIndex\n\t * @param {Number} frameIndex frame index of a frame프레임의 인덱스\n\t *\n\t * @example\n\t *\n\t * sprites.setFrameIndex(0, 1);// col = 0, row = 1\n\t */\n\tsetFrameIndex(index) {\n\t\tconst colRow = this.toColRow(index);\n\n\t\tthis.setColRow(colRow[0], colRow[1]);\n\t}\n\n\t/**\n\t * Returns the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환\n\t * @method eg.view360.SpriteImage#getFrameIndex\n\t * @return {Number} frame index frame 인덱스\n\t *\n\t * @example\n\t *\n\t * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1\n\t *\n\t */\n\tgetFrameIndex() {\n\t\treturn this._colRow[1] * this._colCount + this._colRow[0];\n\t}\n\n\t/**\n\t * Specifies the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정\n\t * @method eg.view360.SpriteImage#setColRow\n\t * @param {Number} col Column number of a frame프레임의 행값\n\t * @param {Number} row Row number of a frame프레임의 열값\n\t *\n\t * @example\n\t *\n\t * sprites.setlColRow(1, 2); // col = 1, row = 2\n\t */\n\tsetColRow(col, row) {\n\t\tif (row > this._rowCount - 1 || col > this._colCount - 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._image && TRANSFORM) {\n\t\t\t// NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser?\n\t\t\tthis._image.style[TRANSFORM] = `translate(${-(col / this._colCount * 100)}%, ${-(row / this._rowCount * 100)}%)`;\n\t\t}\n\n\t\tthis._colRow = [col, row];\n\t}\n\n\t/**\n\t * Returns the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환\n\t * @method eg.view360.SpriteImage#gelColRow\n\t * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열\n\t *\n\t * @example\n\t *\n\t * var colRow = sprites.getlColRow();\n\t * // colRow = [1, 2] - index of col is 1, index of row is 2\n\t *\n\t */\n\tgetColRow() {\n\t\treturn this._colRow;\n\t}\n\n\tstatic _getSizeString(size) {\n\t\tif (typeof size === \"number\") {\n\t\t\treturn `${size}px`;\n\t\t}\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Stop playing\n\t * @ko play 되고 있던 프레임 재생을 중지합니다.\n\t * @method eg.view360.SpriteImage#stop\n\t *\n\t * @example\n\t *\n\t * viewer.stop();\n\t *\n\t */\n\tstop() {\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\t}\n\n\t/**\n\t * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'.\n\t * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다.\n\t * @method eg.view360.SpriteImage#play\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위\n\t * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복\n\t *\n\t * @example\n\t *\n\t * viewer.play({angle: 16, playCount: 1});\n\t *\n\t */\n\tplay({interval, playCount} = {interval: 1000 / this._totalCount, playCount: 0}) {\n\t\tif (!this._bg) {\n\t\t\tthis._autoPlayReservedInfo = {interval, playCount};\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\n\t\tlet frameIndex = this.getFrameIndex();\n\t\tlet count = 0;\n\t\tlet frameCount = 0; // for checking 1 cycle\n\n\t\tthis._autoPlayTimer = setInterval(() => {\n\t\t\tframeIndex %= this._totalCount;\n\t\t\tconst colRow = this.toColRow(frameIndex);\n\n\t\t\tthis.setColRow(colRow[0], colRow[1]);\n\t\t\tframeIndex++;\n\n\t\t\t// Done 1 Cycle?\n\t\t\tif (++frameCount === this._totalCount) {\n\t\t\t\tframeCount = 0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (playCount > 0 && count === playCount) {\n\t\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\t}\n\t\t}, interval);\n\t}\n\n\ttoColRow(frameIndex) {\n\t\tconst colCount = this._colCount;\n\t\tconst rowCount = this._rowCount;\n\n\t\tif (frameIndex < 0) {\n\t\t\treturn [0, 0];\n\t\t} else if (frameIndex >= this._totalCount) {\n\t\t\treturn [colCount - 1, rowCount - 1];\n\t\t}\n\n\t\tconst col = frameIndex % colCount;\n\t\tconst row = Math.floor(frameIndex / colCount);\n\n\t\t// console.log(frameIndex, col, row);\n\t\treturn [col, row];\n\t}\n}\n\nexport default SpriteImage;\n","import Component from \"@egjs/component\";\nimport Axes, {PanInput} from \"@egjs/axes\";\nimport SpriteImage from \"./SpriteImage\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_PAN_SCALE = 0.21;\n\n/**\n * @class eg.view360.SpinViewer\n * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object.\n * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpinViewer\n * var el = document.getElementById(\"product-360\");\n * var viewer = new eg.view360.SpinViewer(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24 //required\n * });\n */\nclass SpinViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.SpinViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.SpinViewer\n\t */\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\n\t\tthis._el = element;\n\n\t\tconst opt = Object.assign({}, options);\n\t\tconst colCount = opt.colCount || 1;\n\t\tconst rowCount = opt.rowCount || 1;\n\n\t\tthis._scale = (opt.scale || 1);\n\t\tthis._panScale = this._scale * DEFAULT_PAN_SCALE;\n\n\t\tthis._frameCount = colCount * rowCount;\n\n\t\t// Init SpriteImage\n\t\tthis._sprites = new SpriteImage(element, opt).on({\n\t\t\t\"load\": evt => {\n\t\t\t\t/**\n\t\t\t\t * Events that occur when component loading is complete\n\t\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#load\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"load\" : function(evt) {\n\t\t\t\t *\t\tthis.spinBy(360, {duration: 300});\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"load\", evt);\n\t\t\t},\n\t\t\t\"imageError\": evt => {\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#imageError\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viewer.on({\n\t\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t\t *\t\t// Error handling\n\t\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: evt.imageUrl\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Init Axes\n\t\tthis._panInput = new PanInput(this._el, {\n\t\t\tscale: [this._panScale, this._panScale]\n\t\t});\n\t\tthis._axes = new Axes({\n\t\t\tangle: {\n\t\t\t\trange: [0, 359],\n\t\t\t\tcircular: true\n\t\t\t}\n\t\t}).on({\n\t\t\t\"change\": evt => {\n\t\t\t\tconst curr = Math.floor(evt.pos.angle / (360 / this._frameCount));\n\t\t\t\tconst frameIndex = this._frameCount - curr - 1;\n\n\t\t\t\tthis._sprites.setFrameIndex(frameIndex);\n\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#change\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row\n\t\t\t\t * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값\n\t\t\t\t * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님)\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"change\" : function(evt) {\n\t\t\t\t *\t\tconsole.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"change\", {\n\t\t\t\t\tframeIndex,\n\t\t\t\t\tcolRow: this._sprites.getColRow(),\n\t\t\t\t\tangle: evt.pos.angle\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"animationEnd\": evt => {\n\t\t\t\t/**\n\t\t\t\t * This event is fired when animation ends.\n\t\t\t\t * @ko 에니메이션이 끝났을 때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#animationEnd\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Boolean} param.isTrusted 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\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"animationEnd\" : function(evt) {\n\t\t\t\t *\t\t// evt.isTrusted === true or false\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"animationEnd\", {\n\t\t\t\t\tisTrusted: evt.isTrusted\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._axes.connect(\"angle\", this._panInput);\n\t}\n\n\t/**\n\t * Set spin scale\n\t * @ko scale 을 조정할 수 있는 함수\n\t * @method eg.view360.SpinViewer#setScale\n\t * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.setScale(2);// It moves twice as much.\n\t */\n\tsetScale(scale) {\n\t\tif (isNaN(scale) || scale < 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._scale = scale;\n\t\tthis._panScale = scale * DEFAULT_PAN_SCALE;\n\t\tthis._panInput.options.scale = [this._panScale, this._panScale];\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get spin scale\n\t * @ko scale 값을 반환한다.\n\t * @method eg.view360.SpinViewer#getScale\n\t *\n\t * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @example\n\t *\n\t * viewer.getScale();// It returns number\n\t */\n\tgetScale() {\n\t\treturn this._scale;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle.\n\t * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinBy\n\t *\n\t * @param {Number} [angle = 0] angle상대적 회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinBy(720, {duration: 500});\n\t */\n\tspinBy(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setBy({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle).\n\t * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinTo\n\t *\n\t * @param {Number} [angle = 0] angle회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinTo(30, {duration:100});\n\t */\n\tspinTo(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setTo({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns current angles\n\t * @ko 현재 각도를 반환한다.\n\t *\n\t * @return {Number} Current angle 현재 각도\n\t */\n\tgetAngle() {\n\t\treturn this._axes.get().angle || 0;\n\t}\n}\n\nexport default SpinViewer;\n"],"names":["this","require","global","win","window","Math","self","Function","doc","document","agent","getAgent","osName","os","name","browserName","browser","IS_IOS","IS_SAFARI_ON_DESKTOP","Float32Array","Array","getComputedStyle","userAgent","navigator","SUPPORT_TOUCH","SUPPORT_DEVICEMOTION","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","i","len","length","SUPPORT_WILLCHANGE","CSS","supports","WEBXR_SUPPORTED","checkXRSupport","xr","isSessionSupported","then","res","supportsSession","quatToVec3","quaternion","baseV","vec3","fromValues","transformQuat","toDegree","a","PI","util","isPowerOfTwo","n","extractPitchFromQuat","atan2","sqrt","pow","hypot","x","y","ROTATE_CONSTANT","PITCH_DELTA","YAW_DELTA_BY_ROLL","YAW_DELTA_BY_YAW","targetAxis","meshPoint","getRotationDelta","prevQ","curQ","rotateKind","prevQuaternion","quat","clone","curQuaternion","normalize","prevPoint","curPoint","rotateDistance","dot","cross","create","rotateDirection","meshPoint2","meshPoint3","vecU","vecV","vecN","coefficientA","coefficientB","coefficientC","distance","abs","projectedPrevPoint","subtract","scale","trigonometricRatio","theta","acos","crossVec","thetaDirection","deltaRadian","angleBetweenVec2","v1","v2","det","vec2","yawOffsetBetween","viewDir","targetDir","viewDirXZ","targetDirXZ","toAxis","source","offset","reduce","acc","v","MathUtil","Util","version","branch","build","match","exec","parseInt","CHROME_VERSION","IS_CHROME_WITHOUT_DEVICE_MOTION","IS_ANDROID","test","CONTROL_MODE_VR","CONTROL_MODE_YAWPITCH","TOUCH_DIRECTION_NONE","TOUCH_DIRECTION_YAW","TOUCH_DIRECTION_PITCH","TOUCH_DIRECTION_ALL","MC_DECELERATION","MC_MAXIMUM_DURATION","MC_BIND_SCALE","MAX_FIELD_OF_VIEW","PAN_SCALE","YAW_RANGE_HALF","PITCH_RANGE_HALF","CIRCULAR_PITCH_RANGE_HALF","GYRO_MODE","NONE","YAWPITCH","VR","STILLNESS_THRESHOLD","DeviceMotion","_onDeviceMotion","bind","_onDeviceOrientation","_onChromeWithoutDeviceMotion","isWithoutDeviceMotion","isAndroid","stillGyroVec","rawGyroVec","adjustedGyroVec","_timer","lastDevicemotionTimestamp","_isEnabled","enable","e","alpha","beta","gamma","trigger","inputEvent","deviceorientation","clearTimeout","setTimeout","Date","getTime","copy","isGyroSensorAvailable","rotationRate","isGravitySensorAvailable","accelerationIncludingGravity","interval","devicemotionEvent","timeStamp","type","z","acceleration","set","adjustedRotationRate","addEventListener","disable","removeEventListener","Component","SensorSample","ComplementaryFilter","prototype","run_","isOrientationInitialized","accelQ","accelToQuaternion_","currentAccelMeasurement","sample","previousFilterQ","deltaT","currentGyroMeasurement","timestampS","previousGyroMeasurement","gyroDeltaQ","gyroToQuaternionDelta_","gyroIntegralQ","multiply","filterQ","invFilterQ","Quaternion","inverse","estimatedGravity","applyQuaternion","measuredGravity","deltaQ","setFromUnitVectors","targetQ","slerp","kFilter","isFilterQuaternionInitialized","getOrientation","K_FILTER","PREDICTION_TIME_S","FusionPoseSensor","deviceMotion","accelerometer","Vector3","gyroscope","_onDeviceMotionChange","_onScreenOrientationChange","filter","posePredictor","PosePredictor","filterToWorldQ","isFirefoxAndroid","isIOS","isChromeUsingDegrees","setFromAxisAngle","inverseWorldToScreenQ","worldToScreenQ","originalPoseAdjustQ","orientation","_setScreenTransform","isLandscapeMode","resetQ","on","isEnabled","destroy","_triggerChange","_prevOrientation","equals","_deviceOrientationQ","deviceOrientationFixQ","_alpha","out","multiplyQuaternions","out_","w","_convertFusionToPredicted","predictedQ","getPrediction","previousTimestampS","accGravity","rotRate","setFromEulerYXZ","multiplyScalar","addAccelMeasurement","addGyroMeasurement","screenOrientation","getDeltaYaw","prvQ","yawDeltaByYaw","yawDeltaByRoll","sin","getDeltaPitch","pitchDelta","TiltMotionInput","el","options","element","_prevQuaternion","_quaternion","fusionPoseSensor","threshold","_onPoseChange","mapAxes","axes","connect","observer","_attachEvent","disconnect","_dettachEvent","event","change","off","screenRotationAngleInst","refCount","ScreenRotationAngle","_onOrientationChange","_spinR","_screenOrientationAngle","betaR","glMatrix","toRadian","gammaR","cos","screen","angle","undefined","getRadian","unref","RotationPanInput","_useRotation","_screenRotationAngle","setUseRotation","useRotation","_userDirection","Axes","DIRECTION_ALL","_direction","DIRECTION_HORIZONTAL","getOffset","properties","useDirection","newOffset","cosTheta","sinTheta","DIRECTION_VERTICAL","PanInput","Y_AXIS_VECTOR","DeviceQuaternion","_fusionPoseSensor","isTrusted","getCombinedQuaternion","yaw","yawQ","setAxisAngle","conj","conjugate","outQ","VERSION","DEFAULT_YAW_RANGE","DEFAULT_PITCH_RANGE","CIRCULAR_PITCH_RANGE","YawPitchControl","opt","pitch","fov","showPolePoint","useZoom","useKeyboard","gyroMode","touchDirection","yawRange","pitchRange","fovRange","aspectRatio","_element","_initialFov","_enabled","_isAnimating","_deviceQuaternion","_initAxes","option","yRange","_updateYawRange","pRange","_updatePitchRange","axesPanInput","axesWheelInput","WheelInput","axesTiltMotionInput","axesPinchInput","PinchInput","axesMoveKeyInput","MoveKeyInput","range","circular","isCircular","bounce","deceleration","maximumDuration","hold","evt","delta","_updateControlScale","updatePanScale","release","animationStart","animationEnd","param","get","areaHeight","height","args","argLen","_getOptions","beforeOptions","newOptions","changedKeyList","Object","keys","push","_setOptions","_getValidatedOptions","_applyOptions","_getValidYawRange","_getValidPitchRange","key","value","arguments","prevOptions","isVR","isYawPitch","some","indexOf","setTo","prevFov","nextFov","axis","_initDeviceQuaternion","_togglePinchInputByOption","_enableTouch","_inputs","direction","yawEnabled","pitchEnabled","newYawRange","newFov","newAspectRatio","ratio","adjustAspectRatio","horizontalFov","isValid","newPitchRange","changeEvt","pos","p","verticalAngle","halfFov","isPanorama","concat","horizontalAngle","halfHorizontalFov","mathUtil","tan","targetElement","input","inputRange","outputRange","rangeIdx","inputA","inputB","outputA","outputB","lerp","b","fraction","persistOrientation","_resetOrientation","lookAt","duration","f","Infinity","setBy","getYawPitch","yawPitch","getFov","getQuaternion","shouldRenderWithQuaternion","axisPanInput","axesDeviceOrientationInput","STATUS","EVENT","ImageLoader","image","_image","_onceHandlers","_loadStatus","rej","LOADED","getElement","LOADING","isMaybeLoaded","READYSTATECHANGE","createElement","onceLoaded","ERROR","images","map","img","_img","Image","crossOrigin","src","result","complete","naturalWidth","onload","onerror","targets","targetsNotLoaded","loadPromises","_once","all","reason","listener","fn","getStatus","forEach","handler","READY_STATUS","HAVE_NOTHING","HAVE_METADATA","HAVE_CURRENT_DATA","HAVE_FUTURE_DATA","HAVE_ENOUGH_DATA","LOADING_FAILED","READYSTATECHANGE_EVENT_NAME","VideoLoader","video","_handlers","_sourceCount","_thresholdReadyState","_thresholdEventName","readyState","_onerror","_errorCount","_detachErrorHandler","_appendSourceElement","videoUrl","videoSrc","videoType","sourceElement","_video","appendChild","_reset","HTMLVideoElement","setAttribute","querySelectorAll","load","_attachErrorHandler","_sources","call","rejector","WEBGL_ERROR_CODE","webglAvailability","MAX_TEXTURE_SIZE_FOR_TEST","WebGLUtils","createShader","gl","shader","shaderSource","compileShader","success","getShaderParameter","COMPILE_STATUS","console","error","getShaderInfoLog","createProgram","vertexShader","fragmentShader","program","attachShader","linkProgram","detachShader","deleteShader","getProgramParameter","LINK_STATUS","deleteProgram","initBuffer","data","itemSize","attr","buffer","createBuffer","bindBuffer","bufferData","STATIC_DRAW","numItems","enableVertexAttribArray","vertexAttribPointer","FLOAT","getWebglContext","canvas","userContextAttributes","webglIdentifiers","context","contextAttributes","preserveDrawingBuffer","antialias","xrCompatible","onWebglcontextcreationerror","statusMessage","getContext","t","createTexture","textureTarget","texture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","isWebGLAvailable","webglContext","loseContextExtension","getExtension","loseContext","isStableWebGL","agentInfo","isStableWebgl","parseFloat","getErrorNameFromWebGLErrorCode","code","texImage2D","pixels","RGBA","UNSIGNED_BYTE","getMaxTextureSize","getParameter","MAX_TEXTURE_SIZE","Agent","isIE11","majorVersion","EVENTS","Renderer","_forceDimension","_pixelCanvas","_pixelContext","render","shaderProgram","indexBuffer","mvMatrix","pMatrix","uniformMatrix4fv","pMatrixUniform","mvMatrixUniform","drawElements","TRIANGLES","UNSIGNED_SHORT","getDimension","pixelSource","width","videoWidth","naturalHeight","videoHeight","updateShaderData","_initPixelSource","forceDimension","isIE11Video","_getPixelSource","contentDimension","textureDimension","drawImage","_extractTileConfig","imageConfig","tileConfig","isArray","config","flipHorizontal","rotation","_triggerError","message","CubeRenderer","getVertexPositionData","_VERTEX_POSITION_DATA","getIndexData","_INDEX_DATA","indexData","vertexPositionData","extractOrder","order","getTextureCoordData","vertexOrder","base","elemSize","vertexPerTile","textureCoordData","split","face","ordermap_","r","shift","unshift","pop","elemPerTile","tileVertex","slice","tileTemp","j","splice","join","getVertexShaderSource","getFragmentShaderSource","updateTexture","baseOrder","orderMap","surfaceIdx","tileIdx","TEXTURE_CUBE_MAP_POSITIVE_X","maxCubeMapTextureSize","getMaxCubeMapTextureSize","tile","extractTileFromImage","TEXTURE_CUBE_MAP","getSourceTileSize","inputTextureSize","outputTextureSize","tilePerRow","MAX_CUBE_MAP_TEXTURE_SIZE","_imageWidth","min","CubeStripRenderer","_vertices","indices","cols","rows","coords","c","coord","tileConfigs","_shrinkCoord","_transformCoord","index","val","TEXTURE_2D","size","max","maxSize","activeTexture","TEXTURE0","pixelStorei","UNPACK_FLIP_Y_WEBGL","newCoord","_flipHorizontalCoord","_rotateCoord","SHRINK_Y","SHRINK_X","rotationAngle","SIZE","shiftCount","moved","rotatedCoord","ERROR_TYPE","INVALID_DEVICE","NO_WEBGL","FAIL_IMAGE_LOAD","FAIL_BIND_TEXTURE","INVALID_RESOURCE","RENDERING_CONTEXT_LOST","READY","VIEW_CHANGE","ANIMATION_END","PROJECTION_TYPE","EQUIRECTANGULAR","CUBEMAP","CUBESTRIP","PANORAMA","STEREOSCOPIC_EQUI","STEREO_FORMAT","TOP_BOTTOM","LEFT_RIGHT","latitudeBands","longitudeBands","radius","ANGLE_CORRECTION_FOR_CENTER_ALIGN","latIdx","lngIdx","phi","sinPhi","cosPhi","u","SphereRenderer","format","_stereoFormat","ctx","leftEyeScaleOffset","rightEyeScaleOffset","uTexScaleOffset","getUniformLocation","uniform4fv","_TEXTURE_COORD_DATA","MIN_ASPECT_RATIO_FOR_FULL_PANORAMA","CylinderRenderer","resizeDimension","imageAspectRatio","cylinderMaxRadian","halfCylinderY","rotated","CYLIDER_Y","startAngleForCenterAlign","yIdx","yLength","VR_DISPLAY_PRESENT_CHANGE","DEFAULT_LEFT_BOUNDS","DEFAULT_RIGHT_BOUNDS","EYES","LEFT","RIGHT","VRManager","_vrDisplay","vrDisplay","removeEndCallback","isPresenting","exitPresent","_clear","_frameData","VRFrameData","canRender","Boolean","beforeRender","bindFramebuffer","FRAMEBUFFER","afterRender","submitFrame","getEyeParams","display","halfWidth","drawingBufferWidth","drawingBufferHeight","frameData","getFrameData","leftMVMatrix","leftViewMatrix","rightMVMatrix","rightViewMatrix","mat4","rotateY","_yawOffset","viewport","leftProjectionMatrix","rightProjectionMatrix","addEndCallback","callback","requestPresent","resolve","reject","getVRDisplays","displays","Error","capabilities","canPresent","leftEye","getEyeParameters","rightEye","renderWidth","renderHeight","_setDisplay","setYawOffset","layers","getLayers","layer","_leftBounds","leftBounds","_rightBounds","rightBounds","XR_REFERENCE_SPACE","XRManager","_xrSession","xrSession","end","frame","pose","getViewerPose","_xrRefSpace","session","baseLayer","renderState","framebuffer","glLayer","views","view","getViewport","transform","matrix","rotateX","projectionMatrix","_presenting","requestSession","requiredFeatures","xrLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","refSpace","_setSession","_xrLayer","WebGLAnimator","_onLoop","_callback","_rafId","_context","requestAnimationFrame","_onLoopNextTick","before","performance","now","diff","_rafTimer","setCallback","setContext","start","stop","cancelAnimationFrame","ImageType","DEVICE_PIXEL_RATIO","BIND_TEXTURE","IMAGE_LOADED","RENDERING_CONTEXT_RESTORE","RENDERER_ERROR","PanoImageRenderer","isVideo","sphericalConfig","renderingContextAttributes","_renderStereo","time","vr","_vr","eyeParams","eyeIndex","eyeParam","uniform1f","uEye","_bindBuffers","_draw","exitVR","animator","_animator","_restoreStyle","updateViewportDimensions","_updateViewport","_shouldForceDraw","_render","_onFirstVRFrame","minusZDir","mat3","fromMat4","mvInv","invert","pInv","transformMat3","yawOffset","fieldOfView","_lastQuaternion","_lastYaw","_lastPitch","_lastFieldOfView","perspective","textureCoordBuffer","vertexBuffer","_initCanvas","_setDefaultCanvasStyle","_wrapper","_wrapperOrigStyle","_renderingContextAttributes","_imageConfig","_imageIsReady","_keepUpdate","_onContentLoad","_onContentError","setImage","imageType","cubemapConfig","setYawPitchControl","yawPitchControl","_yawPitchControl","getContent","_isVideo","_setImageType","_contentLoader","_imageType","_isCubeMap","_renderer","stereoFormat","_initWebGL","_onWebglcontextlost","_onWebglcontextrestored","bottom","left","right","top","margin","maxHeight","maxWidth","outline","position","_triggerContentLoad","content","projectionType","isImageLoaded","_bindTexture","attachTo","parentElement","detach","forceContextLoss","hasRenderingContext","removeChild","isContextLost","_initShaderProgram","renderer","vsSource","fsSource","VERTEX_SHADER","FRAGMENT_SHADER","getError","useProgram","vertexPositionAttribute","getAttribLocation","samplerUniform","textureCoordAttribute","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","uniform1i","preventDefault","updateFieldOfView","viewPortChanged","h","_initRenderingContext","clearColor","deleteTexture","CULL_FACE","WebGLRenderingContext","_initBuffers","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","Uint16Array","isEAC","_updateTexture","keepUpdate","doUpdate","startRender","stopRender","renderWithQuaternion","exactEquals","fromQuat","renderWithYawPitch","identity","getProjectionRenderer","enterVR","_Promise","_requestPresent","_setWrapperFullscreen","wrapper","getAttribute","wrapperStyle","zIndex","removeAttribute","PanoViewer","container","_container","_projectionType","_cubemapConfig","_width","_height","_yaw","_pitch","_fov","_gyroMode","_aspectRatio","_isValidTouchDirection","yawPitchConfig","_isReady","_initYawPitchControl","_initRenderer","getVideo","_photoSphereRenderer","setVideo","getImage","warn","_deactivate","getProjectionType","enableSensor","requestPermission","permissionState","disableSensor","initialYaw","initialPitch","_bindRendererHandler","_activate","_triggerEvent","_updateYawPitchIfNeeded","ProjectionType","yawSize","maxFov","atan","minFov","setUseZoom","setUseKeyboard","setGyroMode","setFovRange","getFovRange","containerSize","_getHFov","getYaw","getPitch","getYawRange","getPitchRange","setYawRange","setPitchRange","setShowPolePoint","verticalAngleOfImage","TOUCH_DIRECTION","YAW","PITCH","ALL","setTouchDirection","getTouchDirection","isSupported","onDeviceMotionChange","checkGyro","timeout","race","fb","SpriteImage","_el","_rowCount","rowCount","_colCount","colCount","_totalCount","_autoHeight","autoHeight","_colRow","colRow","frameIndex","setFrameIndex","_getSizeString","imageUrl","_bg","_createBgDiv","setColRow","bgElement","_autoPlayReservedInfo","play","overflow","ondragstart","willChange","unitWidth","unitHeight","paddingBottom","toColRow","getFrameIndex","col","row","getColRow","_autoPlayTimer","clearInterval","playCount","count","frameCount","setInterval","floor","DEFAULT_PAN_SCALE","SpinViewer","_scale","_panScale","_frameCount","_sprites","_panInput","_axes","curr","setScale","isNaN","getScale","spinBy","spinTo","getAngle"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;EAQA,CAAC,UAAU,MAAM,EAAE,OAAO,EAAE;GAC3B,AAA+D,cAAc,GAAG,OAAO,EAAE,AAE1D,CA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index 000000000..eb0951744 --- /dev/null +++ b/dist/view360.min.js @@ -0,0 +1,9 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@egjs/agent"),require("gl-matrix"),require("@egjs/axes"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["exports","@egjs/agent","gl-matrix","@egjs/axes","@egjs/component"],e):e((t.eg=t.eg||{},t.eg.view360={}),t.eg.Agent,t.glMatrix,t.eg.Axes,t.eg.Component)}(this,function(t,s,R,h,e){"use strict";function n(t,e){for(var i=0;iMath.abs(t.z)?D.set(-t.y,t.x,0):D.set(0,-t.z,t.y)):D.crossVectors(t,e),this.x=D.x,this.y=D.y,this.z=D.z,this.w=M,this.normalize(),this}};var L,F,N,U,Q,Ot,Dt,Mt,Vt,z=V,G=window.Util||{};function B(t,e,i,n,r){var o,a,s,u,h,c,l,d,f,_;o=t,a=n?n.fieldOfView:null,s=r.depthNear,u=r.depthFar,h=Math.tan(a?a.upDegrees*Ot:Dt),c=Math.tan(a?a.downDegrees*Ot:Dt),l=Math.tan(a?a.leftDegrees*Ot:Dt),d=Math.tan(a?a.rightDegrees*Ot:Dt),f=2/(l+d),_=2/(h+c),o[0]=f,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=_,o[6]=0,o[7]=0,o[8]=-(l-d)*f*.5,o[9]=(h-c)*_*.5,o[10]=u/(s-u),o[11]=-1,o[12]=0,o[13]=0,o[14]=u*s/(s-u),o[15]=0;var p,v,g,m,y,x,w,E,R,T,C,b,I,A,P,S,O,D,M,V,L,F,N,U,Q,z,G,B,W,X,k,Y,q,H,j,K,Z,J,$,tt,et,it,nt,rt,ot,at,st,ut,ht,ct,lt,dt,ft,_t,pt,vt,gt,mt,yt,xt,wt,Et,Rt,Tt,Ct,bt,It,At,Pt=i.orientation||Mt,St=i.position||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*bt-et*It-nt*Ct)*At,J[2]=(ft*wt-_t*xt+pt*yt)*At,J[3]=(ct*xt-ht*wt-lt*yt)*At,J[4]=(at*Tt-rt*It-st*Rt)*At,J[5]=(tt*It-it*Tt+nt*Rt)*At,J[6]=(_t*mt-dt*wt-pt*gt)*At,J[7]=(ut*wt-ct*mt+lt*gt)*At,J[8]=(rt*bt-ot*Tt+st*Et)*At,J[9]=(et*Tt-tt*bt-nt*Et)*At,J[10]=(dt*xt-ft*mt+pt*vt)*At,J[11]=(ht*mt-ut*xt-lt*vt)*At,J[12]=(ot*Rt-rt*Ct-at*Et)*At,J[13]=(tt*Ct-et*Rt+it*Et)*At,J[14]=(ft*gt-dt*yt-_t*vt)*At,J[15]=(ut*yt-ht*gt+ct*vt)*At)}G.MIN_TIMESTEP=.001,G.MAX_TIMESTEP=1,G.base64=function(t,e){return"data:"+t+";base64,"+e},G.clamp=function(t,e,i){return Math.min(Math.max(e,t),i)},G.lerp=function(t,e,i){return t+(e-t)*i},G.race=function(n){return Promise.race?Promise.race(n):new Promise(function(t,e){for(var i=0;iG.MAX_TIMESTEP))},G.getScreenWidth=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},G.getScreenHeight=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},G.requestFullscreen=function(t){if(G.isWebViewAndroid())return!1;if(t.requestFullscreen)t.requestFullscreen();else if(t.webkitRequestFullscreen)t.webkitRequestFullscreen();else if(t.mozRequestFullScreen)t.mozRequestFullScreen();else{if(!t.msRequestFullscreen)return!1;t.msRequestFullscreen()}return!0},G.exitFullscreen=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},G.getFullscreenElement=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},G.linkProgram=function(t,e,i,n){var r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);var o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,i),t.compileShader(o);var a=t.createProgram();for(var s in t.attachShader(a,r),t.attachShader(a,o),n)t.bindAttribLocation(a,n[s],s);return t.linkProgram(a),t.deleteShader(r),t.deleteShader(o),a},G.getProgramUniforms=function(t,e){for(var i={},n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r="",o=0;oa[1]&&(u=a[1]),s!==u&&(i.setTo({fov:u},0),this._updateControlScale(),this.updatePanScale())}t.some(function(t){return"gyroMode"===t})&&w&&(this.axesTiltMotionInput&&(this.axes.disconnect(this.axesTiltMotionInput),this.axesTiltMotionInput.destroy(),this.axesTiltMotionInput=null),this._deviceQuaternion&&(this._deviceQuaternion.destroy(),this._deviceQuaternion=null),n?this._initDeviceQuaternion():r&&(this.axesTiltMotionInput=new ht(this._element),this.axes.connect(["yaw","pitch"],this.axesTiltMotionInput)),this.axesPanInput.setUseRotation(n)),t.some(function(t){return"useKeyboard"===t})&&(e.useKeyboard?i.connect(["yaw","pitch"],this.axesMoveKeyInput):i.disconnect(this.axesMoveKeyInput));if(t.some(function(t){return"useZoom"===t})){var h=e.useZoom;i.disconnect(this.axesWheelInput),h&&i.connect(["fov"],this.axesWheelInput)}this._togglePinchInputByOption(e.touchDirection,e.useZoom),t.some(function(t){return"touchDirection"===t})&&this._enabled&&this._enableTouch(o)},t._togglePinchInputByOption=function(t,e){this.axesPinchInput&&(this.axes.disconnect(this.axesPinchInput),e&&6===t&&-1===this.axes._inputs.indexOf(this.axesPinchInput)&&this.axes.connect(["fov"],this.axesPinchInput))},t._enableTouch=function(t){this.axesPanInput&&this.axes.disconnect(this.axesPanInput);var e=2&t?"yaw":null,i=4&t?"pitch":null;this.axes.connect([e,i],this.axesPanInput)},t._initDeviceQuaternion=function(){var e=this;this._deviceQuaternion=new pt,this._deviceQuaternion.on("change",function(t){e._triggerChange(t)})},t._getValidYawRange=function(t,e,i){var n=u.adjustAspectRatio(i||this.options.aspectRatio||1),r=(e||this.axes.get().fov)*n;return t[1]-t[0]>=r?t:this.options.yawRange||gt},t._getValidPitchRange=function(t,e){var i=e||this.axes.get().fov;return t[1]-t[0]>=i?t:this.options.pitchRange||mt},u.isCircular=function(t){return t[1]-t[0]<360?[!1,!1]:[!0,!0]},t._updateControlScale=function(t){var e=this.options,i=this.axes.get().fov,n=this._updatePitchRange(e.pitchRange,i,e.showPolePoint),r=this._updateYawRange(e.yawRange,i,e.aspectRatio),o=this.axes.get(),a=o.yaw,s=o.pitch;return R.vec2.copy(this.axes.axis.yaw.range,r),R.vec2.copy(this.axes.axis.pitch.range,n),this.axes.axis.yaw.circular=u.isCircular(r),this.axes.axis.pitch.circular=u.isCircular(n),ar[1]&&(a=r[1]),sn[1]&&(s=n[1]),t&&t.set({yaw:a,pitch:s}),this.axes.setTo({yaw:a,pitch:s},0),this},t._updatePitchRange=function(t,e,i){if(this.options.gyroMode===tt.VR)return yt;var n=t[1]-t[0],r=e/2;return i&&!(n<180)?t.concat():[t[0]+r,t[1]-r]},t._updateYawRange=function(t,e,i){if(this.options.gyroMode===tt.VR)return gt;if(360<=t[1]-t[0])return t.concat();var n=P.toDegree(Math.atan2(i,1/Math.tan(R.glMatrix.toRadian(e/2))));return[t[0]+n,t[1]-n]},t._triggerChange=function(t){var e=this.axes.get(),i=this.options,n={targetElement:i.element,isTrusted:t.isTrusted};n.yaw=e.yaw,n.pitch=e.pitch,n.fov=e.fov,i.gyroMode===tt.VR&&this._deviceQuaternion&&(n.quaternion=this._deviceQuaternion.getCombinedQuaternion(e.yaw)),this.trigger("change",n)},u.adjustAspectRatio=function(t){for(var e=[.52,.54,.563,.57,.584,.59,.609,.67,.702,.72,.76,.78,.82,.92,.97,1,1.07,1.14,1.19,1.25,1.32,1.38,1.4,1.43,1.53,1.62,1.76,1.77,1.86,1.96,2.26,2.3,2.6,3,5,6],i=[.51,.54,.606,.56,.628,.63,.647,.71,.736,.757,.78,.77,.8,.89,.975,1,1.07,1.1,1.15,1.18,1.22,1.27,1.3,1.33,1.39,1.45,1.54,1.55,1.58,1.62,1.72,1.82,1.92,2,2.24,2.3],n=-1,r=0;r=this._sourceCount&&(this._loadStatus=Lt,this._detachErrorHandler(this._onerror))},e._appendSourceElement=function(t){var e,i;if("object"==typeof t?(e=t.src,i=t.type):"string"==typeof t&&(e=t),!e)return!1;var n=document.createElement("source");return n.src=e,i&&(n.type=i),this._video.appendChild(n),!0},e.set=function(t){var e=this;this._reset(),t&&(t instanceof HTMLVideoElement?this._video=t:"string"!=typeof t&&"object"!=typeof t||(this._video=document.createElement("video"),this._video.setAttribute("crossorigin","anonymous"),this._video.setAttribute("webkit-playsinline",""),this._video.setAttribute("playsinline",""),t instanceof Array?t.forEach(function(t){return e._appendSourceElement(t)}):this._appendSourceElement(t),this._sourceCount=this._video.querySelectorAll("source").length,0=i._thresholdReadyState)t(i._video);else{i._attachErrorHandler(function t(){i._loadStatus===Lt&&(i._detachErrorHandler(t),e("VideoLoader: video source is invalid"))}),i._once(i._thresholdEventName,function(){return t(i._video)})}else e("VideoLoader: video is undefined")})},e.getElement=function(){return this._video},e.destroy=function(){this._reset()},e._reset=function(){var e=this;this._handlers.forEach(function(t){e._video.removeEventListener(t.type,t.fn)}),this._handlers=[],this._video=null,this._sourceCount=0,this._errorCount=0},e._once=function(e,i){function n(t){r.removeEventListener(e,n),i(t)}var r=this._video;r.addEventListener(e,n,!0),this._handlers.push({type:e,fn:n})},t}(),zt={0:"NO_ERROR",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",37442:"CONTEXT_LOST_WEBGL"},Gt=null,Bt=function(){function n(){}return n.createShader=function(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:(console.error(t.getShaderInfoLog(n)),null)},n.createProgram=function(t,e,i){var n=t.createProgram();return t.attachShader(n,e),t.attachShader(n,i),t.linkProgram(n),t.detachShader(n,e),t.detachShader(n,i),t.deleteShader(e),t.deleteShader(i),t.getProgramParameter(n,t.LINK_STATUS)?n:(t.deleteProgram(n),null)},n.initBuffer=function(t,e,i,n,r){var o=t.createBuffer();return t.bindBuffer(e,o),t.bufferData(e,i,t.STATIC_DRAW),o&&(o.itemSize=n,o.numItems=i.length/n),void 0!==r&&(t.enableVertexAttribArray(r),t.vertexAttribPointer(r,o.itemSize,t.FLOAT,!1,0,0)),o},n.getWebglContext=function(t,e){var i=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=null,r=c({preserveDrawingBuffer:!1,antialias:!1,xrCompatible:!0},e);function o(t){return t.statusMessage}t.addEventListener("webglcontextcreationerror",o);for(var a=0;a= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"},i.getVertexPositionData=function(){return this._vertices||(this._vertices=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1]),this._vertices},i.getIndexData=function(){var i=this;return function(){for(var t=[],e=0;ethis._rowCount-1||t>this._colCount-1||(this._image&&C&&(this._image.style[C]="translate("+-t/this._colCount*100+"%, "+-e/this._rowCount*100+"%)"),this._colRow=[t,e])},t.getColRow=function(){return this._colRow},o._getSizeString=function(t){return"number"==typeof t?t+"px":t},t.stop=function(){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=null)},t.play=function(t){var e=this,i=void 0===t?{interval:1e3/this._totalCount,playCount:0}:t,n=i.interval,r=i.playCount;if(this._bg){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=null);var o=this.getFrameIndex(),a=0,s=0;this._autoPlayTimer=setInterval(function(){o%=e._totalCount;var t=e.toColRow(o);e.setColRow(t[0],t[1]),o++,++s===e._totalCount&&(s=0,a++),0=this._totalCount?[e-1,i-1]:[t%e,Math.floor(t/e)]},o}(e);return t.VERSION=vt,t}(),Ue=function(){var t=function(a){function t(t,e){var n;(n=a.call(this)||this)._el=t;var i=c({},e),r=i.colCount||1,o=i.rowCount||1;return n._scale=i.scale||1,n._panScale=.21*n._scale,n._frameCount=r*o,n._sprites=new Ne(t,i).on({load:function(t){n.trigger("load",t)},imageError:function(t){n.trigger("imageError",{imageUrl:t.imageUrl})}}),n._panInput=new h.PanInput(n._el,{scale:[n._panScale,n._panScale]}),n._axes=new h({angle:{range:[0,359],circular:!0}}).on({change:function(t){var e=Math.floor(t.pos.angle/(360/n._frameCount)),i=n._frameCount-e-1;n._sprites.setFrameIndex(i),n.trigger("change",{frameIndex:i,colRow:n._sprites.getColRow(),angle:t.pos.angle})},animationEnd:function(t){n.trigger("animationEnd",{isTrusted:t.isTrusted})}}),n._axes.connect("angle",n._panInput),n}d(t,a);var e=t.prototype;return e.setScale=function(t){return isNaN(t)||t<0||(this._scale=t,this._panScale=.21*t,this._panInput.options.scale=[this._panScale,this._panScale]),this},e.getScale=function(){return this._scale},e.spinBy=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setBy({angle:t},e.duration),this},e.spinTo=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setTo({angle:t},e.duration),this},e.getAngle=function(){return this._axes.get().angle||0},t}(e);return t.VERSION=vt,t}();t.PanoViewer=Fe,t.SpinViewer=Ue,t.SpriteImage=Ne,t.VERSION=vt,Object.defineProperty(t,"__esModule",{value:!0})}); +//# sourceMappingURL=view360.min.js.map diff --git a/dist/view360.min.js.map b/dist/view360.min.js.map new file mode 100644 index 000000000..4911cc9bc --- /dev/null +++ b/dist/view360.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.min.js","sources":["../node_modules/es6-promise/dist/es6-promise.js","../src/utils/browser.js","../src/utils/browserFeature.js","../src/utils/math-util.js","../node_modules/webvr-polyfill/src/math-util.js","../node_modules/webvr-polyfill/src/util.js","../node_modules/webvr-polyfill/src/sensor-fusion/pose-predictor.js","../src/YawPitchControl/consts.js","../src/YawPitchControl/input/DeviceMotion.js","../node_modules/webvr-polyfill/src/sensor-fusion/sensor-sample.js","../node_modules/webvr-polyfill/src/sensor-fusion/complementary-filter.js","../src/YawPitchControl/input/ComplementaryFilter.js","../src/YawPitchControl/input/FusionPoseSensor.js","../src/YawPitchControl/input/TiltMotionInput.js","../src/YawPitchControl/utils.js","../src/YawPitchControl/ScreenRotationAngle.js","../src/YawPitchControl/input/RotationPanInput.js","../src/YawPitchControl/DeviceQuaternion.js","../src/version.js","../src/YawPitchControl/YawPitchControl.js","../src/PanoImageRenderer/ImageLoader.js","../src/PanoImageRenderer/VideoLoader.js","../src/PanoImageRenderer/renderer/SphereRenderer.js","../src/PanoImageRenderer/WebGLUtils.js","../src/PanoImageRenderer/renderer/Renderer.js","../src/PanoImageRenderer/renderer/CubeRenderer.js","../src/PanoImageRenderer/renderer/CubeStripRenderer.js","../src/PanoViewer/consts.js","../src/PanoImageRenderer/renderer/CylinderRenderer.js","../src/PanoImageRenderer/vr/VRManager.js","../src/PanoImageRenderer/vr/XRManager.js","../src/PanoImageRenderer/WebGLAnimator.js","../src/PanoImageRenderer/PanoImageRenderer.js","../src/PanoViewer/PanoViewer.js","../src/SpinViewer/SpriteImage.js","../src/SpinViewer/SpinViewer.js"],"sourcesContent":["/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.ES6Promise = factory());\n}(this, (function () { 'use strict';\n\nfunction objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n}\n\nfunction isFunction(x) {\n return typeof x === 'function';\n}\n\n\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve$1(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n try {\n then$$1.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then$$1) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then$$1, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$1) {\n if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$1 === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$1)) {\n handleForeignThenable(promise, maybeThenable, then$$1);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then$$1 = void 0;\n try {\n then$$1 = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then$$1);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n}\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve$$1 = c.resolve;\n\n\n if (resolve$$1 === resolve$1) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise$1) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$1) {\n return resolve$$1(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$1(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject$1(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n//# sourceMappingURL=es6-promise.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","/**\n * Original Code\n * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js\n * Math Util\n * modified by egjs\n */\n/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.2\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n// Some minimal math functionality borrowed from gl-Matrix and stripped down\n// for the purposes of this library.\n\nimport {vec2, vec3, quat} from \"gl-matrix\";\n\nfunction quatToVec3(quaternion) {\n\tconst baseV = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(baseV, baseV, quaternion);\n\treturn baseV;\n}\n\nfunction toDegree(a){\n\treturn a * 180 / Math.PI;\n}\n\nconst util = {};\n\nutil.isPowerOfTwo = function(n) {\n\treturn n && (n & (n - 1)) === 0;\n};\n\nutil.extractPitchFromQuat = function(quaternion) {\n\tconst baseV = quatToVec3(quaternion);\n\n\treturn -1 * Math.atan2(\n\t\tbaseV[1],\n\t\tMath.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2)));\n};\n\nutil.hypot = Math.hypot || function(x, y) {\n\treturn Math.sqrt(x * x + y * y);\n};\n\n// implement reference\n// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식\n// calculating angle between two vectors : http://darkpgmr.tistory.com/121\nconst ROTATE_CONSTANT = {\n\tPITCH_DELTA: 1,\n\tYAW_DELTA_BY_ROLL: 2,\n\tYAW_DELTA_BY_YAW: 3,\n};\n\nROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [0, 0, 1],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [1, 0, 0],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = {\n\ttargetAxis: [1, 0, 0],\n\tmeshPoint: [0, 0, 1],\n};\n\nfunction getRotationDelta(prevQ, curQ, rotateKind) {\n\tconst targetAxis = vec3.fromValues(\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[0],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[1],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[2]\n\t);\n\tconst meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint;\n\n\tconst prevQuaternion = quat.clone(prevQ);\n\tconst curQuaternion = quat.clone(curQ);\n\n\tquat.normalize(prevQuaternion, prevQuaternion);\n\tquat.normalize(curQuaternion, curQuaternion);\n\n\tlet prevPoint = vec3.fromValues(0, 0, 1);\n\tlet curPoint = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\tvec3.transformQuat(targetAxis, targetAxis, curQuaternion);\n\n\tconst rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint));\n\tconst rotateDirection = rotateDistance > 0 ? 1 : -1;\n\n\t// when counter clock wise, use vec3.fromValues(0,1,0)\n\t// when clock wise, use vec3.fromValues(0,-1,0)\n\t// const meshPoint1 = vec3.fromValues(0, 0, 0);\n\tconst meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\n\tlet meshPoint3;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tmeshPoint3 = vec3.fromValues(0, rotateDirection, 0);\n\t} else {\n\t\tmeshPoint3 = vec3.fromValues(rotateDirection, 0, 0);\n\t}\n\n\tvec3.transformQuat(meshPoint2, meshPoint2, curQuaternion);\n\tvec3.transformQuat(meshPoint3, meshPoint3, curQuaternion);\n\n\tconst vecU = meshPoint2;\n\tconst vecV = meshPoint3;\n\tconst vecN = vec3.create();\n\n\tvec3.cross(vecN, vecU, vecV);\n\tvec3.normalize(vecN, vecN);\n\n\tconst coefficientA = vecN[0];\n\tconst coefficientB = vecN[1];\n\tconst coefficientC = vecN[2];\n//\tconst coefficientD = -1 * vec3.dot(vecN, meshPoint1);\n\n\t// a point on the plane\n\tcurPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\n\t// a point should project on the plane\n\tprevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\n\t// distance between prevPoint and the plane\n\tlet distance = Math.abs(\n\t\tprevPoint[0] * coefficientA +\n\t\tprevPoint[1] * coefficientB +\n\t\tprevPoint[2] * coefficientC\n\t);\n\n\tconst projectedPrevPoint = vec3.create();\n\n\tvec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance));\n\n\tlet trigonometricRatio =\n\t\t(projectedPrevPoint[0] * curPoint[0] +\n\t\tprojectedPrevPoint[1] * curPoint[1] +\n\t\tprojectedPrevPoint[2] * curPoint[2]) /\n\t\t(vec3.length(projectedPrevPoint) * vec3.length(curPoint));\n\n\t// defensive block\n\ttrigonometricRatio > 1 && (trigonometricRatio = 1);\n\n\tconst theta = Math.acos(trigonometricRatio);\n\n\tconst crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint);\n\n\tdistance =\n\t\tcoefficientA * crossVec[0] +\n\t\tcoefficientB * crossVec[1] +\n\t\tcoefficientC * crossVec[2];\n\n\tlet thetaDirection;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tthetaDirection = distance > 0 ? 1 : -1;\n\t} else {\n\t\tthetaDirection = distance < 0 ? 1 : -1;\n\t}\n\n\tconst deltaRadian = theta * thetaDirection * rotateDirection;\n\n\treturn toDegree(deltaRadian);\n}\n\nfunction angleBetweenVec2(v1, v2) {\n\tconst det = v1[0] * v2[1] - v2[0] * v1[1];\n\tconst theta = -Math.atan2(det, vec2.dot(v1, v2));\n\treturn theta;\n}\n\nutil.yawOffsetBetween = function(viewDir, targetDir) {\n\tconst viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]);\n\tconst targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]);\n\n\tvec2.normalize(viewDirXZ, viewDirXZ);\n\tvec2.normalize(targetDirXZ, targetDirXZ);\n\n\tconst theta = -angleBetweenVec2(viewDirXZ, targetDirXZ);\n\n\treturn theta;\n}\n\nutil.toDegree = toDegree;\nutil.getRotationDelta = getRotationDelta;\nutil.angleBetweenVec2 = angleBetweenVec2;\n\nexport {\n\tutil,\n\tROTATE_CONSTANT,\n};\n","/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar MathUtil = window.MathUtil || {};\n\nMathUtil.degToRad = Math.PI / 180;\nMathUtil.radToDeg = 180 / Math.PI;\n\n// Some minimal math functionality borrowed from THREE.Math and stripped down\n// for the purposes of this library.\n\n\nMathUtil.Vector2 = function ( x, y ) {\n this.x = x || 0;\n this.y = y || 0;\n};\n\nMathUtil.Vector2.prototype = {\n constructor: MathUtil.Vector2,\n\n set: function ( x, y ) {\n this.x = x;\n this.y = y;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n\n return this;\n },\n\n subVectors: function ( a, b ) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n\n return this;\n },\n};\n\nMathUtil.Vector3 = function ( x, y, z ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n};\n\nMathUtil.Vector3.prototype = {\n constructor: MathUtil.Vector3,\n\n set: function ( x, y, z ) {\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n\n return this;\n },\n\n length: function () {\n return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n },\n\n normalize: function () {\n var scalar = this.length();\n\n if ( scalar !== 0 ) {\n var invScalar = 1 / scalar;\n\n this.multiplyScalar(invScalar);\n } else {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return this;\n },\n\n multiplyScalar: function ( scalar ) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n },\n\n applyQuaternion: function ( q ) {\n var x = this.x;\n var y = this.y;\n var z = this.z;\n\n var qx = q.x;\n var qy = q.y;\n var qz = q.z;\n var qw = q.w;\n\n // calculate quat * vector\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = - qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n return this;\n },\n\n dot: function ( v ) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n },\n\n crossVectors: function ( a, b ) {\n var ax = a.x, ay = a.y, az = a.z;\n var bx = b.x, by = b.y, bz = b.z;\n\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n\n return this;\n },\n};\n\nMathUtil.Quaternion = function ( x, y, z, w ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = ( w !== undefined ) ? w : 1;\n};\n\nMathUtil.Quaternion.prototype = {\n constructor: MathUtil.Quaternion,\n\n set: function ( x, y, z, w ) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n\n return this;\n },\n\n copy: function ( quaternion ) {\n this.x = quaternion.x;\n this.y = quaternion.y;\n this.z = quaternion.z;\n this.w = quaternion.w;\n\n return this;\n },\n\n setFromEulerXYZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n\n return this;\n },\n\n setFromEulerYXZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n\n return this;\n },\n\n setFromAxisAngle: function ( axis, angle ) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n\n var halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n this.x = axis.x * s;\n this.y = axis.y * s;\n this.z = axis.z * s;\n this.w = Math.cos( halfAngle );\n\n return this;\n },\n\n multiply: function ( q ) {\n return this.multiplyQuaternions( this, q );\n },\n\n multiplyQuaternions: function ( a, b ) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;\n var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;\n\n this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n return this;\n },\n\n inverse: function () {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n\n this.normalize();\n\n return this;\n },\n\n normalize: function () {\n var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n if ( l === 0 ) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 1;\n } else {\n l = 1 / l;\n\n this.x = this.x * l;\n this.y = this.y * l;\n this.z = this.z * l;\n this.w = this.w * l;\n }\n\n return this;\n },\n\n slerp: function ( qb, t ) {\n if ( t === 0 ) return this;\n if ( t === 1 ) return this.copy( qb );\n\n var x = this.x, y = this.y, z = this.z, w = this.w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z;\n\n if ( cosHalfTheta < 0 ) {\n this.w = - qb.w;\n this.x = - qb.x;\n this.y = - qb.y;\n this.z = - qb.z;\n\n cosHalfTheta = - cosHalfTheta;\n } else {\n this.copy( qb );\n }\n\n if ( cosHalfTheta >= 1.0 ) {\n this.w = w;\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n var halfTheta = Math.acos( cosHalfTheta );\n var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\n\n if ( Math.abs( sinHalfTheta ) < 0.001 ) {\n this.w = 0.5 * ( w + this.w );\n this.x = 0.5 * ( x + this.x );\n this.y = 0.5 * ( y + this.y );\n this.z = 0.5 * ( z + this.z );\n\n return this;\n }\n\n var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n this.w = ( w * ratioA + this.w * ratioB );\n this.x = ( x * ratioA + this.x * ratioB );\n this.y = ( y * ratioA + this.y * ratioB );\n this.z = ( z * ratioA + this.z * ratioB );\n\n return this;\n },\n\n setFromUnitVectors: function () {\n // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\n // assumes direction vectors vFrom and vTo are normalized\n\n var v1, r;\n var EPS = 0.000001;\n\n return function ( vFrom, vTo ) {\n if ( v1 === undefined ) v1 = new MathUtil.Vector3();\n\n r = vFrom.dot( vTo ) + 1;\n\n if ( r < EPS ) {\n r = 0;\n\n if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n v1.set( - vFrom.y, vFrom.x, 0 );\n } else {\n v1.set( 0, - vFrom.z, vFrom.y );\n }\n } else {\n v1.crossVectors( vFrom, vTo );\n }\n\n this.x = v1.x;\n this.y = v1.y;\n this.z = v1.z;\n this.w = r;\n\n this.normalize();\n\n return this;\n }\n }(),\n};\n\nmodule.exports = MathUtil;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Util = window.Util || {};\n\nUtil.MIN_TIMESTEP = 0.001;\nUtil.MAX_TIMESTEP = 1;\n\nUtil.base64 = function(mimeType, base64) {\n return 'data:' + mimeType + ';base64,' + base64;\n};\n\nUtil.clamp = function(value, min, max) {\n return Math.min(Math.max(min, value), max);\n};\n\nUtil.lerp = function(a, b, t) {\n return a + ((b - a) * t);\n};\n\n/**\n * Light polyfill for `Promise.race`. Returns\n * a promise that resolves when the first promise\n * provided resolves.\n *\n * @param {Array} promises\n */\nUtil.race = function(promises) {\n if (Promise.race) {\n return Promise.race(promises);\n }\n\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < promises.length; i++) {\n promises[i].then(resolve, reject);\n }\n });\n};\n\nUtil.isIOS = (function() {\n var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);\n return function() {\n return isIOS;\n };\n})();\n\nUtil.isWebViewAndroid = (function() {\n var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1 &&\n navigator.userAgent.indexOf('Chrome') !== -1;\n return function() {\n return isWebViewAndroid;\n };\n})();\n\nUtil.isSafari = (function() {\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n return function() {\n return isSafari;\n };\n})();\n\nUtil.isFirefoxAndroid = (function() {\n var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1;\n return function() {\n return isFirefoxAndroid;\n };\n})();\n\nUtil.isR7 = (function() {\n var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1;\n return function() {\n return isR7;\n };\n})();\n\nUtil.isLandscapeMode = function() {\n var rtn = (window.orientation == 90 || window.orientation == -90);\n return Util.isR7() ? !rtn : rtn;\n};\n\n// Helper method to validate the time steps of sensor timestamps.\nUtil.isTimestampDeltaValid = function(timestampDeltaS) {\n if (isNaN(timestampDeltaS)) {\n return false;\n }\n if (timestampDeltaS <= Util.MIN_TIMESTEP) {\n return false;\n }\n if (timestampDeltaS > Util.MAX_TIMESTEP) {\n return false;\n }\n return true;\n};\n\nUtil.getScreenWidth = function() {\n return Math.max(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.getScreenHeight = function() {\n return Math.min(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.requestFullscreen = function(element) {\n if (Util.isWebViewAndroid()) {\n return false;\n }\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.exitFullscreen = function() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.getFullscreenElement = function() {\n return document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullScreenElement ||\n document.msFullscreenElement;\n};\n\nUtil.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) {\n // No error checking for brevity.\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n for (var attribName in attribLocationMap)\n gl.bindAttribLocation(program, attribLocationMap[attribName], attribName);\n\n gl.linkProgram(program);\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n};\n\nUtil.getProgramUniforms = function(gl, program) {\n var uniforms = {};\n var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n var uniformName = '';\n for (var i = 0; i < uniformCount; i++) {\n var uniformInfo = gl.getActiveUniform(program, i);\n uniformName = uniformInfo.name.replace('[0]', '');\n uniforms[uniformName] = gl.getUniformLocation(program, uniformName);\n }\n return uniforms;\n};\n\nUtil.orthoMatrix = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\nUtil.copyArray = function (source, dest) {\n for (var i = 0, n = source.length; i < n; i++) {\n dest[i] = source[i];\n }\n};\n\nUtil.isMobile = function() {\n var check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);\n return check;\n};\n\nUtil.extend = function(dest, src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n\n return dest;\n}\n\nUtil.safariCssSizeWorkaround = function(canvas) {\n // TODO(smus): Remove this workaround when Safari for iOS is fixed.\n // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556).\n //\n // \"To the last I grapple with thee;\n // from hell's heart I stab at thee;\n // for hate's sake I spit my last breath at thee.\"\n // -- Moby Dick, by Herman Melville\n if (Util.isIOS()) {\n var width = canvas.style.width;\n var height = canvas.style.height;\n canvas.style.width = (parseInt(width) + 1) + 'px';\n canvas.style.height = (parseInt(height)) + 'px';\n setTimeout(function() {\n canvas.style.width = width;\n canvas.style.height = height;\n }, 100);\n }\n\n // Debug only.\n window.Util = Util;\n window.canvas = canvas;\n};\n\nUtil.isDebug = function() {\n return Util.getQueryParameter('debug');\n};\n\nUtil.getQueryParameter = function(name) {\n var name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n results = regex.exec(location.search);\n return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n};\n\nUtil.frameDataFromPose = (function() {\n var piOver180 = Math.PI / 180.0;\n var rad45 = Math.PI * 0.25;\n\n // Borrowed from glMatrix.\n function mat4_perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45),\n downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45),\n leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45),\n rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n\n function mat4_fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n };\n\n function mat4_translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n };\n\n function mat4_invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n };\n\n var defaultOrientation = new Float32Array([0, 0, 0, 1]);\n var defaultPosition = new Float32Array([0, 0, 0]);\n\n function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) {\n mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar);\n\n var orientation = pose.orientation || defaultOrientation;\n var position = pose.position || defaultPosition;\n\n mat4_fromRotationTranslation(view, orientation, position);\n if (parameters)\n mat4_translate(view, view, parameters.offset);\n mat4_invert(view, view);\n }\n\n return function(frameData, pose, vrDisplay) {\n if (!frameData || !pose)\n return false;\n\n frameData.pose = pose;\n frameData.timestamp = pose.timestamp;\n\n updateEyeMatrices(\n frameData.leftProjectionMatrix, frameData.leftViewMatrix,\n pose, vrDisplay.getEyeParameters(\"left\"), vrDisplay);\n updateEyeMatrices(\n frameData.rightProjectionMatrix, frameData.rightViewMatrix,\n pose, vrDisplay.getEyeParameters(\"right\"), vrDisplay);\n\n return true;\n };\n})();\n\nUtil.isInsideCrossDomainIFrame = function() {\n var isFramed = (window.self !== window.top);\n var refDomain = Util.getDomainFromUrl(document.referrer);\n var thisDomain = Util.getDomainFromUrl(window.location.href);\n\n return isFramed && (refDomain !== thisDomain);\n};\n\n// From http://stackoverflow.com/a/23945027.\nUtil.getDomainFromUrl = function(url) {\n var domain;\n // Find & remove protocol (http, ftp, etc.) and get domain.\n if (url.indexOf(\"://\") > -1) {\n domain = url.split('/')[2];\n }\n else {\n domain = url.split('/')[0];\n }\n\n //find & remove port number\n domain = domain.split(':')[0];\n\n return domain;\n}\n\nmodule.exports = Util;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar MathUtil = require('../math-util');\nvar Util = require('../util');\n\n/**\n * Given an orientation and the gyroscope data, predicts the future orientation\n * of the head. This makes rendering appear faster.\n *\n * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf\n *\n * @param {Number} predictionTimeS time from head movement to the appearance of\n * the corresponding image.\n */\nfunction PosePredictor(predictionTimeS) {\n this.predictionTimeS = predictionTimeS;\n\n // The quaternion corresponding to the previous state.\n this.previousQ = new MathUtil.Quaternion();\n // Previous time a prediction occurred.\n this.previousTimestampS = null;\n\n // The delta quaternion that adjusts the current pose.\n this.deltaQ = new MathUtil.Quaternion();\n // The output quaternion.\n this.outQ = new MathUtil.Quaternion();\n}\n\nPosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) {\n if (!this.previousTimestampS) {\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n return currentQ;\n }\n\n // Calculate axis and angle based on gyroscope rotation rate data.\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n\n var angularSpeed = gyro.length();\n\n // If we're rotating slowly, don't do prediction.\n if (angularSpeed < MathUtil.degToRad * 20) {\n if (Util.isDebug()) {\n console.log('Moving slowly, at %s deg/s: no prediction',\n (MathUtil.radToDeg * angularSpeed).toFixed(1));\n }\n this.outQ.copy(currentQ);\n this.previousQ.copy(currentQ);\n return this.outQ;\n }\n\n // Get the predicted angle based on the time delta and latency.\n var deltaT = timestampS - this.previousTimestampS;\n var predictAngle = angularSpeed * this.predictionTimeS;\n\n this.deltaQ.setFromAxisAngle(axis, predictAngle);\n this.outQ.copy(this.previousQ);\n this.outQ.multiply(this.deltaQ);\n\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n\n return this.outQ;\n};\n\n\nmodule.exports = PosePredictor;\n","import {userAgent} from \"../utils/browserFeature\";\n/**\n * Returns a number value indiciating the version of Chrome being used,\n * or otherwise `null` if not on Chrome.\n *\n * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19\n */\n/**\n * In Chrome m65, `devicemotion` events are broken but subsequently fixed\n * in 65.0.3325.148. Since many browsers use Chromium, ensure that\n * we scope this detection by branch and build numbers to provide\n * a proper fallback.\n * https://github.com/immersive-web/webvr-polyfill/issues/307\n */\nlet version = -1; // It should not be null because it will be compared with number\nlet branch = null;\nlet build = null;\n\nconst match = /Chrome\\/([0-9]+)\\.(?:[0-9]*)\\.([0-9]*)\\.([0-9]*)/i.exec(userAgent);\n\nif (match) {\n\tversion = parseInt(match[1], 10);\n\tbranch = match[2];\n\tbuild = match[3];\n}\n\nconst CHROME_VERSION = version;\nconst IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === \"3325\" && parseInt(build, 10) < 148;\nconst IS_ANDROID = /Android/i.test(userAgent);\n\nconst CONTROL_MODE_VR = 1;\nconst CONTROL_MODE_YAWPITCH = 2;\n\nconst TOUCH_DIRECTION_NONE = 1;\nconst TOUCH_DIRECTION_YAW = 2;\nconst TOUCH_DIRECTION_PITCH = 4;\nconst TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH;\n\n/* Const for MovableCoord */\nconst MC_DECELERATION = 0.0014;\nconst MC_MAXIMUM_DURATION = 1000;\nconst MC_BIND_SCALE = [0.20, 0.20];\n\nconst MIN_FIELD_OF_VIEW = 20;\nconst MAX_FIELD_OF_VIEW = 110;\nconst PAN_SCALE = 320;\n\n// const DELTA_THRESHOLD = 0.015;\n// const DELTA_THRESHOLD = 0.09; // Note4\n// const DELTA_THRESHOLD = 0.0825;\n// const DELTA_THRESHOLD = 0.075;\n// const DELTA_THRESHOLD = 0.06;\n// const DELTA_THRESHOLD = 0.045;\nconst DELTA_THRESHOLD = 0.0375; // Note2\n\nconst YAW_RANGE_HALF = 180;\nconst PITCH_RANGE_HALF = 90;\nconst CIRCULAR_PITCH_RANGE_HALF = 180;\nconst PINCH_EVENTS = \"pinchstart pinchmove pinchend\";\n\nconst KEYMAP = {\n\tLEFT_ARROW: 37,\n\tA: 65,\n\tUP_ARROW: 38,\n\tW: 87,\n\tRIGHT_ARROW: 39,\n\tD: 68,\n\tDOWN_ARROW: 40,\n\tS: 83,\n};\n\nconst GYRO_MODE = {\n\tNONE: \"none\",\n\tYAWPITCH: \"yawPitch\",\n\tVR: \"VR\"\n};\n\nexport {\n\tGYRO_MODE,\n\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\n\tTOUCH_DIRECTION_NONE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMIN_FIELD_OF_VIEW,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tDELTA_THRESHOLD,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tPINCH_EVENTS,\n\tKEYMAP,\n\n\tCHROME_VERSION,\n\tIS_CHROME_WITHOUT_DEVICE_MOTION,\n\tIS_ANDROID\n};\n","import Component from \"@egjs/component\";\nimport {vec3} from \"gl-matrix\";\nimport {window} from \"../../utils/browser\";\nimport {IS_CHROME_WITHOUT_DEVICE_MOTION, IS_ANDROID} from \"../consts\";\n\nconst STILLNESS_THRESHOLD = 200; // millisecond\n\nexport default class DeviceMotion extends Component {\n\tconstructor() {\n\t\tsuper();\n\t\tthis._onDeviceMotion = this._onDeviceMotion.bind(this);\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onChromeWithoutDeviceMotion = this._onChromeWithoutDeviceMotion.bind(this);\n\n\t\tthis.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION;\n\t\tthis.isAndroid = IS_ANDROID;\n\n\t\tthis.stillGyroVec = vec3.create();\n\t\tthis.rawGyroVec = vec3.create();\n\t\tthis.adjustedGyroVec = vec3.create();\n\n\t\tthis._timer = null;\n\n\t\tthis.lastDevicemotionTimestamp = 0;\n\t\tthis._isEnabled = false;\n\t\tthis.enable();\n\t}\n\t_onChromeWithoutDeviceMotion(e) {\n\t\tlet {alpha, beta, gamma} = e;\n\n\t\t// There is deviceorientation event trigged with empty values\n\t\t// on Headless Chrome.\n\t\tif (alpha === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// convert to radian\n\t\talpha = (alpha || 0) * Math.PI / 180;\n\t\tbeta = (beta || 0) * Math.PI / 180;\n\t\tgamma = (gamma || 0) * Math.PI / 180;\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: {\n\t\t\t\tdeviceorientation: {\n\t\t\t\t\talpha,\n\t\t\t\t\tbeta,\n\t\t\t\t\tgamma: -gamma\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t_onDeviceOrientation() {\n\t\tthis._timer && clearTimeout(this._timer);\n\t\tthis._timer = setTimeout(() => {\n\t\t\tif ((new Date().getTime() - this.lastDevicemotionTimestamp) < STILLNESS_THRESHOLD) {\n\t\t\t\tvec3.copy(this.stillGyroVec, this.rawGyroVec);\n\t\t\t}\n\t\t}, STILLNESS_THRESHOLD);\n\t}\n\t_onDeviceMotion(e) {\n\t\t// desktop chrome triggers devicemotion event with empthy sensor values.\n\t\t// Those events should ignored.\n\t\tconst isGyroSensorAvailable = !(e.rotationRate.alpha == null);\n\t\tconst isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null);\n\n\t\tif (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst devicemotionEvent = Object.assign({}, e);\n\n\t\tdevicemotionEvent.interval = e.interval;\n\t\tdevicemotionEvent.timeStamp = e.timeStamp;\n\t\tdevicemotionEvent.type = e.type;\n\t\tdevicemotionEvent.rotationRate = {\n\t\t\talpha: e.rotationRate.alpha,\n\t\t\tbeta: e.rotationRate.beta,\n\t\t\tgamma: e.rotationRate.gamma,\n\t\t};\n\t\tdevicemotionEvent.accelerationIncludingGravity = {\n\t\t\tx: e.accelerationIncludingGravity.x,\n\t\t\ty: e.accelerationIncludingGravity.y,\n\t\t\tz: e.accelerationIncludingGravity.z,\n\t\t};\n\t\tdevicemotionEvent.acceleration = {\n\t\t\tx: e.acceleration.x,\n\t\t\ty: e.acceleration.y,\n\t\t\tz: e.acceleration.z,\n\t\t};\n\n\t\tif (this.isAndroid) {\n\t\t\tvec3.set(\n\t\t\t\tthis.rawGyroVec,\n\t\t\t\te.rotationRate.alpha || 0,\n\t\t\t\te.rotationRate.beta || 0,\n\t\t\t\te.rotationRate.gamma || 0);\n\t\t\tvec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec);\n\t\t\tthis.lastDevicemotionTimestamp = new Date().getTime();\n\n\t\t\tdevicemotionEvent.adjustedRotationRate = {\n\t\t\t\talpha: this.adjustedGyroVec[0],\n\t\t\t\tbeta: this.adjustedGyroVec[1],\n\t\t\t\tgamma: this.adjustedGyroVec[2]};\n\t\t}\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: devicemotionEvent\n\t\t});\n\t}\n\tenable() {\n\t\tif (this.isAndroid) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\t}\n\t\tif (this.isWithoutDeviceMotion) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\t} else {\n\t\t\twindow.addEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\t}\n\t\tthis._isEnabled = true;\n\t}\n\tdisable() {\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\twindow.removeEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\tthis._isEnabled = false;\n\t}\n}\n","function SensorSample(sample, timestampS) {\n this.set(sample, timestampS);\n};\n\nSensorSample.prototype.set = function(sample, timestampS) {\n this.sample = sample;\n this.timestampS = timestampS;\n};\n\nSensorSample.prototype.copy = function(sensorSample) {\n this.set(sensorSample.sample, sensorSample.timestampS);\n};\n\nmodule.exports = SensorSample;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar SensorSample = require('./sensor-sample.js');\nvar MathUtil = require('../math-util.js');\nvar Util = require('../util.js');\n\n/**\n * An implementation of a simple complementary filter, which fuses gyroscope and\n * accelerometer data from the 'devicemotion' event.\n *\n * Accelerometer data is very noisy, but stable over the long term.\n * Gyroscope data is smooth, but tends to drift over the long term.\n *\n * This fusion is relatively simple:\n * 1. Get orientation estimates from accelerometer by applying a low-pass filter\n * on that data.\n * 2. Get orientation estimates from gyroscope by integrating over time.\n * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the\n * short term.\n */\nfunction ComplementaryFilter(kFilter) {\n this.kFilter = kFilter;\n\n // Raw sensor measurements.\n this.currentAccelMeasurement = new SensorSample();\n this.currentGyroMeasurement = new SensorSample();\n this.previousGyroMeasurement = new SensorSample();\n\n // Set default look direction to be in the correct direction.\n if (Util.isIOS()) {\n this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1);\n } else {\n this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1);\n }\n this.previousFilterQ = new MathUtil.Quaternion();\n this.previousFilterQ.copy(this.filterQ);\n\n // Orientation based on the accelerometer.\n this.accelQ = new MathUtil.Quaternion();\n // Whether or not the orientation has been initialized.\n this.isOrientationInitialized = false;\n // Running estimate of gravity based on the current orientation.\n this.estimatedGravity = new MathUtil.Vector3();\n // Measured gravity based on accelerometer.\n this.measuredGravity = new MathUtil.Vector3();\n\n // Debug only quaternion of gyro-based orientation.\n this.gyroIntegralQ = new MathUtil.Quaternion();\n}\n\nComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) {\n this.currentAccelMeasurement.set(vector, timestampS);\n};\n\nComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {\n this.currentGyroMeasurement.set(vector, timestampS);\n\n var deltaT = timestampS - this.previousGyroMeasurement.timestampS;\n if (Util.isTimestampDeltaValid(deltaT)) {\n this.run_();\n }\n\n this.previousGyroMeasurement.copy(this.currentGyroMeasurement);\n};\n\nComplementaryFilter.prototype.run_ = function() {\n\n if (!this.isOrientationInitialized) {\n this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n this.previousFilterQ.copy(this.accelQ);\n this.isOrientationInitialized = true;\n return;\n }\n\n var deltaT = this.currentGyroMeasurement.timestampS -\n this.previousGyroMeasurement.timestampS;\n\n // Convert gyro rotation vector to a quaternion delta.\n var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n this.gyroIntegralQ.multiply(gyroDeltaQ);\n\n // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n this.filterQ.copy(this.previousFilterQ);\n this.filterQ.multiply(gyroDeltaQ);\n\n // Calculate the delta between the current estimated gravity and the real\n // gravity vector from accelerometer.\n var invFilterQ = new MathUtil.Quaternion();\n invFilterQ.copy(this.filterQ);\n invFilterQ.inverse();\n\n this.estimatedGravity.set(0, 0, -1);\n this.estimatedGravity.applyQuaternion(invFilterQ);\n this.estimatedGravity.normalize();\n\n this.measuredGravity.copy(this.currentAccelMeasurement.sample);\n this.measuredGravity.normalize();\n\n // Compare estimated gravity with measured gravity, get the delta quaternion\n // between the two.\n var deltaQ = new MathUtil.Quaternion();\n deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n deltaQ.inverse();\n\n if (Util.isDebug()) {\n console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)',\n MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ),\n (this.estimatedGravity.x).toFixed(1),\n (this.estimatedGravity.y).toFixed(1),\n (this.estimatedGravity.z).toFixed(1),\n (this.measuredGravity.x).toFixed(1),\n (this.measuredGravity.y).toFixed(1),\n (this.measuredGravity.z).toFixed(1));\n }\n\n // Calculate the SLERP target: current orientation plus the measured-estimated\n // quaternion delta.\n var targetQ = new MathUtil.Quaternion();\n targetQ.copy(this.filterQ);\n targetQ.multiply(deltaQ);\n\n // SLERP factor: 0 is pure gyro, 1 is pure accel.\n this.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n this.previousFilterQ.copy(this.filterQ);\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n return this.filterQ;\n};\n\nComplementaryFilter.prototype.accelToQuaternion_ = function(accel) {\n var normAccel = new MathUtil.Vector3();\n normAccel.copy(accel);\n normAccel.normalize();\n var quat = new MathUtil.Quaternion();\n quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel);\n quat.inverse();\n return quat;\n};\n\nComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) {\n // Extract axis and angle from the gyroscope data.\n var quat = new MathUtil.Quaternion();\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n quat.setFromAxisAngle(axis, gyro.length() * dt);\n return quat;\n};\n\n\nmodule.exports = ComplementaryFilter;\n","import MathUtil from \"webvr-polyfill/src/math-util\";\nimport ComplementaryFilter from \"webvr-polyfill/src/sensor-fusion/complementary-filter\";\n\nComplementaryFilter.prototype.run_ = function() {\n\tif (!this.isOrientationInitialized) {\n\t\tthis.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n\t\tthis.previousFilterQ.copy(this.accelQ);\n\t\tthis.isOrientationInitialized = true;\n\t\treturn;\n\t}\n\n\tconst deltaT = this.currentGyroMeasurement.timestampS -\n\tthis.previousGyroMeasurement.timestampS;\n\n\t// Convert gyro rotation vector to a quaternion delta.\n\tconst gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n\n\tthis.gyroIntegralQ.multiply(gyroDeltaQ);\n\n\t// filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n\tthis.filterQ.copy(this.previousFilterQ);\n\tthis.filterQ.multiply(gyroDeltaQ);\n\n\t// Calculate the delta between the current estimated gravity and the real\n\t// gravity vector from accelerometer.\n\tconst invFilterQ = new MathUtil.Quaternion();\n\n\tinvFilterQ.copy(this.filterQ);\n\tinvFilterQ.inverse();\n\n\tthis.estimatedGravity.set(0, 0, -1);\n\tthis.estimatedGravity.applyQuaternion(invFilterQ);\n\tthis.estimatedGravity.normalize();\n\n\tthis.measuredGravity.copy(this.currentAccelMeasurement.sample);\n\tthis.measuredGravity.normalize();\n\n\t// Compare estimated gravity with measured gravity, get the delta quaternion\n\t// between the two.\n\tconst deltaQ = new MathUtil.Quaternion();\n\n\tdeltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n\tdeltaQ.inverse();\n\n\t// Calculate the SLERP target: current orientation plus the measured-estimated\n\t// quaternion delta.\n\tconst targetQ = new MathUtil.Quaternion();\n\n\ttargetQ.copy(this.filterQ);\n\ttargetQ.multiply(deltaQ);\n\n\t// SLERP factor: 0 is pure gyro, 1 is pure accel.\n\tthis.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n\tthis.previousFilterQ.copy(this.filterQ);\n\n\tif (!this.isFilterQuaternionInitialized) {\n\t\tthis.isFilterQuaternionInitialized = true;\n\t}\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n\tif (this.isFilterQuaternionInitialized) {\n\t\treturn this.filterQ;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexport default ComplementaryFilter;\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport PosePredictor from \"webvr-polyfill/src/sensor-fusion/pose-predictor\";\nimport MathUtil from \"webvr-polyfill/src/math-util\";\nimport Util from \"webvr-polyfill/src/util\";\nimport {window, IS_IOS, IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\nimport DeviceMotion from \"./DeviceMotion\";\nimport ComplementaryFilter from \"./ComplementaryFilter\";\nimport {CHROME_VERSION} from \"../consts\";\n\nconst K_FILTER = 0.98;\nconst PREDICTION_TIME_S = 0.040;\n\nexport default class FusionPoseSensor extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.deviceMotion = new DeviceMotion();\n\n\t\tthis.accelerometer = new MathUtil.Vector3();\n\t\tthis.gyroscope = new MathUtil.Vector3();\n\n\t\tthis._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);\n\t\tthis._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);\n\n\t\tthis.filter = new ComplementaryFilter(K_FILTER);\n\t\tthis.posePredictor = new PosePredictor(PREDICTION_TIME_S);\n\n\t\tthis.filterToWorldQ = new MathUtil.Quaternion();\n\n\t\tthis.isFirefoxAndroid = Util.isFirefoxAndroid();\n\t\t// This includes iPhone & iPad(both desktop and mobile mode) ref #326\n\t\tthis.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP;\n\n\t\t// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18\n\t\tthis.isChromeUsingDegrees = CHROME_VERSION >= 66;\n\n\t\tthis._isEnabled = false;\n\n\t\t// Set the filter to world transform, depending on OS.\n\t\tif (this.isIOS) {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);\n\t\t} else {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);\n\t\t}\n\n\t\tthis.inverseWorldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.worldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1),\n\t\t\t-window.orientation * Math.PI / 180);\n\n\t\tthis._setScreenTransform();\n\t\t// Adjust this filter for being in landscape mode.\n\t\tif (Util.isLandscapeMode()) {\n\t\t\tthis.filterToWorldQ.multiply(this.inverseWorldToScreenQ);\n\t\t}\n\n\t\t// Keep track of a reset transform for resetSensor.\n\t\tthis.resetQ = new MathUtil.Quaternion();\n\n\t\tthis.deviceMotion.on(\"devicemotion\", this._onDeviceMotionChange);\n\t\tthis.enable();\n\t}\n\tenable() {\n\t\tif (this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.enable();\n\t\tthis._isEnabled = true;\n\t\twindow.addEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tdisable() {\n\t\tif (!this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.disable();\n\t\tthis._isEnabled = false;\n\t\twindow.removeEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tisEnabled() {\n\t\treturn this._isEnabled;\n\t}\n\tdestroy() {\n\t\tthis.disable();\n\t\tthis.deviceMotion = null;\n\t}\n\t_triggerChange() {\n\t\tconst orientation = this.getOrientation();\n\n\t\t// if orientation is not prepared. don't trigger change event\n\t\tif (!orientation) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._prevOrientation) {\n\t\t\tthis._prevOrientation = orientation;\n\t\t\treturn;\n\t\t}\n\n\t\tif (quat.equals(this._prevOrientation, orientation)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.trigger(\"change\", {quaternion: orientation});\n\t}\n\tgetOrientation() {\n\t\tlet orientation;\n\n\t\t// Hack around using deviceorientation instead of devicemotion\n\t\tif (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) {\n\t\t\tthis.deviceOrientationFixQ = this.deviceOrientationFixQ || (() => {\n\t\t\t\tconst y = new MathUtil.Quaternion()\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -this._alpha);\n\n\t\t\t\treturn y;\n\t\t\t})();\n\n\t\t\torientation = this._deviceOrientationQ;\n\t\t\tconst out = new MathUtil.Quaternion();\n\n\t\t\tout.copy(orientation);\n\t\t\tout.multiply(this.filterToWorldQ);\n\t\t\tout.multiply(this.resetQ);\n\t\t\tout.multiply(this.worldToScreenQ);\n\t\t\tout.multiplyQuaternions(this.deviceOrientationFixQ, out);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t} else {\n\t\t\t// Convert from filter space to the the same system used by the\n\t\t\t// deviceorientation event.\n\t\t\torientation = this.filter.getOrientation();\n\n\t\t\tif (!orientation) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst out = this._convertFusionToPredicted(orientation);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t}\n\t}\n\t_convertFusionToPredicted(orientation) {\n\t\t// Predict orientation.\n\t\tthis.predictedQ =\n\t\t\tthis.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS);\n\n\t\t// Convert to THREE coordinate system: -Z forward, Y up, X right.\n\t\tconst out = new MathUtil.Quaternion();\n\n\t\tout.copy(this.filterToWorldQ);\n\t\tout.multiply(this.resetQ);\n\t\tout.multiply(this.predictedQ);\n\t\tout.multiply(this.worldToScreenQ);\n\n\t\treturn out;\n\t}\n\t_onDeviceMotionChange({inputEvent}) {\n\t\tconst deviceorientation = inputEvent.deviceorientation;\n\t\tconst deviceMotion = inputEvent;\n\t\tconst accGravity = deviceMotion.accelerationIncludingGravity;\n\t\tconst rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate;\n\t\tlet timestampS = deviceMotion.timeStamp / 1000;\n\n\t\tif (deviceorientation) {\n\t\t\tif (!this._alpha) {\n\t\t\t\tthis._alpha = deviceorientation.alpha;\n\t\t\t}\n\t\t\tthis._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion();\n\t\t\tthis._deviceOrientationQ.setFromEulerYXZ(\n\t\t\t\tdeviceorientation.beta,\n\t\t\t\tdeviceorientation.alpha,\n\t\t\t\tdeviceorientation.gamma\n\t\t\t);\n\n\t\t\tthis._triggerChange();\n\t\t} else {\n\t\t\t// Firefox Android timeStamp returns one thousandth of a millisecond.\n\t\t\tif (this.isFirefoxAndroid) {\n\t\t\t\ttimestampS /= 1000;\n\t\t\t}\n\n\t\t\tthis.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z);\n\t\t\tthis.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma);\n\n\t\t\t// Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate`\n\t\t\t// is reported in degrees, so we first convert to radians.\n\t\t\tif (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) {\n\t\t\t\tthis.gyroscope.multiplyScalar(Math.PI / 180);\n\t\t\t}\n\n\t\t\tthis.filter.addAccelMeasurement(this.accelerometer, timestampS);\n\t\t\tthis.filter.addGyroMeasurement(this.gyroscope, timestampS);\n\n\t\t\tthis._triggerChange();\n\n\t\t\tthis.previousTimestampS = timestampS;\n\t\t}\n\t}\n\t_onScreenOrientationChange(screenOrientation) {\n\t\tthis._setScreenTransform(window.orientation);\n\t}\n\t_setScreenTransform() {\n\t\tthis.worldToScreenQ.set(0, 0, 0, 1);\n\n\t\tconst orientation = window.orientation;\n\n\t\tswitch (orientation) {\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tcase 90:\n\t\t\tcase -90:\n\t\t\tcase 180:\n\t\t\t\tthis.worldToScreenQ\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.inverseWorldToScreenQ.copy(this.worldToScreenQ);\n\t\tthis.inverseWorldToScreenQ.inverse();\n\t}\n}\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport {toAxis} from \"../utils\";\nimport FusionPoseSensor from \"./FusionPoseSensor\";\nimport {util, ROTATE_CONSTANT} from \"../../utils/math-util\";\n\nfunction getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(util.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nfunction getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n\nexport default class TiltMotionInput extends Component {\n\tconstructor(el, options) {\n\t\tsuper();\n\t\tthis.element = el;\n\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\n\t\tthis.fusionPoseSensor = null;\n\n\t\tthis.options = Object.assign({\n\t\t\tscale: 1,\n\t\t\tthreshold: 0,\n\t\t}, options);\n\n\t\tthis._onPoseChange = this._onPoseChange.bind(this);\n\t}\n\tmapAxes(axes) {\n\t\tthis.axes = axes;\n\t}\n\tconnect(observer) {\n\t\tif (this.observer) {\n\t\t\treturn this;\n\t\t}\n\t\tthis.observer = observer;\n\t\tthis.fusionPoseSensor = new FusionPoseSensor();\n\t\tthis.fusionPoseSensor.enable();\n\t\tthis._attachEvent();\n\t\treturn this;\n\t}\n\tdisconnect() {\n\t\tif (!this.observer) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._dettachEvent();\n\t\tthis.fusionPoseSensor.disable();\n\t\tthis.fusionPoseSensor.destroy();\n\t\tthis.fusionPoseSensor = null;\n\t\tthis.observer = null;\n\t\treturn this;\n\t}\n\tdestroy() {\n\t\tthis.disconnect();\n\t\tthis.element = null;\n\t\tthis.options = null;\n\t\tthis.axes = null;\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\t}\n\t_onPoseChange(event) {\n\t\tif (!this._prevQuaternion) {\n\t\t\tthis._prevQuaternion = quat.clone(event.quaternion);\n\t\t\tthis._quaternion = quat.clone(event.quaternion);\n\t\t\treturn;\n\t\t}\n\n\t\tquat.copy(this._prevQuaternion, this._quaternion);\n\t\tquat.copy(this._quaternion, event.quaternion);\n\n\t\tthis.observer.change(this, event, toAxis(this.axes, [\n\t\t\tgetDeltaYaw(this._prevQuaternion, this._quaternion),\n\t\t\tgetDeltaPitch(this._prevQuaternion, this._quaternion)\n\t\t]));\n\t}\n\t_attachEvent() {\n\t\tthis.fusionPoseSensor.on(\"change\", this._onPoseChange);\n\t}\n\t_dettachEvent() {\n\t\tthis.fusionPoseSensor.off(\"change\", this._onPoseChange);\n\t}\n}\n","import {\n\tutil as mathUtil,\n\tROTATE_CONSTANT,\n} from \"../utils/math-util\";\n\nexport function toAxis(source, offset) {\n\treturn offset.reduce((acc, v, i) => {\n\t\tif (source[i]) {\n\t\t\tacc[source[i]] = v;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(mathUtil.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nexport function getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n","import {glMatrix} from \"gl-matrix\";\nimport {window} from \"../utils/browser\";\n\n// Singleton\nlet screenRotationAngleInst = null;\nlet refCount = 0;\n\nexport default class ScreenRotationAngle {\n\tconstructor() {\n\t\trefCount++;\n\n\t\tif (screenRotationAngleInst) {\n\t\t\treturn screenRotationAngleInst;\n\t\t}\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = this;\n\t\t/* eslint-enable */\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onOrientationChange = this._onOrientationChange.bind(this);\n\n\t\tthis._spinR = 0;\n\n\t\tthis._screenOrientationAngle = 0;\n\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.addEventListener(\"orientationchange\", this._onOrientationChange);\n\t}\n\n\t_onDeviceOrientation(e) {\n\t\tif (e.beta === null || e.gamma === null) {\n\t\t\t// (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it.\n\t\t\treturn;\n\t\t}\n\n\t\t// Radian\n\t\tconst betaR = glMatrix.toRadian(e.beta);\n\t\tconst gammaR = glMatrix.toRadian(e.gamma);\n\n\t\t/* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */\n\t\tthis._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR));\n\t}\n\n\t_onOrientationChange(e) {\n\t\tif (window.screen && window.screen.orientation && window.screen.orientation.angle !== undefined) {\n\t\t\tthis._screenOrientationAngle = screen.orientation.angle;\n\t\t} else if (window.orientation !== undefined) {\n\t\t\t/* iOS */\n\t\t\tthis._screenOrientationAngle = window.orientation >= 0 ?\n\t\t\t\twindow.orientation : 360 + window.orientation;\n\t\t}\n\t}\n\n\tgetRadian() {\n\t\t// Join with screen orientation\n\t\t// this._testVal = this._spinR + \", \" + this._screenOrientationAngle + \", \" + window.orientation;\n\t\treturn this._spinR + glMatrix.toRadian(this._screenOrientationAngle);\n\t}\n\n\tunref() {\n\t\tif (--refCount > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"orientationchange\", this._onOrientationChange);\n\n\t\tthis._spinR = 0;\n\t\tthis._screenOrientationAngle = 0;\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = null;\n\t\t/* eslint-enable */\n\t\trefCount = 0;\n\t}\n}\n","import Axes, {PanInput} from \"@egjs/axes\";\nimport ScreenRotationAngle from \"../ScreenRotationAngle\";\n\n/**\n * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle.\n *\n * The reason for using this function is that in VR mode,\n * the roll angle is adjusted in the direction opposite to the screen rotation angle.\n *\n * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.\n * @extends PanInput\n */\nexport default class RotationPanInput extends PanInput {\n\t/**\n\t * Constructor\n\t *\n\t * @private\n\t * @param {HTMLElement} el target element\n\t * @param {Object} [options] The option object\n\t * @param {Boolean} [options.useRotation] Whether to use rotation(or VR)\n\t */\n\tconstructor(el, options) {\n\t\tsuper(el, options);\n\n\t\tthis._useRotation = false;\n\t\tthis._screenRotationAngle = null;\n\n\t\tthis.setUseRotation(!!(options && options.useRotation));\n\n\t\tthis._userDirection = Axes.DIRECTION_ALL;\n\t}\n\n\tsetUseRotation(useRotation) {\n\t\tthis._useRotation = useRotation;\n\n\t\tif (this._screenRotationAngle) {\n\t\t\tthis._screenRotationAngle.unref();\n\t\t\tthis._screenRotationAngle = null;\n\t\t}\n\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle = new ScreenRotationAngle();\n\t\t}\n\t}\n\n\tconnect(observer) {\n\t\t// User intetened direction\n\t\tthis._userDirection = this._direction;\n\n\t\t// In VR Mode, Use ALL direction if direction is not none\n\t\t// Because horizontal and vertical is changed dynamically by screen rotation.\n\t\t// this._direction is used to initialize hammerjs\n\t\tif (this._useRotation && (this._direction & Axes.DIRECTION_ALL)) {\n\t\t\tthis._direction = Axes.DIRECTION_HORIZONTAL;\n\t\t}\n\n\t\tsuper.connect(observer);\n\t}\n\n\tgetOffset(properties, useDirection) {\n\t\tif (this._useRotation === false) {\n\t\t\treturn super.getOffset(properties, useDirection);\n\t\t}\n\n\t\tconst offset = super.getOffset(properties, [true, true]);\n\t\tconst newOffset = [0, 0];\n\n\t\tconst theta = this._screenRotationAngle.getRadian();\n\n\t\tconst cosTheta = Math.cos(theta);\n\t\tconst sinTheta = Math.sin(theta);\n\n\t\t// RotateZ\n\t\tnewOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta;\n\t\tnewOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta;\n\n\t\t// Use only user allowed direction.\n\t\tif (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) {\n\t\t\tnewOffset[0] = 0;\n\t\t} else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) {\n\t\t\tnewOffset[1] = 0;\n\t\t}\n\n\t\treturn newOffset;\n\t}\n\n\tdestroy() {\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle && this._screenRotationAngle.unref();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n\n/**\n * Override getDirectionByAngle to return DIRECTION_ALL\n * Ref: https://github.com/naver/egjs-axes/issues/99\n *\n * But we obey axes's rule. If axes's rule is problem, let's apply following code.\n */\n// PanInput.getDirectionByAngle = function (angle, thresholdAngle) {\n// \treturn DIRECTION_ALL;\n// };\n","import Component from \"@egjs/component\";\nimport {vec3, glMatrix, quat} from \"gl-matrix\";\nimport FusionPoseSensor from \"./input/FusionPoseSensor\";\n\nconst Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0);\n\nexport default class DeviceQuaternion extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._fusionPoseSensor = new FusionPoseSensor();\n\t\tthis._quaternion = quat.create();\n\n\t\tthis._fusionPoseSensor.enable();\n\t\tthis._fusionPoseSensor.on(\"change\", e => {\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis.trigger(\"change\", {isTrusted: true});\n\t\t});\n\t}\n\n\tgetCombinedQuaternion(yaw) {\n\t\tconst yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw));\n\t\tconst conj = quat.conjugate(quat.create(), this._quaternion);\n\t\t// Multiply pitch quaternion -> device quaternion -> yaw quaternion\n\t\tconst outQ = quat.multiply(quat.create(), conj, yawQ);\n\n\t\treturn outQ;\n\t}\n\n\tdestroy() {\n\t\t// detach all event handler\n\t\tthis.off();\n\n\t\tif (this._fusionPoseSensor) {\n\t\t\tthis._fusionPoseSensor.off();\n\t\t\tthis._fusionPoseSensor.destroy();\n\t\t\tthis._fusionPoseSensor = null;\n\t\t}\n\t}\n}\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport Axes, {PinchInput, MoveKeyInput, WheelInput} from \"@egjs/axes\";\nimport {vec2, glMatrix} from \"gl-matrix\";\nimport {getComputedStyle, SUPPORT_TOUCH, SUPPORT_DEVICEMOTION} from \"../utils/browserFeature\";\nimport TiltMotionInput from \"./input/TiltMotionInput\";\nimport RotationPanInput from \"./input/RotationPanInput\";\nimport DeviceQuaternion from \"./DeviceQuaternion\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {\n\tGYRO_MODE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\tTOUCH_DIRECTION_NONE,\n} from \"./consts\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF];\nconst DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF];\nconst CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF];\n\n/**\n * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates.\n *\n * @alias eg.YawPitchControl\n * @extends eg.Component\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n */\nclass YawPitchControl extends Component {\n\tstatic VERSION = VERSION;\n\t// Expose DeviceOrientationControls sub module for test purpose\n\tstatic CONTROL_MODE_VR = CONTROL_MODE_VR;\n\tstatic CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH;\n\tstatic TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL;\n\tstatic TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW;\n\tstatic TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH;\n\tstatic TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE;\n\t/**\n\t * @param {Object} options The option object of the eg.YawPitch module\n\t * @param {Element}[options.element=null] element A base element for the eg.YawPitch module\n\t * @param {Number} [options.yaw=0] initial yaw (degree)\n\t * @param {Number} [options.pitch=0] initial pitch (degree)\n\t * @param {Number} [options.fov=65] initial field of view (degree)\n\t * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown\n\t * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available\n\t * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion.\n\t * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move)\n\t * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw\n\t * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch\n\t * @param {Array} [options.fovRange=[30, 110] Range of FOV\n\t * @param {Number} [options.aspectRatio=1] Aspect Ratio\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\n\t\tconst opt = Object.assign({\n\t\t\telement: null,\n\t\t\tyaw: 0,\n\t\t\tpitch: 0,\n\t\t\tfov: 65,\n\t\t\tshowPolePoint: false,\n\t\t\tuseZoom: true,\n\t\t\tuseKeyboard: true,\n\t\t\tgyroMode: GYRO_MODE.YAWPITCH,\n\t\t\ttouchDirection: TOUCH_DIRECTION_ALL,\n\t\t\tyawRange: DEFAULT_YAW_RANGE,\n\t\t\tpitchRange: DEFAULT_PITCH_RANGE,\n\t\t\tfovRange: [30, 110],\n\t\t\taspectRatio: 1, /* TODO: Need Mandatory? */\n\t\t}, options);\n\n\t\tthis._element = opt.element;\n\t\tthis._initialFov = opt.fov;\n\t\tthis._enabled = false;\n\t\tthis._isAnimating = false;\n\t\tthis._deviceQuaternion = null;\n\n\t\tthis._initAxes(opt);\n\t\tthis.option(opt);\n\t}\n\n\t_initAxes(opt) {\n\t\tconst yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio);\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint);\n\t\tconst useRotation = opt.gyroMode === GYRO_MODE.VR;\n\n\t\tthis.axesPanInput = new RotationPanInput(this._element, {useRotation});\n\t\tthis.axesWheelInput = new WheelInput(this._element, {scale: -4});\n\t\tthis.axesTiltMotionInput = null;\n\t\tthis.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, {scale: -1}) : null;\n\t\tthis.axesMoveKeyInput = new MoveKeyInput(this._element, {scale: [-6, 6]});\n\n\t\tthis.axes = new Axes({\n\t\t\tyaw: {\n\t\t\t\trange: yRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(yRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tpitch: {\n\t\t\t\trange: pRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(pRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tfov: {\n\t\t\t\trange: opt.fovRange,\n\t\t\t\tcircular: [false, false],\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t}, {\n\t\t\tdeceleration: MC_DECELERATION,\n\t\t\tmaximumDuration: MC_MAXIMUM_DURATION\n\t\t}, {\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov\n\t\t}).on({\n\t\t\thold: evt => {\n\t\t\t\t// Restore maximumDuration not to be spin too mush.\n\t\t\t\tthis.axes.options.maximumDuration = MC_MAXIMUM_DURATION;\n\n\t\t\t\tthis.trigger(\"hold\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t\tchange: evt => {\n\t\t\t\tif (evt.delta.fov !== 0) {\n\t\t\t\t\tthis._updateControlScale(evt);\n\t\t\t\t\tthis.updatePanScale();\n\t\t\t\t}\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\trelease: evt => {\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\tanimationStart: evt => {\n\t\t\t},\n\t\t\tanimationEnd: evt => {\n\t\t\t\tthis.trigger(\"animationEnd\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Update Pan Scale\n\t *\n\t * Scale(Sensitivity) values of panning is related with fov and height.\n\t * If at least one of them is changed, this function need to be called.\n\t * @param {*} param\n\t */\n\tupdatePanScale(param = {}) {\n\t\tconst fov = this.axes.get().fov;\n\t\tconst areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);\n\t\tconst scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight;\n\n\t\tthis.axesPanInput.options.scale = [scale, scale];\n\t\tthis.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW;\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * Override component's option method\n\t * to call method for updating values which is affected by option change.\n\t *\n\t * @param {*} args\n\t */\n\toption(...args) {\n\t\tconst argLen = args.length;\n\n\t\t// Getter\n\t\tif (argLen === 0) {\n\t\t\treturn this._getOptions();\n\t\t} else if (argLen === 1 && typeof args[0] === \"string\") {\n\t\t\treturn this._getOptions(args[0]);\n\t\t}\n\n\t\t// Setter\n\t\tconst beforeOptions = Object.assign({}, this.options);\n\t\tlet newOptions = {};\n\t\tlet changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList.\n\n\t\tif (argLen === 1) {\n\t\t\tchangedKeyList = Object.keys(args[0]);\n\t\t\tnewOptions = Object.assign({}, args[0]);\n\t\t} else if (argLen >= 2) {\n\t\t\tchangedKeyList.push(args[0]);\n\t\t\tnewOptions[args[0]] = args[1];\n\t\t}\n\n\t\tthis._setOptions(this._getValidatedOptions(newOptions));\n\t\tthis._applyOptions(changedKeyList, beforeOptions);\n\t\treturn this;\n\t}\n\n\t_getValidatedOptions(newOptions) {\n\t\tif (newOptions.yawRange) {\n\t\t\tnewOptions.yawRange =\n\t\t\t\tthis._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio);\n\t\t}\n\t\tif (newOptions.pitchRange) {\n\t\t\tnewOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov);\n\t\t}\n\t\treturn newOptions;\n\t}\n\n\t_getOptions(key) {\n\t\tlet value;\n\n\t\tif (typeof key === \"string\") {\n\t\t\tvalue = this.options[key];\n\t\t} else if (arguments.length === 0) {\n\t\t\tvalue = this.options;\n\t\t}\n\t\treturn value;\n\t}\n\n\t_setOptions(options) {\n\t\tfor (const key in options) {\n\t\t\tthis.options[key] = options[key];\n\t\t}\n\t}\n\n\t_applyOptions(keys, prevOptions) {\n\t\tconst options = this.options;\n\t\tconst axes = this.axes;\n\t\tconst isVR = options.gyroMode === GYRO_MODE.VR;\n\t\tconst isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH;\n\t\t// If it's VR mode, restrict user interaction to yaw direction only\n\t\tconst touchDirection = isVR ?\n\t\t\t(TOUCH_DIRECTION_YAW & options.touchDirection) :\n\t\t\toptions.touchDirection;\n\n\t\t// If one of below is changed, call updateControlScale()\n\t\tif (keys.some(key =>\n\t\t\tkey === \"showPolePoint\" || key === \"fov\" || key === \"aspectRatio\" ||\n\t\t\tkey === \"yawRange\" || key === \"pitchRange\"\n\t\t)) {\n\t\t\t// If fov is changed, update pan scale\n\t\t\tif (keys.indexOf(\"fov\") >= 0) {\n\t\t\t\taxes.setTo({\"fov\": options.fov});\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\n\t\t\tthis._updateControlScale();\n\t\t}\n\n\t\tif (keys.some(key => key === \"fovRange\")) {\n\t\t\tconst fovRange = options.fovRange;\n\t\t\tconst prevFov = axes.get().fov;\n\t\t\tlet nextFov = axes.get().fov;\n\n\t\t\tvec2.copy(axes.axis.fov.range, fovRange);\n\n\t\t\tif (nextFov < fovRange[0]) {\n\t\t\t\tnextFov = fovRange[0];\n\t\t\t} else if (prevFov > fovRange[1]) {\n\t\t\t\tnextFov = fovRange[1];\n\t\t\t}\n\n\t\t\tif (prevFov !== nextFov) {\n\t\t\t\taxes.setTo({\n\t\t\t\t\tfov: nextFov\n\t\t\t\t}, 0);\n\t\t\t\tthis._updateControlScale();\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"gyroMode\") && SUPPORT_DEVICEMOTION) {\n\t\t\t// Disconnect first\n\t\t\tif (this.axesTiltMotionInput) {\n\t\t\t\tthis.axes.disconnect(this.axesTiltMotionInput);\n\t\t\t\tthis.axesTiltMotionInput.destroy();\n\t\t\t\tthis.axesTiltMotionInput = null;\n\t\t\t}\n\n\t\t\tif (this._deviceQuaternion) {\n\t\t\t\tthis._deviceQuaternion.destroy();\n\t\t\t\tthis._deviceQuaternion = null;\n\t\t\t}\n\n\t\t\tif (isVR) {\n\t\t\t\tthis._initDeviceQuaternion();\n\t\t\t} else if (isYawPitch) {\n\t\t\t\tthis.axesTiltMotionInput = new TiltMotionInput(this._element);\n\t\t\t\tthis.axes.connect([\"yaw\", \"pitch\"], this.axesTiltMotionInput);\n\t\t\t}\n\n\t\t\tthis.axesPanInput.setUseRotation(isVR);\n\t\t}\n\n\t\tif (keys.some(key => key === \"useKeyboard\")) {\n\t\t\tconst useKeyboard = options.useKeyboard;\n\n\t\t\tif (useKeyboard) {\n\t\t\t\taxes.connect([\"yaw\", \"pitch\"], this.axesMoveKeyInput);\n\t\t\t} else {\n\t\t\t\taxes.disconnect(this.axesMoveKeyInput);\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"useZoom\")) {\n\t\t\tconst useZoom = options.useZoom;\n\n\t\t\t// Disconnect first\n\t\t\taxes.disconnect(this.axesWheelInput);\n\t\t\tif (useZoom) {\n\t\t\t\taxes.connect([\"fov\"], this.axesWheelInput);\n\t\t\t}\n\t\t}\n\n\t\tthis._togglePinchInputByOption(options.touchDirection, options.useZoom);\n\n\t\tif (keys.some(key => key === \"touchDirection\")) {\n\t\t\tthis._enabled && this._enableTouch(touchDirection);\n\t\t}\n\t}\n\n\t_togglePinchInputByOption(touchDirection, useZoom) {\n\t\tif (this.axesPinchInput) {\n\t\t\t// disconnect first\n\t\t\tthis.axes.disconnect(this.axesPinchInput);\n\n\t\t\t// If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll.\n\t\t\tif (\n\t\t\t\tuseZoom &&\n\t\t\t\ttouchDirection === TOUCH_DIRECTION_ALL &&\n\t\t\t\t// TODO: Get rid of using private property of axes instance.\n\t\t\t\tthis.axes._inputs.indexOf(this.axesPinchInput) === -1\n\t\t\t) {\n\t\t\t\tthis.axes.connect([\"fov\"], this.axesPinchInput);\n\t\t\t}\n\t\t}\n\t}\n\n\t_enableTouch(direction) {\n\t\t// Disconnect first\n\t\tthis.axesPanInput && this.axes.disconnect(this.axesPanInput);\n\n\t\tconst yawEnabled = direction & TOUCH_DIRECTION_YAW ? \"yaw\" : null;\n\t\tconst pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? \"pitch\" : null;\n\n\t\tthis.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput);\n\t}\n\n\t_initDeviceQuaternion() {\n\t\tthis._deviceQuaternion = new DeviceQuaternion();\n\t\tthis._deviceQuaternion.on(\"change\", e => {\n\t\t\tthis._triggerChange(e);\n\t\t});\n\t}\n\n\t_getValidYawRange(newYawRange, newFov, newAspectRatio) {\n\t\tconst ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1);\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst horizontalFov = fov * ratio;\n\t\tconst isValid = newYawRange[1] - newYawRange[0] >= horizontalFov;\n\n\t\tif (isValid) {\n\t\t\treturn newYawRange;\n\t\t} else {\n\t\t\treturn this.options.yawRange || DEFAULT_YAW_RANGE;\n\t\t}\n\t}\n\n\t_getValidPitchRange(newPitchRange, newFov) {\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst isValid = newPitchRange[1] - newPitchRange[0] >= fov;\n\n\t\tif (isValid) {\n\t\t\treturn newPitchRange;\n\t\t} else {\n\t\t\treturn this.options.pitchRange || DEFAULT_PITCH_RANGE;\n\t\t}\n\t}\n\n\tstatic isCircular(range) {\n\t\treturn range[1] - range[0] < 360 ? [false, false] : [true, true];\n\t}\n\n\t/**\n\t * Update yaw/pitch min/max by 5 factor\n\t *\n\t * 1. showPolePoint\n\t * 2. fov\n\t * 3. yawRange\n\t * 4. pitchRange\n\t * 5. aspectRatio\n\t *\n\t * If one of above is changed, call this function\n\t */\n\t_updateControlScale(changeEvt) {\n\t\tconst opt = this.options;\n\t\tconst fov = this.axes.get().fov;\n\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint);\n\t\tconst yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio);\n\n\t\t// TODO: If not changed!?\n\t\tconst pos = this.axes.get();\n\t\tlet y = pos.yaw;\n\t\tlet p = pos.pitch;\n\n\t\tvec2.copy(this.axes.axis.yaw.range, yRange);\n\t\tvec2.copy(this.axes.axis.pitch.range, pRange);\n\t\tthis.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange);\n\t\tthis.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange);\n\n\t\t/**\n\t\t * update yaw/pitch by it's range.\n\t\t */\n\t\tif (y < yRange[0]) {\n\t\t\ty = yRange[0];\n\t\t} else if (y > yRange[1]) {\n\t\t\ty = yRange[1];\n\t\t}\n\n\t\tif (p < pRange[0]) {\n\t\t\tp = pRange[0];\n\t\t} else if (p > pRange[1]) {\n\t\t\tp = pRange[1];\n\t\t}\n\n\t\tif (changeEvt) {\n\t\t\tchangeEvt.set({\n\t\t\t\tyaw: y,\n\t\t\t\tpitch: p,\n\t\t\t});\n\t\t}\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\t_updatePitchRange(pitchRange, fov, showPolePoint) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\t// Circular pitch on VR\n\t\t\treturn CIRCULAR_PITCH_RANGE;\n\t\t}\n\n\t\tconst verticalAngle = pitchRange[1] - pitchRange[0];\n\t\tconst halfFov = fov / 2;\n\t\tconst isPanorama = verticalAngle < 180;\n\n\t\tif (showPolePoint && !isPanorama) {\n\t\t\t// Use full pinch range\n\t\t\treturn pitchRange.concat();\n\t\t}\n\n\t\t// Round value as movableCood do.\n\t\treturn [pitchRange[0] + halfFov, pitchRange[1] - halfFov];\n\t}\n\n\t_updateYawRange(yawRange, fov, aspectRatio) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\treturn DEFAULT_YAW_RANGE;\n\t\t}\n\n\t\tconst horizontalAngle = yawRange[1] - yawRange[0];\n\n\t\t/**\n\t\t * Full 360 Mode\n\t\t */\n\t\tif (horizontalAngle >= 360) {\n\t\t\t// Don't limit yaw range on Full 360 mode.\n\t\t\treturn yawRange.concat();\n\t\t}\n\n\t\t/**\n\t\t * Panorama mode\n\t\t */\n\t\t// Ref : https://github.com/naver/egjs-view360/issues/290\n\t\tconst halfHorizontalFov =\n\t\t\tmathUtil.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2))));\n\n\t\t// Round value as movableCood do.\n\t\treturn [\n\t\t\tyawRange[0] + halfHorizontalFov,\n\t\t\tyawRange[1] - halfHorizontalFov\n\t\t];\n\t}\n\n\t_triggerChange(evt) {\n\t\tconst pos = this.axes.get();\n\t\tconst opt = this.options;\n\t\tconst event = {\n\t\t\ttargetElement: opt.element,\n\t\t\tisTrusted: evt.isTrusted,\n\t\t};\n\n\t\tevent.yaw = pos.yaw;\n\t\tevent.pitch = pos.pitch;\n\t\tevent.fov = pos.fov;\n\n\t\tif (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) {\n\t\t\tevent.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t\t}\n\t\tthis.trigger(\"change\", event);\n\t}\n\n\t// TODO: makes constant to be logic\n\tstatic adjustAspectRatio(input) {\n\t\tconst inputRange = [\n\t\t\t0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670,\n\t\t\t0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19,\n\t\t\t1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26,\n\t\t\t2.30, 2.60, 3.00, 5.00, 6.00\n\t\t];\n\t\tconst outputRange = [\n\t\t\t0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710,\n\t\t\t0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15,\n\t\t\t1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72,\n\t\t\t1.82, 1.92, 2.00, 2.24, 2.30\n\t\t];\n\n\t\tlet rangeIdx = -1;\n\n\t\tfor (let i = 0; i < inputRange.length - 1; i++) {\n\t\t\tif (inputRange[i] <= input && inputRange[i + 1] >= input) {\n\t\t\t\trangeIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (rangeIdx === -1) {\n\t\t\tif (inputRange[0] > input) {\n\t\t\t\treturn outputRange[0];\n\t\t\t} else {\n\t\t\t\treturn outputRange[outputRange[0].length - 1];\n\t\t\t}\n\t\t}\n\n\t\tconst inputA = inputRange[rangeIdx];\n\t\tconst inputB = inputRange[rangeIdx + 1];\n\t\tconst outputA = outputRange[rangeIdx];\n\t\tconst outputB = outputRange[rangeIdx + 1];\n\n\t\treturn YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA));\n\t}\n\n\tstatic lerp(a, b, fraction) {\n\t\treturn a + fraction * (b - a);\n\t}\n\n\t/**\n\t * Enable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#enable\n\t */\n\tenable() {\n\t\tif (this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._enabled = true;\n\n\t\t// touchDirection is decided by parameter is valid string (Ref. Axes.connect)\n\t\tthis._applyOptions(Object.keys(this.options), this.options);\n\n\t\t// TODO: Is this code is needed? Check later.\n\t\tthis.updatePanScale();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Disable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#disable\n\t */\n\tdisable(persistOrientation) {\n\t\tif (!this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// TODO: Check peristOrientation is needed!\n\t\tif (!persistOrientation) {\n\t\t\tthis._resetOrientation();\n\t\t}\n\t\tthis.axes.disconnect();\n\t\tthis._enabled = false;\n\t\treturn this;\n\t}\n\n\t_resetOrientation() {\n\t\tconst opt = this.options;\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Set one or more of yaw, pitch, fov\n\t *\n\t * @param {Object} coordinate yaw, pitch, fov\n\t * @param {Number} duration Animation duration. if it is above 0 then it's animated.\n\t */\n\tlookAt({yaw, pitch, fov}, duration) {\n\t\tconst pos = this.axes.get();\n\n\t\tconst y = yaw === undefined ? 0 : yaw - pos.yaw;\n\t\tconst p = pitch === undefined ? 0 : pitch - pos.pitch;\n\t\tconst f = fov === undefined ? 0 : fov - pos.fov;\n\n\t\t// Allow duration of animation to have more than MC_MAXIMUM_DURATION.\n\t\tthis.axes.options.maximumDuration = Infinity;\n\n\t\tthis.axes.setBy({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t\tfov: f\n\t\t}, duration);\n\t}\n\n\tgetYawPitch() {\n\t\tconst yawPitch = this.axes.get();\n\n\t\treturn {\n\t\t\tyaw: yawPitch.yaw,\n\t\t\tpitch: yawPitch.pitch,\n\t\t};\n\t}\n\n\tgetFov() {\n\t\treturn this.axes.get().fov;\n\t}\n\n\tgetQuaternion() {\n\t\tconst pos = this.axes.get();\n\n\t\treturn this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t}\n\n\tshouldRenderWithQuaternion() {\n\t\treturn this.options.gyroMode === GYRO_MODE.VR;\n\t}\n\n\t/**\n\t * Destroys objects\n\t */\n\tdestroy() {\n\t\tthis.axes && this.axes.destroy();\n\t\tthis.axisPanInput && this.axisPanInput.destroy();\n\t\tthis.axesWheelInput && this.axesWheelInput.destroy();\n\t\tthis.axesTiltMotionInput && this.axesTiltMotionInput.destroy();\n\t\tthis.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy();\n\t\tthis.axesPinchInput && this.axesPinchInput.destroy();\n\t\tthis.axesMoveKeyInput && this.axesMoveKeyInput.destroy();\n\t\tthis._deviceQuaternion && this._deviceQuaternion.destroy();\n\t}\n}\n\nexport default YawPitchControl;\n","import Component from \"@egjs/component\";\n\nconst STATUS = {\n\t\"NONE\": 0,\n\t\"LOADING\": 1,\n\t\"LOADED\": 2,\n\t\"ERROR\": 3\n};\n\nconst EVENT = {\n\t\"READYSTATECHANGE\": \"readystatechange\"\n};\n\nclass ImageLoader extends Component {\n\tstatic STATUS = STATUS;\n\tconstructor(image) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis._image = null;\n\t\tthis._onceHandlers = [];\n\t\tthis._loadStatus = STATUS.NONE;\n\n\t\timage && this.set(image);\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._image) {\n\t\t\t\trej(\"ImageLoader: image is not defiend\");\n\t\t\t} else if (this._loadStatus === STATUS.LOADED) {\n\t\t\t\tres(this.getElement());\n\t\t\t} else if (this._loadStatus === STATUS.LOADING) {\n\t\t\t\t/* Check isMaybeLoaded() first because there may have\n\t\t\t\t\tposibilities that image already loaded before get is called.\n\t\t\t\t\tfor example calling get on external image onload callback.*/\n\t\t\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\t\tres(this.getElement());\n\t\t\t\t} else {\n\t\t\t\t\tthis.on(EVENT.READYSTATECHANGE, e => {\n\t\t\t\t\t\tif (e.type === STATUS.LOADED) {\n\t\t\t\t\t\t\tres(this.getElement());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trej(\"ImageLoader: failed to load images.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trej(\"ImageLoader: failed to load images\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param image img element or img url or array of img element or array of img url\n\t */\n\tset(image) {\n\t\tthis._loadStatus = STATUS.LOADING;\n\n\t\tthis._image = ImageLoader.createElement(image);\n\n\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.onceLoaded(\n\t\t\tthis._image,\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.LOADED\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.ERROR;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.ERROR\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tstatic createElement(image) {\n\t\tconst images = image instanceof Array ? image : [image];\n\n\t\treturn images.map(img => {\n\t\t\tlet _img = img;\n\n\t\t\tif (typeof img === \"string\") {\n\t\t\t\t_img = new Image();\n\t\t\t\t_img.crossOrigin = \"anonymous\";\n\t\t\t\t_img.src = img;\n\t\t\t}\n\t\t\treturn _img;\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._image.length === 1 ? this._image[0] : this._image;\n\t}\n\n\tstatic isMaybeLoaded(image) {\n\t\tlet result = false;\n\n\t\tif (image instanceof Image) {\n\t\t\tresult = image.complete && image.naturalWidth !== 0;\n\t\t} else if (image instanceof Array) {\n\t\t\tresult = !image.some(img => !img.complete || img.naturalWidth === 0);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonceLoaded(target, onload, onerror) {\n\t\tconst targets = target instanceof Array ? target : [target];\n\t\tconst targetsNotLoaded = targets.filter(img => !ImageLoader.isMaybeLoaded(img));\n\t\tconst loadPromises = targetsNotLoaded.map(img => new Promise((res, rej) => {\n\t\t\tthis._once(img, \"load\", () => (res(img)));\n\t\t\tthis._once(img, \"error\", () => (rej(img)));\n\t\t}));\n\n\t\tPromise.all(loadPromises).then(\n\t\t\tresult => (onload(targets.length === 1 ? targets[0] : targets)),\n\t\t\treason => (onerror(reason))\n\t\t);\n\t}\n\n\t_once(target, type, listener) {\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\ttarget.addEventListener(type, fn);\n\t\tthis._onceHandlers.push({target, type, fn});\n\t}\n\n\tgetStatus() {\n\t\treturn this._loadStatus;\n\t}\n\n\tdestroy() {\n\t\tthis._onceHandlers.forEach(handler => {\n\t\t\thandler.target.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._onceHandlers = [];\n\t\tthis._image.src = \"\";\n\t\tthis._image = null;\n\t\tthis._loadStatus = STATUS.NONE;\n\t}\n}\n\nexport default ImageLoader;\n","// import Agent from \"@egjs/agent\";\n\n/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */\nconst READY_STATUS = {\n\tHAVE_NOTHING: 0, // no information whether or not the audio/video is ready\n\tHAVE_METADATA: 1, // HAVE_METADATA - metadata for the audio/video is ready\n\tHAVE_CURRENT_DATA: 2, // data for the current playback position is available, but not enough data to play next frame/millisecond\n\tHAVE_FUTURE_DATA: 3, // data for the current and at least the next frame is available\n\tHAVE_ENOUGH_DATA: 4, // enough data available to start playing\n\t// below is custom status for failed to load status\n\tLOADING_FAILED: -1\n};\n\nconst READYSTATECHANGE_EVENT_NAME = {};\n\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = \"loadedmetadata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = \"loadeddata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = \"canplay\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = \"canplaythrough\";\n\nexport default class VideoLoader {\n\tconstructor(video) {\n\t\tthis._handlers = [];\n\t\tthis._sourceCount = 0;\n\n\t\t// on iOS safari, 'loadeddata' will not triggered unless the user hits play,\n\t\t// so used 'loadedmetadata' instead.\n\t\tthis._thresholdReadyState = READY_STATUS.HAVE_METADATA;\n\t\tthis._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState];\n\n\t\tthis._loadStatus = (video && video.readyState) || READY_STATUS.HAVE_NOTHING;\n\n\t\tthis._onerror = this._onerror.bind(this);\n\n\t\tvideo && this.set(video);\n\t}\n\n\t_onerror() {\n\t\tthis._errorCount++;\n\t\tif (this._errorCount >= this._sourceCount) {\n\t\t\tthis._loadStatus = READY_STATUS.LOADING_FAILED;\n\t\t\tthis._detachErrorHandler(this._onerror);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src}\n\t */\n\t_appendSourceElement(videoUrl) {\n\t\tlet videoSrc;\n\t\tlet videoType;\n\n\t\tif (typeof videoUrl === \"object\") {\n\t\t\tvideoSrc = videoUrl.src;\n\t\t\tvideoType = videoUrl.type;\n\t\t} else if (typeof videoUrl === \"string\") {\n\t\t\tvideoSrc = videoUrl;\n\t\t}\n\n\t\tif (!videoSrc) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst sourceElement = document.createElement(\"source\");\n\n\t\tsourceElement.src = videoSrc;\n\t\tvideoType && (sourceElement.type = videoType);\n\n\t\tthis._video.appendChild(sourceElement);\n\t\treturn true;\n\t}\n\n\tset(video) {\n\t\tthis._reset(); // reset resources.\n\n\t\tif (!video) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (video instanceof HTMLVideoElement) {\n\t\t\t// video tag\n\t\t\tthis._video = video;\n\t\t} else if (typeof video === \"string\" || typeof video === \"object\") {\n\t\t\t// url\n\t\t\tthis._video = document.createElement(\"video\");\n\t\t\tthis._video.setAttribute(\"crossorigin\", \"anonymous\");\n\t\t\tthis._video.setAttribute(\"webkit-playsinline\", \"\");\n\t\t\tthis._video.setAttribute(\"playsinline\", \"\");\n\n\t\t\tif (video instanceof Array) {\n\t\t\t\tvideo.forEach(v => this._appendSourceElement(v));\n\t\t\t} else {\n\t\t\t\tthis._appendSourceElement(video);\n\t\t\t}\n\n\t\t\tthis._sourceCount = this._video.querySelectorAll(\"source\").length;\n\n\t\t\tif (this._sourceCount > 0) {\n\t\t\t\tif (this._video.readyState < this._thresholdReadyState) {\n\t\t\t\t\tthis._video.load();\n\t\t\t\t\t// attach loading error listener\n\t\t\t\t\tthis._attachErrorHandler(this._onerror);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._video = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t_attachErrorHandler(handler) {\n\t\tthis._video.addEventListener(\"error\", handler);\n\t\tthis._sources = this._video.querySelectorAll(\"source\");\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.addEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\t_detachErrorHandler(handler) {\n\t\tthis._video.removeEventListener(\"error\", handler);\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.removeEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._video) {\n\t\t\t\trej(\"VideoLoader: video is undefined\");\n\t\t\t} else if (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t} else if (this._video.readyState >= this._thresholdReadyState) {\n\t\t\t\tres(this._video);\n\t\t\t} else {\n\t\t\t\t// check errorCnt and reject\n\t\t\t\tconst rejector = () => {\n\t\t\t\t\tif (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\t\t\tthis._detachErrorHandler(rejector);\n\t\t\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis._attachErrorHandler(rejector);\n\t\t\t\tthis._once(this._thresholdEventName, () => res(this._video));\n\t\t\t}\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._video;\n\t}\n\n\tdestroy() {\n\t\tthis._reset();\n\t}\n\n\t_reset() {\n\t\tthis._handlers.forEach(handler => {\n\t\t\tthis._video.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._handlers = [];\n\t\tthis._video = null;\n\n\t\tthis._sourceCount = 0;\n\t\tthis._errorCount = 0;\n\t}\n\n\t_once(type, listener) {\n\t\tconst target = this._video;\n\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\t/* By useCapture mode enabled, you can capture the error event being fired on source(child)*/\n\t\ttarget.addEventListener(type, fn, true);\n\t\tthis._handlers.push({type, fn});\n\t}\n}\n","import Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {STEREO_FORMAT} from \"../../PanoViewer/consts\";\n\nconst latitudeBands = 60;\nconst longitudeBands = 60;\nconst radius = 2;\nconst ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\nlet latIdx;\nlet lngIdx;\n\nfor (latIdx = 0; latIdx <= latitudeBands; latIdx++) {\n\tconst theta = (latIdx / latitudeBands - 0.5) * Math.PI;\n\tconst sinTheta = Math.sin(theta);\n\tconst cosTheta = Math.cos(theta);\n\n\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\tconst phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN;\n\t\tconst sinPhi = Math.sin(phi);\n\t\tconst cosPhi = Math.cos(phi);\n\t\tconst x = cosPhi * cosTheta;\n\t\tconst y = sinTheta;\n\t\tconst z = sinPhi * cosTheta;\n\t\tconst u = lngIdx / longitudeBands;\n\t\tconst v = latIdx / latitudeBands;\n\n\t\ttextureCoordData.push(u, v);\n\t\tvertexPositionData.push(radius * x, radius * y, radius * z);\n\n\t\tif (lngIdx !== longitudeBands && latIdx !== latitudeBands) {\n\t\t\tconst a = latIdx * (longitudeBands + 1) + lngIdx;\n\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t}\n\t}\n}\n\nclass SphereRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tconstructor(format) {\n\t\tsuper();\n\n\t\tthis._stereoFormat = format;\n\t}\n\n\trender(ctx) {\n\t\tconst {gl, shaderProgram} = ctx;\n\n\t\tlet leftEyeScaleOffset;\n\t\tlet rightEyeScaleOffset;\n\n\t\tswitch (this._stereoFormat) {\n\t\t\tcase STEREO_FORMAT.TOP_BOTTOM:\n\t\t\t\tleftEyeScaleOffset = [1, 0.5, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 0.5, 0, 0.5];\n\t\t\t\tbreak;\n\t\t\tcase STEREO_FORMAT.LEFT_RIGHT:\n\t\t\t\tleftEyeScaleOffset = [0.5, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [0.5, 1, 0.5, 0];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tleftEyeScaleOffset = [1, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 1, 0, 0];\n\t\t}\n\n\t\tconst uTexScaleOffset = gl.getUniformLocation(shaderProgram, \"uTexScaleOffset\");\n\n\t\tgl.uniform4fv(uTexScaleOffset, [...leftEyeScaleOffset, ...rightEyeScaleOffset]);\n\n\t\tsuper.render(ctx);\n\t}\n\n\tgetVertexPositionData() {\n\t\treturn SphereRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn SphereRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn SphereRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n}\n\nexport default SphereRenderer;\n","import agent from \"@egjs/agent\";\n\nconst WEBGL_ERROR_CODE = {\n\t\"0\": \"NO_ERROR\",\n\t\"1280\": \"INVALID_ENUM\",\n\t\"1281\": \"INVALID_VALUE\",\n\t\"1282\": \"INVALID_OPERATION\",\n\t\"1285\": \"OUT_OF_MEMORY\",\n\t\"1286\": \"INVALID_FRAMEBUFFER_OPERATION\",\n\t\"37442\": \"CONTEXT_LOST_WEBGL\"\n};\n\nlet webglAvailability = null;\nlet MAX_TEXTURE_SIZE_FOR_TEST = null;\n\nexport default class WebGLUtils {\n\tstatic createShader(gl, type, source) {\n\t\tconst shader = gl.createShader(type);\n\n\t\tgl.shaderSource(shader, source);\n\t\tgl.compileShader(shader);\n\t\tconst success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n\t\tif (success) {\n\t\t\treturn shader;\n\t\t} else {\n\t\t\t// eslint-disable-next-line\n\t\t\tconsole.error(gl.getShaderInfoLog(shader));\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic createProgram(gl, vertexShader, fragmentShader) {\n\t\tconst program = gl.createProgram();\n\n\t\tgl.attachShader(program, vertexShader);\n\t\tgl.attachShader(program, fragmentShader);\n\t\tgl.linkProgram(program);\n\n\t\tgl.detachShader(program, vertexShader);\n\t\tgl.detachShader(program, fragmentShader);\n\t\tgl.deleteShader(vertexShader);\n\t\tgl.deleteShader(fragmentShader);\n\n\t\tconst success = gl.getProgramParameter(program, gl.LINK_STATUS);\n\n\t\tif (success) {\n\t\t\treturn program;\n\t\t}\n\n\t\tgl.deleteProgram(program);\n\t\treturn null;\n\t}\n\n\tstatic initBuffer(gl, target /* bind point */, data, itemSize, attr) {\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer(target, buffer);\n\t\tgl.bufferData(target, data, gl.STATIC_DRAW);\n\n\t\tif (buffer) {\n\t\t\tbuffer.itemSize = itemSize;\n\t\t\tbuffer.numItems = data.length / itemSize;\n\t\t}\n\n\t\tif (attr !== undefined) {\n\t\t\tgl.enableVertexAttribArray(attr);\n\t\t\tgl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\tstatic getWebglContext(canvas, userContextAttributes) {\n\t\tconst webglIdentifiers = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n\t\tlet context = null;\n\t\tconst contextAttributes = Object.assign({\n\t\t\tpreserveDrawingBuffer: false,\n\t\t\tantialias: false,\n\t\t\txrCompatible: true\n\t\t}, userContextAttributes);\n\n\t\tfunction onWebglcontextcreationerror(e) {\n\t\t\treturn e.statusMessage;\n\t\t}\n\n\t\tcanvas.addEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\tfor (let i = 0; i < webglIdentifiers.length; i++) {\n\t\t\ttry {\n\t\t\t\tcontext = canvas.getContext(webglIdentifiers[i], contextAttributes);\n\t\t\t} catch (t) {}\n\t\t\tif (context) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcanvas.removeEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\treturn context;\n\t}\n\n\tstatic createTexture(gl, textureTarget) {\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture(textureTarget, texture);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(textureTarget, null);\n\n\t\treturn texture;\n\t}\n\n\t/**\n\t * Returns the webgl availability of the current browser.\n\t * @method WebGLUtils#isWebGLAvailable\n\t * @retuen {Boolean} isWebGLAvailable\n\t */\n\tstatic isWebGLAvailable() {\n\t\tif (webglAvailability === null) {\n\t\t\tconst canvas = document.createElement(\"canvas\");\n\t\t\tconst webglContext = WebGLUtils.getWebglContext(canvas);\n\n\t\t\twebglAvailability = !!webglContext;\n\n\t\t\t// webglContext Resource forced collection\n\t\t\tif (webglContext) {\n\t\t\t\tconst loseContextExtension = webglContext.getExtension(\"WEBGL_lose_context\");\n\n\t\t\t\tloseContextExtension && loseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t\treturn webglAvailability;\n\t}\n\n\t/**\n\t * Returns whether webgl is stable in the current browser.\n\t * @method WebGLUtils#isStableWebGL\n\t * @retuen {Boolean} isStableWebGL\n\t */\n\tstatic isStableWebGL() {\n\t\tconst agentInfo = agent();\n\t\tlet isStableWebgl = true;\n\n\t\tif (agentInfo.os.name === \"android\") {\n\t\t\tconst version = parseFloat(agentInfo.os.version);\n\n\t\t\tif (version <= 4.3) {\n\t\t\t\tisStableWebgl = false;\n\t\t\t} else if (version === 4.4) {\n\t\t\t\tif (agentInfo.browser.name !== \"chrome\") {\n\t\t\t\t\tisStableWebgl = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isStableWebgl;\n\t}\n\n\tstatic getErrorNameFromWebGLErrorCode(code) {\n\t\tif (!(code in WEBGL_ERROR_CODE)) {\n\t\t\treturn \"UNKNOWN_ERROR\";\n\t\t}\n\n\t\treturn WEBGL_ERROR_CODE[code];\n\t}\n\n\n\t/**\n\t * This function is wrapper for texImage2D to handle exceptions on texImage2D.\n\t * Purpose is to prevent service from being stopped by script error.\n\t *\n\t * @param {*} gl\n\t * @param {*} target\n\t * @param {*} pixels\n\t */\n\tstatic texImage2D(gl, target, pixels) {\n\t\ttry {\n\t\t\tgl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\t\t} catch (error) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.error(\"WebGLUtils.texImage2D error:\", error);\n\t\t\t/* eslint-enable no-console */\n\t\t}\n\t}\n\n\tstatic getMaxTextureSize(gl) {\n\t\t// WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test\n\t\treturn MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\t}\n}\n\n/**\n * This function should not be used in service code. It's provided only for test purpose.\n * It should be set to null or 0 when test is done.\n *\n * @param {Number} size\n */\nfunction setMaxTextureSizeForTestOnlyPurpose(size) {\n\tMAX_TEXTURE_SIZE_FOR_TEST = size;\n}\n\nexport {\n\tsetMaxTextureSizeForTestOnlyPurpose\n};\n","import Component from \"@egjs/component\";\nimport Agent from \"@egjs/agent\";\n\nconst agent = Agent();\nconst isIE11 = agent.browser.name === \"ie\" && agent.browser.majorVersion === 11;\n\nconst EVENTS = {\n\tERROR: \"error\"\n};\n\n/**\n *\n * Extends Component for firing errors occurs internally.\n */\nclass Renderer extends Component {\n\tstatic EVENTS = EVENTS;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._forceDimension = null;\n\t\tthis._pixelCanvas = null;\n\t\tthis._pixelContext = null;\n\t}\n\n\trender({gl, shaderProgram, indexBuffer, mvMatrix, pMatrix}) {\n\t\tgl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n\t\tgl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n\n\t\tif (indexBuffer) {\n\t\t\tgl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n\t\t}\n\t}\n\n\t// Define interface for Renderers\n\t/**\n\t * Following MUST BE DEFINED on Child of Renderer\n\t *\n\t * DATA\n\t *\n\t * - getVertexPositionData\n\t * - getIndexData\n\t * - getTextureCoordData\n\t *\n\t * SOURCE\n\t *\n\t * - getVertexShaderSource\n\t * - getFragmentShaderSource\n\t *\n\t * TEXTURE\n\t *\n\t * - bindTexture\n\t */\n\tgetDimension(pixelSource) {\n\t\tconst width = pixelSource.naturalWidth || pixelSource.videoWidth;\n\t\tconst height = pixelSource.naturalHeight || pixelSource.videoHeight;\n\n\t\treturn {width, height};\n\t}\n\n\t/**\n\t * Update data used by shader\n\t * \t-\n\t *\n\t *\n\t * @param {*} param\n\t */\n\tupdateShaderData(param) {\n\t\t/*\n\t\t* Update following data in implementation layer.\n\t\t* If the data is not changed, it does not need to implement this function.\n\t\t*\n\t\t* - _VERTEX_POSITION_DATA\n\t\t* - _TEXTURE_COORD_DATA\n\t\t* - _INDEX_DATA\n\t\t*/\n\t}\n\n\t/**\n\t *\n\t * @param {HTMLImageElement | HTMLVideoElement} image\n\t * @param {Object = {width, height}} forceDimension Forced dimension to resize\n\t */\n\t_initPixelSource(image, forceDimension) {\n\t\tconst isIE11Video = isIE11 && (image instanceof HTMLVideoElement);\n\n\t\tif (isIE11Video || forceDimension) {\n\t\t\tconst {width, height} = forceDimension || this.getDimension(image);\n\n\t\t\tthis._pixelCanvas = document.createElement(\"canvas\");\n\t\t\tthis._pixelCanvas.width = width;\n\t\t\tthis._pixelCanvas.height = height;\n\t\t\tthis._pixelContext = this._pixelCanvas.getContext(\"2d\");\n\t\t}\n\t\tthis._forceDimension = forceDimension;\n\t}\n\n\t_getPixelSource(image) {\n\t\tif (!this._pixelCanvas) {\n\t\t\treturn image;\n\t\t}\n\n\t\t/**\n\t\t * IE11 && Video\n\t\t * or\n\t\t * Dimension is forced (Image is larger than texture size.)\n\t\t */\n\t\tconst contentDimension = this.getDimension(image);\n\t\tconst textureDimension = this._forceDimension || contentDimension;\n\n\t\tif (this._pixelCanvas.width !== textureDimension.width) {\n\t\t\tthis._pixelCanvas.width = textureDimension.width;\n\t\t}\n\n\t\tif (this._pixelCanvas.height !== textureDimension.height) {\n\t\t\tthis._pixelCanvas.height = textureDimension.height;\n\t\t}\n\n\t\tif (this._forceDimension) {\n\t\t\tthis._pixelContext.drawImage(image,\n\t\t\t\t0, 0, contentDimension.width, contentDimension.height,\n\t\t\t\t0, 0, textureDimension.width, textureDimension.height);\n\t\t} else {\n\t\t\tthis._pixelContext.drawImage(image, 0, 0);\n\t\t}\n\n\t\treturn this._pixelCanvas;\n\t}\n\n\t_extractTileConfig(imageConfig) {\n\t\tlet tileConfig =\n\t\t\tArray.isArray(imageConfig.tileConfig) ?\n\t\t\t\timageConfig.tileConfig : Array(...Array(6)).map(() => imageConfig.tileConfig);\n\n\t\ttileConfig = tileConfig.map(\n\t\t\tconfig => Object.assign({\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}, config)\n\t\t);\n\n\t\treturn tileConfig;\n\t}\n\n\t_triggerError(error) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.error(\"Renderer Error:\", error);\n\t\t/* eslint-enable no-console */\n\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\tmessage: typeof error === \"string\" ? error : error.message\n\t\t});\n\t}\n}\n\nexport default Renderer;\n","import Agent from \"@egjs/agent\";\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {util as mathUtil} from \"../../utils/math-util.js\";\n\nclass CubeRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = null;\n\tstatic _INDEX_DATA = null;\n\tgetVertexPositionData() {\n\t\tCubeRenderer._VERTEX_POSITION_DATA =\n\t\t\tCubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// top\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// bottom\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\n\t\treturn CubeRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\tif (CubeRenderer._INDEX_DATA) {\n\t\t\treturn CubeRenderer._INDEX_DATA;\n\t\t}\n\n\t\tconst indexData = [];\n\t\tconst vertexPositionData = this.getVertexPositionData();\n\n\t\tfor (let i = 0; i < (vertexPositionData.length / 3); i += 4) {\n\t\t\tindexData.push(\n\t\t\t\ti,\n\t\t\t\ti + 2,\n\t\t\t\ti + 1,\n\t\t\t\ti,\n\t\t\t\ti + 3,\n\t\t\t\ti + 2\n\t\t\t);\n\t\t}\n\n\t\tCubeRenderer._INDEX_DATA = indexData;\n\t\treturn indexData;\n\t}\n\n\tstatic extractOrder(imageConfig) {\n\t\treturn imageConfig.order || \"RLUDBF\";\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\tconst vertexOrder = \"BFUDRL\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst base = this.getVertexPositionData();\n\t\tconst tileConfig = this._extractTileConfig(imageConfig);\n\t\tconst elemSize = 3;\n\t\tconst vertexPerTile = 4;\n\t\tconst textureCoordData =\n\t\t\tvertexOrder.split(\"\")\n\t\t\t\t.map(face => tileConfig[order.indexOf(face)])\n\t\t\t\t.map((config, i) => {\n\t\t\t\t\tconst rotation = parseInt(config.rotation / 90, 10);\n\t\t\t\t\tconst ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2];\n\n\t\t\t\t\tfor (let r = 0; r < Math.abs(rotation); r++) {\n\t\t\t\t\t\tif ((config.flipHorizontal && rotation > 0) ||\n\t\t\t\t\t\t\t(!config.flipHorizontal && rotation < 0)) {\n\t\t\t\t\t\t\tordermap_.push(ordermap_.shift());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tordermap_.unshift(ordermap_.pop());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst elemPerTile = elemSize * vertexPerTile;\n\t\t\t\t\tconst tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile);\n\t\t\t\t\tconst tileTemp = [];\n\n\t\t\t\t\tfor (let j = 0; j < vertexPerTile; j++) {\n\t\t\t\t\t\ttileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize);\n\t\t\t\t\t}\n\t\t\t\t\treturn tileTemp;\n\t\t\t\t})\n\t\t\t\t.join()\n\t\t\t\t.split(\",\")\n\t\t\t\t.map(v => parseInt(v, 10));\n\n\t\treturn textureCoordData;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}`;\n\t}\n\n\tupdateTexture(gl, image, imageConfig) {\n\t\tconst baseOrder = \"RLUDBF\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst orderMap = {};\n\n\t\torder.split(\"\").forEach((v, i) => {\n\t\t\torderMap[v] = i;\n\t\t});\n\n\t\ttry {\n\t\t\tif (image instanceof Array) {\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image);\n\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\t\t\t\t\tconst tile = this.extractTileFromImage(\n\t\t\t\t\t\timage, tileIdx, maxCubeMapTextureSize\n\t\t\t\t\t);\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, tile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis._triggerError(e);\n\t\t}\n\t}\n\n\tbindTexture(gl, texture, image, imageConfig) {\n\t\tgl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\t\tthis.updateTexture(gl, image, imageConfig);\n\t}\n\n\tgetSourceTileSize(image) {\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst aspectRatio = width / height;\n\t\tlet inputTextureSize;\n\n\t\tif (aspectRatio === 1 / 6) {\n\t\t\tinputTextureSize = width;\n\t\t} else if (aspectRatio === 6) {\n\t\t\tinputTextureSize = height;\n\t\t} else if (aspectRatio === 2 / 3) {\n\t\t\tinputTextureSize = width / 2;\n\t\t} else {\n\t\t\tinputTextureSize = width / 3;\n\t\t}\n\t\treturn inputTextureSize;\n\t}\n\n\textractTileFromImage(image, tileIdx, outputTextureSize) {\n\t\tconst {width} = this.getDimension(image);\n\t\tconst inputTextureSize = this.getSourceTileSize(image);\n\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = outputTextureSize;\n\t\tcanvas.height = outputTextureSize;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tconst tilePerRow = width / inputTextureSize;\n\n\t\tconst x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow);\n\t\tconst y = parseInt(tileIdx / tilePerRow, 10) * (inputTextureSize);\n\n\t\tcontext.drawImage(\n\t\t\timage, x, y,\n\t\t\tinputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize\n\t\t);\n\t\treturn canvas;\n\t}\n\n\tgetMaxCubeMapTextureSize(gl, image) {\n\t\tconst agent = Agent();\n\t\tconst maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n\t\tlet _imageWidth = this.getSourceTileSize(image);\n\n\t\tif (agent.browser.name === \"ie\" && agent.browser.majorVersion === 11) {\n\t\t\tif (!mathUtil.isPowerOfTwo(_imageWidth)) {\n\t\t\t\tfor (let i = 1; i < maxCubeMapTextureSize; i *= 2) {\n\t\t\t\t\tif (i < _imageWidth) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_imageWidth = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (agent.os.name === \"ios\") {\n\t\t\tconst majorVersion = agent.os.majorVersion;\n\n\t\t\t// ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다.\n\t\t\tif (majorVersion === 9) {\n\t\t\t\t_imageWidth = 1024;\n\t\t\t}\n\t\t\t// ios 8 의 경우 텍스쳐 최대사이즈는 512 이다.\n\t\t\tif (majorVersion === 8) {\n\t\t\t\t_imageWidth = 512;\n\t\t\t}\n\t\t}\n\t\t// maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수\n\t\treturn Math.min(maxCubeMapTextureSize, _imageWidth);\n\t}\n}\n\nexport default CubeRenderer;\n","\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\n\nexport default class CubeStripRenderer extends Renderer {\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}`;\n\t}\n\n\tgetVertexPositionData() {\n\t\tif (!this._vertices) {\n\t\t\tthis._vertices = [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// up\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// down\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\t\t}\n\n\t\treturn this._vertices;\n\t}\n\n\tgetIndexData() {\n\t\t// TODO: 한번만 계산하도록 수정하기\n\t\tconst indices = (() => {\n\t\t\tconst indexData = [];\n\n\t\t\tfor (let i = 0; i < (this._vertices.length / 3); i += 4) {\n\t\t\t\tindexData.push(\n\t\t\t\t\ti,\n\t\t\t\t\ti + 1,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti + 3\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn indexData;\n\t\t})();\n\n\t\treturn indices;\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\t// TODO: make it cols, rows as config.\n\t\tconst cols = 3;\n\t\tconst rows = 2;\n\t\tconst order = imageConfig.order || \"RLUDFB\";\n\t\tlet coords = [];\n\n\t\t// 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다.\n\t\tfor (let r = rows - 1; r >= 0; r--) {\n\t\t\tfor (let c = 0; c < cols; c++) {\n\t\t\t\tconst coord = [\n\t\t\t\t\tc / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, (r + 1) / rows,\n\t\t\t\t\tc / cols, (r + 1) / rows\n\t\t\t\t];\n\n\t\t\t\tcoords.push(coord);\n\t\t\t}\n\t\t}\n\n\t\tconst tileConfigs = this._extractTileConfig(imageConfig);\n\n\t\t// Transform Coord By Flip & Rotation\n\t\tcoords = coords\n\t\t// shrink coord to avoid pixel bleeding\n\t\t\t.map(coord => this._shrinkCoord(coord))\n\t\t\t.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));\n\n\t\t// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치\n\t\treturn \"BFUDRL\".split(\"\")\n\t\t\t.map(face => order.indexOf(face))\n\t\t\t.map(index => coords[index])\n\t\t\t.reduce((acc, val) => acc.concat(val), []);\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\t_transformCoord(coord, tileConfig) {\n\t\tlet newCoord = coord.slice();\n\n\t\tif (tileConfig.flipHorizontal) {\n\t\t\tnewCoord = this._flipHorizontalCoord(newCoord);\n\t\t}\n\n\t\tif (tileConfig.rotation) {\n\t\t\tnewCoord = this._rotateCoord(newCoord, tileConfig.rotation);\n\t\t}\n\n\t\treturn newCoord;\n\t}\n\n\t_shrinkCoord(coord) {\n\t\tconst SHRINK_Y = 0.00;\n\t\tconst SHRINK_X = 0.00;\n\n\t\treturn [\n\t\t\tcoord[0] + SHRINK_X, coord[1] + SHRINK_Y,\n\t\t\tcoord[2] - SHRINK_X, coord[3] + SHRINK_Y,\n\t\t\tcoord[4] - SHRINK_X, coord[5] - SHRINK_Y,\n\t\t\tcoord[6] + SHRINK_X, coord[7] - SHRINK_Y\n\t\t];\n\t}\n\n\t_rotateCoord(coord, rotationAngle) {\n\t\tconst SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord.\n\t\tconst shiftCount = parseInt(rotationAngle / 90, 10) % 4;\n\n\t\tif (shiftCount === 0) {\n\t\t\treturn coord;\n\t\t}\n\n\t\tlet moved;\n\t\tlet rotatedCoord = [];\n\n\t\tif (shiftCount > 0) {\n\t\t\tmoved = coord.splice(0, shiftCount * SIZE);\n\t\t\trotatedCoord = coord.concat(moved);\n\t\t} else {\n\t\t\tmoved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE);\n\t\t\trotatedCoord = moved.concat(coord);\n\t\t}\n\n\t\treturn rotatedCoord;\n\t}\n\n\t_flipHorizontalCoord(coord) {\n\t\treturn [\n\t\t\tcoord[2], coord[3],\n\t\t\tcoord[0], coord[1],\n\t\t\tcoord[6], coord[7],\n\t\t\tcoord[4], coord[5]\n\t\t];\n\t}\n}\n","/**\n * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide})\n * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고)\n * @namespace\n * @name GYRO_MODE\n * @memberof eg.view360.PanoViewer\n */\n/**\n * Disable gyro\n * @ko gyro 비활성화\n * @name NONE\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"none\"\n */\n/**\n * YawPitch Mode\n * @ko YawPitch Mode\n * @name YAWPITCH\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"yawPitch\"\n */\n/**\n * VR Mode\n * @ko VR Mode\n * @name VR\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"VR\"\n */\nimport {GYRO_MODE} from \"../YawPitchControl/consts\";\n\n/**\n * Constant value for errors\n * @ko 에러에 대한 상수 값\n * @namespace\n * @name ERROR_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst ERROR_TYPE = {\n\t/**\n\t * Unsupported device\n\t * @ko 미지원 기기\n\t * @name INVALID_DEVICE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 10\n\t */\n\tINVALID_DEVICE: 10,\n\t/**\n\t * Webgl not support\n\t * @ko WEBGL 미지원\n\t * @name NO_WEBGL\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 11\n\t */\n\tNO_WEBGL: 11,\n\t/**\n\t * Failed to load image\n\t * @ko 이미지 로드 실패\n\t * @name FAIL_IMAGE_LOAD\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 12\n\t */\n\tFAIL_IMAGE_LOAD: 12,\n\t/**\n\t * Failed to bind texture\n\t * @ko 텍스쳐 바인딩 실패\n\t * @name FAIL_BIND_TEXTURE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 13\n\t */\n\tFAIL_BIND_TEXTURE: 13,\n\t/**\n\t * Only one resource(image or video) should be specified\n\t * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t * @name INVALID_RESOURCE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 14\n\t */\n\tINVALID_RESOURCE: 14,\n\t/**\n\t * WebGL context lost occurred\n\t * @ko WebGL context lost 발생\n\t * @name RENDERING_CONTEXT_LOST\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 15\n\t */\n\tRENDERING_CONTEXT_LOST: 15,\n};\n\n/**\n * Constant value for events\n * @ko 이벤트에 대한 상수 값\n * @namespace\n * @name EVENTS\n * @memberof eg.view360.PanoViewer\n */\nconst EVENTS = {\n\t/**\n\t * Events that is fired when PanoViewer is ready to show image and handle user interaction.\n\t * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트\n\t * @name READY\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default ready\n\t */\n\tREADY: \"ready\",\n\t/**\n\t * Events that is fired when direction or fov is changed.\n\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t * @name VIEW_CHANGE\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default viewChange\n\t */\n\tVIEW_CHANGE: \"viewChange\",\n\t/**\n\t * Events that is fired when animation which is triggered by inertia is ended.\n\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t * @name ANIMATION_END\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default animationEnd\n\t */\n\tANIMATION_END: \"animationEnd\",\n\t/**\n\t * Events that is fired when error occurs\n\t * @ko 에러 발생 시 발생하는 이벤트\n\t * @name ERROR\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default error\n\t */\n\tERROR: \"error\"\n};\n\n/**\n * Constant value for projection type\n * @ko 프로젝션 타입 대한 상수 값\n * @namespace\n * @name PROJECTION_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst PROJECTION_TYPE = {\n\t/**\n\t * Constant value for equirectangular type.\n\t * @ko equirectangular 에 대한 상수 값.\n\t * @name EQUIRECTANGULAR\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default equirectangular\n\t */\n\tEQUIRECTANGULAR: \"equirectangular\",\n\t/**\n\t * Constant value for cubemap type.\n\t * @ko cubemap 에 대한 상수 값.\n\t * @name CUBEMAP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubemap\n\t */\n\tCUBEMAP: \"cubemap\",\n\t/**\n\t * Constant value for cubestrip type.\n\t * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC.\n\t *\n\t * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다.\n\t * @name CUBESTRIP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubestrip\n\t */\n\tCUBESTRIP: \"cubestrip\",\n\t/**\n\t * Constant value for PANORAMA type.\n\t *\n\t * PANORAMA is a format for a panorma image which is taken from smartphone.\n\t *\n\t * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다.\n\t *\n\t * @name PANORAMA\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default panorama\n\t */\n\tPANORAMA: \"panorama\",\n\t/**\n\t * Constant value for EQUI_STEREOSCOPY type.\n\t *\n\t * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present.\n\t *\n\t * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다.\n\t *\n\t * @name STEREOSCOPIC_EQUI\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default stereoequi\n\t */\n\tSTEREOSCOPIC_EQUI: \"stereoequi\",\n};\n\n/**\n * A constant value for the format of the stereoscopic equirectangular projection type.\n * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값\n * @namespace\n * @name STEREO_FORMAT\n * @memberof eg.view360.PanoViewer\n */\nconst STEREO_FORMAT = {\n\t/**\n\t * A constant value for format of top bottom stereoscopic 360 equirectangular projection.\n\t * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name TOP_BOTTOM\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dv\"\n\t */\n\tTOP_BOTTOM: \"3dv\",\n\t/**\n\t * A constant value for format of left right stereoscopic 360 equirectangular projection.\n\t * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name LEFT_RIGHT\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dh\"\n\t */\n\tLEFT_RIGHT: \"3dh\",\n\t/**\n\t * A constant value specifying media is not in stereoscopic format.\n\t * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값.\n\t * @name NONE\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"\"\n\t */\n\tNONE: \"\",\n};\n\nexport {\n\tGYRO_MODE,\n\tEVENTS,\n\tERROR_TYPE,\n\tPROJECTION_TYPE,\n\tSTEREO_FORMAT\n};\n","import {glMatrix} from \"gl-matrix\";\nimport Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\n\n// const latitudeBands = 60;\nconst MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6;\nconst longitudeBands = 60;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\n\nclass CylinderRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tgetVertexPositionData() {\n\t\treturn CylinderRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn CylinderRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn CylinderRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\t\tlet resizeDimension;\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device texture limit(${maxSize}))`);\n\n\t\t\t// Request resizing texture.\n\t\t\t/**\n\t\t\t * TODO: Is it need to apply on another projection type?\n\t\t\t */\n\t\t\tresizeDimension = width > height ?\n\t\t\t\t{width: maxSize, height: maxSize * height / width} :\n\t\t\t\t{width: maxSize * width / height, height: maxSize};\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video or resizing needed\n\t\tthis._initPixelSource(image, resizeDimension);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\tupdateShaderData({imageAspectRatio = MIN_ASPECT_RATIO_FOR_FULL_PANORAMA}) {\n\t\tlet lngIdx;\n\t\tlet cylinderMaxRadian;\n\t\tlet halfCylinderY;\n\t\tlet rotated;\n\t\tlet aspectRatio;\n\n\t\t// Exception case: orientation is rotated.\n\t\tif (imageAspectRatio < 1) {\n\t\t\t/**\n\t\t\t * If rotated is true, we assume that image is rotated counter clockwise.\n\t\t\t * TODO: If there's other rotation, it is need to implement by each rotation.\n\t\t\t */\n\t\t\trotated = true;\n\t\t\taspectRatio = 1 / imageAspectRatio;\n\t\t} else {\n\t\t\trotated = false;\n\t\t\taspectRatio = imageAspectRatio;\n\t\t}\n\n\t\tif (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) {\n\t\t\tconst fov = 360 / aspectRatio;\n\n\t\t\tcylinderMaxRadian = 2 * Math.PI; // 360 deg\n\t\t\thalfCylinderY = Math.tan(glMatrix.toRadian(fov / 2));\n\t\t} else {\n\t\t\tcylinderMaxRadian = aspectRatio;\n\t\t\thalfCylinderY = 0.5;// Range of cylinder is [-0.5, 0.5] to make height to 1.\n\t\t}\n\n\t\t// intialize shader data before update\n\t\ttextureCoordData.length = 0;\n\t\tvertexPositionData.length = 0;\n\t\tindexData.length = 0;\n\n\t\tconst CYLIDER_Y = [-halfCylinderY, halfCylinderY];\n\t\tconst startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360)\n\n\t\t// console.log(\"cylinderMaxRadian:\", glMatrix.toDegree(cylinderMaxRadian), \"CYLIDER_Y\", CYLIDER_Y, \"start angle\", glMatrix.toDegree(startAngleForCenterAlign));\n\t\tfor (let yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength/* bottom & top */; yIdx++) {\n\t\t\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\t\t\tconst angle = startAngleForCenterAlign + (lngIdx / longitudeBands * cylinderMaxRadian);\n\t\t\t\tconst x = Math.cos(angle);\n\t\t\t\tconst y = CYLIDER_Y[yIdx];\n\t\t\t\tconst z = Math.sin(angle);\n\t\t\t\tlet u;\n\t\t\t\tlet v;\n\n\t\t\t\tif (rotated) {\n\t\t\t\t\t// Rotated 90 degree (counter clock wise)\n\t\t\t\t\tu = 1 - yIdx; // yLength - yIdx;\n\t\t\t\t\tv = lngIdx / longitudeBands;\n\t\t\t\t} else {\n\t\t\t\t// \t// Normal case (Not rotated)\n\t\t\t\t\tu = lngIdx / longitudeBands;\n\t\t\t\t\tv = yIdx;\n\t\t\t\t}\n\n\t\t\t\ttextureCoordData.push(u, v);\n\t\t\t\tvertexPositionData.push(x, y, z);\n\n\t\t\t\tif (yIdx === 0 && lngIdx < longitudeBands) {\n\t\t\t\t\tconst a = lngIdx;\n\t\t\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default CylinderRenderer;\n","import {mat4} from \"gl-matrix\";\n\nconst VR_DISPLAY_PRESENT_CHANGE = \"vrdisplaypresentchange\";\nconst DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1];\nconst DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1];\nconst EYES = {\n\tLEFT: \"left\",\n\tRIGHT: \"right\"\n};\n\nclass VRManager {\n\tget context() { return this._vrDisplay; }\n\n\tconstructor() {\n\t\tthis._frameData = new window.VRFrameData();\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst vrDisplay = this._vrDisplay;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (vrDisplay && vrDisplay.isPresenting) {\n\t\t\tvrDisplay.exitPresent();\n\t\t}\n\n\t\tthis._clear();\n\t}\n\n\tcanRender() {\n\t\treturn Boolean(this._vrDisplay);\n\t}\n\n\tbeforeRender(gl) {\n\t\t// Render to the default backbuffer\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t}\n\n\tafterRender() {\n\t\tthis._vrDisplay.submitFrame();\n\t}\n\n\tgetEyeParams(gl) {\n\t\tconst display = this._vrDisplay;\n\t\tconst halfWidth = gl.drawingBufferWidth * 0.5;\n\t\tconst height = gl.drawingBufferHeight;\n\t\tconst frameData = this._frameData;\n\n\t\tdisplay.getFrameData(frameData);\n\n\t\tconst leftMVMatrix = frameData.leftViewMatrix;\n\t\tconst rightMVMatrix = frameData.rightViewMatrix;\n\n\t\tmat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset);\n\t\tmat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tviewport: [0, 0, halfWidth, height],\n\t\t\t\tmvMatrix: leftMVMatrix,\n\t\t\t\tpMatrix: frameData.leftProjectionMatrix,\n\t\t\t},\n\t\t\t{\n\t\t\t\tviewport: [halfWidth, 0, halfWidth, height],\n\t\t\t\tmvMatrix: rightMVMatrix,\n\t\t\t\tpMatrix: frameData.rightProjectionMatrix,\n\t\t\t}\n\t\t];\n\t}\n\n\tisPresenting() {\n\t\treturn Boolean(this._vrDisplay && this._vrDisplay.isPresenting);\n\t}\n\n\taddEndCallback(callback) {\n\t\twindow.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\twindow.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\trequestPresent(canvas) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tnavigator.getVRDisplays().then(displays => {\n\t\t\t\tconst vrDisplay = displays.length && displays[0];\n\n\t\t\t\tif (!vrDisplay) {\n\t\t\t\t\treject(new Error(\"No displays available.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!vrDisplay.capabilities.canPresent) {\n\t\t\t\t\treject(new Error(\"Display lacking capability to present.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvrDisplay.requestPresent([{source: canvas}]).then(() => {\n\t\t\t\t\tconst leftEye = vrDisplay.getEyeParameters(EYES.LEFT);\n\t\t\t\t\tconst rightEye = vrDisplay.getEyeParameters(EYES.RIGHT);\n\n\t\t\t\t\tcanvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;\n\t\t\t\t\tcanvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);\n\n\t\t\t\t\tthis._setDisplay(vrDisplay);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setDisplay(vrDisplay) {\n\t\tthis._vrDisplay = vrDisplay;\n\n\t\tconst layers = vrDisplay.getLayers();\n\n\t\tif (layers.length) {\n\t\t\tconst layer = layers[0];\n\n\t\t\tthis._leftBounds = layer.leftBounds;\n\t\t\tthis._rightBounds = layer.rightBounds;\n\t\t}\n\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._vrDisplay = null;\n\t\tthis._leftBounds = DEFAULT_LEFT_BOUNDS;\n\t\tthis._rightBounds = DEFAULT_RIGHT_BOUNDS;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default VRManager;\n","import {mat4, glMatrix} from \"gl-matrix\";\nimport {IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\n\nconst XR_REFERENCE_SPACE = \"local\";\n\nclass XRManager {\n\tget context() { return this._xrSession; }\n\n\tconstructor() {\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst xrSession = this._xrSession;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (xrSession) {\n\t\t\t// Capture to avoid errors\n\t\t\txrSession.end().then(() => {}, () => {});\n\t\t}\n\t\tthis._clear();\n\t}\n\n\tcanRender(frame) {\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\treturn Boolean(pose);\n\t}\n\n\tbeforeRender(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst baseLayer = session.renderState.baseLayer;\n\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer);\n\t}\n\n\tafterRender() {}\n\n\tgetEyeParams(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\tif (!pose) {\n\t\t\t// Can't render\n\t\t\treturn null;\n\t\t}\n\n\t\tconst glLayer = session.renderState.baseLayer;\n\n\t\treturn pose.views.map(view => {\n\t\t\tconst viewport = glLayer.getViewport(view);\n\t\t\tconst mvMatrix = view.transform.inverse.matrix;\n\n\t\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\t\tmat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180));\n\t\t\t}\n\n\t\t\tmat4.rotateY(mvMatrix, mvMatrix, this._yawOffset);\n\n\t\t\treturn {\n\t\t\t\tviewport: [viewport.x, viewport.y, viewport.width, viewport.height],\n\t\t\t\tmvMatrix,\n\t\t\t\tpMatrix: view.projectionMatrix\n\t\t\t};\n\t\t});\n\t}\n\n\tisPresenting() {\n\t\treturn this._presenting;\n\t}\n\n\taddEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.addEventListener(\"end\", callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.removeEventListener(\"end\", callback);\n\t}\n\n\trequestPresent(canvas, gl) {\n\t\treturn navigator.xr.requestSession(\"immersive-vr\", {\n\t\t\trequiredFeatures: [XR_REFERENCE_SPACE],\n\t\t}).then(session => {\n\t\t\tconst xrLayer = new window.XRWebGLLayer(session, gl);\n\n\t\t\tsession.updateRenderState({baseLayer: xrLayer});\n\t\t\treturn session.requestReferenceSpace(XR_REFERENCE_SPACE)\n\t\t\t\t.then(refSpace => {\n\t\t\t\t\tthis._setSession(session, xrLayer, refSpace);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setSession(session, xrLayer, refSpace) {\n\t\tthis._xrSession = session;\n\t\tthis._xrLayer = xrLayer;\n\t\tthis._xrRefSpace = refSpace;\n\t\tthis._presenting = true;\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._xrSession = null;\n\t\tthis._xrLayer = null;\n\t\tthis._xrRefSpace = null;\n\t\tthis._presenting = false;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default XRManager;\n","import {IS_SAFARI_ON_DESKTOP} from \"../utils/browser\";\n\nclass WebGLAnimator {\n\tconstructor() {\n\t\tthis._callback = null;\n\t\tthis._context = window;\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\tsetCallback(callback) {\n\t\tthis._callback = callback;\n\t}\n\n\tsetContext(context) {\n\t\tthis._context = context;\n\t}\n\n\tstart() {\n\t\tconst context = this._context;\n\t\tconst callback = this._callback;\n\n\t\t// No context / callback set\n\t\tif (!context || !callback) return;\n\t\t// Animation already started\n\t\tif (this._rafId >= 0 || this._rafTimer >= 0) return;\n\n\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoopNextTick);\n\t\t} else {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoop);\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this._rafId >= 0) {\n\t\t\tthis._context.cancelAnimationFrame(this._rafId);\n\t\t}\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t}\n\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\t/**\n\t * There can be more than 1 argument when we use XRSession's raf\n\t */\n\t_onLoop = (...args) => {\n\t\tthis._callback(...args);\n\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t}\n\n\t/**\n\t * MacOS X Safari Bug Fix\n\t * This code guarantees that rendering should be occurred.\n\t *\n\t * In MacOS X(10.14.2), Safari (12.0.2)\n\t * The requestAnimationFrame(RAF) callback is called just after previous RAF callback without term\n\t * only if requestAnimationFrame is called for next frame while updating frame is delayed (~over 2ms)\n\t * So browser cannot render the frame and may be freezing.\n\t */\n\t_onLoopNextTick = (...args) => {\n\t\tconst before = performance.now();\n\n\t\tthis._callback(...args);\n\n\t\tconst diff = performance.now() - before;\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t\tthis._rafTimer = -1;\n\t\t}\n\n\t\t/** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */\n\t\tif (diff < 16) {\n\t\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t\t} else {\n\t\t\t/** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/\n\t\t\tthis._rafTimer = setTimeout(this._onLoop, 0);\n\t\t}\n\t}\n}\n\nexport default WebGLAnimator;\n","import Component from \"@egjs/component\";\nimport {glMatrix, vec3, mat3, mat4, quat} from \"gl-matrix\";\nimport ImageLoader from \"./ImageLoader\";\nimport VideoLoader from \"./VideoLoader\";\nimport WebGLUtils from \"./WebGLUtils\";\nimport Renderer from \"./renderer/Renderer\";\nimport CubeRenderer from \"./renderer/CubeRenderer\";\nimport CubeStripRenderer from \"./renderer/CubeStripRenderer\";\nimport SphereRenderer from \"./renderer/SphereRenderer\";\nimport CylinderRenderer from \"./renderer/CylinderRenderer\";\nimport VRManager from \"./vr/VRManager\";\nimport XRManager from \"./vr/XRManager\";\nimport WebGLAnimator from \"./WebGLAnimator\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {devicePixelRatio, WEBXR_SUPPORTED} from \"../utils/browserFeature\";\nimport {PROJECTION_TYPE, STEREO_FORMAT} from \"../PanoViewer/consts\";\nimport {IS_IOS} from \"../utils/browser\";\n\nconst ImageType = PROJECTION_TYPE;\n\nlet DEVICE_PIXEL_RATIO = devicePixelRatio || 1;\n\n// DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다.\nif (DEVICE_PIXEL_RATIO > 2) {\n\tDEVICE_PIXEL_RATIO = 2;\n}\n\n// define custom events name\n/**\n * TODO: how to manage events/errortype with PanoViewer\n *\n * I think renderer events should be seperated from viewer events although it has same name.\n */\nconst EVENTS = {\n\tBIND_TEXTURE: \"bindTexture\",\n\tIMAGE_LOADED: \"imageLoaded\",\n\tERROR: \"error\",\n\tRENDERING_CONTEXT_LOST: \"renderingContextLost\",\n\tRENDERING_CONTEXT_RESTORE: \"renderingContextRestore\",\n};\n\nconst ERROR_TYPE = {\n\tINVALID_DEVICE: 10,\n\tNO_WEBGL: 11,\n\tFAIL_IMAGE_LOAD: 12,\n\tRENDERER_ERROR: 13\n};\n\nclass PanoImageRenderer extends Component {\n\tstatic EVENTS = EVENTS;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\n\tconstructor(\n\t\timage, width, height, isVideo, sphericalConfig, renderingContextAttributes\n\t) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis.sphericalConfig = sphericalConfig;\n\t\tthis.fieldOfView = sphericalConfig.fieldOfView;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tthis._lastQuaternion = null;\n\t\tthis._lastYaw = null;\n\t\tthis._lastPitch = null;\n\t\tthis._lastFieldOfView = null;\n\n\t\tthis.pMatrix = mat4.create();\n\t\tthis.mvMatrix = mat4.create();\n\n\t\t// initialzie pMatrix\n\t\tmat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), width / height, 0.1, 100);\n\n\t\tthis.textureCoordBuffer = null;\n\t\tthis.vertexBuffer = null;\n\t\tthis.indexBuffer = null;\n\n\t\tthis.canvas = this._initCanvas(width, height);\n\t\tthis._setDefaultCanvasStyle();\n\t\tthis._wrapper = null; // canvas wrapper\n\t\tthis._wrapperOrigStyle = null;\n\n\t\tthis._renderingContextAttributes = renderingContextAttributes;\n\t\tthis._image = null;\n\t\tthis._imageConfig = null;\n\t\tthis._imageIsReady = false;\n\t\tthis._shouldForceDraw = false;\n\t\tthis._keepUpdate = false; // Flag to specify 'continuous update' on video even when still.\n\n\t\tthis._onContentLoad = this._onContentLoad.bind(this);\n\t\tthis._onContentError = \tthis._onContentError.bind(this);\n\n\t\tthis._animator = new WebGLAnimator();\n\n\t\t// VR/XR manager\n\t\tthis._vr = null;\n\n\t\tif (image) {\n\t\t\tthis.setImage({\n\t\t\t\timage,\n\t\t\t\timageType: sphericalConfig.imageType,\n\t\t\t\tisVideo,\n\t\t\t\tcubemapConfig: sphericalConfig.cubemapConfig\n\t\t\t});\n\t\t}\n\t}\n\n\t// FIXME: Please refactor me to have more loose connection to yawpitchcontrol\n\tsetYawPitchControl(yawPitchControl) {\n\t\tthis._yawPitchControl = yawPitchControl;\n\t}\n\n\tgetContent() {\n\t\treturn this._image;\n\t}\n\n\tsetImage({image, imageType, isVideo = false, cubemapConfig}) {\n\t\tthis._imageIsReady = false;\n\t\tthis._isVideo = isVideo;\n\t\tthis._imageConfig = Object.assign(\n\t\t\t{\n\t\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only */\n\t\t\t\torder: (imageType === ImageType.CUBEMAP) ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\t\ttileConfig: {\n\t\t\t\t\tflipHorizontal: false,\n\t\t\t\t\trotation: 0\n\t\t\t\t}\n\t\t\t},\n\t\t\tcubemapConfig\n\t\t);\n\t\tthis._setImageType(imageType);\n\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tif (isVideo) {\n\t\t\tthis._contentLoader = new VideoLoader();\n\t\t\tthis._keepUpdate = true;\n\t\t} else {\n\t\t\tthis._contentLoader = new ImageLoader();\n\t\t\tthis._keepUpdate = false;\n\t\t}\n\n\t\t// img element or img url\n\t\tthis._contentLoader.set(image);\n\n\t\t// 이미지의 사이즈를 캐시한다.\n\t\t// image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed.\n\t\tthis._image = this._contentLoader.getElement();\n\n\t\treturn this._contentLoader.get()\n\t\t\t.then(this._onContentLoad, this._onContentError)\n\t\t\t.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.\n\t}\n\n\t_setImageType(imageType) {\n\t\tif (!imageType || this._imageType === imageType) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._imageType = imageType;\n\t\tthis._isCubeMap = imageType === ImageType.CUBEMAP;\n\n\t\tif (this._renderer) {\n\t\t\tthis._renderer.off();\n\t\t}\n\n\t\tswitch (imageType) {\n\t\t\tcase ImageType.CUBEMAP:\n\t\t\t\tthis._renderer = new CubeRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.CUBESTRIP:\n\t\t\t\tthis._renderer = new CubeStripRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.PANORAMA:\n\t\t\t\tthis._renderer = new CylinderRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.STEREOSCOPIC_EQUI:\n\t\t\t\tthis._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis._renderer = new SphereRenderer(STEREO_FORMAT.NONE);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis._renderer.on(Renderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERER_ERROR,\n\t\t\t\tmessage: e.message\n\t\t\t});\n\t\t});\n\n\t\tthis._initWebGL();\n\t}\n\n\t_initCanvas(width, height) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\n\t\tthis._onWebglcontextlost = this._onWebglcontextlost.bind(this);\n\t\tthis._onWebglcontextrestored = this._onWebglcontextrestored.bind(this);\n\n\t\tcanvas.addEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tcanvas.addEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\n\t\treturn canvas;\n\t}\n\n\t_setDefaultCanvasStyle() {\n\t\tconst canvas = this.canvas;\n\n\t\tcanvas.style.bottom = 0;\n\t\tcanvas.style.left = 0;\n\t\tcanvas.style.right = 0;\n\t\tcanvas.style.top = 0;\n\t\tcanvas.style.margin = \"auto\";\n\t\tcanvas.style.maxHeight = \"100%\";\n\t\tcanvas.style.maxWidth = \"100%\";\n\t\tcanvas.style.outline = \"none\";\n\t\tcanvas.style.position = \"absolute\";\n\t}\n\n\t_onContentError(error) {\n\t\tthis._imageIsReady = false;\n\t\tthis._image = null;\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\ttype: ERROR_TYPE.FAIL_IMAGE_LOAD,\n\t\t\tmessage: \"failed to load image\"\n\t\t});\n\n\t\treturn false;\n\t}\n\n\t_triggerContentLoad() {\n\t\tthis.trigger(EVENTS.IMAGE_LOADED, {\n\t\t\tcontent: this._image,\n\t\t\tisVideo: this._isVideo,\n\t\t\tprojectionType: this._imageType\n\t\t});\n\t}\n\t_onContentLoad(image) {\n\t\tthis._imageIsReady = true;\n\n\t\tthis._triggerContentLoad();\n\t\treturn true;\n\t}\n\n\tisImageLoaded() {\n\t\treturn !!this._image && this._imageIsReady &&\n\t\t\t(!this._isVideo || this._image.readyState >= 2 /* HAVE_CURRENT_DATA */);\n\t}\n\n\tbindTexture() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._contentLoader) {\n\t\t\t\trej(\"ImageLoader is not initialized\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._contentLoader.get()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis._bindTexture();\n\t\t\t\t}, rej)\n\t\t\t\t.then(res);\n\t\t});\n\t}\n\n\t// 부모 엘리먼트에 canvas 를 붙임\n\tattachTo(parentElement) {\n\t\tthis.detach();\n\t\tparentElement.appendChild(this.canvas);\n\t\tthis._wrapper = parentElement;\n\t}\n\n\tforceContextLoss() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\tconst loseContextExtension = this.context.getExtension(\"WEBGL_lose_context\");\n\n\t\t\tif (loseContextExtension) {\n\t\t\t\tloseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t}\n\n\t// 부모 엘리먼트에서 canvas 를 제거\n\tdetach() {\n\t\tif (this.canvas.parentElement) {\n\t\t\tthis.canvas.parentElement.removeChild(this.canvas);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tthis._animator.stop();\n\t\tthis.detach();\n\t\tthis.forceContextLoss();\n\n\t\tthis.off();\n\n\t\tthis.canvas.removeEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tthis.canvas.removeEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\t}\n\n\thasRenderingContext() {\n\t\tif (!(this.context && !this.context.isContextLost())) {\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tthis.context &&\n\t\t\t!this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t_initShaderProgram() {\n\t\tconst gl = this.context;\n\n\t\tif (this.shaderProgram) {\n\t\t\tgl.deleteProgram(this.shaderProgram);\n\t\t\tthis.shaderProgram = null;\n\t\t}\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst vsSource = renderer.getVertexShaderSource();\n\t\tconst fsSource = renderer.getFragmentShaderSource();\n\n\t\tconst vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource);\n\t\tconst fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource);\n\n\t\tconst shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader);\n\n\t\tif (!shaderProgram) {\n\t\t\tthrow new Error(`Failed to intialize shaders: ${WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())}`);\n\t\t}\n\n\t\tgl.useProgram(shaderProgram);\n\t\tshaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\");\n\t\tgl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);\n\t\tshaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, \"uPMatrix\");\n\t\tshaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, \"uMVMatrix\");\n\t\tshaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, \"uSampler\");\n\t\tshaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, \"aTextureCoord\");\n\t\tshaderProgram.uEye = gl.getUniformLocation(shaderProgram, \"uEye\");\n\n\t\tgl.enableVertexAttribArray(shaderProgram.textureCoordAttribute);\n\n\t\t// clear buffer\n\t\tgl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n\t\t// Use TEXTURE0\n\t\tgl.uniform1i(shaderProgram.samplerUniform, 0);\n\n\t\tthis.shaderProgram = shaderProgram;\n\t}\n\n\t_onWebglcontextlost(e) {\n\t\te.preventDefault();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_LOST);\n\t}\n\n\t_onWebglcontextrestored(e) {\n\t\tthis._initWebGL();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_RESTORE);\n\t}\n\n\tupdateFieldOfView(fieldOfView) {\n\t\tthis.fieldOfView = fieldOfView;\n\t\tthis._updateViewport();\n\t}\n\n\tupdateViewportDimensions(width, height) {\n\t\tlet viewPortChanged = false;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tconst w = width * DEVICE_PIXEL_RATIO;\n\t\tconst h = height * DEVICE_PIXEL_RATIO;\n\n\t\tif (w !== this.canvas.width) {\n\t\t\tthis.canvas.width = w;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (h !== this.canvas.height) {\n\t\t\tthis.canvas.height = h;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (!viewPortChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._updateViewport();\n\t\tthis._shouldForceDraw = true;\n\t}\n\n\t_updateViewport() {\n\t\tmat4.perspective(\n\t\t\tthis.pMatrix,\n\t\t\tglMatrix.toRadian(this.fieldOfView),\n\t\t\tthis.canvas.width / this.canvas.height,\n\t\t\t0.1,\n\t\t\t100);\n\n\t\tthis.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight);\n\t}\n\n\t_initWebGL() {\n\t\tlet gl;\n\n\t\t// TODO: Following code does need to be executed only if width/height, cubicStrip property is changed.\n\t\ttry {\n\t\t\tthis._initRenderingContext();\n\t\t\tgl = this.context;\n\n\t\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\t\tthis._initShaderProgram();\n\t\t} catch (e) {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\tmessage: \"no webgl support\"\n\t\t\t});\n\t\t\tthis.destroy();\n\t\t\tconsole.error(e); // eslint-disable-line no-console\n\t\t\treturn;\n\t\t}\n\t\t// 캔버스를 투명으로 채운다.\n\t\tgl.clearColor(0, 0, 0, 0);\n\t\tconst textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n\n\t\tif (this.texture) {\n\t\t\tgl.deleteTexture(this.texture);\n\t\t}\n\n\t\tthis.texture = WebGLUtils.createTexture(gl, textureTarget);\n\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\t// TODO: Apply following options on other projection type.\n\t\t\tgl.enable(gl.CULL_FACE);\n\t\t\t// gl.enable(gl.DEPTH_TEST);\n\t\t}\n\t}\n\n\t_initRenderingContext() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!window.WebGLRenderingContext) {\n\t\t\tthrow new Error(\"WebGLRenderingContext not available.\");\n\t\t}\n\n\t\tthis.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes);\n\n\t\tif (!this.context) {\n\t\t\tthrow new Error(\"Failed to acquire 3D rendering context\");\n\t\t}\n\t}\n\n\t_initBuffers() {\n\t\tconst vertexPositionData = this._renderer.getVertexPositionData();\n\t\tconst indexData = this._renderer.getIndexData();\n\t\tconst textureCoordData = this._renderer.getTextureCoordData(this._imageConfig);\n\t\tconst gl = this.context;\n\n\t\tthis.vertexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3,\n\t\t\tthis.shaderProgram.vertexPositionAttribute);\n\n\t\tthis.indexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1);\n\n\t\tthis.textureCoordBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2,\n\t\t\tthis.shaderProgram.textureCoordAttribute);\n\n\t\tthis._bindBuffers();\n\t}\n\n\t_bindTexture() {\n\t\t// Detect if it is EAC Format while CUBESTRIP mode.\n\t\t// We assume it is EAC if image is not 3/2 ratio.\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst isEAC = width && height && width / height !== 1.5;\n\n\t\t\tthis.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, \"uIsEAC\"), isEAC);\n\t\t} else if (this._imageType === ImageType.PANORAMA) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst imageAspectRatio = width && height && width / height;\n\n\t\t\tthis._renderer.updateShaderData({imageAspectRatio});\n\t\t}\n\n\t\t// intialize shader buffers after image is loaded.(by updateShaderData)\n\t\t// because buffer may be differ by image size.(eg. CylinderRenderer)\n\t\tthis._initBuffers();\n\n\t\tthis._renderer.bindTexture(\n\t\t\tthis.context,\n\t\t\tthis.texture,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t\tthis._shouldForceDraw = true;\n\n\t\tthis.trigger(EVENTS.BIND_TEXTURE);\n\t}\n\n\t_updateTexture() {\n\t\tthis._renderer.updateTexture(\n\t\t\tthis.context,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t}\n\n\tkeepUpdate(doUpdate) {\n\t\tif (doUpdate && this.isImageLoaded() === false) {\n\t\t\t// Force to draw a frame after image is loaded on render()\n\t\t\tthis._shouldForceDraw = true;\n\t\t}\n\n\t\tthis._keepUpdate = doUpdate;\n\t}\n\n\tstartRender() {\n\t\tthis._animator.setCallback(this._render.bind(this));\n\t\tthis._animator.start();\n\t}\n\n\tstopRender() {\n\t\tthis._animator.stop();\n\t}\n\n\trenderWithQuaternion(quaternion, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\tthis._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) &&\n\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// updatefieldOfView only if fieldOfView is changed.\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tthis.mvMatrix = mat4.fromQuat(mat4.create(), quaternion);\n\n\t\tthis._draw();\n\n\t\tthis._lastQuaternion = quat.clone(quaternion);\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\trenderWithYawPitch(yaw, pitch, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\t\tthis._lastYaw !== null && this._lastYaw === yaw &&\n\t\t\t\tthis._lastPitch !== null && this._lastPitch === pitch &&\n\t\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch));\n\t\tmat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw));\n\n\t\tthis._draw();\n\n\t\tthis._lastYaw = yaw;\n\t\tthis._lastPitch = pitch;\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\t_render() {\n\t\tconst yawPitchControl = this._yawPitchControl;\n\t\tconst fov = yawPitchControl.getFov();\n\n\t\tif (yawPitchControl.shouldRenderWithQuaternion()) {\n\t\t\tconst quaternion = yawPitchControl.getQuaternion();\n\n\t\t\tthis.renderWithQuaternion(quaternion, fov);\n\t\t} else {\n\t\t\tconst yawPitch = yawPitchControl.getYawPitch();\n\n\t\t\tthis.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov);\n\t\t}\n\t}\n\n\t_renderStereo = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\n\t\tconst eyeParams = vr.getEyeParams(gl, frame);\n\n\t\tif (!eyeParams) return;\n\n\t\tvr.beforeRender(gl, frame);\n\n\t\t// Render both eyes\n\t\tfor (const eyeIndex of [0, 1]) {\n\t\t\tconst eyeParam = eyeParams[eyeIndex];\n\n\t\t\tthis.mvMatrix = eyeParam.mvMatrix;\n\t\t\tthis.pMatrix = eyeParam.pMatrix;\n\n\t\t\tgl.viewport(...eyeParam.viewport);\n\t\t\tgl.uniform1f(this.shaderProgram.uEye, eyeIndex);\n\n\t\t\tthis._bindBuffers();\n\t\t\tthis._draw();\n\t\t}\n\n\t\tvr.afterRender();\n\t}\n\n\t_bindBuffers() {\n\t\tconst gl = this.context;\n\t\tconst program = this.shaderProgram;\n\n\t\tconst vertexBuffer = this.vertexBuffer;\n\t\tconst textureCoordBuffer = this.textureCoordBuffer;\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\t\tgl.enableVertexAttribArray(program.vertexPositionAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\n\t\tgl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\t\tgl.enableVertexAttribArray(program.textureCoordAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\t}\n\n\t_draw() {\n\t\tif (this._isVideo && this._keepUpdate) {\n\t\t\tthis._updateTexture();\n\t\t}\n\n\t\tthis._renderer.render({\n\t\t\tgl: this.context,\n\t\t\tshaderProgram: this.shaderProgram,\n\t\t\tindexBuffer: this.indexBuffer,\n\t\t\tmvMatrix: this.mvMatrix,\n\t\t\tpMatrix: this.pMatrix,\n\t\t});\n\t}\n\n\t/**\n\t * Returns projection renderer by each type\n\t */\n\tgetProjectionRenderer() {\n\t\treturn this._renderer;\n\t}\n\n\t/**\n\t * @return Promise\n\t */\n\tenterVR() {\n\t\tconst vr = this._vr;\n\n\t\tif (!WEBXR_SUPPORTED && !navigator.getVRDisplays) {\n\t\t\treturn Promise.reject(\"VR is not available on this browser.\");\n\t\t}\n\t\tif (vr && vr.isPresenting()) {\n\t\t\treturn Promise.resolve(\"VR already enabled.\");\n\t\t}\n\n\t\treturn this._requestPresent();\n\t}\n\n\texitVR = () => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\tif (!vr) return;\n\n\t\tvr.removeEndCallback(this.exitVR);\n\t\tvr.destroy();\n\t\tthis._vr = null;\n\n\t\t// Restore canvas & context on iOS\n\t\tif (IS_IOS) {\n\t\t\tthis._restoreStyle();\n\t\t}\n\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\tthis._updateViewport();\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t\tthis._bindBuffers();\n\t\tthis._shouldForceDraw = true;\n\n\t\tanimator.stop();\n\t\tanimator.setContext(window);\n\t\tanimator.setCallback(this._render.bind(this));\n\t\tanimator.start();\n\t}\n\n\t_requestPresent() {\n\t\tconst gl = this.context;\n\t\tconst canvas = this.canvas;\n\t\tconst animator = this._animator;\n\n\t\tthis._vr = WEBXR_SUPPORTED ?\n\t\t\tnew XRManager() :\n\t\t\tnew VRManager();\n\n\t\tconst vr = this._vr;\n\n\t\tanimator.stop();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvr.requestPresent(canvas, gl)\n\t\t\t\t.then(() => {\n\t\t\t\t\tvr.addEndCallback(this.exitVR);\n\t\t\t\t\tanimator.setContext(vr.context);\n\t\t\t\t\tanimator.setCallback(this._onFirstVRFrame);\n\n\t\t\t\t\tif (IS_IOS) {\n\t\t\t\t\t\tthis._setWrapperFullscreen();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shouldForceDraw = true;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\tresolve(\"success\");\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tvr.destroy();\n\t\t\t\t\tthis._vr = null;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t});\n\t}\n\n\t_onFirstVRFrame = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\t// If rendering is not ready, wait for next frame\n\t\tif (!vr.canRender(frame)) return;\n\n\t\tconst minusZDir = vec3.fromValues(0, 0, -1);\n\t\tconst eyeParam = vr.getEyeParams(gl, frame)[0];\n\t\t// Extract only rotation\n\t\tconst mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix);\n\t\tconst pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix);\n\n\t\tconst mvInv = mat3.invert(mat3.create(), mvMatrix);\n\t\tconst pInv = mat3.invert(mat3.create(), pMatrix);\n\t\tconst viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv);\n\n\t\tvec3.transformMat3(viewDir, viewDir, mvInv);\n\n\t\tconst yawOffset = mathUtil.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1));\n\n\t\tif (yawOffset === 0) {\n\t\t\t// If the yawOffset is exactly 0, then device sensor is not ready\n\t\t\t// So read it again until it has any value in it\n\t\t\treturn;\n\t\t}\n\n\t\tvr.setYawOffset(yawOffset);\n\t\tanimator.setCallback(this._renderStereo);\n\t}\n\n\t_setWrapperFullscreen() {\n\t\tconst wrapper = this._wrapper;\n\n\t\tif (!wrapper) return;\n\n\t\tthis._wrapperOrigStyle = wrapper.getAttribute(\"style\");\n\t\tconst wrapperStyle = wrapper.style;\n\n\t\twrapperStyle.width = \"100vw\";\n\t\twrapperStyle.height = \"100vh\";\n\t\twrapperStyle.position = \"fixed\";\n\t\twrapperStyle.left = \"0\";\n\t\twrapperStyle.top = \"0\";\n\t\twrapperStyle.zIndex = \"9999\";\n\t}\n\n\t_restoreStyle() {\n\t\tconst wrapper = this._wrapper;\n\t\tconst canvas = this.canvas;\n\n\t\tif (!wrapper) return;\n\n\t\tif (this._wrapperOrigStyle) {\n\t\t\twrapper.setAttribute(\"style\", this._wrapperOrigStyle);\n\t\t} else {\n\t\t\twrapper.removeAttribute(\"style\");\n\t\t}\n\n\t\tthis._wrapperOrigStyle = null;\n\n\t\t// Restore canvas style\n\t\tcanvas.removeAttribute(\"style\");\n\t\tthis._setDefaultCanvasStyle();\n\t}\n}\n\nexport default PanoImageRenderer;\n","import Component from \"@egjs/component\";\nimport {glMatrix} from \"gl-matrix\";\nimport {\n\tDeviceMotionEvent, checkXRSupport\n} from \"../utils/browserFeature\";\n\nimport YawPitchControl from \"../YawPitchControl/YawPitchControl\";\nimport PanoImageRenderer from \"../PanoImageRenderer/PanoImageRenderer\";\nimport WebGLUtils from \"../PanoImageRenderer/WebGLUtils\";\nimport {ERROR_TYPE, EVENTS, GYRO_MODE, PROJECTION_TYPE, STEREO_FORMAT} from \"./consts\";\nimport {util as mathUtil} from \"../utils/math-util.js\";\nimport {VERSION} from \"../version\";\n\nclass PanoViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.PanoViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic VERSION = VERSION;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\tstatic EVENTS = EVENTS;\n\tstatic PROJECTION_TYPE = PROJECTION_TYPE;\n\tstatic GYRO_MODE = GYRO_MODE;\n\t// It should be deprecated!\n\tstatic ProjectionType = PROJECTION_TYPE;\n\tstatic STEREO_FORMAT = STEREO_FORMAT;\n\t/**\n\t * Constant value for touch directions\n\t * @ko 터치 방향에 대한 상수 값.\n\t * @namespace\n\t * @name TOUCH_DIRECTION\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic TOUCH_DIRECTION = {\n\t\t/**\n\t\t * Constant value for none direction.\n\t\t * @ko none 방향에 대한 상수 값.\n\t\t * @name NONE\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 1\n\t\t */\n\t\tNONE: YawPitchControl.TOUCH_DIRECTION_NONE,\n\t\t/**\n\t\t * Constant value for horizontal(yaw) direction.\n\t\t * @ko horizontal(yaw) 방향에 대한 상수 값.\n\t\t * @name YAW\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 6\n\t\t */\n\t\tYAW: YawPitchControl.TOUCH_DIRECTION_YAW,\n\t\t/**\n\t\t * Constant value for vertical direction.\n\t\t * @ko vertical(pitch) 방향에 대한 상수 값.\n\t\t * @name PITCH\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 24\n\t\t */\n\t\tPITCH: YawPitchControl.TOUCH_DIRECTION_PITCH,\n\t\t/**\n\t\t * Constant value for all direction.\n\t\t * @ko all 방향에 대한 상수 값.\n\t\t * @name ALL\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 30\n\t\t */\n\t\tALL: YawPitchControl.TOUCH_DIRECTION_ALL\n\t};\n\n\t/**\n\t * @classdesc 360 media viewer\n\t * @ko 360 미디어 뷰어\n\t * @class\n\t * @name eg.view360.PanoViewer\n\t * @extends eg.Component\n\t *\n\t * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트\n\t * @param {Object} config\n\t *\n\t * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
\n\t * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.\n\t * @param {Object} [config.cubemapConfig.order = \"RLUDBF\"(ProjectionType === CUBEMAP) | \"RLUDFB\" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서\n\t * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.\n\t * @param {String} [config.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
\n\t * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위)\n\t * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위)\n\t *\n\t * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위)\n\t * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위)\n\t * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위)\n\t * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다\n\t * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다.\n\t * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE}
\n\t * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위\n\t * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위\n\t * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위\n\t * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
\n\t *\n\t * @example\n\t * // PanoViewer Creation\n\t * // create PanoViewer with option\n\t * var PanoViewer = eg.view360.PanoViewer;\n\t * // Area where the image will be displayed(HTMLElement)\n\t * var container = document.getElementById(\"myPanoViewer\");\n\t *\n\t * var panoViewer = new PanoViewer(container, {\n\t * // If projectionType is not specified, the default is \"equirectangular\".\n\t * // Specifies an image of the \"equirectangular\" type.\n\t * image: \"/path/to/image/image.jpg\"\n\t *});\n\t *\n\t * @example\n\t * // Cubemap Config Setting Example\n\t * // For support Youtube EAC projection, You should set cubemapConfig as follows.\n\t * cubemapConfig: {\n\t * \torder: \"LFRDBU\",\n\t * \ttileConfig: [\n\t * \t\ttileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}]\n\t * \t]\n\t * }\n\t */\n\tconstructor(container, options = {}) {\n\t\tsuper();\n\n\t\t// Raises the error event if webgl is not supported.\n\t\tif (!WebGLUtils.isWebGLAvailable()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\t\tmessage: \"no webgl support\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!WebGLUtils.isStableWebGL()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_DEVICE,\n\t\t\t\t\tmessage: \"blacklisted browser\"\n\t\t\t\t});\n\t\t\t}, 0);\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!!options.image && !!options.video) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_RESOURCE,\n\t\t\t\t\tmessage: \"Specifying multi resouces(both image and video) is not valid.\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\t// Check XR support at not when imported, but when created.\n\t\t// This is intended to make polyfills easier to use.\n\t\tcheckXRSupport();\n\n\t\tthis._container = container;\n\t\tthis._image = options.image || options.video;\n\t\tthis._isVideo = !!options.video;\n\t\tthis._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\tthis._cubemapConfig = Object.assign({\n\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/\n\t\t\torder: this._projectionType === PROJECTION_TYPE.CUBEMAP ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, options.cubemapConfig);\n\t\tthis._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\n\t\t// If the width and height are not provided, will use the size of the container.\n\t\tthis._width = options.width || parseInt(window.getComputedStyle(container).width, 10);\n\t\tthis._height = options.height || parseInt(window.getComputedStyle(container).height, 10);\n\n\t\t/**\n\t\t * Cache the direction for the performance in renderLoop\n\t\t *\n\t\t * This value should be updated by \"change\" event of YawPitchControl.\n\t\t */\n\t\tthis._yaw = options.yaw || 0;\n\t\tthis._pitch = options.pitch || 0;\n\t\tthis._fov = options.fov || 65;\n\n\t\tthis._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH;\n\t\tthis._quaternion = null;\n\n\t\tthis._aspectRatio = this._height !== 0 ? this._width / this._height : 1;\n\t\tconst fovRange = options.fovRange || [30, 110];\n\t\tconst touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ?\n\t\t\toptions.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL;\n\t\tconst yawPitchConfig = Object.assign(options, {\n\t\t\telement: container,\n\t\t\tyaw: this._yaw,\n\t\t\tpitch: this._pitch,\n\t\t\tfov: this._fov,\n\t\t\tgyroMode: this._gyroMode,\n\t\t\tfovRange,\n\t\t\taspectRatio: this._aspectRatio,\n\t\t\ttouchDirection\n\t\t});\n\n\t\tthis._isReady = false;\n\n\t\tthis._initYawPitchControl(yawPitchConfig);\n\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t}\n\n\t/**\n\t * Get the video element that the viewer is currently playing. You can use this for playback.\n\t * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다.\n\t * @method eg.view360.PanoViewer#getVideo\n\t * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement\n\t * @example\n\t * var videoTag = panoViewer.getVideo();\n\t * videoTag.play(); // play video!\n\t */\n\tgetVideo() {\n\t\tif (!this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the video information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setVideo\n\t * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정)\n\t * @param {Object} param\n\t * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}(\"equirectangular\")] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setVideo(\"/path/to/video/video.mp4\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR\n\t * });\n\t */\n\tsetVideo(video, param = {}) {\n\t\tif (video) {\n\t\t\tthis.setImage(video, {\n\t\t\t\tprojectionType: param.projectionType,\n\t\t\t\tisVideo: true,\n\t\t\t\tcubemapConfig: param.cubemapConfig,\n\t\t\t\tstereoFormat: param.stereoFormat\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the image information that the viewer is currently using.\n\t * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다.\n\t * @method eg.view360.PanoViewer#getImage\n\t * @return {Image} Image Object이미지 객체\n\t * @example\n\t * var imageObj = panoViewer.getImage();\n\t */\n\tgetImage() {\n\t\tif (this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the image information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setImage\n\t * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.)\n\t * @param {Object} param Additional information이미지 추가 정보\n\t * @param {String} [param.projectionType=\"equirectangular\"] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setImage(\"/path/to/image/image.png\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP\n\t * });\n\t */\n\tsetImage(image, param = {}) {\n\t\tconst cubemapConfig = Object.assign({\n\t\t\torder: \"RLUDBF\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, param.cubemapConfig);\n\t\tconst stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\t\tconst isVideo = !!(param.isVideo);\n\n\t\tif (this._image && this._isVideo !== isVideo) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.warn(\"Currently not supporting to change content type(Image <--> Video)\");\n\t\t\t/* eslint-enable no-console */\n\t\t\treturn this;\n\t\t}\n\n\t\tif (image) {\n\t\t\tthis._image = image;\n\t\t\tthis._isVideo = isVideo;\n\t\t\tthis._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\t\tthis._cubemapConfig = cubemapConfig;\n\t\t\tthis._stereoFormat = stereoFormat;\n\n\t\t\tthis._deactivate();\n\t\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set whether the renderer always updates the texture and renders.\n\t * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다.\n\t *\n\t * @method eg.view360.PanoViewer#keepUpdate\n\t * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다.\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tkeepUpdate(doUpdate) {\n\t\tthis._photoSphereRenderer.keepUpdate(doUpdate);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get projection type (equirectangular/cube)\n\t * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#getProjectionType\n\t * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE}\n\t */\n\tgetProjectionType() {\n\t\treturn this._projectionType;\n\t}\n\n\t/**\n\t * Activate the device's motion sensor, and return the Promise whether the sensor is enabled\n\t * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element.\n\t * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다.\n\t * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * @method eg.view360.PanoViewer#enableSensor\n\t * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다.\n\t */\n\tenableSensor() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\") {\n\t\t\t\tDeviceMotionEvent.requestPermission().then(permissionState => {\n\t\t\t\t\tif (permissionState === \"granted\") {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(new Error(\"permission denied\"));\n\t\t\t\t\t}\n\t\t\t\t}).catch(e => {\n\t\t\t\t\t// This can happen when this method wasn't triggered by user interaction\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disable the device's motion sensor.\n\t * @ko 디바이스의 모션 센서를 비활성화합니다.\n\t * @deprecated\n\t * @method eg.view360.PanoViewer#disableSensor\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdisableSensor() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred).\n\t * This method must be used in the context of user interaction, like onclick callback on the button element.\n\t * It can be rejected when an enabling device sensor fails or image/video is still loading(\"ready\" event not triggered).\n\t * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다)\n\t * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우(\"ready\"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다.\n\t * @method eg.view360.PanoViewer#enterVR\n\t * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error)\n\t */\n\tenterVR() {\n\t\tif (!this._isReady) {\n\t\t\treturn Promise.reject(new Error(\"PanoViewer is not ready to show image.\"));\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.enableSensor()\n\t\t\t\t.then(() => this._photoSphereRenderer.enterVR())\n\t\t\t\t.then(res => resolve(res))\n\t\t\t\t.catch(e => reject(e));\n\t\t});\n\t}\n\n\t/**\n\t * Exit VR stereo rendering mode.\n\t * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#exitVR\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\texitVR() {\n\t\tthis._photoSphereRenderer.exitVR();\n\t\treturn this;\n\t}\n\n\t// TODO: Remove parameters as they're just using private values\n\t_initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) {\n\t\tthis._photoSphereRenderer = new PanoImageRenderer(\n\t\t\tthis._image,\n\t\t\tthis._width,\n\t\t\tthis._height,\n\t\t\tthis._isVideo,\n\t\t\t{\n\t\t\t\tinitialYaw: yaw,\n\t\t\t\tinitialPitch: pitch,\n\t\t\t\tfieldOfView: fov,\n\t\t\t\timageType: projectionType,\n\t\t\t\tcubemapConfig,\n\t\t\t\tstereoFormat: this._stereoFormat\n\t\t\t},\n\t\t);\n\t\tthis._photoSphereRenderer.setYawPitchControl(this._yawPitchControl);\n\n\t\tthis._bindRendererHandler();\n\n\t\tthis._photoSphereRenderer\n\t\t\t.bindTexture()\n\t\t\t.then(() => this._activate())\n\t\t\t.catch(() => {\n\t\t\t\tthis._triggerEvent(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.FAIL_BIND_TEXTURE,\n\t\t\t\t\tmessage: \"failed to bind texture\"\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * update values of YawPitchControl if needed.\n\t * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image.\n\t *\n\t * This function should be called after isReady status is true.\n\t */\n\t_updateYawPitchIfNeeded() {\n\t\tif (this._projectionType === PanoViewer.ProjectionType.PANORAMA) {\n\t\t\t// update fov by aspect ratio\n\t\t\tconst image = this._photoSphereRenderer.getContent();\n\t\t\tlet imageAspectRatio = image.naturalWidth / image.naturalHeight;\n\t\t\tlet isCircular;\n\t\t\tlet yawSize;\n\t\t\tlet maxFov;\n\n\t\t\t// If height is larger than width, then we assume it's rotated by 90 degree.\n\t\t\tif (imageAspectRatio < 1) {\n\t\t\t\t// So inverse the aspect ratio.\n\t\t\t\timageAspectRatio = 1 / imageAspectRatio;\n\t\t\t}\n\n\t\t\tif (imageAspectRatio < 6) {\n\t\t\t\tyawSize = mathUtil.toDegree(imageAspectRatio);\n\t\t\t\tisCircular = false;\n\t\t\t\t// 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5\n\t\t\t\tmaxFov = mathUtil.toDegree(Math.atan(0.5)) * 2;\n\t\t\t} else {\n\t\t\t\tyawSize = 360;\n\t\t\t\tisCircular = true;\n\t\t\t\tmaxFov = (360 / imageAspectRatio); // Make it 5 fixed as axes does.\n\t\t\t}\n\n\t\t\t// console.log(\"_updateYawPitchIfNeeded\", maxFov, \"aspectRatio\", image.naturalWidth, image.naturalHeight, \"yawSize\", yawSize);\n\t\t\tconst minFov = (this._yawPitchControl.option(\"fovRange\"))[0];\n\n\t\t\t// this option should be called after fov is set.\n\t\t\tthis._yawPitchControl.option({\n\t\t\t\t\"fov\": maxFov, /* parameter for internal validation for pitchrange */\n\t\t\t\t\"yawRange\": [-yawSize / 2, yawSize / 2],\n\t\t\t\tisCircular,\n\t\t\t\t\"pitchRange\": [-maxFov / 2, maxFov / 2],\n\t\t\t\t\"fovRange\": [minFov, maxFov]\n\t\t\t});\n\t\t\tthis.lookAt({fov: maxFov});\n\t\t}\n\t}\n\n\t_bindRendererHandler() {\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, e);\n\t\t});\n\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, e => {\n\t\t\tthis._deactivate();\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERING_CONTEXT_LOST,\n\t\t\t\tmessage: \"webgl rendering context lost\"\n\t\t\t});\n\t\t});\n\t}\n\n\t_initYawPitchControl(yawPitchConfig) {\n\t\tthis._yawPitchControl = new YawPitchControl(yawPitchConfig);\n\n\t\tthis._yawPitchControl.on(EVENTS.ANIMATION_END, e => {\n\t\t\tthis._triggerEvent(EVENTS.ANIMATION_END, e);\n\t\t});\n\n\t\tthis._yawPitchControl.on(\"change\", e => {\n\t\t\tthis._yaw = e.yaw;\n\t\t\tthis._pitch = e.pitch;\n\t\t\tthis._fov = e.fov;\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis._triggerEvent(EVENTS.VIEW_CHANGE, e);\n\t\t});\n\t}\n\n\t_triggerEvent(name, param) {\n\t\tconst evt = param || {};\n\n\t\t/**\n\t\t * Events that is fired when error occurs\n\t\t * @ko 에러 발생 시 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#error\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.type Error type\n\t\t * \t\t10: INVALID_DEVICE: Unsupported device\n\t\t * \t\t11: NO_WEBGL: Webgl not support\n\t\t * \t\t12, FAIL_IMAGE_LOAD: Failed to load image\n\t\t * \t\t13: FAIL_BIND_TEXTURE: Failed to bind texture\n\t\t * \t\t14: INVALID_RESOURCE: Only one resource(image or video) should be specified\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost occurred\n\t\t * 에러 종류\n\t\t * \t\t10: INVALID_DEVICE: 미지원 기기\n\t\t * \t\t11: NO_WEBGL: WEBGL 미지원\n\t\t * \t\t12, FAIL_IMAGE_LOAD: 이미지 로드 실패\n\t\t * \t\t13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패\n\t\t * \t\t14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost 발생\n\t\t * \n\t\t * @param {String} param.message Error message 에러 메시지\n\t\t * @see {@link eg.view360.PanoViewer.ERROR_TYPE}\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"error\" : function(evt) {\n\t\t *\t\t// evt.type === 13\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t *\n\t\t * // constant can be used\n\t\t * viwer.on({\n\t\t *\teg.view360.PanoViewer.EVENTS.ERROR : function(evt) {\n\t\t *\t\t// evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when PanoViewer is ready to go.\n\t\t * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#ready\n\t\t * @event\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"ready\" : function(evt) {\n\t\t *\t\t// PanoViewer is ready to show image and handle user interaction.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when direction or fov is changed.\n\t\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#viewChange\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.yaw yawyaw\n\t\t * @param {Number} param.pitch pitch pitch\n\t\t * @param {Number} param.fov Field of view (fov) 화각\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"viewChange\" : function(evt) {\n\t\t *\t\t//evt.yaw, evt.pitch, evt.fov is available.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when animation which is triggered by inertia is ended.\n\t\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#animationEnd\n\t\t * @event\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"animationEnd\" : function(evt) {\n\t\t *\t\t// animation is ended.\n\t\t * });\n\t\t */\n\t\treturn this.trigger(name, evt);\n\t}\n\n\t/**\n\t * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}.\n\t * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다.\n\t * @method eg.view360.PanoViewer#setUseZoom\n\t * @param {Boolean} useZoom\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseZoom(useZoom) {\n\t\ttypeof useZoom === \"boolean\" && this._yawPitchControl.option(\"useZoom\", useZoom);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * When true, enables the keyboard move key control: awsd, arrow keys\n\t * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키)\n\t * @method eg.view360.PanoViewer#setUseKeyboard\n\t * @param {Boolean} useKeyboard\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseKeyboard(useKeyboard) {\n\t\tthis._yawPitchControl.option(\"useKeyboard\", useKeyboard);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")\n\t * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")\n\t * @method eg.view360.PanoViewer#setGyroMode\n\t * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE}\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setGyroMode(\"yawPitch\");\n\t * //equivalent\n\t * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH);\n\t */\n\tsetGyroMode(gyroMode) {\n\t\tthis._yawPitchControl.option(\"gyroMode\", gyroMode);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setFovRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setFovRange([50, 90]);\n\t */\n\tsetFovRange(range) {\n\t\tthis._yawPitchControl.option(\"fovRange\", range);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Getting the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFovRange\n\t * @return {Array}\n\t * @example\n\t * var range = panoViewer.getFovRange(); //[50, 90]\n\t */\n\tgetFovRange() {\n\t\treturn this._yawPitchControl.option(\"fovRange\");\n\t}\n\n\t/**\n\t * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size.\n\t * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다.\n\t * @method eg.view360.PanoViewer#updateViewportDimensions\n\t * @param {Object} [size]\n\t * @param {Number} [size.width=width of container]\n\t * @param {Number} [size.height=height of container]\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tupdateViewportDimensions(size = {width: undefined, height: undefined}) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet containerSize;\n\n\t\tif (size.width === undefined || size.height === undefined) {\n\t\t\tcontainerSize = window.getComputedStyle(this._container);\n\t\t}\n\n\t\tconst width = size.width || parseInt(containerSize.width, 10);\n\t\tconst height = size.height || parseInt(containerSize.height, 10);\n\n\t\t// Skip if viewport is not changed.\n\t\tif (width === this._width && height === this._height) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tthis._aspectRatio = width / height;\n\t\tthis._photoSphereRenderer.updateViewportDimensions(width, height);\n\t\tthis._yawPitchControl.option(\"aspectRatio\", this._aspectRatio);\n\t\tthis._yawPitchControl.updatePanScale({height});\n\n\t\tthis.lookAt({}, 0);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the current field of view(FOV)\n\t * @ko 현재 field of view(FOV) 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFov\n\t * @return {Number}\n\t */\n\tgetFov() {\n\t\treturn this._fov;\n\t}\n\n\t/**\n\t * Get the horizontal field of view in degree\n\t */\n\t_getHFov() {\n\t\treturn mathUtil.toDegree(\n\t\t\t2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2)));\n\t}\n\n\t/**\n\t * Get current yaw value\n\t * @ko 현재 yaw 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYaw\n\t * @return {Number}\n\t */\n\tgetYaw() {\n\t\treturn this._yaw;\n\t}\n\n\t/**\n\t * Get current pitch value\n\t * @ko 현재 pitch 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getPitch\n\t * @return {Number}\n\t */\n\tgetPitch() {\n\t\treturn this._pitch;\n\t}\n\n\t/**\n\t * Get the range of controllable Yaw values\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYawRange\n\t * @return {Array}\n\t */\n\tgetYawRange() {\n\t\treturn this._yawPitchControl.option(\"yawRange\");\n\t}\n\n\t/**\n\t * Get the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다.\n\t * @method eg.view360.PanoViewer#getPitchRange\n\t * @return {Array}\n\t */\n\tgetPitchRange() {\n\t\treturn this._yawPitchControl.option(\"pitchRange\");\n\t}\n\n\t/**\n\t * Set the range of controllable yaw\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#setYawRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setYawRange([-90, 90]);\n\t */\n\tsetYawRange(yawRange) {\n\t\tthis._yawPitchControl.option(\"yawRange\", yawRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setPitchRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setPitchRange([-40, 40]);\n\t */\n\tsetPitchRange(pitchRange) {\n\t\tthis._yawPitchControl.option(\"pitchRange\", pitchRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed.\n\t * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다.\n\t * @method eg.view360.PanoViewer#setShowPolePoint\n\t * @param {Boolean} showPolePoint\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetShowPolePoint(showPolePoint) {\n\t\tthis._yawPitchControl.option(\"showPolePoint\", showPolePoint);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a new view by setting camera configuration. Any parameters not specified remain the same.\n\t * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다.\n\t * @method eg.view360.PanoViewer#lookAt\n\t * @param {Object} orientation\n\t * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위)\n\t * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위)\n\t * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위)\n\t * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초)\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * // Change the yaw angle (absolute angle) to 30 degrees for one second.\n\t * panoViewer.lookAt({yaw: 30}, 1000);\n\t */\n\tlookAt(orientation, duration) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw;\n\t\tconst pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch;\n\t\tconst pitchRange = this._yawPitchControl.option(\"pitchRange\");\n\t\tconst verticalAngleOfImage = pitchRange[1] - pitchRange[0];\n\t\tlet fov = orientation.fov !== undefined ? orientation.fov : this._fov;\n\n\t\tif (verticalAngleOfImage < fov) {\n\t\t\tfov = verticalAngleOfImage;\n\t\t}\n\n\t\tthis._yawPitchControl.lookAt({yaw, pitch, fov}, duration);\n\n\t\tif (duration === 0) {\n\t\t\tthis._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_activate() {\n\t\tthis._photoSphereRenderer.attachTo(this._container);\n\t\tthis._yawPitchControl.enable();\n\n\t\tthis.updateViewportDimensions();\n\n\t\tthis._isReady = true;\n\n\t\t// update yawPitchControl after isReady status is true.\n\t\tthis._updateYawPitchIfNeeded();\n\n\t\tthis._triggerEvent(EVENTS.READY);\n\t\tthis._photoSphereRenderer.startRender();\n\t}\n\n\t/**\n\t * Destroy webgl context and block user interaction and stop rendering\n\t */\n\t_deactivate() {\n\t\tif (this._isReady) {\n\t\t\tthis._photoSphereRenderer.stopRender();\n\t\t\tthis._yawPitchControl.disable();\n\t\t\tthis._isReady = false;\n\t\t}\n\n\t\tif (this._photoSphereRenderer) {\n\t\t\tthis._photoSphereRenderer.destroy();\n\t\t\tthis._photoSphereRenderer = null;\n\t\t}\n\t}\n\n\tstatic _isValidTouchDirection(direction) {\n\t\treturn direction === PanoViewer.TOUCH_DIRECTION.NONE ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.YAW ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.PITCH ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.ALL;\n\t}\n\n\t/**\n\t * Set touch direction by which user can control.\n\t * @ko 사용자가 조작가능한 터치 방향을 지정합니다.\n\t * @method eg.view360.PanoViewer#setTouchDirection\n\t * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @return {eg.view360.PanoViewer} PanoViewer instance\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Limit the touch direction to the yaw direction only.\n\t * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW);\n\t */\n\tsetTouchDirection(direction) {\n\t\tif (PanoViewer._isValidTouchDirection(direction)) {\n\t\t\tthis._yawPitchControl.option(\"touchDirection\", direction);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns touch direction by which user can control\n\t * @ko 사용자가 조작가능한 터치 방향을 반환한다.\n\t * @method eg.view360.PanoViewer#getTouchDirection\n\t * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Returns the current touch direction.\n\t * var dir = panoViewer.getTouchDirection();\n\t */\n\tgetTouchDirection() {\n\t\treturn this._yawPitchControl.option(\"touchDirection\");\n\t}\n\n\t/**\n\t * Destroy viewer. Remove all registered event listeners and remove viewer canvas.\n\t * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다.\n\t * @method eg.view360.PanoViewer#destroy\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdestroy() {\n\t\tthis._deactivate();\n\n\t\tif (this._yawPitchControl) {\n\t\t\tthis._yawPitchControl.destroy();\n\t\t\tthis._yawPitchControl = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check whether the current environment can execute PanoViewer\n\t * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다.\n\t * @function isSupported\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부\n\t * @static\n\t */\n\tstatic isSupported() {\n\t\treturn WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the WebGL\n\t * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다.\n\t * @function isWebGLAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} WebGL support WebGL 지원여부\n\t * @static\n\t */\n\tstatic isWebGLAvailable() {\n\t\treturn WebGLUtils.isWebGLAvailable();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the gyro sensor.\n\t * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다.\n\t * @function isGyroSensorAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수\n\t * @static\n\t */\n\tstatic isGyroSensorAvailable(callback) {\n\t\tif (!DeviceMotionEvent) {\n\t\t\tcallback && callback(false);\n\t\t\treturn;\n\t\t}\n\n\t\tlet onDeviceMotionChange;\n\n\t\tfunction checkGyro() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tonDeviceMotionChange = function(deviceMotion) {\n\t\t\t\t\tconst isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null);\n\n\t\t\t\t\tres(isGyroSensorAvailable);\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener(\"devicemotion\", onDeviceMotionChange);\n\t\t\t});\n\t\t}\n\n\t\tfunction timeout() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tsetTimeout(() => res(false), 1000);\n\t\t\t});\n\t\t}\n\n\t\tPromise.race([checkGyro(), timeout()]).then(isGyroSensorAvailable => {\n\t\t\twindow.removeEventListener(\"devicemotion\", onDeviceMotionChange);\n\n\t\t\tcallback && callback(isGyroSensorAvailable);\n\n\t\t\tPanoViewer.isGyroSensorAvailable = function(fb) {\n\t\t\t\tfb && fb(isGyroSensorAvailable);\n\t\t\t\treturn isGyroSensorAvailable;\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport default PanoViewer;\n","import Component from \"@egjs/component\";\nimport {TRANSFORM, SUPPORT_WILLCHANGE} from \"../utils/browserFeature\";\nimport {VERSION} from \"../version\";\n/**\n * @class eg.view360.SpriteImage\n * @classdesc A module that displays a single or continuous image of any one of the \"sprite images\". SpinViewer internally uses SpriteImage to show each frame of the sprite image.\n * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the \"Sprite image\". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n *\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpriteImage\n *\n * var el = document.getElementById(\"image-div\");\n * var sprites = new eg.view360.SpriteImage(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24\n * });\n */\nclass SpriteImage extends Component {\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\t\tconst opt = options || {};\n\n\t\tthis._el = element;\n\t\tthis._rowCount = opt.rowCount || 1;\n\t\tthis._colCount = opt.colCount || 1;\n\t\tthis._totalCount = this._rowCount * this._colCount;// total frames\n\t\tthis._width = opt.width || \"auto\";\n\t\tthis._height = opt.height || \"auto\";\n\t\tthis._autoHeight = opt.autoHeight != null ? opt.autoHeight : \"true\"; // If autoHeight is specified, _height will be overwritten.\n\t\tthis._colRow = [0, 0];\n\n\t\tif (opt.colRow) {\n\t\t\tthis._colRow = opt.colRow;\n\t\t} else if (opt.frameIndex) {\n\t\t\tthis.setFrameIndex(opt.frameIndex);\n\t\t}\n\n\t\tthis._el.style.width = SpriteImage._getSizeString(this._width);\n\t\tthis._el.style.height = SpriteImage._getSizeString(this._height);\n\n\t\tif (!opt.imageUrl) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: opt.imageUrl\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._image = new Image();\n\t\t/**\n\t\t * Event\n\t\t */\n\t\tthis._image.onload = () => {\n\t\t\tthis._bg = SpriteImage._createBgDiv(\n\t\t\t\tthis._image, this._rowCount, this._colCount, this._autoHeight);\n\t\t\tthis._el.appendChild(this._bg);\n\t\t\tthis.setColRow(this._colRow[0], this._colRow[1]);\n\n\t\t\t/**\n\t\t\t * Events that occur when component loading is complete\n\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#load\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"load\" : function(evt) {\n\t\t\t *\t\tconsole.log(\"load event fired - e.target\", e.target, \"e.bgElement\", e.bgElement);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"load\", {\n\t\t\t\ttarget: this._el,\n\t\t\t\tbgElement: this._bg\n\t\t\t});\n\n\t\t\tif (this._autoPlayReservedInfo) {\n\t\t\t\tthis.play(this._autoPlayReservedInfo);\n\t\t\t\tthis._autoPlayReservedInfo = null;\n\t\t\t}\n\t\t};\n\n\t\tthis._image.onerror = e => {\n\t\t\t/**\n\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#imageError\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t *\t\t// Error handling\n\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\timageUrl: opt.imageUrl\n\t\t\t});\n\t\t};\n\n\t\tthis._image.src = opt.imageUrl;\n\t}\n\n\tstatic _createBgDiv(img, rowCount, colCount, autoHeight) {\n\t\tconst el = document.createElement(\"div\");\n\n\t\tel.style.position = \"relative\";\n\t\tel.style.overflow = \"hidden\";\n\n\t\timg.style.position = \"absolute\";\n\t\timg.style.width = `${colCount * 100}%`;\n\t\timg.style.height = `${rowCount * 100}%`;\n\t\t/** Prevent image from being dragged on IE10, IE11, Safari especially */\n\t\timg.ondragstart = () => (false); // img.style.pointerEvents = \"none\";\n\t\t// Use hardware accelerator if available\n\t\tSUPPORT_WILLCHANGE && (img.style.willChange = \"transform\");\n\n\t\tel.appendChild(img);\n\n\t\tconst unitWidth = img.width / colCount;\n\t\tconst unitHeight = img.height / rowCount;\n\n\t\tif (autoHeight) {\n\t\t\tconst r = unitHeight / unitWidth;\n\n\t\t\tel.style.paddingBottom = `${r * 100}%`;\n\t\t} else {\n\t\t\tel.style.height = \"100%\";\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/**\n\t * Specifies the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정\n\t * @method eg.view360.SpriteImage#setFrameIndex\n\t * @param {Number} frameIndex frame index of a frame프레임의 인덱스\n\t *\n\t * @example\n\t *\n\t * sprites.setFrameIndex(0, 1);// col = 0, row = 1\n\t */\n\tsetFrameIndex(index) {\n\t\tconst colRow = this.toColRow(index);\n\n\t\tthis.setColRow(colRow[0], colRow[1]);\n\t}\n\n\t/**\n\t * Returns the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환\n\t * @method eg.view360.SpriteImage#getFrameIndex\n\t * @return {Number} frame index frame 인덱스\n\t *\n\t * @example\n\t *\n\t * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1\n\t *\n\t */\n\tgetFrameIndex() {\n\t\treturn this._colRow[1] * this._colCount + this._colRow[0];\n\t}\n\n\t/**\n\t * Specifies the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정\n\t * @method eg.view360.SpriteImage#setColRow\n\t * @param {Number} col Column number of a frame프레임의 행값\n\t * @param {Number} row Row number of a frame프레임의 열값\n\t *\n\t * @example\n\t *\n\t * sprites.setlColRow(1, 2); // col = 1, row = 2\n\t */\n\tsetColRow(col, row) {\n\t\tif (row > this._rowCount - 1 || col > this._colCount - 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._image && TRANSFORM) {\n\t\t\t// NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser?\n\t\t\tthis._image.style[TRANSFORM] = `translate(${-(col / this._colCount * 100)}%, ${-(row / this._rowCount * 100)}%)`;\n\t\t}\n\n\t\tthis._colRow = [col, row];\n\t}\n\n\t/**\n\t * Returns the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환\n\t * @method eg.view360.SpriteImage#gelColRow\n\t * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열\n\t *\n\t * @example\n\t *\n\t * var colRow = sprites.getlColRow();\n\t * // colRow = [1, 2] - index of col is 1, index of row is 2\n\t *\n\t */\n\tgetColRow() {\n\t\treturn this._colRow;\n\t}\n\n\tstatic _getSizeString(size) {\n\t\tif (typeof size === \"number\") {\n\t\t\treturn `${size}px`;\n\t\t}\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Stop playing\n\t * @ko play 되고 있던 프레임 재생을 중지합니다.\n\t * @method eg.view360.SpriteImage#stop\n\t *\n\t * @example\n\t *\n\t * viewer.stop();\n\t *\n\t */\n\tstop() {\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\t}\n\n\t/**\n\t * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'.\n\t * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다.\n\t * @method eg.view360.SpriteImage#play\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위\n\t * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복\n\t *\n\t * @example\n\t *\n\t * viewer.play({angle: 16, playCount: 1});\n\t *\n\t */\n\tplay({interval, playCount} = {interval: 1000 / this._totalCount, playCount: 0}) {\n\t\tif (!this._bg) {\n\t\t\tthis._autoPlayReservedInfo = {interval, playCount};\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\n\t\tlet frameIndex = this.getFrameIndex();\n\t\tlet count = 0;\n\t\tlet frameCount = 0; // for checking 1 cycle\n\n\t\tthis._autoPlayTimer = setInterval(() => {\n\t\t\tframeIndex %= this._totalCount;\n\t\t\tconst colRow = this.toColRow(frameIndex);\n\n\t\t\tthis.setColRow(colRow[0], colRow[1]);\n\t\t\tframeIndex++;\n\n\t\t\t// Done 1 Cycle?\n\t\t\tif (++frameCount === this._totalCount) {\n\t\t\t\tframeCount = 0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (playCount > 0 && count === playCount) {\n\t\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\t}\n\t\t}, interval);\n\t}\n\n\ttoColRow(frameIndex) {\n\t\tconst colCount = this._colCount;\n\t\tconst rowCount = this._rowCount;\n\n\t\tif (frameIndex < 0) {\n\t\t\treturn [0, 0];\n\t\t} else if (frameIndex >= this._totalCount) {\n\t\t\treturn [colCount - 1, rowCount - 1];\n\t\t}\n\n\t\tconst col = frameIndex % colCount;\n\t\tconst row = Math.floor(frameIndex / colCount);\n\n\t\t// console.log(frameIndex, col, row);\n\t\treturn [col, row];\n\t}\n}\n\nexport default SpriteImage;\n","import Component from \"@egjs/component\";\nimport Axes, {PanInput} from \"@egjs/axes\";\nimport SpriteImage from \"./SpriteImage\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_PAN_SCALE = 0.21;\n\n/**\n * @class eg.view360.SpinViewer\n * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object.\n * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpinViewer\n * var el = document.getElementById(\"product-360\");\n * var viewer = new eg.view360.SpinViewer(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24 //required\n * });\n */\nclass SpinViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.SpinViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.SpinViewer\n\t */\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\n\t\tthis._el = element;\n\n\t\tconst opt = Object.assign({}, options);\n\t\tconst colCount = opt.colCount || 1;\n\t\tconst rowCount = opt.rowCount || 1;\n\n\t\tthis._scale = (opt.scale || 1);\n\t\tthis._panScale = this._scale * DEFAULT_PAN_SCALE;\n\n\t\tthis._frameCount = colCount * rowCount;\n\n\t\t// Init SpriteImage\n\t\tthis._sprites = new SpriteImage(element, opt).on({\n\t\t\t\"load\": evt => {\n\t\t\t\t/**\n\t\t\t\t * Events that occur when component loading is complete\n\t\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#load\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"load\" : function(evt) {\n\t\t\t\t *\t\tthis.spinBy(360, {duration: 300});\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"load\", evt);\n\t\t\t},\n\t\t\t\"imageError\": evt => {\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#imageError\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viewer.on({\n\t\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t\t *\t\t// Error handling\n\t\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: evt.imageUrl\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Init Axes\n\t\tthis._panInput = new PanInput(this._el, {\n\t\t\tscale: [this._panScale, this._panScale]\n\t\t});\n\t\tthis._axes = new Axes({\n\t\t\tangle: {\n\t\t\t\trange: [0, 359],\n\t\t\t\tcircular: true\n\t\t\t}\n\t\t}).on({\n\t\t\t\"change\": evt => {\n\t\t\t\tconst curr = Math.floor(evt.pos.angle / (360 / this._frameCount));\n\t\t\t\tconst frameIndex = this._frameCount - curr - 1;\n\n\t\t\t\tthis._sprites.setFrameIndex(frameIndex);\n\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#change\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row\n\t\t\t\t * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값\n\t\t\t\t * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님)\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"change\" : function(evt) {\n\t\t\t\t *\t\tconsole.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"change\", {\n\t\t\t\t\tframeIndex,\n\t\t\t\t\tcolRow: this._sprites.getColRow(),\n\t\t\t\t\tangle: evt.pos.angle\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"animationEnd\": evt => {\n\t\t\t\t/**\n\t\t\t\t * This event is fired when animation ends.\n\t\t\t\t * @ko 에니메이션이 끝났을 때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#animationEnd\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Boolean} param.isTrusted 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\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"animationEnd\" : function(evt) {\n\t\t\t\t *\t\t// evt.isTrusted === true or false\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"animationEnd\", {\n\t\t\t\t\tisTrusted: evt.isTrusted\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._axes.connect(\"angle\", this._panInput);\n\t}\n\n\t/**\n\t * Set spin scale\n\t * @ko scale 을 조정할 수 있는 함수\n\t * @method eg.view360.SpinViewer#setScale\n\t * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.setScale(2);// It moves twice as much.\n\t */\n\tsetScale(scale) {\n\t\tif (isNaN(scale) || scale < 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._scale = scale;\n\t\tthis._panScale = scale * DEFAULT_PAN_SCALE;\n\t\tthis._panInput.options.scale = [this._panScale, this._panScale];\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get spin scale\n\t * @ko scale 값을 반환한다.\n\t * @method eg.view360.SpinViewer#getScale\n\t *\n\t * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @example\n\t *\n\t * viewer.getScale();// It returns number\n\t */\n\tgetScale() {\n\t\treturn this._scale;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle.\n\t * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinBy\n\t *\n\t * @param {Number} [angle = 0] angle상대적 회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinBy(720, {duration: 500});\n\t */\n\tspinBy(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setBy({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle).\n\t * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinTo\n\t *\n\t * @param {Number} [angle = 0] angle회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinTo(30, {duration:100});\n\t */\n\tspinTo(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setTo({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns current angles\n\t * @ko 현재 각도를 반환한다.\n\t *\n\t * @return {Number} Current angle 현재 각도\n\t */\n\tgetAngle() {\n\t\treturn this._axes.get().angle || 0;\n\t}\n}\n\nexport default SpinViewer;\n"],"names":["module","objectOrFunction","x","type","isFunction","_isArray","Array","isArray","Object","prototype","toString","call","len","vertxNext","customSchedulerFn","asap","callback","arg","queue","flush","scheduleFlush","setScheduler","scheduleFn","setAsap","asapFn","browserWindow","window","undefined","browserGlobal","BrowserMutationObserver","MutationObserver","WebKitMutationObserver","isNode","self","process","isWorker","Uint8ClampedArray","importScripts","MessageChannel","useNextTick","nextTick","useVertxTimer","useSetTimeout","useMutationObserver","iterations","observer","node","document","createTextNode","observe","characterData","data","useMessageChannel","channel","port1","onmessage","port2","postMessage","globalSetTimeout","setTimeout","i","attemptVertx","vertx","Function","require","runOnLoop","runOnContext","e","then","onFulfillment","onRejection","parent","this","child","constructor","noop","PROMISE_ID","makePromise","_state","arguments","invokeCallback","_result","subscribe","resolve$1","object","Constructor","promise","resolve","Math","random","substring","PENDING","FULFILLED","REJECTED","selfFulfillment","TypeError","cannotReturnOwn","tryThen","then$$1","value","fulfillmentHandler","rejectionHandler","handleForeignThenable","thenable","sealed","error","fulfill","reason","reject","_label","handleOwnThenable","handleMaybeThenable","maybeThenable","publishRejection","_onerror","publish","_subscribers","length","subscribers","settled","detail","hasCallback","succeeded","initializePromise","resolver","resolvePromise","rejectPromise","id","nextId","validationError","Error","Enumerator","input","_instanceConstructor","_remaining","_enumerate","_eachEntry","entry","c","resolve$$1","_then","didError","_settledAt","Promise$1","_willSettleAt","state","enumerator","all","entries","race","_","reject$1","needsResolver","needsNew","Promise","catch","_catch","finally","_finally","polyfill","local","global","P","promiseToString","cast","_setScheduler","_setAsap","_asap","factory","win","doc","agent","getAgent","osName","os","name","browserName","browser","IS_IOS","IS_SAFARI_ON_DESKTOP","Float32Array","getComputedStyle","userAgent","navigator","SUPPORT_TOUCH","SUPPORT_DEVICEMOTION","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","SUPPORT_WILLCHANGE","CSS","supports","WEBXR_SUPPORTED","toDegree","a","PI","util","n","extractPitchFromQuat","quaternion","baseV","vec3","fromValues","transformQuat","atan2","sqrt","pow","hypot","y","ROTATE_CONSTANT","PITCH_DELTA","YAW_DELTA_BY_ROLL","YAW_DELTA_BY_YAW","angleBetweenVec2","v1","v2","det","vec2","dot","targetAxis","meshPoint","yawOffsetBetween","viewDir","targetDir","viewDirXZ","targetDirXZ","normalize","getRotationDelta","prevQ","curQ","rotateKind","prevQuaternion","quat","clone","curQuaternion","prevPoint","curPoint","meshPoint3","rotateDirection","cross","create","meshPoint2","vecU","vecV","vecN","coefficientA","coefficientB","coefficientC","distance","abs","projectedPrevPoint","subtract","scale","trigonometricRatio","theta","acos","crossVec","r","MathUtil","degToRad","radToDeg","Vector2","set","copy","v","subVectors","b","Vector3","z","scalar","invScalar","multiplyScalar","applyQuaternion","q","qx","qy","qz","qw","w","ix","iy","iz","iw","crossVectors","ax","ay","az","bx","by","bz","Quaternion","setFromEulerXYZ","c1","cos","c2","c3","s1","sin","s2","s3","setFromEulerYXZ","setFromAxisAngle","axis","angle","halfAngle","s","multiply","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","inverse","l","slerp","qb","t","cosHalfTheta","halfTheta","sinHalfTheta","ratioA","ratioB","setFromUnitVectors","vFrom","vTo","isIOS","isWebViewAndroid","isSafari","isFirefoxAndroid","isR7","piOver180","rad45","defaultOrientation","defaultPosition","Util","updateEyeMatrices","projection","view","pose","parameters","vrDisplay","out","fov","near","far","upTan","downTan","leftTan","rightTan","xScale","yScale","fieldOfView","depthNear","depthFar","tan","upDegrees","downDegrees","leftDegrees","rightDegrees","x2","y2","z2","xx","xy","xz","yy","yz","zz","wx","wy","wz","a00","a01","a02","a03","a10","a11","a12","a13","a20","a21","a22","a23","a30","a31","a32","a33","b00","b01","b02","b03","b04","b05","b06","b07","b08","b09","b10","b11","orientation","position","offset","MIN_TIMESTEP","MAX_TIMESTEP","base64","mimeType","clamp","min","max","lerp","promises","test","platform","indexOf","isLandscapeMode","rtn","isTimestampDeltaValid","timestampDeltaS","isNaN","getScreenWidth","screen","width","height","getScreenHeight","requestFullscreen","element","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen","exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen","getFullscreenElement","fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement","linkProgram","gl","vertexSource","fragmentSource","attribLocationMap","vertexShader","createShader","VERTEX_SHADER","shaderSource","compileShader","fragmentShader","FRAGMENT_SHADER","program","createProgram","attribName","attachShader","bindAttribLocation","deleteShader","getProgramUniforms","uniforms","uniformCount","getProgramParameter","ACTIVE_UNIFORMS","uniformName","getActiveUniform","replace","getUniformLocation","orthoMatrix","left","right","bottom","top","lr","bt","nf","copyArray","source","dest","isMobile","check","vendor","opera","substr","extend","src","key","hasOwnProperty","safariCssSizeWorkaround","canvas","parseInt","isDebug","getQueryParameter","results","RegExp","exec","location","search","decodeURIComponent","frameDataFromPose","frameData","timestamp","leftProjectionMatrix","leftViewMatrix","getEyeParameters","rightProjectionMatrix","rightViewMatrix","isInsideCrossDomainIFrame","isFramed","refDomain","getDomainFromUrl","referrer","thisDomain","href","url","split","PosePredictor","predictionTimeS","previousQ","previousTimestampS","deltaQ","outQ","getPrediction","currentQ","gyro","timestampS","angularSpeed","console","log","toFixed","predictAngle","version","branch","build","match","CHROME_VERSION","IS_CHROME_WITHOUT_DEVICE_MOTION","IS_ANDROID","MC_BIND_SCALE","GYRO_MODE","NONE","YAWPITCH","VR","DeviceMotion","_onDeviceMotion","_this","bind","_onDeviceOrientation","_onChromeWithoutDeviceMotion","isWithoutDeviceMotion","isAndroid","stillGyroVec","rawGyroVec","adjustedGyroVec","_timer","lastDevicemotionTimestamp","_isEnabled","enable","alpha","beta","gamma","trigger","inputEvent","deviceorientation","clearTimeout","Date","getTime","_this2","isGyroSensorAvailable","rotationRate","isGravitySensorAvailable","accelerationIncludingGravity","interval","devicemotionEvent","_extends","timeStamp","acceleration","adjustedRotationRate","addEventListener","disable","removeEventListener","Component","SensorSample","sample","sensorSample","ComplementaryFilter","kFilter","currentAccelMeasurement","currentGyroMeasurement","previousGyroMeasurement","filterQ","previousFilterQ","accelQ","isOrientationInitialized","estimatedGravity","measuredGravity","gyroIntegralQ","addAccelMeasurement","vector","addGyroMeasurement","deltaT","run_","accelToQuaternion_","gyroDeltaQ","gyroToQuaternionDelta_","invFilterQ","getQuaternionAngle","targetQ","getOrientation","accel","normAccel","dt","isFilterQuaternionInitialized","FusionPoseSensor","deviceMotion","accelerometer","gyroscope","_onDeviceMotionChange","_onScreenOrientationChange","filter","posePredictor","filterToWorldQ","isChromeUsingDegrees","inverseWorldToScreenQ","worldToScreenQ","originalPoseAdjustQ","_setScreenTransform","resetQ","on","isEnabled","destroy","_triggerChange","_prevOrientation","equals","_deviceOrientationQ","deviceOrientationFixQ","_alpha","out_","_convertFusionToPredicted","predictedQ","accGravity","rotRate","TiltMotionInput","el","options","_prevQuaternion","_quaternion","fusionPoseSensor","threshold","_onPoseChange","mapAxes","axes","connect","_attachEvent","disconnect","_dettachEvent","event","prvQ","yawDeltaByYaw","change","reduce","acc","off","screenRotationAngleInst","refCount","ScreenRotationAngle","_onOrientationChange","_spinR","_screenOrientationAngle","betaR","glMatrix","toRadian","gammaR","getRadian","unref","RotationPanInput","_useRotation","_screenRotationAngle","setUseRotation","useRotation","_userDirection","Axes","DIRECTION_ALL","_direction","DIRECTION_HORIZONTAL","getOffset","properties","useDirection","newOffset","cosTheta","sinTheta","DIRECTION_VERTICAL","PanInput","Y_AXIS_VECTOR","DeviceQuaternion","_fusionPoseSensor","isTrusted","getCombinedQuaternion","yaw","yawQ","setAxisAngle","conj","conjugate","VERSION","DEFAULT_YAW_RANGE","DEFAULT_PITCH_RANGE","CIRCULAR_PITCH_RANGE","YawPitchControl","opt","pitch","showPolePoint","useZoom","useKeyboard","gyroMode","touchDirection","TOUCH_DIRECTION_YAW","yawRange","pitchRange","fovRange","aspectRatio","_element","_initialFov","_enabled","_isAnimating","_deviceQuaternion","_initAxes","option","yRange","_updateYawRange","pRange","_updatePitchRange","axesPanInput","axesWheelInput","WheelInput","axesTiltMotionInput","axesPinchInput","PinchInput","axesMoveKeyInput","MoveKeyInput","range","circular","isCircular","bounce","deceleration","maximumDuration","hold","evt","delta","_updateControlScale","updatePanScale","release","animationStart","animationEnd","param","get","areaHeight","args","argLen","_getOptions","beforeOptions","newOptions","changedKeyList","keys","push","_setOptions","_getValidatedOptions","_applyOptions","_getValidYawRange","_getValidPitchRange","isVR","isYawPitch","some","setTo","prevFov","nextFov","_initDeviceQuaternion","_togglePinchInputByOption","_enableTouch","_inputs","direction","yawEnabled","pitchEnabled","_this3","newYawRange","newFov","newAspectRatio","ratio","adjustAspectRatio","horizontalFov","newPitchRange","changeEvt","pos","p","verticalAngle","halfFov","concat","halfHorizontalFov","mathUtil","targetElement","inputRange","outputRange","rangeIdx","inputA","fraction","persistOrientation","_resetOrientation","lookAt","duration","f","Infinity","setBy","getYawPitch","yawPitch","getFov","getQuaternion","shouldRenderWithQuaternion","axisPanInput","axesDeviceOrientationInput","CONTROL_MODE_VR","CONTROL_MODE_YAWPITCH","TOUCH_DIRECTION_ALL","TOUCH_DIRECTION_PITCH","TOUCH_DIRECTION_NONE","STATUS","EVENT","ImageLoader","image","_image","_onceHandlers","_loadStatus","res","rej","LOADED","getElement","LOADING","isMaybeLoaded","createElement","onceLoaded","ERROR","map","img","_img","Image","crossOrigin","result","complete","naturalWidth","onload","onerror","targets","loadPromises","_this4","_once","listener","fn","getStatus","forEach","handler","READY_STATUS","READYSTATECHANGE_EVENT_NAME","latIdx","lngIdx","VideoLoader","video","_handlers","_sourceCount","_thresholdReadyState","_thresholdEventName","readyState","_errorCount","_detachErrorHandler","_appendSourceElement","videoUrl","videoSrc","videoType","sourceElement","_video","appendChild","_reset","HTMLVideoElement","setAttribute","querySelectorAll","load","_attachErrorHandler","_sources","rejector","WEBGL_ERROR_CODE","webglAvailability","WebGLUtils","shader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","detachShader","LINK_STATUS","deleteProgram","initBuffer","itemSize","attr","buffer","createBuffer","bindBuffer","bufferData","STATIC_DRAW","numItems","enableVertexAttribArray","vertexAttribPointer","FLOAT","getWebglContext","userContextAttributes","webglIdentifiers","context","contextAttributes","preserveDrawingBuffer","antialias","xrCompatible","onWebglcontextcreationerror","statusMessage","getContext","createTexture","textureTarget","texture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","isWebGLAvailable","webglContext","loseContextExtension","getExtension","loseContext","isStableWebGL","agentInfo","isStableWebgl","parseFloat","getErrorNameFromWebGLErrorCode","code","texImage2D","pixels","RGBA","UNSIGNED_BYTE","getMaxTextureSize","getParameter","MAX_TEXTURE_SIZE","Agent","isIE11","majorVersion","EVENTS","Renderer","_forceDimension","_pixelCanvas","_pixelContext","render","shaderProgram","indexBuffer","mvMatrix","pMatrix","uniformMatrix4fv","pMatrixUniform","mvMatrixUniform","drawElements","TRIANGLES","UNSIGNED_SHORT","getDimension","pixelSource","videoWidth","naturalHeight","videoHeight","updateShaderData","_initPixelSource","forceDimension","_getPixelSource","contentDimension","textureDimension","drawImage","_extractTileConfig","imageConfig","tileConfig","config","flipHorizontal","rotation","_triggerError","message","CubeRenderer","getVertexPositionData","_VERTEX_POSITION_DATA","getIndexData","_INDEX_DATA","indexData","vertexPositionData","extractOrder","order","getTextureCoordData","base","face","ordermap_","shift","unshift","pop","tileVertex","slice","elemSize","tileTemp","j","splice","join","getVertexShaderSource","getFragmentShaderSource","updateTexture","orderMap","surfaceIdx","tileIdx","TEXTURE_CUBE_MAP_POSITIVE_X","maxCubeMapTextureSize","getMaxCubeMapTextureSize","tile","extractTileFromImage","TEXTURE_CUBE_MAP","getSourceTileSize","outputTextureSize","inputTextureSize","tilePerRow","MAX_CUBE_MAP_TEXTURE_SIZE","_imageWidth","isPowerOfTwo","CubeStripRenderer","_vertices","coords","rows","coord","tileConfigs","_shrinkCoord","_transformCoord","index","val","TEXTURE_2D","size","maxSize","activeTexture","TEXTURE0","pixelStorei","UNPACK_FLIP_Y_WEBGL","newCoord","_flipHorizontalCoord","_rotateCoord","rotationAngle","moved","shiftCount","ERROR_TYPE","INVALID_DEVICE","NO_WEBGL","FAIL_IMAGE_LOAD","FAIL_BIND_TEXTURE","INVALID_RESOURCE","RENDERING_CONTEXT_LOST","READY","VIEW_CHANGE","ANIMATION_END","PROJECTION_TYPE","EQUIRECTANGULAR","CUBEMAP","CUBESTRIP","PANORAMA","STEREOSCOPIC_EQUI","STEREO_FORMAT","TOP_BOTTOM","LEFT_RIGHT","ANGLE_CORRECTION_FOR_CENTER_ALIGN","textureCoordData","phi","sinPhi","u","SphereRenderer","format","_stereoFormat","ctx","leftEyeScaleOffset","rightEyeScaleOffset","uTexScaleOffset","uniform4fv","_TEXTURE_COORD_DATA","CylinderRenderer","resizeDimension","cylinderMaxRadian","halfCylinderY","rotated","imageAspectRatio","CYLIDER_Y","startAngleForCenterAlign","yIdx","yLength","VR_DISPLAY_PRESENT_CHANGE","DEFAULT_LEFT_BOUNDS","DEFAULT_RIGHT_BOUNDS","EYES","VRManager","_vrDisplay","removeEndCallback","isPresenting","exitPresent","_clear","_frameData","VRFrameData","canRender","Boolean","beforeRender","bindFramebuffer","FRAMEBUFFER","afterRender","submitFrame","getEyeParams","display","halfWidth","drawingBufferWidth","drawingBufferHeight","getFrameData","leftMVMatrix","rightMVMatrix","mat4","rotateY","_yawOffset","viewport","addEndCallback","requestPresent","getVRDisplays","displays","capabilities","canPresent","leftEye","rightEye","renderWidth","renderHeight","_setDisplay","setYawOffset","layers","getLayers","layer","_leftBounds","leftBounds","_rightBounds","rightBounds","XRManager","xrSession","_xrSession","end","frame","getViewerPose","_xrRefSpace","baseLayer","session","renderState","framebuffer","glLayer","views","getViewport","transform","matrix","rotateX","projectionMatrix","_presenting","xr","requestSession","requiredFeatures","xrLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","refSpace","_setSession","_xrLayer","WebGLAnimator","_onLoop","_callback","_rafId","_context","requestAnimationFrame","_onLoopNextTick","before","performance","now","diff","_rafTimer","setCallback","setContext","start","stop","cancelAnimationFrame","ImageType","DEVICE_PIXEL_RATIO","BIND_TEXTURE","IMAGE_LOADED","RENDERING_CONTEXT_RESTORE","RENDERER_ERROR","PanoImageRenderer","isVideo","sphericalConfig","renderingContextAttributes","_renderStereo","time","vr","_vr","eyeParams","eyeIndex","eyeParam","uniform1f","uEye","_bindBuffers","_draw","exitVR","animator","_animator","_restoreStyle","updateViewportDimensions","_updateViewport","_shouldForceDraw","_render","_onFirstVRFrame","minusZDir","mat3","fromMat4","mvInv","invert","pInv","transformMat3","yawOffset","_lastQuaternion","_lastYaw","_lastPitch","_lastFieldOfView","perspective","textureCoordBuffer","vertexBuffer","_initCanvas","_setDefaultCanvasStyle","_wrapper","_wrapperOrigStyle","_renderingContextAttributes","_imageConfig","_imageIsReady","_keepUpdate","_onContentLoad","_onContentError","setImage","imageType","cubemapConfig","setYawPitchControl","yawPitchControl","_yawPitchControl","getContent","_isVideo","_setImageType","_contentLoader","_imageType","_isCubeMap","_renderer","stereoFormat","_initWebGL","_onWebglcontextlost","_onWebglcontextrestored","margin","maxHeight","maxWidth","outline","_triggerContentLoad","content","projectionType","isImageLoaded","_bindTexture","attachTo","parentElement","detach","forceContextLoss","hasRenderingContext","removeChild","isContextLost","_initShaderProgram","renderer","vsSource","fsSource","getError","useProgram","vertexPositionAttribute","getAttribLocation","samplerUniform","textureCoordAttribute","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","uniform1i","preventDefault","updateFieldOfView","viewPortChanged","h","_initRenderingContext","clearColor","deleteTexture","CULL_FACE","WebGLRenderingContext","_initBuffers","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","Uint16Array","isEAC","_updateTexture","keepUpdate","doUpdate","startRender","stopRender","renderWithQuaternion","exactEquals","fromQuat","renderWithYawPitch","identity","getProjectionRenderer","enterVR","_Promise","_requestPresent","_setWrapperFullscreen","wrapper","getAttribute","wrapperStyle","zIndex","removeAttribute","PanoViewer","container","isSessionSupported","supportsSession","_container","_projectionType","_cubemapConfig","_width","_height","_yaw","_pitch","_fov","_gyroMode","_aspectRatio","_isValidTouchDirection","yawPitchConfig","_isReady","_initYawPitchControl","_initRenderer","getVideo","_photoSphereRenderer","setVideo","getImage","warn","_deactivate","getProjectionType","enableSensor","requestPermission","permissionState","disableSensor","initialYaw","initialPitch","_bindRendererHandler","_activate","_triggerEvent","_updateYawPitchIfNeeded","ProjectionType","yawSize","maxFov","atan","minFov","_this5","setUseZoom","setUseKeyboard","setGyroMode","setFovRange","getFovRange","containerSize","_getHFov","getYaw","getPitch","getYawRange","getPitchRange","setYawRange","setPitchRange","setShowPolePoint","verticalAngleOfImage","TOUCH_DIRECTION","YAW","PITCH","ALL","setTouchDirection","getTouchDirection","isSupported","onDeviceMotionChange","fb","SpriteImage","_el","_rowCount","rowCount","_colCount","colCount","_totalCount","_autoHeight","autoHeight","_colRow","colRow","frameIndex","setFrameIndex","_getSizeString","imageUrl","_bg","_createBgDiv","setColRow","bgElement","_autoPlayReservedInfo","play","overflow","ondragstart","willChange","unitWidth","unitHeight","paddingBottom","toColRow","getFrameIndex","col","row","getColRow","_autoPlayTimer","clearInterval","playCount","count","frameCount","setInterval","floor","SpinViewer","_scale","_panScale","_frameCount","_sprites","_panInput","_axes","curr","setScale","getScale","spinBy","spinTo","getAngle"],"mappings":";;;;;;;uzCASgEA,qBAKhE,SAASC,EAAiBC,GACxB,IAAIC,SAAcD,EAClB,OAAOA,IAAM,OAASC,IAAS,UAAYA,IAAS,YAGtD,SAASC,EAAWF,GAClB,cAAcA,IAAM,WAKtB,IAAIG,OAAgB,EACpB,GAAIC,MAAMC,QAAS,CACjBF,EAAWC,MAAMC,YACZ,CACLF,EAAW,SAAUH,GACnB,OAAOM,OAAOC,UAAUC,SAASC,KAAKT,KAAO,kBAIjD,IAAIK,EAAUF,EAEVO,EAAM,EACNC,OAAiB,EACjBC,OAAyB,EAEzBC,EAAO,SAASA,EAAKC,EAAUC,GACjCC,EAAMN,GAAOI,EACbE,EAAMN,EAAM,GAAKK,EACjBL,GAAO,EACP,GAAIA,IAAQ,EAAG,CAIb,GAAIE,EAAmB,CACrBA,EAAkBK,OACb,CACLC,OAKN,SAASC,EAAaC,GACpBR,EAAoBQ,EAGtB,SAASC,EAAQC,GACfT,EAAOS,EAGT,IAAIC,SAAuBC,SAAW,YAAcA,OAASC,UACzDC,EAAgBH,GAAiB,GACjCI,EAA0BD,EAAcE,kBAAoBF,EAAcG,uBAC1EC,SAAgBC,OAAS,oBAAsBC,UAAY,aAAe,GAAGxB,SAASC,KAAKuB,WAAa,mBAGxGC,SAAkBC,oBAAsB,oBAAsBC,gBAAkB,oBAAsBC,iBAAmB,YAG7H,SAASC,IAGP,OAAO,WACL,OAAOL,QAAQM,SAASrB,IAK5B,SAASsB,IACP,UAA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KAAKw1C,UAAWx1C,KAAKw1C,YAL7Cx1C,QAqBT+1C,SAAA,kBACQ/1C,KAAKu1C,UAkBbS,OAAA,SAAOrnC,EAAWmc,mBAAXnc,IAAAA,EAAQ,YAAGmc,IAAAA,EAAQ,CAACsD,SAAU,SAC/BwnB,MAAMrnB,MAAM,CAAC5f,MAAAA,GAAQmc,EAAMsD,UACzBpuB,QAkBRi2C,OAAA,SAAOtnC,EAAWmc,mBAAXnc,IAAAA,EAAQ,YAAGmc,IAAAA,EAAQ,CAACsD,SAAU,SAC/BwnB,MAAM3pB,MAAM,CAACtd,MAAAA,GAAQmc,EAAMsD,UACzBpuB,QASRk2C,SAAA,kBACQl2C,KAAK41C,MAAM7qB,MAAMpc,OAAS,MAhOVuR,UAAnBo1B,EAWE1tB,QAAUA,GAXZ0tB"} \ No newline at end of file diff --git a/dist/view360.pkgd.js b/dist/view360.pkgd.js new file mode 100644 index 000000000..cc28f3958 --- /dev/null +++ b/dist/view360.pkgd.js @@ -0,0 +1,16870 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +All-in-one packaged file for ease use of '@egjs/view360' with below dependencies. +- @egjs/agent ^2.2.1, @egjs/axes ^2.7.1, @egjs/component ^2.1.2, es6-promise ^4.2.5, gl-matrix ^3.1.0, motion-sensors-polyfill ^0.3.1, webvr-polyfill ^0.9.41 +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.eg = global.eg || {}, global.eg.view360 = {}))); +}(this, (function (exports) { 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function commonjsRequire () { + throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs'); + } + + function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; + } + + var es6Promise = createCommonjsModule(function (module, exports) { + /*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ + + (function (global, factory) { + module.exports = factory(); + }(commonjsGlobal, (function () { + function objectOrFunction(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); + } + + function isFunction(x) { + return typeof x === 'function'; + } + + + + var _isArray = void 0; + if (Array.isArray) { + _isArray = Array.isArray; + } else { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } + + var isArray = _isArray; + + var len = 0; + var vertxNext = void 0; + var customSchedulerFn = void 0; + + var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } + }; + + function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; + } + + function setAsap(asapFn) { + asap = asapFn; + } + + var browserWindow = typeof window !== 'undefined' ? window : undefined; + var browserGlobal = browserWindow || {}; + var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; + var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + + // node + function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; + } + + // vertx + function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); + } + + function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; + } + + // web worker + function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; + } + + function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; + } + + var queue = new Array(1000); + function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; + } + + function attemptVertx() { + try { + var vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } + } + + var scheduleFlush = void 0; + // Decide what async method to use to triggering processing of queued callbacks: + if (isNode) { + scheduleFlush = useNextTick(); + } else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); + } else if (isWorker) { + scheduleFlush = useMessageChannel(); + } else if (browserWindow === undefined && typeof commonjsRequire === 'function') { + scheduleFlush = attemptVertx(); + } else { + scheduleFlush = useSetTimeout(); + } + + function then(onFulfillment, onRejection) { + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + + if (_state) { + var callback = arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + } + + /** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + function resolve$1(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + resolve(promise, object); + return promise; + } + + var PROMISE_ID = Math.random().toString(36).substring(2); + + function noop() {} + + var PENDING = void 0; + var FULFILLED = 1; + var REJECTED = 2; + + function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { + try { + then$$1.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } + } + + function handleForeignThenable(promise, thenable, then$$1) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then$$1, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); + } + + function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return resolve(promise, value); + }, function (reason) { + return reject(promise, reason); + }); + } + } + + function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$1 === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); + } else { + fulfill(promise, maybeThenable); + } + } + } + + function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + var then$$1 = void 0; + try { + then$$1 = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then$$1); + } else { + fulfill(promise, value); + } + } + + function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); + } + + function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } + } + + function reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); + } + + function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } + } + + function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = void 0, + callback = void 0, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = void 0, + error = void 0, + succeeded = true; + + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + + if (promise._state !== PENDING) ; else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } + } + + function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch (e) { + reject(promise, e); + } + } + + var id = 0; + function nextId() { + return id++; + } + + function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; + } + + function validationError() { + return new Error('Array Methods must be provided an Array'); + } + + var Enumerator = function () { + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + + Enumerator.prototype._enumerate = function _enumerate(input) { + for (var i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + }; + + Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { + var c = this._instanceConstructor; + var resolve$$1 = c.resolve; + + + if (resolve$$1 === resolve$1) { + var _then = void 0; + var error = void 0; + var didError = false; + try { + _then = entry.then; + } catch (e) { + didError = true; + error = e; + } + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise$1) { + var promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, _then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$1(entry), i); + } + }; + + Enumerator.prototype._settledAt = function _settledAt(state, i, value) { + var promise = this.promise; + + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + + Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + + return Enumerator; + }(); + + /** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static + */ + function all(entries) { + return new Enumerator(this, entries).promise; + } + + /** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. + */ + function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } + } + + /** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. + */ + function reject$1(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + reject(promise, reason); + return promise; + } + + function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor + */ + + var Promise$1 = function () { + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + Chaining + -------- + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + Assimilation + ------------ + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + If the assimliated promise rejects, then the downstream promise will also reject. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + Simple Example + -------------- + Synchronous Example + ```javascript + let result; + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + Promise Example; + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + Advanced Example + -------------- + Synchronous Example + ```javascript + let author, books; + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + function foundBooks(books) { + } + function failure(reason) { + } + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + Promise Example; + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + + + Promise.prototype.catch = function _catch(onRejection) { + return this.then(null, onRejection); + }; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + Synchronous example: + + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + + Asynchronous example: + + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + + @method finally + @param {Function} callback + @return {Promise} + */ + + + Promise.prototype.finally = function _finally(callback) { + var promise = this; + var constructor = promise.constructor; + + if (isFunction(callback)) { + return promise.then(function (value) { + return constructor.resolve(callback()).then(function () { + return value; + }); + }, function (reason) { + return constructor.resolve(callback()).then(function () { + throw reason; + }); + }); + } + + return promise.then(callback, callback); + }; + + return Promise; + }(); + + Promise$1.prototype.then = then; + Promise$1.all = all; + Promise$1.race = race; + Promise$1.resolve = resolve$1; + Promise$1.reject = reject$1; + Promise$1._setScheduler = setScheduler; + Promise$1._setAsap = setAsap; + Promise$1._asap = asap; + + /*global self*/ + function polyfill() { + var local = void 0; + + if (typeof commonjsGlobal !== 'undefined') { + local = commonjsGlobal; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise$1; + } + + // Strange compat.. + Promise$1.polyfill = polyfill; + Promise$1.Promise = Promise$1; + + return Promise$1; + + }))); + + + + + }); + + /* + Copyright (c) 2017 NAVER Corp. + @egjs/component project is licensed under the MIT license + + @egjs/component JavaScript library + https://naver.github.io/egjs-component + + @version 2.1.2 + */ + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + function isUndefined(value) { + return typeof value === "undefined"; + } + /** + * A class used to manage events in a component + * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스 + * @alias eg.Component + */ + + + var Component = + /*#__PURE__*/ + function () { + var Component = + /*#__PURE__*/ + function () { + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.Component.VERSION; // ex) 2.0.0 + * @memberof eg.Component + */ + + /** + * @support {"ie": "7+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.1+ (except 3.x)"} + */ + function Component() { + this._eventHandler = {}; + this.options = {}; + } + /** + * Triggers a custom event. + * @ko 커스텀 이벤트를 발생시킨다 + * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름 + * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터 + * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고 + * @example + class Some extends eg.Component { + 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. + } + }); + some.on("hi", (e) => { + // `currentTarget` is component instance. + console.log(some === e.currentTarget); // true + }); + // 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 trigger(eventName, customEvent) { + if (customEvent === void 0) { + customEvent = {}; + } + + var handlerList = this._eventHandler[eventName] || []; + var hasHandlerList = handlerList.length > 0; + + if (!hasHandlerList) { + return true; + } // If detach method call in handler in first time then handler list calls. + + + handlerList = handlerList.concat(); + customEvent.eventType = eventName; + var isCanceled = false; + var arg = [customEvent]; + var i = 0; + + customEvent.stop = function () { + isCanceled = true; + }; + + customEvent.currentTarget = this; + + for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + restParam[_key - 2] = arguments[_key]; + } + + if (restParam.length >= 1) { + arg = arg.concat(restParam); + } + + for (i = 0; handlerList[i]; i++) { + handlerList[i].apply(this, arg); + } + + return !isCanceled; + }; + /** + * Executed event just one time. + * @ko 이벤트가 한번만 실행된다. + * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름 + * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + alert("hi"); + } + thing() { + this.once("hi", this.hi); + } + } + var some = new Some(); + some.thing(); + some.trigger("hi"); + // fire alert("hi"); + some.trigger("hi"); + // Nothing happens + */ + + + _proto.once = function once(eventName, handlerToAttach) { + if (typeof eventName === "object" && isUndefined(handlerToAttach)) { + var eventHash = eventName; + var i; + + for (i in eventHash) { + this.once(i, eventHash[i]); + } + + return this; + } else if (typeof eventName === "string" && typeof handlerToAttach === "function") { + var self = this; + this.on(eventName, function listener() { + for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + arg[_key2] = arguments[_key2]; + } + + handlerToAttach.apply(self, arg); + self.off(eventName, listener); + }); + } + + 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 + class Some extends eg.Component { + some() { + this.hasOn("hi");// check hi event. + } + } + */ + + + _proto.hasOn = function hasOn(eventName) { + return !!this._eventHandler[eventName]; + }; + /** + * Attaches an event to a component. + * @ko 컴포넌트에 이벤트를 등록한다. + * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름 + * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + console.log("hi"); + } + some() { + this.on("hi",this.hi); //attach event + } + } + */ + + + _proto.on = function on(eventName, handlerToAttach) { + if (typeof eventName === "object" && isUndefined(handlerToAttach)) { + var eventHash = eventName; + var name; + + for (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. + * @ko 컴포넌트에 등록된 이벤트를 해제한다 + * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름 + * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수 + * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스 + * @example + class Some extends eg.Component { + hi() { + console.log("hi"); + } + some() { + this.off("hi",this.hi); //detach event + } + } + */ + + + _proto.off = function off(eventName, handlerToDetach) { + // All event detach. + if (isUndefined(eventName)) { + this._eventHandler = {}; + return this; + } // All handler of specific event detach. + + + if (isUndefined(handlerToDetach)) { + if (typeof eventName === "string") { + this._eventHandler[eventName] = undefined; + return this; + } else { + var eventHash = eventName; + var name; + + for (name in eventHash) { + this.off(name, eventHash[name]); + } + + return this; + } + } // The handler of specific event detach. + + + var handlerList = this._eventHandler[eventName]; + + if (handlerList) { + var k; + var handlerFunction; + + for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) { + if (handlerFunction === handlerToDetach) { + handlerList = handlerList.splice(k, 1); + break; + } + } + } + + return this; + }; + + return Component; + }(); + + Component.VERSION = "2.1.2"; + return Component; + }(); + + /** + * Common utilities + * @module glMatrix + */ + // Configuration Constants + var EPSILON = 0.000001; + var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; + var degree = Math.PI / 180; + /** + * Convert Degree To Radian + * + * @param {Number} a Angle in Degrees + */ + + function toRadian(a) { + return a * degree; + } + if (!Math.hypot) Math.hypot = function () { + var y = 0, + i = arguments.length; + + while (i--) { + y += arguments[i] * arguments[i]; + } + + return Math.sqrt(y); + }; + + /** + * 3x3 Matrix + * @module mat3 + */ + + /** + * Creates a new identity mat3 + * + * @returns {mat3} a new 3x3 matrix + */ + + function create$2() { + var out = new ARRAY_TYPE(9); + + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + } + + out[0] = 1; + out[4] = 1; + out[8] = 1; + return out; + } + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param {mat3} out the receiving 3x3 matrix + * @param {mat4} a the source 4x4 matrix + * @returns {mat3} out + */ + + function fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + /** + * Inverts a mat3 + * + * @param {mat3} out the receiving matrix + * @param {mat3} a the source matrix + * @returns {mat3} out + */ + + function invert$2(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2]; + var a10 = a[3], + a11 = a[4], + a12 = a[5]; + var a20 = a[6], + a21 = a[7], + a22 = a[8]; + var b01 = a22 * a11 - a12 * a21; + var b11 = -a22 * a10 + a12 * a20; + var b21 = a21 * a10 - a11 * a20; // Calculate the determinant + + var det = a00 * b01 + a01 * b11 + a02 * b21; + + if (!det) { + return null; + } + + det = 1.0 / det; + out[0] = b01 * det; + out[1] = (-a22 * a01 + a02 * a21) * det; + out[2] = (a12 * a01 - a02 * a11) * det; + out[3] = b11 * det; + out[4] = (a22 * a00 - a02 * a20) * det; + out[5] = (-a12 * a00 + a02 * a10) * det; + out[6] = b21 * det; + out[7] = (-a21 * a00 + a01 * a20) * det; + out[8] = (a11 * a00 - a01 * a10) * det; + return out; + } + + /** + * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied. + * @module mat4 + */ + + /** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ + + function create$3() { + var out = new ARRAY_TYPE(16); + + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + } + + out[0] = 1; + out[5] = 1; + out[10] = 1; + out[15] = 1; + return out; + } + /** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ + + function identity$3(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Rotates a matrix by the given angle around the X axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + + function rotateX(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a10 = a[4]; + var a11 = a[5]; + var a12 = a[6]; + var a13 = a[7]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + if (a !== out) { + // If the source and destination differ, copy the unchanged rows + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } // Perform axis-specific matrix multiplication + + + out[4] = a10 * c + a20 * s; + out[5] = a11 * c + a21 * s; + out[6] = a12 * c + a22 * s; + out[7] = a13 * c + a23 * s; + out[8] = a20 * c - a10 * s; + out[9] = a21 * c - a11 * s; + out[10] = a22 * c - a12 * s; + out[11] = a23 * c - a13 * s; + return out; + } + /** + * Rotates a matrix by the given angle around the Y axis + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the matrix to rotate + * @param {Number} rad the angle to rotate the matrix by + * @returns {mat4} out + */ + + function rotateY(out, a, rad) { + var s = Math.sin(rad); + var c = Math.cos(rad); + var a00 = a[0]; + var a01 = a[1]; + var a02 = a[2]; + var a03 = a[3]; + var a20 = a[8]; + var a21 = a[9]; + var a22 = a[10]; + var a23 = a[11]; + + if (a !== out) { + // If the source and destination differ, copy the unchanged rows + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + } // Perform axis-specific matrix multiplication + + + out[0] = a00 * c - a20 * s; + out[1] = a01 * c - a21 * s; + out[2] = a02 * c - a22 * s; + out[3] = a03 * c - a23 * s; + out[8] = a00 * s + a20 * c; + out[9] = a01 * s + a21 * c; + out[10] = a02 * s + a22 * c; + out[11] = a03 * s + a23 * c; + return out; + } + /** + * Calculates a 4x4 matrix from the given quaternion + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Quaternion to create matrix from + * + * @returns {mat4} out + */ + + function fromQuat$1(out, q) { + var x = q[0], + y = q[1], + z = q[2], + w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + /** + * Generates a perspective projection matrix with the given bounds. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum, can be null or Infinity + * @returns {mat4} out + */ + + function perspective(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2), + nf; + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + + if (far != null && far !== Infinity) { + nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + + return out; + } + + /** + * 3 Dimensional Vector + * @module vec3 + */ + + /** + * Creates a new, empty vec3 + * + * @returns {vec3} a new 3D vector + */ + + function create$4() { + var out = new ARRAY_TYPE(3); + + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + + return out; + } + /** + * Calculates the length of a vec3 + * + * @param {vec3} a vector to calculate length of + * @returns {Number} length of a + */ + + function length(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return Math.hypot(x, y, z); + } + /** + * Creates a new vec3 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @returns {vec3} a new 3D vector + */ + + function fromValues$4(x, y, z) { + var out = new ARRAY_TYPE(3); + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Copy the values from one vec3 to another + * + * @param {vec3} out the receiving vector + * @param {vec3} a the source vector + * @returns {vec3} out + */ + + function copy$4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + /** + * Set the components of a vec3 to the given values + * + * @param {vec3} out the receiving vector + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @returns {vec3} out + */ + + function set$5(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + /** + * Subtracts vector b from vector a + * + * @param {vec3} out the receiving vector + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @returns {vec3} out + */ + + function subtract$4(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + /** + * Scales a vec3 by a scalar number + * + * @param {vec3} out the receiving vector + * @param {vec3} a the vector to scale + * @param {Number} b amount to scale the vector by + * @returns {vec3} out + */ + + function scale$4(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + return out; + } + /** + * Normalize a vec3 + * + * @param {vec3} out the receiving vector + * @param {vec3} a vector to normalize + * @returns {vec3} out + */ + + function normalize(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var len = x * x + y * y + z * z; + + if (len > 0) { + //TODO: evaluate use of glm_invsqrt here? + len = 1 / Math.sqrt(len); + } + + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + /** + * Calculates the dot product of two vec3's + * + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @returns {Number} dot product of a and b + */ + + function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + /** + * Computes the cross product of two vec3's + * + * @param {vec3} out the receiving vector + * @param {vec3} a the first operand + * @param {vec3} b the second operand + * @returns {vec3} out + */ + + function cross(out, a, b) { + var ax = a[0], + ay = a[1], + az = a[2]; + var bx = b[0], + by = b[1], + bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + /** + * Transforms the vec3 with a mat3. + * + * @param {vec3} out the receiving vector + * @param {vec3} a the vector to transform + * @param {mat3} m the 3x3 matrix to transform with + * @returns {vec3} out + */ + + function transformMat3(out, a, m) { + var x = a[0], + y = a[1], + z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * + * @param {vec3} out the receiving vector + * @param {vec3} a the vector to transform + * @param {quat} q quaternion to transform with + * @returns {vec3} out + */ + + function transformQuat(out, a, q) { + // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed + var qx = q[0], + qy = q[1], + qz = q[2], + qw = q[3]; + var x = a[0], + y = a[1], + z = a[2]; // var qvec = [qx, qy, qz]; + // var uv = vec3.cross([], qvec, a); + + var uvx = qy * z - qz * y, + uvy = qz * x - qx * z, + uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); + + var uuvx = qy * uvz - qz * uvy, + uuvy = qz * uvx - qx * uvz, + uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); + + var w2 = qw * 2; + uvx *= w2; + uvy *= w2; + uvz *= w2; // vec3.scale(uuv, uuv, 2); + + uuvx *= 2; + uuvy *= 2; + uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); + + out[0] = x + uvx + uuvx; + out[1] = y + uvy + uuvy; + out[2] = z + uvz + uuvz; + return out; + } + /** + * Alias for {@link vec3.length} + * @function + */ + + var len = length; + /** + * Perform some operation over an array of vec3s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + + var forEach = function () { + var vec = create$4(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + + if (!stride) { + stride = 3; + } + + if (!offset) { + offset = 0; + } + + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + vec[2] = a[i + 2]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + a[i + 2] = vec[2]; + } + + return a; + }; + }(); + + /** + * 4 Dimensional Vector + * @module vec4 + */ + + /** + * Creates a new, empty vec4 + * + * @returns {vec4} a new 4D vector + */ + + function create$5() { + var out = new ARRAY_TYPE(4); + + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + } + + return out; + } + /** + * Creates a new vec4 initialized with values from an existing vector + * + * @param {vec4} a vector to clone + * @returns {vec4} a new 4D vector + */ + + function clone$5(a) { + var out = new ARRAY_TYPE(4); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a new vec4 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {vec4} a new 4D vector + */ + + function fromValues$5(x, y, z, w) { + var out = new ARRAY_TYPE(4); + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + /** + * Copy the values from one vec4 to another + * + * @param {vec4} out the receiving vector + * @param {vec4} a the source vector + * @returns {vec4} out + */ + + function copy$5(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + /** + * Normalize a vec4 + * + * @param {vec4} out the receiving vector + * @param {vec4} a vector to normalize + * @returns {vec4} out + */ + + function normalize$1(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + var len = x * x + y * y + z * z + w * w; + + if (len > 0) { + len = 1 / Math.sqrt(len); + } + + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {vec4} a The first vector. + * @param {vec4} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + + function exactEquals$5(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {vec4} a The first vector. + * @param {vec4} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + + function equals$6(a, b) { + var a0 = a[0], + a1 = a[1], + a2 = a[2], + a3 = a[3]; + var b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)); + } + /** + * Perform some operation over an array of vec4s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + + var forEach$1 = function () { + var vec = create$5(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + + if (!stride) { + stride = 4; + } + + if (!offset) { + offset = 0; + } + + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + vec[2] = a[i + 2]; + vec[3] = a[i + 3]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + a[i + 2] = vec[2]; + a[i + 3] = vec[3]; + } + + return a; + }; + }(); + + /** + * Quaternion + * @module quat + */ + + /** + * Creates a new identity quat + * + * @returns {quat} a new quaternion + */ + + function create$6() { + var out = new ARRAY_TYPE(4); + + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + + out[3] = 1; + return out; + } + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * + * @param {quat} out the receiving quaternion + * @param {vec3} axis the axis around which to rotate + * @param {Number} rad the angle in radians + * @returns {quat} out + **/ + + function setAxisAngle(out, axis, rad) { + rad = rad * 0.5; + var s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + /** + * Multiplies two quat's + * + * @param {quat} out the receiving quaternion + * @param {quat} a the first operand + * @param {quat} b the second operand + * @returns {quat} out + */ + + function multiply$6(out, a, b) { + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + /** + * Performs a spherical linear interpolation between two quat + * + * @param {quat} out the receiving quaternion + * @param {quat} a the first operand + * @param {quat} b the second operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {quat} out + */ + + function slerp(out, a, b, t) { + // benchmarks: + // http://jsperf.com/quaternion-slerp-implementations + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + var omega, cosom, sinom, scale0, scale1; // calc cosine + + cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) + + if (cosom < 0.0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } // calculate coefficients + + + if (1.0 - cosom > EPSILON) { + // standard case (slerp) + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1.0 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + // "from" and "to" quaternions are very close + // ... so we can do a linear interpolation + scale0 = 1.0 - t; + scale1 = t; + } // calculate final values + + + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * + * @param {quat} out the receiving quaternion + * @param {quat} a quat to calculate conjugate of + * @returns {quat} out + */ + + function conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to renormalize the quaternion yourself where necessary. + * + * @param {quat} out the receiving quaternion + * @param {mat3} m rotation matrix + * @returns {quat} out + * @function + */ + + function fromMat3(out, m) { + // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes + // article "Quaternion Calculus and Fast Animation". + var fTrace = m[0] + m[4] + m[8]; + var fRoot; + + if (fTrace > 0.0) { + // |w| > 1/2, may as well choose w > 1/2 + fRoot = Math.sqrt(fTrace + 1.0); // 2w + + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; // 1/(4w) + + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + // |w| <= 1/2 + var i = 0; + if (m[4] > m[0]) i = 1; + if (m[8] > m[i * 3 + i]) i = 2; + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + + return out; + } + /** + * Creates a new quat initialized with values from an existing quaternion + * + * @param {quat} a quaternion to clone + * @returns {quat} a new quaternion + * @function + */ + + var clone$6 = clone$5; + /** + * Creates a new quat initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {quat} a new quaternion + * @function + */ + + var fromValues$6 = fromValues$5; + /** + * Copy the values from one quat to another + * + * @param {quat} out the receiving quaternion + * @param {quat} a the source quaternion + * @returns {quat} out + * @function + */ + + var copy$6 = copy$5; + /** + * Normalize a quat + * + * @param {quat} out the receiving quaternion + * @param {quat} a quaternion to normalize + * @returns {quat} out + * @function + */ + + var normalize$2 = normalize$1; + /** + * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===) + * + * @param {quat} a The first quaternion. + * @param {quat} b The second quaternion. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + + var exactEquals$6 = exactEquals$5; + /** + * Returns whether or not the quaternions have approximately the same elements in the same position. + * + * @param {quat} a The first vector. + * @param {quat} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + + var equals$7 = equals$6; + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param {quat} out the receiving quaternion. + * @param {vec3} a the initial vector + * @param {vec3} b the destination vector + * @returns {quat} out + */ + + var rotationTo = function () { + var tmpvec3 = create$4(); + var xUnitVec3 = fromValues$4(1, 0, 0); + var yUnitVec3 = fromValues$4(0, 1, 0); + return function (out, a, b) { + var dot$$1 = dot(a, b); + + if (dot$$1 < -0.999999) { + cross(tmpvec3, xUnitVec3, a); + if (len(tmpvec3) < 0.000001) cross(tmpvec3, yUnitVec3, a); + normalize(tmpvec3, tmpvec3); + setAxisAngle(out, tmpvec3, Math.PI); + return out; + } else if (dot$$1 > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + cross(tmpvec3, a, b); + out[0] = tmpvec3[0]; + out[1] = tmpvec3[1]; + out[2] = tmpvec3[2]; + out[3] = 1 + dot$$1; + return normalize$2(out, out); + } + }; + }(); + /** + * Performs a spherical linear interpolation with two control points + * + * @param {quat} out the receiving quaternion + * @param {quat} a the first operand + * @param {quat} b the second operand + * @param {quat} c the third operand + * @param {quat} d the fourth operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {quat} out + */ + + var sqlerp = function () { + var temp1 = create$6(); + var temp2 = create$6(); + return function (out, a, b, c, d, t) { + slerp(temp1, a, d, t); + slerp(temp2, b, c, t); + slerp(out, temp1, temp2, 2 * t * (1 - t)); + return out; + }; + }(); + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param {vec3} view the vector representing the viewing direction + * @param {vec3} right the vector representing the local "right" direction + * @param {vec3} up the vector representing the local "up" direction + * @returns {quat} out + */ + + var setAxes = function () { + var matr = create$2(); + return function (out, view, right, up) { + matr[0] = right[0]; + matr[3] = right[1]; + matr[6] = right[2]; + matr[1] = up[0]; + matr[4] = up[1]; + matr[7] = up[2]; + matr[2] = -view[0]; + matr[5] = -view[1]; + matr[8] = -view[2]; + return normalize$2(out, fromMat3(out, matr)); + }; + }(); + + /** + * 2 Dimensional Vector + * @module vec2 + */ + + /** + * Creates a new, empty vec2 + * + * @returns {vec2} a new 2D vector + */ + + function create$8() { + var out = new ARRAY_TYPE(2); + + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + } + + return out; + } + /** + * Creates a new vec2 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @returns {vec2} a new 2D vector + */ + + function fromValues$8(x, y) { + var out = new ARRAY_TYPE(2); + out[0] = x; + out[1] = y; + return out; + } + /** + * Copy the values from one vec2 to another + * + * @param {vec2} out the receiving vector + * @param {vec2} a the source vector + * @returns {vec2} out + */ + + function copy$8(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + /** + * Normalize a vec2 + * + * @param {vec2} out the receiving vector + * @param {vec2} a vector to normalize + * @returns {vec2} out + */ + + function normalize$4(out, a) { + var x = a[0], + y = a[1]; + var len = x * x + y * y; + + if (len > 0) { + //TODO: evaluate use of glm_invsqrt here? + len = 1 / Math.sqrt(len); + } + + out[0] = a[0] * len; + out[1] = a[1] * len; + return out; + } + /** + * Calculates the dot product of two vec2's + * + * @param {vec2} a the first operand + * @param {vec2} b the second operand + * @returns {Number} dot product of a and b + */ + + function dot$4(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Perform some operation over an array of vec2s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + + var forEach$2 = function () { + var vec = create$8(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + + if (!stride) { + stride = 2; + } + + if (!offset) { + offset = 0; + } + + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + } + + return a; + }; + }(); + + /* + 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); + } + } + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + /* eslint-disable no-new-func, no-nested-ternary */ + + var win = typeof window !== "undefined" && window.Math === Math ? window : typeof self !== "undefined" && self.Math === Math ? self : Function("return this")(); + /* eslint-enable no-new-func, no-nested-ternary */ + + var doc = win.document; + var agent$1 = agent(); + var osName = agent$1.os.name; + var browserName = agent$1.browser.name; + var IS_IOS = osName === "ios"; + var IS_SAFARI_ON_DESKTOP = osName === "mac" && browserName === "safari"; + + /** + * Copyright (c) 2015 NAVER Corp. + * egjs projects are licensed under the MIT license + */ + win.Float32Array = typeof win.Float32Array !== "undefined" ? win.Float32Array : win.Array; + var Float32Array$1 = win.Float32Array; + var getComputedStyle = win.getComputedStyle; + var userAgent = win.navigator.userAgent; + var SUPPORT_TOUCH = "ontouchstart" in win; + var SUPPORT_DEVICEMOTION = "ondevicemotion" in win; + var DeviceMotionEvent = win.DeviceMotionEvent; + var devicePixelRatio = win.devicePixelRatio; + + var TRANSFORM = function () { + var docStyle = doc.documentElement.style; + var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; + + for (var i = 0, len = target.length; i < len; i++) { + if (target[i] in docStyle) { + return target[i]; + } + } + + return ""; + }(); // check for will-change support + + + var SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports && win.CSS.supports("will-change", "transform"); + var WEBXR_SUPPORTED = false; + + var checkXRSupport = function checkXRSupport() { + if (!navigator.xr) { + return; + } + + if (navigator.xr.isSessionSupported) { + navigator.xr.isSessionSupported("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } else if (navigator.xr.supportsSession) { + navigator.xr.supportsSession("immersive-vr").then(function (res) { + WEBXR_SUPPORTED = res; + })["catch"](function () {}); + } + }; + + /*! Hammer.JS - v2.0.17-rc - 2019-12-16 + * http://naver.github.io/egjs + * + * Forked By Naver egjs + * Copyright (c) hammerjs + * Licensed under the MIT license */ + function _extends$1() { + _extends$1 = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends$1.apply(this, arguments); + } + + function _inheritsLoose$1(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized$1(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + /** + * @private + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} target + * @param {...Object} objects_to_assign + * @returns {Object} target + */ + var assign; + + if (typeof Object.assign !== 'function') { + assign = function assign(target) { + if (target === undefined || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var output = Object(target); + + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + + if (source !== undefined && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + + return output; + }; + } else { + assign = Object.assign; + } + + var assign$1 = assign; + + var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; + var TEST_ELEMENT = typeof document === "undefined" ? { + style: {} + } : document.createElement('div'); + var TYPE_FUNCTION = 'function'; + var round$3 = Math.round, + abs = Math.abs; + var now = Date.now; + + /** + * @private + * get the prefixed property + * @param {Object} obj + * @param {String} property + * @returns {String|Undefined} prefixed + */ + + function prefixed(obj, property) { + var prefix; + var prop; + var camelProp = property[0].toUpperCase() + property.slice(1); + var i = 0; + + while (i < VENDOR_PREFIXES.length) { + prefix = VENDOR_PREFIXES[i]; + prop = prefix ? prefix + camelProp : property; + + if (prop in obj) { + return prop; + } + + i++; + } + + return undefined; + } + + /* eslint-disable no-new-func, no-nested-ternary */ + var win$1; + + if (typeof window === "undefined") { + // window is undefined in node.js + win$1 = {}; + } else { + win$1 = window; + } + + var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); + var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; + function getTouchActionProps() { + if (!NATIVE_TOUCH_ACTION) { + return false; + } + + var touchMap = {}; + var cssSupports = win$1.CSS && win$1.CSS.supports; + ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) { + // If css.supports is not supported but there is native touch-action assume it supports + // all values. This is the case for IE 10 and 11. + return touchMap[val] = cssSupports ? win$1.CSS.supports('touch-action', val) : true; + }); + return touchMap; + } + + var TOUCH_ACTION_COMPUTE = 'compute'; + var TOUCH_ACTION_AUTO = 'auto'; + var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented + + var TOUCH_ACTION_NONE = 'none'; + var TOUCH_ACTION_PAN_X = 'pan-x'; + var TOUCH_ACTION_PAN_Y = 'pan-y'; + var TOUCH_ACTION_MAP = getTouchActionProps(); + + var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; + var SUPPORT_TOUCH$1 = 'ontouchstart' in win$1; + var SUPPORT_POINTER_EVENTS = prefixed(win$1, 'PointerEvent') !== undefined; + var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH$1 && MOBILE_REGEX.test(navigator.userAgent); + var INPUT_TYPE_TOUCH = 'touch'; + var INPUT_TYPE_PEN = 'pen'; + var INPUT_TYPE_MOUSE = 'mouse'; + var INPUT_TYPE_KINECT = 'kinect'; + var COMPUTE_INTERVAL = 25; + var INPUT_START = 1; + var INPUT_MOVE = 2; + var INPUT_END = 4; + var INPUT_CANCEL = 8; + var DIRECTION_NONE = 1; + var DIRECTION_LEFT = 2; + var DIRECTION_RIGHT = 4; + var DIRECTION_UP = 8; + var DIRECTION_DOWN = 16; + var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; + var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; + var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; + var PROPS_XY = ['x', 'y']; + var PROPS_CLIENT_XY = ['clientX', 'clientY']; + + /** + * @private + * walk objects and arrays + * @param {Object} obj + * @param {Function} iterator + * @param {Object} context + */ + function each(obj, iterator, context) { + var i; + + if (!obj) { + return; + } + + if (obj.forEach) { + obj.forEach(iterator, context); + } else if (obj.length !== undefined) { + i = 0; + + while (i < obj.length) { + iterator.call(context, obj[i], i, obj); + i++; + } + } else { + for (i in obj) { + obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); + } + } + } + + /** + * @private + * let a boolean value also be a function that must return a boolean + * this first item in args will be used as the context + * @param {Boolean|Function} val + * @param {Array} [args] + * @returns {Boolean} + */ + + function boolOrFn(val, args) { + if (typeof val === TYPE_FUNCTION) { + return val.apply(args ? args[0] || undefined : undefined, args); + } + + return val; + } + + /** + * @private + * small indexOf wrapper + * @param {String} str + * @param {String} find + * @returns {Boolean} found + */ + function inStr(str, find) { + return str.indexOf(find) > -1; + } + + /** + * @private + * when the touchActions are collected they are not a valid value, so we need to clean things up. * + * @param {String} actions + * @returns {*} + */ + + function cleanTouchActions(actions) { + // none + if (inStr(actions, TOUCH_ACTION_NONE)) { + return TOUCH_ACTION_NONE; + } + + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers + // for different directions, e.g. horizontal pan but vertical swipe?) + // we need none (as otherwise with pan-x pan-y combined none of these + // recognizers will work, since the browser would handle all panning + + if (hasPanX && hasPanY) { + return TOUCH_ACTION_NONE; + } // pan-x OR pan-y + + + if (hasPanX || hasPanY) { + return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; + } // manipulation + + + if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { + return TOUCH_ACTION_MANIPULATION; + } + + return TOUCH_ACTION_AUTO; + } + + /** + * @private + * Touch Action + * sets the touchAction property or uses the js alternative + * @param {Manager} manager + * @param {String} value + * @constructor + */ + + var TouchAction = + /*#__PURE__*/ + function () { + function TouchAction(manager, value) { + this.manager = manager; + this.set(value); + } + /** + * @private + * set the touchAction value on the element or enable the polyfill + * @param {String} value + */ + + + var _proto = TouchAction.prototype; + + _proto.set = function set(value) { + // find out the touch-action by the event handlers + if (value === TOUCH_ACTION_COMPUTE) { + value = this.compute(); + } + + if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { + this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; + } + + this.actions = value.toLowerCase().trim(); + }; + /** + * @private + * just re-set the touchAction value + */ + + + _proto.update = function update() { + this.set(this.manager.options.touchAction); + }; + /** + * @private + * compute the value for the touchAction property based on the recognizer's settings + * @returns {String} value + */ + + + _proto.compute = function compute() { + var actions = []; + each(this.manager.recognizers, function (recognizer) { + if (boolOrFn(recognizer.options.enable, [recognizer])) { + actions = actions.concat(recognizer.getTouchAction()); + } + }); + return cleanTouchActions(actions.join(' ')); + }; + /** + * @private + * this method is called on each input cycle and provides the preventing of the browser behavior + * @param {Object} input + */ + + + _proto.preventDefaults = function preventDefaults(input) { + var srcEvent = input.srcEvent; + var direction = input.offsetDirection; // if the touch action did prevented once this session + + if (this.manager.session.prevented) { + srcEvent.preventDefault(); + return; + } + + var actions = this.actions; + var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; + var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; + var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; + + if (hasNone) { + // do not prevent defaults if this is a tap gesture + var isTapPointer = input.pointers.length === 1; + var isTapMovement = input.distance < 2; + var isTapTouchTime = input.deltaTime < 250; + + if (isTapPointer && isTapMovement && isTapTouchTime) { + return; + } + } + + if (hasPanX && hasPanY) { + // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent + return; + } + + if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) { + return this.preventSrc(srcEvent); + } + }; + /** + * @private + * call preventDefault to prevent the browser's default behavior (scrolling in most cases) + * @param {Object} srcEvent + */ + + + _proto.preventSrc = function preventSrc(srcEvent) { + this.manager.session.prevented = true; + srcEvent.preventDefault(); + }; + + return TouchAction; + }(); + + /** + * @private + * find if a node is in the given parent + * @method hasParent + * @param {HTMLElement} node + * @param {HTMLElement} parent + * @return {Boolean} found + */ + function hasParent(node, parent) { + while (node) { + if (node === parent) { + return true; + } + + node = node.parentNode; + } + + return false; + } + + /** + * @private + * get the center of all the pointers + * @param {Array} pointers + * @return {Object} center contains `x` and `y` properties + */ + + function getCenter(pointers) { + var pointersLength = pointers.length; // no need to loop when only one touch + + if (pointersLength === 1) { + return { + x: round$3(pointers[0].clientX), + y: round$3(pointers[0].clientY) + }; + } + + var x = 0; + var y = 0; + var i = 0; + + while (i < pointersLength) { + x += pointers[i].clientX; + y += pointers[i].clientY; + i++; + } + + return { + x: round$3(x / pointersLength), + y: round$3(y / pointersLength) + }; + } + + /** + * @private + * create a simple clone from the input used for storage of firstInput and firstMultiple + * @param {Object} input + * @returns {Object} clonedInputData + */ + + function simpleCloneInputData(input) { + // make a simple copy of the pointers because we will get a reference if we don't + // we only need clientXY for the calculations + var pointers = []; + var i = 0; + + while (i < input.pointers.length) { + pointers[i] = { + clientX: round$3(input.pointers[i].clientX), + clientY: round$3(input.pointers[i].clientY) + }; + i++; + } + + return { + timeStamp: now(), + pointers: pointers, + center: getCenter(pointers), + deltaX: input.deltaX, + deltaY: input.deltaY + }; + } + + /** + * @private + * calculate the absolute distance between two points + * @param {Object} p1 {x, y} + * @param {Object} p2 {x, y} + * @param {Array} [props] containing x and y keys + * @return {Number} distance + */ + + function getDistance(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + + var x = p2[props[0]] - p1[props[0]]; + var y = p2[props[1]] - p1[props[1]]; + return Math.sqrt(x * x + y * y); + } + + /** + * @private + * calculate the angle between two coordinates + * @param {Object} p1 + * @param {Object} p2 + * @param {Array} [props] containing x and y keys + * @return {Number} angle + */ + + function getAngle$1(p1, p2, props) { + if (!props) { + props = PROPS_XY; + } + + var x = p2[props[0]] - p1[props[0]]; + var y = p2[props[1]] - p1[props[1]]; + return Math.atan2(y, x) * 180 / Math.PI; + } + + /** + * @private + * get the direction between two points + * @param {Number} x + * @param {Number} y + * @return {Number} direction + */ + + function getDirection(x, y) { + if (x === y) { + return DIRECTION_NONE; + } + + if (abs(x) >= abs(y)) { + return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + } + + return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; + } + + function computeDeltaXY(session, input) { + var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session; + // jscs throwing error on defalut destructured values and without defaults tests fail + + var offset = session.offsetDelta || {}; + var prevDelta = session.prevDelta || {}; + var prevInput = session.prevInput || {}; + + if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { + prevDelta = session.prevDelta = { + x: prevInput.deltaX || 0, + y: prevInput.deltaY || 0 + }; + offset = session.offsetDelta = { + x: center.x, + y: center.y + }; + } + + input.deltaX = prevDelta.x + (center.x - offset.x); + input.deltaY = prevDelta.y + (center.y - offset.y); + } + + /** + * @private + * calculate the velocity between two points. unit is in px per ms. + * @param {Number} deltaTime + * @param {Number} x + * @param {Number} y + * @return {Object} velocity `x` and `y` + */ + function getVelocity(deltaTime, x, y) { + return { + x: x / deltaTime || 0, + y: y / deltaTime || 0 + }; + } + + /** + * @private + * calculate the scale factor between two pointersets + * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} scale + */ + + function getScale(start, end) { + return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); + } + + /** + * @private + * calculate the rotation degrees between two pointersets + * @param {Array} start array of pointers + * @param {Array} end array of pointers + * @return {Number} rotation + */ + + function getRotation$1(start, end) { + return getAngle$1(end[1], end[0], PROPS_CLIENT_XY) + getAngle$1(start[1], start[0], PROPS_CLIENT_XY); + } + + /** + * @private + * velocity is calculated every x ms + * @param {Object} session + * @param {Object} input + */ + + function computeIntervalInputData(session, input) { + var last = session.lastInterval || input; + var deltaTime = input.timeStamp - last.timeStamp; + var velocity; + var velocityX; + var velocityY; + var direction; + + if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { + var deltaX = input.deltaX - last.deltaX; + var deltaY = input.deltaY - last.deltaY; + var v = getVelocity(deltaTime, deltaX, deltaY); + velocityX = v.x; + velocityY = v.y; + velocity = abs(v.x) > abs(v.y) ? v.x : v.y; + direction = getDirection(deltaX, deltaY); + session.lastInterval = input; + } else { + // use latest velocity info if it doesn't overtake a minimum period + velocity = last.velocity; + velocityX = last.velocityX; + velocityY = last.velocityY; + direction = last.direction; + } + + input.velocity = velocity; + input.velocityX = velocityX; + input.velocityY = velocityY; + input.direction = direction; + } + + /** + * @private + * extend the data with some usable properties like scale, rotate, velocity etc + * @param {Object} manager + * @param {Object} input + */ + + function computeInputData(manager, input) { + var session = manager.session; + var pointers = input.pointers; + var pointersLength = pointers.length; // store the first input to calculate the distance and direction + + if (!session.firstInput) { + session.firstInput = simpleCloneInputData(input); + } // to compute scale and rotation we need to store the multiple touches + + + if (pointersLength > 1 && !session.firstMultiple) { + session.firstMultiple = simpleCloneInputData(input); + } else if (pointersLength === 1) { + session.firstMultiple = false; + } + + var firstInput = session.firstInput, + firstMultiple = session.firstMultiple; + var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; + var center = input.center = getCenter(pointers); + input.timeStamp = now(); + input.deltaTime = input.timeStamp - firstInput.timeStamp; + input.angle = getAngle$1(offsetCenter, center); + input.distance = getDistance(offsetCenter, center); + computeDeltaXY(session, input); + input.offsetDirection = getDirection(input.deltaX, input.deltaY); + var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); + input.overallVelocityX = overallVelocity.x; + input.overallVelocityY = overallVelocity.y; + input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y; + input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; + input.rotation = firstMultiple ? getRotation$1(firstMultiple.pointers, pointers) : 0; + input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers; + computeIntervalInputData(session, input); // find the correct target + + var target = manager.element; + var srcEvent = input.srcEvent; + var srcEventTarget; + + if (srcEvent.composedPath) { + srcEventTarget = srcEvent.composedPath()[0]; + } else if (srcEvent.path) { + srcEventTarget = srcEvent.path[0]; + } else { + srcEventTarget = srcEvent.target; + } + + if (hasParent(srcEventTarget, target)) { + target = srcEventTarget; + } + + input.target = target; + } + + /** + * @private + * handle input events + * @param {Manager} manager + * @param {String} eventType + * @param {Object} input + */ + + function inputHandler(manager, eventType, input) { + var pointersLen = input.pointers.length; + var changedPointersLen = input.changedPointers.length; + var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0; + var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0; + input.isFirst = !!isFirst; + input.isFinal = !!isFinal; + + if (isFirst) { + manager.session = {}; + } // source event is the normalized value of the domEvents + // like 'touchstart, mouseup, pointerdown' + + + input.eventType = eventType; // compute scale, rotation etc + + computeInputData(manager, input); // emit secret event + + manager.emit('hammer.input', input); + manager.recognize(input); + manager.session.prevInput = input; + } + + /** + * @private + * split string on whitespace + * @param {String} str + * @returns {Array} words + */ + function splitStr(str) { + return str.trim().split(/\s+/g); + } + + /** + * @private + * addEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ + + function addEventListeners(target, types, handler) { + each(splitStr(types), function (type) { + target.addEventListener(type, handler, false); + }); + } + + /** + * @private + * removeEventListener with multiple events at once + * @param {EventTarget} target + * @param {String} types + * @param {Function} handler + */ + + function removeEventListeners(target, types, handler) { + each(splitStr(types), function (type) { + target.removeEventListener(type, handler, false); + }); + } + + /** + * @private + * get the window object of an element + * @param {HTMLElement} element + * @returns {DocumentView|Window} + */ + function getWindowForElement(element) { + var doc = element.ownerDocument || element; + return doc.defaultView || doc.parentWindow || window; + } + + /** + * @private + * create new input type manager + * @param {Manager} manager + * @param {Function} callback + * @returns {Input} + * @constructor + */ + + var Input = + /*#__PURE__*/ + function () { + function Input(manager, callback) { + var self = this; + this.manager = manager; + this.callback = callback; + this.element = manager.element; + this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager, + // so when disabled the input events are completely bypassed. + + this.domHandler = function (ev) { + if (boolOrFn(manager.options.enable, [manager])) { + self.handler(ev); + } + }; + + this.init(); + } + /** + * @private + * should handle the inputEvent data and trigger the callback + * @virtual + */ + + + var _proto = Input.prototype; + + _proto.handler = function handler() {}; + /** + * @private + * bind the events + */ + + + _proto.init = function init() { + this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }; + /** + * @private + * unbind the events + */ + + + _proto.destroy = function destroy() { + this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); + this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); + this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); + }; + + return Input; + }(); + + /** + * @private + * find if a array contains the object using indexOf or a simple polyFill + * @param {Array} src + * @param {String} find + * @param {String} [findByKey] + * @return {Boolean|Number} false when not found, or the index + */ + function inArray(src, find, findByKey) { + if (src.indexOf && !findByKey) { + return src.indexOf(find); + } else { + var i = 0; + + while (i < src.length) { + if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) { + // do not use === here, test fails + return i; + } + + i++; + } + + return -1; + } + } + + var POINTER_INPUT_MAP = { + pointerdown: INPUT_START, + pointermove: INPUT_MOVE, + pointerup: INPUT_END, + pointercancel: INPUT_CANCEL, + pointerout: INPUT_CANCEL + }; // in IE10 the pointer types is defined as an enum + + var IE10_POINTER_TYPE_ENUM = { + 2: INPUT_TYPE_TOUCH, + 3: INPUT_TYPE_PEN, + 4: INPUT_TYPE_MOUSE, + 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 + + }; + var POINTER_ELEMENT_EVENTS = 'pointerdown'; + var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive + + if (win$1.MSPointerEvent && !win$1.PointerEvent) { + POINTER_ELEMENT_EVENTS = 'MSPointerDown'; + POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; + } + /** + * @private + * Pointer events input + * @constructor + * @extends Input + */ + + + var PointerEventInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(PointerEventInput, _Input); + + function PointerEventInput() { + var _this; + + var proto = PointerEventInput.prototype; + proto.evEl = POINTER_ELEMENT_EVENTS; + proto.evWin = POINTER_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.store = _this.manager.session.pointerEvents = []; + return _this; + } + /** + * @private + * handle mouse events + * @param {Object} ev + */ + + + var _proto = PointerEventInput.prototype; + + _proto.handler = function handler(ev) { + var store = this.store; + var removePointer = false; + var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); + var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; + var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; + var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store + + var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down + + if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { + if (storeIndex < 0) { + store.push(ev); + storeIndex = store.length - 1; + } + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + removePointer = true; + } // it not found, so the pointer hasn't been down (so it's probably a hover) + + + if (storeIndex < 0) { + return; + } // update the event in the store + + + store[storeIndex] = ev; + this.callback(this.manager, eventType, { + pointers: store, + changedPointers: [ev], + pointerType: pointerType, + srcEvent: ev + }); + + if (removePointer) { + // remove from the store + store.splice(storeIndex, 1); + } + }; + + return PointerEventInput; + }(Input); + + /** + * @private + * convert array-like objects to real arrays + * @param {Object} obj + * @returns {Array} + */ + function toArray(obj) { + return Array.prototype.slice.call(obj, 0); + } + + /** + * @private + * unique array with objects based on a key (like 'id') or just by the array's value + * @param {Array} src [{id:1},{id:2},{id:1}] + * @param {String} [key] + * @param {Boolean} [sort=False] + * @returns {Array} [{id:1},{id:2}] + */ + + function uniqueArray(src, key, sort) { + var results = []; + var values = []; + var i = 0; + + while (i < src.length) { + var val = key ? src[i][key] : src[i]; + + if (inArray(values, val) < 0) { + results.push(src[i]); + } + + values[i] = val; + i++; + } + + if (sort) { + if (!key) { + results = results.sort(); + } else { + results = results.sort(function (a, b) { + return a[key] > b[key]; + }); + } + } + + return results; + } + + var TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL + }; + var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; + /** + * @private + * Multi-user touch events input + * @constructor + * @extends Input + */ + + var TouchInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(TouchInput, _Input); + + function TouchInput() { + var _this; + + TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS; + + return _this; + } + + var _proto = TouchInput.prototype; + + _proto.handler = function handler(ev) { + var type = TOUCH_INPUT_MAP[ev.type]; + var touches = getTouches.call(this, ev, type); + + if (!touches) { + return; + } + + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + }; + + return TouchInput; + }(Input); + + function getTouches(ev, type) { + var allTouches = toArray(ev.touches); + var targetIds = this.targetIds; // when there is only one touch, the process can be simplified + + if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { + targetIds[allTouches[0].identifier] = true; + return [allTouches, allTouches]; + } + + var i; + var targetTouches; + var changedTouches = toArray(ev.changedTouches); + var changedTargetTouches = []; + var target = this.target; // get target touches from touches + + targetTouches = allTouches.filter(function (touch) { + return hasParent(touch.target, target); + }); // collect touches + + if (type === INPUT_START) { + i = 0; + + while (i < targetTouches.length) { + targetIds[targetTouches[i].identifier] = true; + i++; + } + } // filter changed touches to only contain touches that exist in the collected target ids + + + i = 0; + + while (i < changedTouches.length) { + if (targetIds[changedTouches[i].identifier]) { + changedTargetTouches.push(changedTouches[i]); + } // cleanup removed touches + + + if (type & (INPUT_END | INPUT_CANCEL)) { + delete targetIds[changedTouches[i].identifier]; + } + + i++; + } + + if (!changedTargetTouches.length) { + return; + } + + return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' + uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches]; + } + + var MOUSE_INPUT_MAP = { + mousedown: INPUT_START, + mousemove: INPUT_MOVE, + mouseup: INPUT_END + }; + var MOUSE_ELEMENT_EVENTS = 'mousedown'; + var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; + /** + * @private + * Mouse events input + * @constructor + * @extends Input + */ + + var MouseInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(MouseInput, _Input); + + function MouseInput() { + var _this; + + var proto = MouseInput.prototype; + proto.evEl = MOUSE_ELEMENT_EVENTS; + proto.evWin = MOUSE_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.pressed = false; // mousedown state + + return _this; + } + /** + * @private + * handle mouse events + * @param {Object} ev + */ + + + var _proto = MouseInput.prototype; + + _proto.handler = function handler(ev) { + var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down + + if (eventType & INPUT_START && ev.button === 0) { + this.pressed = true; + } + + if (eventType & INPUT_MOVE && ev.which !== 1) { + eventType = INPUT_END; + } // mouse must be down + + + if (!this.pressed) { + return; + } + + if (eventType & INPUT_END) { + this.pressed = false; + } + + this.callback(this.manager, eventType, { + pointers: [ev], + changedPointers: [ev], + pointerType: INPUT_TYPE_MOUSE, + srcEvent: ev + }); + }; + + return MouseInput; + }(Input); + + /** + * @private + * Combined touch and mouse input + * + * Touch has a higher priority then mouse, and while touching no mouse events are allowed. + * This because touch devices also emit mouse events while doing a touch. + * + * @constructor + * @extends Input + */ + + var DEDUP_TIMEOUT = 2500; + var DEDUP_DISTANCE = 25; + + function setLastTouch(eventData) { + var _eventData$changedPoi = eventData.changedPointers, + touch = _eventData$changedPoi[0]; + + if (touch.identifier === this.primaryTouch) { + var lastTouch = { + x: touch.clientX, + y: touch.clientY + }; + var lts = this.lastTouches; + this.lastTouches.push(lastTouch); + + var removeLastTouch = function removeLastTouch() { + var i = lts.indexOf(lastTouch); + + if (i > -1) { + lts.splice(i, 1); + } + }; + + setTimeout(removeLastTouch, DEDUP_TIMEOUT); + } + } + + function recordTouches(eventType, eventData) { + if (eventType & INPUT_START) { + this.primaryTouch = eventData.changedPointers[0].identifier; + setLastTouch.call(this, eventData); + } else if (eventType & (INPUT_END | INPUT_CANCEL)) { + setLastTouch.call(this, eventData); + } + } + + function isSyntheticEvent(eventData) { + var x = eventData.srcEvent.clientX; + var y = eventData.srcEvent.clientY; + + for (var i = 0; i < this.lastTouches.length; i++) { + var t = this.lastTouches[i]; + var dx = Math.abs(x - t.x); + var dy = Math.abs(y - t.y); + + if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { + return true; + } + } + + return false; + } + + var TouchMouseInput = + /*#__PURE__*/ + function () { + var TouchMouseInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(TouchMouseInput, _Input); + + function TouchMouseInput(_manager, callback) { + var _this; + + _this = _Input.call(this, _manager, callback) || this; + + _this.handler = function (manager, inputEvent, inputData) { + var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH; + var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE; + + if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { + return; + } // when we're in a touch event, record touches to de-dupe synthetic mouse event + + + if (isTouch) { + recordTouches.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputEvent, inputData); + } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized$1(_assertThisInitialized$1(_this)), inputData)) { + return; + } + + _this.callback(manager, inputEvent, inputData); + }; + + _this.touch = new TouchInput(_this.manager, _this.handler); + _this.mouse = new MouseInput(_this.manager, _this.handler); + _this.primaryTouch = null; + _this.lastTouches = []; + return _this; + } + /** + * @private + * handle mouse and touch events + * @param {Hammer} manager + * @param {String} inputEvent + * @param {Object} inputData + */ + + + var _proto = TouchMouseInput.prototype; + + /** + * @private + * remove the event listeners + */ + _proto.destroy = function destroy() { + this.touch.destroy(); + this.mouse.destroy(); + }; + + return TouchMouseInput; + }(Input); + + return TouchMouseInput; + }(); + + /** + * @private + * create new input type manager + * called by the Manager constructor + * @param {Hammer} manager + * @returns {Input} + */ + + function createInputInstance(manager) { + var Type; // let inputClass = manager.options.inputClass; + + var inputClass = manager.options.inputClass; + + if (inputClass) { + Type = inputClass; + } else if (SUPPORT_POINTER_EVENTS) { + Type = PointerEventInput; + } else if (SUPPORT_ONLY_TOUCH) { + Type = TouchInput; + } else if (!SUPPORT_TOUCH$1) { + Type = MouseInput; + } else { + Type = TouchMouseInput; + } + + return new Type(manager, inputHandler); + } + + /** + * @private + * if the argument is an array, we want to execute the fn on each entry + * if it aint an array we don't want to do a thing. + * this is used by all the methods that accept a single and array argument. + * @param {*|Array} arg + * @param {String} fn + * @param {Object} [context] + * @returns {Boolean} + */ + + function invokeArrayArg(arg, fn, context) { + if (Array.isArray(arg)) { + each(arg, context[fn], context); + return true; + } + + return false; + } + + var STATE_POSSIBLE = 1; + var STATE_BEGAN = 2; + var STATE_CHANGED = 4; + var STATE_ENDED = 8; + var STATE_RECOGNIZED = STATE_ENDED; + var STATE_CANCELLED = 16; + var STATE_FAILED = 32; + + /** + * @private + * get a unique id + * @returns {number} uniqueId + */ + var _uniqueId = 1; + function uniqueId() { + return _uniqueId++; + } + + /** + * @private + * get a recognizer by name if it is bound to a manager + * @param {Recognizer|String} otherRecognizer + * @param {Recognizer} recognizer + * @returns {Recognizer} + */ + function getRecognizerByNameIfManager(otherRecognizer, recognizer) { + var manager = recognizer.manager; + + if (manager) { + return manager.get(otherRecognizer); + } + + return otherRecognizer; + } + + /** + * @private + * get a usable string, used as event postfix + * @param {constant} state + * @returns {String} state + */ + + function stateStr(state) { + if (state & STATE_CANCELLED) { + return 'cancel'; + } else if (state & STATE_ENDED) { + return 'end'; + } else if (state & STATE_CHANGED) { + return 'move'; + } else if (state & STATE_BEGAN) { + return 'start'; + } + + return ''; + } + + /** + * @private + * Recognizer flow explained; * + * All recognizers have the initial state of POSSIBLE when a input session starts. + * The definition of a input session is from the first input until the last input, with all it's movement in it. * + * Example session for mouse-input: mousedown -> mousemove -> mouseup + * + * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed + * which determines with state it should be. + * + * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to + * POSSIBLE to give it another change on the next cycle. + * + * Possible + * | + * +-----+---------------+ + * | | + * +-----+-----+ | + * | | | + * Failed Cancelled | + * +-------+------+ + * | | + * Recognized Began + * | + * Changed + * | + * Ended/Recognized + */ + + /** + * @private + * Recognizer + * Every recognizer needs to extend from this class. + * @constructor + * @param {Object} options + */ + + var Recognizer = + /*#__PURE__*/ + function () { + function Recognizer(options) { + if (options === void 0) { + options = {}; + } + + this.options = _extends$1({ + enable: true + }, options); + this.id = uniqueId(); + this.manager = null; // default is enable true + + this.state = STATE_POSSIBLE; + this.simultaneous = {}; + this.requireFail = []; + } + /** + * @private + * set options + * @param {Object} options + * @return {Recognizer} + */ + + + var _proto = Recognizer.prototype; + + _proto.set = function set(options) { + assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state + + this.manager && this.manager.touchAction.update(); + return this; + }; + /** + * @private + * recognize simultaneous with an other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.recognizeWith = function recognizeWith(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { + return this; + } + + var simultaneous = this.simultaneous; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + + if (!simultaneous[otherRecognizer.id]) { + simultaneous[otherRecognizer.id] = otherRecognizer; + otherRecognizer.recognizeWith(this); + } + + return this; + }; + /** + * @private + * drop the simultaneous link. it doesnt remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { + return this; + } + + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + delete this.simultaneous[otherRecognizer.id]; + return this; + }; + /** + * @private + * recognizer can only run when an other is failing + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.requireFailure = function requireFailure(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { + return this; + } + + var requireFail = this.requireFail; + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + + if (inArray(requireFail, otherRecognizer) === -1) { + requireFail.push(otherRecognizer); + otherRecognizer.requireFailure(this); + } + + return this; + }; + /** + * @private + * drop the requireFailure link. it does not remove the link on the other recognizer. + * @param {Recognizer} otherRecognizer + * @returns {Recognizer} this + */ + + + _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) { + if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { + return this; + } + + otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); + var index = inArray(this.requireFail, otherRecognizer); + + if (index > -1) { + this.requireFail.splice(index, 1); + } + + return this; + }; + /** + * @private + * has require failures boolean + * @returns {boolean} + */ + + + _proto.hasRequireFailures = function hasRequireFailures() { + return this.requireFail.length > 0; + }; + /** + * @private + * if the recognizer can recognize simultaneous with an other recognizer + * @param {Recognizer} otherRecognizer + * @returns {Boolean} + */ + + + _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) { + return !!this.simultaneous[otherRecognizer.id]; + }; + /** + * @private + * You should use `tryEmit` instead of `emit` directly to check + * that all the needed recognizers has failed before emitting. + * @param {Object} input + */ + + + _proto.emit = function emit(input) { + var self = this; + var state = this.state; + + function emit(event) { + self.manager.emit(event, input); + } // 'panstart' and 'panmove' + + + if (state < STATE_ENDED) { + emit(self.options.event + stateStr(state)); + } + + emit(self.options.event); // simple 'eventName' events + + if (input.additionalEvent) { + // additional event(panleft, panright, pinchin, pinchout...) + emit(input.additionalEvent); + } // panend and pancancel + + + if (state >= STATE_ENDED) { + emit(self.options.event + stateStr(state)); + } + }; + /** + * @private + * Check that all the require failure recognizers has failed, + * if true, it emits a gesture event, + * otherwise, setup the state to FAILED. + * @param {Object} input + */ + + + _proto.tryEmit = function tryEmit(input) { + if (this.canEmit()) { + return this.emit(input); + } // it's failing anyway + + + this.state = STATE_FAILED; + }; + /** + * @private + * can we emit? + * @returns {boolean} + */ + + + _proto.canEmit = function canEmit() { + var i = 0; + + while (i < this.requireFail.length) { + if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { + return false; + } + + i++; + } + + return true; + }; + /** + * @private + * update the recognizer + * @param {Object} inputData + */ + + + _proto.recognize = function recognize(inputData) { + // make a new copy of the inputData + // so we can change the inputData without messing up the other recognizers + var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing? + + if (!boolOrFn(this.options.enable, [this, inputDataClone])) { + this.reset(); + this.state = STATE_FAILED; + return; + } // reset when we've reached the end + + + if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { + this.state = STATE_POSSIBLE; + } + + this.state = this.process(inputDataClone); // the recognizer has recognized a gesture + // so trigger an event + + if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { + this.tryEmit(inputDataClone); + } + }; + /** + * @private + * return the state of the recognizer + * the actual recognizing happens in this method + * @virtual + * @param {Object} inputData + * @returns {constant} STATE + */ + + /* jshint ignore:start */ + + + _proto.process = function process(inputData) {}; + /* jshint ignore:end */ + + /** + * @private + * return the preferred touch-action + * @virtual + * @returns {Array} + */ + + + _proto.getTouchAction = function getTouchAction() {}; + /** + * @private + * called when the gesture isn't allowed to recognize + * like when another is being recognized or it is disabled + * @virtual + */ + + + _proto.reset = function reset() {}; + + return Recognizer; + }(); + + /** + * @private + * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur + * between the given interval and position. The delay option can be used to recognize multi-taps without firing + * a single tap. + * + * The eventData from the emitted event contains the property `tapCount`, which contains the amount of + * multi-taps being recognized. + * @constructor + * @extends Recognizer + */ + + var TapRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(TapRecognizer, _Recognizer); + + function TapRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Recognizer.call(this, _extends$1({ + event: 'tap', + pointers: 1, + taps: 1, + interval: 300, + // max time between the multi-tap taps + time: 250, + // max time of the pointer to be down (like finger on the screen) + threshold: 9, + // a minimal movement is ok, but keep it low + posThreshold: 10 + }, options)) || this; // previous time and center, + // used for tap counting + + _this.pTime = false; + _this.pCenter = false; + _this._timer = null; + _this._input = null; + _this.count = 0; + return _this; + } + + var _proto = TapRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_MANIPULATION]; + }; + + _proto.process = function process(input) { + var _this2 = this; + + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTouchTime = input.deltaTime < options.time; + this.reset(); + + if (input.eventType & INPUT_START && this.count === 0) { + return this.failTimeout(); + } // we only allow little movement + // and we've reached an end event, so a tap is possible + + + if (validMovement && validTouchTime && validPointers) { + if (input.eventType !== INPUT_END) { + return this.failTimeout(); + } + + var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true; + var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; + this.pTime = input.timeStamp; + this.pCenter = input.center; + + if (!validMultiTap || !validInterval) { + this.count = 1; + } else { + this.count += 1; + } + + this._input = input; // if tap count matches we have recognized it, + // else it has began recognizing... + + var tapCount = this.count % options.taps; + + if (tapCount === 0) { + // no failing requirements, immediately trigger the tap event + // or wait as long as the multitap interval to trigger + if (!this.hasRequireFailures()) { + return STATE_RECOGNIZED; + } else { + this._timer = setTimeout(function () { + _this2.state = STATE_RECOGNIZED; + + _this2.tryEmit(); + }, options.interval); + return STATE_BEGAN; + } + } + } + + return STATE_FAILED; + }; + + _proto.failTimeout = function failTimeout() { + var _this3 = this; + + this._timer = setTimeout(function () { + _this3.state = STATE_FAILED; + }, this.options.interval); + return STATE_FAILED; + }; + + _proto.reset = function reset() { + clearTimeout(this._timer); + }; + + _proto.emit = function emit() { + if (this.state === STATE_RECOGNIZED) { + this._input.tapCount = this.count; + this.manager.emit(this.options.event, this._input); + } + }; + + return TapRecognizer; + }(Recognizer); + + /** + * @private + * This recognizer is just used as a base for the simple attribute recognizers. + * @constructor + * @extends Recognizer + */ + + var AttrRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(AttrRecognizer, _Recognizer); + + function AttrRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _Recognizer.call(this, _extends$1({ + pointers: 1 + }, options)) || this; + } + /** + * @private + * Used to check if it the recognizer receives valid input, like input.distance > 10. + * @memberof AttrRecognizer + * @param {Object} input + * @returns {Boolean} recognized + */ + + + var _proto = AttrRecognizer.prototype; + + _proto.attrTest = function attrTest(input) { + var optionPointers = this.options.pointers; + return optionPointers === 0 || input.pointers.length === optionPointers; + }; + /** + * @private + * Process the input and return the state for the recognizer + * @memberof AttrRecognizer + * @param {Object} input + * @returns {*} State + */ + + + _proto.process = function process(input) { + var state = this.state; + var eventType = input.eventType; + var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); + var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED + + if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { + return state | STATE_CANCELLED; + } else if (isRecognized || isValid) { + if (eventType & INPUT_END) { + return state | STATE_ENDED; + } else if (!(state & STATE_BEGAN)) { + return STATE_BEGAN; + } + + return state | STATE_CHANGED; + } + + return STATE_FAILED; + }; + + return AttrRecognizer; + }(Recognizer); + + /** + * @private + * direction cons to string + * @param {constant} direction + * @returns {String} + */ + + function directionStr(direction) { + if (direction === DIRECTION_DOWN) { + return 'down'; + } else if (direction === DIRECTION_UP) { + return 'up'; + } else if (direction === DIRECTION_LEFT) { + return 'left'; + } else if (direction === DIRECTION_RIGHT) { + return 'right'; + } + + return ''; + } + + /** + * @private + * Pan + * Recognized when the pointer is down and moved in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ + + var PanRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(PanRecognizer, _AttrRecognizer); + + function PanRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _AttrRecognizer.call(this, _extends$1({ + event: 'pan', + threshold: 10, + pointers: 1, + direction: DIRECTION_ALL + }, options)) || this; + _this.pX = null; + _this.pY = null; + return _this; + } + + var _proto = PanRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + var direction = this.options.direction; + var actions = []; + + if (direction & DIRECTION_HORIZONTAL) { + actions.push(TOUCH_ACTION_PAN_Y); + } + + if (direction & DIRECTION_VERTICAL) { + actions.push(TOUCH_ACTION_PAN_X); + } + + return actions; + }; + + _proto.directionTest = function directionTest(input) { + var options = this.options; + var hasMoved = true; + var distance = input.distance; + var direction = input.direction; + var x = input.deltaX; + var y = input.deltaY; // lock to axis? + + if (!(direction & options.direction)) { + if (options.direction & DIRECTION_HORIZONTAL) { + direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; + hasMoved = x !== this.pX; + distance = Math.abs(input.deltaX); + } else { + direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN; + hasMoved = y !== this.pY; + distance = Math.abs(input.deltaY); + } + } + + input.direction = direction; + return hasMoved && distance > options.threshold && direction & options.direction; + }; + + _proto.attrTest = function attrTest(input) { + return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call + this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input)); + }; + + _proto.emit = function emit(input) { + this.pX = input.deltaX; + this.pY = input.deltaY; + var direction = directionStr(input.direction); + + if (direction) { + input.additionalEvent = this.options.event + direction; + } + + _AttrRecognizer.prototype.emit.call(this, input); + }; + + return PanRecognizer; + }(AttrRecognizer); + + /** + * @private + * Swipe + * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. + * @constructor + * @extends AttrRecognizer + */ + + var SwipeRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(SwipeRecognizer, _AttrRecognizer); + + function SwipeRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'swipe', + threshold: 10, + velocity: 0.3, + direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, + pointers: 1 + }, options)) || this; + } + + var _proto = SwipeRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return PanRecognizer.prototype.getTouchAction.call(this); + }; + + _proto.attrTest = function attrTest(input) { + var direction = this.options.direction; + var velocity; + + if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { + velocity = input.overallVelocity; + } else if (direction & DIRECTION_HORIZONTAL) { + velocity = input.overallVelocityX; + } else if (direction & DIRECTION_VERTICAL) { + velocity = input.overallVelocityY; + } + + return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END; + }; + + _proto.emit = function emit(input) { + var direction = directionStr(input.offsetDirection); + + if (direction) { + this.manager.emit(this.options.event + direction, input); + } + + this.manager.emit(this.options.event, input); + }; + + return SwipeRecognizer; + }(AttrRecognizer); + + /** + * @private + * Pinch + * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). + * @constructor + * @extends AttrRecognizer + */ + + var PinchRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(PinchRecognizer, _AttrRecognizer); + + function PinchRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'pinch', + threshold: 0, + pointers: 2 + }, options)) || this; + } + + var _proto = PinchRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_NONE]; + }; + + _proto.attrTest = function attrTest(input) { + return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); + }; + + _proto.emit = function emit(input) { + if (input.scale !== 1) { + var inOut = input.scale < 1 ? 'in' : 'out'; + input.additionalEvent = this.options.event + inOut; + } + + _AttrRecognizer.prototype.emit.call(this, input); + }; + + return PinchRecognizer; + }(AttrRecognizer); + + /** + * @private + * Rotate + * Recognized when two or more pointer are moving in a circular motion. + * @constructor + * @extends AttrRecognizer + */ + + var RotateRecognizer = + /*#__PURE__*/ + function (_AttrRecognizer) { + _inheritsLoose$1(RotateRecognizer, _AttrRecognizer); + + function RotateRecognizer(options) { + if (options === void 0) { + options = {}; + } + + return _AttrRecognizer.call(this, _extends$1({ + event: 'rotate', + threshold: 0, + pointers: 2 + }, options)) || this; + } + + var _proto = RotateRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_NONE]; + }; + + _proto.attrTest = function attrTest(input) { + return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); + }; + + return RotateRecognizer; + }(AttrRecognizer); + + /** + * @private + * Press + * Recognized when the pointer is down for x ms without any movement. + * @constructor + * @extends Recognizer + */ + + var PressRecognizer = + /*#__PURE__*/ + function (_Recognizer) { + _inheritsLoose$1(PressRecognizer, _Recognizer); + + function PressRecognizer(options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Recognizer.call(this, _extends$1({ + event: 'press', + pointers: 1, + time: 251, + // minimal time of the pointer to be pressed + threshold: 9 + }, options)) || this; + _this._timer = null; + _this._input = null; + return _this; + } + + var _proto = PressRecognizer.prototype; + + _proto.getTouchAction = function getTouchAction() { + return [TOUCH_ACTION_AUTO]; + }; + + _proto.process = function process(input) { + var _this2 = this; + + var options = this.options; + var validPointers = input.pointers.length === options.pointers; + var validMovement = input.distance < options.threshold; + var validTime = input.deltaTime > options.time; + this._input = input; // we only allow little movement + // and we've reached an end event, so a tap is possible + + if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) { + this.reset(); + } else if (input.eventType & INPUT_START) { + this.reset(); + this._timer = setTimeout(function () { + _this2.state = STATE_RECOGNIZED; + + _this2.tryEmit(); + }, options.time); + } else if (input.eventType & INPUT_END) { + return STATE_RECOGNIZED; + } + + return STATE_FAILED; + }; + + _proto.reset = function reset() { + clearTimeout(this._timer); + }; + + _proto.emit = function emit(input) { + if (this.state !== STATE_RECOGNIZED) { + return; + } + + if (input && input.eventType & INPUT_END) { + this.manager.emit(this.options.event + "up", input); + } else { + this._input.timeStamp = now(); + this.manager.emit(this.options.event, this._input); + } + }; + + return PressRecognizer; + }(Recognizer); + + var defaults = { + /** + * @private + * set if DOM events are being triggered. + * But this is slower and unused by simple implementations, so disabled by default. + * @type {Boolean} + * @default false + */ + domEvents: false, + + /** + * @private + * The value for the touchAction property/fallback. + * When set to `compute` it will magically set the correct value based on the added recognizers. + * @type {String} + * @default compute + */ + touchAction: TOUCH_ACTION_COMPUTE, + + /** + * @private + * @type {Boolean} + * @default true + */ + enable: true, + + /** + * @private + * EXPERIMENTAL FEATURE -- can be removed/changed + * Change the parent input target element. + * If Null, then it is being set the to main element. + * @type {Null|EventTarget} + * @default null + */ + inputTarget: null, + + /** + * @private + * force an input class + * @type {Null|Function} + * @default null + */ + inputClass: null, + + /** + * @private + * Some CSS properties can be used to improve the working of Hammer. + * Add them to this method and they will be set when creating a new Manager. + * @namespace + */ + cssProps: { + /** + * @private + * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userSelect: "none", + + /** + * @private + * Disable the Windows Phone grippers when pressing an element. + * @type {String} + * @default 'none' + */ + touchSelect: "none", + + /** + * @private + * Disables the default callout shown when you touch and hold a touch target. + * On iOS, when you touch and hold a touch target such as a link, Safari displays + * a callout containing information about the link. This property allows you to disable that callout. + * @type {String} + * @default 'none' + */ + touchCallout: "none", + + /** + * @private + * Specifies whether zooming is enabled. Used by IE10> + * @type {String} + * @default 'none' + */ + contentZooming: "none", + + /** + * @private + * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. + * @type {String} + * @default 'none' + */ + userDrag: "none", + + /** + * @private + * Overrides the highlight color shown when the user taps a link or a JavaScript + * clickable element in iOS. This property obeys the alpha value, if specified. + * @type {String} + * @default 'rgba(0,0,0,0)' + */ + tapHighlightColor: "rgba(0,0,0,0)" + } + }; + /** + * @private + * Default recognizer setup when calling `Hammer()` + * When creating a new Manager these will be skipped. + * This is separated with other defaults because of tree-shaking. + * @type {Array} + */ + + var preset = [[RotateRecognizer, { + enable: false + }], [PinchRecognizer, { + enable: false + }, ['rotate']], [SwipeRecognizer, { + direction: DIRECTION_HORIZONTAL + }], [PanRecognizer, { + direction: DIRECTION_HORIZONTAL + }, ['swipe']], [TapRecognizer], [TapRecognizer, { + event: 'doubletap', + taps: 2 + }, ['tap']], [PressRecognizer]]; + + var STOP = 1; + var FORCED_STOP = 2; + /** + * @private + * add/remove the css properties as defined in manager.options.cssProps + * @param {Manager} manager + * @param {Boolean} add + */ + + function toggleCssProps(manager, add) { + var element = manager.element; + + if (!element.style) { + return; + } + + var prop; + each(manager.options.cssProps, function (value, name) { + prop = prefixed(element.style, name); + + if (add) { + manager.oldCssProps[prop] = element.style[prop]; + element.style[prop] = value; + } else { + element.style[prop] = manager.oldCssProps[prop] || ""; + } + }); + + if (!add) { + manager.oldCssProps = {}; + } + } + /** + * @private + * trigger dom event + * @param {String} event + * @param {Object} data + */ + + + function triggerDomEvent(event, data) { + var gestureEvent = document.createEvent("Event"); + gestureEvent.initEvent(event, true, true); + gestureEvent.gesture = data; + data.target.dispatchEvent(gestureEvent); + } + /** + * @private + * Manager + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ + + + var Manager = + /*#__PURE__*/ + function () { + function Manager(element, options) { + var _this = this; + + this.options = assign$1({}, defaults, options || {}); + this.options.inputTarget = this.options.inputTarget || element; + this.handlers = {}; + this.session = {}; + this.recognizers = []; + this.oldCssProps = {}; + this.element = element; + this.input = createInputInstance(this); + this.touchAction = new TouchAction(this, this.options.touchAction); + toggleCssProps(this, true); + each(this.options.recognizers, function (item) { + var recognizer = _this.add(new item[0](item[1])); + + item[2] && recognizer.recognizeWith(item[2]); + item[3] && recognizer.requireFailure(item[3]); + }, this); + } + /** + * @private + * set options + * @param {Object} options + * @returns {Manager} + */ + + + var _proto = Manager.prototype; + + _proto.set = function set(options) { + assign$1(this.options, options); // Options that need a little more setup + + if (options.touchAction) { + this.touchAction.update(); + } + + if (options.inputTarget) { + // Clean up existing event listeners and reinitialize + this.input.destroy(); + this.input.target = options.inputTarget; + this.input.init(); + } + + return this; + }; + /** + * @private + * stop recognizing for this session. + * This session will be discarded, when a new [input]start event is fired. + * When forced, the recognizer cycle is stopped immediately. + * @param {Boolean} [force] + */ + + + _proto.stop = function stop(force) { + this.session.stopped = force ? FORCED_STOP : STOP; + }; + /** + * @private + * run the recognizers! + * called by the inputHandler function on every movement of the pointers (touches) + * it walks through all the recognizers and tries to detect the gesture that is being made + * @param {Object} inputData + */ + + + _proto.recognize = function recognize(inputData) { + var session = this.session; + + if (session.stopped) { + return; + } // run the touch-action polyfill + + + this.touchAction.preventDefaults(inputData); + var recognizer; + var recognizers = this.recognizers; // this holds the recognizer that is being recognized. + // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED + // if no recognizer is detecting a thing, it is set to `null` + + var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized + // or when we're in a new session + + if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) { + session.curRecognizer = null; + curRecognizer = null; + } + + var i = 0; + + while (i < recognizers.length) { + recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one. + // 1. allow if the session is NOT forced stopped (see the .stop() method) + // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one + // that is being recognized. + // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. + // this can be setup with the `recognizeWith()` method on the recognizer. + + if (session.stopped !== FORCED_STOP && ( // 1 + !curRecognizer || recognizer === curRecognizer || // 2 + recognizer.canRecognizeWith(curRecognizer))) { + // 3 + recognizer.recognize(inputData); + } else { + recognizer.reset(); + } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the + // current active recognizer. but only if we don't already have an active recognizer + + + if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { + session.curRecognizer = recognizer; + curRecognizer = recognizer; + } + + i++; + } + }; + /** + * @private + * get a recognizer by its event name. + * @param {Recognizer|String} recognizer + * @returns {Recognizer|Null} + */ + + + _proto.get = function get(recognizer) { + if (recognizer instanceof Recognizer) { + return recognizer; + } + + var recognizers = this.recognizers; + + for (var i = 0; i < recognizers.length; i++) { + if (recognizers[i].options.event === recognizer) { + return recognizers[i]; + } + } + + return null; + }; + /** + * @private add a recognizer to the manager + * existing recognizers with the same event name will be removed + * @param {Recognizer} recognizer + * @returns {Recognizer|Manager} + */ + + + _proto.add = function add(recognizer) { + if (invokeArrayArg(recognizer, "add", this)) { + return this; + } // remove existing + + + var existing = this.get(recognizer.options.event); + + if (existing) { + this.remove(existing); + } + + this.recognizers.push(recognizer); + recognizer.manager = this; + this.touchAction.update(); + return recognizer; + }; + /** + * @private + * remove a recognizer by name or instance + * @param {Recognizer|String} recognizer + * @returns {Manager} + */ + + + _proto.remove = function remove(recognizer) { + if (invokeArrayArg(recognizer, "remove", this)) { + return this; + } + + var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists + + if (recognizer) { + var recognizers = this.recognizers; + var index = inArray(recognizers, targetRecognizer); + + if (index !== -1) { + recognizers.splice(index, 1); + this.touchAction.update(); + } + } + + return this; + }; + /** + * @private + * bind event + * @param {String} events + * @param {Function} handler + * @returns {EventEmitter} this + */ + + + _proto.on = function on(events, handler) { + if (events === undefined || handler === undefined) { + return this; + } + + var handlers = this.handlers; + each(splitStr(events), function (event) { + handlers[event] = handlers[event] || []; + handlers[event].push(handler); + }); + return this; + }; + /** + * @private unbind event, leave emit blank to remove all handlers + * @param {String} events + * @param {Function} [handler] + * @returns {EventEmitter} this + */ + + + _proto.off = function off(events, handler) { + if (events === undefined) { + return this; + } + + var handlers = this.handlers; + each(splitStr(events), function (event) { + if (!handler) { + delete handlers[event]; + } else { + handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); + } + }); + return this; + }; + /** + * @private emit event to the listeners + * @param {String} event + * @param {Object} data + */ + + + _proto.emit = function emit(event, data) { + // we also want to trigger dom events + if (this.options.domEvents) { + triggerDomEvent(event, data); + } // no handlers, so skip it all + + + var handlers = this.handlers[event] && this.handlers[event].slice(); + + if (!handlers || !handlers.length) { + return; + } + + data.type = event; + + data.preventDefault = function () { + data.srcEvent.preventDefault(); + }; + + var i = 0; + + while (i < handlers.length) { + handlers[i](data); + i++; + } + }; + /** + * @private + * destroy the manager and unbinds all events + * it doesn't unbind dom events, that is the user own responsibility + */ + + + _proto.destroy = function destroy() { + this.element && toggleCssProps(this, false); + this.handlers = {}; + this.session = {}; + this.input.destroy(); + this.element = null; + }; + + return Manager; + }(); + + var SINGLE_TOUCH_INPUT_MAP = { + touchstart: INPUT_START, + touchmove: INPUT_MOVE, + touchend: INPUT_END, + touchcancel: INPUT_CANCEL + }; + var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; + var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; + /** + * @private + * Touch events input + * @constructor + * @extends Input + */ + + var SingleTouchInput = + /*#__PURE__*/ + function (_Input) { + _inheritsLoose$1(SingleTouchInput, _Input); + + function SingleTouchInput() { + var _this; + + var proto = SingleTouchInput.prototype; + proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS; + proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS; + _this = _Input.apply(this, arguments) || this; + _this.started = false; + return _this; + } + + var _proto = SingleTouchInput.prototype; + + _proto.handler = function handler(ev) { + var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events? + + if (type === INPUT_START) { + this.started = true; + } + + if (!this.started) { + return; + } + + var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state + + if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { + this.started = false; + } + + this.callback(this.manager, type, { + pointers: touches[0], + changedPointers: touches[1], + pointerType: INPUT_TYPE_TOUCH, + srcEvent: ev + }); + }; + + return SingleTouchInput; + }(Input); + + function normalizeSingleTouches(ev, type) { + var all = toArray(ev.touches); + var changed = toArray(ev.changedTouches); + + if (type & (INPUT_END | INPUT_CANCEL)) { + all = uniqueArray(all.concat(changed), 'identifier', true); + } + + return [all, changed]; + } + + /** + * @private + * wrap a method with a deprecation warning and stack trace + * @param {Function} method + * @param {String} name + * @param {String} message + * @returns {Function} A new function wrapping the supplied method. + */ + function deprecate(method, name, message) { + var deprecationMessage = "DEPRECATED METHOD: " + name + "\n" + message + " AT \n"; + return function () { + var e = new Error('get-stack-trace'); + var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '').replace(/^\s+at\s+/gm, '').replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; + var log = window.console && (window.console.warn || window.console.log); + + if (log) { + log.call(window.console, deprecationMessage, stack); + } + + return method.apply(this, arguments); + }; + } + + /** + * @private + * extend object. + * means that properties in dest will be overwritten by the ones in src. + * @param {Object} dest + * @param {Object} src + * @param {Boolean} [merge=false] + * @returns {Object} dest + */ + + var extend = deprecate(function (dest, src, merge) { + var keys = Object.keys(src); + var i = 0; + + while (i < keys.length) { + if (!merge || merge && dest[keys[i]] === undefined) { + dest[keys[i]] = src[keys[i]]; + } + + i++; + } + + return dest; + }, 'extend', 'Use `assign`.'); + + /** + * @private + * merge the values from src in the dest. + * means that properties that exist in dest will not be overwritten by src + * @param {Object} dest + * @param {Object} src + * @returns {Object} dest + */ + + var merge = deprecate(function (dest, src) { + return extend(dest, src, true); + }, 'merge', 'Use `assign`.'); + + /** + * @private + * simple class inheritance + * @param {Function} child + * @param {Function} base + * @param {Object} [properties] + */ + + function inherit(child, base, properties) { + var baseP = base.prototype; + var childP; + childP = child.prototype = Object.create(baseP); + childP.constructor = child; + childP._super = baseP; + + if (properties) { + assign$1(childP, properties); + } + } + + /** + * @private + * simple function bind + * @param {Function} fn + * @param {Object} context + * @returns {Function} + */ + function bindFn(fn, context) { + return function boundFn() { + return fn.apply(context, arguments); + }; + } + + /** + * @private + * Simple way to create a manager with a default set of recognizers. + * @param {HTMLElement} element + * @param {Object} [options] + * @constructor + */ + + var Hammer = + /*#__PURE__*/ + function () { + var Hammer = + /** + * @private + * @const {string} + */ + function Hammer(element, options) { + if (options === void 0) { + options = {}; + } + + return new Manager(element, _extends$1({ + recognizers: preset.concat() + }, options)); + }; + + Hammer.VERSION = "2.0.17-rc"; + Hammer.DIRECTION_ALL = DIRECTION_ALL; + Hammer.DIRECTION_DOWN = DIRECTION_DOWN; + Hammer.DIRECTION_LEFT = DIRECTION_LEFT; + Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT; + Hammer.DIRECTION_UP = DIRECTION_UP; + Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + Hammer.DIRECTION_NONE = DIRECTION_NONE; + Hammer.DIRECTION_DOWN = DIRECTION_DOWN; + Hammer.INPUT_START = INPUT_START; + Hammer.INPUT_MOVE = INPUT_MOVE; + Hammer.INPUT_END = INPUT_END; + Hammer.INPUT_CANCEL = INPUT_CANCEL; + Hammer.STATE_POSSIBLE = STATE_POSSIBLE; + Hammer.STATE_BEGAN = STATE_BEGAN; + Hammer.STATE_CHANGED = STATE_CHANGED; + Hammer.STATE_ENDED = STATE_ENDED; + Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED; + Hammer.STATE_CANCELLED = STATE_CANCELLED; + Hammer.STATE_FAILED = STATE_FAILED; + Hammer.Manager = Manager; + Hammer.Input = Input; + Hammer.TouchAction = TouchAction; + Hammer.TouchInput = TouchInput; + Hammer.MouseInput = MouseInput; + Hammer.PointerEventInput = PointerEventInput; + Hammer.TouchMouseInput = TouchMouseInput; + Hammer.SingleTouchInput = SingleTouchInput; + Hammer.Recognizer = Recognizer; + Hammer.AttrRecognizer = AttrRecognizer; + Hammer.Tap = TapRecognizer; + Hammer.Pan = PanRecognizer; + Hammer.Swipe = SwipeRecognizer; + Hammer.Pinch = PinchRecognizer; + Hammer.Rotate = RotateRecognizer; + Hammer.Press = PressRecognizer; + Hammer.on = addEventListeners; + Hammer.off = removeEventListeners; + Hammer.each = each; + Hammer.merge = merge; + Hammer.extend = extend; + Hammer.bindFn = bindFn; + Hammer.assign = assign$1; + Hammer.inherit = inherit; + Hammer.bindFn = bindFn; + Hammer.prefixed = prefixed; + Hammer.toArray = toArray; + Hammer.inArray = inArray; + Hammer.uniqueArray = uniqueArray; + Hammer.splitStr = splitStr; + Hammer.boolOrFn = boolOrFn; + Hammer.hasParent = hasParent; + Hammer.addEventListeners = addEventListeners; + Hammer.removeEventListeners = removeEventListeners; + Hammer.defaults = assign$1({}, defaults, { + preset: preset + }); + return Hammer; + }(); + + /* + 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$1(arr, callback) { + var length = arr.length; + + for (var i = 0; i < length; ++i) { + if (callback(arr[i], i)) { + return true; + } + } + + return false; + } + function find$1(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$1(agent) { + var userAgent = agent; + + if (typeof userAgent === "undefined") { + if (typeof navigator === "undefined" || !navigator) { + return ""; + } + + userAgent = navigator.userAgent || ""; + } + + return userAgent.toLowerCase(); + } + function execRegExp$1(pattern, text) { + try { + return new RegExp(pattern, "g").exec(text); + } catch (e) { + return null; + } + } + function hasUserAgentData$1() { + 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$1(versionTest, userAgent) { + var result = execRegExp$1("(" + versionTest + ")((?:\\/|\\s|:)([0-9|\\.|_]+))?", userAgent); + return result ? result[3] : ""; + } + function convertVersion$1(text) { + return text.replace(/_/g, "."); + } + function findPreset$1(presets, userAgent) { + var userPreset = null; + var version = "-1"; + some$1(presets, function (preset) { + var result = execRegExp$1("(" + 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$1(preset.versionTest.toLowerCase(), userAgent) || version; + } + + version = convertVersion$1(version); + return true; + }); + return { + preset: userPreset, + version: version + }; + } + function findBrand$1(brands, preset) { + return find$1(brands, function (_a) { + var brand = _a.brand; + return execRegExp$1("" + preset.test, brand.toLowerCase()); + }); + } + + var BROWSER_PRESETS$1 = [{ + 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$1 = [{ + 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$1 = [{ + test: "applewebkit", + id: "webkit" + }]; + var WEBVIEW_PRESETS$1 = [{ + test: "(?=(iphone|ipad))(?!(.*version))", + id: "webview" + }, { + test: "(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))", + id: "webview" + }, { + // test webview + test: "webview", + id: "webview" + }]; + var OS_PRESETS$1 = [{ + 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$1(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$1(WEBVIEW_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }), + chromium: some$1(CHROMIUM_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }) + }; + var os = { + name: "unknown", + version: "-1", + majorVersion: -1 + }; + browser.webkit = !browser.chromium && some$1(WEBKIT_PRESETS$1, function (preset) { + return findBrand$1(brands, preset); + }); + + if (osData) { + var platform_1 = osData.platform.toLowerCase(); + var result = find$1(OS_PRESETS$1, function (preset) { + return new RegExp("" + preset.test, "g").exec(platform_1); + }); + os.name = result ? result.id : platform_1; + os.version = osData.platformVersion; + } + + some$1(BROWSER_PRESETS$1, function (preset) { + var result = findBrand$1(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$1(os.version); + browser.version = convertVersion$1(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$1(userAgent) { + var nextAgent = getUserAgent$1(userAgent); + var isMobile = !!/mobi/g.exec(nextAgent); + var browser = { + name: "unknown", + version: "-1", + majorVersion: -1, + webview: !!findPreset$1(WEBVIEW_PRESETS$1, nextAgent).preset, + chromium: !!findPreset$1(CHROMIUM_PRESETS$1, nextAgent).preset, + webkit: false + }; + var os = { + name: "unknown", + version: "-1", + majorVersion: -1 + }; + + var _a = findPreset$1(BROWSER_PRESETS$1, nextAgent), + browserPreset = _a.preset, + browserVersion = _a.version; + + var _b = findPreset$1(OS_PRESETS$1, nextAgent), + osPreset = _b.preset, + osVersion = _b.version; + + browser.webkit = !browser.chromium && !!findPreset$1(WEBKIT_PRESETS$1, 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$2(userAgent) { + if (typeof userAgent === "undefined" && hasUserAgentData$1()) { + return parseUserAgentData$1(); + } else { + return parseUserAgent$1(userAgent); + } + } + + /* + Copyright (c) 2017 NAVER Corp. + @egjs/axes project is licensed under the MIT license + + @egjs/axes JavaScript library + https://github.com/naver/egjs-axes + + @version 2.7.1 + */ + + /*! ***************************************************************************** + 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); + }; + + function getInsidePosition(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 + + function isOutside(pos, range) { + return pos < range[0] || pos > range[1]; + } + function getDuration(distance, deceleration) { + var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero + + return duration < 100 ? 0 : duration; + } + function isCircularable(destPos, range, circular) { + return circular[1] && destPos > range[1] || circular[0] && destPos < range[0]; + } + function getCirculatedPos(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; + } + + /* eslint-disable no-new-func, no-nested-ternary */ + var win$2; + + if (typeof window === "undefined") { + // window is undefined in node.js + win$2 = { + navigator: { + userAgent: "" + } + }; + } else { + win$2 = window; + } + + function toArray$1(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; + } + 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$1(dummy.childNodes); + } else { + // Selector + el = toArray$1(document.querySelectorAll(param)); + } + + if (!multi) { + el = el.length >= 1 ? el[0] : undefined; + } + } else if (param === win$2) { + // window + el = param; + } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) { + // HTMLElement, Document + el = param; + } else if ("jQuery" in win$2 && 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$2.requestAnimationFrame || win$2.webkitRequestAnimationFrame; + var caf = win$2.cancelAnimationFrame || win$2.webkitCancelAnimationFrame; + + if (raf && !caf) { + var keyInfo_1 = {}; + var oldraf_1 = raf; + + raf = function (callback) { + function wrapCallback(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$2.setTimeout(function () { + callback(win$2.performance && win$2.performance.now && win$2.performance.now() || new Date().getTime()); + }, 16); + }; + + caf = win$2.clearTimeout; + } + /** + * A polyfill for the window.requestAnimationFrame() method. + * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame + * @private + */ + + + function requestAnimationFrame(fp) { + return raf(fp); + } + /** + * A polyfill for the window.cancelAnimationFrame() method. It cancels an animation executed through a call to the requestAnimationFrame() method. + * @param {Number} key − The ID value returned through a call to the requestAnimationFrame() method. requestAnimationFrame() 메서드가 반환한 아이디 값 + * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/cancelAnimationFrame + * @private + */ + + function cancelAnimationFrame(key) { + caf(key); + } + function map(obj, callback) { + var tranformed = {}; + + for (var k in obj) { + k && (tranformed[k] = callback(obj[k], k)); + } + + return tranformed; + } + function filter(obj, callback) { + var filtered = {}; + + for (var k in obj) { + k && callback(obj[k], k) && (filtered[k] = obj[k]); + } + + return filtered; + } + function every(obj, callback) { + for (var k in obj) { + if (k && !callback(obj[k], k)) { + return false; + } + } + + return true; + } + function equal(target, base) { + return every(target, function (v, k) { + return v === base[k]; + }); + } + var roundNumFunc = {}; + function roundNumber(num, roundUnit) { + // Cache for performance + if (!roundNumFunc[roundUnit]) { + roundNumFunc[roundUnit] = getRoundFunc(roundUnit); + } + + return roundNumFunc[roundUnit](num); + } + function roundNumbers(num, roundUnit) { + if (!num || !roundUnit) { + return num; + } + + var isNumber = typeof roundUnit === "number"; + return map(num, function (value, key) { + return roundNumber(value, isNumber ? roundUnit : roundUnit[key]); + }); + } + function getDecimalPlace(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; + } + function inversePow(n) { + // replace Math.pow(10, -n) to solve floating point issue. + // eg. Math.pow(10, -4) => 0.00009999999999999999 + return 1 / Math.pow(10, n); + } + function getRoundFunc(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; + }; + } + + function minMax(value, min, max) { + return Math.max(Math.min(value, max), min); + } + + var AnimationManager = + /*#__PURE__*/ + function () { + function AnimationManager(_a) { + var options = _a.options, + itm = _a.itm, + em = _a.em, + axm = _a.axm; + this.options = options; + this.itm = itm; + this.em = em; + this.axm = axm; + 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 minMax(duration, this.options.minimumDuration, this.options.maximumDuration); + }; + + __proto.createAnimationParam = function (pos, duration, option) { + var depaPos = this.axm.get(); + var destPos = pos; + var inputEvent = option && option.event || null; + return { + depaPos: depaPos, + destPos: destPos, + duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration), + delta: this.axm.getDelta(depaPos, destPos), + inputEvent: inputEvent, + input: option && option.input || null, + isTrusted: !!inputEvent, + done: this.animationEnd + }; + }; + + __proto.grab = function (axes, option) { + if (this._animateParam && axes.length) { + var orgPos_1 = this.axm.get(axes); + var pos = this.axm.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.em.triggerChange(pos, false, orgPos_1, option, !!option); + } + + this._animateParam = null; + this._raf && cancelAnimationFrame(this._raf); + this._raf = null; + this.em.triggerAnimationEnd(!!(option && 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.axm.get(); + var destPos = this.axm.map(pos, function (v, opt) { + return Math.min(opt.range[1], Math.max(opt.range[0], v)); + }); + this.animateTo(destPos, this.getDuration(pos, destPos), option); + }; + + __proto.animationEnd = function () { + var beforeParam = this.getEventInfo(); + this._animateParam = null; // for Circular + + var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + }); + Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) { + return getCirculatedPos(v, opt.range, opt.circular); + })); + this.itm.setInterrupt(false); + this.em.triggerAnimationEnd(!!beforeParam); + + if (this.axm.isOutside()) { + this.restore(beforeParam); + } else { + this.finish(!!beforeParam); + } + }; + + __proto.finish = function (isTrusted) { + this._animateParam = null; + this.itm.setInterrupt(false); + this.em.triggerFinish(isTrusted); + }; + + __proto.animateLoop = function (param, complete) { + if (param.duration) { + this._animateParam = __assign({}, param); + var info_1 = this._animateParam; + var self_1 = this; + var destPos_1 = info_1.destPos; + var prevPos_1 = info_1.depaPos; + var prevEasingPer_1 = 0; + var directions_1 = map(prevPos_1, function (value, key) { + return value <= destPos_1[key] ? 1 : -1; + }); + var originalIntendedPos_1 = map(destPos_1, function (v) { + return v; + }); + var prevTime_1 = new Date().getTime(); + info_1.startTime = prevTime_1; + + (function loop() { + self_1._raf = null; + var currentTime = new Date().getTime(); + var ratio = (currentTime - info_1.startTime) / param.duration; + var easingPer = self_1.easing(ratio); + var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) { + var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved. + // Recalculate the remaining distance. + // Fix the bouncing phenomenon by changing the range. + + var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular); + + if (nextPos !== circulatedPos) { + // circular + var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]); + destPos_1[key] -= rangeOffset; + prevPos_1[key] -= rangeOffset; + } + + return circulatedPos; + }); + var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1); + prevPos_1 = toPos; + prevTime_1 = currentTime; + prevEasingPer_1 = easingPer; + + if (easingPer >= 1) { + destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1); + + if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) { + self_1.em.triggerChange(destPos_1, true, prevPos_1); + } + + complete(); + return; + } else if (isCanceled) { + self_1.finish(false); + } else { + // animationEnd + self_1._raf = requestAnimationFrame(loop); + } + })(); + } else { + this.em.triggerChange(param.destPos, true); + 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 + + + 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.axm.getAxisOptions(key); + minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val))); + } + + return minRoundUnit || roundUnit; + }; + + __proto.getUserControll = function (param) { + var userWish = param.setTo(); + userWish.destPos = this.axm.get(userWish.destPos); + userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration); + return userWish; + }; + + __proto.animateTo = function (destPos, duration, option) { + var _this = this; + + var param = this.createAnimationParam(destPos, duration, option); + + var depaPos = __assign({}, param.depaPos); + + var retTrigger = this.em.triggerAnimationStart(param); // to control + + var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true. + + if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) { + return isCircularable(v, opt.range, opt.circular); + })) { + console.warn("You can't stop the 'animation' event when 'circular' is true."); + } + + if (retTrigger && !equal(userWish.destPos, depaPos)) { + var inputEvent = option && option.event || null; + this.animateLoop({ + depaPos: depaPos, + destPos: userWish.destPos, + duration: userWish.duration, + delta: this.axm.getDelta(depaPos, userWish.destPos), + isTrusted: !!inputEvent, + inputEvent: inputEvent, + input: option && option.input || null + }, function () { + return _this.animationEnd(); + }); + } + }; + + __proto.easing = function (p) { + return p > 1 ? 1 : this.options.easing(p); + }; + + __proto.setTo = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + var axes = Object.keys(pos); + this.grab(axes); + var orgPos = this.axm.get(axes); + + if (equal(pos, orgPos)) { + return this; + } + + this.itm.setInterrupt(true); + var movedPos = filter(pos, function (v, k) { + return orgPos[k] !== v; + }); + + if (!Object.keys(movedPos).length) { + return this; + } + + movedPos = this.axm.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.em.triggerChange(movedPos); + this.finish(false); + } + + return this; + }; + + __proto.setBy = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } + + return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) { + return v + pos[k]; + }), duration); + }; + + return AnimationManager; + }(); + + 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 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트 + * @name eg.Axes#hold + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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.triggerHold = function (pos, option) { + var roundPos = this.getRoundPos(pos).roundPos; + this.axes.trigger("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일 경우에 동작한다 + * @name set + * @function + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("change", function(event) { + * event.holding && event.set({x: 10}); + * }); + */ + + /** Specifies the animation coordinates to move after the 'release' or 'animationStart' events. + * @ko 'release' 또는 'animationStart' 이벤트 이후 이동할 좌표를 지정한다. + * @name setTo + * @function + * @param {Object.} pos The coordinate to move to 이동할 좌표 + * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms) + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }).on("animationStart", function(event) { + * event.setTo({x: 10}, 2000); + * }); + */ + + /** + * This event is fired when a user release an element on the screen of the device. + * @ko 사용자가 기기의 화면에서 손을 뗐을 때 발생하는 이벤트 + * @name eg.Axes#release + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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} 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 + * 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("release", param); + }; + /** + * This event is fired when coordinate changes. + * @ko 좌표가 변경됐을 때 발생하는 이벤트 + * @name eg.Axes#change + * @event + * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체 + * @property {Object.} pos The coordinate 좌표 + * @property {Object.} delta The movement variation of coordinate 좌표의 변화량 + * @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 + * 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, isAccurate, depaPos, option, holding) { + if (holding === void 0) { + holding = false; + } + + var am = this.am; + var axm = am.axm; + var eventInfo = am.getEventInfo(); + + var _a = this.getRoundPos(pos, depaPos), + roundPos = _a.roundPos, + roundDepa = _a.roundDepa; + + var moveTo = axm.moveTo(roundPos, roundDepa); + var inputEvent = option && option.event || eventInfo && eventInfo.event || null; + var param = { + pos: moveTo.pos, + delta: moveTo.delta, + holding: holding, + inputEvent: inputEvent, + isTrusted: !!inputEvent, + input: option && option.input || eventInfo && eventInfo.input || null, + set: inputEvent ? this.createUserControll(moveTo.pos) : function () {} + }; + var result = this.axes.trigger("change", param); + inputEvent && axm.set(param.set()["destPos"]); + return result; + }; + /** + * This event is fired when animation starts. + * @ko 에니메이션이 시작할 때 발생한다. + * @name eg.Axes#animationStart + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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); + return this.axes.trigger("animationStart", param); + }; + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생한다. + * @name eg.Axes#animationEnd + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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("animationEnd", { + isTrusted: isTrusted + }); + }; + /** + * This event is fired when all actions have been completed. + * @ko 에니메이션이 끝났을 때 발생한다. + * @name eg.Axes#finish + * @event + * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체 + * @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 + * 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("finish", { + isTrusted: isTrusted + }); + }; + + __proto.createUserControll = function (pos, duration) { + if (duration === void 0) { + duration = 0; + } // to controll + + + var userControl = { + destPos: __assign({}, pos), + duration: duration + }; + return function (toPos, userDuration) { + toPos && (userControl.destPos = __assign({}, toPos)); + userDuration !== undefined && (userControl.duration = userDuration); + return userControl; + }; + }; + + __proto.setAnimationManager = function (am) { + this.am = am; + }; + + __proto.destroy = function () { + this.axes.off(); + }; + + __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) + }; + }; + + 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) { + !this.options.interruptable && (this._prevented = prevented); + }; + + return InterruptManager; + }(); + + var AxisManager = + /*#__PURE__*/ + function () { + function AxisManager(axis, options) { + var _this = this; + + this.axis = axis; + this.options = options; + + this._complementOptions(); + + this._pos = Object.keys(this.axis).reduce(function (acc, v) { + acc[v] = _this.axis[v].range[0]; + return acc; + }, {}); + } + /** + * set up 'css' expression + * @private + */ + + + var __proto = AxisManager.prototype; + + __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]; + } + }); + }); + }; + + __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({}, 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]; + }; + + return AxisManager; + }(); + + var InputObserver = + /*#__PURE__*/ + function () { + function InputObserver(_a) { + var options = _a.options, + itm = _a.itm, + em = _a.em, + axm = _a.axm, + am = _a.am; + this.isOutside = false; + this.moveDistance = null; + this.isStopped = false; + this.options = options; + this.itm = itm; + this.em = em; + this.axm = axm; + this.am = am; + } // when move pointer is held in outside + + + var __proto = InputObserver.prototype; + + __proto.atOutside = function (pos) { + var _this = this; + + if (this.isOutside) { + return this.axm.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 { + // when start pointer is held in inside + // get a initialization slope value to prevent smooth animation. + var initSlope_1 = this.am.easing(0.00001) / 0.00001; + return this.axm.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.am.easing((min - v) / (out[0] * initSlope_1)) * out[0]; + } else if (v > max) { + // right + return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1]; + } + + return v; + }); + } + }; + + __proto.get = function (input) { + return this.axm.get(input.axes); + }; + + __proto.hold = function (input, event) { + if (this.itm.isInterrupted() || !input.axes.length) { + return; + } + + var changeOption = { + input: input, + event: event + }; + this.isStopped = false; + this.itm.setInterrupt(true); + this.am.grab(input.axes, changeOption); + !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption); + this.isOutside = this.axm.isOutside(input.axes); + this.moveDistance = this.axm.get(input.axes); + }; + + __proto.change = function (input, event, offset) { + if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) { + return v === 0; + })) { + return; + } + + var depaPos = this.moveDistance || this.axm.get(input.axes); + var destPos; // for outside logic + + destPos = map(depaPos, function (v, k) { + return v + (offset[k] || 0); + }); + this.moveDistance && (this.moveDistance = destPos); // from outside to inside + + if (this.isOutside && this.axm.every(depaPos, function (v, opt) { + return !isOutside(v, opt.range); + })) { + this.isOutside = false; + } + + depaPos = this.atOutside(depaPos); + destPos = this.atOutside(destPos); + var isCanceled = !this.em.triggerChange(destPos, false, depaPos, { + input: input, + event: event + }, true); + + if (isCanceled) { + this.isStopped = true; + this.moveDistance = null; + this.am.finish(false); + } + }; + + __proto.release = function (input, event, offset, inputDuration) { + if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) { + return; + } + + var pos = this.axm.get(input.axes); + var depaPos = this.axm.get(); + var destPos = this.axm.get(this.axm.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); + } + })); + var duration = this.am.getDuration(destPos, pos, inputDuration); + + if (duration === 0) { + destPos = __assign({}, depaPos); + } // prepare params + + + var param = { + depaPos: depaPos, + destPos: destPos, + duration: duration, + delta: this.axm.getDelta(depaPos, destPos), + inputEvent: event, + input: input, + isTrusted: true + }; + this.em.triggerRelease(param); + this.moveDistance = null; // to contol + + var userWish = this.am.getUserControll(param); + var isEqual = equal(userWish.destPos, depaPos); + var changeOption = { + input: input, + event: event + }; + + if (isEqual || userWish.duration === 0) { + !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true); + this.itm.setInterrupt(false); + + if (this.axm.isOutside()) { + this.am.restore(changeOption); + } else { + this.em.triggerFinish(true); + } + } else { + this.am.animateTo(userWish.destPos, userWish.duration, changeOption); + } + }; + + return InputObserver; + }(); + + // export const DIRECTION_NONE = 1; + var IOS_EDGE_THRESHOLD = 30; + var IS_IOS_SAFARI = "ontouchstart" in win$2 && agent$2().browser.name === "safari"; + var TRANSFORM$1 = 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 ""; + }(); + + /** + * @typedef {Object} AxisOption The Axis information. The key of the axis specifies the name to use as the logical virtual coordinate system. + * @ko 축 정보. 축의 키는 논리적인 가상 좌표계로 사용할 이름을 지정한다. + * @property {Number[]} [range] The coordinate of range 좌표 범위 + * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표 + * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표 + * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다 + * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기 + * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기 + * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to "true" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다 + * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부 + * @property {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 모듈의 옵션 객체 + * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수 + * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간 + * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간 + * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다 + * @property {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가 적용되지 않는다
+ * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
+ **/ + + /** + * @class eg.Axes + * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions. + * @ko 터치 입력 장치나 마우스와 같은 다양한 입력 장치를 통해 전달 받은 사용자의 동작을 논리적인 가상 좌표로 변경하는 모듈이다. 사용자 동작에 반응하는 UI를 손쉽게 만들수 있다. + * @extends eg.Component + * + * @param {Object.} 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] 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 + * + * // 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 = {}; + } + + var _this = _super.call(this) || this; + + _this.axis = axis; + _this._inputs = []; + _this.options = __assign({ + easing: function easeOutCubic(x) { + return 1 - Math.pow(1 - x, 3); + }, + interruptable: true, + maximumDuration: Infinity, + minimumDuration: 0, + deceleration: 0.0006, + round: null + }, options); + _this.itm = new InterruptManager(_this.options); + _this.axm = new AxisManager(_this.axis, _this.options); + _this.em = new EventManager(_this); + _this.am = new AnimationManager(_this); + _this.io = new InputObserver(_this); + + _this.em.setAnimationManager(_this.am); + + startPos && _this.em.triggerChange(startPos); + return _this; + } + /** + * Connect the axis of eg.Axes to the inputType. + * @ko eg.Axes의 축과 inputType을 연결한다 + * @method eg.Axes#connect + * @param {(String[]|String)} axes The name of the axis to associate with inputType 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 + * 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); + } // check same element in hammer type for share + + + if ("hammer" in inputType) { + var targets = this._inputs.filter(function (v) { + return v.hammer && v.element === inputType.element; + }); + + if (targets.length) { + inputType.hammer = targets[0].hammer; + } + } + + inputType.mapAxes(mapped); + inputType.connect(this.io); + + this._inputs.push(inputType); + + return this; + }; + /** + * Disconnect the axis of eg.Axes from the inputType. + * @ko eg.Axes의 축과 inputType의 연결을 끊는다. + * @method eg.Axes#disconnect + * @param {Object} [inputType] An inputType instance associated with the axis of eg.Axes eg.Axes의 축과 연결한 inputType 인스턴스 + * @return {eg.Axes} An instance of a module itself 모듈 자신의 인스턴스 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * } + * }); + * + * const input1 = new eg.Axes.PanInput("#area1"); + * const input2 = new eg.Axes.PanInput("#area2"); + * const input3 = new eg.Axes.PanInput("#area3"); + * + * axes.connect("x", input1); + * .connect("x xOther", input2) + * .connect(["xOther", "x"], input3); + * + * axes.disconnect(input1); // disconnects input1 + * axes.disconnect(); // disconnects all of them + */ + + + __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 좌표의 현재 위치를 반환한다 + * @method eg.Axes#get + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Object.} Axis coordinate information 축 좌표 정보 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }); + * + * axes.get(); // {"x": 0, "xOther": -100, "zoom": 50} + * axes.get(["x", "zoom"]); // {"x": 0, "zoom": 50} + */ + + + __proto.get = function (axes) { + return this.axm.get(axes); + }; + /** + * Moves an axis to specific coordinates. + * @ko 좌표를 이동한다. + * @method eg.Axes#setTo + * @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 + * 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.am.setTo(pos, duration); + return this; + }; + /** + * Moves an axis from the current coordinates to specific coordinates. + * @ko 현재 좌표를 기준으로 좌표를 이동한다. + * @method eg.Axes#setBy + * @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 + * 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.am.setBy(pos, duration); + return this; + }; + /** + * Returns whether there is a coordinate in the bounce area of ​​the target axis. + * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다 + * @method eg.Axes#isBounceArea + * @param {Object} [axes] The names of the axis 축 이름들 + * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부 + * @example + * const axes = new eg.Axes({ + * "x": { + * range: [0, 100] + * }, + * "xOther": { + * range: [-100, 100] + * }, + * "zoom": { + * range: [50, 30] + * } + * }); + * + * axes.isBounceArea(["x"]); + * axes.isBounceArea(["x", "zoom"]); + * axes.isBounceArea(); + */ + + + __proto.isBounceArea = function (axes) { + return this.axm.isOutside(axes); + }; + /** + * Destroys properties, and events used in a module and disconnect all connections to inputTypes. + * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다. + * @method eg.Axes#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + this.em.destroy(); + }; + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.Axes.VERSION; // ex) 3.3.3 + * @memberof eg.Axes + */ + + + Axes.VERSION = "2.7.1"; + /** + * @name eg.Axes.TRANSFORM + * @desc Returns the transform attribute with CSS vendor prefixes. + * @ko CSS vendor prefixes를 붙인 transform 속성을 반환한다. + * + * @constant + * @type {String} + * @example + * eg.Axes.TRANSFORM; // "transform" or "webkitTransform" + */ + + Axes.TRANSFORM = TRANSFORM$1; + /** + * @name eg.Axes.DIRECTION_NONE + * @constant + * @type {Number} + */ + + Axes.DIRECTION_NONE = DIRECTION_NONE; + /** + * @name eg.Axes.DIRECTION_LEFT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_LEFT = DIRECTION_LEFT; + /** + * @name eg.Axes.DIRECTION_RIGHT + * @constant + * @type {Number} + */ + + Axes.DIRECTION_RIGHT = DIRECTION_RIGHT; + /** + * @name eg.Axes.DIRECTION_UP + * @constant + * @type {Number} + */ + + Axes.DIRECTION_UP = DIRECTION_UP; + /** + * @name eg.Axes.DIRECTION_DOWN + * @constant + * @type {Number} + */ + + Axes.DIRECTION_DOWN = DIRECTION_DOWN; + /** + * @name eg.Axes.DIRECTION_HORIZONTAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL; + /** + * @name eg.Axes.DIRECTION_VERTICAL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL; + /** + * @name eg.Axes.DIRECTION_ALL + * @constant + * @type {Number} + */ + + Axes.DIRECTION_ALL = DIRECTION_ALL; + return Axes; + }(Component); + + var SUPPORT_POINTER_EVENTS$1 = "PointerEvent" in win$2 || "MSPointerEvent" in win$2; + var SUPPORT_TOUCH$2 = ("ontouchstart" in win$2); + var UNIQUEKEY = "_EGJS_AXES_INPUTTYPE_"; + function toAxis(source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + } + function createHammer(element, options) { + try { + // create Hammer + return new Manager(element, __assign({}, options)); + } catch (e) { + return null; + } + } + function convertInputType(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$2; + break; + + case "pointer": + hasPointer = SUPPORT_POINTER_EVENTS$1; + // no default + } + }); + + if (hasPointer) { + return PointerEventInput; + } else if (hasTouch && hasMouse) { + return TouchMouseInput; + } else if (hasTouch) { + return TouchInput; + } else if (hasMouse) { + return MouseInput; + } + + return null; + } + + function getDirectionByAngle(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; + } + function getNextOffset(speeds, deceleration) { + var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]); + var duration = Math.abs(normalSpeed / -deceleration); + return [speeds[0] / 2 * duration, speeds[1] / 2 * duration]; + } + function useDirection(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 모듈의 옵션 객체 + * @property {String[]} [inputType=["touch","mouse", "pointer"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
+ * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율 + * @property {Number} [scale.1=1] vertical axis scale 수직축 배율 + * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90) + * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리 + * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px) + * @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager Hammer.Manager의 옵션 + **/ + + /** + * @class eg.Axes.PanInput + * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes. + * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다. + * + * @example + * const pan = new eg.Axes.PanInput("#area", { + * inputType: ["touch"], + * scale: [1, 1.3], + * }); + * + * // Connect the 'something2' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. + * // Connect the 'somethingN' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. + * axes.connect(["something2", "somethingN"], pan); // or axes.connect("something2 somethingN", pan); + * + * // Connect only one 'something1' axis to the mouse or touchscreen x position when the mouse or touchscreen is down and moved. + * axes.connect(["something1"], pan); // or axes.connect("something1", pan); + * + * // Connect only one 'something2' axis to the mouse or touchscreen y position when the mouse or touchscreen is down and moved. + * axes.connect(["", "something2"], pan); // or axes.connect(" something2", pan); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PanInput module 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) { + this.axes = []; + this.hammer = null; + this.element = null; + this.panRecognizer = null; + this.isRightEdge = false; + this.rightEdgeTimer = 0; + this.panFlag = false; + /** + * Hammer helps you add support for touch gestures to your page + * + * @external Hammer + * @see {@link http://hammerjs.github.io|Hammer.JS} + * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents} + * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS + */ + + if (typeof Manager === "undefined") { + throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/"); + } + + this.element = $(el); + this.options = __assign({ + inputType: ["touch", "mouse", "pointer"], + scale: [1, 1], + thresholdAngle: 45, + threshold: 0, + iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD, + hammerManagerOptions: { + // css properties were removed due to usablility issue + // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html + cssProps: { + userSelect: "none", + touchSelect: "none", + touchCallout: "none", + userDrag: "none" + } + } + }, options); + this.onHammerInput = this.onHammerInput.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) { + var hammerOption = { + direction: this._direction, + threshold: this.options.threshold + }; + + if (this.hammer) { + // for sharing hammer instance. + // hammer remove previous PanRecognizer. + this.removeRecognizer(); + this.dettachEvent(); + } else { + var keyValue = this.element[UNIQUEKEY]; + + if (!keyValue) { + keyValue = String(Math.round(Math.random() * new Date().getTime())); + } + + var inputClass = convertInputType(this.options.inputType); + + if (!inputClass) { + throw new Error("Wrong inputType parameter!"); + } + + this.hammer = createHammer(this.element, __assign({ + inputClass: inputClass + }, this.options.hammerManagerOptions)); + this.element[UNIQUEKEY] = keyValue; + } + + this.panRecognizer = new PanRecognizer(hammerOption); + this.hammer.add(this.panRecognizer); + this.attachEvent(observer); + return this; + }; + + __proto.disconnect = function () { + this.removeRecognizer(); + + if (this.hammer) { + this.dettachEvent(); + } + + this._direction = DIRECTION_NONE; + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.PanInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + + if (this.hammer && this.hammer.recognizers.length === 0) { + this.hammer.destroy(); + } + + delete this.element[UNIQUEKEY]; + this.element = null; + this.hammer = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.PanInput#enable + * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this.hammer && (this.hammer.get("pan").options.enable = true); + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.PanInput#disable + * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this.hammer && (this.hammer.get("pan").options.enable = false); + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.PanInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return !!(this.hammer && this.hammer.get("pan").options.enable); + }; + + __proto.removeRecognizer = function () { + if (this.hammer && this.panRecognizer) { + this.hammer.remove(this.panRecognizer); + this.panRecognizer = null; + } + }; + + __proto.onHammerInput = function (event) { + if (this.isEnable()) { + if (event.isFirst) { + this.panFlag = false; + + if (event.srcEvent.cancelable !== false) { + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + this.observer.hold(this, event); + this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold; + this.panFlag = true; + } + } else if (event.isFinal) { + this.onPanend(event); + } + } + }; + + __proto.onPanmove = function (event) { + var _this = this; + + if (!this.panFlag) { + return; + } + + var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start + + var prevInput = this.hammer.session.prevInput; + + if (prevInput && IS_IOS_SAFARI) { + var swipeLeftToRight = event.center.x < 0; + + if (swipeLeftToRight) { + // iOS swipe left => right + this.onPanend(__assign({}, prevInput, { + velocityX: 0, + velocityY: 0, + offsetX: 0, + offsetY: 0 + })); + return; + } else if (this.isRightEdge) { + clearTimeout(this.rightEdgeTimer); // - is right to left + + var edgeThreshold = this.options.iOSEdgeSwipeThreshold; + var swipeRightToLeft = event.deltaX < -edgeThreshold; + + if (swipeRightToLeft) { + this.isRightEdge = false; + } else { + // iOS swipe right => left + this.rightEdgeTimer = window.setTimeout(function () { + _this.onPanend(__assign({}, prevInput, { + velocityX: 0, + velocityY: 0, + offsetX: 0, + offsetY: 0 + })); + }, 100); + } + } + } + /* eslint-disable no-param-reassign */ + + + if (prevInput) { + event.offsetX = event.deltaX - prevInput.deltaX; + event.offsetY = event.deltaY - prevInput.deltaY; + } else { + event.offsetX = 0; + event.offsetY = 0; + } + + var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]); + var prevent = offset.some(function (v) { + return v !== 0; + }); + + if (prevent) { + var srcEvent = event.srcEvent; + + if (srcEvent.cancelable !== false) { + srcEvent.preventDefault(); + } + + srcEvent.stopPropagation(); + } + + event.preventSystemEvent = prevent; + prevent && this.observer.change(this, event, toAxis(this.axes, offset)); + }; + + __proto.onPanend = function (event) { + if (!this.panFlag) { + return; + } + + clearTimeout(this.rightEdgeTimer); + this.panFlag = false; + var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]); + offset = getNextOffset(offset, this.observer.options.deceleration); + this.observer.release(this, event, toAxis(this.axes, offset)); + }; + + __proto.attachEvent = function (observer) { + this.observer = observer; + this.hammer.on("hammer.input", this.onHammerInput).on("panstart panmove", this.onPanmove); + }; + + __proto.dettachEvent = function () { + this.hammer.off("hammer.input", this.onHammerInput).off("panstart panmove", this.onPanmove); + this.observer = null; + }; + + __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; + }; + + return PanInput; + }(); + + /** + * @class eg.Axes.RotatePanInput + * @classdesc 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 + * 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 eg.Axes.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.onHammerInput = function (event) { + if (this.isEnable()) { + if (event.isFirst) { + this.observer.hold(this, event); + this.onPanstart(event); + } else if (event.isFinal) { + this.onPanend(event); + } + } + }; + + __proto.onPanstart = function (event) { + var rect = this.element.getBoundingClientRect(); + /** + * Responsive + */ + // TODO: how to do if element is ellipse not circle. + + this.coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360 + // TODO: provide a way to set origin like https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin + + this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle. + + this.prevAngle = null; + this.triggerChange(event); + }; + + __proto.onPanmove = function (event) { + this.triggerChange(event); + }; + + __proto.onPanend = function (event) { + this.triggerChange(event); + this.triggerAnimation(event); + }; + + __proto.triggerChange = function (event) { + var angle = this.getAngle(event.center.x, event.center.y); + var quadrant = this.getQuadrant(event.center.x, event.center.y); + var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant); + this.prevAngle = angle; + this.prevQuadrant = quadrant; + + if (diff === 0) { + return; + } + + this.lastDiff = diff; + this.observer.change(this, event, toAxis(this.axes, [-diff])); // minus for clockwise + }; + + __proto.triggerAnimation = function (event) { + var vx = event.velocityX; + var vy = event.velocityY; + var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise + + var duration = Math.abs(velocity / -this.observer.options.deceleration); + var distance = velocity / 2 * duration; + this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle])); + }; + + __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.getAngle = function (posX, posY) { + var _a = this.getPosFromOrigin(posX, posY), + x = _a.x, + y = _a.y; + + var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y); + + return angle < 0 ? 360 + angle : angle; + }; + /** + * Quadrant + * y(+) + * | + * 2 | 1 + * --------------->x(+) + * 3 | 4 + * | + */ + + + __proto.getQuadrant = function (posX, posY) { + 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 모듈의 옵션 객체 + * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @property {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율 + * @property {Object} [hammerManagerOptions={cssProps: {userSelect: "none",touchSelect: "none",touchCallout: "none",userDrag: "none"}] Options of Hammer.Manager Hammer.Manager의 옵션 + **/ + + /** + * @class eg.Axes.PinchInput + * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis. + * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. + * @example + * const pinch = new eg.Axes.PinchInput("#area", { + * scale: 1 + * }); + * + * // Connect 'something' axis when two pointers are moving toward (zoom-in) or away from each other (zoom-out). + * axes.connect("something", pinch); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.PinchInput module 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.hammer = null; + this.element = null; + this._base = null; + this._prev = null; + this.pinchRecognizer = null; + /** + * Hammer helps you add support for touch gestures to your page + * + * @external Hammer + * @see {@link http://hammerjs.github.io|Hammer.JS} + * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents} + * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS + */ + + if (typeof Manager === "undefined") { + throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/"); + } + + this.element = $(el); + this.options = __assign({ + scale: 1, + threshold: 0, + inputType: ["touch", "pointer"], + hammerManagerOptions: { + // css properties were removed due to usablility issue + // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html + cssProps: { + userSelect: "none", + touchSelect: "none", + touchCallout: "none", + userDrag: "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) { + var hammerOption = { + threshold: this.options.threshold + }; + + if (this.hammer) { + // for sharing hammer instance. + // hammer remove previous PinchRecognizer. + this.removeRecognizer(); + this.dettachEvent(); + } else { + var keyValue = this.element[UNIQUEKEY]; + + if (!keyValue) { + keyValue = String(Math.round(Math.random() * new Date().getTime())); + } + + var inputClass = convertInputType(this.options.inputType); + + if (!inputClass) { + throw new Error("Wrong inputType parameter!"); + } + + this.hammer = createHammer(this.element, __assign({ + inputClass: inputClass + }, this.options.hammerManagerOptions)); + this.element[UNIQUEKEY] = keyValue; + } + + this.pinchRecognizer = new PinchRecognizer(hammerOption); + this.hammer.add(this.pinchRecognizer); + this.attachEvent(observer); + return this; + }; + + __proto.disconnect = function () { + this.removeRecognizer(); + + if (this.hammer) { + this.hammer.remove(this.pinchRecognizer); + this.pinchRecognizer = null; + this.dettachEvent(); + } + + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.PinchInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + + if (this.hammer && this.hammer.recognizers.length === 0) { + this.hammer.destroy(); + } + + delete this.element[UNIQUEKEY]; + this.element = null; + this.hammer = null; + }; + + __proto.removeRecognizer = function () { + if (this.hammer && this.pinchRecognizer) { + this.hammer.remove(this.pinchRecognizer); + this.pinchRecognizer = null; + } + }; + + __proto.onPinchStart = function (event) { + this._base = this.observer.get(this)[this.axes[0]]; + var offset = this.getOffset(event.scale); + this.observer.hold(this, event); + this.observer.change(this, event, toAxis(this.axes, [offset])); + this._prev = event.scale; + }; + + __proto.onPinchMove = function (event) { + var offset = this.getOffset(event.scale, this._prev); + this.observer.change(this, event, toAxis(this.axes, [offset])); + this._prev = event.scale; + }; + + __proto.onPinchEnd = function (event) { + var offset = this.getOffset(event.scale, this._prev); + this.observer.change(this, event, toAxis(this.axes, [offset])); + this.observer.release(this, event, toAxis(this.axes, [0]), 0); + this._base = null; + this._prev = null; + }; + + __proto.getOffset = function (pinchScale, prev) { + if (prev === void 0) { + prev = 1; + } + + return this._base * (pinchScale - prev) * this.options.scale; + }; + + __proto.attachEvent = function (observer) { + this.observer = observer; + this.hammer.on("pinchstart", this.onPinchStart).on("pinchmove", this.onPinchMove).on("pinchend", this.onPinchEnd); + }; + + __proto.dettachEvent = function () { + this.hammer.off("pinchstart", this.onPinchStart).off("pinchmove", this.onPinchMove).off("pinchend", this.onPinchEnd); + this.observer = null; + this._prev = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.PinchInput#enable + * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this.hammer && (this.hammer.get("pinch").options.enable = true); + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.PinchInput#disable + * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this.hammer && (this.hammer.get("pinch").options.enable = false); + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.PinchInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return !!(this.hammer && this.hammer.get("pinch").options.enable); + }; + + return PinchInput; + }(); + + /** + * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module + * @ko eg.Axes.WheelInput 모듈의 옵션 객체 + * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + **/ + + /** + * @class eg.Axes.WheelInput + * @classdesc A module that passes the amount of change to eg.Axes when the mouse wheel is moved. use one axis. + * @ko 마우스 휠이 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다. + * + * @example + * const wheel = new eg.Axes.WheelInput("#area", { + * scale: 1 + * }); + * + * // Connect 'something' axis when the mousewheel is moved. + * axes.connect("something", wheel); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.WheelInput module 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._isEnabled = false; + this._isHolded = false; + this._timer = null; + this.element = $(el); + this.options = __assign({ + scale: 1, + useNormalized: true + }, options); + this.onWheel = this.onWheel.bind(this); + } + + var __proto = WheelInput.prototype; + + __proto.mapAxes = function (axes) { + this.axes = axes; + }; + + __proto.connect = function (observer) { + this.dettachEvent(); + this.attachEvent(observer); + return this; + }; + + __proto.disconnect = function () { + this.dettachEvent(); + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.WheelInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + + __proto.onWheel = function (event) { + var _this = this; + + if (!this._isEnabled) { + return; + } + + event.preventDefault(); + + if (event.deltaY === 0) { + return; + } + + if (!this._isHolded) { + this.observer.hold(this, event); + this._isHolded = 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])); + clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (_this._isHolded) { + _this._isHolded = false; + + _this.observer.release(_this, event, toAxis(_this.axes, [0])); + } + }, 50); + }; + + __proto.attachEvent = function (observer) { + this.observer = observer; + this.element.addEventListener("wheel", this.onWheel); + this._isEnabled = true; + }; + + __proto.dettachEvent = function () { + this.element.removeEventListener("wheel", this.onWheel); + this._isEnabled = false; + this.observer = null; + + if (this._timer) { + clearTimeout(this._timer); + this._timer = null; + } + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.WheelInput#enable + * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._isEnabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.WheelInput#disable + * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._isEnabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.WheelInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return this._isEnabled; + }; + + 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; + 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 모듈의 옵션 객체 + * @property {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율 + * @property {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율 + * @property {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율 + **/ + + /** + * @class eg.Axes.MoveKeyInput + * @classdesc A module that passes the amount of change to eg.Axes when the move key stroke is occured. use two axis. + * @ko 이동키 입력이 발생했을 때의 변화량을 eg.Axes에 전달하는 모듈. 두 개 의 축을 사용한다. + * + * @example + * const moveKey = new eg.Axes.MoveKeyInput("#area", { + * scale: [1, 1] + * }); + * + * // Connect 'x', 'y' axes when the moveKey is pressed. + * axes.connect(["x", "y"], moveKey); + * + * @param {HTMLElement|String|jQuery} element An element to use the eg.Axes.MoveKeyInput module 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._isEnabled = false; + this._isHolded = 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.dettachEvent(); // 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.dettachEvent(); + return this; + }; + /** + * Destroys elements, properties, and events used in a module. + * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다. + * @method eg.Axes.MoveKeyInput#destroy + */ + + + __proto.destroy = function () { + this.disconnect(); + this.element = null; + }; + + __proto.onKeydown = function (e) { + if (!this._isEnabled) { + return; + } + + var isMoveKey = true; + var direction = DIRECTION_FORWARD; + var move = DIRECTION_HORIZONTAL$1; + + switch (e.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; + } + + var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction]; + + if (!this._isHolded) { + this.observer.hold(this, event); + this._isHolded = true; + } + + clearTimeout(this._timer); + this.observer.change(this, event, toAxis(this.axes, offsets)); + }; + + __proto.onKeyup = function (e) { + var _this = this; + + if (!this._isHolded) { + return; + } + + clearTimeout(this._timer); + this._timer = setTimeout(function () { + _this.observer.release(_this, e, toAxis(_this.axes, [0, 0])); + + _this._isHolded = 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._isEnabled = true; + }; + + __proto.dettachEvent = function () { + this.element.removeEventListener("keydown", this.onKeydown, false); + this.element.removeEventListener("keypress", this.onKeydown, false); + this.element.removeEventListener("keyup", this.onKeyup, false); + this._isEnabled = false; + this.observer = null; + }; + /** + * Enables input devices + * @ko 입력 장치를 사용할 수 있게 한다 + * @method eg.Axes.MoveKeyInput#enable + * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.enable = function () { + this._isEnabled = true; + return this; + }; + /** + * Disables input devices + * @ko 입력 장치를 사용할 수 없게 한다. + * @method eg.Axes.MoveKeyInput#disable + * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스 + */ + + + __proto.disable = function () { + this._isEnabled = false; + return this; + }; + /** + * Returns whether to use an input device + * @ko 입력 장치를 사용 여부를 반환한다. + * @method eg.Axes.MoveKeyInput#isEnable + * @return {Boolean} Whether to use an input device 입력장치 사용여부 + */ + + + __proto.isEnable = function () { + return this._isEnabled; + }; + + return MoveKeyInput; + }(); + + /** + * Original Code + * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js + * Math Util + * modified by egjs + */ + + function quatToVec3(quaternion) { + var baseV = fromValues$4(0, 0, 1); + transformQuat(baseV, baseV, quaternion); + return baseV; + } + + function toDegree(a) { + return a * 180 / Math.PI; + } + + var util = {}; + + util.isPowerOfTwo = function (n) { + return n && (n & n - 1) === 0; + }; + + util.extractPitchFromQuat = function (quaternion) { + var baseV = quatToVec3(quaternion); + return -1 * Math.atan2(baseV[1], Math.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2))); + }; + + util.hypot = Math.hypot || function (x, y) { + return Math.sqrt(x * x + y * y); + }; // implement reference + // the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식 + // calculating angle between two vectors : http://darkpgmr.tistory.com/121 + + + var ROTATE_CONSTANT = { + PITCH_DELTA: 1, + YAW_DELTA_BY_ROLL: 2, + YAW_DELTA_BY_YAW: 3 + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = { + targetAxis: [0, 1, 0], + meshPoint: [0, 0, 1] + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = { + targetAxis: [0, 1, 0], + meshPoint: [1, 0, 0] + }; + ROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = { + targetAxis: [1, 0, 0], + meshPoint: [0, 0, 1] + }; + + function getRotationDelta(prevQ, curQ, rotateKind) { + var targetAxis = fromValues$4(ROTATE_CONSTANT[rotateKind].targetAxis[0], ROTATE_CONSTANT[rotateKind].targetAxis[1], ROTATE_CONSTANT[rotateKind].targetAxis[2]); + var meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint; + var prevQuaternion = clone$6(prevQ); + var curQuaternion = clone$6(curQ); + normalize$2(prevQuaternion, prevQuaternion); + normalize$2(curQuaternion, curQuaternion); + var prevPoint = fromValues$4(0, 0, 1); + var curPoint = fromValues$4(0, 0, 1); + transformQuat(prevPoint, prevPoint, prevQuaternion); + transformQuat(curPoint, curPoint, curQuaternion); + transformQuat(targetAxis, targetAxis, curQuaternion); + var rotateDistance = dot(targetAxis, cross(create$4(), prevPoint, curPoint)); + var rotateDirection = rotateDistance > 0 ? 1 : -1; // when counter clock wise, use vec3.fromValues(0,1,0) + // when clock wise, use vec3.fromValues(0,-1,0) + // const meshPoint1 = vec3.fromValues(0, 0, 0); + + var meshPoint2 = fromValues$4(meshPoint[0], meshPoint[1], meshPoint[2]); + var meshPoint3; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + meshPoint3 = fromValues$4(0, rotateDirection, 0); + } else { + meshPoint3 = fromValues$4(rotateDirection, 0, 0); + } + + transformQuat(meshPoint2, meshPoint2, curQuaternion); + transformQuat(meshPoint3, meshPoint3, curQuaternion); + var vecU = meshPoint2; + var vecV = meshPoint3; + var vecN = create$4(); + cross(vecN, vecU, vecV); + normalize(vecN, vecN); + var coefficientA = vecN[0]; + var coefficientB = vecN[1]; + var coefficientC = vecN[2]; // const coefficientD = -1 * vec3.dot(vecN, meshPoint1); + // a point on the plane + + curPoint = fromValues$4(meshPoint[0], meshPoint[1], meshPoint[2]); + transformQuat(curPoint, curPoint, curQuaternion); // a point should project on the plane + + prevPoint = fromValues$4(meshPoint[0], meshPoint[1], meshPoint[2]); + transformQuat(prevPoint, prevPoint, prevQuaternion); // distance between prevPoint and the plane + + var distance$$1 = Math.abs(prevPoint[0] * coefficientA + prevPoint[1] * coefficientB + prevPoint[2] * coefficientC); + var projectedPrevPoint = create$4(); + subtract$4(projectedPrevPoint, prevPoint, scale$4(create$4(), vecN, distance$$1)); + var trigonometricRatio = (projectedPrevPoint[0] * curPoint[0] + projectedPrevPoint[1] * curPoint[1] + projectedPrevPoint[2] * curPoint[2]) / (length(projectedPrevPoint) * length(curPoint)); // defensive block + + trigonometricRatio > 1 && (trigonometricRatio = 1); + var theta = Math.acos(trigonometricRatio); + var crossVec = cross(create$4(), curPoint, projectedPrevPoint); + distance$$1 = coefficientA * crossVec[0] + coefficientB * crossVec[1] + coefficientC * crossVec[2]; + var thetaDirection; + + if (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) { + thetaDirection = distance$$1 > 0 ? 1 : -1; + } else { + thetaDirection = distance$$1 < 0 ? 1 : -1; + } + + var deltaRadian = theta * thetaDirection * rotateDirection; + return toDegree(deltaRadian); + } + + function angleBetweenVec2(v1, v2) { + var det = v1[0] * v2[1] - v2[0] * v1[1]; + var theta = -Math.atan2(det, dot$4(v1, v2)); + return theta; + } + + util.yawOffsetBetween = function (viewDir, targetDir) { + var viewDirXZ = fromValues$8(viewDir[0], viewDir[2]); + var targetDirXZ = fromValues$8(targetDir[0], targetDir[2]); + normalize$4(viewDirXZ, viewDirXZ); + normalize$4(targetDirXZ, targetDirXZ); + var theta = -angleBetweenVec2(viewDirXZ, targetDirXZ); + return theta; + }; + + util.toDegree = toDegree; + util.getRotationDelta = getRotationDelta; + util.angleBetweenVec2 = angleBetweenVec2; + + function toAxis$1(source, offset) { + return offset.reduce(function (acc, v, i) { + if (source[i]) { + acc[source[i]] = v; + } + + return acc; + }, {}); + } + + /* + * Copyright 2016 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + var MathUtil = window.MathUtil || {}; + + MathUtil.degToRad = Math.PI / 180; + MathUtil.radToDeg = 180 / Math.PI; + + // Some minimal math functionality borrowed from THREE.Math and stripped down + // for the purposes of this library. + + + MathUtil.Vector2 = function ( x, y ) { + this.x = x || 0; + this.y = y || 0; + }; + + MathUtil.Vector2.prototype = { + constructor: MathUtil.Vector2, + + set: function ( x, y ) { + this.x = x; + this.y = y; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + + return this; + }, + + subVectors: function ( a, b ) { + this.x = a.x - b.x; + this.y = a.y - b.y; + + return this; + }, + }; + + MathUtil.Vector3 = function ( x, y, z ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + }; + + MathUtil.Vector3.prototype = { + constructor: MathUtil.Vector3, + + set: function ( x, y, z ) { + this.x = x; + this.y = y; + this.z = z; + + return this; + }, + + copy: function ( v ) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + + return this; + }, + + length: function () { + return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z ); + }, + + normalize: function () { + var scalar = this.length(); + + if ( scalar !== 0 ) { + var invScalar = 1 / scalar; + + this.multiplyScalar(invScalar); + } else { + this.x = 0; + this.y = 0; + this.z = 0; + } + + return this; + }, + + multiplyScalar: function ( scalar ) { + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; + }, + + applyQuaternion: function ( q ) { + var x = this.x; + var y = this.y; + var z = this.z; + + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + + // calculate quat * vector + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = - qx * x - qy * y - qz * z; + + // calculate result * inverse quat + this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy; + this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz; + this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx; + + return this; + }, + + dot: function ( v ) { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + + crossVectors: function ( a, b ) { + var ax = a.x, ay = a.y, az = a.z; + var bx = b.x, by = b.y, bz = b.z; + + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + + return this; + }, + }; + + MathUtil.Quaternion = function ( x, y, z, w ) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = ( w !== undefined ) ? w : 1; + }; + + MathUtil.Quaternion.prototype = { + constructor: MathUtil.Quaternion, + + set: function ( x, y, z, w ) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + + return this; + }, + + copy: function ( quaternion ) { + this.x = quaternion.x; + this.y = quaternion.y; + this.z = quaternion.z; + this.w = quaternion.w; + + return this; + }, + + setFromEulerXYZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 + s1 * s2 * c3; + this.w = c1 * c2 * c3 - s1 * s2 * s3; + + return this; + }, + + setFromEulerYXZ: function( x, y, z ) { + var c1 = Math.cos( x / 2 ); + var c2 = Math.cos( y / 2 ); + var c3 = Math.cos( z / 2 ); + var s1 = Math.sin( x / 2 ); + var s2 = Math.sin( y / 2 ); + var s3 = Math.sin( z / 2 ); + + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 - s1 * s2 * c3; + this.w = c1 * c2 * c3 + s1 * s2 * s3; + + return this; + }, + + setFromAxisAngle: function ( axis, angle ) { + // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm + // assumes axis is normalized + + var halfAngle = angle / 2, s = Math.sin( halfAngle ); + + this.x = axis.x * s; + this.y = axis.y * s; + this.z = axis.z * s; + this.w = Math.cos( halfAngle ); + + return this; + }, + + multiply: function ( q ) { + return this.multiplyQuaternions( this, q ); + }, + + multiplyQuaternions: function ( a, b ) { + // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm + + var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w; + var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w; + + this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; + this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; + this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; + this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; + + return this; + }, + + inverse: function () { + this.x *= -1; + this.y *= -1; + this.z *= -1; + + this.normalize(); + + return this; + }, + + normalize: function () { + var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w ); + + if ( l === 0 ) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } else { + l = 1 / l; + + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + + return this; + }, + + slerp: function ( qb, t ) { + if ( t === 0 ) return this; + if ( t === 1 ) return this.copy( qb ); + + var x = this.x, y = this.y, z = this.z, w = this.w; + + // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + + var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z; + + if ( cosHalfTheta < 0 ) { + this.w = - qb.w; + this.x = - qb.x; + this.y = - qb.y; + this.z = - qb.z; + + cosHalfTheta = - cosHalfTheta; + } else { + this.copy( qb ); + } + + if ( cosHalfTheta >= 1.0 ) { + this.w = w; + this.x = x; + this.y = y; + this.z = z; + + return this; + } + + var halfTheta = Math.acos( cosHalfTheta ); + var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta ); + + if ( Math.abs( sinHalfTheta ) < 0.001 ) { + this.w = 0.5 * ( w + this.w ); + this.x = 0.5 * ( x + this.x ); + this.y = 0.5 * ( y + this.y ); + this.z = 0.5 * ( z + this.z ); + + return this; + } + + var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta, + ratioB = Math.sin( t * halfTheta ) / sinHalfTheta; + + this.w = ( w * ratioA + this.w * ratioB ); + this.x = ( x * ratioA + this.x * ratioB ); + this.y = ( y * ratioA + this.y * ratioB ); + this.z = ( z * ratioA + this.z * ratioB ); + + return this; + }, + + setFromUnitVectors: function () { + // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final + // assumes direction vectors vFrom and vTo are normalized + + var v1, r; + var EPS = 0.000001; + + return function ( vFrom, vTo ) { + if ( v1 === undefined ) v1 = new MathUtil.Vector3(); + + r = vFrom.dot( vTo ) + 1; + + if ( r < EPS ) { + r = 0; + + if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) { + v1.set( - vFrom.y, vFrom.x, 0 ); + } else { + v1.set( 0, - vFrom.z, vFrom.y ); + } + } else { + v1.crossVectors( vFrom, vTo ); + } + + this.x = v1.x; + this.y = v1.y; + this.z = v1.z; + this.w = r; + + this.normalize(); + + return this; + } + }(), + }; + + var mathUtil = MathUtil; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + var Util = window.Util || {}; + + Util.MIN_TIMESTEP = 0.001; + Util.MAX_TIMESTEP = 1; + + Util.base64 = function(mimeType, base64) { + return 'data:' + mimeType + ';base64,' + base64; + }; + + Util.clamp = function(value, min, max) { + return Math.min(Math.max(min, value), max); + }; + + Util.lerp = function(a, b, t) { + return a + ((b - a) * t); + }; + + /** + * Light polyfill for `Promise.race`. Returns + * a promise that resolves when the first promise + * provided resolves. + * + * @param {Array} promises + */ + Util.race = function(promises) { + if (Promise.race) { + return Promise.race(promises); + } + + return new Promise(function (resolve, reject) { + for (var i = 0; i < promises.length; i++) { + promises[i].then(resolve, reject); + } + }); + }; + + Util.isIOS = (function() { + var isIOS = /iPad|iPhone|iPod/.test(navigator.platform); + return function() { + return isIOS; + }; + })(); + + Util.isWebViewAndroid = (function() { + var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 && + navigator.userAgent.indexOf('Android') !== -1 && + navigator.userAgent.indexOf('Chrome') !== -1; + return function() { + return isWebViewAndroid; + }; + })(); + + Util.isSafari = (function() { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + return function() { + return isSafari; + }; + })(); + + Util.isFirefoxAndroid = (function() { + var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 && + navigator.userAgent.indexOf('Android') !== -1; + return function() { + return isFirefoxAndroid; + }; + })(); + + Util.isR7 = (function() { + var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1; + return function() { + return isR7; + }; + })(); + + Util.isLandscapeMode = function() { + var rtn = (window.orientation == 90 || window.orientation == -90); + return Util.isR7() ? !rtn : rtn; + }; + + // Helper method to validate the time steps of sensor timestamps. + Util.isTimestampDeltaValid = function(timestampDeltaS) { + if (isNaN(timestampDeltaS)) { + return false; + } + if (timestampDeltaS <= Util.MIN_TIMESTEP) { + return false; + } + if (timestampDeltaS > Util.MAX_TIMESTEP) { + return false; + } + return true; + }; + + Util.getScreenWidth = function() { + return Math.max(window.screen.width, window.screen.height) * + window.devicePixelRatio; + }; + + Util.getScreenHeight = function() { + return Math.min(window.screen.width, window.screen.height) * + window.devicePixelRatio; + }; + + Util.requestFullscreen = function(element) { + if (Util.isWebViewAndroid()) { + return false; + } + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else { + return false; + } + + return true; + }; + + Util.exitFullscreen = function() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else { + return false; + } + + return true; + }; + + Util.getFullscreenElement = function() { + return document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement; + }; + + Util.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) { + // No error checking for brevity. + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, vertexSource); + gl.compileShader(vertexShader); + + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, fragmentSource); + gl.compileShader(fragmentShader); + + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + + for (var attribName in attribLocationMap) + gl.bindAttribLocation(program, attribLocationMap[attribName], attribName); + + gl.linkProgram(program); + + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + + return program; + }; + + Util.getProgramUniforms = function(gl, program) { + var uniforms = {}; + var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + var uniformName = ''; + for (var i = 0; i < uniformCount; i++) { + var uniformInfo = gl.getActiveUniform(program, i); + uniformName = uniformInfo.name.replace('[0]', ''); + uniforms[uniformName] = gl.getUniformLocation(program, uniformName); + } + return uniforms; + }; + + Util.orthoMatrix = function (out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; + }; + + Util.copyArray = function (source, dest) { + for (var i = 0, n = source.length; i < n; i++) { + dest[i] = source[i]; + } + }; + + Util.isMobile = function() { + var check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera); + return check; + }; + + Util.extend = function(dest, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dest[key] = src[key]; + } + } + + return dest; + }; + + Util.safariCssSizeWorkaround = function(canvas) { + // TODO(smus): Remove this workaround when Safari for iOS is fixed. + // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556). + // + // "To the last I grapple with thee; + // from hell's heart I stab at thee; + // for hate's sake I spit my last breath at thee." + // -- Moby Dick, by Herman Melville + if (Util.isIOS()) { + var width = canvas.style.width; + var height = canvas.style.height; + canvas.style.width = (parseInt(width) + 1) + 'px'; + canvas.style.height = (parseInt(height)) + 'px'; + setTimeout(function() { + canvas.style.width = width; + canvas.style.height = height; + }, 100); + } + + // Debug only. + window.Util = Util; + window.canvas = canvas; + }; + + Util.isDebug = function() { + return Util.getQueryParameter('debug'); + }; + + Util.getQueryParameter = function(name) { + var name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); + }; + + Util.frameDataFromPose = (function() { + var piOver180 = Math.PI / 180.0; + var rad45 = Math.PI * 0.25; + + // Borrowed from glMatrix. + function mat4_perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45), + downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45), + leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45), + rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = ((upTan - downTan) * yScale * 0.5); + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = (far * near) / (near - far); + out[15] = 0.0; + return out; + } + + function mat4_fromRotationTranslation(out, q, v) { + // Quaternion math + var x = q[0], y = q[1], z = q[2], w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; + } + function mat4_translate(out, a, v) { + var x = v[0], y = v[1], z = v[2], + a00, a01, a02, a03, + a10, a11, a12, a13, + a20, a21, a22, a23; + + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; + a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; + a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; + + out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; + out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; + out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; + + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + + return out; + } + function mat4_invert(out, a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], + a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], + a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], + a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], + + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + + // Calculate the determinant + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; + } + var defaultOrientation = new Float32Array([0, 0, 0, 1]); + var defaultPosition = new Float32Array([0, 0, 0]); + + function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) { + mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar); + + var orientation = pose.orientation || defaultOrientation; + var position = pose.position || defaultPosition; + + mat4_fromRotationTranslation(view, orientation, position); + if (parameters) + mat4_translate(view, view, parameters.offset); + mat4_invert(view, view); + } + + return function(frameData, pose, vrDisplay) { + if (!frameData || !pose) + return false; + + frameData.pose = pose; + frameData.timestamp = pose.timestamp; + + updateEyeMatrices( + frameData.leftProjectionMatrix, frameData.leftViewMatrix, + pose, vrDisplay.getEyeParameters("left"), vrDisplay); + updateEyeMatrices( + frameData.rightProjectionMatrix, frameData.rightViewMatrix, + pose, vrDisplay.getEyeParameters("right"), vrDisplay); + + return true; + }; + })(); + + Util.isInsideCrossDomainIFrame = function() { + var isFramed = (window.self !== window.top); + var refDomain = Util.getDomainFromUrl(document.referrer); + var thisDomain = Util.getDomainFromUrl(window.location.href); + + return isFramed && (refDomain !== thisDomain); + }; + + // From http://stackoverflow.com/a/23945027. + Util.getDomainFromUrl = function(url) { + var domain; + // Find & remove protocol (http, ftp, etc.) and get domain. + if (url.indexOf("://") > -1) { + domain = url.split('/')[2]; + } + else { + domain = url.split('/')[0]; + } + + //find & remove port number + domain = domain.split(':')[0]; + + return domain; + }; + + var util$1 = Util; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + /** + * Given an orientation and the gyroscope data, predicts the future orientation + * of the head. This makes rendering appear faster. + * + * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf + * + * @param {Number} predictionTimeS time from head movement to the appearance of + * the corresponding image. + */ + function PosePredictor(predictionTimeS) { + this.predictionTimeS = predictionTimeS; + + // The quaternion corresponding to the previous state. + this.previousQ = new mathUtil.Quaternion(); + // Previous time a prediction occurred. + this.previousTimestampS = null; + + // The delta quaternion that adjusts the current pose. + this.deltaQ = new mathUtil.Quaternion(); + // The output quaternion. + this.outQ = new mathUtil.Quaternion(); + } + + PosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) { + if (!this.previousTimestampS) { + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return currentQ; + } + + // Calculate axis and angle based on gyroscope rotation rate data. + var axis = new mathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + + var angularSpeed = gyro.length(); + + // If we're rotating slowly, don't do prediction. + if (angularSpeed < mathUtil.degToRad * 20) { + if (util$1.isDebug()) { + console.log('Moving slowly, at %s deg/s: no prediction', + (mathUtil.radToDeg * angularSpeed).toFixed(1)); + } + this.outQ.copy(currentQ); + this.previousQ.copy(currentQ); + return this.outQ; + } + + // Get the predicted angle based on the time delta and latency. + var deltaT = timestampS - this.previousTimestampS; + var predictAngle = angularSpeed * this.predictionTimeS; + + this.deltaQ.setFromAxisAngle(axis, predictAngle); + this.outQ.copy(this.previousQ); + this.outQ.multiply(this.deltaQ); + + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + + return this.outQ; + }; + + + var posePredictor = PosePredictor; + + /** + * Returns a number value indiciating the version of Chrome being used, + * or otherwise `null` if not on Chrome. + * + * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19 + */ + + /** + * In Chrome m65, `devicemotion` events are broken but subsequently fixed + * in 65.0.3325.148. Since many browsers use Chromium, ensure that + * we scope this detection by branch and build numbers to provide + * a proper fallback. + * https://github.com/immersive-web/webvr-polyfill/issues/307 + */ + + var version = -1; // It should not be null because it will be compared with number + + var branch = null; + var build = null; + var match = /Chrome\/([0-9]+)\.(?:[0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(userAgent); + + if (match) { + version = parseInt(match[1], 10); + branch = match[2]; + build = match[3]; + } + + var CHROME_VERSION = version; + var IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === "3325" && parseInt(build, 10) < 148; + var IS_ANDROID = /Android/i.test(userAgent); + var CONTROL_MODE_VR = 1; + var CONTROL_MODE_YAWPITCH = 2; + var TOUCH_DIRECTION_NONE = 1; + var TOUCH_DIRECTION_YAW = 2; + var TOUCH_DIRECTION_PITCH = 4; + var TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH; + /* Const for MovableCoord */ + + var MC_DECELERATION = 0.0014; + var MC_MAXIMUM_DURATION = 1000; + var MC_BIND_SCALE = [0.20, 0.20]; + var MAX_FIELD_OF_VIEW = 110; + var PAN_SCALE = 320; // const DELTA_THRESHOLD = 0.015; + + var YAW_RANGE_HALF = 180; + var PITCH_RANGE_HALF = 90; + var CIRCULAR_PITCH_RANGE_HALF = 180; + var GYRO_MODE = { + NONE: "none", + YAWPITCH: "yawPitch", + VR: "VR" + }; + + var STILLNESS_THRESHOLD = 200; // millisecond + + var DeviceMotion = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(DeviceMotion, _Component); + + function DeviceMotion() { + var _this; + + _this = _Component.call(this) || this; + _this._onDeviceMotion = _this._onDeviceMotion.bind(_assertThisInitialized(_this)); + _this._onDeviceOrientation = _this._onDeviceOrientation.bind(_assertThisInitialized(_this)); + _this._onChromeWithoutDeviceMotion = _this._onChromeWithoutDeviceMotion.bind(_assertThisInitialized(_this)); + _this.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION; + _this.isAndroid = IS_ANDROID; + _this.stillGyroVec = create$4(); + _this.rawGyroVec = create$4(); + _this.adjustedGyroVec = create$4(); + _this._timer = null; + _this.lastDevicemotionTimestamp = 0; + _this._isEnabled = false; + + _this.enable(); + + return _this; + } + + var _proto = DeviceMotion.prototype; + + _proto._onChromeWithoutDeviceMotion = function _onChromeWithoutDeviceMotion(e) { + var alpha = e.alpha, + beta = e.beta, + gamma = e.gamma; // There is deviceorientation event trigged with empty values + // on Headless Chrome. + + if (alpha === null) { + return; + } // convert to radian + + + alpha = (alpha || 0) * Math.PI / 180; + beta = (beta || 0) * Math.PI / 180; + gamma = (gamma || 0) * Math.PI / 180; + this.trigger("devicemotion", { + inputEvent: { + deviceorientation: { + alpha: alpha, + beta: beta, + gamma: -gamma + } + } + }); + }; + + _proto._onDeviceOrientation = function _onDeviceOrientation() { + var _this2 = this; + + this._timer && clearTimeout(this._timer); + this._timer = setTimeout(function () { + if (new Date().getTime() - _this2.lastDevicemotionTimestamp < STILLNESS_THRESHOLD) { + copy$4(_this2.stillGyroVec, _this2.rawGyroVec); + } + }, STILLNESS_THRESHOLD); + }; + + _proto._onDeviceMotion = function _onDeviceMotion(e) { + // desktop chrome triggers devicemotion event with empthy sensor values. + // Those events should ignored. + var isGyroSensorAvailable = !(e.rotationRate.alpha == null); + var isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null); + + if (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) { + return; + } + + var devicemotionEvent = _extends({}, e); + + devicemotionEvent.interval = e.interval; + devicemotionEvent.timeStamp = e.timeStamp; + devicemotionEvent.type = e.type; + devicemotionEvent.rotationRate = { + alpha: e.rotationRate.alpha, + beta: e.rotationRate.beta, + gamma: e.rotationRate.gamma + }; + devicemotionEvent.accelerationIncludingGravity = { + x: e.accelerationIncludingGravity.x, + y: e.accelerationIncludingGravity.y, + z: e.accelerationIncludingGravity.z + }; + devicemotionEvent.acceleration = { + x: e.acceleration.x, + y: e.acceleration.y, + z: e.acceleration.z + }; + + if (this.isAndroid) { + set$5(this.rawGyroVec, e.rotationRate.alpha || 0, e.rotationRate.beta || 0, e.rotationRate.gamma || 0); + subtract$4(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec); + this.lastDevicemotionTimestamp = new Date().getTime(); + devicemotionEvent.adjustedRotationRate = { + alpha: this.adjustedGyroVec[0], + beta: this.adjustedGyroVec[1], + gamma: this.adjustedGyroVec[2] + }; + } + + this.trigger("devicemotion", { + inputEvent: devicemotionEvent + }); + }; + + _proto.enable = function enable() { + if (this.isAndroid) { + win.addEventListener("deviceorientation", this._onDeviceOrientation); + } + + if (this.isWithoutDeviceMotion) { + win.addEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + } else { + win.addEventListener("devicemotion", this._onDeviceMotion); + } + + this._isEnabled = true; + }; + + _proto.disable = function disable() { + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("deviceorientation", this._onChromeWithoutDeviceMotion); + win.removeEventListener("devicemotion", this._onDeviceMotion); + this._isEnabled = false; + }; + + return DeviceMotion; + }(Component); + + function SensorSample(sample, timestampS) { + this.set(sample, timestampS); + } + SensorSample.prototype.set = function(sample, timestampS) { + this.sample = sample; + this.timestampS = timestampS; + }; + + SensorSample.prototype.copy = function(sensorSample) { + this.set(sensorSample.sample, sensorSample.timestampS); + }; + + var sensorSample = SensorSample; + + /* + * Copyright 2015 Google Inc. 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + + + + /** + * An implementation of a simple complementary filter, which fuses gyroscope and + * accelerometer data from the 'devicemotion' event. + * + * Accelerometer data is very noisy, but stable over the long term. + * Gyroscope data is smooth, but tends to drift over the long term. + * + * This fusion is relatively simple: + * 1. Get orientation estimates from accelerometer by applying a low-pass filter + * on that data. + * 2. Get orientation estimates from gyroscope by integrating over time. + * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the + * short term. + */ + function ComplementaryFilter(kFilter) { + this.kFilter = kFilter; + + // Raw sensor measurements. + this.currentAccelMeasurement = new sensorSample(); + this.currentGyroMeasurement = new sensorSample(); + this.previousGyroMeasurement = new sensorSample(); + + // Set default look direction to be in the correct direction. + if (util$1.isIOS()) { + this.filterQ = new mathUtil.Quaternion(-1, 0, 0, 1); + } else { + this.filterQ = new mathUtil.Quaternion(1, 0, 0, 1); + } + this.previousFilterQ = new mathUtil.Quaternion(); + this.previousFilterQ.copy(this.filterQ); + + // Orientation based on the accelerometer. + this.accelQ = new mathUtil.Quaternion(); + // Whether or not the orientation has been initialized. + this.isOrientationInitialized = false; + // Running estimate of gravity based on the current orientation. + this.estimatedGravity = new mathUtil.Vector3(); + // Measured gravity based on accelerometer. + this.measuredGravity = new mathUtil.Vector3(); + + // Debug only quaternion of gyro-based orientation. + this.gyroIntegralQ = new mathUtil.Quaternion(); + } + + ComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) { + this.currentAccelMeasurement.set(vector, timestampS); + }; + + ComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) { + this.currentGyroMeasurement.set(vector, timestampS); + + var deltaT = timestampS - this.previousGyroMeasurement.timestampS; + if (util$1.isTimestampDeltaValid(deltaT)) { + this.run_(); + } + + this.previousGyroMeasurement.copy(this.currentGyroMeasurement); + }; + + ComplementaryFilter.prototype.run_ = function() { + + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - + this.previousGyroMeasurement.timestampS; + + // Convert gyro rotation vector to a quaternion delta. + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); + + // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); + + // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + var invFilterQ = new mathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); + + // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + var deltaQ = new mathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); + + if (util$1.isDebug()) { + console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)', + mathUtil.radToDeg * util$1.getQuaternionAngle(deltaQ), + (this.estimatedGravity.x).toFixed(1), + (this.estimatedGravity.y).toFixed(1), + (this.estimatedGravity.z).toFixed(1), + (this.measuredGravity.x).toFixed(1), + (this.measuredGravity.y).toFixed(1), + (this.measuredGravity.z).toFixed(1)); + } + + // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + var targetQ = new mathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); + + // SLERP factor: 0 is pure gyro, 1 is pure accel. + this.filterQ.slerp(targetQ, 1 - this.kFilter); + + this.previousFilterQ.copy(this.filterQ); + }; + + ComplementaryFilter.prototype.getOrientation = function() { + return this.filterQ; + }; + + ComplementaryFilter.prototype.accelToQuaternion_ = function(accel) { + var normAccel = new mathUtil.Vector3(); + normAccel.copy(accel); + normAccel.normalize(); + var quat = new mathUtil.Quaternion(); + quat.setFromUnitVectors(new mathUtil.Vector3(0, 0, -1), normAccel); + quat.inverse(); + return quat; + }; + + ComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) { + // Extract axis and angle from the gyroscope data. + var quat = new mathUtil.Quaternion(); + var axis = new mathUtil.Vector3(); + axis.copy(gyro); + axis.normalize(); + quat.setFromAxisAngle(axis, gyro.length() * dt); + return quat; + }; + + + var complementaryFilter = ComplementaryFilter; + + complementaryFilter.prototype.run_ = function () { + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + + var deltaT = this.currentGyroMeasurement.timestampS - this.previousGyroMeasurement.timestampS; // Convert gyro rotation vector to a quaternion delta. + + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel. + + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); // Calculate the delta between the current estimated gravity and the real + // gravity vector from accelerometer. + + var invFilterQ = new mathUtil.Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); // Compare estimated gravity with measured gravity, get the delta quaternion + // between the two. + + var deltaQ = new mathUtil.Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); // Calculate the SLERP target: current orientation plus the measured-estimated + // quaternion delta. + + var targetQ = new mathUtil.Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); // SLERP factor: 0 is pure gyro, 1 is pure accel. + + this.filterQ.slerp(targetQ, 1 - this.kFilter); + this.previousFilterQ.copy(this.filterQ); + + if (!this.isFilterQuaternionInitialized) { + this.isFilterQuaternionInitialized = true; + } + }; + + complementaryFilter.prototype.getOrientation = function () { + if (this.isFilterQuaternionInitialized) { + return this.filterQ; + } else { + return null; + } + }; + + var K_FILTER = 0.98; + var PREDICTION_TIME_S = 0.040; + + var FusionPoseSensor = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(FusionPoseSensor, _Component); + + function FusionPoseSensor() { + var _this; + + _this = _Component.call(this) || this; + _this.deviceMotion = new DeviceMotion(); + _this.accelerometer = new mathUtil.Vector3(); + _this.gyroscope = new mathUtil.Vector3(); + _this._onDeviceMotionChange = _this._onDeviceMotionChange.bind(_assertThisInitialized(_this)); + _this._onScreenOrientationChange = _this._onScreenOrientationChange.bind(_assertThisInitialized(_this)); + _this.filter = new complementaryFilter(K_FILTER); + _this.posePredictor = new posePredictor(PREDICTION_TIME_S); + _this.filterToWorldQ = new mathUtil.Quaternion(); + _this.isFirefoxAndroid = util$1.isFirefoxAndroid(); // This includes iPhone & iPad(both desktop and mobile mode) ref #326 + + _this.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP; // Ref https://github.com/immersive-web/cardboard-vr-display/issues/18 + + _this.isChromeUsingDegrees = CHROME_VERSION >= 66; + _this._isEnabled = false; // Set the filter to world transform, depending on OS. + + if (_this.isIOS) { + _this.filterToWorldQ.setFromAxisAngle(new mathUtil.Vector3(1, 0, 0), Math.PI / 2); + } else { + _this.filterToWorldQ.setFromAxisAngle(new mathUtil.Vector3(1, 0, 0), -Math.PI / 2); + } + + _this.inverseWorldToScreenQ = new mathUtil.Quaternion(); + _this.worldToScreenQ = new mathUtil.Quaternion(); + _this.originalPoseAdjustQ = new mathUtil.Quaternion(); + + _this.originalPoseAdjustQ.setFromAxisAngle(new mathUtil.Vector3(0, 0, 1), -win.orientation * Math.PI / 180); + + _this._setScreenTransform(); // Adjust this filter for being in landscape mode. + + + if (util$1.isLandscapeMode()) { + _this.filterToWorldQ.multiply(_this.inverseWorldToScreenQ); + } // Keep track of a reset transform for resetSensor. + + + _this.resetQ = new mathUtil.Quaternion(); + + _this.deviceMotion.on("devicemotion", _this._onDeviceMotionChange); + + _this.enable(); + + return _this; + } + + var _proto = FusionPoseSensor.prototype; + + _proto.enable = function enable() { + if (this.isEnabled()) { + return; + } + + this.deviceMotion.enable(); + this._isEnabled = true; + win.addEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.disable = function disable() { + if (!this.isEnabled()) { + return; + } + + this.deviceMotion.disable(); + this._isEnabled = false; + win.removeEventListener("orientationchange", this._onScreenOrientationChange); + }; + + _proto.isEnabled = function isEnabled() { + return this._isEnabled; + }; + + _proto.destroy = function destroy() { + this.disable(); + this.deviceMotion = null; + }; + + _proto._triggerChange = function _triggerChange() { + var orientation = this.getOrientation(); // if orientation is not prepared. don't trigger change event + + if (!orientation) { + return; + } + + if (!this._prevOrientation) { + this._prevOrientation = orientation; + return; + } + + if (equals$7(this._prevOrientation, orientation)) { + return; + } + + this.trigger("change", { + quaternion: orientation + }); + }; + + _proto.getOrientation = function getOrientation() { + var _this2 = this; + + var orientation; // Hack around using deviceorientation instead of devicemotion + + if (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) { + this.deviceOrientationFixQ = this.deviceOrientationFixQ || function () { + var y = new mathUtil.Quaternion().setFromAxisAngle(new mathUtil.Vector3(0, 1, 0), -_this2._alpha); + return y; + }(); + + orientation = this._deviceOrientationQ; + var out = new mathUtil.Quaternion(); + out.copy(orientation); + out.multiply(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.worldToScreenQ); + out.multiplyQuaternions(this.deviceOrientationFixQ, out); // return quaternion as glmatrix quaternion object + + var out_ = fromValues$6(out.x, out.y, out.z, out.w); + return normalize$2(out_, out_); + } else { + // Convert from filter space to the the same system used by the + // deviceorientation event. + orientation = this.filter.getOrientation(); + + if (!orientation) { + return null; + } + + var _out = this._convertFusionToPredicted(orientation); // return quaternion as glmatrix quaternion object + + + var _out_ = fromValues$6(_out.x, _out.y, _out.z, _out.w); + + return normalize$2(_out_, _out_); + } + }; + + _proto._convertFusionToPredicted = function _convertFusionToPredicted(orientation) { + // Predict orientation. + this.predictedQ = this.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS); // Convert to THREE coordinate system: -Z forward, Y up, X right. + + var out = new mathUtil.Quaternion(); + out.copy(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.predictedQ); + out.multiply(this.worldToScreenQ); + return out; + }; + + _proto._onDeviceMotionChange = function _onDeviceMotionChange(_ref) { + var inputEvent = _ref.inputEvent; + var deviceorientation = inputEvent.deviceorientation; + var deviceMotion = inputEvent; + var accGravity = deviceMotion.accelerationIncludingGravity; + var rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate; + var timestampS = deviceMotion.timeStamp / 1000; + + if (deviceorientation) { + if (!this._alpha) { + this._alpha = deviceorientation.alpha; + } + + this._deviceOrientationQ = this._deviceOrientationQ || new mathUtil.Quaternion(); + + this._deviceOrientationQ.setFromEulerYXZ(deviceorientation.beta, deviceorientation.alpha, deviceorientation.gamma); + + this._triggerChange(); + } else { + // Firefox Android timeStamp returns one thousandth of a millisecond. + if (this.isFirefoxAndroid) { + timestampS /= 1000; + } + + this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); + this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); // Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate` + // is reported in degrees, so we first convert to radians. + + if (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) { + this.gyroscope.multiplyScalar(Math.PI / 180); + } + + this.filter.addAccelMeasurement(this.accelerometer, timestampS); + this.filter.addGyroMeasurement(this.gyroscope, timestampS); + + this._triggerChange(); + + this.previousTimestampS = timestampS; + } + }; + + _proto._onScreenOrientationChange = function _onScreenOrientationChange(screenOrientation) { + this._setScreenTransform(win.orientation); + }; + + _proto._setScreenTransform = function _setScreenTransform() { + this.worldToScreenQ.set(0, 0, 0, 1); + var orientation = win.orientation; + + switch (orientation) { + case 0: + break; + + case 90: + case -90: + case 180: + this.worldToScreenQ.setFromAxisAngle(new mathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI); + break; + + default: + break; + } + + this.inverseWorldToScreenQ.copy(this.worldToScreenQ); + this.inverseWorldToScreenQ.inverse(); + }; + + return FusionPoseSensor; + }(Component); + + function getDeltaYaw$1(prvQ, curQ) { + var yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW); + var yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) * Math.sin(util.extractPitchFromQuat(curQ)); + return yawDeltaByRoll + yawDeltaByYaw; + } + + function getDeltaPitch$1(prvQ, curQ) { + var pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA); + return pitchDelta; + } + + var TiltMotionInput = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(TiltMotionInput, _Component); + + function TiltMotionInput(el, options) { + var _this; + + _this = _Component.call(this) || this; + _this.element = el; + _this._prevQuaternion = null; + _this._quaternion = null; + _this.fusionPoseSensor = null; + _this.options = _extends({ + scale: 1, + threshold: 0 + }, options); + _this._onPoseChange = _this._onPoseChange.bind(_assertThisInitialized(_this)); + return _this; + } + + var _proto = TiltMotionInput.prototype; + + _proto.mapAxes = function mapAxes(axes) { + this.axes = axes; + }; + + _proto.connect = function connect(observer) { + if (this.observer) { + return this; + } + + this.observer = observer; + this.fusionPoseSensor = new FusionPoseSensor(); + this.fusionPoseSensor.enable(); + + this._attachEvent(); + + return this; + }; + + _proto.disconnect = function disconnect() { + if (!this.observer) { + return this; + } + + this._dettachEvent(); + + this.fusionPoseSensor.disable(); + this.fusionPoseSensor.destroy(); + this.fusionPoseSensor = null; + this.observer = null; + return this; + }; + + _proto.destroy = function destroy() { + this.disconnect(); + this.element = null; + this.options = null; + this.axes = null; + this._prevQuaternion = null; + this._quaternion = null; + }; + + _proto._onPoseChange = function _onPoseChange(event) { + if (!this._prevQuaternion) { + this._prevQuaternion = clone$6(event.quaternion); + this._quaternion = clone$6(event.quaternion); + return; + } + + copy$6(this._prevQuaternion, this._quaternion); + copy$6(this._quaternion, event.quaternion); + this.observer.change(this, event, toAxis$1(this.axes, [getDeltaYaw$1(this._prevQuaternion, this._quaternion), getDeltaPitch$1(this._prevQuaternion, this._quaternion)])); + }; + + _proto._attachEvent = function _attachEvent() { + this.fusionPoseSensor.on("change", this._onPoseChange); + }; + + _proto._dettachEvent = function _dettachEvent() { + this.fusionPoseSensor.off("change", this._onPoseChange); + }; + + return TiltMotionInput; + }(Component); + + var screenRotationAngleInst = null; + var refCount = 0; + + var ScreenRotationAngle = + /*#__PURE__*/ + function () { + function ScreenRotationAngle() { + refCount++; + + if (screenRotationAngleInst) { + return screenRotationAngleInst; + } + /* eslint-disable */ + + + screenRotationAngleInst = this; + /* eslint-enable */ + + this._onDeviceOrientation = this._onDeviceOrientation.bind(this); + this._onOrientationChange = this._onOrientationChange.bind(this); + this._spinR = 0; + this._screenOrientationAngle = 0; + win.addEventListener("deviceorientation", this._onDeviceOrientation); + win.addEventListener("orientationchange", this._onOrientationChange); + } + + var _proto = ScreenRotationAngle.prototype; + + _proto._onDeviceOrientation = function _onDeviceOrientation(e) { + if (e.beta === null || e.gamma === null) { + // (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it. + return; + } // Radian + + + var betaR = toRadian(e.beta); + var gammaR = toRadian(e.gamma); + /* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */ + + this._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR)); + }; + + _proto._onOrientationChange = function _onOrientationChange(e) { + if (win.screen && win.screen.orientation && win.screen.orientation.angle !== undefined) { + this._screenOrientationAngle = screen.orientation.angle; + } else if (win.orientation !== undefined) { + /* iOS */ + this._screenOrientationAngle = win.orientation >= 0 ? win.orientation : 360 + win.orientation; + } + }; + + _proto.getRadian = function getRadian() { + // Join with screen orientation + // this._testVal = this._spinR + ", " + this._screenOrientationAngle + ", " + window.orientation; + return this._spinR + toRadian(this._screenOrientationAngle); + }; + + _proto.unref = function unref() { + if (--refCount > 0) { + return; + } + + win.removeEventListener("deviceorientation", this._onDeviceOrientation); + win.removeEventListener("orientationchange", this._onOrientationChange); + this._spinR = 0; + this._screenOrientationAngle = 0; + /* eslint-disable */ + + screenRotationAngleInst = null; + /* eslint-enable */ + + refCount = 0; + }; + + return ScreenRotationAngle; + }(); + + /** + * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle. + * + * The reason for using this function is that in VR mode, + * the roll angle is adjusted in the direction opposite to the screen rotation angle. + * + * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move. + * @extends PanInput + */ + + var RotationPanInput = + /*#__PURE__*/ + function (_PanInput) { + _inheritsLoose(RotationPanInput, _PanInput); + + /** + * Constructor + * + * @private + * @param {HTMLElement} el target element + * @param {Object} [options] The option object + * @param {Boolean} [options.useRotation] Whether to use rotation(or VR) + */ + function RotationPanInput(el, options) { + var _this; + + _this = _PanInput.call(this, el, options) || this; + _this._useRotation = false; + _this._screenRotationAngle = null; + + _this.setUseRotation(!!(options && options.useRotation)); + + _this._userDirection = Axes.DIRECTION_ALL; + return _this; + } + + var _proto = RotationPanInput.prototype; + + _proto.setUseRotation = function setUseRotation(useRotation) { + this._useRotation = useRotation; + + if (this._screenRotationAngle) { + this._screenRotationAngle.unref(); + + this._screenRotationAngle = null; + } + + if (this._useRotation) { + this._screenRotationAngle = new ScreenRotationAngle(); + } + }; + + _proto.connect = function connect(observer) { + // User intetened direction + this._userDirection = this._direction; // In VR Mode, Use ALL direction if direction is not none + // Because horizontal and vertical is changed dynamically by screen rotation. + // this._direction is used to initialize hammerjs + + if (this._useRotation && this._direction & Axes.DIRECTION_ALL) { + this._direction = Axes.DIRECTION_HORIZONTAL; + } + + _PanInput.prototype.connect.call(this, observer); + }; + + _proto.getOffset = function getOffset(properties, useDirection) { + if (this._useRotation === false) { + return _PanInput.prototype.getOffset.call(this, properties, useDirection); + } + + var offset = _PanInput.prototype.getOffset.call(this, properties, [true, true]); + + var newOffset = [0, 0]; + + var theta = this._screenRotationAngle.getRadian(); + + var cosTheta = Math.cos(theta); + var sinTheta = Math.sin(theta); // RotateZ + + newOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta; + newOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta; // Use only user allowed direction. + + if (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) { + newOffset[0] = 0; + } else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) { + newOffset[1] = 0; + } + + return newOffset; + }; + + _proto.destroy = function destroy() { + if (this._useRotation) { + this._screenRotationAngle && this._screenRotationAngle.unref(); + } + + _PanInput.prototype.destroy.call(this); + }; + + return RotationPanInput; + }(PanInput); + + var Y_AXIS_VECTOR = fromValues$4(0, 1, 0); + + var DeviceQuaternion = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(DeviceQuaternion, _Component); + + function DeviceQuaternion() { + var _this; + + _this = _Component.call(this) || this; + _this._fusionPoseSensor = new FusionPoseSensor(); + _this._quaternion = create$6(); + + _this._fusionPoseSensor.enable(); + + _this._fusionPoseSensor.on("change", function (e) { + _this._quaternion = e.quaternion; + + _this.trigger("change", { + isTrusted: true + }); + }); + + return _this; + } + + var _proto = DeviceQuaternion.prototype; + + _proto.getCombinedQuaternion = function getCombinedQuaternion(yaw) { + var yawQ = setAxisAngle(create$6(), Y_AXIS_VECTOR, toRadian(-yaw)); + var conj = conjugate(create$6(), this._quaternion); // Multiply pitch quaternion -> device quaternion -> yaw quaternion + + var outQ = multiply$6(create$6(), conj, yawQ); + return outQ; + }; + + _proto.destroy = function destroy() { + // detach all event handler + this.off(); + + if (this._fusionPoseSensor) { + this._fusionPoseSensor.off(); + + this._fusionPoseSensor.destroy(); + + this._fusionPoseSensor = null; + } + }; + + return DeviceQuaternion; + }(Component); + + var VERSION = "3.3.3"; + + var DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF]; + var DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF]; + var CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF]; + /** + * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates. + * + * @alias eg.YawPitchControl + * @extends eg.Component + * + * @support {"ie": "10+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + */ + + var YawPitchControl = + /*#__PURE__*/ + function () { + var YawPitchControl = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(YawPitchControl, _Component); + + // Expose DeviceOrientationControls sub module for test purpose + + /** + * @param {Object} options The option object of the eg.YawPitch module + * @param {Element}[options.element=null] element A base element for the eg.YawPitch module + * @param {Number} [options.yaw=0] initial yaw (degree) + * @param {Number} [options.pitch=0] initial pitch (degree) + * @param {Number} [options.fov=65] initial field of view (degree) + * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown + * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available + * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. + * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move) + * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw + * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch + * @param {Array} [options.fovRange=[30, 110] Range of FOV + * @param {Number} [options.aspectRatio=1] Aspect Ratio + */ + function YawPitchControl(options) { + var _this; + + _this = _Component.call(this) || this; + + var opt = _extends({ + element: null, + yaw: 0, + pitch: 0, + fov: 65, + showPolePoint: false, + useZoom: true, + useKeyboard: true, + gyroMode: GYRO_MODE.YAWPITCH, + touchDirection: TOUCH_DIRECTION_ALL, + yawRange: DEFAULT_YAW_RANGE, + pitchRange: DEFAULT_PITCH_RANGE, + fovRange: [30, 110], + aspectRatio: 1 + /* TODO: Need Mandatory? */ + + }, options); + + _this._element = opt.element; + _this._initialFov = opt.fov; + _this._enabled = false; + _this._isAnimating = false; + _this._deviceQuaternion = null; + + _this._initAxes(opt); + + _this.option(opt); + + return _this; + } + + var _proto = YawPitchControl.prototype; + + _proto._initAxes = function _initAxes(opt) { + var _this2 = this; + + var yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio); + + var pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint); + + var useRotation = opt.gyroMode === GYRO_MODE.VR; + this.axesPanInput = new RotationPanInput(this._element, { + useRotation: useRotation + }); + this.axesWheelInput = new WheelInput(this._element, { + scale: -4 + }); + this.axesTiltMotionInput = null; + this.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, { + scale: -1 + }) : null; + this.axesMoveKeyInput = new MoveKeyInput(this._element, { + scale: [-6, 6] + }); + this.axes = new Axes({ + yaw: { + range: yRange, + circular: YawPitchControl.isCircular(yRange), + bounce: [0, 0] + }, + pitch: { + range: pRange, + circular: YawPitchControl.isCircular(pRange), + bounce: [0, 0] + }, + fov: { + range: opt.fovRange, + circular: [false, false], + bounce: [0, 0] + } + }, { + deceleration: MC_DECELERATION, + maximumDuration: MC_MAXIMUM_DURATION + }, { + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }).on({ + hold: function hold(evt) { + // Restore maximumDuration not to be spin too mush. + _this2.axes.options.maximumDuration = MC_MAXIMUM_DURATION; + + _this2.trigger("hold", { + isTrusted: evt.isTrusted + }); + }, + change: function change(evt) { + if (evt.delta.fov !== 0) { + _this2._updateControlScale(evt); + + _this2.updatePanScale(); + } + + _this2._triggerChange(evt); + }, + release: function release(evt) { + _this2._triggerChange(evt); + }, + animationStart: function animationStart(evt) {}, + animationEnd: function animationEnd(evt) { + _this2.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + } + /** + * Update Pan Scale + * + * Scale(Sensitivity) values of panning is related with fov and height. + * If at least one of them is changed, this function need to be called. + * @param {*} param + */ + ; + + _proto.updatePanScale = function updatePanScale(param) { + if (param === void 0) { + param = {}; + } + + var fov = this.axes.get().fov; + var areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10); + var scale$$1 = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight; + this.axesPanInput.options.scale = [scale$$1, scale$$1]; + this.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW; + return this; + } + /* + * Override component's option method + * to call method for updating values which is affected by option change. + * + * @param {*} args + */ + ; + + _proto.option = function option() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var argLen = args.length; // Getter + + if (argLen === 0) { + return this._getOptions(); + } else if (argLen === 1 && typeof args[0] === "string") { + return this._getOptions(args[0]); + } // Setter + + + var beforeOptions = _extends({}, this.options); + + var newOptions = {}; + var changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList. + + if (argLen === 1) { + changedKeyList = Object.keys(args[0]); + newOptions = _extends({}, args[0]); + } else if (argLen >= 2) { + changedKeyList.push(args[0]); + newOptions[args[0]] = args[1]; + } + + this._setOptions(this._getValidatedOptions(newOptions)); + + this._applyOptions(changedKeyList, beforeOptions); + + return this; + }; + + _proto._getValidatedOptions = function _getValidatedOptions(newOptions) { + if (newOptions.yawRange) { + newOptions.yawRange = this._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio); + } + + if (newOptions.pitchRange) { + newOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov); + } + + return newOptions; + }; + + _proto._getOptions = function _getOptions(key) { + var value; + + if (typeof key === "string") { + value = this.options[key]; + } else if (arguments.length === 0) { + value = this.options; + } + + return value; + }; + + _proto._setOptions = function _setOptions(options) { + for (var key in options) { + this.options[key] = options[key]; + } + }; + + _proto._applyOptions = function _applyOptions(keys, prevOptions) { + var options = this.options; + var axes = this.axes; + var isVR = options.gyroMode === GYRO_MODE.VR; + var isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH; // If it's VR mode, restrict user interaction to yaw direction only + + var touchDirection = isVR ? TOUCH_DIRECTION_YAW & options.touchDirection : options.touchDirection; // If one of below is changed, call updateControlScale() + + if (keys.some(function (key) { + return key === "showPolePoint" || key === "fov" || key === "aspectRatio" || key === "yawRange" || key === "pitchRange"; + })) { + // If fov is changed, update pan scale + if (keys.indexOf("fov") >= 0) { + axes.setTo({ + "fov": options.fov + }); + this.updatePanScale(); + } + + this._updateControlScale(); + } + + if (keys.some(function (key) { + return key === "fovRange"; + })) { + var fovRange = options.fovRange; + var prevFov = axes.get().fov; + var nextFov = axes.get().fov; + copy$8(axes.axis.fov.range, fovRange); + + if (nextFov < fovRange[0]) { + nextFov = fovRange[0]; + } else if (prevFov > fovRange[1]) { + nextFov = fovRange[1]; + } + + if (prevFov !== nextFov) { + axes.setTo({ + fov: nextFov + }, 0); + + this._updateControlScale(); + + this.updatePanScale(); + } + } + + if (keys.some(function (key) { + return key === "gyroMode"; + }) && SUPPORT_DEVICEMOTION) { + // Disconnect first + if (this.axesTiltMotionInput) { + this.axes.disconnect(this.axesTiltMotionInput); + this.axesTiltMotionInput.destroy(); + this.axesTiltMotionInput = null; + } + + if (this._deviceQuaternion) { + this._deviceQuaternion.destroy(); + + this._deviceQuaternion = null; + } + + if (isVR) { + this._initDeviceQuaternion(); + } else if (isYawPitch) { + this.axesTiltMotionInput = new TiltMotionInput(this._element); + this.axes.connect(["yaw", "pitch"], this.axesTiltMotionInput); + } + + this.axesPanInput.setUseRotation(isVR); + } + + if (keys.some(function (key) { + return key === "useKeyboard"; + })) { + var useKeyboard = options.useKeyboard; + + if (useKeyboard) { + axes.connect(["yaw", "pitch"], this.axesMoveKeyInput); + } else { + axes.disconnect(this.axesMoveKeyInput); + } + } + + if (keys.some(function (key) { + return key === "useZoom"; + })) { + var useZoom = options.useZoom; // Disconnect first + + axes.disconnect(this.axesWheelInput); + + if (useZoom) { + axes.connect(["fov"], this.axesWheelInput); + } + } + + this._togglePinchInputByOption(options.touchDirection, options.useZoom); + + if (keys.some(function (key) { + return key === "touchDirection"; + })) { + this._enabled && this._enableTouch(touchDirection); + } + }; + + _proto._togglePinchInputByOption = function _togglePinchInputByOption(touchDirection, useZoom) { + if (this.axesPinchInput) { + // disconnect first + this.axes.disconnect(this.axesPinchInput); // If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll. + + if (useZoom && touchDirection === TOUCH_DIRECTION_ALL && // TODO: Get rid of using private property of axes instance. + this.axes._inputs.indexOf(this.axesPinchInput) === -1) { + this.axes.connect(["fov"], this.axesPinchInput); + } + } + }; + + _proto._enableTouch = function _enableTouch(direction) { + // Disconnect first + this.axesPanInput && this.axes.disconnect(this.axesPanInput); + var yawEnabled = direction & TOUCH_DIRECTION_YAW ? "yaw" : null; + var pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? "pitch" : null; + this.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput); + }; + + _proto._initDeviceQuaternion = function _initDeviceQuaternion() { + var _this3 = this; + + this._deviceQuaternion = new DeviceQuaternion(); + + this._deviceQuaternion.on("change", function (e) { + _this3._triggerChange(e); + }); + }; + + _proto._getValidYawRange = function _getValidYawRange(newYawRange, newFov, newAspectRatio) { + var ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1); + var fov = newFov || this.axes.get().fov; + var horizontalFov = fov * ratio; + var isValid = newYawRange[1] - newYawRange[0] >= horizontalFov; + + if (isValid) { + return newYawRange; + } else { + return this.options.yawRange || DEFAULT_YAW_RANGE; + } + }; + + _proto._getValidPitchRange = function _getValidPitchRange(newPitchRange, newFov) { + var fov = newFov || this.axes.get().fov; + var isValid = newPitchRange[1] - newPitchRange[0] >= fov; + + if (isValid) { + return newPitchRange; + } else { + return this.options.pitchRange || DEFAULT_PITCH_RANGE; + } + }; + + YawPitchControl.isCircular = function isCircular(range) { + return range[1] - range[0] < 360 ? [false, false] : [true, true]; + } + /** + * Update yaw/pitch min/max by 5 factor + * + * 1. showPolePoint + * 2. fov + * 3. yawRange + * 4. pitchRange + * 5. aspectRatio + * + * If one of above is changed, call this function + */ + ; + + _proto._updateControlScale = function _updateControlScale(changeEvt) { + var opt = this.options; + var fov = this.axes.get().fov; + + var pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint); + + var yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio); // TODO: If not changed!? + + + var pos = this.axes.get(); + var y = pos.yaw; + var p = pos.pitch; + copy$8(this.axes.axis.yaw.range, yRange); + copy$8(this.axes.axis.pitch.range, pRange); + this.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange); + this.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange); + /** + * update yaw/pitch by it's range. + */ + + if (y < yRange[0]) { + y = yRange[0]; + } else if (y > yRange[1]) { + y = yRange[1]; + } + + if (p < pRange[0]) { + p = pRange[0]; + } else if (p > pRange[1]) { + p = pRange[1]; + } + + if (changeEvt) { + changeEvt.set({ + yaw: y, + pitch: p + }); + } + + this.axes.setTo({ + yaw: y, + pitch: p + }, 0); + return this; + }; + + _proto._updatePitchRange = function _updatePitchRange(pitchRange, fov, showPolePoint) { + if (this.options.gyroMode === GYRO_MODE.VR) { + // Circular pitch on VR + return CIRCULAR_PITCH_RANGE; + } + + var verticalAngle = pitchRange[1] - pitchRange[0]; + var halfFov = fov / 2; + var isPanorama = verticalAngle < 180; + + if (showPolePoint && !isPanorama) { + // Use full pinch range + return pitchRange.concat(); + } // Round value as movableCood do. + + + return [pitchRange[0] + halfFov, pitchRange[1] - halfFov]; + }; + + _proto._updateYawRange = function _updateYawRange(yawRange, fov, aspectRatio) { + if (this.options.gyroMode === GYRO_MODE.VR) { + return DEFAULT_YAW_RANGE; + } + + var horizontalAngle = yawRange[1] - yawRange[0]; + /** + * Full 360 Mode + */ + + if (horizontalAngle >= 360) { + // Don't limit yaw range on Full 360 mode. + return yawRange.concat(); + } + /** + * Panorama mode + */ + // Ref : https://github.com/naver/egjs-view360/issues/290 + + + var halfHorizontalFov = util.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(toRadian(fov / 2)))); // Round value as movableCood do. + + return [yawRange[0] + halfHorizontalFov, yawRange[1] - halfHorizontalFov]; + }; + + _proto._triggerChange = function _triggerChange(evt) { + var pos = this.axes.get(); + var opt = this.options; + var event = { + targetElement: opt.element, + isTrusted: evt.isTrusted + }; + event.yaw = pos.yaw; + event.pitch = pos.pitch; + event.fov = pos.fov; + + if (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) { + event.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + } + + this.trigger("change", event); + } // TODO: makes constant to be logic + ; + + YawPitchControl.adjustAspectRatio = function adjustAspectRatio(input) { + var inputRange = [0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670, 0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19, 1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26, 2.30, 2.60, 3.00, 5.00, 6.00]; + var outputRange = [0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710, 0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15, 1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72, 1.82, 1.92, 2.00, 2.24, 2.30]; + var rangeIdx = -1; + + for (var i = 0; i < inputRange.length - 1; i++) { + if (inputRange[i] <= input && inputRange[i + 1] >= input) { + rangeIdx = i; + break; + } + } + + if (rangeIdx === -1) { + if (inputRange[0] > input) { + return outputRange[0]; + } else { + return outputRange[outputRange[0].length - 1]; + } + } + + var inputA = inputRange[rangeIdx]; + var inputB = inputRange[rangeIdx + 1]; + var outputA = outputRange[rangeIdx]; + var outputB = outputRange[rangeIdx + 1]; + return YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA)); + }; + + YawPitchControl.lerp = function lerp$$1(a, b, fraction) { + return a + fraction * (b - a); + } + /** + * Enable YawPitch functionality + * + * @method eg.YawPitch#enable + */ + ; + + _proto.enable = function enable() { + if (this._enabled) { + return this; + } + + this._enabled = true; // touchDirection is decided by parameter is valid string (Ref. Axes.connect) + + this._applyOptions(Object.keys(this.options), this.options); // TODO: Is this code is needed? Check later. + + + this.updatePanScale(); + return this; + } + /** + * Disable YawPitch functionality + * + * @method eg.YawPitch#disable + */ + ; + + _proto.disable = function disable(persistOrientation) { + if (!this._enabled) { + return this; + } // TODO: Check peristOrientation is needed! + + + if (!persistOrientation) { + this._resetOrientation(); + } + + this.axes.disconnect(); + this._enabled = false; + return this; + }; + + _proto._resetOrientation = function _resetOrientation() { + var opt = this.options; + this.axes.setTo({ + yaw: opt.yaw, + pitch: opt.pitch, + fov: opt.fov + }, 0); + return this; + } + /** + * Set one or more of yaw, pitch, fov + * + * @param {Object} coordinate yaw, pitch, fov + * @param {Number} duration Animation duration. if it is above 0 then it's animated. + */ + ; + + _proto.lookAt = function lookAt$$1(_ref, duration) { + var yaw = _ref.yaw, + pitch = _ref.pitch, + fov = _ref.fov; + var pos = this.axes.get(); + var y = yaw === undefined ? 0 : yaw - pos.yaw; + var p = pitch === undefined ? 0 : pitch - pos.pitch; + var f = fov === undefined ? 0 : fov - pos.fov; // Allow duration of animation to have more than MC_MAXIMUM_DURATION. + + this.axes.options.maximumDuration = Infinity; + this.axes.setBy({ + yaw: y, + pitch: p, + fov: f + }, duration); + }; + + _proto.getYawPitch = function getYawPitch() { + var yawPitch = this.axes.get(); + return { + yaw: yawPitch.yaw, + pitch: yawPitch.pitch + }; + }; + + _proto.getFov = function getFov() { + return this.axes.get().fov; + }; + + _proto.getQuaternion = function getQuaternion() { + var pos = this.axes.get(); + return this._deviceQuaternion.getCombinedQuaternion(pos.yaw); + }; + + _proto.shouldRenderWithQuaternion = function shouldRenderWithQuaternion() { + return this.options.gyroMode === GYRO_MODE.VR; + } + /** + * Destroys objects + */ + ; + + _proto.destroy = function destroy() { + this.axes && this.axes.destroy(); + this.axisPanInput && this.axisPanInput.destroy(); + this.axesWheelInput && this.axesWheelInput.destroy(); + this.axesTiltMotionInput && this.axesTiltMotionInput.destroy(); + this.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy(); + this.axesPinchInput && this.axesPinchInput.destroy(); + this.axesMoveKeyInput && this.axesMoveKeyInput.destroy(); + this._deviceQuaternion && this._deviceQuaternion.destroy(); + }; + + return YawPitchControl; + }(Component); + + YawPitchControl.VERSION = VERSION; + YawPitchControl.CONTROL_MODE_VR = CONTROL_MODE_VR; + YawPitchControl.CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH; + YawPitchControl.TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL; + YawPitchControl.TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW; + YawPitchControl.TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH; + YawPitchControl.TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE; + return YawPitchControl; + }(); + + var _Promise = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var STATUS = { + "NONE": 0, + "LOADING": 1, + "LOADED": 2, + "ERROR": 3 + }; + var EVENT = { + "READYSTATECHANGE": "readystatechange" + }; + + var ImageLoader = + /*#__PURE__*/ + function () { + var ImageLoader = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(ImageLoader, _Component); + + function ImageLoader(image) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + _this._image = null; + _this._onceHandlers = []; + _this._loadStatus = STATUS.NONE; + image && _this.set(image); + return _this; + } + + var _proto = ImageLoader.prototype; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise(function (res, rej) { + if (!_this2._image) { + rej("ImageLoader: image is not defiend"); + } else if (_this2._loadStatus === STATUS.LOADED) { + res(_this2.getElement()); + } else if (_this2._loadStatus === STATUS.LOADING) { + /* Check isMaybeLoaded() first because there may have + posibilities that image already loaded before get is called. + for example calling get on external image onload callback.*/ + if (ImageLoader.isMaybeLoaded(_this2._image)) { + _this2._loadStatus = STATUS.LOADED; + res(_this2.getElement()); + } else { + _this2.on(EVENT.READYSTATECHANGE, function (e) { + if (e.type === STATUS.LOADED) { + res(_this2.getElement()); + } else { + rej("ImageLoader: failed to load images."); + } + }); + } + } else { + rej("ImageLoader: failed to load images"); + } + }); + } + /** + * @param image img element or img url or array of img element or array of img url + */ + ; + + _proto.set = function set(image) { + var _this3 = this; + + this._loadStatus = STATUS.LOADING; + this._image = ImageLoader.createElement(image); + + if (ImageLoader.isMaybeLoaded(this._image)) { + this._loadStatus = STATUS.LOADED; + return; + } + + this.onceLoaded(this._image, function () { + _this3._loadStatus = STATUS.LOADED; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.LOADED + }); + }, function () { + _this3._loadStatus = STATUS.ERROR; + + _this3.trigger(EVENT.READYSTATECHANGE, { + type: STATUS.ERROR + }); + }); + }; + + ImageLoader.createElement = function createElement(image) { + var images = image instanceof Array ? image : [image]; + return images.map(function (img) { + var _img = img; + + if (typeof img === "string") { + _img = new Image(); + _img.crossOrigin = "anonymous"; + _img.src = img; + } + + return _img; + }); + }; + + _proto.getElement = function getElement() { + return this._image.length === 1 ? this._image[0] : this._image; + }; + + ImageLoader.isMaybeLoaded = function isMaybeLoaded(image) { + var result = false; + + if (image instanceof Image) { + result = image.complete && image.naturalWidth !== 0; + } else if (image instanceof Array) { + result = !image.some(function (img) { + return !img.complete || img.naturalWidth === 0; + }); + } + + return result; + }; + + _proto.onceLoaded = function onceLoaded(target, onload, onerror) { + var _this4 = this; + + var targets = target instanceof Array ? target : [target]; + var targetsNotLoaded = targets.filter(function (img) { + return !ImageLoader.isMaybeLoaded(img); + }); + var loadPromises = targetsNotLoaded.map(function (img) { + return new _Promise(function (res, rej) { + _this4._once(img, "load", function () { + return res(img); + }); + + _this4._once(img, "error", function () { + return rej(img); + }); + }); + }); + + _Promise.all(loadPromises).then(function (result) { + return onload(targets.length === 1 ? targets[0] : targets); + }, function (reason) { + return onerror(reason); + }); + }; + + _proto._once = function _once(target, type, listener) { + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + + target.addEventListener(type, fn); + + this._onceHandlers.push({ + target: target, + type: type, + fn: fn + }); + }; + + _proto.getStatus = function getStatus() { + return this._loadStatus; + }; + + _proto.destroy = function destroy() { + this._onceHandlers.forEach(function (handler) { + handler.target.removeEventListener(handler.type, handler.fn); + }); + + this._onceHandlers = []; + this._image.src = ""; + this._image = null; + this._loadStatus = STATUS.NONE; + }; + + return ImageLoader; + }(Component); + + ImageLoader.STATUS = STATUS; + return ImageLoader; + }(); + + var _Promise$1 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + + // import Agent from "@egjs/agent"; + + /* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */ + var READY_STATUS = { + HAVE_NOTHING: 0, + // no information whether or not the audio/video is ready + HAVE_METADATA: 1, + // HAVE_METADATA - metadata for the audio/video is ready + HAVE_CURRENT_DATA: 2, + // data for the current playback position is available, but not enough data to play next frame/millisecond + HAVE_FUTURE_DATA: 3, + // data for the current and at least the next frame is available + HAVE_ENOUGH_DATA: 4, + // enough data available to start playing + // below is custom status for failed to load status + LOADING_FAILED: -1 + }; + var READYSTATECHANGE_EVENT_NAME = {}; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = "loadedmetadata"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = "loadeddata"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = "canplay"; + READYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = "canplaythrough"; + + var VideoLoader = + /*#__PURE__*/ + function () { + function VideoLoader(video) { + this._handlers = []; + this._sourceCount = 0; // on iOS safari, 'loadeddata' will not triggered unless the user hits play, + // so used 'loadedmetadata' instead. + + this._thresholdReadyState = READY_STATUS.HAVE_METADATA; + this._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState]; + this._loadStatus = video && video.readyState || READY_STATUS.HAVE_NOTHING; + this._onerror = this._onerror.bind(this); + video && this.set(video); + } + + var _proto = VideoLoader.prototype; + + _proto._onerror = function _onerror() { + this._errorCount++; + + if (this._errorCount >= this._sourceCount) { + this._loadStatus = READY_STATUS.LOADING_FAILED; + + this._detachErrorHandler(this._onerror); + } + } + /** + * + * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src} + */ + ; + + _proto._appendSourceElement = function _appendSourceElement(videoUrl) { + var videoSrc; + var videoType; + + if (typeof videoUrl === "object") { + videoSrc = videoUrl.src; + videoType = videoUrl.type; + } else if (typeof videoUrl === "string") { + videoSrc = videoUrl; + } + + if (!videoSrc) { + return false; + } + + var sourceElement = document.createElement("source"); + sourceElement.src = videoSrc; + videoType && (sourceElement.type = videoType); + + this._video.appendChild(sourceElement); + + return true; + }; + + _proto.set = function set(video) { + var _this = this; + + this._reset(); // reset resources. + + + if (!video) { + return; + } + + if (video instanceof HTMLVideoElement) { + // video tag + this._video = video; + } else if (typeof video === "string" || typeof video === "object") { + // url + this._video = document.createElement("video"); + + this._video.setAttribute("crossorigin", "anonymous"); + + this._video.setAttribute("webkit-playsinline", ""); + + this._video.setAttribute("playsinline", ""); + + if (video instanceof Array) { + video.forEach(function (v) { + return _this._appendSourceElement(v); + }); + } else { + this._appendSourceElement(video); + } + + this._sourceCount = this._video.querySelectorAll("source").length; + + if (this._sourceCount > 0) { + if (this._video.readyState < this._thresholdReadyState) { + this._video.load(); // attach loading error listener + + + this._attachErrorHandler(this._onerror); + } + } else { + this._video = null; + } + } + }; + + _proto._attachErrorHandler = function _attachErrorHandler(handler) { + this._video.addEventListener("error", handler); + + this._sources = this._video.querySelectorAll("source"); + [].forEach.call(this._sources, function (source) { + source.addEventListener("error", handler); + }); + }; + + _proto._detachErrorHandler = function _detachErrorHandler(handler) { + this._video.removeEventListener("error", handler); + + [].forEach.call(this._sources, function (source) { + source.removeEventListener("error", handler); + }); + }; + + _proto.get = function get() { + var _this2 = this; + + return new _Promise$1(function (res, rej) { + if (!_this2._video) { + rej("VideoLoader: video is undefined"); + } else if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + rej("VideoLoader: video source is invalid"); + } else if (_this2._video.readyState >= _this2._thresholdReadyState) { + res(_this2._video); + } else { + // check errorCnt and reject + var rejector = function rejector() { + if (_this2._loadStatus === READY_STATUS.LOADING_FAILED) { + _this2._detachErrorHandler(rejector); + + rej("VideoLoader: video source is invalid"); + } + }; + + _this2._attachErrorHandler(rejector); + + _this2._once(_this2._thresholdEventName, function () { + return res(_this2._video); + }); + } + }); + }; + + _proto.getElement = function getElement() { + return this._video; + }; + + _proto.destroy = function destroy() { + this._reset(); + }; + + _proto._reset = function _reset() { + var _this3 = this; + + this._handlers.forEach(function (handler) { + _this3._video.removeEventListener(handler.type, handler.fn); + }); + + this._handlers = []; + this._video = null; + this._sourceCount = 0; + this._errorCount = 0; + }; + + _proto._once = function _once(type, listener) { + var target = this._video; + + var fn = function fn(event) { + target.removeEventListener(type, fn); + listener(event); + }; + /* By useCapture mode enabled, you can capture the error event being fired on source(child)*/ + + + target.addEventListener(type, fn, true); + + this._handlers.push({ + type: type, + fn: fn + }); + }; + + return VideoLoader; + }(); + + var WEBGL_ERROR_CODE = { + "0": "NO_ERROR", + "1280": "INVALID_ENUM", + "1281": "INVALID_VALUE", + "1282": "INVALID_OPERATION", + "1285": "OUT_OF_MEMORY", + "1286": "INVALID_FRAMEBUFFER_OPERATION", + "37442": "CONTEXT_LOST_WEBGL" + }; + var webglAvailability = null; + var MAX_TEXTURE_SIZE_FOR_TEST = null; + + var WebGLUtils = + /*#__PURE__*/ + function () { + function WebGLUtils() {} + + WebGLUtils.createShader = function createShader(gl, type, source) { + var shader = gl.createShader(type); + gl.shaderSource(shader, source); + gl.compileShader(shader); + var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS); + + if (success) { + return shader; + } else { + // eslint-disable-next-line + console.error(gl.getShaderInfoLog(shader)); + } + + return null; + }; + + WebGLUtils.createProgram = function createProgram(gl, vertexShader, fragmentShader) { + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + gl.linkProgram(program); + gl.detachShader(program, vertexShader); + gl.detachShader(program, fragmentShader); + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + var success = gl.getProgramParameter(program, gl.LINK_STATUS); + + if (success) { + return program; + } + + gl.deleteProgram(program); + return null; + }; + + WebGLUtils.initBuffer = function initBuffer(gl, target + /* bind point */ + , data, itemSize, attr) { + var buffer = gl.createBuffer(); + gl.bindBuffer(target, buffer); + gl.bufferData(target, data, gl.STATIC_DRAW); + + if (buffer) { + buffer.itemSize = itemSize; + buffer.numItems = data.length / itemSize; + } + + if (attr !== undefined) { + gl.enableVertexAttribArray(attr); + gl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0); + } + + return buffer; + }; + + WebGLUtils.getWebglContext = function getWebglContext(canvas, userContextAttributes) { + var webglIdentifiers = ["webgl", "experimental-webgl", "webkit-3d", "moz-webgl"]; + var context = null; + + var contextAttributes = _extends({ + preserveDrawingBuffer: false, + antialias: false, + xrCompatible: true + }, userContextAttributes); + + function onWebglcontextcreationerror(e) { + return e.statusMessage; + } + + canvas.addEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + + for (var i = 0; i < webglIdentifiers.length; i++) { + try { + context = canvas.getContext(webglIdentifiers[i], contextAttributes); + } catch (t) {} + + if (context) { + break; + } + } + + canvas.removeEventListener("webglcontextcreationerror", onWebglcontextcreationerror); + return context; + }; + + WebGLUtils.createTexture = function createTexture(gl, textureTarget) { + var texture = gl.createTexture(); + gl.bindTexture(textureTarget, texture); + gl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.bindTexture(textureTarget, null); + return texture; + } + /** + * Returns the webgl availability of the current browser. + * @method WebGLUtils#isWebGLAvailable + * @retuen {Boolean} isWebGLAvailable + */ + ; + + WebGLUtils.isWebGLAvailable = function isWebGLAvailable() { + if (webglAvailability === null) { + var canvas = document.createElement("canvas"); + var webglContext = WebGLUtils.getWebglContext(canvas); + webglAvailability = !!webglContext; // webglContext Resource forced collection + + if (webglContext) { + var loseContextExtension = webglContext.getExtension("WEBGL_lose_context"); + loseContextExtension && loseContextExtension.loseContext(); + } + } + + return webglAvailability; + } + /** + * Returns whether webgl is stable in the current browser. + * @method WebGLUtils#isStableWebGL + * @retuen {Boolean} isStableWebGL + */ + ; + + WebGLUtils.isStableWebGL = function isStableWebGL() { + var agentInfo = agent(); + var isStableWebgl = true; + + if (agentInfo.os.name === "android") { + var version = parseFloat(agentInfo.os.version); + + if (version <= 4.3) { + isStableWebgl = false; + } else if (version === 4.4) { + if (agentInfo.browser.name !== "chrome") { + isStableWebgl = false; + } + } + } + + return isStableWebgl; + }; + + WebGLUtils.getErrorNameFromWebGLErrorCode = function getErrorNameFromWebGLErrorCode(code) { + if (!(code in WEBGL_ERROR_CODE)) { + return "UNKNOWN_ERROR"; + } + + return WEBGL_ERROR_CODE[code]; + } + /** + * This function is wrapper for texImage2D to handle exceptions on texImage2D. + * Purpose is to prevent service from being stopped by script error. + * + * @param {*} gl + * @param {*} target + * @param {*} pixels + */ + ; + + WebGLUtils.texImage2D = function texImage2D(gl, target, pixels) { + try { + gl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels); + } catch (error) { + /* eslint-disable no-console */ + console.error("WebGLUtils.texImage2D error:", error); + /* eslint-enable no-console */ + } + }; + + WebGLUtils.getMaxTextureSize = function getMaxTextureSize(gl) { + // WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test + return MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE); + }; + + return WebGLUtils; + }(); + + var agent$3 = agent(); + var isIE11 = agent$3.browser.name === "ie" && agent$3.browser.majorVersion === 11; + var EVENTS = { + ERROR: "error" + }; + /** + * + * Extends Component for firing errors occurs internally. + */ + + var Renderer = + /*#__PURE__*/ + function () { + var Renderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(Renderer, _Component); + + function Renderer() { + var _this; + + _this = _Component.call(this) || this; + _this._forceDimension = null; + _this._pixelCanvas = null; + _this._pixelContext = null; + return _this; + } + + var _proto = Renderer.prototype; + + _proto.render = function render(_ref) { + var gl = _ref.gl, + shaderProgram = _ref.shaderProgram, + indexBuffer = _ref.indexBuffer, + mvMatrix = _ref.mvMatrix, + pMatrix = _ref.pMatrix; + gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix); + gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix); + + if (indexBuffer) { + gl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0); + } + } // Define interface for Renderers + + /** + * Following MUST BE DEFINED on Child of Renderer + * + * DATA + * + * - getVertexPositionData + * - getIndexData + * - getTextureCoordData + * + * SOURCE + * + * - getVertexShaderSource + * - getFragmentShaderSource + * + * TEXTURE + * + * - bindTexture + */ + ; + + _proto.getDimension = function getDimension(pixelSource) { + var width = pixelSource.naturalWidth || pixelSource.videoWidth; + var height = pixelSource.naturalHeight || pixelSource.videoHeight; + return { + width: width, + height: height + }; + } + /** + * Update data used by shader + * - + * + * + * @param {*} param + */ + ; + + _proto.updateShaderData = function updateShaderData(param) {} + /* + * Update following data in implementation layer. + * If the data is not changed, it does not need to implement this function. + * + * - _VERTEX_POSITION_DATA + * - _TEXTURE_COORD_DATA + * - _INDEX_DATA + */ + + /** + * + * @param {HTMLImageElement | HTMLVideoElement} image + * @param {Object = {width, height}} forceDimension Forced dimension to resize + */ + ; + + _proto._initPixelSource = function _initPixelSource(image, forceDimension) { + var isIE11Video = isIE11 && image instanceof HTMLVideoElement; + + if (isIE11Video || forceDimension) { + var _ref2 = forceDimension || this.getDimension(image), + width = _ref2.width, + height = _ref2.height; + + this._pixelCanvas = document.createElement("canvas"); + this._pixelCanvas.width = width; + this._pixelCanvas.height = height; + this._pixelContext = this._pixelCanvas.getContext("2d"); + } + + this._forceDimension = forceDimension; + }; + + _proto._getPixelSource = function _getPixelSource(image) { + if (!this._pixelCanvas) { + return image; + } + /** + * IE11 && Video + * or + * Dimension is forced (Image is larger than texture size.) + */ + + + var contentDimension = this.getDimension(image); + var textureDimension = this._forceDimension || contentDimension; + + if (this._pixelCanvas.width !== textureDimension.width) { + this._pixelCanvas.width = textureDimension.width; + } + + if (this._pixelCanvas.height !== textureDimension.height) { + this._pixelCanvas.height = textureDimension.height; + } + + if (this._forceDimension) { + this._pixelContext.drawImage(image, 0, 0, contentDimension.width, contentDimension.height, 0, 0, textureDimension.width, textureDimension.height); + } else { + this._pixelContext.drawImage(image, 0, 0); + } + + return this._pixelCanvas; + }; + + _proto._extractTileConfig = function _extractTileConfig(imageConfig) { + var tileConfig = Array.isArray(imageConfig.tileConfig) ? imageConfig.tileConfig : Array.apply(void 0, Array(6)).map(function () { + return imageConfig.tileConfig; + }); + tileConfig = tileConfig.map(function (config) { + return _extends({ + flipHorizontal: false, + rotation: 0 + }, config); + }); + return tileConfig; + }; + + _proto._triggerError = function _triggerError(error) { + /* eslint-disable no-console */ + console.error("Renderer Error:", error); + /* eslint-enable no-console */ + + this.trigger(EVENTS.ERROR, { + message: typeof error === "string" ? error : error.message + }); + }; + + return Renderer; + }(Component); + + Renderer.EVENTS = EVENTS; + return Renderer; + }(); + + var CubeRenderer = + /*#__PURE__*/ + function () { + var CubeRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeRenderer, _Renderer); + + function CubeRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + CubeRenderer._VERTEX_POSITION_DATA = CubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // top + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // bottom + 1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + return CubeRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + if (CubeRenderer._INDEX_DATA) { + return CubeRenderer._INDEX_DATA; + } + + var indexData = []; + var vertexPositionData = this.getVertexPositionData(); + + for (var i = 0; i < vertexPositionData.length / 3; i += 4) { + indexData.push(i, i + 2, i + 1, i, i + 3, i + 2); + } + + CubeRenderer._INDEX_DATA = indexData; + return indexData; + }; + + CubeRenderer.extractOrder = function extractOrder(imageConfig) { + return imageConfig.order || "RLUDBF"; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var vertexOrder = "BFUDRL"; + var order = CubeRenderer.extractOrder(imageConfig); + var base = this.getVertexPositionData(); + + var tileConfig = this._extractTileConfig(imageConfig); + + var elemSize = 3; + var vertexPerTile = 4; + var textureCoordData = vertexOrder.split("").map(function (face) { + return tileConfig[order.indexOf(face)]; + }).map(function (config, i) { + var rotation = parseInt(config.rotation / 90, 10); + var ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2]; + + for (var r = 0; r < Math.abs(rotation); r++) { + if (config.flipHorizontal && rotation > 0 || !config.flipHorizontal && rotation < 0) { + ordermap_.push(ordermap_.shift()); + } else { + ordermap_.unshift(ordermap_.pop()); + } + } + + var elemPerTile = elemSize * vertexPerTile; + var tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile); + var tileTemp = []; + + for (var j = 0; j < vertexPerTile; j++) { + tileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize); + } + + return tileTemp; + }).join().split(",").map(function (v) { + return parseInt(v, 10); + }); + return textureCoordData; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image, imageConfig) { + var baseOrder = "RLUDBF"; + var order = CubeRenderer.extractOrder(imageConfig); + var orderMap = {}; + order.split("").forEach(function (v, i) { + orderMap[v] = i; + }); + + try { + if (image instanceof Array) { + for (var surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) { + var tileIdx = orderMap[baseOrder[surfaceIdx]]; + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]); + } + } else { + var maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image); + + for (var _surfaceIdx = 0; _surfaceIdx < 6; _surfaceIdx++) { + var _tileIdx = orderMap[baseOrder[_surfaceIdx]]; + var tile = this.extractTileFromImage(image, _tileIdx, maxCubeMapTextureSize); + WebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + _surfaceIdx, tile); + } + } + } catch (e) { + this._triggerError(e); + } + }; + + _proto.bindTexture = function bindTexture(gl, texture, image, imageConfig) { + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + this.updateTexture(gl, image, imageConfig); + }; + + _proto.getSourceTileSize = function getSourceTileSize(image) { + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var aspectRatio = width / height; + var inputTextureSize; + + if (aspectRatio === 1 / 6) { + inputTextureSize = width; + } else if (aspectRatio === 6) { + inputTextureSize = height; + } else if (aspectRatio === 2 / 3) { + inputTextureSize = width / 2; + } else { + inputTextureSize = width / 3; + } + + return inputTextureSize; + }; + + _proto.extractTileFromImage = function extractTileFromImage(image, tileIdx, outputTextureSize) { + var _this$getDimension2 = this.getDimension(image), + width = _this$getDimension2.width; + + var inputTextureSize = this.getSourceTileSize(image); + var canvas = document.createElement("canvas"); + canvas.width = outputTextureSize; + canvas.height = outputTextureSize; + var context = canvas.getContext("2d"); + var tilePerRow = width / inputTextureSize; + var x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow); + var y = parseInt(tileIdx / tilePerRow, 10) * inputTextureSize; + context.drawImage(image, x, y, inputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize); + return canvas; + }; + + _proto.getMaxCubeMapTextureSize = function getMaxCubeMapTextureSize(gl, image) { + var agent$$1 = agent(); + var maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE); + + var _imageWidth = this.getSourceTileSize(image); + + if (agent$$1.browser.name === "ie" && agent$$1.browser.majorVersion === 11) { + if (!util.isPowerOfTwo(_imageWidth)) { + for (var i = 1; i < maxCubeMapTextureSize; i *= 2) { + if (i < _imageWidth) { + continue; + } else { + _imageWidth = i; + break; + } + } + } + } + + if (agent$$1.os.name === "ios") { + var majorVersion = agent$$1.os.majorVersion; // ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다. + + if (majorVersion === 9) { + _imageWidth = 1024; + } // ios 8 의 경우 텍스쳐 최대사이즈는 512 이다. + + + if (majorVersion === 8) { + _imageWidth = 512; + } + } // maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수 + + + return Math.min(maxCubeMapTextureSize, _imageWidth); + }; + + return CubeRenderer; + }(Renderer); + + CubeRenderer._VERTEX_POSITION_DATA = null; + CubeRenderer._INDEX_DATA = null; + return CubeRenderer; + }(); + + var CubeStripRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CubeStripRenderer, _Renderer); + + function CubeStripRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CubeStripRenderer.prototype; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"; + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + if (!this._vertices) { + this._vertices = [// back + 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, // front + -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, -1, // up + -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, // down + -1, -1, 1, 1, -1, 1, 1, -1, -1, -1, -1, -1, // right + 1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, // left + -1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, 1]; + } + + return this._vertices; + }; + + _proto.getIndexData = function getIndexData() { + var _this = this; + + // TODO: 한번만 계산하도록 수정하기 + var indices = function () { + var indexData = []; + + for (var i = 0; i < _this._vertices.length / 3; i += 4) { + indexData.push(i, i + 1, i + 2, i, i + 2, i + 3); + } + + return indexData; + }(); + + return indices; + }; + + _proto.getTextureCoordData = function getTextureCoordData(imageConfig) { + var _this2 = this; + + // TODO: make it cols, rows as config. + var cols = 3; + var rows = 2; + var order = imageConfig.order || "RLUDFB"; + var coords = []; // 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다. + + for (var r = rows - 1; r >= 0; r--) { + for (var c = 0; c < cols; c++) { + var coord = [c / cols, r / rows, (c + 1) / cols, r / rows, (c + 1) / cols, (r + 1) / rows, c / cols, (r + 1) / rows]; + coords.push(coord); + } + } + + var tileConfigs = this._extractTileConfig(imageConfig); // Transform Coord By Flip & Rotation + + + coords = coords // shrink coord to avoid pixel bleeding + .map(function (coord) { + return _this2._shrinkCoord(coord); + }).map(function (coord, i) { + return _this2._transformCoord(coord, tileConfigs[i]); + }); // vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치 + + return "BFUDRL".split("").map(function (face) { + return order.indexOf(face); + }).map(function (index) { + return coords[index]; + }).reduce(function (acc, val) { + return acc.concat(val); + }, []); + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto._transformCoord = function _transformCoord(coord, tileConfig) { + var newCoord = coord.slice(); + + if (tileConfig.flipHorizontal) { + newCoord = this._flipHorizontalCoord(newCoord); + } + + if (tileConfig.rotation) { + newCoord = this._rotateCoord(newCoord, tileConfig.rotation); + } + + return newCoord; + }; + + _proto._shrinkCoord = function _shrinkCoord(coord) { + var SHRINK_Y = 0.00; + var SHRINK_X = 0.00; + return [coord[0] + SHRINK_X, coord[1] + SHRINK_Y, coord[2] - SHRINK_X, coord[3] + SHRINK_Y, coord[4] - SHRINK_X, coord[5] - SHRINK_Y, coord[6] + SHRINK_X, coord[7] - SHRINK_Y]; + }; + + _proto._rotateCoord = function _rotateCoord(coord, rotationAngle) { + var SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord. + + var shiftCount = parseInt(rotationAngle / 90, 10) % 4; + + if (shiftCount === 0) { + return coord; + } + + var moved; + var rotatedCoord = []; + + if (shiftCount > 0) { + moved = coord.splice(0, shiftCount * SIZE); + rotatedCoord = coord.concat(moved); + } else { + moved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE); + rotatedCoord = moved.concat(coord); + } + + return rotatedCoord; + }; + + _proto._flipHorizontalCoord = function _flipHorizontalCoord(coord) { + return [coord[2], coord[3], coord[0], coord[1], coord[6], coord[7], coord[4], coord[5]]; + }; + + return CubeStripRenderer; + }(Renderer); + + /** + * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide}) + * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고) + * @namespace + * @name GYRO_MODE + * @memberof eg.view360.PanoViewer + */ + /** + * Constant value for errors + * @ko 에러에 대한 상수 값 + * @namespace + * @name ERROR_TYPE + * @memberof eg.view360.PanoViewer + */ + + var ERROR_TYPE = { + /** + * Unsupported device + * @ko 미지원 기기 + * @name INVALID_DEVICE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 10 + */ + INVALID_DEVICE: 10, + + /** + * Webgl not support + * @ko WEBGL 미지원 + * @name NO_WEBGL + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 11 + */ + NO_WEBGL: 11, + + /** + * Failed to load image + * @ko 이미지 로드 실패 + * @name FAIL_IMAGE_LOAD + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 12 + */ + FAIL_IMAGE_LOAD: 12, + + /** + * Failed to bind texture + * @ko 텍스쳐 바인딩 실패 + * @name FAIL_BIND_TEXTURE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 13 + */ + FAIL_BIND_TEXTURE: 13, + + /** + * Only one resource(image or video) should be specified + * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * @name INVALID_RESOURCE + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 14 + */ + INVALID_RESOURCE: 14, + + /** + * WebGL context lost occurred + * @ko WebGL context lost 발생 + * @name RENDERING_CONTEXT_LOST + * @memberof eg.view360.PanoViewer.ERROR_TYPE + * @constant + * @type {Number} + * @default 15 + */ + RENDERING_CONTEXT_LOST: 15 + }; + /** + * Constant value for events + * @ko 이벤트에 대한 상수 값 + * @namespace + * @name EVENTS + * @memberof eg.view360.PanoViewer + */ + + var EVENTS$1 = { + /** + * Events that is fired when PanoViewer is ready to show image and handle user interaction. + * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트 + * @name READY + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default ready + */ + READY: "ready", + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name VIEW_CHANGE + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default viewChange + */ + VIEW_CHANGE: "viewChange", + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name ANIMATION_END + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default animationEnd + */ + ANIMATION_END: "animationEnd", + + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name ERROR + * @memberof eg.view360.PanoViewer.EVENTS + * @constant + * @type {String} + * @default error + */ + ERROR: "error" + }; + /** + * Constant value for projection type + * @ko 프로젝션 타입 대한 상수 값 + * @namespace + * @name PROJECTION_TYPE + * @memberof eg.view360.PanoViewer + */ + + var PROJECTION_TYPE = { + /** + * Constant value for equirectangular type. + * @ko equirectangular 에 대한 상수 값. + * @name EQUIRECTANGULAR + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default equirectangular + */ + EQUIRECTANGULAR: "equirectangular", + + /** + * Constant value for cubemap type. + * @ko cubemap 에 대한 상수 값. + * @name CUBEMAP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubemap + */ + CUBEMAP: "cubemap", + + /** + * Constant value for cubestrip type. + * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC. + * + * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다. + * @name CUBESTRIP + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default cubestrip + */ + CUBESTRIP: "cubestrip", + + /** + * Constant value for PANORAMA type. + * + * PANORAMA is a format for a panorma image which is taken from smartphone. + * + * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다. + * + * @name PANORAMA + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default panorama + */ + PANORAMA: "panorama", + + /** + * Constant value for EQUI_STEREOSCOPY type. + * + * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present. + * + * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다. + * + * @name STEREOSCOPIC_EQUI + * @memberof eg.view360.PanoViewer.PROJECTION_TYPE + * @constant + * @type {String} + * @default stereoequi + */ + STEREOSCOPIC_EQUI: "stereoequi" + }; + /** + * A constant value for the format of the stereoscopic equirectangular projection type. + * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값 + * @namespace + * @name STEREO_FORMAT + * @memberof eg.view360.PanoViewer + */ + + var STEREO_FORMAT = { + /** + * A constant value for format of top bottom stereoscopic 360 equirectangular projection. + * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name TOP_BOTTOM + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dv" + */ + TOP_BOTTOM: "3dv", + + /** + * A constant value for format of left right stereoscopic 360 equirectangular projection. + * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값. + * @name LEFT_RIGHT + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "3dh" + */ + LEFT_RIGHT: "3dh", + + /** + * A constant value specifying media is not in stereoscopic format. + * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값. + * @name NONE + * @memberof eg.view360.PanoViewer.STEREO_FORMAT + * @constant + * @type {String} + * @default "" + */ + NONE: "" + }; + + var latitudeBands = 60; + var longitudeBands = 60; + var radius = 2; + var ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI; + var textureCoordData = []; + var vertexPositionData = []; + var indexData = []; + var latIdx; + var lngIdx; + + for (latIdx = 0; latIdx <= latitudeBands; latIdx++) { + var theta = (latIdx / latitudeBands - 0.5) * Math.PI; + var sinTheta = Math.sin(theta); + var cosTheta = Math.cos(theta); + + for (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) { + var phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN; + var sinPhi = Math.sin(phi); + var cosPhi = Math.cos(phi); + var x = cosPhi * cosTheta; + var y = sinTheta; + var z = sinPhi * cosTheta; + var u = lngIdx / longitudeBands; + var v = latIdx / latitudeBands; + textureCoordData.push(u, v); + vertexPositionData.push(radius * x, radius * y, radius * z); + + if (lngIdx !== longitudeBands && latIdx !== latitudeBands) { + var a = latIdx * (longitudeBands + 1) + lngIdx; + var b = a + longitudeBands + 1; + indexData.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + + var SphereRenderer = + /*#__PURE__*/ + function () { + var SphereRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(SphereRenderer, _Renderer); + + function SphereRenderer(format) { + var _this; + + _this = _Renderer.call(this) || this; + _this._stereoFormat = format; + return _this; + } + + var _proto = SphereRenderer.prototype; + + _proto.render = function render(ctx) { + var gl = ctx.gl, + shaderProgram = ctx.shaderProgram; + var leftEyeScaleOffset; + var rightEyeScaleOffset; + + switch (this._stereoFormat) { + case STEREO_FORMAT.TOP_BOTTOM: + leftEyeScaleOffset = [1, 0.5, 0, 0]; + rightEyeScaleOffset = [1, 0.5, 0, 0.5]; + break; + + case STEREO_FORMAT.LEFT_RIGHT: + leftEyeScaleOffset = [0.5, 1, 0, 0]; + rightEyeScaleOffset = [0.5, 1, 0.5, 0]; + break; + + default: + leftEyeScaleOffset = [1, 1, 0, 0]; + rightEyeScaleOffset = [1, 1, 0, 0]; + } + + var uTexScaleOffset = gl.getUniformLocation(shaderProgram, "uTexScaleOffset"); + gl.uniform4fv(uTexScaleOffset, [].concat(leftEyeScaleOffset, rightEyeScaleOffset)); + + _Renderer.prototype.render.call(this, ctx); + }; + + _proto.getVertexPositionData = function getVertexPositionData() { + return SphereRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return SphereRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return SphereRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device limit(" + maxSize + "))"); + + return; + } // Pixel Source for IE11 & Video + + + this._initPixelSource(image); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + return SphereRenderer; + }(Renderer); + + SphereRenderer._VERTEX_POSITION_DATA = vertexPositionData; + SphereRenderer._TEXTURE_COORD_DATA = textureCoordData; + SphereRenderer._INDEX_DATA = indexData; + return SphereRenderer; + }(); + + var MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6; + var longitudeBands$1 = 60; + var textureCoordData$1 = []; + var vertexPositionData$1 = []; + var indexData$1 = []; + + var CylinderRenderer = + /*#__PURE__*/ + function () { + var CylinderRenderer = + /*#__PURE__*/ + function (_Renderer) { + _inheritsLoose(CylinderRenderer, _Renderer); + + function CylinderRenderer() { + return _Renderer.apply(this, arguments) || this; + } + + var _proto = CylinderRenderer.prototype; + + _proto.getVertexPositionData = function getVertexPositionData() { + return CylinderRenderer._VERTEX_POSITION_DATA; + }; + + _proto.getIndexData = function getIndexData() { + return CylinderRenderer._INDEX_DATA; + }; + + _proto.getTextureCoordData = function getTextureCoordData() { + return CylinderRenderer._TEXTURE_COORD_DATA; + }; + + _proto.getVertexShaderSource = function getVertexShaderSource() { + return "\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"; + }; + + _proto.getFragmentShaderSource = function getFragmentShaderSource() { + return "\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}"; + }; + + _proto.updateTexture = function updateTexture(gl, image) { + WebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image)); + }; + + _proto.bindTexture = function bindTexture(gl, texture, image) { + // Make sure image isn't too big + var _this$getDimension = this.getDimension(image), + width = _this$getDimension.width, + height = _this$getDimension.height; + + var size = Math.max(width, height); + var maxSize = WebGLUtils.getMaxTextureSize(gl); + var resizeDimension; + + if (size > maxSize) { + this._triggerError("Image width(" + width + ") exceeds device texture limit(" + maxSize + "))"); // Request resizing texture. + + /** + * TODO: Is it need to apply on another projection type? + */ + + + resizeDimension = width > height ? { + width: maxSize, + height: maxSize * height / width + } : { + width: maxSize * width / height, + height: maxSize + }; + } // Pixel Source for IE11 & Video or resizing needed + + + this._initPixelSource(image, resizeDimension); + + gl.activeTexture(gl.TEXTURE0); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.bindTexture(gl.TEXTURE_2D, texture); + this.updateTexture(gl, image); + }; + + _proto.updateShaderData = function updateShaderData(_ref) { + var _ref$imageAspectRatio = _ref.imageAspectRatio, + imageAspectRatio = _ref$imageAspectRatio === void 0 ? MIN_ASPECT_RATIO_FOR_FULL_PANORAMA : _ref$imageAspectRatio; + var lngIdx; + var cylinderMaxRadian; + var halfCylinderY; + var rotated; + var aspectRatio; // Exception case: orientation is rotated. + + if (imageAspectRatio < 1) { + /** + * If rotated is true, we assume that image is rotated counter clockwise. + * TODO: If there's other rotation, it is need to implement by each rotation. + */ + rotated = true; + aspectRatio = 1 / imageAspectRatio; + } else { + rotated = false; + aspectRatio = imageAspectRatio; + } + + if (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) { + var fov = 360 / aspectRatio; + cylinderMaxRadian = 2 * Math.PI; // 360 deg + + halfCylinderY = Math.tan(toRadian(fov / 2)); + } else { + cylinderMaxRadian = aspectRatio; + halfCylinderY = 0.5; // Range of cylinder is [-0.5, 0.5] to make height to 1. + } // intialize shader data before update + + + textureCoordData$1.length = 0; + vertexPositionData$1.length = 0; + indexData$1.length = 0; + var CYLIDER_Y = [-halfCylinderY, halfCylinderY]; + var startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360) + // console.log("cylinderMaxRadian:", glMatrix.toDegree(cylinderMaxRadian), "CYLIDER_Y", CYLIDER_Y, "start angle", glMatrix.toDegree(startAngleForCenterAlign)); + + for (var yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength + /* bottom & top */ + ; yIdx++) { + for (lngIdx = 0; lngIdx <= longitudeBands$1; lngIdx++) { + var angle$$1 = startAngleForCenterAlign + lngIdx / longitudeBands$1 * cylinderMaxRadian; + var x = Math.cos(angle$$1); + var y = CYLIDER_Y[yIdx]; + var z = Math.sin(angle$$1); + var u = void 0; + var v = void 0; + + if (rotated) { + // Rotated 90 degree (counter clock wise) + u = 1 - yIdx; // yLength - yIdx; + + v = lngIdx / longitudeBands$1; + } else { + // // Normal case (Not rotated) + u = lngIdx / longitudeBands$1; + v = yIdx; + } + + textureCoordData$1.push(u, v); + vertexPositionData$1.push(x, y, z); + + if (yIdx === 0 && lngIdx < longitudeBands$1) { + var a = lngIdx; + var b = a + longitudeBands$1 + 1; + indexData$1.push(a, b, a + 1, b, b + 1, a + 1); + } + } + } + }; + + return CylinderRenderer; + }(Renderer); + + CylinderRenderer._VERTEX_POSITION_DATA = vertexPositionData$1; + CylinderRenderer._TEXTURE_COORD_DATA = textureCoordData$1; + CylinderRenderer._INDEX_DATA = indexData$1; + return CylinderRenderer; + }(); + + var _Promise$2 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var VR_DISPLAY_PRESENT_CHANGE = "vrdisplaypresentchange"; + var DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1]; + var DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1]; + var EYES = { + LEFT: "left", + RIGHT: "right" + }; + + var VRManager = + /*#__PURE__*/ + function () { + var VRManager = + /*#__PURE__*/ + function () { + _createClass(VRManager, [{ + key: "context", + get: function get() { + return this._vrDisplay; + } + }]); + + function VRManager() { + var _this = this; + + this.destroy = function () { + var vrDisplay = _this._vrDisplay; + + _this.removeEndCallback(_this.destroy); + + if (vrDisplay && vrDisplay.isPresenting) { + vrDisplay.exitPresent(); + } + + _this._clear(); + }; + + this._frameData = new window.VRFrameData(); + + this._clear(); + } + + var _proto = VRManager.prototype; + + _proto.canRender = function canRender() { + return Boolean(this._vrDisplay); + }; + + _proto.beforeRender = function beforeRender(gl) { + // Render to the default backbuffer + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + }; + + _proto.afterRender = function afterRender() { + this._vrDisplay.submitFrame(); + }; + + _proto.getEyeParams = function getEyeParams(gl) { + var display = this._vrDisplay; + var halfWidth = gl.drawingBufferWidth * 0.5; + var height = gl.drawingBufferHeight; + var frameData = this._frameData; + display.getFrameData(frameData); + var leftMVMatrix = frameData.leftViewMatrix; + var rightMVMatrix = frameData.rightViewMatrix; + rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset); + rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset); + return [{ + viewport: [0, 0, halfWidth, height], + mvMatrix: leftMVMatrix, + pMatrix: frameData.leftProjectionMatrix + }, { + viewport: [halfWidth, 0, halfWidth, height], + mvMatrix: rightMVMatrix, + pMatrix: frameData.rightProjectionMatrix + }]; + }; + + _proto.isPresenting = function isPresenting() { + return Boolean(this._vrDisplay && this._vrDisplay.isPresenting); + }; + + _proto.addEndCallback = function addEndCallback(callback) { + window.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + window.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback); + }; + + _proto.requestPresent = function requestPresent(canvas) { + var _this2 = this; + + return new _Promise$2(function (resolve, reject) { + navigator.getVRDisplays().then(function (displays) { + var vrDisplay = displays.length && displays[0]; + + if (!vrDisplay) { + reject(new Error("No displays available.")); + return; + } + + if (!vrDisplay.capabilities.canPresent) { + reject(new Error("Display lacking capability to present.")); + return; + } + + vrDisplay.requestPresent([{ + source: canvas + }]).then(function () { + var leftEye = vrDisplay.getEyeParameters(EYES.LEFT); + var rightEye = vrDisplay.getEyeParameters(EYES.RIGHT); + canvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2; + canvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight); + + _this2._setDisplay(vrDisplay); + + resolve(); + }); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setDisplay = function _setDisplay(vrDisplay) { + this._vrDisplay = vrDisplay; + var layers = vrDisplay.getLayers(); + + if (layers.length) { + var layer = layers[0]; + this._leftBounds = layer.leftBounds; + this._rightBounds = layer.rightBounds; + } + + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._vrDisplay = null; + this._leftBounds = DEFAULT_LEFT_BOUNDS; + this._rightBounds = DEFAULT_RIGHT_BOUNDS; + this._yawOffset = 0; + }; + + return VRManager; + }(); + + return VRManager; + }(); + + var XR_REFERENCE_SPACE = "local"; + + var XRManager = + /*#__PURE__*/ + function () { + var XRManager = + /*#__PURE__*/ + function () { + _createClass(XRManager, [{ + key: "context", + get: function get() { + return this._xrSession; + } + }]); + + function XRManager() { + var _this = this; + + this.destroy = function () { + var xrSession = _this._xrSession; + + _this.removeEndCallback(_this.destroy); + + if (xrSession) { + // Capture to avoid errors + xrSession.end().then(function () {}, function () {}); + } + + _this._clear(); + }; + + this._clear(); + } + + var _proto = XRManager.prototype; + + _proto.canRender = function canRender(frame) { + var pose = frame.getViewerPose(this._xrRefSpace); + return Boolean(pose); + }; + + _proto.beforeRender = function beforeRender(gl, frame) { + var session = frame.session; + var baseLayer = session.renderState.baseLayer; + gl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer); + }; + + _proto.afterRender = function afterRender() {}; + + _proto.getEyeParams = function getEyeParams(gl, frame) { + var _this2 = this; + + var session = frame.session; + var pose = frame.getViewerPose(this._xrRefSpace); + + if (!pose) { + // Can't render + return null; + } + + var glLayer = session.renderState.baseLayer; + return pose.views.map(function (view) { + var viewport = glLayer.getViewport(view); + var mvMatrix = view.transform.inverse.matrix; + + if (IS_SAFARI_ON_DESKTOP) { + rotateX(mvMatrix, mvMatrix, toRadian(180)); + } + + rotateY(mvMatrix, mvMatrix, _this2._yawOffset); + return { + viewport: [viewport.x, viewport.y, viewport.width, viewport.height], + mvMatrix: mvMatrix, + pMatrix: view.projectionMatrix + }; + }); + }; + + _proto.isPresenting = function isPresenting() { + return this._presenting; + }; + + _proto.addEndCallback = function addEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.addEventListener("end", callback); + }; + + _proto.removeEndCallback = function removeEndCallback(callback) { + var session = this._xrSession; + if (!session) return; + session.removeEventListener("end", callback); + }; + + _proto.requestPresent = function requestPresent(canvas, gl) { + var _this3 = this; + + return navigator.xr.requestSession("immersive-vr", { + requiredFeatures: [XR_REFERENCE_SPACE] + }).then(function (session) { + var xrLayer = new window.XRWebGLLayer(session, gl); + session.updateRenderState({ + baseLayer: xrLayer + }); + return session.requestReferenceSpace(XR_REFERENCE_SPACE).then(function (refSpace) { + _this3._setSession(session, xrLayer, refSpace); + }); + }); + }; + + _proto.setYawOffset = function setYawOffset(offset) { + this._yawOffset = offset; + }; + + _proto._setSession = function _setSession(session, xrLayer, refSpace) { + this._xrSession = session; + this._xrLayer = xrLayer; + this._xrRefSpace = refSpace; + this._presenting = true; + this.addEndCallback(this.destroy); + }; + + _proto._clear = function _clear() { + this._xrSession = null; + this._xrLayer = null; + this._xrRefSpace = null; + this._presenting = false; + this._yawOffset = 0; + }; + + return XRManager; + }(); + + return XRManager; + }(); + + var WebGLAnimator = + /*#__PURE__*/ + function () { + var WebGLAnimator = + /*#__PURE__*/ + function () { + function WebGLAnimator() { + var _this = this; + + this._onLoop = function () { + _this._callback.apply(_this, arguments); + + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + }; + + this._onLoopNextTick = function () { + var before = performance.now(); + + _this._callback.apply(_this, arguments); + + var diff = performance.now() - before; + + if (_this._rafTimer >= 0) { + clearTimeout(_this._rafTimer); + _this._rafTimer = -1; + } + /** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */ + + + if (diff < 16) { + _this._rafId = _this._context.requestAnimationFrame(_this._onLoop); + } else { + /** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/ + _this._rafTimer = setTimeout(_this._onLoop, 0); + } + }; + + this._callback = null; + this._context = window; + this._rafId = -1; + this._rafTimer = -1; + } + + var _proto = WebGLAnimator.prototype; + + _proto.setCallback = function setCallback(callback) { + this._callback = callback; + }; + + _proto.setContext = function setContext(context) { + this._context = context; + }; + + _proto.start = function start() { + var context = this._context; + var callback = this._callback; // No context / callback set + + if (!context || !callback) return; // Animation already started + + if (this._rafId >= 0 || this._rafTimer >= 0) return; + + if (IS_SAFARI_ON_DESKTOP) { + this._rafId = context.requestAnimationFrame(this._onLoopNextTick); + } else { + this._rafId = context.requestAnimationFrame(this._onLoop); + } + }; + + _proto.stop = function stop() { + if (this._rafId >= 0) { + this._context.cancelAnimationFrame(this._rafId); + } + + if (this._rafTimer >= 0) { + clearTimeout(this._rafTimer); + } + + this._rafId = -1; + this._rafTimer = -1; + } + /** + * There can be more than 1 argument when we use XRSession's raf + */ + ; + + return WebGLAnimator; + }(); + + return WebGLAnimator; + }(); + + var _Promise$3 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + var ImageType = PROJECTION_TYPE; + var DEVICE_PIXEL_RATIO = devicePixelRatio || 1; // DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다. + + if (DEVICE_PIXEL_RATIO > 2) { + DEVICE_PIXEL_RATIO = 2; + } // define custom events name + + /** + * TODO: how to manage events/errortype with PanoViewer + * + * I think renderer events should be seperated from viewer events although it has same name. + */ + + + var EVENTS$2 = { + BIND_TEXTURE: "bindTexture", + IMAGE_LOADED: "imageLoaded", + ERROR: "error", + RENDERING_CONTEXT_LOST: "renderingContextLost", + RENDERING_CONTEXT_RESTORE: "renderingContextRestore" + }; + var ERROR_TYPE$1 = { + INVALID_DEVICE: 10, + NO_WEBGL: 11, + FAIL_IMAGE_LOAD: 12, + RENDERER_ERROR: 13 + }; + + var PanoImageRenderer = + /*#__PURE__*/ + function () { + var PanoImageRenderer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoImageRenderer, _Component); + + function PanoImageRenderer(image, width, height, isVideo, sphericalConfig, renderingContextAttributes) { + var _this; + + // Super constructor + _this = _Component.call(this) || this; + + _this._renderStereo = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var eyeParams = vr.getEyeParams(gl, frame); + if (!eyeParams) return; + vr.beforeRender(gl, frame); // Render both eyes + + for (var _i = 0, _arr = [0, 1]; _i < _arr.length; _i++) { + var eyeIndex = _arr[_i]; + var eyeParam = eyeParams[eyeIndex]; + _this.mvMatrix = eyeParam.mvMatrix; + _this.pMatrix = eyeParam.pMatrix; + gl.viewport.apply(gl, eyeParam.viewport); + gl.uniform1f(_this.shaderProgram.uEye, eyeIndex); + + _this._bindBuffers(); + + _this._draw(); + } + + vr.afterRender(); + }; + + _this.exitVR = function () { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; + if (!vr) return; + vr.removeEndCallback(_this.exitVR); + vr.destroy(); + _this._vr = null; // Restore canvas & context on iOS + + if (IS_IOS) { + _this._restoreStyle(); + } + + _this.updateViewportDimensions(_this.width, _this.height); + + _this._updateViewport(); + + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + + _this._bindBuffers(); + + _this._shouldForceDraw = true; + animator.stop(); + animator.setContext(window); + animator.setCallback(_this._render.bind(_assertThisInitialized(_this))); + animator.start(); + }; + + _this._onFirstVRFrame = function (time, frame) { + var vr = _this._vr; + var gl = _this.context; + var animator = _this._animator; // If rendering is not ready, wait for next frame + + if (!vr.canRender(frame)) return; + var minusZDir = fromValues$4(0, 0, -1); + var eyeParam = vr.getEyeParams(gl, frame)[0]; // Extract only rotation + + var mvMatrix = fromMat4(create$2(), eyeParam.mvMatrix); + var pMatrix = fromMat4(create$2(), eyeParam.pMatrix); + var mvInv = invert$2(create$2(), mvMatrix); + var pInv = invert$2(create$2(), pMatrix); + var viewDir = transformMat3(create$4(), minusZDir, pInv); + transformMat3(viewDir, viewDir, mvInv); + var yawOffset = util.yawOffsetBetween(viewDir, fromValues$4(0, 0, 1)); + + if (yawOffset === 0) { + // If the yawOffset is exactly 0, then device sensor is not ready + // So read it again until it has any value in it + return; + } + + vr.setYawOffset(yawOffset); + animator.setCallback(_this._renderStereo); + }; + + _this.sphericalConfig = sphericalConfig; + _this.fieldOfView = sphericalConfig.fieldOfView; + _this.width = width; + _this.height = height; + _this._lastQuaternion = null; + _this._lastYaw = null; + _this._lastPitch = null; + _this._lastFieldOfView = null; + _this.pMatrix = create$3(); + _this.mvMatrix = create$3(); // initialzie pMatrix + + perspective(_this.pMatrix, toRadian(_this.fieldOfView), width / height, 0.1, 100); + _this.textureCoordBuffer = null; + _this.vertexBuffer = null; + _this.indexBuffer = null; + _this.canvas = _this._initCanvas(width, height); + + _this._setDefaultCanvasStyle(); + + _this._wrapper = null; // canvas wrapper + + _this._wrapperOrigStyle = null; + _this._renderingContextAttributes = renderingContextAttributes; + _this._image = null; + _this._imageConfig = null; + _this._imageIsReady = false; + _this._shouldForceDraw = false; + _this._keepUpdate = false; // Flag to specify 'continuous update' on video even when still. + + _this._onContentLoad = _this._onContentLoad.bind(_assertThisInitialized(_this)); + _this._onContentError = _this._onContentError.bind(_assertThisInitialized(_this)); + _this._animator = new WebGLAnimator(); // VR/XR manager + + _this._vr = null; + + if (image) { + _this.setImage({ + image: image, + imageType: sphericalConfig.imageType, + isVideo: isVideo, + cubemapConfig: sphericalConfig.cubemapConfig + }); + } + + return _this; + } // FIXME: Please refactor me to have more loose connection to yawpitchcontrol + + + var _proto = PanoImageRenderer.prototype; + + _proto.setYawPitchControl = function setYawPitchControl(yawPitchControl) { + this._yawPitchControl = yawPitchControl; + }; + + _proto.getContent = function getContent() { + return this._image; + }; + + _proto.setImage = function setImage(_ref) { + var image = _ref.image, + imageType = _ref.imageType, + _ref$isVideo = _ref.isVideo, + isVideo = _ref$isVideo === void 0 ? false : _ref$isVideo, + cubemapConfig = _ref.cubemapConfig; + this._imageIsReady = false; + this._isVideo = isVideo; + this._imageConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only */ + order: imageType === ImageType.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, cubemapConfig); + + this._setImageType(imageType); + + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + if (isVideo) { + this._contentLoader = new VideoLoader(); + this._keepUpdate = true; + } else { + this._contentLoader = new ImageLoader(); + this._keepUpdate = false; + } // img element or img url + + + this._contentLoader.set(image); // 이미지의 사이즈를 캐시한다. + // image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed. + + + this._image = this._contentLoader.getElement(); + return this._contentLoader.get().then(this._onContentLoad, this._onContentError)["catch"](function (e) { + return setTimeout(function () { + throw e; + }); + }); // Prevent exceptions from being isolated in promise chain. + }; + + _proto._setImageType = function _setImageType(imageType) { + var _this2 = this; + + if (!imageType || this._imageType === imageType) { + return; + } + + this._imageType = imageType; + this._isCubeMap = imageType === ImageType.CUBEMAP; + + if (this._renderer) { + this._renderer.off(); + } + + switch (imageType) { + case ImageType.CUBEMAP: + this._renderer = new CubeRenderer(); + break; + + case ImageType.CUBESTRIP: + this._renderer = new CubeStripRenderer(); + break; + + case ImageType.PANORAMA: + this._renderer = new CylinderRenderer(); + break; + + case ImageType.STEREOSCOPIC_EQUI: + this._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat); + break; + + default: + this._renderer = new SphereRenderer(STEREO_FORMAT.NONE); + break; + } + + this._renderer.on(Renderer.EVENTS.ERROR, function (e) { + _this2.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.RENDERER_ERROR, + message: e.message + }); + }); + + this._initWebGL(); + }; + + _proto._initCanvas = function _initCanvas(width, height) { + var canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + this._onWebglcontextlost = this._onWebglcontextlost.bind(this); + this._onWebglcontextrestored = this._onWebglcontextrestored.bind(this); + canvas.addEventListener("webglcontextlost", this._onWebglcontextlost); + canvas.addEventListener("webglcontextrestored", this._onWebglcontextrestored); + return canvas; + }; + + _proto._setDefaultCanvasStyle = function _setDefaultCanvasStyle() { + var canvas = this.canvas; + canvas.style.bottom = 0; + canvas.style.left = 0; + canvas.style.right = 0; + canvas.style.top = 0; + canvas.style.margin = "auto"; + canvas.style.maxHeight = "100%"; + canvas.style.maxWidth = "100%"; + canvas.style.outline = "none"; + canvas.style.position = "absolute"; + }; + + _proto._onContentError = function _onContentError(error) { + this._imageIsReady = false; + this._image = null; + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.FAIL_IMAGE_LOAD, + message: "failed to load image" + }); + return false; + }; + + _proto._triggerContentLoad = function _triggerContentLoad() { + this.trigger(EVENTS$2.IMAGE_LOADED, { + content: this._image, + isVideo: this._isVideo, + projectionType: this._imageType + }); + }; + + _proto._onContentLoad = function _onContentLoad(image) { + this._imageIsReady = true; + + this._triggerContentLoad(); + + return true; + }; + + _proto.isImageLoaded = function isImageLoaded() { + return !!this._image && this._imageIsReady && (!this._isVideo || this._image.readyState >= 2 + /* HAVE_CURRENT_DATA */ + ); + }; + + _proto.bindTexture = function bindTexture() { + var _this3 = this; + + return new _Promise$3(function (res, rej) { + if (!_this3._contentLoader) { + rej("ImageLoader is not initialized"); + return; + } + + _this3._contentLoader.get().then(function () { + _this3._bindTexture(); + }, rej).then(res); + }); + } // 부모 엘리먼트에 canvas 를 붙임 + ; + + _proto.attachTo = function attachTo(parentElement) { + this.detach(); + parentElement.appendChild(this.canvas); + this._wrapper = parentElement; + }; + + _proto.forceContextLoss = function forceContextLoss() { + if (this.hasRenderingContext()) { + var loseContextExtension = this.context.getExtension("WEBGL_lose_context"); + + if (loseContextExtension) { + loseContextExtension.loseContext(); + } + } + } // 부모 엘리먼트에서 canvas 를 제거 + ; + + _proto.detach = function detach() { + if (this.canvas.parentElement) { + this.canvas.parentElement.removeChild(this.canvas); + } + }; + + _proto.destroy = function destroy() { + if (this._contentLoader) { + this._contentLoader.destroy(); + } + + this._animator.stop(); + + this.detach(); + this.forceContextLoss(); + this.off(); + this.canvas.removeEventListener("webglcontextlost", this._onWebglcontextlost); + this.canvas.removeEventListener("webglcontextrestored", this._onWebglcontextrestored); + }; + + _proto.hasRenderingContext = function hasRenderingContext() { + if (!(this.context && !this.context.isContextLost())) { + return false; + } else if (this.context && !this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) { + return false; + } + + return true; + }; + + _proto._initShaderProgram = function _initShaderProgram() { + var gl = this.context; + + if (this.shaderProgram) { + gl.deleteProgram(this.shaderProgram); + this.shaderProgram = null; + } + + var renderer = this._renderer; + var vsSource = renderer.getVertexShaderSource(); + var fsSource = renderer.getFragmentShaderSource(); + var vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource); + var fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource); + var shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader); + + if (!shaderProgram) { + throw new Error("Failed to intialize shaders: " + WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())); + } + + gl.useProgram(shaderProgram); + shaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); + gl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute); + shaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix"); + shaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); + shaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); + shaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); + shaderProgram.uEye = gl.getUniformLocation(shaderProgram, "uEye"); + gl.enableVertexAttribArray(shaderProgram.textureCoordAttribute); // clear buffer + + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT); // Use TEXTURE0 + + gl.uniform1i(shaderProgram.samplerUniform, 0); + this.shaderProgram = shaderProgram; + }; + + _proto._onWebglcontextlost = function _onWebglcontextlost(e) { + e.preventDefault(); + this.trigger(EVENTS$2.RENDERING_CONTEXT_LOST); + }; + + _proto._onWebglcontextrestored = function _onWebglcontextrestored(e) { + this._initWebGL(); + + this.trigger(EVENTS$2.RENDERING_CONTEXT_RESTORE); + }; + + _proto.updateFieldOfView = function updateFieldOfView(fieldOfView) { + this.fieldOfView = fieldOfView; + + this._updateViewport(); + }; + + _proto.updateViewportDimensions = function updateViewportDimensions(width, height) { + var viewPortChanged = false; + this.width = width; + this.height = height; + var w = width * DEVICE_PIXEL_RATIO; + var h = height * DEVICE_PIXEL_RATIO; + + if (w !== this.canvas.width) { + this.canvas.width = w; + viewPortChanged = true; + } + + if (h !== this.canvas.height) { + this.canvas.height = h; + viewPortChanged = true; + } + + if (!viewPortChanged) { + return; + } + + this._updateViewport(); + + this._shouldForceDraw = true; + }; + + _proto._updateViewport = function _updateViewport() { + perspective(this.pMatrix, toRadian(this.fieldOfView), this.canvas.width / this.canvas.height, 0.1, 100); + this.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight); + }; + + _proto._initWebGL = function _initWebGL() { + var gl; // TODO: Following code does need to be executed only if width/height, cubicStrip property is changed. + + try { + this._initRenderingContext(); + + gl = this.context; + this.updateViewportDimensions(this.width, this.height); + + this._initShaderProgram(); + } catch (e) { + this.trigger(EVENTS$2.ERROR, { + type: ERROR_TYPE$1.NO_WEBGL, + message: "no webgl support" + }); + this.destroy(); + console.error(e); // eslint-disable-line no-console + + return; + } // 캔버스를 투명으로 채운다. + + + gl.clearColor(0, 0, 0, 0); + var textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D; + + if (this.texture) { + gl.deleteTexture(this.texture); + } + + this.texture = WebGLUtils.createTexture(gl, textureTarget); + + if (this._imageType === ImageType.CUBESTRIP) { + // TODO: Apply following options on other projection type. + gl.enable(gl.CULL_FACE); // gl.enable(gl.DEPTH_TEST); + } + }; + + _proto._initRenderingContext = function _initRenderingContext() { + if (this.hasRenderingContext()) { + return; + } + + if (!window.WebGLRenderingContext) { + throw new Error("WebGLRenderingContext not available."); + } + + this.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes); + + if (!this.context) { + throw new Error("Failed to acquire 3D rendering context"); + } + }; + + _proto._initBuffers = function _initBuffers() { + var vertexPositionData = this._renderer.getVertexPositionData(); + + var indexData = this._renderer.getIndexData(); + + var textureCoordData = this._renderer.getTextureCoordData(this._imageConfig); + + var gl = this.context; + this.vertexBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3, this.shaderProgram.vertexPositionAttribute); + this.indexBuffer = WebGLUtils.initBuffer(gl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1); + this.textureCoordBuffer = WebGLUtils.initBuffer(gl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2, this.shaderProgram.textureCoordAttribute); + + this._bindBuffers(); + }; + + _proto._bindTexture = function _bindTexture() { + // Detect if it is EAC Format while CUBESTRIP mode. + // We assume it is EAC if image is not 3/2 ratio. + if (this._imageType === ImageType.CUBESTRIP) { + var _this$_renderer$getDi = this._renderer.getDimension(this._image), + width = _this$_renderer$getDi.width, + height = _this$_renderer$getDi.height; + + var isEAC = width && height && width / height !== 1.5; + this.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, "uIsEAC"), isEAC); + } else if (this._imageType === ImageType.PANORAMA) { + var _this$_renderer$getDi2 = this._renderer.getDimension(this._image), + _width = _this$_renderer$getDi2.width, + _height = _this$_renderer$getDi2.height; + + var imageAspectRatio = _width && _height && _width / _height; + + this._renderer.updateShaderData({ + imageAspectRatio: imageAspectRatio + }); + } // intialize shader buffers after image is loaded.(by updateShaderData) + // because buffer may be differ by image size.(eg. CylinderRenderer) + + + this._initBuffers(); + + this._renderer.bindTexture(this.context, this.texture, this._image, this._imageConfig); + + this._shouldForceDraw = true; + this.trigger(EVENTS$2.BIND_TEXTURE); + }; + + _proto._updateTexture = function _updateTexture() { + this._renderer.updateTexture(this.context, this._image, this._imageConfig); + }; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + if (doUpdate && this.isImageLoaded() === false) { + // Force to draw a frame after image is loaded on render() + this._shouldForceDraw = true; + } + + this._keepUpdate = doUpdate; + }; + + _proto.startRender = function startRender() { + this._animator.setCallback(this._render.bind(this)); + + this._animator.start(); + }; + + _proto.stopRender = function stopRender() { + this._animator.stop(); + }; + + _proto.renderWithQuaternion = function renderWithQuaternion(quaternion, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastQuaternion && exactEquals$6(this._lastQuaternion, quaternion) && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // updatefieldOfView only if fieldOfView is changed. + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + this.mvMatrix = fromQuat$1(create$3(), quaternion); + + this._draw(); + + this._lastQuaternion = clone$6(quaternion); + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto.renderWithYawPitch = function renderWithYawPitch(yaw, pitch, fieldOfView) { + if (!this.isImageLoaded()) { + return; + } + + if (this._keepUpdate === false && this._lastYaw !== null && this._lastYaw === yaw && this._lastPitch !== null && this._lastPitch === pitch && this.fieldOfView && this.fieldOfView === fieldOfView && this._shouldForceDraw === false) { + return; + } // fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출 + + + if (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) { + this.updateFieldOfView(fieldOfView); + } + + identity$3(this.mvMatrix); + rotateX(this.mvMatrix, this.mvMatrix, -toRadian(pitch)); + rotateY(this.mvMatrix, this.mvMatrix, -toRadian(yaw)); + + this._draw(); + + this._lastYaw = yaw; + this._lastPitch = pitch; + + if (this._shouldForceDraw) { + this._shouldForceDraw = false; + } + }; + + _proto._render = function _render() { + var yawPitchControl = this._yawPitchControl; + var fov = yawPitchControl.getFov(); + + if (yawPitchControl.shouldRenderWithQuaternion()) { + var quaternion = yawPitchControl.getQuaternion(); + this.renderWithQuaternion(quaternion, fov); + } else { + var yawPitch = yawPitchControl.getYawPitch(); + this.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov); + } + }; + + _proto._bindBuffers = function _bindBuffers() { + var gl = this.context; + var program = this.shaderProgram; + var vertexBuffer = this.vertexBuffer; + var textureCoordBuffer = this.textureCoordBuffer; + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); + gl.enableVertexAttribArray(program.vertexPositionAttribute); + gl.vertexAttribPointer(program.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer); + gl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer); + gl.enableVertexAttribArray(program.textureCoordAttribute); + gl.vertexAttribPointer(program.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0); + }; + + _proto._draw = function _draw() { + if (this._isVideo && this._keepUpdate) { + this._updateTexture(); + } + + this._renderer.render({ + gl: this.context, + shaderProgram: this.shaderProgram, + indexBuffer: this.indexBuffer, + mvMatrix: this.mvMatrix, + pMatrix: this.pMatrix + }); + } + /** + * Returns projection renderer by each type + */ + ; + + _proto.getProjectionRenderer = function getProjectionRenderer() { + return this._renderer; + } + /** + * @return Promise + */ + ; + + _proto.enterVR = function enterVR() { + var vr = this._vr; + + if (!WEBXR_SUPPORTED && !navigator.getVRDisplays) { + return _Promise$3.reject("VR is not available on this browser."); + } + + if (vr && vr.isPresenting()) { + return _Promise$3.resolve("VR already enabled."); + } + + return this._requestPresent(); + }; + + _proto._requestPresent = function _requestPresent() { + var _this4 = this; + + var gl = this.context; + var canvas = this.canvas; + var animator = this._animator; + this._vr = WEBXR_SUPPORTED ? new XRManager() : new VRManager(); + var vr = this._vr; + animator.stop(); + return new _Promise$3(function (resolve, reject) { + vr.requestPresent(canvas, gl).then(function () { + vr.addEndCallback(_this4.exitVR); + animator.setContext(vr.context); + animator.setCallback(_this4._onFirstVRFrame); + + if (IS_IOS) { + _this4._setWrapperFullscreen(); + } + + _this4._shouldForceDraw = true; + animator.start(); + resolve("success"); + })["catch"](function (e) { + vr.destroy(); + _this4._vr = null; + animator.start(); + reject(e); + }); + }); + }; + + _proto._setWrapperFullscreen = function _setWrapperFullscreen() { + var wrapper = this._wrapper; + if (!wrapper) return; + this._wrapperOrigStyle = wrapper.getAttribute("style"); + var wrapperStyle = wrapper.style; + wrapperStyle.width = "100vw"; + wrapperStyle.height = "100vh"; + wrapperStyle.position = "fixed"; + wrapperStyle.left = "0"; + wrapperStyle.top = "0"; + wrapperStyle.zIndex = "9999"; + }; + + _proto._restoreStyle = function _restoreStyle() { + var wrapper = this._wrapper; + var canvas = this.canvas; + if (!wrapper) return; + + if (this._wrapperOrigStyle) { + wrapper.setAttribute("style", this._wrapperOrigStyle); + } else { + wrapper.removeAttribute("style"); + } + + this._wrapperOrigStyle = null; // Restore canvas style + + canvas.removeAttribute("style"); + + this._setDefaultCanvasStyle(); + }; + + return PanoImageRenderer; + }(Component); + + PanoImageRenderer.EVENTS = EVENTS$2; + PanoImageRenderer.ERROR_TYPE = ERROR_TYPE$1; + return PanoImageRenderer; + }(); + + var _Promise$4 = typeof Promise === 'undefined' ? es6Promise.Promise : Promise; + + var PanoViewer = + /*#__PURE__*/ + function () { + var PanoViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(PanoViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.PanoViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.PanoViewer + */ + // It should be deprecated! + + /** + * Constant value for touch directions + * @ko 터치 방향에 대한 상수 값. + * @namespace + * @name TOUCH_DIRECTION + * @memberof eg.view360.PanoViewer + */ + + /** + * @classdesc 360 media viewer + * @ko 360 미디어 뷰어 + * @class + * @name eg.view360.PanoViewer + * @extends eg.Component + * + * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트 + * @param {Object} config + * + * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정) + * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
+ * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다. + * @param {Object} [config.cubemapConfig.order = "RLUDBF"(ProjectionType === CUBEMAP) | "RLUDFB" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서 + * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다. + * @param {String} [config.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
+ * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위) + * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위) + * + * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위) + * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위) + * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위) + * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다 + * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다. + * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키 + * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR")
{@link eg.view360.PanoViewer.GYRO_MODE}
+ * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위 + * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위 + * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위 + * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
+ * + * @example + * // PanoViewer Creation + * // create PanoViewer with option + * var PanoViewer = eg.view360.PanoViewer; + * // Area where the image will be displayed(HTMLElement) + * var container = document.getElementById("myPanoViewer"); + * + * var panoViewer = new PanoViewer(container, { + * // If projectionType is not specified, the default is "equirectangular". + * // Specifies an image of the "equirectangular" type. + * image: "/path/to/image/image.jpg" + *}); + * + * @example + * // Cubemap Config Setting Example + * // For support Youtube EAC projection, You should set cubemapConfig as follows. + * cubemapConfig: { + * order: "LFRDBU", + * tileConfig: [ + * tileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}] + * ] + * } + */ + function PanoViewer(container, options) { + var _this; + + if (options === void 0) { + options = {}; + } + + _this = _Component.call(this) || this; // Raises the error event if webgl is not supported. + + if (!WebGLUtils.isWebGLAvailable()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.NO_WEBGL, + message: "no webgl support" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!WebGLUtils.isStableWebGL()) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_DEVICE, + message: "blacklisted browser" + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } + + if (!!options.image && !!options.video) { + setTimeout(function () { + _this.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.INVALID_RESOURCE, + message: "Specifying multi resouces(both image and video) is not valid." + }); + }, 0); + return _assertThisInitialized(_this) || _assertThisInitialized(_this); + } // Check XR support at not when imported, but when created. + // This is intended to make polyfills easier to use. + + + checkXRSupport(); + _this._container = container; + _this._image = options.image || options.video; + _this._isVideo = !!options.video; + _this._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + _this._cubemapConfig = _extends({ + /* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/ + order: _this._projectionType === PROJECTION_TYPE.CUBEMAP ? "RLUDBF" : "RLUDFB", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, options.cubemapConfig); + _this._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; // If the width and height are not provided, will use the size of the container. + + _this._width = options.width || parseInt(window.getComputedStyle(container).width, 10); + _this._height = options.height || parseInt(window.getComputedStyle(container).height, 10); + /** + * Cache the direction for the performance in renderLoop + * + * This value should be updated by "change" event of YawPitchControl. + */ + + _this._yaw = options.yaw || 0; + _this._pitch = options.pitch || 0; + _this._fov = options.fov || 65; + _this._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH; + _this._quaternion = null; + _this._aspectRatio = _this._height !== 0 ? _this._width / _this._height : 1; + var fovRange = options.fovRange || [30, 110]; + var touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ? options.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL; + + var yawPitchConfig = _extends(options, { + element: container, + yaw: _this._yaw, + pitch: _this._pitch, + fov: _this._fov, + gyroMode: _this._gyroMode, + fovRange: fovRange, + aspectRatio: _this._aspectRatio, + touchDirection: touchDirection + }); + + _this._isReady = false; + + _this._initYawPitchControl(yawPitchConfig); + + _this._initRenderer(_this._yaw, _this._pitch, _this._fov, _this._projectionType, _this._cubemapConfig); + + return _this; + } + /** + * Get the video element that the viewer is currently playing. You can use this for playback. + * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다. + * @method eg.view360.PanoViewer#getVideo + * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement + * @example + * var videoTag = panoViewer.getVideo(); + * videoTag.play(); // play video! + */ + + + var _proto = PanoViewer.prototype; + + _proto.getVideo = function getVideo() { + if (!this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the video information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setVideo + * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정) + * @param {Object} param + * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}("equirectangular")] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setVideo("/path/to/video/video.mp4", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR + * }); + */ + ; + + _proto.setVideo = function setVideo(video, param) { + if (param === void 0) { + param = {}; + } + + if (video) { + this.setImage(video, { + projectionType: param.projectionType, + isVideo: true, + cubemapConfig: param.cubemapConfig, + stereoFormat: param.stereoFormat + }); + } + + return this; + } + /** + * Get the image information that the viewer is currently using. + * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다. + * @method eg.view360.PanoViewer#getImage + * @return {Image} Image Object이미지 객체 + * @example + * var imageObj = panoViewer.getImage(); + */ + ; + + _proto.getImage = function getImage() { + if (this._isVideo) { + return null; + } + + return this._photoSphereRenderer.getContent(); + } + /** + * Set the image information to be used by the viewer. + * @ko 뷰어가 사용할 이미지 정보를 설정합니다. + * @method eg.view360.PanoViewer#setImage + * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.) + * @param {Object} param Additional information이미지 추가 정보 + * @param {String} [param.projectionType="equirectangular"] Projection Type프로젝션 타입 + * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃 + * @param {String} [param.stereoFormat="3dv"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조. + * + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setImage("/path/to/image/image.png", { + * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP + * }); + */ + ; + + _proto.setImage = function setImage(image, param) { + if (param === void 0) { + param = {}; + } + + var cubemapConfig = _extends({ + order: "RLUDBF", + tileConfig: { + flipHorizontal: false, + rotation: 0 + } + }, param.cubemapConfig); + + var stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM; + var isVideo = !!param.isVideo; + + if (this._image && this._isVideo !== isVideo) { + /* eslint-disable no-console */ + console.warn("Currently not supporting to change content type(Image <--> Video)"); + /* eslint-enable no-console */ + + return this; + } + + if (image) { + this._image = image; + this._isVideo = isVideo; + this._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR; + this._cubemapConfig = cubemapConfig; + this._stereoFormat = stereoFormat; + + this._deactivate(); + + this._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig); + } + + return this; + } + /** + * Set whether the renderer always updates the texture and renders. + * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다. + * + * @method eg.view360.PanoViewer#keepUpdate + * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다. + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.keepUpdate = function keepUpdate(doUpdate) { + this._photoSphereRenderer.keepUpdate(doUpdate); + + return this; + } + /** + * Get projection type (equirectangular/cube) + * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다. + * + * @method eg.view360.PanoViewer#getProjectionType + * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE} + */ + ; + + _proto.getProjectionType = function getProjectionType() { + return this._projectionType; + } + /** + * Activate the device's motion sensor, and return the Promise whether the sensor is enabled + * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element. + * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다. + * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * @method eg.view360.PanoViewer#enableSensor + * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다. + */ + ; + + _proto.enableSensor = function enableSensor() { + return new _Promise$4(function (resolve, reject) { + if (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === "function") { + DeviceMotionEvent.requestPermission().then(function (permissionState) { + if (permissionState === "granted") { + resolve(); + } else { + reject(new Error("permission denied")); + } + })["catch"](function (e) { + // This can happen when this method wasn't triggered by user interaction + reject(e); + }); + } else { + resolve(); + } + }); + } + /** + * Disable the device's motion sensor. + * @ko 디바이스의 모션 센서를 비활성화합니다. + * @deprecated + * @method eg.view360.PanoViewer#disableSensor + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.disableSensor = function disableSensor() { + return this; + } + /** + * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred). + * This method must be used in the context of user interaction, like onclick callback on the button element. + * It can be rejected when an enabling device sensor fails or image/video is still loading("ready" event not triggered). + * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다) + * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다. + * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우("ready"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다. + * @method eg.view360.PanoViewer#enterVR + * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error) + */ + ; + + _proto.enterVR = function enterVR() { + var _this2 = this; + + if (!this._isReady) { + return _Promise$4.reject(new Error("PanoViewer is not ready to show image.")); + } + + return new _Promise$4(function (resolve, reject) { + _this2.enableSensor().then(function () { + return _this2._photoSphereRenderer.enterVR(); + }).then(function (res) { + return resolve(res); + })["catch"](function (e) { + return reject(e); + }); + }); + } + /** + * Exit VR stereo rendering mode. + * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다. + * + * @method eg.view360.PanoViewer#exitVR + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.exitVR = function exitVR() { + this._photoSphereRenderer.exitVR(); + + return this; + } // TODO: Remove parameters as they're just using private values + ; + + _proto._initRenderer = function _initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) { + var _this3 = this; + + this._photoSphereRenderer = new PanoImageRenderer(this._image, this._width, this._height, this._isVideo, { + initialYaw: yaw, + initialPitch: pitch, + fieldOfView: fov, + imageType: projectionType, + cubemapConfig: cubemapConfig, + stereoFormat: this._stereoFormat + }); + + this._photoSphereRenderer.setYawPitchControl(this._yawPitchControl); + + this._bindRendererHandler(); + + this._photoSphereRenderer.bindTexture().then(function () { + return _this3._activate(); + })["catch"](function () { + _this3._triggerEvent(EVENTS$1.ERROR, { + type: ERROR_TYPE.FAIL_BIND_TEXTURE, + message: "failed to bind texture" + }); + }); + } + /** + * update values of YawPitchControl if needed. + * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image. + * + * This function should be called after isReady status is true. + */ + ; + + _proto._updateYawPitchIfNeeded = function _updateYawPitchIfNeeded() { + if (this._projectionType === PanoViewer.ProjectionType.PANORAMA) { + // update fov by aspect ratio + var image = this._photoSphereRenderer.getContent(); + + var imageAspectRatio = image.naturalWidth / image.naturalHeight; + var isCircular; + var yawSize; + var maxFov; // If height is larger than width, then we assume it's rotated by 90 degree. + + if (imageAspectRatio < 1) { + // So inverse the aspect ratio. + imageAspectRatio = 1 / imageAspectRatio; + } + + if (imageAspectRatio < 6) { + yawSize = util.toDegree(imageAspectRatio); + isCircular = false; // 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5 + + maxFov = util.toDegree(Math.atan(0.5)) * 2; + } else { + yawSize = 360; + isCircular = true; + maxFov = 360 / imageAspectRatio; // Make it 5 fixed as axes does. + } // console.log("_updateYawPitchIfNeeded", maxFov, "aspectRatio", image.naturalWidth, image.naturalHeight, "yawSize", yawSize); + + + var minFov = this._yawPitchControl.option("fovRange")[0]; // this option should be called after fov is set. + + + this._yawPitchControl.option({ + "fov": maxFov, + + /* parameter for internal validation for pitchrange */ + "yawRange": [-yawSize / 2, yawSize / 2], + isCircular: isCircular, + "pitchRange": [-maxFov / 2, maxFov / 2], + "fovRange": [minFov, maxFov] + }); + + this.lookAt({ + fov: maxFov + }); + } + }; + + _proto._bindRendererHandler = function _bindRendererHandler() { + var _this4 = this; + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, function (e) { + _this4.trigger(EVENTS$1.ERROR, e); + }); + + this._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, function (e) { + _this4._deactivate(); + + _this4.trigger(EVENTS$1.ERROR, { + type: ERROR_TYPE.RENDERING_CONTEXT_LOST, + message: "webgl rendering context lost" + }); + }); + }; + + _proto._initYawPitchControl = function _initYawPitchControl(yawPitchConfig) { + var _this5 = this; + + this._yawPitchControl = new YawPitchControl(yawPitchConfig); + + this._yawPitchControl.on(EVENTS$1.ANIMATION_END, function (e) { + _this5._triggerEvent(EVENTS$1.ANIMATION_END, e); + }); + + this._yawPitchControl.on("change", function (e) { + _this5._yaw = e.yaw; + _this5._pitch = e.pitch; + _this5._fov = e.fov; + _this5._quaternion = e.quaternion; + + _this5._triggerEvent(EVENTS$1.VIEW_CHANGE, e); + }); + }; + + _proto._triggerEvent = function _triggerEvent(name, param) { + var evt = param || {}; + /** + * Events that is fired when error occurs + * @ko 에러 발생 시 발생하는 이벤트 + * @name eg.view360.PanoViewer#error + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.type Error type + * 10: INVALID_DEVICE: Unsupported device + * 11: NO_WEBGL: Webgl not support + * 12, FAIL_IMAGE_LOAD: Failed to load image + * 13: FAIL_BIND_TEXTURE: Failed to bind texture + * 14: INVALID_RESOURCE: Only one resource(image or video) should be specified + * 15: RENDERING_CONTEXT_LOST: WebGL context lost occurred + * 에러 종류 + * 10: INVALID_DEVICE: 미지원 기기 + * 11: NO_WEBGL: WEBGL 미지원 + * 12, FAIL_IMAGE_LOAD: 이미지 로드 실패 + * 13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패 + * 14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함) + * 15: RENDERING_CONTEXT_LOST: WebGL context lost 발생 + * + * @param {String} param.message Error message 에러 메시지 + * @see {@link eg.view360.PanoViewer.ERROR_TYPE} + * @example + * + * viwer.on({ + * "error" : function(evt) { + * // evt.type === 13 + * // evt.message === "failed to bind texture" + * }); + * + * // constant can be used + * viwer.on({ + * eg.view360.PanoViewer.EVENTS.ERROR : function(evt) { + * // evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE + * // evt.message === "failed to bind texture" + * }); + */ + + /** + * Events that is fired when PanoViewer is ready to go. + * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트 + * @name eg.view360.PanoViewer#ready + * @event + * + * @example + * + * viwer.on({ + * "ready" : function(evt) { + * // PanoViewer is ready to show image and handle user interaction. + * }); + */ + + /** + * Events that is fired when direction or fov is changed. + * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#viewChange + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number} param.yaw yawyaw + * @param {Number} param.pitch pitch pitch + * @param {Number} param.fov Field of view (fov) 화각 + * @example + * + * viwer.on({ + * "viewChange" : function(evt) { + * //evt.yaw, evt.pitch, evt.fov is available. + * }); + */ + + /** + * Events that is fired when animation which is triggered by inertia is ended. + * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트 + * @name eg.view360.PanoViewer#animationEnd + * @event + * @example + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // animation is ended. + * }); + */ + + return this.trigger(name, evt); + } + /** + * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}. + * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다. + * @method eg.view360.PanoViewer#setUseZoom + * @param {Boolean} useZoom + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseZoom = function setUseZoom(useZoom) { + typeof useZoom === "boolean" && this._yawPitchControl.option("useZoom", useZoom); + return this; + } + /** + * When true, enables the keyboard move key control: awsd, arrow keys + * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키) + * @method eg.view360.PanoViewer#setUseKeyboard + * @param {Boolean} useKeyboard + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setUseKeyboard = function setUseKeyboard(useKeyboard) { + this._yawPitchControl.option("useKeyboard", useKeyboard); + + return this; + } + /** + * Enables control through device motion. ("none", "yawPitch", "VR") + * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. ("none", "yawPitch", "VR") + * @method eg.view360.PanoViewer#setGyroMode + * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE} + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setGyroMode("yawPitch"); + * //equivalent + * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH); + */ + ; + + _proto.setGyroMode = function setGyroMode(gyroMode) { + this._yawPitchControl.option("gyroMode", gyroMode); + + return this; + } + /** + * Set the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 설정합니다. + * @method eg.view360.PanoViewer#setFovRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setFovRange([50, 90]); + */ + ; + + _proto.setFovRange = function setFovRange(range) { + this._yawPitchControl.option("fovRange", range); + + return this; + } + /** + * Getting the range of controllable FOV values + * @ko 제어 가능한 FOV 구간을 반환합니다. + * @method eg.view360.PanoViewer#getFovRange + * @return {Array} + * @example + * var range = panoViewer.getFovRange(); //[50, 90] + */ + ; + + _proto.getFovRange = function getFovRange() { + return this._yawPitchControl.option("fovRange"); + } + /** + * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size. + * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다. + * @method eg.view360.PanoViewer#updateViewportDimensions + * @param {Object} [size] + * @param {Number} [size.width=width of container] + * @param {Number} [size.height=height of container] + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.updateViewportDimensions = function updateViewportDimensions(size) { + if (size === void 0) { + size = { + width: undefined, + height: undefined + }; + } + + if (!this._isReady) { + return this; + } + + var containerSize; + + if (size.width === undefined || size.height === undefined) { + containerSize = window.getComputedStyle(this._container); + } + + var width = size.width || parseInt(containerSize.width, 10); + var height = size.height || parseInt(containerSize.height, 10); // Skip if viewport is not changed. + + if (width === this._width && height === this._height) { + return this; + } + + this._width = width; + this._height = height; + this._aspectRatio = width / height; + + this._photoSphereRenderer.updateViewportDimensions(width, height); + + this._yawPitchControl.option("aspectRatio", this._aspectRatio); + + this._yawPitchControl.updatePanScale({ + height: height + }); + + this.lookAt({}, 0); + return this; + } + /** + * Get the current field of view(FOV) + * @ko 현재 field of view(FOV) 값을 반환합니다. + * @method eg.view360.PanoViewer#getFov + * @return {Number} + */ + ; + + _proto.getFov = function getFov() { + return this._fov; + } + /** + * Get the horizontal field of view in degree + */ + ; + + _proto._getHFov = function _getHFov() { + return util.toDegree(2 * Math.atan(this._aspectRatio * Math.tan(toRadian(this._fov) / 2))); + } + /** + * Get current yaw value + * @ko 현재 yaw 값을 반환합니다. + * @method eg.view360.PanoViewer#getYaw + * @return {Number} + */ + ; + + _proto.getYaw = function getYaw() { + return this._yaw; + } + /** + * Get current pitch value + * @ko 현재 pitch 값을 반환합니다. + * @method eg.view360.PanoViewer#getPitch + * @return {Number} + */ + ; + + _proto.getPitch = function getPitch() { + return this._pitch; + } + /** + * Get the range of controllable Yaw values + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#getYawRange + * @return {Array} + */ + ; + + _proto.getYawRange = function getYawRange() { + return this._yawPitchControl.option("yawRange"); + } + /** + * Get the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다. + * @method eg.view360.PanoViewer#getPitchRange + * @return {Array} + */ + ; + + _proto.getPitchRange = function getPitchRange() { + return this._yawPitchControl.option("pitchRange"); + } + /** + * Set the range of controllable yaw + * @ko 컨트롤 가능한 Yaw 구간을 반환합니다. + * @method eg.view360.PanoViewer#setYawRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setYawRange([-90, 90]); + */ + ; + + _proto.setYawRange = function setYawRange(yawRange) { + this._yawPitchControl.option("yawRange", yawRange); + + return this; + } + /** + * Set the range of controllable Pitch values + * @ko 컨트롤 가능한 Pitch 구간을 설정합니다. + * @method eg.view360.PanoViewer#setPitchRange + * @param {Array} range + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * panoViewer.setPitchRange([-40, 40]); + */ + ; + + _proto.setPitchRange = function setPitchRange(pitchRange) { + this._yawPitchControl.option("pitchRange", pitchRange); + + return this; + } + /** + * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed. + * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다. + * @method eg.view360.PanoViewer#setShowPolePoint + * @param {Boolean} showPolePoint + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.setShowPolePoint = function setShowPolePoint(showPolePoint) { + this._yawPitchControl.option("showPolePoint", showPolePoint); + + return this; + } + /** + * Set a new view by setting camera configuration. Any parameters not specified remain the same. + * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다. + * @method eg.view360.PanoViewer#lookAt + * @param {Object} orientation + * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위) + * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위) + * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위) + * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초) + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + * @example + * // Change the yaw angle (absolute angle) to 30 degrees for one second. + * panoViewer.lookAt({yaw: 30}, 1000); + */ + ; + + _proto.lookAt = function lookAt$$1(orientation, duration) { + if (!this._isReady) { + return this; + } + + var yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw; + var pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch; + + var pitchRange = this._yawPitchControl.option("pitchRange"); + + var verticalAngleOfImage = pitchRange[1] - pitchRange[0]; + var fov = orientation.fov !== undefined ? orientation.fov : this._fov; + + if (verticalAngleOfImage < fov) { + fov = verticalAngleOfImage; + } + + this._yawPitchControl.lookAt({ + yaw: yaw, + pitch: pitch, + fov: fov + }, duration); + + if (duration === 0) { + this._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov); + } + + return this; + }; + + _proto._activate = function _activate() { + this._photoSphereRenderer.attachTo(this._container); + + this._yawPitchControl.enable(); + + this.updateViewportDimensions(); + this._isReady = true; // update yawPitchControl after isReady status is true. + + this._updateYawPitchIfNeeded(); + + this._triggerEvent(EVENTS$1.READY); + + this._photoSphereRenderer.startRender(); + } + /** + * Destroy webgl context and block user interaction and stop rendering + */ + ; + + _proto._deactivate = function _deactivate() { + if (this._isReady) { + this._photoSphereRenderer.stopRender(); + + this._yawPitchControl.disable(); + + this._isReady = false; + } + + if (this._photoSphereRenderer) { + this._photoSphereRenderer.destroy(); + + this._photoSphereRenderer = null; + } + }; + + PanoViewer._isValidTouchDirection = function _isValidTouchDirection(direction) { + return direction === PanoViewer.TOUCH_DIRECTION.NONE || direction === PanoViewer.TOUCH_DIRECTION.YAW || direction === PanoViewer.TOUCH_DIRECTION.PITCH || direction === PanoViewer.TOUCH_DIRECTION.ALL; + } + /** + * Set touch direction by which user can control. + * @ko 사용자가 조작가능한 터치 방향을 지정합니다. + * @method eg.view360.PanoViewer#setTouchDirection + * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @return {eg.view360.PanoViewer} PanoViewer instance + * @example + * + * panoViewer = new PanoViewer(el); + * // Limit the touch direction to the yaw direction only. + * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW); + */ + ; + + _proto.setTouchDirection = function setTouchDirection(direction) { + if (PanoViewer._isValidTouchDirection(direction)) { + this._yawPitchControl.option("touchDirection", direction); + } + + return this; + } + /** + * Returns touch direction by which user can control + * @ko 사용자가 조작가능한 터치 방향을 반환한다. + * @method eg.view360.PanoViewer#getTouchDirection + * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION} + * @example + * + * panoViewer = new PanoViewer(el); + * // Returns the current touch direction. + * var dir = panoViewer.getTouchDirection(); + */ + ; + + _proto.getTouchDirection = function getTouchDirection() { + return this._yawPitchControl.option("touchDirection"); + } + /** + * Destroy viewer. Remove all registered event listeners and remove viewer canvas. + * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다. + * @method eg.view360.PanoViewer#destroy + * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스 + */ + ; + + _proto.destroy = function destroy() { + this._deactivate(); + + if (this._yawPitchControl) { + this._yawPitchControl.destroy(); + + this._yawPitchControl = null; + } + + return this; + } + /** + * Check whether the current environment can execute PanoViewer + * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다. + * @function isSupported + * @memberof eg.view360.PanoViewer + * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부 + * @static + */ + ; + + PanoViewer.isSupported = function isSupported() { + return WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL(); + } + /** + * Check whether the current environment supports the WebGL + * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다. + * @function isWebGLAvailable + * @memberof eg.view360.PanoViewer + * @return {Boolean} WebGL support WebGL 지원여부 + * @static + */ + ; + + PanoViewer.isWebGLAvailable = function isWebGLAvailable() { + return WebGLUtils.isWebGLAvailable(); + } + /** + * Check whether the current environment supports the gyro sensor. + * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다. + * @function isGyroSensorAvailable + * @memberof eg.view360.PanoViewer + * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수 + * @static + */ + ; + + PanoViewer.isGyroSensorAvailable = function isGyroSensorAvailable(callback) { + if (!DeviceMotionEvent) { + callback && callback(false); + return; + } + + var onDeviceMotionChange; + + function checkGyro() { + return new _Promise$4(function (res, rej) { + onDeviceMotionChange = function onDeviceMotionChange(deviceMotion) { + var isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null); + res(isGyroSensorAvailable); + }; + + window.addEventListener("devicemotion", onDeviceMotionChange); + }); + } + + function timeout() { + return new _Promise$4(function (res, rej) { + setTimeout(function () { + return res(false); + }, 1000); + }); + } + + _Promise$4.race([checkGyro(), timeout()]).then(function (isGyroSensorAvailable) { + window.removeEventListener("devicemotion", onDeviceMotionChange); + callback && callback(isGyroSensorAvailable); + + PanoViewer.isGyroSensorAvailable = function (fb) { + fb && fb(isGyroSensorAvailable); + return isGyroSensorAvailable; + }; + }); + }; + + return PanoViewer; + }(Component); + + PanoViewer.VERSION = VERSION; + PanoViewer.ERROR_TYPE = ERROR_TYPE; + PanoViewer.EVENTS = EVENTS$1; + PanoViewer.PROJECTION_TYPE = PROJECTION_TYPE; + PanoViewer.GYRO_MODE = GYRO_MODE; + PanoViewer.ProjectionType = PROJECTION_TYPE; + PanoViewer.STEREO_FORMAT = STEREO_FORMAT; + PanoViewer.TOUCH_DIRECTION = { + /** + * Constant value for none direction. + * @ko none 방향에 대한 상수 값. + * @name NONE + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 1 + */ + NONE: YawPitchControl.TOUCH_DIRECTION_NONE, + + /** + * Constant value for horizontal(yaw) direction. + * @ko horizontal(yaw) 방향에 대한 상수 값. + * @name YAW + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 6 + */ + YAW: YawPitchControl.TOUCH_DIRECTION_YAW, + + /** + * Constant value for vertical direction. + * @ko vertical(pitch) 방향에 대한 상수 값. + * @name PITCH + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 24 + */ + PITCH: YawPitchControl.TOUCH_DIRECTION_PITCH, + + /** + * Constant value for all direction. + * @ko all 방향에 대한 상수 값. + * @name ALL + * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION + * @constant + * @type {Number} + * @default 30 + */ + ALL: YawPitchControl.TOUCH_DIRECTION_ALL + }; + return PanoViewer; + }(); + + /** + * @class eg.view360.SpriteImage + * @classdesc A module that displays a single or continuous image of any one of the "sprite images". SpinViewer internally uses SpriteImage to show each frame of the sprite image. + * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the "Sprite image". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
+ * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpriteImage + * + * var el = document.getElementById("image-div"); + * var sprites = new eg.view360.SpriteImage(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 + * }); + */ + + var SpriteImage = + /*#__PURE__*/ + function () { + var SpriteImage = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpriteImage, _Component); + + function SpriteImage(element, options) { + var _this; + + _this = _Component.call(this) || this; + var opt = options || {}; + _this._el = element; + _this._rowCount = opt.rowCount || 1; + _this._colCount = opt.colCount || 1; + _this._totalCount = _this._rowCount * _this._colCount; // total frames + + _this._width = opt.width || "auto"; + _this._height = opt.height || "auto"; + _this._autoHeight = opt.autoHeight != null ? opt.autoHeight : "true"; // If autoHeight is specified, _height will be overwritten. + + _this._colRow = [0, 0]; + + if (opt.colRow) { + _this._colRow = opt.colRow; + } else if (opt.frameIndex) { + _this.setFrameIndex(opt.frameIndex); + } + + _this._el.style.width = SpriteImage._getSizeString(_this._width); + _this._el.style.height = SpriteImage._getSizeString(_this._height); + + if (!opt.imageUrl) { + setTimeout(function () { + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }, 0); + return _assertThisInitialized(_this); + } + + _this._image = new Image(); + /** + * Event + */ + + _this._image.onload = function () { + _this._bg = SpriteImage._createBgDiv(_this._image, _this._rowCount, _this._colCount, _this._autoHeight); + + _this._el.appendChild(_this._bg); + + _this.setColRow(_this._colRow[0], _this._colRow[1]); + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpriteImage#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * sprites.on({ + * "load" : function(evt) { + * console.log("load event fired - e.target", e.target, "e.bgElement", e.bgElement); + * } + * }); + */ + + + _this.trigger("load", { + target: _this._el, + bgElement: _this._bg + }); + + if (_this._autoPlayReservedInfo) { + _this.play(_this._autoPlayReservedInfo); + + _this._autoPlayReservedInfo = null; + } + }; + + _this._image.onerror = function (e) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpriteImage#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * sprites.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: opt.imageUrl + }); + }; + + _this._image.src = opt.imageUrl; + return _this; + } + + SpriteImage._createBgDiv = function _createBgDiv(img, rowCount, colCount, autoHeight) { + var el = document.createElement("div"); + el.style.position = "relative"; + el.style.overflow = "hidden"; + img.style.position = "absolute"; + img.style.width = colCount * 100 + "%"; + img.style.height = rowCount * 100 + "%"; + /** Prevent image from being dragged on IE10, IE11, Safari especially */ + + img.ondragstart = function () { + return false; + }; // img.style.pointerEvents = "none"; + // Use hardware accelerator if available + + + SUPPORT_WILLCHANGE && (img.style.willChange = "transform"); + el.appendChild(img); + var unitWidth = img.width / colCount; + var unitHeight = img.height / rowCount; + + if (autoHeight) { + var r = unitHeight / unitWidth; + el.style.paddingBottom = r * 100 + "%"; + } else { + el.style.height = "100%"; + } + + return el; + } + /** + * Specifies the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정 + * @method eg.view360.SpriteImage#setFrameIndex + * @param {Number} frameIndex frame index of a frame프레임의 인덱스 + * + * @example + * + * sprites.setFrameIndex(0, 1);// col = 0, row = 1 + */ + ; + + var _proto = SpriteImage.prototype; + + _proto.setFrameIndex = function setFrameIndex(index) { + var colRow = this.toColRow(index); + this.setColRow(colRow[0], colRow[1]); + } + /** + * Returns the frameIndex of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환 + * @method eg.view360.SpriteImage#getFrameIndex + * @return {Number} frame index frame 인덱스 + * + * @example + * + * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1 + * + */ + ; + + _proto.getFrameIndex = function getFrameIndex() { + return this._colRow[1] * this._colCount + this._colRow[0]; + } + /** + * Specifies the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정 + * @method eg.view360.SpriteImage#setColRow + * @param {Number} col Column number of a frame프레임의 행값 + * @param {Number} row Row number of a frame프레임의 열값 + * + * @example + * + * sprites.setlColRow(1, 2); // col = 1, row = 2 + */ + ; + + _proto.setColRow = function setColRow(col, row) { + if (row > this._rowCount - 1 || col > this._colCount - 1) { + return; + } + + if (this._image && TRANSFORM) { + // NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser? + this._image.style[TRANSFORM] = "translate(" + -(col / this._colCount * 100) + "%, " + -(row / this._rowCount * 100) + "%)"; + } + + this._colRow = [col, row]; + } + /** + * Returns the col and row values of the frame to be shown in the sprite image. + * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환 + * @method eg.view360.SpriteImage#gelColRow + * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열 + * + * @example + * + * var colRow = sprites.getlColRow(); + * // colRow = [1, 2] - index of col is 1, index of row is 2 + * + */ + ; + + _proto.getColRow = function getColRow() { + return this._colRow; + }; + + SpriteImage._getSizeString = function _getSizeString(size) { + if (typeof size === "number") { + return size + "px"; + } + + return size; + } + /** + * Stop playing + * @ko play 되고 있던 프레임 재생을 중지합니다. + * @method eg.view360.SpriteImage#stop + * + * @example + * + * viewer.stop(); + * + */ + ; + + _proto.stop = function stop() { + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + } + /** + * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'. + * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다. + * @method eg.view360.SpriteImage#play + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위 + * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복 + * + * @example + * + * viewer.play({angle: 16, playCount: 1}); + * + */ + ; + + _proto.play = function play(_temp) { + var _this2 = this; + + var _ref = _temp === void 0 ? { + interval: 1000 / this._totalCount, + playCount: 0 + } : _temp, + interval = _ref.interval, + playCount = _ref.playCount; + + if (!this._bg) { + this._autoPlayReservedInfo = { + interval: interval, + playCount: playCount + }; + return; + } + + if (this._autoPlayTimer) { + clearInterval(this._autoPlayTimer); + this._autoPlayTimer = null; + } + + var frameIndex = this.getFrameIndex(); + var count = 0; + var frameCount = 0; // for checking 1 cycle + + this._autoPlayTimer = setInterval(function () { + frameIndex %= _this2._totalCount; + + var colRow = _this2.toColRow(frameIndex); + + _this2.setColRow(colRow[0], colRow[1]); + + frameIndex++; // Done 1 Cycle? + + if (++frameCount === _this2._totalCount) { + frameCount = 0; + count++; + } + + if (playCount > 0 && count === playCount) { + clearInterval(_this2._autoPlayTimer); + } + }, interval); + }; + + _proto.toColRow = function toColRow(frameIndex) { + var colCount = this._colCount; + var rowCount = this._rowCount; + + if (frameIndex < 0) { + return [0, 0]; + } else if (frameIndex >= this._totalCount) { + return [colCount - 1, rowCount - 1]; + } + + var col = frameIndex % colCount; + var row = Math.floor(frameIndex / colCount); // console.log(frameIndex, col, row); + + return [col, row]; + }; + + return SpriteImage; + }(Component); + + SpriteImage.VERSION = VERSION; + return SpriteImage; + }(); + + var DEFAULT_PAN_SCALE = 0.21; + /** + * @class eg.view360.SpinViewer + * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object. + * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다. + * @extends eg.Component + * + * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소 + * @param {Object} options The option object파라미터 객체 + * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url + * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수 + * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수 + * @param {Number|String} [options.width="auto"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비 + * @param {Number|String} [options.height="auto"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이 + * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부 + * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반) + * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임) + * @support {"ie": "9+", "ch" : "latest", "ff" : "latest", "sf" : "latest", "edge" : "latest", "ios" : "7+", "an" : "2.3+ (except 3.x)"} + * @example + * + * // Initialize SpinViewer + * var el = document.getElementById("product-360"); + * var viewer = new eg.view360.SpinViewer(el, { + * imageUrl: "/img/bag360.jpg", // required + * rowCount: 24 //required + * }); + */ + + var SpinViewer = + /*#__PURE__*/ + function () { + var SpinViewer = + /*#__PURE__*/ + function (_Component) { + _inheritsLoose(SpinViewer, _Component); + + /** + * Version info string + * @ko 버전정보 문자열 + * @name VERSION + * @static + * @type {String} + * @example + * eg.view360.SpinViewer.VERSION; // ex) 3.0.1 + * @memberof eg.view360.SpinViewer + */ + function SpinViewer(element, options) { + var _this; + + _this = _Component.call(this) || this; + _this._el = element; + + var opt = _extends({}, options); + + var colCount = opt.colCount || 1; + var rowCount = opt.rowCount || 1; + _this._scale = opt.scale || 1; + _this._panScale = _this._scale * DEFAULT_PAN_SCALE; + _this._frameCount = colCount * rowCount; // Init SpriteImage + + _this._sprites = new SpriteImage(element, opt).on({ + "load": function load(evt) { + /** + * Events that occur when component loading is complete + * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트 + * @name eg.view360.SpinViewer#load + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트 + * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트 + * + * @example + * + * viwer.on({ + * "load" : function(evt) { + * this.spinBy(360, {duration: 300}); + * } + * }); + */ + _this.trigger("load", evt); + }, + "imageError": function imageError(evt) { + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#imageError + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL + * + * @example + * + * viewer.on({ + * "imageError" : function(evt) { + * // Error handling + * console.log(e.imageUrl); + * } + * }); + */ + _this.trigger("imageError", { + imageUrl: evt.imageUrl + }); + } + }); // Init Axes + + _this._panInput = new PanInput(_this._el, { + scale: [_this._panScale, _this._panScale] + }); + _this._axes = new Axes({ + angle: { + range: [0, 359], + circular: true + } + }).on({ + "change": function change(evt) { + var curr = Math.floor(evt.pos.angle / (360 / _this._frameCount)); + var frameIndex = _this._frameCount - curr - 1; + + _this._sprites.setFrameIndex(frameIndex); + /** + * An event that occurs when the image index is changed by the user's left / right panning + * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트 + * @name eg.view360.SpinViewer#change + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row + * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값 + * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님) + * + * @example + * + * viwer.on({ + * "change" : function(evt) { + * console.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30 + * } + * }); + */ + + + _this.trigger("change", { + frameIndex: frameIndex, + colRow: _this._sprites.getColRow(), + angle: evt.pos.angle + }); + }, + "animationEnd": function animationEnd(evt) { + /** + * This event is fired when animation ends. + * @ko 에니메이션이 끝났을 때 발생하는 이벤트 + * @name eg.view360.SpinViewer#animationEnd + * @event + * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체 + * @param {Boolean} param.isTrusted 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 + * + * viwer.on({ + * "animationEnd" : function(evt) { + * // evt.isTrusted === true or false + * } + * }); + */ + _this.trigger("animationEnd", { + isTrusted: evt.isTrusted + }); + } + }); + + _this._axes.connect("angle", _this._panInput); + + return _this; + } + /** + * Set spin scale + * @ko scale 을 조정할 수 있는 함수 + * @method eg.view360.SpinViewer#setScale + * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.setScale(2);// It moves twice as much. + */ + + + var _proto = SpinViewer.prototype; + + _proto.setScale = function setScale(scale) { + if (isNaN(scale) || scale < 0) { + return this; + } + + this._scale = scale; + this._panScale = scale * DEFAULT_PAN_SCALE; + this._panInput.options.scale = [this._panScale, this._panScale]; + return this; + } + /** + * Get spin scale + * @ko scale 값을 반환한다. + * @method eg.view360.SpinViewer#getScale + * + * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전 + * + * @example + * + * viewer.getScale();// It returns number + */ + ; + + _proto.getScale = function getScale() { + return this._scale; + } + /** + * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle. + * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinBy + * + * @param {Number} [angle = 0] angle상대적 회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinBy(720, {duration: 500}); + */ + ; + + _proto.spinBy = function spinBy(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setBy({ + angle: angle + }, param.duration); + + return this; + } + /** + * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle). + * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다. + * @method eg.view360.SpinViewer#spinTo + * + * @param {Number} [angle = 0] angle회전 각도 + * @param {Object} param The parameter object파라미터 객체 + * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위 + * + * @return {Object} Instance of SpinViewer SpinViewer 인스턴스 + * + * @example + * + * viewer.spinTo(30, {duration:100}); + */ + ; + + _proto.spinTo = function spinTo(angle, param) { + if (angle === void 0) { + angle = 0; + } + + if (param === void 0) { + param = { + duration: 0 + }; + } + + this._axes.setTo({ + angle: angle + }, param.duration); + + return this; + } + /** + * Returns current angles + * @ko 현재 각도를 반환한다. + * + * @return {Number} Current angle 현재 각도 + */ + ; + + _proto.getAngle = function getAngle() { + return this._axes.get().angle || 0; + }; + + return SpinViewer; + }(Component); + + SpinViewer.VERSION = VERSION; + return SpinViewer; + }(); + + exports.PanoViewer = PanoViewer; + exports.SpinViewer = SpinViewer; + exports.SpriteImage = SpriteImage; + exports.VERSION = VERSION; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=view360.pkgd.js.map diff --git a/dist/view360.pkgd.js.map b/dist/view360.pkgd.js.map new file mode 100644 index 000000000..6c5a4560a --- /dev/null +++ b/dist/view360.pkgd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.pkgd.js","sources":["../node_modules/es6-promise/dist/es6-promise.js","../node_modules/@egjs/component/dist/component.esm.js","../node_modules/gl-matrix/esm/common.js","../node_modules/gl-matrix/esm/mat3.js","../node_modules/gl-matrix/esm/mat4.js","../node_modules/gl-matrix/esm/vec3.js","../node_modules/gl-matrix/esm/vec4.js","../node_modules/gl-matrix/esm/quat.js","../node_modules/gl-matrix/esm/vec2.js","../node_modules/@egjs/agent/dist/agent.esm.js","../src/utils/browser.js","../src/utils/browserFeature.js","../node_modules/@egjs/hammerjs/dist/hammer.esm.js","../node_modules/@egjs/axes/node_modules/@egjs/agent/dist/agent.esm.js","../node_modules/@egjs/axes/dist/axes.esm.js","../src/utils/math-util.js","../src/YawPitchControl/utils.js","../node_modules/webvr-polyfill/src/math-util.js","../node_modules/webvr-polyfill/src/util.js","../node_modules/webvr-polyfill/src/sensor-fusion/pose-predictor.js","../src/YawPitchControl/consts.js","../src/YawPitchControl/input/DeviceMotion.js","../node_modules/webvr-polyfill/src/sensor-fusion/sensor-sample.js","../node_modules/webvr-polyfill/src/sensor-fusion/complementary-filter.js","../src/YawPitchControl/input/ComplementaryFilter.js","../src/YawPitchControl/input/FusionPoseSensor.js","../src/YawPitchControl/input/TiltMotionInput.js","../src/YawPitchControl/ScreenRotationAngle.js","../src/YawPitchControl/input/RotationPanInput.js","../src/YawPitchControl/DeviceQuaternion.js","../src/version.js","../src/YawPitchControl/YawPitchControl.js","../src/PanoImageRenderer/ImageLoader.js","../src/PanoImageRenderer/VideoLoader.js","../src/PanoImageRenderer/WebGLUtils.js","../src/PanoImageRenderer/renderer/Renderer.js","../src/PanoImageRenderer/renderer/CubeRenderer.js","../src/PanoImageRenderer/renderer/CubeStripRenderer.js","../src/PanoViewer/consts.js","../src/PanoImageRenderer/renderer/SphereRenderer.js","../src/PanoImageRenderer/renderer/CylinderRenderer.js","../src/PanoImageRenderer/vr/VRManager.js","../src/PanoImageRenderer/vr/XRManager.js","../src/PanoImageRenderer/WebGLAnimator.js","../src/PanoImageRenderer/PanoImageRenderer.js","../src/PanoViewer/PanoViewer.js","../src/SpinViewer/SpriteImage.js","../src/SpinViewer/SpinViewer.js"],"sourcesContent":["/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.ES6Promise = factory());\n}(this, (function () { 'use strict';\n\nfunction objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n}\n\nfunction isFunction(x) {\n return typeof x === 'function';\n}\n\n\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve$1(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n try {\n then$$1.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then$$1) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then$$1, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$1) {\n if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$1 === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$1)) {\n handleForeignThenable(promise, maybeThenable, then$$1);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then$$1 = void 0;\n try {\n then$$1 = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then$$1);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n}\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve$$1 = c.resolve;\n\n\n if (resolve$$1 === resolve$1) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise$1) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$1) {\n return resolve$$1(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$1(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject$1(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n//# sourceMappingURL=es6-promise.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/component project is licensed under the MIT license\n\n@egjs/component JavaScript library\nhttps://naver.github.io/egjs-component\n\n@version 2.1.2\n*/\n/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\n/**\n * A class used to manage events in a component\n * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스\n * @alias eg.Component\n */\n\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Component.VERSION; // ex) 2.0.0\n * @memberof eg.Component\n */\n\n /**\n * @support {\"ie\": \"7+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n */\n function Component() {\n this._eventHandler = {};\n this.options = {};\n }\n /**\n * Triggers a custom event.\n * @ko 커스텀 이벤트를 발생시킨다\n * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름\n * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터\n * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고\n * @example\n class Some extends eg.Component {\n some(){\n \tif(this.trigger(\"beforeHi\")){ // When event call to stop return false.\n \tthis.trigger(\"hi\");// fire hi event.\n \t}\n }\n }\n const some = new Some();\n some.on(\"beforeHi\", (e) => {\n if(condition){\n \te.stop(); // When event call to stop, `hi` event not call.\n }\n });\n some.on(\"hi\", (e) => {\n // `currentTarget` is component instance.\n console.log(some === e.currentTarget); // true\n });\n // If you want to more know event design. You can see article.\n // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F\n */\n\n\n var _proto = Component.prototype;\n\n _proto.trigger = function trigger(eventName, customEvent) {\n if (customEvent === void 0) {\n customEvent = {};\n }\n\n var handlerList = this._eventHandler[eventName] || [];\n var hasHandlerList = handlerList.length > 0;\n\n if (!hasHandlerList) {\n return true;\n } // If detach method call in handler in first time then handler list calls.\n\n\n handlerList = handlerList.concat();\n customEvent.eventType = eventName;\n var isCanceled = false;\n var arg = [customEvent];\n var i = 0;\n\n customEvent.stop = function () {\n isCanceled = true;\n };\n\n customEvent.currentTarget = this;\n\n for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n restParam[_key - 2] = arguments[_key];\n }\n\n if (restParam.length >= 1) {\n arg = arg.concat(restParam);\n }\n\n for (i = 0; handlerList[i]; i++) {\n handlerList[i].apply(this, arg);\n }\n\n return !isCanceled;\n };\n /**\n * Executed event just one time.\n * @ko 이벤트가 한번만 실행된다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n alert(\"hi\");\n }\n thing() {\n this.once(\"hi\", this.hi);\n }\n }\n var some = new Some();\n some.thing();\n some.trigger(\"hi\");\n // fire alert(\"hi\");\n some.trigger(\"hi\");\n // Nothing happens\n */\n\n\n _proto.once = function once(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var i;\n\n for (i in eventHash) {\n this.once(i, eventHash[i]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var self = this;\n this.on(eventName, function listener() {\n for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arg[_key2] = arguments[_key2];\n }\n\n handlerToAttach.apply(self, arg);\n self.off(eventName, listener);\n });\n }\n\n return this;\n };\n /**\n * Checks whether an event has been attached to a component.\n * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다.\n * @param {String} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름\n * @return {Boolean} Indicates whether the event is attached. 이벤트 등록 여부\n * @example\n class Some extends eg.Component {\n some() {\n this.hasOn(\"hi\");// check hi event.\n }\n }\n */\n\n\n _proto.hasOn = function hasOn(eventName) {\n return !!this._eventHandler[eventName];\n };\n /**\n * Attaches an event to a component.\n * @ko 컴포넌트에 이벤트를 등록한다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.on(\"hi\",this.hi); //attach event\n }\n }\n */\n\n\n _proto.on = function on(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.on(name, eventHash[name]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var handlerList = this._eventHandler[eventName];\n\n if (isUndefined(handlerList)) {\n this._eventHandler[eventName] = [];\n handlerList = this._eventHandler[eventName];\n }\n\n handlerList.push(handlerToAttach);\n }\n\n return this;\n };\n /**\n * Detaches an event from the component.\n * @ko 컴포넌트에 등록된 이벤트를 해제한다\n * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름\n * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.off(\"hi\",this.hi); //detach event\n }\n }\n */\n\n\n _proto.off = function off(eventName, handlerToDetach) {\n // All event detach.\n if (isUndefined(eventName)) {\n this._eventHandler = {};\n return this;\n } // All handler of specific event detach.\n\n\n if (isUndefined(handlerToDetach)) {\n if (typeof eventName === \"string\") {\n this._eventHandler[eventName] = undefined;\n return this;\n } else {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.off(name, eventHash[name]);\n }\n\n return this;\n }\n } // The handler of specific event detach.\n\n\n var handlerList = this._eventHandler[eventName];\n\n if (handlerList) {\n var k;\n var handlerFunction;\n\n for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) {\n if (handlerFunction === handlerToDetach) {\n handlerList = handlerList.splice(k, 1);\n break;\n }\n }\n }\n\n return this;\n };\n\n return Component;\n }();\n\n Component.VERSION = \"2.1.2\";\n return Component;\n}();\n\nexport default Component;\n//# sourceMappingURL=component.esm.js.map\n","/**\r\n * Common utilities\r\n * @module glMatrix\r\n */\n// Configuration Constants\nexport var EPSILON = 0.000001;\nexport var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nexport var RANDOM = Math.random;\n/**\r\n * Sets the type of array used when creating new vectors and matrices\r\n *\r\n * @param {Type} type Array type, such as Float32Array or Array\r\n */\n\nexport function setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\n/**\r\n * Convert Degree To Radian\r\n *\r\n * @param {Number} a Angle in Degrees\r\n */\n\nexport function toRadian(a) {\n return a * degree;\n}\n/**\r\n * Tests whether or not the arguments have approximately the same value, within an absolute\r\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\r\n * than or equal to 1.0, and a relative tolerance is used for larger values)\r\n *\r\n * @param {Number} a The first number to test.\r\n * @param {Number} b The second number to test.\r\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\nif (!Math.hypot) Math.hypot = function () {\n var y = 0,\n i = arguments.length;\n\n while (i--) {\n y += arguments[i] * arguments[i];\n }\n\n return Math.sqrt(y);\n};","import * as glMatrix from \"./common.js\";\n/**\r\n * 3x3 Matrix\r\n * @module mat3\r\n */\n\n/**\r\n * Creates a new identity mat3\r\n *\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(9);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the upper-left 3x3 values into the given mat3.\r\n *\r\n * @param {mat3} out the receiving 3x3 matrix\r\n * @param {mat4} a the source 4x4 matrix\r\n * @returns {mat3} out\r\n */\n\nexport function fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\r\n * Creates a new mat3 initialized with values from an existing matrix\r\n *\r\n * @param {mat3} a matrix to clone\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Copy the values from one mat3 to another\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Create a new mat3 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} A new mat3\r\n */\n\nexport function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set the components of a mat3 to the given values\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} out\r\n */\n\nexport function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set a mat3 to the identity matrix\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @returns {mat3} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b01 = a22 * a11 - a12 * a21;\n var b11 = -a22 * a10 + a12 * a20;\n var b21 = a21 * a10 - a11 * a20; // Calculate the determinant\n\n var det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\r\n * Calculates the determinant of a mat3\r\n *\r\n * @param {mat3} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n}\n/**\r\n * Multiplies two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b00 = b[0],\n b01 = b[1],\n b02 = b[2];\n var b10 = b[3],\n b11 = b[4],\n b12 = b[5];\n var b20 = b[6],\n b21 = b[7],\n b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\r\n * Translate a mat3 by the given vector\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to translate\r\n * @param {vec2} v vector to translate by\r\n * @returns {mat3} out\r\n */\n\nexport function translate(out, a, v) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n x = v[0],\n y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\r\n * Rotates a mat3 by the given angle\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function rotate(out, a, rad) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n;\n/**\r\n * Scales the mat3 by the dimensions in the given vec2\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {vec2} v the vec2 to scale the matrix by\r\n * @returns {mat3} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Translation vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function fromRotation(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Scaling vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the values from a mat2d into a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat2d} a the matrix to copy\r\n * @returns {mat3} out\r\n **/\n\nexport function fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\r\n* Calculates a 3x3 matrix from the given quaternion\r\n*\r\n* @param {mat3} out mat3 receiving operation result\r\n* @param {quat} q Quaternion to create matrix from\r\n*\r\n* @returns {mat3} out\r\n*/\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\r\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n*\r\n* @param {mat3} out mat3 receiving operation result\r\n* @param {mat4} a Mat4 to derive the normal matrix from\r\n*\r\n* @returns {mat3} out\r\n*/\n\nexport function normalFromMat4(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\r\n * Generates a 2D projection matrix with the given bounds\r\n *\r\n * @param {mat3} out mat3 frustum matrix will be written into\r\n * @param {number} width Width of your gl context\r\n * @param {number} height Height of gl context\r\n * @returns {mat3} out\r\n */\n\nexport function projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Returns a string representation of a mat3\r\n *\r\n * @param {mat3} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n}\n/**\r\n * Returns Frobenius norm of a mat3\r\n *\r\n * @param {mat3} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);\n}\n/**\r\n * Adds two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\r\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat3} out the receiving vector\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7],\n a8 = a[8];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));\n}\n/**\r\n * Alias for {@link mat3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied.\r\n * @module mat4\r\n */\n\n/**\r\n * Creates a new identity mat4\r\n *\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 initialized with values from an existing matrix\r\n *\r\n * @param {mat4} a matrix to clone\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Copy the values from one mat4 to another\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Create a new mat4 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} A new mat4\r\n */\n\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set the components of a mat4 to the given values\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} out\r\n */\n\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set a mat4 to the identity matrix\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @returns {mat4} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\r\n * Calculates the determinant of a mat4\r\n *\r\n * @param {mat4} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\r\n * Multiplies two mat4s\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\r\n * Translate a mat4 by the given vector\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to translate\r\n * @param {vec3} v vector to translate by\r\n * @returns {mat4} out\r\n */\n\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\r\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {vec3} v the vec3 to scale the matrix by\r\n * @returns {mat4} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Rotates a mat4 by the given angle around the given axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the X axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Y axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Z axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 from a dual quat.\r\n *\r\n * @param {mat4} out Matrix\r\n * @param {quat2} a Dual Quaternion\r\n * @returns {mat4} mat4 receiving operation result\r\n */\n\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion paramter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @param {quat} out Quaternion to receive the rotation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {quat} out\r\n */\n\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @param {vec3} o The origin vector around which to scale and rotate\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat} q Quaternion to create matrix from\r\n *\r\n * @returns {mat4} out\r\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a frustum matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Number} left Left bound of the frustum\r\n * @param {Number} right Right bound of the frustum\r\n * @param {Number} bottom Bottom bound of the frustum\r\n * @param {Number} top Top bound of the frustum\r\n * @param {Number} near Near bound of the frustum\r\n * @param {Number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} fovy Vertical field of view in radians\r\n * @param {number} aspect Aspect ratio. typically viewport width/height\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum, can be null or Infinity\r\n * @returns {mat4} out\r\n */\n\nexport function perspective(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given field of view.\r\n * This is primarily useful for generating projection matrices to be used\r\n * with the still experiemental WebVR API.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\r\n * Generates a orthogonal projection matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} left Left bound of the frustum\r\n * @param {number} right Right bound of the frustum\r\n * @param {number} bottom Bottom bound of the frustum\r\n * @param {number} top Top bound of the frustum\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\r\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a matrix that makes something look at something else.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n;\n/**\r\n * Returns a string representation of a mat4\r\n *\r\n * @param {mat4} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n}\n/**\r\n * Returns Frobenius norm of a mat4\r\n *\r\n * @param {mat4} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\r\n * Adds two mat4's\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat4} out the receiving vector\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\r\n * Alias for {@link mat4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 3 Dimensional Vector\r\n * @module vec3\r\n */\n\n/**\r\n * Creates a new, empty vec3\r\n *\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n *\r\n * @param {vec3} a vector to clone\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Calculates the length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Creates a new vec3 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Copy the values from one vec3 to another\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the source vector\r\n * @returns {vec3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Set the components of a vec3 to the given values\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} out\r\n */\n\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Adds two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\r\n * Multiplies two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\r\n * Divides two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to ceil\r\n * @returns {vec3} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to floor\r\n * @returns {vec3} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\r\n * Math.round the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to round\r\n * @returns {vec3} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\r\n * Scales a vec3 by a scalar number\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec3} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec3} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Calculates the squared length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Negates the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to negate\r\n * @returns {vec3} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to invert\r\n * @returns {vec3} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\r\n * Normalize a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to normalize\r\n * @returns {vec3} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\r\n * Computes the cross product of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\r\n * Performs a hermite interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Performs a bezier interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec3} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat3.\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat3} m the 3x3 matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\r\n * Rotate a 3D vector around the x-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateX(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(c) - p[2] * Math.sin(c);\n r[2] = p[1] * Math.sin(c) + p[2] * Math.cos(c); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the y-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateY(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(c) + p[0] * Math.cos(c);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(c) - p[0] * Math.sin(c); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the z-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateZ(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(c) - p[1] * Math.sin(c);\n r[1] = p[0] * Math.sin(c) + p[1] * Math.cos(c);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Get the angle between two 3D vectors\r\n * @param {vec3} a The first operand\r\n * @param {vec3} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var tempA = fromValues(a[0], a[1], a[2]);\n var tempB = fromValues(b[0], b[1], b[2]);\n normalize(tempA, tempA);\n normalize(tempB, tempB);\n var cosine = dot(tempA, tempB);\n\n if (cosine > 1.0) {\n return 0;\n } else if (cosine < -1.0) {\n return Math.PI;\n } else {\n return Math.acos(cosine);\n }\n}\n/**\r\n * Set the components of a vec3 to zero\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @returns {vec3} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec3} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\r\n * Alias for {@link vec3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec3.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec3.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec3.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec3.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec3.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec3s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 4 Dimensional Vector\r\n * @module vec4\r\n */\n\n/**\r\n * Creates a new, empty vec4\r\n *\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with values from an existing vector\r\n *\r\n * @param {vec4} a vector to clone\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function fromValues(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Copy the values from one vec4 to another\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the source vector\r\n * @returns {vec4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to the given values\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} out\r\n */\n\nexport function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Adds two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\r\n * Multiplies two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\r\n * Divides two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to ceil\r\n * @returns {vec4} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to floor\r\n * @returns {vec4} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\r\n * Math.round the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to round\r\n * @returns {vec4} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\r\n * Scales a vec4 by a scalar number\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec4} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\r\n * Adds two vec4's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec4} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Calculates the length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Negates the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to negate\r\n * @returns {vec4} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to invert\r\n * @returns {vec4} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\r\n * Normalize a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to normalize\r\n * @returns {vec4} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n *\r\n * @param {vec4} result the receiving vector\r\n * @param {vec4} U the first vector\r\n * @param {vec4} V the second vector\r\n * @param {vec4} W the third vector\r\n * @returns {vec4} result\r\n */\n\nexport function cross(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n;\n/**\r\n * Performs a linear interpolation between two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec4} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec4} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\r\n * Transforms the vec4 with a mat4.\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\r\n * Transforms the vec4 with a quat\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to zero\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @returns {vec4} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec4} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\r\n * Alias for {@link vec4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec4.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec4.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec4.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec4.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec4.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec4s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\nimport * as mat3 from \"./mat3.js\";\nimport * as vec3 from \"./vec3.js\";\nimport * as vec4 from \"./vec4.js\";\n/**\r\n * Quaternion\r\n * @module quat\r\n */\n\n/**\r\n * Creates a new identity quat\r\n *\r\n * @returns {quat} a new quaternion\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n out[3] = 1;\n return out;\n}\n/**\r\n * Set a quat to the identity quaternion\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @returns {quat} out\r\n */\n\nexport function identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {vec3} axis the axis around which to rotate\r\n * @param {Number} rad the angle in radians\r\n * @returns {quat} out\r\n **/\n\nexport function setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n}\n/**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as providied in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @param {vec3} out_axis Vector receiving the axis of rotation\r\n * @param {quat} q Quaternion to be decomposed\r\n * @return {Number} Angle, in radians, of the rotation\r\n */\n\nexport function getAxisAngle(out_axis, q) {\n var rad = Math.acos(q[3]) * 2.0;\n var s = Math.sin(rad / 2.0);\n\n if (s > glMatrix.EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n } else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n\n return rad;\n}\n/**\r\n * Gets the angular distance between two unit quaternions\r\n *\r\n * @param {quat} a Origin unit quaternion \r\n * @param {quat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\n\nexport function getAngle(a, b) {\n var dotproduct = dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n}\n/**\r\n * Multiplies two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {quat} out\r\n */\n\nexport function multiply(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the X axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateX(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateY(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var by = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bz = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n}\n/**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate W component of\r\n * @returns {quat} out\r\n */\n\nexport function calculateW(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n}\n/**\r\n * Calculate the exponential of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @returns {quat} out\r\n */\n\nexport function exp(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var et = Math.exp(w);\n var s = r > 0 ? et * Math.sin(r) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n}\n/**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @returns {quat} out\r\n */\n\nexport function ln(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n}\n/**\r\n * Calculate the scalar power of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @param {Number} b amount to scale the quaternion by\r\n * @returns {quat} out\r\n */\n\nexport function pow(out, a, b) {\n ln(out, a);\n scale(out, out, b);\n exp(out, out);\n return out;\n}\n/**\r\n * Performs a spherical linear interpolation between two quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n */\n\nexport function slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n var omega, cosom, sinom, scale0, scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > glMatrix.EPSILON) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n}\n/**\r\n * Generates a random unit quaternion\r\n * \r\n * @param {quat} out the receiving quaternion\r\n * @returns {quat} out\r\n */\n\nexport function random(out) {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n var u1 = glMatrix.RANDOM();\n var u2 = glMatrix.RANDOM();\n var u3 = glMatrix.RANDOM();\n var sqrt1MinusU1 = Math.sqrt(1 - u1);\n var sqrtU1 = Math.sqrt(u1);\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n}\n/**\r\n * Calculates the inverse of a quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate inverse of\r\n * @returns {quat} out\r\n */\n\nexport function invert(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n}\n/**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate conjugate of\r\n * @returns {quat} out\r\n */\n\nexport function conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to renormalize the quaternion yourself where necessary.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {mat3} m rotation matrix\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport function fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if (m[4] > m[0]) i = 1;\n if (m[8] > m[i * 3 + i]) i = 2;\n var j = (i + 1) % 3;\n var k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n\n return out;\n}\n/**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {x} Angle to rotate around X axis in degrees.\r\n * @param {y} Angle to rotate around Y axis in degrees.\r\n * @param {z} Angle to rotate around Z axis in degrees.\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport function fromEuler(out, x, y, z) {\n var halfToRad = 0.5 * Math.PI / 180.0;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n var sx = Math.sin(x);\n var cx = Math.cos(x);\n var sy = Math.sin(y);\n var cy = Math.cos(y);\n var sz = Math.sin(z);\n var cz = Math.cos(z);\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n return out;\n}\n/**\r\n * Returns a string representation of a quatenion\r\n *\r\n * @param {quat} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n}\n/**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n *\r\n * @param {quat} a quaternion to clone\r\n * @returns {quat} a new quaternion\r\n * @function\r\n */\n\nexport var clone = vec4.clone;\n/**\r\n * Creates a new quat initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {quat} a new quaternion\r\n * @function\r\n */\n\nexport var fromValues = vec4.fromValues;\n/**\r\n * Copy the values from one quat to another\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the source quaternion\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var copy = vec4.copy;\n/**\r\n * Set the components of a quat to the given values\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var set = vec4.set;\n/**\r\n * Adds two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var add = vec4.add;\n/**\r\n * Alias for {@link quat.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Scales a quat by a scalar number\r\n *\r\n * @param {quat} out the receiving vector\r\n * @param {quat} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var scale = vec4.scale;\n/**\r\n * Calculates the dot product of two quat's\r\n *\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {Number} dot product of a and b\r\n * @function\r\n */\n\nexport var dot = vec4.dot;\n/**\r\n * Performs a linear interpolation between two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var lerp = vec4.lerp;\n/**\r\n * Calculates the length of a quat\r\n *\r\n * @param {quat} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport var length = vec4.length;\n/**\r\n * Alias for {@link quat.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Calculates the squared length of a quat\r\n *\r\n * @param {quat} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n * @function\r\n */\n\nexport var squaredLength = vec4.squaredLength;\n/**\r\n * Alias for {@link quat.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Normalize a quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quaternion to normalize\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var normalize = vec4.normalize;\n/**\r\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {quat} a The first quaternion.\r\n * @param {quat} b The second quaternion.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport var exactEquals = vec4.exactEquals;\n/**\r\n * Returns whether or not the quaternions have approximately the same elements in the same position.\r\n *\r\n * @param {quat} a The first vector.\r\n * @param {quat} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport var equals = vec4.equals;\n/**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n *\r\n * @param {quat} out the receiving quaternion.\r\n * @param {vec3} a the initial vector\r\n * @param {vec3} b the destination vector\r\n * @returns {quat} out\r\n */\n\nexport var rotationTo = function () {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1, 0, 0);\n var yUnitVec3 = vec3.fromValues(0, 1, 0);\n return function (out, a, b) {\n var dot = vec3.dot(a, b);\n\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.len(tmpvec3) < 0.000001) vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return normalize(out, out);\n }\n };\n}();\n/**\r\n * Performs a spherical linear interpolation with two control points\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {quat} c the third operand\r\n * @param {quat} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n */\n\nexport var sqlerp = function () {\n var temp1 = create();\n var temp2 = create();\n return function (out, a, b, c, d, t) {\n slerp(temp1, a, d, t);\n slerp(temp2, b, c, t);\n slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n };\n}();\n/**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n *\r\n * @param {vec3} view the vector representing the viewing direction\r\n * @param {vec3} right the vector representing the local \"right\" direction\r\n * @param {vec3} up the vector representing the local \"up\" direction\r\n * @returns {quat} out\r\n */\n\nexport var setAxes = function () {\n var matr = mat3.create();\n return function (out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n return normalize(out, fromMat3(out, matr));\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 2 Dimensional Vector\r\n * @module vec2\r\n */\n\n/**\r\n * Creates a new, empty vec2\r\n *\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(2);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with values from an existing vector\r\n *\r\n * @param {vec2} a vector to clone\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function fromValues(x, y) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Copy the values from one vec2 to another\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the source vector\r\n * @returns {vec2} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Set the components of a vec2 to the given values\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} out\r\n */\n\nexport function set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Adds two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n/**\r\n * Multiplies two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n/**\r\n * Divides two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to ceil\r\n * @returns {vec2} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to floor\r\n * @returns {vec2} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n/**\r\n * Math.round the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to round\r\n * @returns {vec2} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n}\n/**\r\n * Scales a vec2 by a scalar number\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec2} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n/**\r\n * Adds two vec2's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec2} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x * x + y * y;\n}\n/**\r\n * Calculates the length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0],\n y = a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0],\n y = a[1];\n return x * x + y * y;\n}\n/**\r\n * Negates the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to negate\r\n * @returns {vec2} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to invert\r\n * @returns {vec2} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n/**\r\n * Normalize a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to normalize\r\n * @returns {vec2} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0],\n y = a[1];\n var len = x * x + y * y;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n}\n/**\r\n * Computes the cross product of two vec2's\r\n * Note that the cross product must by definition produce a 3D vector\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec2} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec2} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2d\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2d} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2d(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat3\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat3} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat4\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0];\n var y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n/**\r\n * Rotate a 2D vector\r\n * @param {vec2} out The receiving vec2\r\n * @param {vec2} a The vec2 point to rotate\r\n * @param {vec2} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec2} out\r\n */\n\nexport function rotate(out, a, b, c) {\n //Translate point to the origin\n var p0 = a[0] - b[0],\n p1 = a[1] - b[1],\n sinC = Math.sin(c),\n cosC = Math.cos(c); //perform rotation and translate to correct position\n\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n}\n/**\r\n * Get the angle between two 2D vectors\r\n * @param {vec2} a The first operand\r\n * @param {vec2} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var x1 = a[0],\n y1 = a[1],\n x2 = b[0],\n y2 = b[1];\n var len1 = x1 * x1 + y1 * y1;\n\n if (len1 > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len1 = 1 / Math.sqrt(len1);\n }\n\n var len2 = x2 * x2 + y2 * y2;\n\n if (len2 > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len2 = 1 / Math.sqrt(len2);\n }\n\n var cosine = (x1 * x2 + y1 * y2) * len1 * len2;\n\n if (cosine > 1.0) {\n return 0;\n } else if (cosine < -1.0) {\n return Math.PI;\n } else {\n return Math.acos(cosine);\n }\n}\n/**\r\n * Set the components of a vec2 to zero\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @returns {vec2} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec2} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec2(' + a[0] + ', ' + a[1] + ')';\n}\n/**\r\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1];\n var b0 = b[0],\n b1 = b[1];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));\n}\n/**\r\n * Alias for {@link vec2.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec2.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec2.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec2.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec2.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec2.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec2.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec2s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 2;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n\n return a;\n };\n}();","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","/*! Hammer.JS - v2.0.17-rc - 2019-12-16\n * http://naver.github.io/egjs\n *\n * Forked By Naver egjs\n * Copyright (c) hammerjs\n * Licensed under the MIT license */\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\n\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\nvar assign$1 = assign;\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = typeof document === \"undefined\" ? {\n style: {}\n} : document.createElement('div');\nvar TYPE_FUNCTION = 'function';\nvar round = Math.round,\n abs = Math.abs;\nvar now = Date.now;\n\n/**\n * @private\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n\nfunction prefixed(obj, property) {\n var prefix;\n var prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n\n i++;\n }\n\n return undefined;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {};\n} else {\n win = window;\n}\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\nfunction getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n\n var touchMap = {};\n var cssSupports = win.CSS && win.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n}\n\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\nvar TOUCH_ACTION_MAP = getTouchActionProps();\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\nvar SUPPORT_TOUCH = 'ontouchstart' in win;\nvar SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\nvar COMPUTE_INTERVAL = 25;\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * @private\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * @private\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n\nfunction boolOrFn(val, args) {\n if (typeof val === TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n\n return val;\n}\n\n/**\n * @private\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * @private\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n } // pan-x OR pan-y\n\n\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n } // manipulation\n\n\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * @private\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n\nvar TouchAction =\n/*#__PURE__*/\nfunction () {\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n /**\n * @private\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n\n\n var _proto = TouchAction.prototype;\n\n _proto.set = function set(value) {\n // find out the touch-action by the event handlers\n if (value === TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n\n this.actions = value.toLowerCase().trim();\n };\n /**\n * @private\n * just re-set the touchAction value\n */\n\n\n _proto.update = function update() {\n this.set(this.manager.options.touchAction);\n };\n /**\n * @private\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n\n\n _proto.compute = function compute() {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n };\n /**\n * @private\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n\n\n _proto.preventDefaults = function preventDefaults(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection; // if the touch action did prevented once this session\n\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n\n if (hasNone) {\n // do not prevent defaults if this is a tap gesture\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {\n return this.preventSrc(srcEvent);\n }\n };\n /**\n * @private\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n\n\n _proto.preventSrc = function preventSrc(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n };\n\n return TouchAction;\n}();\n\n/**\n * @private\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node === parent) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}\n\n/**\n * @private\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n\nfunction getCenter(pointers) {\n var pointersLength = pointers.length; // no need to loop when only one touch\n\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0;\n var y = 0;\n var i = 0;\n\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * @private\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * @private\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * @private\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * @private\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session;\n // jscs throwing error on defalut destructured values and without defaults tests fail\n\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * @private\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * @private\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input;\n var deltaTime = input.timeStamp - last.timeStamp;\n var velocity;\n var velocityX;\n var velocityY;\n var direction;\n\n if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n* @private\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length; // store the first input to calculate the distance and direction\n\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n } // to compute scale and rotation we need to store the multiple touches\n\n\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput,\n firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;\n computeIntervalInputData(session, input); // find the correct target\n\n var target = manager.element;\n var srcEvent = input.srcEvent;\n var srcEventTarget;\n\n if (srcEvent.composedPath) {\n srcEventTarget = srcEvent.composedPath()[0];\n } else if (srcEvent.path) {\n srcEventTarget = srcEvent.path[0];\n } else {\n srcEventTarget = srcEvent.target;\n }\n\n if (hasParent(srcEventTarget, target)) {\n target = srcEventTarget;\n }\n\n input.target = target;\n}\n\n/**\n * @private\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n } // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n\n\n input.eventType = eventType; // compute scale, rotation etc\n\n computeInputData(manager, input); // emit secret event\n\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * @private\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * @private\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n}\n\n/**\n * @private\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n\nvar Input =\n/*#__PURE__*/\nfunction () {\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n }\n /**\n * @private\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n\n\n var _proto = Input.prototype;\n\n _proto.handler = function handler() {};\n /**\n * @private\n * bind the events\n */\n\n\n _proto.init = function init() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n /**\n * @private\n * unbind the events\n */\n\n\n _proto.destroy = function destroy() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n\n return Input;\n}();\n\n/**\n * @private\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n\n while (i < src.length) {\n if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {\n // do not use === here, test fails\n return i;\n }\n\n i++;\n }\n\n return -1;\n }\n}\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n}; // in IE10 the pointer types is defined as an enum\n\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\n};\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive\n\nif (win.MSPointerEvent && !win.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n/**\n * @private\n * Pointer events input\n * @constructor\n * @extends Input\n */\n\n\nvar PointerEventInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(PointerEventInput, _Input);\n\n function PointerEventInput() {\n var _this;\n\n var proto = PointerEventInput.prototype;\n proto.evEl = POINTER_ELEMENT_EVENTS;\n proto.evWin = POINTER_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.store = _this.manager.session.pointerEvents = [];\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = PointerEventInput.prototype;\n\n _proto.handler = function handler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store\n\n var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down\n\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n } // it not found, so the pointer hasn't been down (so it's probably a hover)\n\n\n if (storeIndex < 0) {\n return;\n } // update the event in the store\n\n\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n };\n\n return PointerEventInput;\n}(Input);\n\n/**\n * @private\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * @private\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function (a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n\nvar TouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(TouchInput, _Input);\n\n function TouchInput() {\n var _this;\n\n TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS;\n\n return _this;\n }\n\n var _proto = TouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return TouchInput;\n}(Input);\n\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds; // when there is only one touch, the process can be simplified\n\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i;\n var targetTouches;\n var changedTouches = toArray(ev.changedTouches);\n var changedTargetTouches = [];\n var target = this.target; // get target touches from touches\n\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n }); // collect touches\n\n if (type === INPUT_START) {\n i = 0;\n\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n } // filter changed touches to only contain touches that exist in the collected target ids\n\n\n i = 0;\n\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n } // cleanup removed touches\n\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n/**\n * @private\n * Mouse events input\n * @constructor\n * @extends Input\n */\n\nvar MouseInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(MouseInput, _Input);\n\n function MouseInput() {\n var _this;\n\n var proto = MouseInput.prototype;\n proto.evEl = MOUSE_ELEMENT_EVENTS;\n proto.evWin = MOUSE_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.pressed = false; // mousedown state\n\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = MouseInput.prototype;\n\n _proto.handler = function handler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down\n\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n } // mouse must be down\n\n\n if (!this.pressed) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n };\n\n return MouseInput;\n}(Input);\n\n/**\n * @private\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\nvar DEDUP_TIMEOUT = 2500;\nvar DEDUP_DISTANCE = 25;\n\nfunction setLastTouch(eventData) {\n var _eventData$changedPoi = eventData.changedPointers,\n touch = _eventData$changedPoi[0];\n\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {\n x: touch.clientX,\n y: touch.clientY\n };\n var lts = this.lastTouches;\n this.lastTouches.push(lastTouch);\n\n var removeLastTouch = function removeLastTouch() {\n var i = lts.indexOf(lastTouch);\n\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n}\n\nfunction recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n}\n\nfunction isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX;\n var y = eventData.srcEvent.clientY;\n\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x);\n var dy = Math.abs(y - t.y);\n\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n\n return false;\n}\n\nvar TouchMouseInput =\n/*#__PURE__*/\nfunction () {\n var TouchMouseInput =\n /*#__PURE__*/\n function (_Input) {\n _inheritsLoose(TouchMouseInput, _Input);\n\n function TouchMouseInput(_manager, callback) {\n var _this;\n\n _this = _Input.call(this, _manager, callback) || this;\n\n _this.handler = function (manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;\n var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;\n\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n } // when we're in a touch event, record touches to de-dupe synthetic mouse event\n\n\n if (isTouch) {\n recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) {\n return;\n }\n\n _this.callback(manager, inputEvent, inputData);\n };\n\n _this.touch = new TouchInput(_this.manager, _this.handler);\n _this.mouse = new MouseInput(_this.manager, _this.handler);\n _this.primaryTouch = null;\n _this.lastTouches = [];\n return _this;\n }\n /**\n * @private\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n\n\n var _proto = TouchMouseInput.prototype;\n\n /**\n * @private\n * remove the event listeners\n */\n _proto.destroy = function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n };\n\n return TouchMouseInput;\n }(Input);\n\n return TouchMouseInput;\n}();\n\n/**\n * @private\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n\nfunction createInputInstance(manager) {\n var Type; // let inputClass = manager.options.inputClass;\n\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n\n return new Type(manager, inputHandler);\n}\n\n/**\n * @private\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n\n return false;\n}\n\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * @private\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * @private\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n\n if (manager) {\n return manager.get(otherRecognizer);\n }\n\n return otherRecognizer;\n}\n\n/**\n * @private\n * get a usable string, used as event postfix\n * @param {constant} state\n * @returns {String} state\n */\n\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n\n return '';\n}\n\n/**\n * @private\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n\n/**\n * @private\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n\nvar Recognizer =\n/*#__PURE__*/\nfunction () {\n function Recognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.options = _extends({\n enable: true\n }, options);\n this.id = uniqueId();\n this.manager = null; // default is enable true\n\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n\n\n var _proto = Recognizer.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state\n\n this.manager && this.manager.touchAction.update();\n return this;\n };\n /**\n * @private\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.recognizeWith = function recognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n };\n /**\n * @private\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.requireFailure = function requireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n\n return this;\n };\n /**\n * @private\n * has require failures boolean\n * @returns {boolean}\n */\n\n\n _proto.hasRequireFailures = function hasRequireFailures() {\n return this.requireFail.length > 0;\n };\n /**\n * @private\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n\n\n _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n };\n /**\n * @private\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n\n\n _proto.emit = function emit(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n } // 'panstart' and 'panmove'\n\n\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n } // panend and pancancel\n\n\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n };\n /**\n * @private\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n\n\n _proto.tryEmit = function tryEmit(input) {\n if (this.canEmit()) {\n return this.emit(input);\n } // it's failing anyway\n\n\n this.state = STATE_FAILED;\n };\n /**\n * @private\n * can we emit?\n * @returns {boolean}\n */\n\n\n _proto.canEmit = function canEmit() {\n var i = 0;\n\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n\n i++;\n }\n\n return true;\n };\n /**\n * @private\n * update the recognizer\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing?\n\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n } // reset when we've reached the end\n\n\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone); // the recognizer has recognized a gesture\n // so trigger an event\n\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n };\n /**\n * @private\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {constant} STATE\n */\n\n /* jshint ignore:start */\n\n\n _proto.process = function process(inputData) {};\n /* jshint ignore:end */\n\n /**\n * @private\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n\n\n _proto.getTouchAction = function getTouchAction() {};\n /**\n * @private\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n\n\n _proto.reset = function reset() {};\n\n return Recognizer;\n}();\n\n/**\n * @private\n * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n\nvar TapRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(TapRecognizer, _Recognizer);\n\n function TapRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n // max time between the multi-tap taps\n time: 250,\n // max time of the pointer to be down (like finger on the screen)\n threshold: 9,\n // a minimal movement is ok, but keep it low\n posThreshold: 10\n }, options)) || this; // previous time and center,\n // used for tap counting\n\n _this.pTime = false;\n _this.pCenter = false;\n _this._timer = null;\n _this._input = null;\n _this.count = 0;\n return _this;\n }\n\n var _proto = TapRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_MANIPULATION];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n\n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n } // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType !== INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input; // if tap count matches we have recognized it,\n // else it has began recognizing...\n\n var tapCount = this.count % options.taps;\n\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.interval);\n return STATE_BEGAN;\n }\n }\n }\n\n return STATE_FAILED;\n };\n\n _proto.failTimeout = function failTimeout() {\n var _this3 = this;\n\n this._timer = setTimeout(function () {\n _this3.state = STATE_FAILED;\n }, this.options.interval);\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit() {\n if (this.state === STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return TapRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n\nvar AttrRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(AttrRecognizer, _Recognizer);\n\n function AttrRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _Recognizer.call(this, _extends({\n pointers: 1\n }, options)) || this;\n }\n /**\n * @private\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n\n\n var _proto = AttrRecognizer.prototype;\n\n _proto.attrTest = function attrTest(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n };\n /**\n * @private\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n\n\n _proto.process = function process(input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED\n\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n\n return state | STATE_CHANGED;\n }\n\n return STATE_FAILED;\n };\n\n return AttrRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * direction cons to string\n * @param {constant} direction\n * @returns {String}\n */\n\nfunction directionStr(direction) {\n if (direction === DIRECTION_DOWN) {\n return 'down';\n } else if (direction === DIRECTION_UP) {\n return 'up';\n } else if (direction === DIRECTION_LEFT) {\n return 'left';\n } else if (direction === DIRECTION_RIGHT) {\n return 'right';\n }\n\n return '';\n}\n\n/**\n * @private\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PanRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PanRecognizer, _AttrRecognizer);\n\n function PanRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _AttrRecognizer.call(this, _extends({\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n }, options)) || this;\n _this.pX = null;\n _this.pY = null;\n return _this;\n }\n\n var _proto = PanRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n var direction = this.options.direction;\n var actions = [];\n\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n\n return actions;\n };\n\n _proto.directionTest = function directionTest(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY; // lock to axis?\n\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x !== this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y !== this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n };\n\n _proto.attrTest = function attrTest(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call\n this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));\n };\n\n _proto.emit = function emit(input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PanRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar SwipeRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(SwipeRecognizer, _AttrRecognizer);\n\n function SwipeRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n }, options)) || this;\n }\n\n var _proto = SwipeRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n };\n\n _proto.attrTest = function attrTest(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n };\n\n _proto.emit = function emit(input) {\n var direction = directionStr(input.offsetDirection);\n\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n };\n\n return SwipeRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PinchRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PinchRecognizer, _AttrRecognizer);\n\n function PinchRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'pinch',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = PinchRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n _proto.emit = function emit(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PinchRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar RotateRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(RotateRecognizer, _AttrRecognizer);\n\n function RotateRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'rotate',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = RotateRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n return RotateRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n\nvar PressRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(PressRecognizer, _Recognizer);\n\n function PressRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'press',\n pointers: 1,\n time: 251,\n // minimal time of the pointer to be pressed\n threshold: 9\n }, options)) || this;\n _this._timer = null;\n _this._input = null;\n return _this;\n }\n\n var _proto = PressRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_AUTO];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input; // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.time);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + \"up\", input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return PressRecognizer;\n}(Recognizer);\n\nvar defaults = {\n /**\n * @private\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * @private\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @private\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * @private\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * @private\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * @private\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * @private\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: \"none\",\n\n /**\n * @private\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: \"none\",\n\n /**\n * @private\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: \"none\",\n\n /**\n * @private\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: \"none\",\n\n /**\n * @private\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: \"none\",\n\n /**\n * @private\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: \"rgba(0,0,0,0)\"\n }\n};\n/**\n * @private\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * This is separated with other defaults because of tree-shaking.\n * @type {Array}\n */\n\nvar preset = [[RotateRecognizer, {\n enable: false\n}], [PinchRecognizer, {\n enable: false\n}, ['rotate']], [SwipeRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}], [PanRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}, ['swipe']], [TapRecognizer], [TapRecognizer, {\n event: 'doubletap',\n taps: 2\n}, ['tap']], [PressRecognizer]];\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n/**\n * @private\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n\n if (!element.style) {\n return;\n }\n\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || \"\";\n }\n });\n\n if (!add) {\n manager.oldCssProps = {};\n }\n}\n/**\n * @private\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n\n\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent(\"Event\");\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n/**\n* @private\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\n\nvar Manager =\n/*#__PURE__*/\nfunction () {\n function Manager(element, options) {\n var _this = this;\n\n this.options = assign$1({}, defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = _this.add(new item[0](item[1]));\n\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n\n\n var _proto = Manager.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // Options that need a little more setup\n\n if (options.touchAction) {\n this.touchAction.update();\n }\n\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n\n return this;\n };\n /**\n * @private\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n\n\n _proto.stop = function stop(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n };\n /**\n * @private\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n var session = this.session;\n\n if (session.stopped) {\n return;\n } // run the touch-action polyfill\n\n\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers; // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n\n var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized\n // or when we're in a new session\n\n if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {\n session.curRecognizer = null;\n curRecognizer = null;\n }\n\n var i = 0;\n\n while (i < recognizers.length) {\n recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer === curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n\n\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n session.curRecognizer = recognizer;\n curRecognizer = recognizer;\n }\n\n i++;\n }\n };\n /**\n * @private\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n\n\n _proto.get = function get(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event === recognizer) {\n return recognizers[i];\n }\n }\n\n return null;\n };\n /**\n * @private add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n\n\n _proto.add = function add(recognizer) {\n if (invokeArrayArg(recognizer, \"add\", this)) {\n return this;\n } // remove existing\n\n\n var existing = this.get(recognizer.options.event);\n\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n };\n /**\n * @private\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n\n\n _proto.remove = function remove(recognizer) {\n if (invokeArrayArg(recognizer, \"remove\", this)) {\n return this;\n }\n\n var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists\n\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, targetRecognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n };\n /**\n * @private\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n\n\n _proto.on = function on(events, handler) {\n if (events === undefined || handler === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n };\n /**\n * @private unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n\n\n _proto.off = function off(events, handler) {\n if (events === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n };\n /**\n * @private emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n\n\n _proto.emit = function emit(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n } // no handlers, so skip it all\n\n\n var handlers = this.handlers[event] && this.handlers[event].slice();\n\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n };\n /**\n * @private\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n\n\n _proto.destroy = function destroy() {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n };\n\n return Manager;\n}();\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Touch events input\n * @constructor\n * @extends Input\n */\n\nvar SingleTouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(SingleTouchInput, _Input);\n\n function SingleTouchInput() {\n var _this;\n\n var proto = SingleTouchInput.prototype;\n proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.started = false;\n return _this;\n }\n\n var _proto = SingleTouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?\n\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state\n\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return SingleTouchInput;\n}(Input);\n\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\n/**\n * @private\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = \"DEPRECATED METHOD: \" + name + \"\\n\" + message + \" AT \\n\";\n return function () {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '').replace(/^\\s+at\\s+/gm, '').replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n\n return method.apply(this, arguments);\n };\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n\nvar extend = deprecate(function (dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n\n while (i < keys.length) {\n if (!merge || merge && dest[keys[i]] === undefined) {\n dest[keys[i]] = src[keys[i]];\n }\n\n i++;\n }\n\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * @private\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n\nvar merge = deprecate(function (dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * @private\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n\nfunction inherit(child, base, properties) {\n var baseP = base.prototype;\n var childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign$1(childP, properties);\n }\n}\n\n/**\n * @private\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * @private\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\nvar Hammer =\n/*#__PURE__*/\nfunction () {\n var Hammer =\n /**\n * @private\n * @const {string}\n */\n function Hammer(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n return new Manager(element, _extends({\n recognizers: preset.concat()\n }, options));\n };\n\n Hammer.VERSION = \"2.0.17-rc\";\n Hammer.DIRECTION_ALL = DIRECTION_ALL;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.DIRECTION_LEFT = DIRECTION_LEFT;\n Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;\n Hammer.DIRECTION_UP = DIRECTION_UP;\n Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n Hammer.DIRECTION_NONE = DIRECTION_NONE;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.INPUT_START = INPUT_START;\n Hammer.INPUT_MOVE = INPUT_MOVE;\n Hammer.INPUT_END = INPUT_END;\n Hammer.INPUT_CANCEL = INPUT_CANCEL;\n Hammer.STATE_POSSIBLE = STATE_POSSIBLE;\n Hammer.STATE_BEGAN = STATE_BEGAN;\n Hammer.STATE_CHANGED = STATE_CHANGED;\n Hammer.STATE_ENDED = STATE_ENDED;\n Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;\n Hammer.STATE_CANCELLED = STATE_CANCELLED;\n Hammer.STATE_FAILED = STATE_FAILED;\n Hammer.Manager = Manager;\n Hammer.Input = Input;\n Hammer.TouchAction = TouchAction;\n Hammer.TouchInput = TouchInput;\n Hammer.MouseInput = MouseInput;\n Hammer.PointerEventInput = PointerEventInput;\n Hammer.TouchMouseInput = TouchMouseInput;\n Hammer.SingleTouchInput = SingleTouchInput;\n Hammer.Recognizer = Recognizer;\n Hammer.AttrRecognizer = AttrRecognizer;\n Hammer.Tap = TapRecognizer;\n Hammer.Pan = PanRecognizer;\n Hammer.Swipe = SwipeRecognizer;\n Hammer.Pinch = PinchRecognizer;\n Hammer.Rotate = RotateRecognizer;\n Hammer.Press = PressRecognizer;\n Hammer.on = addEventListeners;\n Hammer.off = removeEventListeners;\n Hammer.each = each;\n Hammer.merge = merge;\n Hammer.extend = extend;\n Hammer.bindFn = bindFn;\n Hammer.assign = assign$1;\n Hammer.inherit = inherit;\n Hammer.bindFn = bindFn;\n Hammer.prefixed = prefixed;\n Hammer.toArray = toArray;\n Hammer.inArray = inArray;\n Hammer.uniqueArray = uniqueArray;\n Hammer.splitStr = splitStr;\n Hammer.boolOrFn = boolOrFn;\n Hammer.hasParent = hasParent;\n Hammer.addEventListeners = addEventListeners;\n Hammer.removeEventListeners = removeEventListeners;\n Hammer.defaults = assign$1({}, defaults, {\n preset: preset\n });\n return Hammer;\n}();\n\n// style loader but by script tag, not by the loader.\n\nvar defaults$1 = Hammer.defaults;\n\nexport default Hammer;\nexport { INPUT_START, INPUT_MOVE, INPUT_END, INPUT_CANCEL, STATE_POSSIBLE, STATE_BEGAN, STATE_CHANGED, STATE_ENDED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_FAILED, DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, Input, TouchAction, TouchInput, MouseInput, PointerEventInput, TouchMouseInput, SingleTouchInput, Recognizer, AttrRecognizer, TapRecognizer as Tap, PanRecognizer as Pan, SwipeRecognizer as Swipe, PinchRecognizer as Pinch, RotateRecognizer as Rotate, PressRecognizer as Press, addEventListeners as on, removeEventListeners as off, each, merge, extend, assign$1 as assign, inherit, bindFn, prefixed, toArray, inArray, uniqueArray, splitStr, boolOrFn, hasParent, addEventListeners, removeEventListeners, defaults$1 as defaults };\n//# sourceMappingURL=hammer.esm.js.map\n","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/axes project is licensed under the MIT license\n\n@egjs/axes JavaScript library\nhttps://github.com/naver/egjs-axes\n\n@version 2.7.1\n*/\nimport { DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, PointerEventInput, TouchMouseInput, TouchInput, MouseInput, Pan, Pinch } from '@egjs/hammerjs';\nimport getAgent from '@egjs/agent';\nimport Component from '@egjs/component';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n};\n\nfunction __extends(d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nfunction getInsidePosition(destPos, range, circular, bounce) {\n var toDestPos = destPos;\n var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]];\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n return toDestPos;\n} // determine outside\n\nfunction isOutside(pos, range) {\n return pos < range[0] || pos > range[1];\n}\nfunction getDuration(distance, deceleration) {\n var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero\n\n return duration < 100 ? 0 : duration;\n}\nfunction isCircularable(destPos, range, circular) {\n return circular[1] && destPos > range[1] || circular[0] && destPos < range[0];\n}\nfunction getCirculatedPos(pos, range, circular) {\n var toPos = pos;\n var min = range[0];\n var max = range[1];\n var length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = (toPos - max) % length + min;\n }\n\n if (circular[0] && pos < min) {\n // left\n toPos = (toPos - min) % length + max;\n }\n\n return toPos;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\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\nfunction toArray(nodes) {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n var el = [];\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n\n return el;\n}\nfunction $(param, multi) {\n if (multi === void 0) {\n multi = false;\n }\n\n var el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n var match = param.match(/^<([a-z]+)\\s*([^>]*)>/); // creating element\n\n if (match) {\n // HTML\n var dummy = document.createElement(\"div\");\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === win) {\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 (\"jQuery\" in win && param instanceof jQuery || param.constructor.prototype.jquery) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map(function (v) {\n return $(v);\n });\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n\n return el;\n}\nvar raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame;\nvar caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;\n\nif (raf && !caf) {\n var keyInfo_1 = {};\n var oldraf_1 = raf;\n\n raf = function (callback) {\n function wrapCallback(timestamp) {\n if (keyInfo_1[key]) {\n callback(timestamp);\n }\n }\n\n var key = oldraf_1(wrapCallback);\n keyInfo_1[key] = true;\n return key;\n };\n\n caf = function (key) {\n delete keyInfo_1[key];\n };\n} else if (!(raf && caf)) {\n raf = function (callback) {\n return win.setTimeout(function () {\n callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime());\n }, 16);\n };\n\n caf = win.clearTimeout;\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 */\n\n\nfunction 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*/\n\nfunction cancelAnimationFrame(key) {\n caf(key);\n}\nfunction map(obj, callback) {\n var tranformed = {};\n\n for (var k in obj) {\n k && (tranformed[k] = callback(obj[k], k));\n }\n\n return tranformed;\n}\nfunction filter(obj, callback) {\n var filtered = {};\n\n for (var k in obj) {\n k && callback(obj[k], k) && (filtered[k] = obj[k]);\n }\n\n return filtered;\n}\nfunction every(obj, callback) {\n for (var k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n\n return true;\n}\nfunction equal(target, base) {\n return every(target, function (v, k) {\n return v === base[k];\n });\n}\nvar roundNumFunc = {};\nfunction roundNumber(num, roundUnit) {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n}\nfunction roundNumbers(num, roundUnit) {\n if (!num || !roundUnit) {\n return num;\n }\n\n var isNumber = typeof roundUnit === \"number\";\n return map(num, function (value, key) {\n return roundNumber(value, isNumber ? roundUnit : roundUnit[key]);\n });\n}\nfunction getDecimalPlace(val) {\n if (!isFinite(val)) {\n return 0;\n }\n\n var v = val + \"\";\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n var p = 0;\n var e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n } // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n\n\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n}\nfunction inversePow(n) {\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}\nfunction getRoundFunc(v) {\n var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n return function (n) {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n}\n\nfunction minMax(value, min, max) {\n return Math.max(Math.min(value, max), min);\n}\n\nvar AnimationManager =\n/*#__PURE__*/\nfunction () {\n function AnimationManager(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n var __proto = AnimationManager.prototype;\n\n __proto.getDuration = function (depaPos, destPos, wishDuration) {\n var _this = this;\n\n var duration;\n\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n var durations_1 = map(destPos, function (v, k) {\n return getDuration(Math.abs(v - depaPos[k]), _this.options.deceleration);\n });\n duration = Object.keys(durations_1).reduce(function (max, v) {\n return Math.max(max, durations_1[v]);\n }, -Infinity);\n }\n\n return minMax(duration, this.options.minimumDuration, this.options.maximumDuration);\n };\n\n __proto.createAnimationParam = function (pos, duration, option) {\n var depaPos = this.axm.get();\n var destPos = pos;\n var inputEvent = option && option.event || null;\n return {\n depaPos: depaPos,\n destPos: destPos,\n duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration),\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: inputEvent,\n input: option && option.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd\n };\n };\n\n __proto.grab = function (axes, option) {\n if (this._animateParam && axes.length) {\n var orgPos_1 = this.axm.get(axes);\n var pos = this.axm.map(orgPos_1, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n });\n\n if (!every(pos, function (v, k) {\n return orgPos_1[k] === v;\n })) {\n this.em.triggerChange(pos, false, orgPos_1, option, !!option);\n }\n\n this._animateParam = null;\n this._raf && cancelAnimationFrame(this._raf);\n this._raf = null;\n this.em.triggerAnimationEnd(!!(option && option.event));\n }\n };\n\n __proto.getEventInfo = function () {\n if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent\n };\n } else {\n return null;\n }\n };\n\n __proto.restore = function (option) {\n var pos = this.axm.get();\n var destPos = this.axm.map(pos, function (v, opt) {\n return Math.min(opt.range[1], Math.max(opt.range[0], v));\n });\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n };\n\n __proto.animationEnd = function () {\n var beforeParam = this.getEventInfo();\n this._animateParam = null; // for Circular\n\n var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n });\n Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n }));\n this.itm.setInterrupt(false);\n this.em.triggerAnimationEnd(!!beforeParam);\n\n if (this.axm.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n };\n\n __proto.finish = function (isTrusted) {\n this._animateParam = null;\n this.itm.setInterrupt(false);\n this.em.triggerFinish(isTrusted);\n };\n\n __proto.animateLoop = function (param, complete) {\n if (param.duration) {\n this._animateParam = __assign({}, param);\n var info_1 = this._animateParam;\n var self_1 = this;\n var destPos_1 = info_1.destPos;\n var prevPos_1 = info_1.depaPos;\n var prevEasingPer_1 = 0;\n var directions_1 = map(prevPos_1, function (value, key) {\n return value <= destPos_1[key] ? 1 : -1;\n });\n var originalIntendedPos_1 = map(destPos_1, function (v) {\n return v;\n });\n var prevTime_1 = new Date().getTime();\n info_1.startTime = prevTime_1;\n\n (function loop() {\n self_1._raf = null;\n var currentTime = new Date().getTime();\n var ratio = (currentTime - info_1.startTime) / param.duration;\n var easingPer = self_1.easing(ratio);\n var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) {\n var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n\n var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular);\n\n if (nextPos !== circulatedPos) {\n // circular\n var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]);\n destPos_1[key] -= rangeOffset;\n prevPos_1[key] -= rangeOffset;\n }\n\n return circulatedPos;\n });\n var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1);\n prevPos_1 = toPos;\n prevTime_1 = currentTime;\n prevEasingPer_1 = easingPer;\n\n if (easingPer >= 1) {\n destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1);\n\n if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) {\n self_1.em.triggerChange(destPos_1, true, prevPos_1);\n }\n\n complete();\n return;\n } else if (isCanceled) {\n self_1.finish(false);\n } else {\n // animationEnd\n self_1._raf = requestAnimationFrame(loop);\n }\n })();\n } else {\n this.em.triggerChange(param.destPos, true);\n complete();\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 *\n * @param originalIntendedPos\n * @param destPos\n */\n\n\n __proto.getFinalPos = function (destPos, originalIntendedPos) {\n var _this = this; // compare destPos and originalIntendedPos\n\n\n var ERROR_LIMIT = 0.000001;\n var finalPos = map(destPos, function (value, key) {\n if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n var roundUnit = _this.getRoundUnit(value, key);\n\n var result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n };\n\n __proto.getRoundUnit = function (val, key) {\n var roundUnit = this.options.round; // manual mode\n\n var minRoundUnit = null; // auto mode\n // auto mode\n\n if (!roundUnit) {\n // Get minimum round unit\n var options = this.axm.getAxisOptions(key);\n minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val)));\n }\n\n return minRoundUnit || roundUnit;\n };\n\n __proto.getUserControll = function (param) {\n var userWish = param.setTo();\n userWish.destPos = this.axm.get(userWish.destPos);\n userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration);\n return userWish;\n };\n\n __proto.animateTo = function (destPos, duration, option) {\n var _this = this;\n\n var param = this.createAnimationParam(destPos, duration, option);\n\n var depaPos = __assign({}, param.depaPos);\n\n var retTrigger = this.em.triggerAnimationStart(param); // to control\n\n var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true.\n\n if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n })) {\n console.warn(\"You can't stop the 'animation' event when 'circular' is true.\");\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n var inputEvent = option && option.event || null;\n this.animateLoop({\n depaPos: depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axm.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent: inputEvent,\n input: option && option.input || null\n }, function () {\n return _this.animationEnd();\n });\n }\n };\n\n __proto.easing = function (p) {\n return p > 1 ? 1 : this.options.easing(p);\n };\n\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n var axes = Object.keys(pos);\n this.grab(axes);\n var orgPos = this.axm.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n\n this.itm.setInterrupt(true);\n var movedPos = filter(pos, function (v, k) {\n return orgPos[k] !== v;\n });\n\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axm.map(movedPos, function (v, opt) {\n var range = opt.range,\n circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular);\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.em.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n };\n\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) {\n return v + pos[k];\n }), duration);\n };\n\n return AnimationManager;\n}();\n\nvar EventManager =\n/*#__PURE__*/\nfunction () {\n function EventManager(axes) {\n this.axes = axes;\n }\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @name eg.Axes#hold\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n var __proto = EventManager.prototype;\n\n __proto.triggerHold = function (pos, option) {\n var roundPos = this.getRoundPos(pos).roundPos;\n this.axes.trigger(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true\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 * @name set\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\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 * @name setTo\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\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 * @name eg.Axes#release\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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} 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 * 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\n __proto.triggerRelease = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n this.axes.trigger(\"release\", param);\n };\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @name eg.Axes#change\n * @event\n * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\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 * 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\n __proto.triggerChange = function (pos, isAccurate, depaPos, option, holding) {\n if (holding === void 0) {\n holding = false;\n }\n\n var am = this.am;\n var axm = am.axm;\n var eventInfo = am.getEventInfo();\n\n var _a = this.getRoundPos(pos, depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n var moveTo = axm.moveTo(roundPos, roundDepa);\n var inputEvent = option && option.event || eventInfo && eventInfo.event || null;\n var param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n holding: holding,\n inputEvent: inputEvent,\n isTrusted: !!inputEvent,\n input: option && option.input || eventInfo && eventInfo.input || null,\n set: inputEvent ? this.createUserControll(moveTo.pos) : function () {}\n };\n var result = this.axes.trigger(\"change\", param);\n inputEvent && axm.set(param.set()[\"destPos\"]);\n return result;\n };\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @name eg.Axes#animationStart\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationStart = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n return this.axes.trigger(\"animationStart\", param);\n };\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#animationEnd\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationEnd = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"animationEnd\", {\n isTrusted: isTrusted\n });\n };\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#finish\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerFinish = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"finish\", {\n isTrusted: isTrusted\n });\n };\n\n __proto.createUserControll = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n } // to controll\n\n\n var userControl = {\n destPos: __assign({}, pos),\n duration: duration\n };\n return function (toPos, userDuration) {\n toPos && (userControl.destPos = __assign({}, toPos));\n userDuration !== undefined && (userControl.duration = userDuration);\n return userControl;\n };\n };\n\n __proto.setAnimationManager = function (am) {\n this.am = am;\n };\n\n __proto.destroy = function () {\n this.axes.off();\n };\n\n __proto.getRoundPos = function (pos, depaPos) {\n // round value if round exist\n var roundUnit = this.axes.options.round; // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit)\n };\n };\n\n return EventManager;\n}();\n\nvar InterruptManager =\n/*#__PURE__*/\nfunction () {\n function InterruptManager(options) {\n this.options = options;\n this._prevented = false; // check whether the animation event was prevented\n }\n\n var __proto = InterruptManager.prototype;\n\n __proto.isInterrupting = function () {\n // when interruptable is 'true', return value is always 'true'.\n return this.options.interruptable || this._prevented;\n };\n\n __proto.isInterrupted = function () {\n return !this.options.interruptable && this._prevented;\n };\n\n __proto.setInterrupt = function (prevented) {\n !this.options.interruptable && (this._prevented = prevented);\n };\n\n return InterruptManager;\n}();\n\nvar AxisManager =\n/*#__PURE__*/\nfunction () {\n function AxisManager(axis, options) {\n var _this = this;\n\n this.axis = axis;\n this.options = options;\n\n this._complementOptions();\n\n this._pos = Object.keys(this.axis).reduce(function (acc, v) {\n acc[v] = _this.axis[v].range[0];\n return acc;\n }, {});\n }\n /**\n * set up 'css' expression\n * @private\n */\n\n\n var __proto = AxisManager.prototype;\n\n __proto._complementOptions = function () {\n var _this = this;\n\n Object.keys(this.axis).forEach(function (axis) {\n _this.axis[axis] = __assign({\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false]\n }, _this.axis[axis]);\n [\"bounce\", \"circular\"].forEach(function (v) {\n var axisOption = _this.axis;\n var 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 __proto.getDelta = function (depaPos, destPos) {\n var fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), function (v, k) {\n return v - fullDepaPos[k];\n });\n };\n\n __proto.get = function (axes) {\n var _this = this;\n\n if (axes && Array.isArray(axes)) {\n return axes.reduce(function (acc, v) {\n if (v && v in _this._pos) {\n acc[v] = _this._pos[v];\n }\n\n return acc;\n }, {});\n } else {\n return __assign({}, this._pos, axes || {});\n }\n };\n\n __proto.moveTo = function (pos, depaPos) {\n if (depaPos === void 0) {\n depaPos = this._pos;\n }\n\n var delta = map(this._pos, function (v, key) {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n this.set(this.map(pos, function (v, opt) {\n return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0;\n }));\n return {\n pos: __assign({}, this._pos),\n delta: delta\n };\n };\n\n __proto.set = function (pos) {\n for (var k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n };\n\n __proto.every = function (pos, callback) {\n var axisOptions = this.axis;\n return every(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.filter = function (pos, callback) {\n var axisOptions = this.axis;\n return filter(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.map = function (pos, callback) {\n var axisOptions = this.axis;\n return map(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.isOutside = function (axes) {\n return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) {\n return !isOutside(v, opt.range);\n });\n };\n\n __proto.getAxisOptions = function (key) {\n return this.axis[key];\n };\n\n return AxisManager;\n}();\n\nvar InputObserver =\n/*#__PURE__*/\nfunction () {\n function InputObserver(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm,\n am = _a.am;\n this.isOutside = false;\n this.moveDistance = null;\n this.isStopped = false;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.am = am;\n } // when move pointer is held in outside\n\n\n var __proto = InputObserver.prototype;\n\n __proto.atOutside = function (pos) {\n var _this = this;\n\n if (this.isOutside) {\n return this.axm.map(pos, function (v, opt) {\n var tn = opt.range[0] - opt.bounce[0];\n var tx = opt.range[1] + opt.bounce[1];\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n // when start pointer is held in inside\n // get a initialization slope value to prevent smooth animation.\n var initSlope_1 = this.am.easing(0.00001) / 0.00001;\n return this.axm.map(pos, function (v, opt) {\n var min = opt.range[0];\n var max = opt.range[1];\n var out = opt.bounce;\n var circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return min - _this.am.easing((min - v) / (out[0] * initSlope_1)) * out[0];\n } else if (v > max) {\n // right\n return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1];\n }\n\n return v;\n });\n }\n };\n\n __proto.get = function (input) {\n return this.axm.get(input.axes);\n };\n\n __proto.hold = function (input, event) {\n if (this.itm.isInterrupted() || !input.axes.length) {\n return;\n }\n\n var changeOption = {\n input: input,\n event: event\n };\n this.isStopped = false;\n this.itm.setInterrupt(true);\n this.am.grab(input.axes, changeOption);\n !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption);\n this.isOutside = this.axm.isOutside(input.axes);\n this.moveDistance = this.axm.get(input.axes);\n };\n\n __proto.change = function (input, event, offset) {\n if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) {\n return v === 0;\n })) {\n return;\n }\n\n var depaPos = this.moveDistance || this.axm.get(input.axes);\n var destPos; // for outside logic\n\n destPos = map(depaPos, function (v, k) {\n return v + (offset[k] || 0);\n });\n this.moveDistance && (this.moveDistance = destPos); // from outside to inside\n\n if (this.isOutside && this.axm.every(depaPos, function (v, opt) {\n return !isOutside(v, opt.range);\n })) {\n this.isOutside = false;\n }\n\n depaPos = this.atOutside(depaPos);\n destPos = this.atOutside(destPos);\n var isCanceled = !this.em.triggerChange(destPos, false, depaPos, {\n input: input,\n event: event\n }, true);\n\n if (isCanceled) {\n this.isStopped = true;\n this.moveDistance = null;\n this.am.finish(false);\n }\n };\n\n __proto.release = function (input, event, offset, inputDuration) {\n if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) {\n return;\n }\n\n var pos = this.axm.get(input.axes);\n var depaPos = this.axm.get();\n var destPos = this.axm.get(this.axm.map(offset, function (v, opt, k) {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce);\n }\n }));\n var duration = this.am.getDuration(destPos, pos, inputDuration);\n\n if (duration === 0) {\n destPos = __assign({}, depaPos);\n } // prepare params\n\n\n var param = {\n depaPos: depaPos,\n destPos: destPos,\n duration: duration,\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: event,\n input: input,\n isTrusted: true\n };\n this.em.triggerRelease(param);\n this.moveDistance = null; // to contol\n\n var userWish = this.am.getUserControll(param);\n var isEqual = equal(userWish.destPos, depaPos);\n var changeOption = {\n input: input,\n event: event\n };\n\n if (isEqual || userWish.duration === 0) {\n !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true);\n this.itm.setInterrupt(false);\n\n if (this.axm.isOutside()) {\n this.am.restore(changeOption);\n } else {\n this.em.triggerFinish(true);\n }\n } else {\n this.am.animateTo(userWish.destPos, userWish.duration, changeOption);\n }\n };\n\n return InputObserver;\n}();\n\n// export const DIRECTION_NONE = 1;\nvar IOS_EDGE_THRESHOLD = 30;\nvar IS_IOS_SAFARI = \"ontouchstart\" in win && getAgent().browser.name === \"safari\";\nvar TRANSFORM = function () {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n\n var bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0]).style;\n var target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n for (var i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n\n return \"\";\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 * @property {Number[]} [range] The coordinate of range 좌표 범위\n * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표\n * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표\n * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to \"true\" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @property {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 * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @property {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가 적용되지 않는다
\n * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
\n**/\n\n/**\n * @class eg.Axes\n * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.\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] 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 *\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\nvar Axes =\n/*#__PURE__*/\nfunction (_super) {\n __extends(Axes, _super);\n\n function Axes(axis, options, startPos) {\n if (axis === void 0) {\n axis = {};\n }\n\n if (options === void 0) {\n options = {};\n }\n\n var _this = _super.call(this) || this;\n\n _this.axis = axis;\n _this._inputs = [];\n _this.options = __assign({\n easing: function easeOutCubic(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 }, options);\n _this.itm = new InterruptManager(_this.options);\n _this.axm = new AxisManager(_this.axis, _this.options);\n _this.em = new EventManager(_this);\n _this.am = new AnimationManager(_this);\n _this.io = new InputObserver(_this);\n\n _this.em.setAnimationManager(_this.am);\n\n startPos && _this.em.triggerChange(startPos);\n return _this;\n }\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @method eg.Axes#connect\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 * 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\n var __proto = Axes.prototype;\n\n __proto.connect = function (axes, inputType) {\n var mapped;\n\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n } // check same instance\n\n\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n } // check same element in hammer type for share\n\n\n if (\"hammer\" in inputType) {\n var targets = this._inputs.filter(function (v) {\n return v.hammer && v.element === inputType.element;\n });\n\n if (targets.length) {\n inputType.hammer = targets[0].hammer;\n }\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.io);\n\n this._inputs.push(inputType);\n\n return this;\n };\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @method eg.Axes#disconnect\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 * 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\n __proto.disconnect = function (inputType) {\n if (inputType) {\n var index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach(function (v) {\n return v.disconnect();\n });\n\n this._inputs = [];\n }\n\n return this;\n };\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @method eg.Axes#get\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\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\n __proto.get = function (axes) {\n return this.axm.get(axes);\n };\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @method eg.Axes#setTo\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 * 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\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setTo(pos, duration);\n return this;\n };\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @method eg.Axes#setBy\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 * 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\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setBy(pos, duration);\n return this;\n };\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @method eg.Axes#isBounceArea\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\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\n __proto.isBounceArea = function (axes) {\n return this.axm.isOutside(axes);\n };\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n * @method eg.Axes#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.em.destroy();\n };\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Axes.VERSION; // ex) 3.3.3\n * @memberof eg.Axes\n */\n\n\n Axes.VERSION = \"2.7.1\";\n /**\n * @name eg.Axes.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 * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n */\n\n Axes.TRANSFORM = TRANSFORM;\n /**\n * @name eg.Axes.DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name eg.Axes.DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name eg.Axes.DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name eg.Axes.DIRECTION_UP\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_UP = DIRECTION_UP;\n /**\n * @name eg.Axes.DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name eg.Axes.DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name eg.Axes.DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name eg.Axes.DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_ALL = DIRECTION_ALL;\n return Axes;\n}(Component);\n\nvar SUPPORT_POINTER_EVENTS = \"PointerEvent\" in win || \"MSPointerEvent\" in win;\nvar SUPPORT_TOUCH = (\"ontouchstart\" in win);\nvar UNIQUEKEY = \"_EGJS_AXES_INPUTTYPE_\";\nfunction toAxis(source, offset) {\n return offset.reduce(function (acc, v, i) {\n if (source[i]) {\n acc[source[i]] = v;\n }\n\n return acc;\n }, {});\n}\nfunction createHammer(element, options) {\n try {\n // create Hammer\n return new Manager(element, __assign({}, options));\n } catch (e) {\n return null;\n }\n}\nfunction convertInputType(inputType) {\n if (inputType === void 0) {\n inputType = [];\n }\n\n var hasTouch = false;\n var hasMouse = false;\n var hasPointer = false;\n inputType.forEach(function (v) {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n\n if (hasPointer) {\n return PointerEventInput;\n } else if (hasTouch && hasMouse) {\n return TouchMouseInput;\n } else if (hasTouch) {\n return TouchInput;\n } else if (hasMouse) {\n return MouseInput;\n }\n\n return null;\n}\n\nfunction getDirectionByAngle(angle, thresholdAngle) {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n\n var toAngle = Math.abs(angle);\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL;\n}\nfunction getNextOffset(speeds, deceleration) {\n var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]);\n var duration = Math.abs(normalSpeed / -deceleration);\n return [speeds[0] / 2 * duration, speeds[1] / 2 * duration];\n}\nfunction useDirection(checkType, direction, userDirection) {\n if (userDirection) {\n return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType);\n } else {\n return !!(direction & checkType);\n }\n}\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @property {String[]} [inputType=[\"touch\",\"mouse\", \"pointer\"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
\n * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율\n * @property {Number} [scale.1=1] vertical axis scale 수직축 배율\n * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PanInput\n * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\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 */\n\nvar PanInput =\n/*#__PURE__*/\nfunction () {\n function PanInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this.panRecognizer = null;\n this.isRightEdge = false;\n this.rightEdgeTimer = 0;\n this.panFlag = false;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PanInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onHammerInput = this.onHammerInput.bind(this);\n this.onPanmove = this.onPanmove.bind(this);\n this.onPanend = this.onPanend.bind(this);\n }\n\n var __proto = PanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n var useHorizontal = !!axes[0];\n var useVertical = !!axes[1];\n\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\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n direction: this._direction,\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PanRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.panRecognizer = new Pan(hammerOption);\n this.hammer.add(this.panRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.dettachEvent();\n }\n\n this._direction = DIRECTION_NONE;\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PanInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PanInput#enable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PanInput#disable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PanInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pan\").options.enable);\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.panRecognizer) {\n this.hammer.remove(this.panRecognizer);\n this.panRecognizer = null;\n }\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.panFlag = false;\n\n if (event.srcEvent.cancelable !== false) {\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n this.observer.hold(this, event);\n this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold;\n this.panFlag = true;\n }\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanmove = function (event) {\n var _this = this;\n\n if (!this.panFlag) {\n return;\n }\n\n var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start\n\n var prevInput = this.hammer.session.prevInput;\n\n if (prevInput && IS_IOS_SAFARI) {\n var swipeLeftToRight = event.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n return;\n } else if (this.isRightEdge) {\n clearTimeout(this.rightEdgeTimer); // - is right to left\n\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n var swipeRightToLeft = event.deltaX < -edgeThreshold;\n\n if (swipeRightToLeft) {\n this.isRightEdge = false;\n } else {\n // iOS swipe right => left\n this.rightEdgeTimer = window.setTimeout(function () {\n _this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n }, 100);\n }\n }\n }\n /* eslint-disable no-param-reassign */\n\n\n if (prevInput) {\n event.offsetX = event.deltaX - prevInput.deltaX;\n event.offsetY = event.deltaY - prevInput.deltaY;\n } else {\n event.offsetX = 0;\n event.offsetY = 0;\n }\n\n var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]);\n var prevent = offset.some(function (v) {\n return v !== 0;\n });\n\n if (prevent) {\n var srcEvent = event.srcEvent;\n\n if (srcEvent.cancelable !== false) {\n srcEvent.preventDefault();\n }\n\n srcEvent.stopPropagation();\n }\n\n event.preventSystemEvent = prevent;\n prevent && this.observer.change(this, event, toAxis(this.axes, offset));\n };\n\n __proto.onPanend = function (event) {\n if (!this.panFlag) {\n return;\n }\n\n clearTimeout(this.rightEdgeTimer);\n this.panFlag = false;\n var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]);\n offset = getNextOffset(offset, this.observer.options.deceleration);\n this.observer.release(this, event, toAxis(this.axes, offset));\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"hammer.input\", this.onHammerInput).on(\"panstart panmove\", this.onPanmove);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"hammer.input\", this.onHammerInput).off(\"panstart panmove\", this.onPanmove);\n this.observer = null;\n };\n\n __proto.getOffset = function (properties, direction) {\n var offset = [0, 0];\n var scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n\n return offset;\n };\n\n return PanInput;\n}();\n\n/**\n * @class eg.Axes.RotatePanInput\n * @classdesc 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)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.
[상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\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 eg.Axes.PanInput\n */\n\nvar RotatePanInput =\n/*#__PURE__*/\nfunction (_super) {\n __extends(RotatePanInput, _super);\n\n function RotatePanInput(el, options) {\n var _this = _super.call(this, el, options) || this;\n\n _this.prevQuadrant = null;\n _this.lastDiff = 0;\n return _this;\n }\n\n var __proto = RotatePanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.observer.hold(this, event);\n this.onPanstart(event);\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanstart = function (event) {\n var rect = this.element.getBoundingClientRect();\n /**\n * Responsive\n */\n // TODO: how to do if element is ellipse not circle.\n\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\n this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle.\n\n this.prevAngle = null;\n this.triggerChange(event);\n };\n\n __proto.onPanmove = function (event) {\n this.triggerChange(event);\n };\n\n __proto.onPanend = function (event) {\n this.triggerChange(event);\n this.triggerAnimation(event);\n };\n\n __proto.triggerChange = function (event) {\n var angle = this.getAngle(event.center.x, event.center.y);\n var quadrant = this.getQuadrant(event.center.x, event.center.y);\n var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant);\n this.prevAngle = angle;\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 __proto.triggerAnimation = function (event) {\n var vx = event.velocityX;\n var vy = event.velocityY;\n var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise\n\n var duration = Math.abs(velocity / -this.observer.options.deceleration);\n var distance = velocity / 2 * duration;\n this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle]));\n };\n\n __proto.getDifference = function (prevAngle, angle, prevQuadrant, quadrant) {\n var diff;\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 __proto.getPosFromOrigin = function (posX, posY) {\n return {\n x: posX - this.rotateOrigin[0],\n y: this.rotateOrigin[1] - posY\n };\n };\n\n __proto.getAngle = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y);\n\n return angle < 0 ? 360 + angle : angle;\n };\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n\n\n __proto.getQuadrant = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var 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\n return q;\n };\n\n return RotatePanInput;\n}(PanInput);\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PinchInput\n * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\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 */\n\nvar PinchInput =\n/*#__PURE__*/\nfunction () {\n function PinchInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this._base = null;\n this._prev = null;\n this.pinchRecognizer = null;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PinchInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onPinchStart = this.onPinchStart.bind(this);\n this.onPinchMove = this.onPinchMove.bind(this);\n this.onPinchEnd = this.onPinchEnd.bind(this);\n }\n\n var __proto = PinchInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PinchRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.pinchRecognizer = new Pinch(hammerOption);\n this.hammer.add(this.pinchRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n this.dettachEvent();\n }\n\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PinchInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.pinchRecognizer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n }\n };\n\n __proto.onPinchStart = function (event) {\n this._base = this.observer.get(this)[this.axes[0]];\n var offset = this.getOffset(event.scale);\n this.observer.hold(this, event);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchMove = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchEnd = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this.observer.release(this, event, toAxis(this.axes, [0]), 0);\n this._base = null;\n this._prev = null;\n };\n\n __proto.getOffset = function (pinchScale, prev) {\n if (prev === void 0) {\n prev = 1;\n }\n\n return this._base * (pinchScale - prev) * this.options.scale;\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"pinchstart\", this.onPinchStart).on(\"pinchmove\", this.onPinchMove).on(\"pinchend\", this.onPinchEnd);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"pinchstart\", this.onPinchStart).off(\"pinchmove\", this.onPinchMove).off(\"pinchend\", this.onPinchEnd);\n this.observer = null;\n this._prev = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PinchInput#enable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PinchInput#disable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PinchInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pinch\").options.enable);\n };\n\n return PinchInput;\n}();\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n**/\n\n/**\n * @class eg.Axes.WheelInput\n * @classdesc 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 * 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 */\n\nvar WheelInput =\n/*#__PURE__*/\nfunction () {\n function WheelInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n useNormalized: true\n }, options);\n this.onWheel = this.onWheel.bind(this);\n }\n\n var __proto = WheelInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent();\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.WheelInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onWheel = function (event) {\n var _this = this;\n\n if (!this._isEnabled) {\n return;\n }\n\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n if (_this._isHolded) {\n _this._isHolded = false;\n\n _this.observer.release(_this, event, toAxis(_this.axes, [0]));\n }\n }, 50);\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.element.addEventListener(\"wheel\", this.onWheel);\n this._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\n this.element.removeEventListener(\"wheel\", this.onWheel);\n this._isEnabled = false;\n this.observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.WheelInput#enable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.WheelInput#disable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.WheelInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return WheelInput;\n}();\n\nvar KEY_LEFT_ARROW = 37;\nvar KEY_A = 65;\nvar KEY_UP_ARROW = 38;\nvar KEY_W = 87;\nvar KEY_RIGHT_ARROW = 39;\nvar KEY_D = 68;\nvar KEY_DOWN_ARROW = 40;\nvar KEY_S = 83;\nvar DIRECTION_REVERSE = -1;\nvar DIRECTION_FORWARD = 1;\nvar DIRECTION_HORIZONTAL$1 = -1;\nvar DIRECTION_VERTICAL$1 = 1;\nvar DELAY = 80;\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @property {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @property {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n**/\n\n/**\n * @class eg.Axes.MoveKeyInput\n * @classdesc 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 * 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 */\n\nvar MoveKeyInput =\n/*#__PURE__*/\nfunction () {\n function MoveKeyInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: [1, 1]\n }, options);\n this.onKeydown = this.onKeydown.bind(this);\n this.onKeyup = this.onKeyup.bind(this);\n }\n\n var __proto = MoveKeyInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent(); // add tabindex=\"0\" to the container for making it focusable\n\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 __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.MoveKeyInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onKeydown = function (e) {\n if (!this._isEnabled) {\n return;\n }\n\n var isMoveKey = true;\n var direction = DIRECTION_FORWARD;\n var move = DIRECTION_HORIZONTAL$1;\n\n switch (e.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL$1;\n break;\n\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL$1;\n break;\n\n default:\n isMoveKey = false;\n }\n\n if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) {\n isMoveKey = false;\n }\n\n if (!isMoveKey) {\n return;\n }\n\n var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction];\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n clearTimeout(this._timer);\n this.observer.change(this, event, toAxis(this.axes, offsets));\n };\n\n __proto.onKeyup = function (e) {\n var _this = this;\n\n if (!this._isHolded) {\n return;\n }\n\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n _this.observer.release(_this, e, toAxis(_this.axes, [0, 0]));\n\n _this._isHolded = false;\n }, DELAY);\n };\n\n __proto.attachEvent = function (observer) {\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._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\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._isEnabled = false;\n this.observer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.MoveKeyInput#enable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.MoveKeyInput#disable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.MoveKeyInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return MoveKeyInput;\n}();\n\nexport default Axes;\nexport { PanInput, RotatePanInput, PinchInput, WheelInput, MoveKeyInput };\n//# sourceMappingURL=axes.esm.js.map\n","/**\n * Original Code\n * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js\n * Math Util\n * modified by egjs\n */\n/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.2\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n// Some minimal math functionality borrowed from gl-Matrix and stripped down\n// for the purposes of this library.\n\nimport {vec2, vec3, quat} from \"gl-matrix\";\n\nfunction quatToVec3(quaternion) {\n\tconst baseV = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(baseV, baseV, quaternion);\n\treturn baseV;\n}\n\nfunction toDegree(a){\n\treturn a * 180 / Math.PI;\n}\n\nconst util = {};\n\nutil.isPowerOfTwo = function(n) {\n\treturn n && (n & (n - 1)) === 0;\n};\n\nutil.extractPitchFromQuat = function(quaternion) {\n\tconst baseV = quatToVec3(quaternion);\n\n\treturn -1 * Math.atan2(\n\t\tbaseV[1],\n\t\tMath.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2)));\n};\n\nutil.hypot = Math.hypot || function(x, y) {\n\treturn Math.sqrt(x * x + y * y);\n};\n\n// implement reference\n// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식\n// calculating angle between two vectors : http://darkpgmr.tistory.com/121\nconst ROTATE_CONSTANT = {\n\tPITCH_DELTA: 1,\n\tYAW_DELTA_BY_ROLL: 2,\n\tYAW_DELTA_BY_YAW: 3,\n};\n\nROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [0, 0, 1],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [1, 0, 0],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = {\n\ttargetAxis: [1, 0, 0],\n\tmeshPoint: [0, 0, 1],\n};\n\nfunction getRotationDelta(prevQ, curQ, rotateKind) {\n\tconst targetAxis = vec3.fromValues(\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[0],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[1],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[2]\n\t);\n\tconst meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint;\n\n\tconst prevQuaternion = quat.clone(prevQ);\n\tconst curQuaternion = quat.clone(curQ);\n\n\tquat.normalize(prevQuaternion, prevQuaternion);\n\tquat.normalize(curQuaternion, curQuaternion);\n\n\tlet prevPoint = vec3.fromValues(0, 0, 1);\n\tlet curPoint = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\tvec3.transformQuat(targetAxis, targetAxis, curQuaternion);\n\n\tconst rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint));\n\tconst rotateDirection = rotateDistance > 0 ? 1 : -1;\n\n\t// when counter clock wise, use vec3.fromValues(0,1,0)\n\t// when clock wise, use vec3.fromValues(0,-1,0)\n\t// const meshPoint1 = vec3.fromValues(0, 0, 0);\n\tconst meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\n\tlet meshPoint3;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tmeshPoint3 = vec3.fromValues(0, rotateDirection, 0);\n\t} else {\n\t\tmeshPoint3 = vec3.fromValues(rotateDirection, 0, 0);\n\t}\n\n\tvec3.transformQuat(meshPoint2, meshPoint2, curQuaternion);\n\tvec3.transformQuat(meshPoint3, meshPoint3, curQuaternion);\n\n\tconst vecU = meshPoint2;\n\tconst vecV = meshPoint3;\n\tconst vecN = vec3.create();\n\n\tvec3.cross(vecN, vecU, vecV);\n\tvec3.normalize(vecN, vecN);\n\n\tconst coefficientA = vecN[0];\n\tconst coefficientB = vecN[1];\n\tconst coefficientC = vecN[2];\n//\tconst coefficientD = -1 * vec3.dot(vecN, meshPoint1);\n\n\t// a point on the plane\n\tcurPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\n\t// a point should project on the plane\n\tprevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\n\t// distance between prevPoint and the plane\n\tlet distance = Math.abs(\n\t\tprevPoint[0] * coefficientA +\n\t\tprevPoint[1] * coefficientB +\n\t\tprevPoint[2] * coefficientC\n\t);\n\n\tconst projectedPrevPoint = vec3.create();\n\n\tvec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance));\n\n\tlet trigonometricRatio =\n\t\t(projectedPrevPoint[0] * curPoint[0] +\n\t\tprojectedPrevPoint[1] * curPoint[1] +\n\t\tprojectedPrevPoint[2] * curPoint[2]) /\n\t\t(vec3.length(projectedPrevPoint) * vec3.length(curPoint));\n\n\t// defensive block\n\ttrigonometricRatio > 1 && (trigonometricRatio = 1);\n\n\tconst theta = Math.acos(trigonometricRatio);\n\n\tconst crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint);\n\n\tdistance =\n\t\tcoefficientA * crossVec[0] +\n\t\tcoefficientB * crossVec[1] +\n\t\tcoefficientC * crossVec[2];\n\n\tlet thetaDirection;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tthetaDirection = distance > 0 ? 1 : -1;\n\t} else {\n\t\tthetaDirection = distance < 0 ? 1 : -1;\n\t}\n\n\tconst deltaRadian = theta * thetaDirection * rotateDirection;\n\n\treturn toDegree(deltaRadian);\n}\n\nfunction angleBetweenVec2(v1, v2) {\n\tconst det = v1[0] * v2[1] - v2[0] * v1[1];\n\tconst theta = -Math.atan2(det, vec2.dot(v1, v2));\n\treturn theta;\n}\n\nutil.yawOffsetBetween = function(viewDir, targetDir) {\n\tconst viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]);\n\tconst targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]);\n\n\tvec2.normalize(viewDirXZ, viewDirXZ);\n\tvec2.normalize(targetDirXZ, targetDirXZ);\n\n\tconst theta = -angleBetweenVec2(viewDirXZ, targetDirXZ);\n\n\treturn theta;\n}\n\nutil.toDegree = toDegree;\nutil.getRotationDelta = getRotationDelta;\nutil.angleBetweenVec2 = angleBetweenVec2;\n\nexport {\n\tutil,\n\tROTATE_CONSTANT,\n};\n","import {\n\tutil as mathUtil,\n\tROTATE_CONSTANT,\n} from \"../utils/math-util\";\n\nexport function toAxis(source, offset) {\n\treturn offset.reduce((acc, v, i) => {\n\t\tif (source[i]) {\n\t\t\tacc[source[i]] = v;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(mathUtil.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nexport function getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n","/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar MathUtil = window.MathUtil || {};\n\nMathUtil.degToRad = Math.PI / 180;\nMathUtil.radToDeg = 180 / Math.PI;\n\n// Some minimal math functionality borrowed from THREE.Math and stripped down\n// for the purposes of this library.\n\n\nMathUtil.Vector2 = function ( x, y ) {\n this.x = x || 0;\n this.y = y || 0;\n};\n\nMathUtil.Vector2.prototype = {\n constructor: MathUtil.Vector2,\n\n set: function ( x, y ) {\n this.x = x;\n this.y = y;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n\n return this;\n },\n\n subVectors: function ( a, b ) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n\n return this;\n },\n};\n\nMathUtil.Vector3 = function ( x, y, z ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n};\n\nMathUtil.Vector3.prototype = {\n constructor: MathUtil.Vector3,\n\n set: function ( x, y, z ) {\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n\n return this;\n },\n\n length: function () {\n return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n },\n\n normalize: function () {\n var scalar = this.length();\n\n if ( scalar !== 0 ) {\n var invScalar = 1 / scalar;\n\n this.multiplyScalar(invScalar);\n } else {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return this;\n },\n\n multiplyScalar: function ( scalar ) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n },\n\n applyQuaternion: function ( q ) {\n var x = this.x;\n var y = this.y;\n var z = this.z;\n\n var qx = q.x;\n var qy = q.y;\n var qz = q.z;\n var qw = q.w;\n\n // calculate quat * vector\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = - qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n return this;\n },\n\n dot: function ( v ) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n },\n\n crossVectors: function ( a, b ) {\n var ax = a.x, ay = a.y, az = a.z;\n var bx = b.x, by = b.y, bz = b.z;\n\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n\n return this;\n },\n};\n\nMathUtil.Quaternion = function ( x, y, z, w ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = ( w !== undefined ) ? w : 1;\n};\n\nMathUtil.Quaternion.prototype = {\n constructor: MathUtil.Quaternion,\n\n set: function ( x, y, z, w ) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n\n return this;\n },\n\n copy: function ( quaternion ) {\n this.x = quaternion.x;\n this.y = quaternion.y;\n this.z = quaternion.z;\n this.w = quaternion.w;\n\n return this;\n },\n\n setFromEulerXYZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n\n return this;\n },\n\n setFromEulerYXZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n\n return this;\n },\n\n setFromAxisAngle: function ( axis, angle ) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n\n var halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n this.x = axis.x * s;\n this.y = axis.y * s;\n this.z = axis.z * s;\n this.w = Math.cos( halfAngle );\n\n return this;\n },\n\n multiply: function ( q ) {\n return this.multiplyQuaternions( this, q );\n },\n\n multiplyQuaternions: function ( a, b ) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;\n var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;\n\n this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n return this;\n },\n\n inverse: function () {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n\n this.normalize();\n\n return this;\n },\n\n normalize: function () {\n var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n if ( l === 0 ) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 1;\n } else {\n l = 1 / l;\n\n this.x = this.x * l;\n this.y = this.y * l;\n this.z = this.z * l;\n this.w = this.w * l;\n }\n\n return this;\n },\n\n slerp: function ( qb, t ) {\n if ( t === 0 ) return this;\n if ( t === 1 ) return this.copy( qb );\n\n var x = this.x, y = this.y, z = this.z, w = this.w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z;\n\n if ( cosHalfTheta < 0 ) {\n this.w = - qb.w;\n this.x = - qb.x;\n this.y = - qb.y;\n this.z = - qb.z;\n\n cosHalfTheta = - cosHalfTheta;\n } else {\n this.copy( qb );\n }\n\n if ( cosHalfTheta >= 1.0 ) {\n this.w = w;\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n var halfTheta = Math.acos( cosHalfTheta );\n var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\n\n if ( Math.abs( sinHalfTheta ) < 0.001 ) {\n this.w = 0.5 * ( w + this.w );\n this.x = 0.5 * ( x + this.x );\n this.y = 0.5 * ( y + this.y );\n this.z = 0.5 * ( z + this.z );\n\n return this;\n }\n\n var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n this.w = ( w * ratioA + this.w * ratioB );\n this.x = ( x * ratioA + this.x * ratioB );\n this.y = ( y * ratioA + this.y * ratioB );\n this.z = ( z * ratioA + this.z * ratioB );\n\n return this;\n },\n\n setFromUnitVectors: function () {\n // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\n // assumes direction vectors vFrom and vTo are normalized\n\n var v1, r;\n var EPS = 0.000001;\n\n return function ( vFrom, vTo ) {\n if ( v1 === undefined ) v1 = new MathUtil.Vector3();\n\n r = vFrom.dot( vTo ) + 1;\n\n if ( r < EPS ) {\n r = 0;\n\n if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n v1.set( - vFrom.y, vFrom.x, 0 );\n } else {\n v1.set( 0, - vFrom.z, vFrom.y );\n }\n } else {\n v1.crossVectors( vFrom, vTo );\n }\n\n this.x = v1.x;\n this.y = v1.y;\n this.z = v1.z;\n this.w = r;\n\n this.normalize();\n\n return this;\n }\n }(),\n};\n\nmodule.exports = MathUtil;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Util = window.Util || {};\n\nUtil.MIN_TIMESTEP = 0.001;\nUtil.MAX_TIMESTEP = 1;\n\nUtil.base64 = function(mimeType, base64) {\n return 'data:' + mimeType + ';base64,' + base64;\n};\n\nUtil.clamp = function(value, min, max) {\n return Math.min(Math.max(min, value), max);\n};\n\nUtil.lerp = function(a, b, t) {\n return a + ((b - a) * t);\n};\n\n/**\n * Light polyfill for `Promise.race`. Returns\n * a promise that resolves when the first promise\n * provided resolves.\n *\n * @param {Array} promises\n */\nUtil.race = function(promises) {\n if (Promise.race) {\n return Promise.race(promises);\n }\n\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < promises.length; i++) {\n promises[i].then(resolve, reject);\n }\n });\n};\n\nUtil.isIOS = (function() {\n var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);\n return function() {\n return isIOS;\n };\n})();\n\nUtil.isWebViewAndroid = (function() {\n var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1 &&\n navigator.userAgent.indexOf('Chrome') !== -1;\n return function() {\n return isWebViewAndroid;\n };\n})();\n\nUtil.isSafari = (function() {\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n return function() {\n return isSafari;\n };\n})();\n\nUtil.isFirefoxAndroid = (function() {\n var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1;\n return function() {\n return isFirefoxAndroid;\n };\n})();\n\nUtil.isR7 = (function() {\n var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1;\n return function() {\n return isR7;\n };\n})();\n\nUtil.isLandscapeMode = function() {\n var rtn = (window.orientation == 90 || window.orientation == -90);\n return Util.isR7() ? !rtn : rtn;\n};\n\n// Helper method to validate the time steps of sensor timestamps.\nUtil.isTimestampDeltaValid = function(timestampDeltaS) {\n if (isNaN(timestampDeltaS)) {\n return false;\n }\n if (timestampDeltaS <= Util.MIN_TIMESTEP) {\n return false;\n }\n if (timestampDeltaS > Util.MAX_TIMESTEP) {\n return false;\n }\n return true;\n};\n\nUtil.getScreenWidth = function() {\n return Math.max(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.getScreenHeight = function() {\n return Math.min(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.requestFullscreen = function(element) {\n if (Util.isWebViewAndroid()) {\n return false;\n }\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.exitFullscreen = function() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.getFullscreenElement = function() {\n return document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullScreenElement ||\n document.msFullscreenElement;\n};\n\nUtil.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) {\n // No error checking for brevity.\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n for (var attribName in attribLocationMap)\n gl.bindAttribLocation(program, attribLocationMap[attribName], attribName);\n\n gl.linkProgram(program);\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n};\n\nUtil.getProgramUniforms = function(gl, program) {\n var uniforms = {};\n var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n var uniformName = '';\n for (var i = 0; i < uniformCount; i++) {\n var uniformInfo = gl.getActiveUniform(program, i);\n uniformName = uniformInfo.name.replace('[0]', '');\n uniforms[uniformName] = gl.getUniformLocation(program, uniformName);\n }\n return uniforms;\n};\n\nUtil.orthoMatrix = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\nUtil.copyArray = function (source, dest) {\n for (var i = 0, n = source.length; i < n; i++) {\n dest[i] = source[i];\n }\n};\n\nUtil.isMobile = function() {\n var check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);\n return check;\n};\n\nUtil.extend = function(dest, src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n\n return dest;\n}\n\nUtil.safariCssSizeWorkaround = function(canvas) {\n // TODO(smus): Remove this workaround when Safari for iOS is fixed.\n // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556).\n //\n // \"To the last I grapple with thee;\n // from hell's heart I stab at thee;\n // for hate's sake I spit my last breath at thee.\"\n // -- Moby Dick, by Herman Melville\n if (Util.isIOS()) {\n var width = canvas.style.width;\n var height = canvas.style.height;\n canvas.style.width = (parseInt(width) + 1) + 'px';\n canvas.style.height = (parseInt(height)) + 'px';\n setTimeout(function() {\n canvas.style.width = width;\n canvas.style.height = height;\n }, 100);\n }\n\n // Debug only.\n window.Util = Util;\n window.canvas = canvas;\n};\n\nUtil.isDebug = function() {\n return Util.getQueryParameter('debug');\n};\n\nUtil.getQueryParameter = function(name) {\n var name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n results = regex.exec(location.search);\n return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n};\n\nUtil.frameDataFromPose = (function() {\n var piOver180 = Math.PI / 180.0;\n var rad45 = Math.PI * 0.25;\n\n // Borrowed from glMatrix.\n function mat4_perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45),\n downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45),\n leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45),\n rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n\n function mat4_fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n };\n\n function mat4_translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n };\n\n function mat4_invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n };\n\n var defaultOrientation = new Float32Array([0, 0, 0, 1]);\n var defaultPosition = new Float32Array([0, 0, 0]);\n\n function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) {\n mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar);\n\n var orientation = pose.orientation || defaultOrientation;\n var position = pose.position || defaultPosition;\n\n mat4_fromRotationTranslation(view, orientation, position);\n if (parameters)\n mat4_translate(view, view, parameters.offset);\n mat4_invert(view, view);\n }\n\n return function(frameData, pose, vrDisplay) {\n if (!frameData || !pose)\n return false;\n\n frameData.pose = pose;\n frameData.timestamp = pose.timestamp;\n\n updateEyeMatrices(\n frameData.leftProjectionMatrix, frameData.leftViewMatrix,\n pose, vrDisplay.getEyeParameters(\"left\"), vrDisplay);\n updateEyeMatrices(\n frameData.rightProjectionMatrix, frameData.rightViewMatrix,\n pose, vrDisplay.getEyeParameters(\"right\"), vrDisplay);\n\n return true;\n };\n})();\n\nUtil.isInsideCrossDomainIFrame = function() {\n var isFramed = (window.self !== window.top);\n var refDomain = Util.getDomainFromUrl(document.referrer);\n var thisDomain = Util.getDomainFromUrl(window.location.href);\n\n return isFramed && (refDomain !== thisDomain);\n};\n\n// From http://stackoverflow.com/a/23945027.\nUtil.getDomainFromUrl = function(url) {\n var domain;\n // Find & remove protocol (http, ftp, etc.) and get domain.\n if (url.indexOf(\"://\") > -1) {\n domain = url.split('/')[2];\n }\n else {\n domain = url.split('/')[0];\n }\n\n //find & remove port number\n domain = domain.split(':')[0];\n\n return domain;\n}\n\nmodule.exports = Util;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar MathUtil = require('../math-util');\nvar Util = require('../util');\n\n/**\n * Given an orientation and the gyroscope data, predicts the future orientation\n * of the head. This makes rendering appear faster.\n *\n * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf\n *\n * @param {Number} predictionTimeS time from head movement to the appearance of\n * the corresponding image.\n */\nfunction PosePredictor(predictionTimeS) {\n this.predictionTimeS = predictionTimeS;\n\n // The quaternion corresponding to the previous state.\n this.previousQ = new MathUtil.Quaternion();\n // Previous time a prediction occurred.\n this.previousTimestampS = null;\n\n // The delta quaternion that adjusts the current pose.\n this.deltaQ = new MathUtil.Quaternion();\n // The output quaternion.\n this.outQ = new MathUtil.Quaternion();\n}\n\nPosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) {\n if (!this.previousTimestampS) {\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n return currentQ;\n }\n\n // Calculate axis and angle based on gyroscope rotation rate data.\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n\n var angularSpeed = gyro.length();\n\n // If we're rotating slowly, don't do prediction.\n if (angularSpeed < MathUtil.degToRad * 20) {\n if (Util.isDebug()) {\n console.log('Moving slowly, at %s deg/s: no prediction',\n (MathUtil.radToDeg * angularSpeed).toFixed(1));\n }\n this.outQ.copy(currentQ);\n this.previousQ.copy(currentQ);\n return this.outQ;\n }\n\n // Get the predicted angle based on the time delta and latency.\n var deltaT = timestampS - this.previousTimestampS;\n var predictAngle = angularSpeed * this.predictionTimeS;\n\n this.deltaQ.setFromAxisAngle(axis, predictAngle);\n this.outQ.copy(this.previousQ);\n this.outQ.multiply(this.deltaQ);\n\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n\n return this.outQ;\n};\n\n\nmodule.exports = PosePredictor;\n","import {userAgent} from \"../utils/browserFeature\";\n/**\n * Returns a number value indiciating the version of Chrome being used,\n * or otherwise `null` if not on Chrome.\n *\n * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19\n */\n/**\n * In Chrome m65, `devicemotion` events are broken but subsequently fixed\n * in 65.0.3325.148. Since many browsers use Chromium, ensure that\n * we scope this detection by branch and build numbers to provide\n * a proper fallback.\n * https://github.com/immersive-web/webvr-polyfill/issues/307\n */\nlet version = -1; // It should not be null because it will be compared with number\nlet branch = null;\nlet build = null;\n\nconst match = /Chrome\\/([0-9]+)\\.(?:[0-9]*)\\.([0-9]*)\\.([0-9]*)/i.exec(userAgent);\n\nif (match) {\n\tversion = parseInt(match[1], 10);\n\tbranch = match[2];\n\tbuild = match[3];\n}\n\nconst CHROME_VERSION = version;\nconst IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === \"3325\" && parseInt(build, 10) < 148;\nconst IS_ANDROID = /Android/i.test(userAgent);\n\nconst CONTROL_MODE_VR = 1;\nconst CONTROL_MODE_YAWPITCH = 2;\n\nconst TOUCH_DIRECTION_NONE = 1;\nconst TOUCH_DIRECTION_YAW = 2;\nconst TOUCH_DIRECTION_PITCH = 4;\nconst TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH;\n\n/* Const for MovableCoord */\nconst MC_DECELERATION = 0.0014;\nconst MC_MAXIMUM_DURATION = 1000;\nconst MC_BIND_SCALE = [0.20, 0.20];\n\nconst MIN_FIELD_OF_VIEW = 20;\nconst MAX_FIELD_OF_VIEW = 110;\nconst PAN_SCALE = 320;\n\n// const DELTA_THRESHOLD = 0.015;\n// const DELTA_THRESHOLD = 0.09; // Note4\n// const DELTA_THRESHOLD = 0.0825;\n// const DELTA_THRESHOLD = 0.075;\n// const DELTA_THRESHOLD = 0.06;\n// const DELTA_THRESHOLD = 0.045;\nconst DELTA_THRESHOLD = 0.0375; // Note2\n\nconst YAW_RANGE_HALF = 180;\nconst PITCH_RANGE_HALF = 90;\nconst CIRCULAR_PITCH_RANGE_HALF = 180;\nconst PINCH_EVENTS = \"pinchstart pinchmove pinchend\";\n\nconst KEYMAP = {\n\tLEFT_ARROW: 37,\n\tA: 65,\n\tUP_ARROW: 38,\n\tW: 87,\n\tRIGHT_ARROW: 39,\n\tD: 68,\n\tDOWN_ARROW: 40,\n\tS: 83,\n};\n\nconst GYRO_MODE = {\n\tNONE: \"none\",\n\tYAWPITCH: \"yawPitch\",\n\tVR: \"VR\"\n};\n\nexport {\n\tGYRO_MODE,\n\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\n\tTOUCH_DIRECTION_NONE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMIN_FIELD_OF_VIEW,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tDELTA_THRESHOLD,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tPINCH_EVENTS,\n\tKEYMAP,\n\n\tCHROME_VERSION,\n\tIS_CHROME_WITHOUT_DEVICE_MOTION,\n\tIS_ANDROID\n};\n","import Component from \"@egjs/component\";\nimport {vec3} from \"gl-matrix\";\nimport {window} from \"../../utils/browser\";\nimport {IS_CHROME_WITHOUT_DEVICE_MOTION, IS_ANDROID} from \"../consts\";\n\nconst STILLNESS_THRESHOLD = 200; // millisecond\n\nexport default class DeviceMotion extends Component {\n\tconstructor() {\n\t\tsuper();\n\t\tthis._onDeviceMotion = this._onDeviceMotion.bind(this);\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onChromeWithoutDeviceMotion = this._onChromeWithoutDeviceMotion.bind(this);\n\n\t\tthis.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION;\n\t\tthis.isAndroid = IS_ANDROID;\n\n\t\tthis.stillGyroVec = vec3.create();\n\t\tthis.rawGyroVec = vec3.create();\n\t\tthis.adjustedGyroVec = vec3.create();\n\n\t\tthis._timer = null;\n\n\t\tthis.lastDevicemotionTimestamp = 0;\n\t\tthis._isEnabled = false;\n\t\tthis.enable();\n\t}\n\t_onChromeWithoutDeviceMotion(e) {\n\t\tlet {alpha, beta, gamma} = e;\n\n\t\t// There is deviceorientation event trigged with empty values\n\t\t// on Headless Chrome.\n\t\tif (alpha === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// convert to radian\n\t\talpha = (alpha || 0) * Math.PI / 180;\n\t\tbeta = (beta || 0) * Math.PI / 180;\n\t\tgamma = (gamma || 0) * Math.PI / 180;\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: {\n\t\t\t\tdeviceorientation: {\n\t\t\t\t\talpha,\n\t\t\t\t\tbeta,\n\t\t\t\t\tgamma: -gamma\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t_onDeviceOrientation() {\n\t\tthis._timer && clearTimeout(this._timer);\n\t\tthis._timer = setTimeout(() => {\n\t\t\tif ((new Date().getTime() - this.lastDevicemotionTimestamp) < STILLNESS_THRESHOLD) {\n\t\t\t\tvec3.copy(this.stillGyroVec, this.rawGyroVec);\n\t\t\t}\n\t\t}, STILLNESS_THRESHOLD);\n\t}\n\t_onDeviceMotion(e) {\n\t\t// desktop chrome triggers devicemotion event with empthy sensor values.\n\t\t// Those events should ignored.\n\t\tconst isGyroSensorAvailable = !(e.rotationRate.alpha == null);\n\t\tconst isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null);\n\n\t\tif (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst devicemotionEvent = Object.assign({}, e);\n\n\t\tdevicemotionEvent.interval = e.interval;\n\t\tdevicemotionEvent.timeStamp = e.timeStamp;\n\t\tdevicemotionEvent.type = e.type;\n\t\tdevicemotionEvent.rotationRate = {\n\t\t\talpha: e.rotationRate.alpha,\n\t\t\tbeta: e.rotationRate.beta,\n\t\t\tgamma: e.rotationRate.gamma,\n\t\t};\n\t\tdevicemotionEvent.accelerationIncludingGravity = {\n\t\t\tx: e.accelerationIncludingGravity.x,\n\t\t\ty: e.accelerationIncludingGravity.y,\n\t\t\tz: e.accelerationIncludingGravity.z,\n\t\t};\n\t\tdevicemotionEvent.acceleration = {\n\t\t\tx: e.acceleration.x,\n\t\t\ty: e.acceleration.y,\n\t\t\tz: e.acceleration.z,\n\t\t};\n\n\t\tif (this.isAndroid) {\n\t\t\tvec3.set(\n\t\t\t\tthis.rawGyroVec,\n\t\t\t\te.rotationRate.alpha || 0,\n\t\t\t\te.rotationRate.beta || 0,\n\t\t\t\te.rotationRate.gamma || 0);\n\t\t\tvec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec);\n\t\t\tthis.lastDevicemotionTimestamp = new Date().getTime();\n\n\t\t\tdevicemotionEvent.adjustedRotationRate = {\n\t\t\t\talpha: this.adjustedGyroVec[0],\n\t\t\t\tbeta: this.adjustedGyroVec[1],\n\t\t\t\tgamma: this.adjustedGyroVec[2]};\n\t\t}\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: devicemotionEvent\n\t\t});\n\t}\n\tenable() {\n\t\tif (this.isAndroid) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\t}\n\t\tif (this.isWithoutDeviceMotion) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\t} else {\n\t\t\twindow.addEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\t}\n\t\tthis._isEnabled = true;\n\t}\n\tdisable() {\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\twindow.removeEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\tthis._isEnabled = false;\n\t}\n}\n","function SensorSample(sample, timestampS) {\n this.set(sample, timestampS);\n};\n\nSensorSample.prototype.set = function(sample, timestampS) {\n this.sample = sample;\n this.timestampS = timestampS;\n};\n\nSensorSample.prototype.copy = function(sensorSample) {\n this.set(sensorSample.sample, sensorSample.timestampS);\n};\n\nmodule.exports = SensorSample;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar SensorSample = require('./sensor-sample.js');\nvar MathUtil = require('../math-util.js');\nvar Util = require('../util.js');\n\n/**\n * An implementation of a simple complementary filter, which fuses gyroscope and\n * accelerometer data from the 'devicemotion' event.\n *\n * Accelerometer data is very noisy, but stable over the long term.\n * Gyroscope data is smooth, but tends to drift over the long term.\n *\n * This fusion is relatively simple:\n * 1. Get orientation estimates from accelerometer by applying a low-pass filter\n * on that data.\n * 2. Get orientation estimates from gyroscope by integrating over time.\n * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the\n * short term.\n */\nfunction ComplementaryFilter(kFilter) {\n this.kFilter = kFilter;\n\n // Raw sensor measurements.\n this.currentAccelMeasurement = new SensorSample();\n this.currentGyroMeasurement = new SensorSample();\n this.previousGyroMeasurement = new SensorSample();\n\n // Set default look direction to be in the correct direction.\n if (Util.isIOS()) {\n this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1);\n } else {\n this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1);\n }\n this.previousFilterQ = new MathUtil.Quaternion();\n this.previousFilterQ.copy(this.filterQ);\n\n // Orientation based on the accelerometer.\n this.accelQ = new MathUtil.Quaternion();\n // Whether or not the orientation has been initialized.\n this.isOrientationInitialized = false;\n // Running estimate of gravity based on the current orientation.\n this.estimatedGravity = new MathUtil.Vector3();\n // Measured gravity based on accelerometer.\n this.measuredGravity = new MathUtil.Vector3();\n\n // Debug only quaternion of gyro-based orientation.\n this.gyroIntegralQ = new MathUtil.Quaternion();\n}\n\nComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) {\n this.currentAccelMeasurement.set(vector, timestampS);\n};\n\nComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {\n this.currentGyroMeasurement.set(vector, timestampS);\n\n var deltaT = timestampS - this.previousGyroMeasurement.timestampS;\n if (Util.isTimestampDeltaValid(deltaT)) {\n this.run_();\n }\n\n this.previousGyroMeasurement.copy(this.currentGyroMeasurement);\n};\n\nComplementaryFilter.prototype.run_ = function() {\n\n if (!this.isOrientationInitialized) {\n this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n this.previousFilterQ.copy(this.accelQ);\n this.isOrientationInitialized = true;\n return;\n }\n\n var deltaT = this.currentGyroMeasurement.timestampS -\n this.previousGyroMeasurement.timestampS;\n\n // Convert gyro rotation vector to a quaternion delta.\n var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n this.gyroIntegralQ.multiply(gyroDeltaQ);\n\n // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n this.filterQ.copy(this.previousFilterQ);\n this.filterQ.multiply(gyroDeltaQ);\n\n // Calculate the delta between the current estimated gravity and the real\n // gravity vector from accelerometer.\n var invFilterQ = new MathUtil.Quaternion();\n invFilterQ.copy(this.filterQ);\n invFilterQ.inverse();\n\n this.estimatedGravity.set(0, 0, -1);\n this.estimatedGravity.applyQuaternion(invFilterQ);\n this.estimatedGravity.normalize();\n\n this.measuredGravity.copy(this.currentAccelMeasurement.sample);\n this.measuredGravity.normalize();\n\n // Compare estimated gravity with measured gravity, get the delta quaternion\n // between the two.\n var deltaQ = new MathUtil.Quaternion();\n deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n deltaQ.inverse();\n\n if (Util.isDebug()) {\n console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)',\n MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ),\n (this.estimatedGravity.x).toFixed(1),\n (this.estimatedGravity.y).toFixed(1),\n (this.estimatedGravity.z).toFixed(1),\n (this.measuredGravity.x).toFixed(1),\n (this.measuredGravity.y).toFixed(1),\n (this.measuredGravity.z).toFixed(1));\n }\n\n // Calculate the SLERP target: current orientation plus the measured-estimated\n // quaternion delta.\n var targetQ = new MathUtil.Quaternion();\n targetQ.copy(this.filterQ);\n targetQ.multiply(deltaQ);\n\n // SLERP factor: 0 is pure gyro, 1 is pure accel.\n this.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n this.previousFilterQ.copy(this.filterQ);\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n return this.filterQ;\n};\n\nComplementaryFilter.prototype.accelToQuaternion_ = function(accel) {\n var normAccel = new MathUtil.Vector3();\n normAccel.copy(accel);\n normAccel.normalize();\n var quat = new MathUtil.Quaternion();\n quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel);\n quat.inverse();\n return quat;\n};\n\nComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) {\n // Extract axis and angle from the gyroscope data.\n var quat = new MathUtil.Quaternion();\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n quat.setFromAxisAngle(axis, gyro.length() * dt);\n return quat;\n};\n\n\nmodule.exports = ComplementaryFilter;\n","import MathUtil from \"webvr-polyfill/src/math-util\";\nimport ComplementaryFilter from \"webvr-polyfill/src/sensor-fusion/complementary-filter\";\n\nComplementaryFilter.prototype.run_ = function() {\n\tif (!this.isOrientationInitialized) {\n\t\tthis.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n\t\tthis.previousFilterQ.copy(this.accelQ);\n\t\tthis.isOrientationInitialized = true;\n\t\treturn;\n\t}\n\n\tconst deltaT = this.currentGyroMeasurement.timestampS -\n\tthis.previousGyroMeasurement.timestampS;\n\n\t// Convert gyro rotation vector to a quaternion delta.\n\tconst gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n\n\tthis.gyroIntegralQ.multiply(gyroDeltaQ);\n\n\t// filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n\tthis.filterQ.copy(this.previousFilterQ);\n\tthis.filterQ.multiply(gyroDeltaQ);\n\n\t// Calculate the delta between the current estimated gravity and the real\n\t// gravity vector from accelerometer.\n\tconst invFilterQ = new MathUtil.Quaternion();\n\n\tinvFilterQ.copy(this.filterQ);\n\tinvFilterQ.inverse();\n\n\tthis.estimatedGravity.set(0, 0, -1);\n\tthis.estimatedGravity.applyQuaternion(invFilterQ);\n\tthis.estimatedGravity.normalize();\n\n\tthis.measuredGravity.copy(this.currentAccelMeasurement.sample);\n\tthis.measuredGravity.normalize();\n\n\t// Compare estimated gravity with measured gravity, get the delta quaternion\n\t// between the two.\n\tconst deltaQ = new MathUtil.Quaternion();\n\n\tdeltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n\tdeltaQ.inverse();\n\n\t// Calculate the SLERP target: current orientation plus the measured-estimated\n\t// quaternion delta.\n\tconst targetQ = new MathUtil.Quaternion();\n\n\ttargetQ.copy(this.filterQ);\n\ttargetQ.multiply(deltaQ);\n\n\t// SLERP factor: 0 is pure gyro, 1 is pure accel.\n\tthis.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n\tthis.previousFilterQ.copy(this.filterQ);\n\n\tif (!this.isFilterQuaternionInitialized) {\n\t\tthis.isFilterQuaternionInitialized = true;\n\t}\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n\tif (this.isFilterQuaternionInitialized) {\n\t\treturn this.filterQ;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexport default ComplementaryFilter;\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport PosePredictor from \"webvr-polyfill/src/sensor-fusion/pose-predictor\";\nimport MathUtil from \"webvr-polyfill/src/math-util\";\nimport Util from \"webvr-polyfill/src/util\";\nimport {window, IS_IOS, IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\nimport DeviceMotion from \"./DeviceMotion\";\nimport ComplementaryFilter from \"./ComplementaryFilter\";\nimport {CHROME_VERSION} from \"../consts\";\n\nconst K_FILTER = 0.98;\nconst PREDICTION_TIME_S = 0.040;\n\nexport default class FusionPoseSensor extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.deviceMotion = new DeviceMotion();\n\n\t\tthis.accelerometer = new MathUtil.Vector3();\n\t\tthis.gyroscope = new MathUtil.Vector3();\n\n\t\tthis._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);\n\t\tthis._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);\n\n\t\tthis.filter = new ComplementaryFilter(K_FILTER);\n\t\tthis.posePredictor = new PosePredictor(PREDICTION_TIME_S);\n\n\t\tthis.filterToWorldQ = new MathUtil.Quaternion();\n\n\t\tthis.isFirefoxAndroid = Util.isFirefoxAndroid();\n\t\t// This includes iPhone & iPad(both desktop and mobile mode) ref #326\n\t\tthis.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP;\n\n\t\t// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18\n\t\tthis.isChromeUsingDegrees = CHROME_VERSION >= 66;\n\n\t\tthis._isEnabled = false;\n\n\t\t// Set the filter to world transform, depending on OS.\n\t\tif (this.isIOS) {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);\n\t\t} else {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);\n\t\t}\n\n\t\tthis.inverseWorldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.worldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1),\n\t\t\t-window.orientation * Math.PI / 180);\n\n\t\tthis._setScreenTransform();\n\t\t// Adjust this filter for being in landscape mode.\n\t\tif (Util.isLandscapeMode()) {\n\t\t\tthis.filterToWorldQ.multiply(this.inverseWorldToScreenQ);\n\t\t}\n\n\t\t// Keep track of a reset transform for resetSensor.\n\t\tthis.resetQ = new MathUtil.Quaternion();\n\n\t\tthis.deviceMotion.on(\"devicemotion\", this._onDeviceMotionChange);\n\t\tthis.enable();\n\t}\n\tenable() {\n\t\tif (this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.enable();\n\t\tthis._isEnabled = true;\n\t\twindow.addEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tdisable() {\n\t\tif (!this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.disable();\n\t\tthis._isEnabled = false;\n\t\twindow.removeEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tisEnabled() {\n\t\treturn this._isEnabled;\n\t}\n\tdestroy() {\n\t\tthis.disable();\n\t\tthis.deviceMotion = null;\n\t}\n\t_triggerChange() {\n\t\tconst orientation = this.getOrientation();\n\n\t\t// if orientation is not prepared. don't trigger change event\n\t\tif (!orientation) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._prevOrientation) {\n\t\t\tthis._prevOrientation = orientation;\n\t\t\treturn;\n\t\t}\n\n\t\tif (quat.equals(this._prevOrientation, orientation)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.trigger(\"change\", {quaternion: orientation});\n\t}\n\tgetOrientation() {\n\t\tlet orientation;\n\n\t\t// Hack around using deviceorientation instead of devicemotion\n\t\tif (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) {\n\t\t\tthis.deviceOrientationFixQ = this.deviceOrientationFixQ || (() => {\n\t\t\t\tconst y = new MathUtil.Quaternion()\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -this._alpha);\n\n\t\t\t\treturn y;\n\t\t\t})();\n\n\t\t\torientation = this._deviceOrientationQ;\n\t\t\tconst out = new MathUtil.Quaternion();\n\n\t\t\tout.copy(orientation);\n\t\t\tout.multiply(this.filterToWorldQ);\n\t\t\tout.multiply(this.resetQ);\n\t\t\tout.multiply(this.worldToScreenQ);\n\t\t\tout.multiplyQuaternions(this.deviceOrientationFixQ, out);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t} else {\n\t\t\t// Convert from filter space to the the same system used by the\n\t\t\t// deviceorientation event.\n\t\t\torientation = this.filter.getOrientation();\n\n\t\t\tif (!orientation) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst out = this._convertFusionToPredicted(orientation);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t}\n\t}\n\t_convertFusionToPredicted(orientation) {\n\t\t// Predict orientation.\n\t\tthis.predictedQ =\n\t\t\tthis.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS);\n\n\t\t// Convert to THREE coordinate system: -Z forward, Y up, X right.\n\t\tconst out = new MathUtil.Quaternion();\n\n\t\tout.copy(this.filterToWorldQ);\n\t\tout.multiply(this.resetQ);\n\t\tout.multiply(this.predictedQ);\n\t\tout.multiply(this.worldToScreenQ);\n\n\t\treturn out;\n\t}\n\t_onDeviceMotionChange({inputEvent}) {\n\t\tconst deviceorientation = inputEvent.deviceorientation;\n\t\tconst deviceMotion = inputEvent;\n\t\tconst accGravity = deviceMotion.accelerationIncludingGravity;\n\t\tconst rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate;\n\t\tlet timestampS = deviceMotion.timeStamp / 1000;\n\n\t\tif (deviceorientation) {\n\t\t\tif (!this._alpha) {\n\t\t\t\tthis._alpha = deviceorientation.alpha;\n\t\t\t}\n\t\t\tthis._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion();\n\t\t\tthis._deviceOrientationQ.setFromEulerYXZ(\n\t\t\t\tdeviceorientation.beta,\n\t\t\t\tdeviceorientation.alpha,\n\t\t\t\tdeviceorientation.gamma\n\t\t\t);\n\n\t\t\tthis._triggerChange();\n\t\t} else {\n\t\t\t// Firefox Android timeStamp returns one thousandth of a millisecond.\n\t\t\tif (this.isFirefoxAndroid) {\n\t\t\t\ttimestampS /= 1000;\n\t\t\t}\n\n\t\t\tthis.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z);\n\t\t\tthis.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma);\n\n\t\t\t// Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate`\n\t\t\t// is reported in degrees, so we first convert to radians.\n\t\t\tif (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) {\n\t\t\t\tthis.gyroscope.multiplyScalar(Math.PI / 180);\n\t\t\t}\n\n\t\t\tthis.filter.addAccelMeasurement(this.accelerometer, timestampS);\n\t\t\tthis.filter.addGyroMeasurement(this.gyroscope, timestampS);\n\n\t\t\tthis._triggerChange();\n\n\t\t\tthis.previousTimestampS = timestampS;\n\t\t}\n\t}\n\t_onScreenOrientationChange(screenOrientation) {\n\t\tthis._setScreenTransform(window.orientation);\n\t}\n\t_setScreenTransform() {\n\t\tthis.worldToScreenQ.set(0, 0, 0, 1);\n\n\t\tconst orientation = window.orientation;\n\n\t\tswitch (orientation) {\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tcase 90:\n\t\t\tcase -90:\n\t\t\tcase 180:\n\t\t\t\tthis.worldToScreenQ\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.inverseWorldToScreenQ.copy(this.worldToScreenQ);\n\t\tthis.inverseWorldToScreenQ.inverse();\n\t}\n}\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport {toAxis} from \"../utils\";\nimport FusionPoseSensor from \"./FusionPoseSensor\";\nimport {util, ROTATE_CONSTANT} from \"../../utils/math-util\";\n\nfunction getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(util.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nfunction getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n\nexport default class TiltMotionInput extends Component {\n\tconstructor(el, options) {\n\t\tsuper();\n\t\tthis.element = el;\n\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\n\t\tthis.fusionPoseSensor = null;\n\n\t\tthis.options = Object.assign({\n\t\t\tscale: 1,\n\t\t\tthreshold: 0,\n\t\t}, options);\n\n\t\tthis._onPoseChange = this._onPoseChange.bind(this);\n\t}\n\tmapAxes(axes) {\n\t\tthis.axes = axes;\n\t}\n\tconnect(observer) {\n\t\tif (this.observer) {\n\t\t\treturn this;\n\t\t}\n\t\tthis.observer = observer;\n\t\tthis.fusionPoseSensor = new FusionPoseSensor();\n\t\tthis.fusionPoseSensor.enable();\n\t\tthis._attachEvent();\n\t\treturn this;\n\t}\n\tdisconnect() {\n\t\tif (!this.observer) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._dettachEvent();\n\t\tthis.fusionPoseSensor.disable();\n\t\tthis.fusionPoseSensor.destroy();\n\t\tthis.fusionPoseSensor = null;\n\t\tthis.observer = null;\n\t\treturn this;\n\t}\n\tdestroy() {\n\t\tthis.disconnect();\n\t\tthis.element = null;\n\t\tthis.options = null;\n\t\tthis.axes = null;\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\t}\n\t_onPoseChange(event) {\n\t\tif (!this._prevQuaternion) {\n\t\t\tthis._prevQuaternion = quat.clone(event.quaternion);\n\t\t\tthis._quaternion = quat.clone(event.quaternion);\n\t\t\treturn;\n\t\t}\n\n\t\tquat.copy(this._prevQuaternion, this._quaternion);\n\t\tquat.copy(this._quaternion, event.quaternion);\n\n\t\tthis.observer.change(this, event, toAxis(this.axes, [\n\t\t\tgetDeltaYaw(this._prevQuaternion, this._quaternion),\n\t\t\tgetDeltaPitch(this._prevQuaternion, this._quaternion)\n\t\t]));\n\t}\n\t_attachEvent() {\n\t\tthis.fusionPoseSensor.on(\"change\", this._onPoseChange);\n\t}\n\t_dettachEvent() {\n\t\tthis.fusionPoseSensor.off(\"change\", this._onPoseChange);\n\t}\n}\n","import {glMatrix} from \"gl-matrix\";\nimport {window} from \"../utils/browser\";\n\n// Singleton\nlet screenRotationAngleInst = null;\nlet refCount = 0;\n\nexport default class ScreenRotationAngle {\n\tconstructor() {\n\t\trefCount++;\n\n\t\tif (screenRotationAngleInst) {\n\t\t\treturn screenRotationAngleInst;\n\t\t}\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = this;\n\t\t/* eslint-enable */\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onOrientationChange = this._onOrientationChange.bind(this);\n\n\t\tthis._spinR = 0;\n\n\t\tthis._screenOrientationAngle = 0;\n\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.addEventListener(\"orientationchange\", this._onOrientationChange);\n\t}\n\n\t_onDeviceOrientation(e) {\n\t\tif (e.beta === null || e.gamma === null) {\n\t\t\t// (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it.\n\t\t\treturn;\n\t\t}\n\n\t\t// Radian\n\t\tconst betaR = glMatrix.toRadian(e.beta);\n\t\tconst gammaR = glMatrix.toRadian(e.gamma);\n\n\t\t/* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */\n\t\tthis._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR));\n\t}\n\n\t_onOrientationChange(e) {\n\t\tif (window.screen && window.screen.orientation && window.screen.orientation.angle !== undefined) {\n\t\t\tthis._screenOrientationAngle = screen.orientation.angle;\n\t\t} else if (window.orientation !== undefined) {\n\t\t\t/* iOS */\n\t\t\tthis._screenOrientationAngle = window.orientation >= 0 ?\n\t\t\t\twindow.orientation : 360 + window.orientation;\n\t\t}\n\t}\n\n\tgetRadian() {\n\t\t// Join with screen orientation\n\t\t// this._testVal = this._spinR + \", \" + this._screenOrientationAngle + \", \" + window.orientation;\n\t\treturn this._spinR + glMatrix.toRadian(this._screenOrientationAngle);\n\t}\n\n\tunref() {\n\t\tif (--refCount > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"orientationchange\", this._onOrientationChange);\n\n\t\tthis._spinR = 0;\n\t\tthis._screenOrientationAngle = 0;\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = null;\n\t\t/* eslint-enable */\n\t\trefCount = 0;\n\t}\n}\n","import Axes, {PanInput} from \"@egjs/axes\";\nimport ScreenRotationAngle from \"../ScreenRotationAngle\";\n\n/**\n * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle.\n *\n * The reason for using this function is that in VR mode,\n * the roll angle is adjusted in the direction opposite to the screen rotation angle.\n *\n * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.\n * @extends PanInput\n */\nexport default class RotationPanInput extends PanInput {\n\t/**\n\t * Constructor\n\t *\n\t * @private\n\t * @param {HTMLElement} el target element\n\t * @param {Object} [options] The option object\n\t * @param {Boolean} [options.useRotation] Whether to use rotation(or VR)\n\t */\n\tconstructor(el, options) {\n\t\tsuper(el, options);\n\n\t\tthis._useRotation = false;\n\t\tthis._screenRotationAngle = null;\n\n\t\tthis.setUseRotation(!!(options && options.useRotation));\n\n\t\tthis._userDirection = Axes.DIRECTION_ALL;\n\t}\n\n\tsetUseRotation(useRotation) {\n\t\tthis._useRotation = useRotation;\n\n\t\tif (this._screenRotationAngle) {\n\t\t\tthis._screenRotationAngle.unref();\n\t\t\tthis._screenRotationAngle = null;\n\t\t}\n\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle = new ScreenRotationAngle();\n\t\t}\n\t}\n\n\tconnect(observer) {\n\t\t// User intetened direction\n\t\tthis._userDirection = this._direction;\n\n\t\t// In VR Mode, Use ALL direction if direction is not none\n\t\t// Because horizontal and vertical is changed dynamically by screen rotation.\n\t\t// this._direction is used to initialize hammerjs\n\t\tif (this._useRotation && (this._direction & Axes.DIRECTION_ALL)) {\n\t\t\tthis._direction = Axes.DIRECTION_HORIZONTAL;\n\t\t}\n\n\t\tsuper.connect(observer);\n\t}\n\n\tgetOffset(properties, useDirection) {\n\t\tif (this._useRotation === false) {\n\t\t\treturn super.getOffset(properties, useDirection);\n\t\t}\n\n\t\tconst offset = super.getOffset(properties, [true, true]);\n\t\tconst newOffset = [0, 0];\n\n\t\tconst theta = this._screenRotationAngle.getRadian();\n\n\t\tconst cosTheta = Math.cos(theta);\n\t\tconst sinTheta = Math.sin(theta);\n\n\t\t// RotateZ\n\t\tnewOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta;\n\t\tnewOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta;\n\n\t\t// Use only user allowed direction.\n\t\tif (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) {\n\t\t\tnewOffset[0] = 0;\n\t\t} else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) {\n\t\t\tnewOffset[1] = 0;\n\t\t}\n\n\t\treturn newOffset;\n\t}\n\n\tdestroy() {\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle && this._screenRotationAngle.unref();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n\n/**\n * Override getDirectionByAngle to return DIRECTION_ALL\n * Ref: https://github.com/naver/egjs-axes/issues/99\n *\n * But we obey axes's rule. If axes's rule is problem, let's apply following code.\n */\n// PanInput.getDirectionByAngle = function (angle, thresholdAngle) {\n// \treturn DIRECTION_ALL;\n// };\n","import Component from \"@egjs/component\";\nimport {vec3, glMatrix, quat} from \"gl-matrix\";\nimport FusionPoseSensor from \"./input/FusionPoseSensor\";\n\nconst Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0);\n\nexport default class DeviceQuaternion extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._fusionPoseSensor = new FusionPoseSensor();\n\t\tthis._quaternion = quat.create();\n\n\t\tthis._fusionPoseSensor.enable();\n\t\tthis._fusionPoseSensor.on(\"change\", e => {\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis.trigger(\"change\", {isTrusted: true});\n\t\t});\n\t}\n\n\tgetCombinedQuaternion(yaw) {\n\t\tconst yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw));\n\t\tconst conj = quat.conjugate(quat.create(), this._quaternion);\n\t\t// Multiply pitch quaternion -> device quaternion -> yaw quaternion\n\t\tconst outQ = quat.multiply(quat.create(), conj, yawQ);\n\n\t\treturn outQ;\n\t}\n\n\tdestroy() {\n\t\t// detach all event handler\n\t\tthis.off();\n\n\t\tif (this._fusionPoseSensor) {\n\t\t\tthis._fusionPoseSensor.off();\n\t\t\tthis._fusionPoseSensor.destroy();\n\t\t\tthis._fusionPoseSensor = null;\n\t\t}\n\t}\n}\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport Axes, {PinchInput, MoveKeyInput, WheelInput} from \"@egjs/axes\";\nimport {vec2, glMatrix} from \"gl-matrix\";\nimport {getComputedStyle, SUPPORT_TOUCH, SUPPORT_DEVICEMOTION} from \"../utils/browserFeature\";\nimport TiltMotionInput from \"./input/TiltMotionInput\";\nimport RotationPanInput from \"./input/RotationPanInput\";\nimport DeviceQuaternion from \"./DeviceQuaternion\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {\n\tGYRO_MODE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\tTOUCH_DIRECTION_NONE,\n} from \"./consts\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF];\nconst DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF];\nconst CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF];\n\n/**\n * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates.\n *\n * @alias eg.YawPitchControl\n * @extends eg.Component\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n */\nclass YawPitchControl extends Component {\n\tstatic VERSION = VERSION;\n\t// Expose DeviceOrientationControls sub module for test purpose\n\tstatic CONTROL_MODE_VR = CONTROL_MODE_VR;\n\tstatic CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH;\n\tstatic TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL;\n\tstatic TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW;\n\tstatic TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH;\n\tstatic TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE;\n\t/**\n\t * @param {Object} options The option object of the eg.YawPitch module\n\t * @param {Element}[options.element=null] element A base element for the eg.YawPitch module\n\t * @param {Number} [options.yaw=0] initial yaw (degree)\n\t * @param {Number} [options.pitch=0] initial pitch (degree)\n\t * @param {Number} [options.fov=65] initial field of view (degree)\n\t * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown\n\t * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available\n\t * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion.\n\t * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move)\n\t * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw\n\t * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch\n\t * @param {Array} [options.fovRange=[30, 110] Range of FOV\n\t * @param {Number} [options.aspectRatio=1] Aspect Ratio\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\n\t\tconst opt = Object.assign({\n\t\t\telement: null,\n\t\t\tyaw: 0,\n\t\t\tpitch: 0,\n\t\t\tfov: 65,\n\t\t\tshowPolePoint: false,\n\t\t\tuseZoom: true,\n\t\t\tuseKeyboard: true,\n\t\t\tgyroMode: GYRO_MODE.YAWPITCH,\n\t\t\ttouchDirection: TOUCH_DIRECTION_ALL,\n\t\t\tyawRange: DEFAULT_YAW_RANGE,\n\t\t\tpitchRange: DEFAULT_PITCH_RANGE,\n\t\t\tfovRange: [30, 110],\n\t\t\taspectRatio: 1, /* TODO: Need Mandatory? */\n\t\t}, options);\n\n\t\tthis._element = opt.element;\n\t\tthis._initialFov = opt.fov;\n\t\tthis._enabled = false;\n\t\tthis._isAnimating = false;\n\t\tthis._deviceQuaternion = null;\n\n\t\tthis._initAxes(opt);\n\t\tthis.option(opt);\n\t}\n\n\t_initAxes(opt) {\n\t\tconst yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio);\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint);\n\t\tconst useRotation = opt.gyroMode === GYRO_MODE.VR;\n\n\t\tthis.axesPanInput = new RotationPanInput(this._element, {useRotation});\n\t\tthis.axesWheelInput = new WheelInput(this._element, {scale: -4});\n\t\tthis.axesTiltMotionInput = null;\n\t\tthis.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, {scale: -1}) : null;\n\t\tthis.axesMoveKeyInput = new MoveKeyInput(this._element, {scale: [-6, 6]});\n\n\t\tthis.axes = new Axes({\n\t\t\tyaw: {\n\t\t\t\trange: yRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(yRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tpitch: {\n\t\t\t\trange: pRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(pRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tfov: {\n\t\t\t\trange: opt.fovRange,\n\t\t\t\tcircular: [false, false],\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t}, {\n\t\t\tdeceleration: MC_DECELERATION,\n\t\t\tmaximumDuration: MC_MAXIMUM_DURATION\n\t\t}, {\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov\n\t\t}).on({\n\t\t\thold: evt => {\n\t\t\t\t// Restore maximumDuration not to be spin too mush.\n\t\t\t\tthis.axes.options.maximumDuration = MC_MAXIMUM_DURATION;\n\n\t\t\t\tthis.trigger(\"hold\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t\tchange: evt => {\n\t\t\t\tif (evt.delta.fov !== 0) {\n\t\t\t\t\tthis._updateControlScale(evt);\n\t\t\t\t\tthis.updatePanScale();\n\t\t\t\t}\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\trelease: evt => {\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\tanimationStart: evt => {\n\t\t\t},\n\t\t\tanimationEnd: evt => {\n\t\t\t\tthis.trigger(\"animationEnd\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Update Pan Scale\n\t *\n\t * Scale(Sensitivity) values of panning is related with fov and height.\n\t * If at least one of them is changed, this function need to be called.\n\t * @param {*} param\n\t */\n\tupdatePanScale(param = {}) {\n\t\tconst fov = this.axes.get().fov;\n\t\tconst areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);\n\t\tconst scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight;\n\n\t\tthis.axesPanInput.options.scale = [scale, scale];\n\t\tthis.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW;\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * Override component's option method\n\t * to call method for updating values which is affected by option change.\n\t *\n\t * @param {*} args\n\t */\n\toption(...args) {\n\t\tconst argLen = args.length;\n\n\t\t// Getter\n\t\tif (argLen === 0) {\n\t\t\treturn this._getOptions();\n\t\t} else if (argLen === 1 && typeof args[0] === \"string\") {\n\t\t\treturn this._getOptions(args[0]);\n\t\t}\n\n\t\t// Setter\n\t\tconst beforeOptions = Object.assign({}, this.options);\n\t\tlet newOptions = {};\n\t\tlet changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList.\n\n\t\tif (argLen === 1) {\n\t\t\tchangedKeyList = Object.keys(args[0]);\n\t\t\tnewOptions = Object.assign({}, args[0]);\n\t\t} else if (argLen >= 2) {\n\t\t\tchangedKeyList.push(args[0]);\n\t\t\tnewOptions[args[0]] = args[1];\n\t\t}\n\n\t\tthis._setOptions(this._getValidatedOptions(newOptions));\n\t\tthis._applyOptions(changedKeyList, beforeOptions);\n\t\treturn this;\n\t}\n\n\t_getValidatedOptions(newOptions) {\n\t\tif (newOptions.yawRange) {\n\t\t\tnewOptions.yawRange =\n\t\t\t\tthis._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio);\n\t\t}\n\t\tif (newOptions.pitchRange) {\n\t\t\tnewOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov);\n\t\t}\n\t\treturn newOptions;\n\t}\n\n\t_getOptions(key) {\n\t\tlet value;\n\n\t\tif (typeof key === \"string\") {\n\t\t\tvalue = this.options[key];\n\t\t} else if (arguments.length === 0) {\n\t\t\tvalue = this.options;\n\t\t}\n\t\treturn value;\n\t}\n\n\t_setOptions(options) {\n\t\tfor (const key in options) {\n\t\t\tthis.options[key] = options[key];\n\t\t}\n\t}\n\n\t_applyOptions(keys, prevOptions) {\n\t\tconst options = this.options;\n\t\tconst axes = this.axes;\n\t\tconst isVR = options.gyroMode === GYRO_MODE.VR;\n\t\tconst isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH;\n\t\t// If it's VR mode, restrict user interaction to yaw direction only\n\t\tconst touchDirection = isVR ?\n\t\t\t(TOUCH_DIRECTION_YAW & options.touchDirection) :\n\t\t\toptions.touchDirection;\n\n\t\t// If one of below is changed, call updateControlScale()\n\t\tif (keys.some(key =>\n\t\t\tkey === \"showPolePoint\" || key === \"fov\" || key === \"aspectRatio\" ||\n\t\t\tkey === \"yawRange\" || key === \"pitchRange\"\n\t\t)) {\n\t\t\t// If fov is changed, update pan scale\n\t\t\tif (keys.indexOf(\"fov\") >= 0) {\n\t\t\t\taxes.setTo({\"fov\": options.fov});\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\n\t\t\tthis._updateControlScale();\n\t\t}\n\n\t\tif (keys.some(key => key === \"fovRange\")) {\n\t\t\tconst fovRange = options.fovRange;\n\t\t\tconst prevFov = axes.get().fov;\n\t\t\tlet nextFov = axes.get().fov;\n\n\t\t\tvec2.copy(axes.axis.fov.range, fovRange);\n\n\t\t\tif (nextFov < fovRange[0]) {\n\t\t\t\tnextFov = fovRange[0];\n\t\t\t} else if (prevFov > fovRange[1]) {\n\t\t\t\tnextFov = fovRange[1];\n\t\t\t}\n\n\t\t\tif (prevFov !== nextFov) {\n\t\t\t\taxes.setTo({\n\t\t\t\t\tfov: nextFov\n\t\t\t\t}, 0);\n\t\t\t\tthis._updateControlScale();\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"gyroMode\") && SUPPORT_DEVICEMOTION) {\n\t\t\t// Disconnect first\n\t\t\tif (this.axesTiltMotionInput) {\n\t\t\t\tthis.axes.disconnect(this.axesTiltMotionInput);\n\t\t\t\tthis.axesTiltMotionInput.destroy();\n\t\t\t\tthis.axesTiltMotionInput = null;\n\t\t\t}\n\n\t\t\tif (this._deviceQuaternion) {\n\t\t\t\tthis._deviceQuaternion.destroy();\n\t\t\t\tthis._deviceQuaternion = null;\n\t\t\t}\n\n\t\t\tif (isVR) {\n\t\t\t\tthis._initDeviceQuaternion();\n\t\t\t} else if (isYawPitch) {\n\t\t\t\tthis.axesTiltMotionInput = new TiltMotionInput(this._element);\n\t\t\t\tthis.axes.connect([\"yaw\", \"pitch\"], this.axesTiltMotionInput);\n\t\t\t}\n\n\t\t\tthis.axesPanInput.setUseRotation(isVR);\n\t\t}\n\n\t\tif (keys.some(key => key === \"useKeyboard\")) {\n\t\t\tconst useKeyboard = options.useKeyboard;\n\n\t\t\tif (useKeyboard) {\n\t\t\t\taxes.connect([\"yaw\", \"pitch\"], this.axesMoveKeyInput);\n\t\t\t} else {\n\t\t\t\taxes.disconnect(this.axesMoveKeyInput);\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"useZoom\")) {\n\t\t\tconst useZoom = options.useZoom;\n\n\t\t\t// Disconnect first\n\t\t\taxes.disconnect(this.axesWheelInput);\n\t\t\tif (useZoom) {\n\t\t\t\taxes.connect([\"fov\"], this.axesWheelInput);\n\t\t\t}\n\t\t}\n\n\t\tthis._togglePinchInputByOption(options.touchDirection, options.useZoom);\n\n\t\tif (keys.some(key => key === \"touchDirection\")) {\n\t\t\tthis._enabled && this._enableTouch(touchDirection);\n\t\t}\n\t}\n\n\t_togglePinchInputByOption(touchDirection, useZoom) {\n\t\tif (this.axesPinchInput) {\n\t\t\t// disconnect first\n\t\t\tthis.axes.disconnect(this.axesPinchInput);\n\n\t\t\t// If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll.\n\t\t\tif (\n\t\t\t\tuseZoom &&\n\t\t\t\ttouchDirection === TOUCH_DIRECTION_ALL &&\n\t\t\t\t// TODO: Get rid of using private property of axes instance.\n\t\t\t\tthis.axes._inputs.indexOf(this.axesPinchInput) === -1\n\t\t\t) {\n\t\t\t\tthis.axes.connect([\"fov\"], this.axesPinchInput);\n\t\t\t}\n\t\t}\n\t}\n\n\t_enableTouch(direction) {\n\t\t// Disconnect first\n\t\tthis.axesPanInput && this.axes.disconnect(this.axesPanInput);\n\n\t\tconst yawEnabled = direction & TOUCH_DIRECTION_YAW ? \"yaw\" : null;\n\t\tconst pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? \"pitch\" : null;\n\n\t\tthis.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput);\n\t}\n\n\t_initDeviceQuaternion() {\n\t\tthis._deviceQuaternion = new DeviceQuaternion();\n\t\tthis._deviceQuaternion.on(\"change\", e => {\n\t\t\tthis._triggerChange(e);\n\t\t});\n\t}\n\n\t_getValidYawRange(newYawRange, newFov, newAspectRatio) {\n\t\tconst ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1);\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst horizontalFov = fov * ratio;\n\t\tconst isValid = newYawRange[1] - newYawRange[0] >= horizontalFov;\n\n\t\tif (isValid) {\n\t\t\treturn newYawRange;\n\t\t} else {\n\t\t\treturn this.options.yawRange || DEFAULT_YAW_RANGE;\n\t\t}\n\t}\n\n\t_getValidPitchRange(newPitchRange, newFov) {\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst isValid = newPitchRange[1] - newPitchRange[0] >= fov;\n\n\t\tif (isValid) {\n\t\t\treturn newPitchRange;\n\t\t} else {\n\t\t\treturn this.options.pitchRange || DEFAULT_PITCH_RANGE;\n\t\t}\n\t}\n\n\tstatic isCircular(range) {\n\t\treturn range[1] - range[0] < 360 ? [false, false] : [true, true];\n\t}\n\n\t/**\n\t * Update yaw/pitch min/max by 5 factor\n\t *\n\t * 1. showPolePoint\n\t * 2. fov\n\t * 3. yawRange\n\t * 4. pitchRange\n\t * 5. aspectRatio\n\t *\n\t * If one of above is changed, call this function\n\t */\n\t_updateControlScale(changeEvt) {\n\t\tconst opt = this.options;\n\t\tconst fov = this.axes.get().fov;\n\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint);\n\t\tconst yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio);\n\n\t\t// TODO: If not changed!?\n\t\tconst pos = this.axes.get();\n\t\tlet y = pos.yaw;\n\t\tlet p = pos.pitch;\n\n\t\tvec2.copy(this.axes.axis.yaw.range, yRange);\n\t\tvec2.copy(this.axes.axis.pitch.range, pRange);\n\t\tthis.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange);\n\t\tthis.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange);\n\n\t\t/**\n\t\t * update yaw/pitch by it's range.\n\t\t */\n\t\tif (y < yRange[0]) {\n\t\t\ty = yRange[0];\n\t\t} else if (y > yRange[1]) {\n\t\t\ty = yRange[1];\n\t\t}\n\n\t\tif (p < pRange[0]) {\n\t\t\tp = pRange[0];\n\t\t} else if (p > pRange[1]) {\n\t\t\tp = pRange[1];\n\t\t}\n\n\t\tif (changeEvt) {\n\t\t\tchangeEvt.set({\n\t\t\t\tyaw: y,\n\t\t\t\tpitch: p,\n\t\t\t});\n\t\t}\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\t_updatePitchRange(pitchRange, fov, showPolePoint) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\t// Circular pitch on VR\n\t\t\treturn CIRCULAR_PITCH_RANGE;\n\t\t}\n\n\t\tconst verticalAngle = pitchRange[1] - pitchRange[0];\n\t\tconst halfFov = fov / 2;\n\t\tconst isPanorama = verticalAngle < 180;\n\n\t\tif (showPolePoint && !isPanorama) {\n\t\t\t// Use full pinch range\n\t\t\treturn pitchRange.concat();\n\t\t}\n\n\t\t// Round value as movableCood do.\n\t\treturn [pitchRange[0] + halfFov, pitchRange[1] - halfFov];\n\t}\n\n\t_updateYawRange(yawRange, fov, aspectRatio) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\treturn DEFAULT_YAW_RANGE;\n\t\t}\n\n\t\tconst horizontalAngle = yawRange[1] - yawRange[0];\n\n\t\t/**\n\t\t * Full 360 Mode\n\t\t */\n\t\tif (horizontalAngle >= 360) {\n\t\t\t// Don't limit yaw range on Full 360 mode.\n\t\t\treturn yawRange.concat();\n\t\t}\n\n\t\t/**\n\t\t * Panorama mode\n\t\t */\n\t\t// Ref : https://github.com/naver/egjs-view360/issues/290\n\t\tconst halfHorizontalFov =\n\t\t\tmathUtil.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2))));\n\n\t\t// Round value as movableCood do.\n\t\treturn [\n\t\t\tyawRange[0] + halfHorizontalFov,\n\t\t\tyawRange[1] - halfHorizontalFov\n\t\t];\n\t}\n\n\t_triggerChange(evt) {\n\t\tconst pos = this.axes.get();\n\t\tconst opt = this.options;\n\t\tconst event = {\n\t\t\ttargetElement: opt.element,\n\t\t\tisTrusted: evt.isTrusted,\n\t\t};\n\n\t\tevent.yaw = pos.yaw;\n\t\tevent.pitch = pos.pitch;\n\t\tevent.fov = pos.fov;\n\n\t\tif (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) {\n\t\t\tevent.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t\t}\n\t\tthis.trigger(\"change\", event);\n\t}\n\n\t// TODO: makes constant to be logic\n\tstatic adjustAspectRatio(input) {\n\t\tconst inputRange = [\n\t\t\t0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670,\n\t\t\t0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19,\n\t\t\t1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26,\n\t\t\t2.30, 2.60, 3.00, 5.00, 6.00\n\t\t];\n\t\tconst outputRange = [\n\t\t\t0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710,\n\t\t\t0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15,\n\t\t\t1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72,\n\t\t\t1.82, 1.92, 2.00, 2.24, 2.30\n\t\t];\n\n\t\tlet rangeIdx = -1;\n\n\t\tfor (let i = 0; i < inputRange.length - 1; i++) {\n\t\t\tif (inputRange[i] <= input && inputRange[i + 1] >= input) {\n\t\t\t\trangeIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (rangeIdx === -1) {\n\t\t\tif (inputRange[0] > input) {\n\t\t\t\treturn outputRange[0];\n\t\t\t} else {\n\t\t\t\treturn outputRange[outputRange[0].length - 1];\n\t\t\t}\n\t\t}\n\n\t\tconst inputA = inputRange[rangeIdx];\n\t\tconst inputB = inputRange[rangeIdx + 1];\n\t\tconst outputA = outputRange[rangeIdx];\n\t\tconst outputB = outputRange[rangeIdx + 1];\n\n\t\treturn YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA));\n\t}\n\n\tstatic lerp(a, b, fraction) {\n\t\treturn a + fraction * (b - a);\n\t}\n\n\t/**\n\t * Enable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#enable\n\t */\n\tenable() {\n\t\tif (this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._enabled = true;\n\n\t\t// touchDirection is decided by parameter is valid string (Ref. Axes.connect)\n\t\tthis._applyOptions(Object.keys(this.options), this.options);\n\n\t\t// TODO: Is this code is needed? Check later.\n\t\tthis.updatePanScale();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Disable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#disable\n\t */\n\tdisable(persistOrientation) {\n\t\tif (!this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// TODO: Check peristOrientation is needed!\n\t\tif (!persistOrientation) {\n\t\t\tthis._resetOrientation();\n\t\t}\n\t\tthis.axes.disconnect();\n\t\tthis._enabled = false;\n\t\treturn this;\n\t}\n\n\t_resetOrientation() {\n\t\tconst opt = this.options;\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Set one or more of yaw, pitch, fov\n\t *\n\t * @param {Object} coordinate yaw, pitch, fov\n\t * @param {Number} duration Animation duration. if it is above 0 then it's animated.\n\t */\n\tlookAt({yaw, pitch, fov}, duration) {\n\t\tconst pos = this.axes.get();\n\n\t\tconst y = yaw === undefined ? 0 : yaw - pos.yaw;\n\t\tconst p = pitch === undefined ? 0 : pitch - pos.pitch;\n\t\tconst f = fov === undefined ? 0 : fov - pos.fov;\n\n\t\t// Allow duration of animation to have more than MC_MAXIMUM_DURATION.\n\t\tthis.axes.options.maximumDuration = Infinity;\n\n\t\tthis.axes.setBy({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t\tfov: f\n\t\t}, duration);\n\t}\n\n\tgetYawPitch() {\n\t\tconst yawPitch = this.axes.get();\n\n\t\treturn {\n\t\t\tyaw: yawPitch.yaw,\n\t\t\tpitch: yawPitch.pitch,\n\t\t};\n\t}\n\n\tgetFov() {\n\t\treturn this.axes.get().fov;\n\t}\n\n\tgetQuaternion() {\n\t\tconst pos = this.axes.get();\n\n\t\treturn this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t}\n\n\tshouldRenderWithQuaternion() {\n\t\treturn this.options.gyroMode === GYRO_MODE.VR;\n\t}\n\n\t/**\n\t * Destroys objects\n\t */\n\tdestroy() {\n\t\tthis.axes && this.axes.destroy();\n\t\tthis.axisPanInput && this.axisPanInput.destroy();\n\t\tthis.axesWheelInput && this.axesWheelInput.destroy();\n\t\tthis.axesTiltMotionInput && this.axesTiltMotionInput.destroy();\n\t\tthis.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy();\n\t\tthis.axesPinchInput && this.axesPinchInput.destroy();\n\t\tthis.axesMoveKeyInput && this.axesMoveKeyInput.destroy();\n\t\tthis._deviceQuaternion && this._deviceQuaternion.destroy();\n\t}\n}\n\nexport default YawPitchControl;\n","import Component from \"@egjs/component\";\n\nconst STATUS = {\n\t\"NONE\": 0,\n\t\"LOADING\": 1,\n\t\"LOADED\": 2,\n\t\"ERROR\": 3\n};\n\nconst EVENT = {\n\t\"READYSTATECHANGE\": \"readystatechange\"\n};\n\nclass ImageLoader extends Component {\n\tstatic STATUS = STATUS;\n\tconstructor(image) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis._image = null;\n\t\tthis._onceHandlers = [];\n\t\tthis._loadStatus = STATUS.NONE;\n\n\t\timage && this.set(image);\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._image) {\n\t\t\t\trej(\"ImageLoader: image is not defiend\");\n\t\t\t} else if (this._loadStatus === STATUS.LOADED) {\n\t\t\t\tres(this.getElement());\n\t\t\t} else if (this._loadStatus === STATUS.LOADING) {\n\t\t\t\t/* Check isMaybeLoaded() first because there may have\n\t\t\t\t\tposibilities that image already loaded before get is called.\n\t\t\t\t\tfor example calling get on external image onload callback.*/\n\t\t\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\t\tres(this.getElement());\n\t\t\t\t} else {\n\t\t\t\t\tthis.on(EVENT.READYSTATECHANGE, e => {\n\t\t\t\t\t\tif (e.type === STATUS.LOADED) {\n\t\t\t\t\t\t\tres(this.getElement());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trej(\"ImageLoader: failed to load images.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trej(\"ImageLoader: failed to load images\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param image img element or img url or array of img element or array of img url\n\t */\n\tset(image) {\n\t\tthis._loadStatus = STATUS.LOADING;\n\n\t\tthis._image = ImageLoader.createElement(image);\n\n\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.onceLoaded(\n\t\t\tthis._image,\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.LOADED\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.ERROR;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.ERROR\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tstatic createElement(image) {\n\t\tconst images = image instanceof Array ? image : [image];\n\n\t\treturn images.map(img => {\n\t\t\tlet _img = img;\n\n\t\t\tif (typeof img === \"string\") {\n\t\t\t\t_img = new Image();\n\t\t\t\t_img.crossOrigin = \"anonymous\";\n\t\t\t\t_img.src = img;\n\t\t\t}\n\t\t\treturn _img;\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._image.length === 1 ? this._image[0] : this._image;\n\t}\n\n\tstatic isMaybeLoaded(image) {\n\t\tlet result = false;\n\n\t\tif (image instanceof Image) {\n\t\t\tresult = image.complete && image.naturalWidth !== 0;\n\t\t} else if (image instanceof Array) {\n\t\t\tresult = !image.some(img => !img.complete || img.naturalWidth === 0);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonceLoaded(target, onload, onerror) {\n\t\tconst targets = target instanceof Array ? target : [target];\n\t\tconst targetsNotLoaded = targets.filter(img => !ImageLoader.isMaybeLoaded(img));\n\t\tconst loadPromises = targetsNotLoaded.map(img => new Promise((res, rej) => {\n\t\t\tthis._once(img, \"load\", () => (res(img)));\n\t\t\tthis._once(img, \"error\", () => (rej(img)));\n\t\t}));\n\n\t\tPromise.all(loadPromises).then(\n\t\t\tresult => (onload(targets.length === 1 ? targets[0] : targets)),\n\t\t\treason => (onerror(reason))\n\t\t);\n\t}\n\n\t_once(target, type, listener) {\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\ttarget.addEventListener(type, fn);\n\t\tthis._onceHandlers.push({target, type, fn});\n\t}\n\n\tgetStatus() {\n\t\treturn this._loadStatus;\n\t}\n\n\tdestroy() {\n\t\tthis._onceHandlers.forEach(handler => {\n\t\t\thandler.target.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._onceHandlers = [];\n\t\tthis._image.src = \"\";\n\t\tthis._image = null;\n\t\tthis._loadStatus = STATUS.NONE;\n\t}\n}\n\nexport default ImageLoader;\n","// import Agent from \"@egjs/agent\";\n\n/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */\nconst READY_STATUS = {\n\tHAVE_NOTHING: 0, // no information whether or not the audio/video is ready\n\tHAVE_METADATA: 1, // HAVE_METADATA - metadata for the audio/video is ready\n\tHAVE_CURRENT_DATA: 2, // data for the current playback position is available, but not enough data to play next frame/millisecond\n\tHAVE_FUTURE_DATA: 3, // data for the current and at least the next frame is available\n\tHAVE_ENOUGH_DATA: 4, // enough data available to start playing\n\t// below is custom status for failed to load status\n\tLOADING_FAILED: -1\n};\n\nconst READYSTATECHANGE_EVENT_NAME = {};\n\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = \"loadedmetadata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = \"loadeddata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = \"canplay\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = \"canplaythrough\";\n\nexport default class VideoLoader {\n\tconstructor(video) {\n\t\tthis._handlers = [];\n\t\tthis._sourceCount = 0;\n\n\t\t// on iOS safari, 'loadeddata' will not triggered unless the user hits play,\n\t\t// so used 'loadedmetadata' instead.\n\t\tthis._thresholdReadyState = READY_STATUS.HAVE_METADATA;\n\t\tthis._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState];\n\n\t\tthis._loadStatus = (video && video.readyState) || READY_STATUS.HAVE_NOTHING;\n\n\t\tthis._onerror = this._onerror.bind(this);\n\n\t\tvideo && this.set(video);\n\t}\n\n\t_onerror() {\n\t\tthis._errorCount++;\n\t\tif (this._errorCount >= this._sourceCount) {\n\t\t\tthis._loadStatus = READY_STATUS.LOADING_FAILED;\n\t\t\tthis._detachErrorHandler(this._onerror);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src}\n\t */\n\t_appendSourceElement(videoUrl) {\n\t\tlet videoSrc;\n\t\tlet videoType;\n\n\t\tif (typeof videoUrl === \"object\") {\n\t\t\tvideoSrc = videoUrl.src;\n\t\t\tvideoType = videoUrl.type;\n\t\t} else if (typeof videoUrl === \"string\") {\n\t\t\tvideoSrc = videoUrl;\n\t\t}\n\n\t\tif (!videoSrc) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst sourceElement = document.createElement(\"source\");\n\n\t\tsourceElement.src = videoSrc;\n\t\tvideoType && (sourceElement.type = videoType);\n\n\t\tthis._video.appendChild(sourceElement);\n\t\treturn true;\n\t}\n\n\tset(video) {\n\t\tthis._reset(); // reset resources.\n\n\t\tif (!video) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (video instanceof HTMLVideoElement) {\n\t\t\t// video tag\n\t\t\tthis._video = video;\n\t\t} else if (typeof video === \"string\" || typeof video === \"object\") {\n\t\t\t// url\n\t\t\tthis._video = document.createElement(\"video\");\n\t\t\tthis._video.setAttribute(\"crossorigin\", \"anonymous\");\n\t\t\tthis._video.setAttribute(\"webkit-playsinline\", \"\");\n\t\t\tthis._video.setAttribute(\"playsinline\", \"\");\n\n\t\t\tif (video instanceof Array) {\n\t\t\t\tvideo.forEach(v => this._appendSourceElement(v));\n\t\t\t} else {\n\t\t\t\tthis._appendSourceElement(video);\n\t\t\t}\n\n\t\t\tthis._sourceCount = this._video.querySelectorAll(\"source\").length;\n\n\t\t\tif (this._sourceCount > 0) {\n\t\t\t\tif (this._video.readyState < this._thresholdReadyState) {\n\t\t\t\t\tthis._video.load();\n\t\t\t\t\t// attach loading error listener\n\t\t\t\t\tthis._attachErrorHandler(this._onerror);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._video = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t_attachErrorHandler(handler) {\n\t\tthis._video.addEventListener(\"error\", handler);\n\t\tthis._sources = this._video.querySelectorAll(\"source\");\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.addEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\t_detachErrorHandler(handler) {\n\t\tthis._video.removeEventListener(\"error\", handler);\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.removeEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._video) {\n\t\t\t\trej(\"VideoLoader: video is undefined\");\n\t\t\t} else if (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t} else if (this._video.readyState >= this._thresholdReadyState) {\n\t\t\t\tres(this._video);\n\t\t\t} else {\n\t\t\t\t// check errorCnt and reject\n\t\t\t\tconst rejector = () => {\n\t\t\t\t\tif (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\t\t\tthis._detachErrorHandler(rejector);\n\t\t\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis._attachErrorHandler(rejector);\n\t\t\t\tthis._once(this._thresholdEventName, () => res(this._video));\n\t\t\t}\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._video;\n\t}\n\n\tdestroy() {\n\t\tthis._reset();\n\t}\n\n\t_reset() {\n\t\tthis._handlers.forEach(handler => {\n\t\t\tthis._video.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._handlers = [];\n\t\tthis._video = null;\n\n\t\tthis._sourceCount = 0;\n\t\tthis._errorCount = 0;\n\t}\n\n\t_once(type, listener) {\n\t\tconst target = this._video;\n\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\t/* By useCapture mode enabled, you can capture the error event being fired on source(child)*/\n\t\ttarget.addEventListener(type, fn, true);\n\t\tthis._handlers.push({type, fn});\n\t}\n}\n","import agent from \"@egjs/agent\";\n\nconst WEBGL_ERROR_CODE = {\n\t\"0\": \"NO_ERROR\",\n\t\"1280\": \"INVALID_ENUM\",\n\t\"1281\": \"INVALID_VALUE\",\n\t\"1282\": \"INVALID_OPERATION\",\n\t\"1285\": \"OUT_OF_MEMORY\",\n\t\"1286\": \"INVALID_FRAMEBUFFER_OPERATION\",\n\t\"37442\": \"CONTEXT_LOST_WEBGL\"\n};\n\nlet webglAvailability = null;\nlet MAX_TEXTURE_SIZE_FOR_TEST = null;\n\nexport default class WebGLUtils {\n\tstatic createShader(gl, type, source) {\n\t\tconst shader = gl.createShader(type);\n\n\t\tgl.shaderSource(shader, source);\n\t\tgl.compileShader(shader);\n\t\tconst success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n\t\tif (success) {\n\t\t\treturn shader;\n\t\t} else {\n\t\t\t// eslint-disable-next-line\n\t\t\tconsole.error(gl.getShaderInfoLog(shader));\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic createProgram(gl, vertexShader, fragmentShader) {\n\t\tconst program = gl.createProgram();\n\n\t\tgl.attachShader(program, vertexShader);\n\t\tgl.attachShader(program, fragmentShader);\n\t\tgl.linkProgram(program);\n\n\t\tgl.detachShader(program, vertexShader);\n\t\tgl.detachShader(program, fragmentShader);\n\t\tgl.deleteShader(vertexShader);\n\t\tgl.deleteShader(fragmentShader);\n\n\t\tconst success = gl.getProgramParameter(program, gl.LINK_STATUS);\n\n\t\tif (success) {\n\t\t\treturn program;\n\t\t}\n\n\t\tgl.deleteProgram(program);\n\t\treturn null;\n\t}\n\n\tstatic initBuffer(gl, target /* bind point */, data, itemSize, attr) {\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer(target, buffer);\n\t\tgl.bufferData(target, data, gl.STATIC_DRAW);\n\n\t\tif (buffer) {\n\t\t\tbuffer.itemSize = itemSize;\n\t\t\tbuffer.numItems = data.length / itemSize;\n\t\t}\n\n\t\tif (attr !== undefined) {\n\t\t\tgl.enableVertexAttribArray(attr);\n\t\t\tgl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\tstatic getWebglContext(canvas, userContextAttributes) {\n\t\tconst webglIdentifiers = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n\t\tlet context = null;\n\t\tconst contextAttributes = Object.assign({\n\t\t\tpreserveDrawingBuffer: false,\n\t\t\tantialias: false,\n\t\t\txrCompatible: true\n\t\t}, userContextAttributes);\n\n\t\tfunction onWebglcontextcreationerror(e) {\n\t\t\treturn e.statusMessage;\n\t\t}\n\n\t\tcanvas.addEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\tfor (let i = 0; i < webglIdentifiers.length; i++) {\n\t\t\ttry {\n\t\t\t\tcontext = canvas.getContext(webglIdentifiers[i], contextAttributes);\n\t\t\t} catch (t) {}\n\t\t\tif (context) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcanvas.removeEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\treturn context;\n\t}\n\n\tstatic createTexture(gl, textureTarget) {\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture(textureTarget, texture);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(textureTarget, null);\n\n\t\treturn texture;\n\t}\n\n\t/**\n\t * Returns the webgl availability of the current browser.\n\t * @method WebGLUtils#isWebGLAvailable\n\t * @retuen {Boolean} isWebGLAvailable\n\t */\n\tstatic isWebGLAvailable() {\n\t\tif (webglAvailability === null) {\n\t\t\tconst canvas = document.createElement(\"canvas\");\n\t\t\tconst webglContext = WebGLUtils.getWebglContext(canvas);\n\n\t\t\twebglAvailability = !!webglContext;\n\n\t\t\t// webglContext Resource forced collection\n\t\t\tif (webglContext) {\n\t\t\t\tconst loseContextExtension = webglContext.getExtension(\"WEBGL_lose_context\");\n\n\t\t\t\tloseContextExtension && loseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t\treturn webglAvailability;\n\t}\n\n\t/**\n\t * Returns whether webgl is stable in the current browser.\n\t * @method WebGLUtils#isStableWebGL\n\t * @retuen {Boolean} isStableWebGL\n\t */\n\tstatic isStableWebGL() {\n\t\tconst agentInfo = agent();\n\t\tlet isStableWebgl = true;\n\n\t\tif (agentInfo.os.name === \"android\") {\n\t\t\tconst version = parseFloat(agentInfo.os.version);\n\n\t\t\tif (version <= 4.3) {\n\t\t\t\tisStableWebgl = false;\n\t\t\t} else if (version === 4.4) {\n\t\t\t\tif (agentInfo.browser.name !== \"chrome\") {\n\t\t\t\t\tisStableWebgl = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isStableWebgl;\n\t}\n\n\tstatic getErrorNameFromWebGLErrorCode(code) {\n\t\tif (!(code in WEBGL_ERROR_CODE)) {\n\t\t\treturn \"UNKNOWN_ERROR\";\n\t\t}\n\n\t\treturn WEBGL_ERROR_CODE[code];\n\t}\n\n\n\t/**\n\t * This function is wrapper for texImage2D to handle exceptions on texImage2D.\n\t * Purpose is to prevent service from being stopped by script error.\n\t *\n\t * @param {*} gl\n\t * @param {*} target\n\t * @param {*} pixels\n\t */\n\tstatic texImage2D(gl, target, pixels) {\n\t\ttry {\n\t\t\tgl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\t\t} catch (error) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.error(\"WebGLUtils.texImage2D error:\", error);\n\t\t\t/* eslint-enable no-console */\n\t\t}\n\t}\n\n\tstatic getMaxTextureSize(gl) {\n\t\t// WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test\n\t\treturn MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\t}\n}\n\n/**\n * This function should not be used in service code. It's provided only for test purpose.\n * It should be set to null or 0 when test is done.\n *\n * @param {Number} size\n */\nfunction setMaxTextureSizeForTestOnlyPurpose(size) {\n\tMAX_TEXTURE_SIZE_FOR_TEST = size;\n}\n\nexport {\n\tsetMaxTextureSizeForTestOnlyPurpose\n};\n","import Component from \"@egjs/component\";\nimport Agent from \"@egjs/agent\";\n\nconst agent = Agent();\nconst isIE11 = agent.browser.name === \"ie\" && agent.browser.majorVersion === 11;\n\nconst EVENTS = {\n\tERROR: \"error\"\n};\n\n/**\n *\n * Extends Component for firing errors occurs internally.\n */\nclass Renderer extends Component {\n\tstatic EVENTS = EVENTS;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._forceDimension = null;\n\t\tthis._pixelCanvas = null;\n\t\tthis._pixelContext = null;\n\t}\n\n\trender({gl, shaderProgram, indexBuffer, mvMatrix, pMatrix}) {\n\t\tgl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n\t\tgl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n\n\t\tif (indexBuffer) {\n\t\t\tgl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n\t\t}\n\t}\n\n\t// Define interface for Renderers\n\t/**\n\t * Following MUST BE DEFINED on Child of Renderer\n\t *\n\t * DATA\n\t *\n\t * - getVertexPositionData\n\t * - getIndexData\n\t * - getTextureCoordData\n\t *\n\t * SOURCE\n\t *\n\t * - getVertexShaderSource\n\t * - getFragmentShaderSource\n\t *\n\t * TEXTURE\n\t *\n\t * - bindTexture\n\t */\n\tgetDimension(pixelSource) {\n\t\tconst width = pixelSource.naturalWidth || pixelSource.videoWidth;\n\t\tconst height = pixelSource.naturalHeight || pixelSource.videoHeight;\n\n\t\treturn {width, height};\n\t}\n\n\t/**\n\t * Update data used by shader\n\t * \t-\n\t *\n\t *\n\t * @param {*} param\n\t */\n\tupdateShaderData(param) {\n\t\t/*\n\t\t* Update following data in implementation layer.\n\t\t* If the data is not changed, it does not need to implement this function.\n\t\t*\n\t\t* - _VERTEX_POSITION_DATA\n\t\t* - _TEXTURE_COORD_DATA\n\t\t* - _INDEX_DATA\n\t\t*/\n\t}\n\n\t/**\n\t *\n\t * @param {HTMLImageElement | HTMLVideoElement} image\n\t * @param {Object = {width, height}} forceDimension Forced dimension to resize\n\t */\n\t_initPixelSource(image, forceDimension) {\n\t\tconst isIE11Video = isIE11 && (image instanceof HTMLVideoElement);\n\n\t\tif (isIE11Video || forceDimension) {\n\t\t\tconst {width, height} = forceDimension || this.getDimension(image);\n\n\t\t\tthis._pixelCanvas = document.createElement(\"canvas\");\n\t\t\tthis._pixelCanvas.width = width;\n\t\t\tthis._pixelCanvas.height = height;\n\t\t\tthis._pixelContext = this._pixelCanvas.getContext(\"2d\");\n\t\t}\n\t\tthis._forceDimension = forceDimension;\n\t}\n\n\t_getPixelSource(image) {\n\t\tif (!this._pixelCanvas) {\n\t\t\treturn image;\n\t\t}\n\n\t\t/**\n\t\t * IE11 && Video\n\t\t * or\n\t\t * Dimension is forced (Image is larger than texture size.)\n\t\t */\n\t\tconst contentDimension = this.getDimension(image);\n\t\tconst textureDimension = this._forceDimension || contentDimension;\n\n\t\tif (this._pixelCanvas.width !== textureDimension.width) {\n\t\t\tthis._pixelCanvas.width = textureDimension.width;\n\t\t}\n\n\t\tif (this._pixelCanvas.height !== textureDimension.height) {\n\t\t\tthis._pixelCanvas.height = textureDimension.height;\n\t\t}\n\n\t\tif (this._forceDimension) {\n\t\t\tthis._pixelContext.drawImage(image,\n\t\t\t\t0, 0, contentDimension.width, contentDimension.height,\n\t\t\t\t0, 0, textureDimension.width, textureDimension.height);\n\t\t} else {\n\t\t\tthis._pixelContext.drawImage(image, 0, 0);\n\t\t}\n\n\t\treturn this._pixelCanvas;\n\t}\n\n\t_extractTileConfig(imageConfig) {\n\t\tlet tileConfig =\n\t\t\tArray.isArray(imageConfig.tileConfig) ?\n\t\t\t\timageConfig.tileConfig : Array(...Array(6)).map(() => imageConfig.tileConfig);\n\n\t\ttileConfig = tileConfig.map(\n\t\t\tconfig => Object.assign({\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}, config)\n\t\t);\n\n\t\treturn tileConfig;\n\t}\n\n\t_triggerError(error) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.error(\"Renderer Error:\", error);\n\t\t/* eslint-enable no-console */\n\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\tmessage: typeof error === \"string\" ? error : error.message\n\t\t});\n\t}\n}\n\nexport default Renderer;\n","import Agent from \"@egjs/agent\";\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {util as mathUtil} from \"../../utils/math-util.js\";\n\nclass CubeRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = null;\n\tstatic _INDEX_DATA = null;\n\tgetVertexPositionData() {\n\t\tCubeRenderer._VERTEX_POSITION_DATA =\n\t\t\tCubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// top\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// bottom\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\n\t\treturn CubeRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\tif (CubeRenderer._INDEX_DATA) {\n\t\t\treturn CubeRenderer._INDEX_DATA;\n\t\t}\n\n\t\tconst indexData = [];\n\t\tconst vertexPositionData = this.getVertexPositionData();\n\n\t\tfor (let i = 0; i < (vertexPositionData.length / 3); i += 4) {\n\t\t\tindexData.push(\n\t\t\t\ti,\n\t\t\t\ti + 2,\n\t\t\t\ti + 1,\n\t\t\t\ti,\n\t\t\t\ti + 3,\n\t\t\t\ti + 2\n\t\t\t);\n\t\t}\n\n\t\tCubeRenderer._INDEX_DATA = indexData;\n\t\treturn indexData;\n\t}\n\n\tstatic extractOrder(imageConfig) {\n\t\treturn imageConfig.order || \"RLUDBF\";\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\tconst vertexOrder = \"BFUDRL\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst base = this.getVertexPositionData();\n\t\tconst tileConfig = this._extractTileConfig(imageConfig);\n\t\tconst elemSize = 3;\n\t\tconst vertexPerTile = 4;\n\t\tconst textureCoordData =\n\t\t\tvertexOrder.split(\"\")\n\t\t\t\t.map(face => tileConfig[order.indexOf(face)])\n\t\t\t\t.map((config, i) => {\n\t\t\t\t\tconst rotation = parseInt(config.rotation / 90, 10);\n\t\t\t\t\tconst ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2];\n\n\t\t\t\t\tfor (let r = 0; r < Math.abs(rotation); r++) {\n\t\t\t\t\t\tif ((config.flipHorizontal && rotation > 0) ||\n\t\t\t\t\t\t\t(!config.flipHorizontal && rotation < 0)) {\n\t\t\t\t\t\t\tordermap_.push(ordermap_.shift());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tordermap_.unshift(ordermap_.pop());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst elemPerTile = elemSize * vertexPerTile;\n\t\t\t\t\tconst tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile);\n\t\t\t\t\tconst tileTemp = [];\n\n\t\t\t\t\tfor (let j = 0; j < vertexPerTile; j++) {\n\t\t\t\t\t\ttileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize);\n\t\t\t\t\t}\n\t\t\t\t\treturn tileTemp;\n\t\t\t\t})\n\t\t\t\t.join()\n\t\t\t\t.split(\",\")\n\t\t\t\t.map(v => parseInt(v, 10));\n\n\t\treturn textureCoordData;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}`;\n\t}\n\n\tupdateTexture(gl, image, imageConfig) {\n\t\tconst baseOrder = \"RLUDBF\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst orderMap = {};\n\n\t\torder.split(\"\").forEach((v, i) => {\n\t\t\torderMap[v] = i;\n\t\t});\n\n\t\ttry {\n\t\t\tif (image instanceof Array) {\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image);\n\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\t\t\t\t\tconst tile = this.extractTileFromImage(\n\t\t\t\t\t\timage, tileIdx, maxCubeMapTextureSize\n\t\t\t\t\t);\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, tile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis._triggerError(e);\n\t\t}\n\t}\n\n\tbindTexture(gl, texture, image, imageConfig) {\n\t\tgl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\t\tthis.updateTexture(gl, image, imageConfig);\n\t}\n\n\tgetSourceTileSize(image) {\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst aspectRatio = width / height;\n\t\tlet inputTextureSize;\n\n\t\tif (aspectRatio === 1 / 6) {\n\t\t\tinputTextureSize = width;\n\t\t} else if (aspectRatio === 6) {\n\t\t\tinputTextureSize = height;\n\t\t} else if (aspectRatio === 2 / 3) {\n\t\t\tinputTextureSize = width / 2;\n\t\t} else {\n\t\t\tinputTextureSize = width / 3;\n\t\t}\n\t\treturn inputTextureSize;\n\t}\n\n\textractTileFromImage(image, tileIdx, outputTextureSize) {\n\t\tconst {width} = this.getDimension(image);\n\t\tconst inputTextureSize = this.getSourceTileSize(image);\n\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = outputTextureSize;\n\t\tcanvas.height = outputTextureSize;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tconst tilePerRow = width / inputTextureSize;\n\n\t\tconst x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow);\n\t\tconst y = parseInt(tileIdx / tilePerRow, 10) * (inputTextureSize);\n\n\t\tcontext.drawImage(\n\t\t\timage, x, y,\n\t\t\tinputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize\n\t\t);\n\t\treturn canvas;\n\t}\n\n\tgetMaxCubeMapTextureSize(gl, image) {\n\t\tconst agent = Agent();\n\t\tconst maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n\t\tlet _imageWidth = this.getSourceTileSize(image);\n\n\t\tif (agent.browser.name === \"ie\" && agent.browser.majorVersion === 11) {\n\t\t\tif (!mathUtil.isPowerOfTwo(_imageWidth)) {\n\t\t\t\tfor (let i = 1; i < maxCubeMapTextureSize; i *= 2) {\n\t\t\t\t\tif (i < _imageWidth) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_imageWidth = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (agent.os.name === \"ios\") {\n\t\t\tconst majorVersion = agent.os.majorVersion;\n\n\t\t\t// ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다.\n\t\t\tif (majorVersion === 9) {\n\t\t\t\t_imageWidth = 1024;\n\t\t\t}\n\t\t\t// ios 8 의 경우 텍스쳐 최대사이즈는 512 이다.\n\t\t\tif (majorVersion === 8) {\n\t\t\t\t_imageWidth = 512;\n\t\t\t}\n\t\t}\n\t\t// maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수\n\t\treturn Math.min(maxCubeMapTextureSize, _imageWidth);\n\t}\n}\n\nexport default CubeRenderer;\n","\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\n\nexport default class CubeStripRenderer extends Renderer {\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}`;\n\t}\n\n\tgetVertexPositionData() {\n\t\tif (!this._vertices) {\n\t\t\tthis._vertices = [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// up\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// down\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\t\t}\n\n\t\treturn this._vertices;\n\t}\n\n\tgetIndexData() {\n\t\t// TODO: 한번만 계산하도록 수정하기\n\t\tconst indices = (() => {\n\t\t\tconst indexData = [];\n\n\t\t\tfor (let i = 0; i < (this._vertices.length / 3); i += 4) {\n\t\t\t\tindexData.push(\n\t\t\t\t\ti,\n\t\t\t\t\ti + 1,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti + 3\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn indexData;\n\t\t})();\n\n\t\treturn indices;\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\t// TODO: make it cols, rows as config.\n\t\tconst cols = 3;\n\t\tconst rows = 2;\n\t\tconst order = imageConfig.order || \"RLUDFB\";\n\t\tlet coords = [];\n\n\t\t// 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다.\n\t\tfor (let r = rows - 1; r >= 0; r--) {\n\t\t\tfor (let c = 0; c < cols; c++) {\n\t\t\t\tconst coord = [\n\t\t\t\t\tc / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, (r + 1) / rows,\n\t\t\t\t\tc / cols, (r + 1) / rows\n\t\t\t\t];\n\n\t\t\t\tcoords.push(coord);\n\t\t\t}\n\t\t}\n\n\t\tconst tileConfigs = this._extractTileConfig(imageConfig);\n\n\t\t// Transform Coord By Flip & Rotation\n\t\tcoords = coords\n\t\t// shrink coord to avoid pixel bleeding\n\t\t\t.map(coord => this._shrinkCoord(coord))\n\t\t\t.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));\n\n\t\t// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치\n\t\treturn \"BFUDRL\".split(\"\")\n\t\t\t.map(face => order.indexOf(face))\n\t\t\t.map(index => coords[index])\n\t\t\t.reduce((acc, val) => acc.concat(val), []);\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\t_transformCoord(coord, tileConfig) {\n\t\tlet newCoord = coord.slice();\n\n\t\tif (tileConfig.flipHorizontal) {\n\t\t\tnewCoord = this._flipHorizontalCoord(newCoord);\n\t\t}\n\n\t\tif (tileConfig.rotation) {\n\t\t\tnewCoord = this._rotateCoord(newCoord, tileConfig.rotation);\n\t\t}\n\n\t\treturn newCoord;\n\t}\n\n\t_shrinkCoord(coord) {\n\t\tconst SHRINK_Y = 0.00;\n\t\tconst SHRINK_X = 0.00;\n\n\t\treturn [\n\t\t\tcoord[0] + SHRINK_X, coord[1] + SHRINK_Y,\n\t\t\tcoord[2] - SHRINK_X, coord[3] + SHRINK_Y,\n\t\t\tcoord[4] - SHRINK_X, coord[5] - SHRINK_Y,\n\t\t\tcoord[6] + SHRINK_X, coord[7] - SHRINK_Y\n\t\t];\n\t}\n\n\t_rotateCoord(coord, rotationAngle) {\n\t\tconst SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord.\n\t\tconst shiftCount = parseInt(rotationAngle / 90, 10) % 4;\n\n\t\tif (shiftCount === 0) {\n\t\t\treturn coord;\n\t\t}\n\n\t\tlet moved;\n\t\tlet rotatedCoord = [];\n\n\t\tif (shiftCount > 0) {\n\t\t\tmoved = coord.splice(0, shiftCount * SIZE);\n\t\t\trotatedCoord = coord.concat(moved);\n\t\t} else {\n\t\t\tmoved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE);\n\t\t\trotatedCoord = moved.concat(coord);\n\t\t}\n\n\t\treturn rotatedCoord;\n\t}\n\n\t_flipHorizontalCoord(coord) {\n\t\treturn [\n\t\t\tcoord[2], coord[3],\n\t\t\tcoord[0], coord[1],\n\t\t\tcoord[6], coord[7],\n\t\t\tcoord[4], coord[5]\n\t\t];\n\t}\n}\n","/**\n * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide})\n * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고)\n * @namespace\n * @name GYRO_MODE\n * @memberof eg.view360.PanoViewer\n */\n/**\n * Disable gyro\n * @ko gyro 비활성화\n * @name NONE\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"none\"\n */\n/**\n * YawPitch Mode\n * @ko YawPitch Mode\n * @name YAWPITCH\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"yawPitch\"\n */\n/**\n * VR Mode\n * @ko VR Mode\n * @name VR\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"VR\"\n */\nimport {GYRO_MODE} from \"../YawPitchControl/consts\";\n\n/**\n * Constant value for errors\n * @ko 에러에 대한 상수 값\n * @namespace\n * @name ERROR_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst ERROR_TYPE = {\n\t/**\n\t * Unsupported device\n\t * @ko 미지원 기기\n\t * @name INVALID_DEVICE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 10\n\t */\n\tINVALID_DEVICE: 10,\n\t/**\n\t * Webgl not support\n\t * @ko WEBGL 미지원\n\t * @name NO_WEBGL\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 11\n\t */\n\tNO_WEBGL: 11,\n\t/**\n\t * Failed to load image\n\t * @ko 이미지 로드 실패\n\t * @name FAIL_IMAGE_LOAD\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 12\n\t */\n\tFAIL_IMAGE_LOAD: 12,\n\t/**\n\t * Failed to bind texture\n\t * @ko 텍스쳐 바인딩 실패\n\t * @name FAIL_BIND_TEXTURE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 13\n\t */\n\tFAIL_BIND_TEXTURE: 13,\n\t/**\n\t * Only one resource(image or video) should be specified\n\t * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t * @name INVALID_RESOURCE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 14\n\t */\n\tINVALID_RESOURCE: 14,\n\t/**\n\t * WebGL context lost occurred\n\t * @ko WebGL context lost 발생\n\t * @name RENDERING_CONTEXT_LOST\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 15\n\t */\n\tRENDERING_CONTEXT_LOST: 15,\n};\n\n/**\n * Constant value for events\n * @ko 이벤트에 대한 상수 값\n * @namespace\n * @name EVENTS\n * @memberof eg.view360.PanoViewer\n */\nconst EVENTS = {\n\t/**\n\t * Events that is fired when PanoViewer is ready to show image and handle user interaction.\n\t * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트\n\t * @name READY\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default ready\n\t */\n\tREADY: \"ready\",\n\t/**\n\t * Events that is fired when direction or fov is changed.\n\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t * @name VIEW_CHANGE\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default viewChange\n\t */\n\tVIEW_CHANGE: \"viewChange\",\n\t/**\n\t * Events that is fired when animation which is triggered by inertia is ended.\n\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t * @name ANIMATION_END\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default animationEnd\n\t */\n\tANIMATION_END: \"animationEnd\",\n\t/**\n\t * Events that is fired when error occurs\n\t * @ko 에러 발생 시 발생하는 이벤트\n\t * @name ERROR\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default error\n\t */\n\tERROR: \"error\"\n};\n\n/**\n * Constant value for projection type\n * @ko 프로젝션 타입 대한 상수 값\n * @namespace\n * @name PROJECTION_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst PROJECTION_TYPE = {\n\t/**\n\t * Constant value for equirectangular type.\n\t * @ko equirectangular 에 대한 상수 값.\n\t * @name EQUIRECTANGULAR\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default equirectangular\n\t */\n\tEQUIRECTANGULAR: \"equirectangular\",\n\t/**\n\t * Constant value for cubemap type.\n\t * @ko cubemap 에 대한 상수 값.\n\t * @name CUBEMAP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubemap\n\t */\n\tCUBEMAP: \"cubemap\",\n\t/**\n\t * Constant value for cubestrip type.\n\t * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC.\n\t *\n\t * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다.\n\t * @name CUBESTRIP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubestrip\n\t */\n\tCUBESTRIP: \"cubestrip\",\n\t/**\n\t * Constant value for PANORAMA type.\n\t *\n\t * PANORAMA is a format for a panorma image which is taken from smartphone.\n\t *\n\t * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다.\n\t *\n\t * @name PANORAMA\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default panorama\n\t */\n\tPANORAMA: \"panorama\",\n\t/**\n\t * Constant value for EQUI_STEREOSCOPY type.\n\t *\n\t * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present.\n\t *\n\t * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다.\n\t *\n\t * @name STEREOSCOPIC_EQUI\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default stereoequi\n\t */\n\tSTEREOSCOPIC_EQUI: \"stereoequi\",\n};\n\n/**\n * A constant value for the format of the stereoscopic equirectangular projection type.\n * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값\n * @namespace\n * @name STEREO_FORMAT\n * @memberof eg.view360.PanoViewer\n */\nconst STEREO_FORMAT = {\n\t/**\n\t * A constant value for format of top bottom stereoscopic 360 equirectangular projection.\n\t * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name TOP_BOTTOM\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dv\"\n\t */\n\tTOP_BOTTOM: \"3dv\",\n\t/**\n\t * A constant value for format of left right stereoscopic 360 equirectangular projection.\n\t * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name LEFT_RIGHT\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dh\"\n\t */\n\tLEFT_RIGHT: \"3dh\",\n\t/**\n\t * A constant value specifying media is not in stereoscopic format.\n\t * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값.\n\t * @name NONE\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"\"\n\t */\n\tNONE: \"\",\n};\n\nexport {\n\tGYRO_MODE,\n\tEVENTS,\n\tERROR_TYPE,\n\tPROJECTION_TYPE,\n\tSTEREO_FORMAT\n};\n","import Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {STEREO_FORMAT} from \"../../PanoViewer/consts\";\n\nconst latitudeBands = 60;\nconst longitudeBands = 60;\nconst radius = 2;\nconst ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\nlet latIdx;\nlet lngIdx;\n\nfor (latIdx = 0; latIdx <= latitudeBands; latIdx++) {\n\tconst theta = (latIdx / latitudeBands - 0.5) * Math.PI;\n\tconst sinTheta = Math.sin(theta);\n\tconst cosTheta = Math.cos(theta);\n\n\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\tconst phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN;\n\t\tconst sinPhi = Math.sin(phi);\n\t\tconst cosPhi = Math.cos(phi);\n\t\tconst x = cosPhi * cosTheta;\n\t\tconst y = sinTheta;\n\t\tconst z = sinPhi * cosTheta;\n\t\tconst u = lngIdx / longitudeBands;\n\t\tconst v = latIdx / latitudeBands;\n\n\t\ttextureCoordData.push(u, v);\n\t\tvertexPositionData.push(radius * x, radius * y, radius * z);\n\n\t\tif (lngIdx !== longitudeBands && latIdx !== latitudeBands) {\n\t\t\tconst a = latIdx * (longitudeBands + 1) + lngIdx;\n\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t}\n\t}\n}\n\nclass SphereRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tconstructor(format) {\n\t\tsuper();\n\n\t\tthis._stereoFormat = format;\n\t}\n\n\trender(ctx) {\n\t\tconst {gl, shaderProgram} = ctx;\n\n\t\tlet leftEyeScaleOffset;\n\t\tlet rightEyeScaleOffset;\n\n\t\tswitch (this._stereoFormat) {\n\t\t\tcase STEREO_FORMAT.TOP_BOTTOM:\n\t\t\t\tleftEyeScaleOffset = [1, 0.5, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 0.5, 0, 0.5];\n\t\t\t\tbreak;\n\t\t\tcase STEREO_FORMAT.LEFT_RIGHT:\n\t\t\t\tleftEyeScaleOffset = [0.5, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [0.5, 1, 0.5, 0];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tleftEyeScaleOffset = [1, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 1, 0, 0];\n\t\t}\n\n\t\tconst uTexScaleOffset = gl.getUniformLocation(shaderProgram, \"uTexScaleOffset\");\n\n\t\tgl.uniform4fv(uTexScaleOffset, [...leftEyeScaleOffset, ...rightEyeScaleOffset]);\n\n\t\tsuper.render(ctx);\n\t}\n\n\tgetVertexPositionData() {\n\t\treturn SphereRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn SphereRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn SphereRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n}\n\nexport default SphereRenderer;\n","import {glMatrix} from \"gl-matrix\";\nimport Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\n\n// const latitudeBands = 60;\nconst MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6;\nconst longitudeBands = 60;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\n\nclass CylinderRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tgetVertexPositionData() {\n\t\treturn CylinderRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn CylinderRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn CylinderRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\t\tlet resizeDimension;\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device texture limit(${maxSize}))`);\n\n\t\t\t// Request resizing texture.\n\t\t\t/**\n\t\t\t * TODO: Is it need to apply on another projection type?\n\t\t\t */\n\t\t\tresizeDimension = width > height ?\n\t\t\t\t{width: maxSize, height: maxSize * height / width} :\n\t\t\t\t{width: maxSize * width / height, height: maxSize};\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video or resizing needed\n\t\tthis._initPixelSource(image, resizeDimension);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\tupdateShaderData({imageAspectRatio = MIN_ASPECT_RATIO_FOR_FULL_PANORAMA}) {\n\t\tlet lngIdx;\n\t\tlet cylinderMaxRadian;\n\t\tlet halfCylinderY;\n\t\tlet rotated;\n\t\tlet aspectRatio;\n\n\t\t// Exception case: orientation is rotated.\n\t\tif (imageAspectRatio < 1) {\n\t\t\t/**\n\t\t\t * If rotated is true, we assume that image is rotated counter clockwise.\n\t\t\t * TODO: If there's other rotation, it is need to implement by each rotation.\n\t\t\t */\n\t\t\trotated = true;\n\t\t\taspectRatio = 1 / imageAspectRatio;\n\t\t} else {\n\t\t\trotated = false;\n\t\t\taspectRatio = imageAspectRatio;\n\t\t}\n\n\t\tif (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) {\n\t\t\tconst fov = 360 / aspectRatio;\n\n\t\t\tcylinderMaxRadian = 2 * Math.PI; // 360 deg\n\t\t\thalfCylinderY = Math.tan(glMatrix.toRadian(fov / 2));\n\t\t} else {\n\t\t\tcylinderMaxRadian = aspectRatio;\n\t\t\thalfCylinderY = 0.5;// Range of cylinder is [-0.5, 0.5] to make height to 1.\n\t\t}\n\n\t\t// intialize shader data before update\n\t\ttextureCoordData.length = 0;\n\t\tvertexPositionData.length = 0;\n\t\tindexData.length = 0;\n\n\t\tconst CYLIDER_Y = [-halfCylinderY, halfCylinderY];\n\t\tconst startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360)\n\n\t\t// console.log(\"cylinderMaxRadian:\", glMatrix.toDegree(cylinderMaxRadian), \"CYLIDER_Y\", CYLIDER_Y, \"start angle\", glMatrix.toDegree(startAngleForCenterAlign));\n\t\tfor (let yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength/* bottom & top */; yIdx++) {\n\t\t\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\t\t\tconst angle = startAngleForCenterAlign + (lngIdx / longitudeBands * cylinderMaxRadian);\n\t\t\t\tconst x = Math.cos(angle);\n\t\t\t\tconst y = CYLIDER_Y[yIdx];\n\t\t\t\tconst z = Math.sin(angle);\n\t\t\t\tlet u;\n\t\t\t\tlet v;\n\n\t\t\t\tif (rotated) {\n\t\t\t\t\t// Rotated 90 degree (counter clock wise)\n\t\t\t\t\tu = 1 - yIdx; // yLength - yIdx;\n\t\t\t\t\tv = lngIdx / longitudeBands;\n\t\t\t\t} else {\n\t\t\t\t// \t// Normal case (Not rotated)\n\t\t\t\t\tu = lngIdx / longitudeBands;\n\t\t\t\t\tv = yIdx;\n\t\t\t\t}\n\n\t\t\t\ttextureCoordData.push(u, v);\n\t\t\t\tvertexPositionData.push(x, y, z);\n\n\t\t\t\tif (yIdx === 0 && lngIdx < longitudeBands) {\n\t\t\t\t\tconst a = lngIdx;\n\t\t\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default CylinderRenderer;\n","import {mat4} from \"gl-matrix\";\n\nconst VR_DISPLAY_PRESENT_CHANGE = \"vrdisplaypresentchange\";\nconst DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1];\nconst DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1];\nconst EYES = {\n\tLEFT: \"left\",\n\tRIGHT: \"right\"\n};\n\nclass VRManager {\n\tget context() { return this._vrDisplay; }\n\n\tconstructor() {\n\t\tthis._frameData = new window.VRFrameData();\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst vrDisplay = this._vrDisplay;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (vrDisplay && vrDisplay.isPresenting) {\n\t\t\tvrDisplay.exitPresent();\n\t\t}\n\n\t\tthis._clear();\n\t}\n\n\tcanRender() {\n\t\treturn Boolean(this._vrDisplay);\n\t}\n\n\tbeforeRender(gl) {\n\t\t// Render to the default backbuffer\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t}\n\n\tafterRender() {\n\t\tthis._vrDisplay.submitFrame();\n\t}\n\n\tgetEyeParams(gl) {\n\t\tconst display = this._vrDisplay;\n\t\tconst halfWidth = gl.drawingBufferWidth * 0.5;\n\t\tconst height = gl.drawingBufferHeight;\n\t\tconst frameData = this._frameData;\n\n\t\tdisplay.getFrameData(frameData);\n\n\t\tconst leftMVMatrix = frameData.leftViewMatrix;\n\t\tconst rightMVMatrix = frameData.rightViewMatrix;\n\n\t\tmat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset);\n\t\tmat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tviewport: [0, 0, halfWidth, height],\n\t\t\t\tmvMatrix: leftMVMatrix,\n\t\t\t\tpMatrix: frameData.leftProjectionMatrix,\n\t\t\t},\n\t\t\t{\n\t\t\t\tviewport: [halfWidth, 0, halfWidth, height],\n\t\t\t\tmvMatrix: rightMVMatrix,\n\t\t\t\tpMatrix: frameData.rightProjectionMatrix,\n\t\t\t}\n\t\t];\n\t}\n\n\tisPresenting() {\n\t\treturn Boolean(this._vrDisplay && this._vrDisplay.isPresenting);\n\t}\n\n\taddEndCallback(callback) {\n\t\twindow.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\twindow.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\trequestPresent(canvas) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tnavigator.getVRDisplays().then(displays => {\n\t\t\t\tconst vrDisplay = displays.length && displays[0];\n\n\t\t\t\tif (!vrDisplay) {\n\t\t\t\t\treject(new Error(\"No displays available.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!vrDisplay.capabilities.canPresent) {\n\t\t\t\t\treject(new Error(\"Display lacking capability to present.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvrDisplay.requestPresent([{source: canvas}]).then(() => {\n\t\t\t\t\tconst leftEye = vrDisplay.getEyeParameters(EYES.LEFT);\n\t\t\t\t\tconst rightEye = vrDisplay.getEyeParameters(EYES.RIGHT);\n\n\t\t\t\t\tcanvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;\n\t\t\t\t\tcanvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);\n\n\t\t\t\t\tthis._setDisplay(vrDisplay);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setDisplay(vrDisplay) {\n\t\tthis._vrDisplay = vrDisplay;\n\n\t\tconst layers = vrDisplay.getLayers();\n\n\t\tif (layers.length) {\n\t\t\tconst layer = layers[0];\n\n\t\t\tthis._leftBounds = layer.leftBounds;\n\t\t\tthis._rightBounds = layer.rightBounds;\n\t\t}\n\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._vrDisplay = null;\n\t\tthis._leftBounds = DEFAULT_LEFT_BOUNDS;\n\t\tthis._rightBounds = DEFAULT_RIGHT_BOUNDS;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default VRManager;\n","import {mat4, glMatrix} from \"gl-matrix\";\nimport {IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\n\nconst XR_REFERENCE_SPACE = \"local\";\n\nclass XRManager {\n\tget context() { return this._xrSession; }\n\n\tconstructor() {\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst xrSession = this._xrSession;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (xrSession) {\n\t\t\t// Capture to avoid errors\n\t\t\txrSession.end().then(() => {}, () => {});\n\t\t}\n\t\tthis._clear();\n\t}\n\n\tcanRender(frame) {\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\treturn Boolean(pose);\n\t}\n\n\tbeforeRender(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst baseLayer = session.renderState.baseLayer;\n\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer);\n\t}\n\n\tafterRender() {}\n\n\tgetEyeParams(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\tif (!pose) {\n\t\t\t// Can't render\n\t\t\treturn null;\n\t\t}\n\n\t\tconst glLayer = session.renderState.baseLayer;\n\n\t\treturn pose.views.map(view => {\n\t\t\tconst viewport = glLayer.getViewport(view);\n\t\t\tconst mvMatrix = view.transform.inverse.matrix;\n\n\t\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\t\tmat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180));\n\t\t\t}\n\n\t\t\tmat4.rotateY(mvMatrix, mvMatrix, this._yawOffset);\n\n\t\t\treturn {\n\t\t\t\tviewport: [viewport.x, viewport.y, viewport.width, viewport.height],\n\t\t\t\tmvMatrix,\n\t\t\t\tpMatrix: view.projectionMatrix\n\t\t\t};\n\t\t});\n\t}\n\n\tisPresenting() {\n\t\treturn this._presenting;\n\t}\n\n\taddEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.addEventListener(\"end\", callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.removeEventListener(\"end\", callback);\n\t}\n\n\trequestPresent(canvas, gl) {\n\t\treturn navigator.xr.requestSession(\"immersive-vr\", {\n\t\t\trequiredFeatures: [XR_REFERENCE_SPACE],\n\t\t}).then(session => {\n\t\t\tconst xrLayer = new window.XRWebGLLayer(session, gl);\n\n\t\t\tsession.updateRenderState({baseLayer: xrLayer});\n\t\t\treturn session.requestReferenceSpace(XR_REFERENCE_SPACE)\n\t\t\t\t.then(refSpace => {\n\t\t\t\t\tthis._setSession(session, xrLayer, refSpace);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setSession(session, xrLayer, refSpace) {\n\t\tthis._xrSession = session;\n\t\tthis._xrLayer = xrLayer;\n\t\tthis._xrRefSpace = refSpace;\n\t\tthis._presenting = true;\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._xrSession = null;\n\t\tthis._xrLayer = null;\n\t\tthis._xrRefSpace = null;\n\t\tthis._presenting = false;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default XRManager;\n","import {IS_SAFARI_ON_DESKTOP} from \"../utils/browser\";\n\nclass WebGLAnimator {\n\tconstructor() {\n\t\tthis._callback = null;\n\t\tthis._context = window;\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\tsetCallback(callback) {\n\t\tthis._callback = callback;\n\t}\n\n\tsetContext(context) {\n\t\tthis._context = context;\n\t}\n\n\tstart() {\n\t\tconst context = this._context;\n\t\tconst callback = this._callback;\n\n\t\t// No context / callback set\n\t\tif (!context || !callback) return;\n\t\t// Animation already started\n\t\tif (this._rafId >= 0 || this._rafTimer >= 0) return;\n\n\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoopNextTick);\n\t\t} else {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoop);\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this._rafId >= 0) {\n\t\t\tthis._context.cancelAnimationFrame(this._rafId);\n\t\t}\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t}\n\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\t/**\n\t * There can be more than 1 argument when we use XRSession's raf\n\t */\n\t_onLoop = (...args) => {\n\t\tthis._callback(...args);\n\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t}\n\n\t/**\n\t * MacOS X Safari Bug Fix\n\t * This code guarantees that rendering should be occurred.\n\t *\n\t * In MacOS X(10.14.2), Safari (12.0.2)\n\t * The requestAnimationFrame(RAF) callback is called just after previous RAF callback without term\n\t * only if requestAnimationFrame is called for next frame while updating frame is delayed (~over 2ms)\n\t * So browser cannot render the frame and may be freezing.\n\t */\n\t_onLoopNextTick = (...args) => {\n\t\tconst before = performance.now();\n\n\t\tthis._callback(...args);\n\n\t\tconst diff = performance.now() - before;\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t\tthis._rafTimer = -1;\n\t\t}\n\n\t\t/** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */\n\t\tif (diff < 16) {\n\t\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t\t} else {\n\t\t\t/** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/\n\t\t\tthis._rafTimer = setTimeout(this._onLoop, 0);\n\t\t}\n\t}\n}\n\nexport default WebGLAnimator;\n","import Component from \"@egjs/component\";\nimport {glMatrix, vec3, mat3, mat4, quat} from \"gl-matrix\";\nimport ImageLoader from \"./ImageLoader\";\nimport VideoLoader from \"./VideoLoader\";\nimport WebGLUtils from \"./WebGLUtils\";\nimport Renderer from \"./renderer/Renderer\";\nimport CubeRenderer from \"./renderer/CubeRenderer\";\nimport CubeStripRenderer from \"./renderer/CubeStripRenderer\";\nimport SphereRenderer from \"./renderer/SphereRenderer\";\nimport CylinderRenderer from \"./renderer/CylinderRenderer\";\nimport VRManager from \"./vr/VRManager\";\nimport XRManager from \"./vr/XRManager\";\nimport WebGLAnimator from \"./WebGLAnimator\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {devicePixelRatio, WEBXR_SUPPORTED} from \"../utils/browserFeature\";\nimport {PROJECTION_TYPE, STEREO_FORMAT} from \"../PanoViewer/consts\";\nimport {IS_IOS} from \"../utils/browser\";\n\nconst ImageType = PROJECTION_TYPE;\n\nlet DEVICE_PIXEL_RATIO = devicePixelRatio || 1;\n\n// DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다.\nif (DEVICE_PIXEL_RATIO > 2) {\n\tDEVICE_PIXEL_RATIO = 2;\n}\n\n// define custom events name\n/**\n * TODO: how to manage events/errortype with PanoViewer\n *\n * I think renderer events should be seperated from viewer events although it has same name.\n */\nconst EVENTS = {\n\tBIND_TEXTURE: \"bindTexture\",\n\tIMAGE_LOADED: \"imageLoaded\",\n\tERROR: \"error\",\n\tRENDERING_CONTEXT_LOST: \"renderingContextLost\",\n\tRENDERING_CONTEXT_RESTORE: \"renderingContextRestore\",\n};\n\nconst ERROR_TYPE = {\n\tINVALID_DEVICE: 10,\n\tNO_WEBGL: 11,\n\tFAIL_IMAGE_LOAD: 12,\n\tRENDERER_ERROR: 13\n};\n\nclass PanoImageRenderer extends Component {\n\tstatic EVENTS = EVENTS;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\n\tconstructor(\n\t\timage, width, height, isVideo, sphericalConfig, renderingContextAttributes\n\t) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis.sphericalConfig = sphericalConfig;\n\t\tthis.fieldOfView = sphericalConfig.fieldOfView;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tthis._lastQuaternion = null;\n\t\tthis._lastYaw = null;\n\t\tthis._lastPitch = null;\n\t\tthis._lastFieldOfView = null;\n\n\t\tthis.pMatrix = mat4.create();\n\t\tthis.mvMatrix = mat4.create();\n\n\t\t// initialzie pMatrix\n\t\tmat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), width / height, 0.1, 100);\n\n\t\tthis.textureCoordBuffer = null;\n\t\tthis.vertexBuffer = null;\n\t\tthis.indexBuffer = null;\n\n\t\tthis.canvas = this._initCanvas(width, height);\n\t\tthis._setDefaultCanvasStyle();\n\t\tthis._wrapper = null; // canvas wrapper\n\t\tthis._wrapperOrigStyle = null;\n\n\t\tthis._renderingContextAttributes = renderingContextAttributes;\n\t\tthis._image = null;\n\t\tthis._imageConfig = null;\n\t\tthis._imageIsReady = false;\n\t\tthis._shouldForceDraw = false;\n\t\tthis._keepUpdate = false; // Flag to specify 'continuous update' on video even when still.\n\n\t\tthis._onContentLoad = this._onContentLoad.bind(this);\n\t\tthis._onContentError = \tthis._onContentError.bind(this);\n\n\t\tthis._animator = new WebGLAnimator();\n\n\t\t// VR/XR manager\n\t\tthis._vr = null;\n\n\t\tif (image) {\n\t\t\tthis.setImage({\n\t\t\t\timage,\n\t\t\t\timageType: sphericalConfig.imageType,\n\t\t\t\tisVideo,\n\t\t\t\tcubemapConfig: sphericalConfig.cubemapConfig\n\t\t\t});\n\t\t}\n\t}\n\n\t// FIXME: Please refactor me to have more loose connection to yawpitchcontrol\n\tsetYawPitchControl(yawPitchControl) {\n\t\tthis._yawPitchControl = yawPitchControl;\n\t}\n\n\tgetContent() {\n\t\treturn this._image;\n\t}\n\n\tsetImage({image, imageType, isVideo = false, cubemapConfig}) {\n\t\tthis._imageIsReady = false;\n\t\tthis._isVideo = isVideo;\n\t\tthis._imageConfig = Object.assign(\n\t\t\t{\n\t\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only */\n\t\t\t\torder: (imageType === ImageType.CUBEMAP) ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\t\ttileConfig: {\n\t\t\t\t\tflipHorizontal: false,\n\t\t\t\t\trotation: 0\n\t\t\t\t}\n\t\t\t},\n\t\t\tcubemapConfig\n\t\t);\n\t\tthis._setImageType(imageType);\n\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tif (isVideo) {\n\t\t\tthis._contentLoader = new VideoLoader();\n\t\t\tthis._keepUpdate = true;\n\t\t} else {\n\t\t\tthis._contentLoader = new ImageLoader();\n\t\t\tthis._keepUpdate = false;\n\t\t}\n\n\t\t// img element or img url\n\t\tthis._contentLoader.set(image);\n\n\t\t// 이미지의 사이즈를 캐시한다.\n\t\t// image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed.\n\t\tthis._image = this._contentLoader.getElement();\n\n\t\treturn this._contentLoader.get()\n\t\t\t.then(this._onContentLoad, this._onContentError)\n\t\t\t.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.\n\t}\n\n\t_setImageType(imageType) {\n\t\tif (!imageType || this._imageType === imageType) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._imageType = imageType;\n\t\tthis._isCubeMap = imageType === ImageType.CUBEMAP;\n\n\t\tif (this._renderer) {\n\t\t\tthis._renderer.off();\n\t\t}\n\n\t\tswitch (imageType) {\n\t\t\tcase ImageType.CUBEMAP:\n\t\t\t\tthis._renderer = new CubeRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.CUBESTRIP:\n\t\t\t\tthis._renderer = new CubeStripRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.PANORAMA:\n\t\t\t\tthis._renderer = new CylinderRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.STEREOSCOPIC_EQUI:\n\t\t\t\tthis._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis._renderer = new SphereRenderer(STEREO_FORMAT.NONE);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis._renderer.on(Renderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERER_ERROR,\n\t\t\t\tmessage: e.message\n\t\t\t});\n\t\t});\n\n\t\tthis._initWebGL();\n\t}\n\n\t_initCanvas(width, height) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\n\t\tthis._onWebglcontextlost = this._onWebglcontextlost.bind(this);\n\t\tthis._onWebglcontextrestored = this._onWebglcontextrestored.bind(this);\n\n\t\tcanvas.addEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tcanvas.addEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\n\t\treturn canvas;\n\t}\n\n\t_setDefaultCanvasStyle() {\n\t\tconst canvas = this.canvas;\n\n\t\tcanvas.style.bottom = 0;\n\t\tcanvas.style.left = 0;\n\t\tcanvas.style.right = 0;\n\t\tcanvas.style.top = 0;\n\t\tcanvas.style.margin = \"auto\";\n\t\tcanvas.style.maxHeight = \"100%\";\n\t\tcanvas.style.maxWidth = \"100%\";\n\t\tcanvas.style.outline = \"none\";\n\t\tcanvas.style.position = \"absolute\";\n\t}\n\n\t_onContentError(error) {\n\t\tthis._imageIsReady = false;\n\t\tthis._image = null;\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\ttype: ERROR_TYPE.FAIL_IMAGE_LOAD,\n\t\t\tmessage: \"failed to load image\"\n\t\t});\n\n\t\treturn false;\n\t}\n\n\t_triggerContentLoad() {\n\t\tthis.trigger(EVENTS.IMAGE_LOADED, {\n\t\t\tcontent: this._image,\n\t\t\tisVideo: this._isVideo,\n\t\t\tprojectionType: this._imageType\n\t\t});\n\t}\n\t_onContentLoad(image) {\n\t\tthis._imageIsReady = true;\n\n\t\tthis._triggerContentLoad();\n\t\treturn true;\n\t}\n\n\tisImageLoaded() {\n\t\treturn !!this._image && this._imageIsReady &&\n\t\t\t(!this._isVideo || this._image.readyState >= 2 /* HAVE_CURRENT_DATA */);\n\t}\n\n\tbindTexture() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._contentLoader) {\n\t\t\t\trej(\"ImageLoader is not initialized\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._contentLoader.get()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis._bindTexture();\n\t\t\t\t}, rej)\n\t\t\t\t.then(res);\n\t\t});\n\t}\n\n\t// 부모 엘리먼트에 canvas 를 붙임\n\tattachTo(parentElement) {\n\t\tthis.detach();\n\t\tparentElement.appendChild(this.canvas);\n\t\tthis._wrapper = parentElement;\n\t}\n\n\tforceContextLoss() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\tconst loseContextExtension = this.context.getExtension(\"WEBGL_lose_context\");\n\n\t\t\tif (loseContextExtension) {\n\t\t\t\tloseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t}\n\n\t// 부모 엘리먼트에서 canvas 를 제거\n\tdetach() {\n\t\tif (this.canvas.parentElement) {\n\t\t\tthis.canvas.parentElement.removeChild(this.canvas);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tthis._animator.stop();\n\t\tthis.detach();\n\t\tthis.forceContextLoss();\n\n\t\tthis.off();\n\n\t\tthis.canvas.removeEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tthis.canvas.removeEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\t}\n\n\thasRenderingContext() {\n\t\tif (!(this.context && !this.context.isContextLost())) {\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tthis.context &&\n\t\t\t!this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t_initShaderProgram() {\n\t\tconst gl = this.context;\n\n\t\tif (this.shaderProgram) {\n\t\t\tgl.deleteProgram(this.shaderProgram);\n\t\t\tthis.shaderProgram = null;\n\t\t}\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst vsSource = renderer.getVertexShaderSource();\n\t\tconst fsSource = renderer.getFragmentShaderSource();\n\n\t\tconst vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource);\n\t\tconst fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource);\n\n\t\tconst shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader);\n\n\t\tif (!shaderProgram) {\n\t\t\tthrow new Error(`Failed to intialize shaders: ${WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())}`);\n\t\t}\n\n\t\tgl.useProgram(shaderProgram);\n\t\tshaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\");\n\t\tgl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);\n\t\tshaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, \"uPMatrix\");\n\t\tshaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, \"uMVMatrix\");\n\t\tshaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, \"uSampler\");\n\t\tshaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, \"aTextureCoord\");\n\t\tshaderProgram.uEye = gl.getUniformLocation(shaderProgram, \"uEye\");\n\n\t\tgl.enableVertexAttribArray(shaderProgram.textureCoordAttribute);\n\n\t\t// clear buffer\n\t\tgl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n\t\t// Use TEXTURE0\n\t\tgl.uniform1i(shaderProgram.samplerUniform, 0);\n\n\t\tthis.shaderProgram = shaderProgram;\n\t}\n\n\t_onWebglcontextlost(e) {\n\t\te.preventDefault();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_LOST);\n\t}\n\n\t_onWebglcontextrestored(e) {\n\t\tthis._initWebGL();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_RESTORE);\n\t}\n\n\tupdateFieldOfView(fieldOfView) {\n\t\tthis.fieldOfView = fieldOfView;\n\t\tthis._updateViewport();\n\t}\n\n\tupdateViewportDimensions(width, height) {\n\t\tlet viewPortChanged = false;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tconst w = width * DEVICE_PIXEL_RATIO;\n\t\tconst h = height * DEVICE_PIXEL_RATIO;\n\n\t\tif (w !== this.canvas.width) {\n\t\t\tthis.canvas.width = w;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (h !== this.canvas.height) {\n\t\t\tthis.canvas.height = h;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (!viewPortChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._updateViewport();\n\t\tthis._shouldForceDraw = true;\n\t}\n\n\t_updateViewport() {\n\t\tmat4.perspective(\n\t\t\tthis.pMatrix,\n\t\t\tglMatrix.toRadian(this.fieldOfView),\n\t\t\tthis.canvas.width / this.canvas.height,\n\t\t\t0.1,\n\t\t\t100);\n\n\t\tthis.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight);\n\t}\n\n\t_initWebGL() {\n\t\tlet gl;\n\n\t\t// TODO: Following code does need to be executed only if width/height, cubicStrip property is changed.\n\t\ttry {\n\t\t\tthis._initRenderingContext();\n\t\t\tgl = this.context;\n\n\t\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\t\tthis._initShaderProgram();\n\t\t} catch (e) {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\tmessage: \"no webgl support\"\n\t\t\t});\n\t\t\tthis.destroy();\n\t\t\tconsole.error(e); // eslint-disable-line no-console\n\t\t\treturn;\n\t\t}\n\t\t// 캔버스를 투명으로 채운다.\n\t\tgl.clearColor(0, 0, 0, 0);\n\t\tconst textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n\n\t\tif (this.texture) {\n\t\t\tgl.deleteTexture(this.texture);\n\t\t}\n\n\t\tthis.texture = WebGLUtils.createTexture(gl, textureTarget);\n\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\t// TODO: Apply following options on other projection type.\n\t\t\tgl.enable(gl.CULL_FACE);\n\t\t\t// gl.enable(gl.DEPTH_TEST);\n\t\t}\n\t}\n\n\t_initRenderingContext() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!window.WebGLRenderingContext) {\n\t\t\tthrow new Error(\"WebGLRenderingContext not available.\");\n\t\t}\n\n\t\tthis.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes);\n\n\t\tif (!this.context) {\n\t\t\tthrow new Error(\"Failed to acquire 3D rendering context\");\n\t\t}\n\t}\n\n\t_initBuffers() {\n\t\tconst vertexPositionData = this._renderer.getVertexPositionData();\n\t\tconst indexData = this._renderer.getIndexData();\n\t\tconst textureCoordData = this._renderer.getTextureCoordData(this._imageConfig);\n\t\tconst gl = this.context;\n\n\t\tthis.vertexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3,\n\t\t\tthis.shaderProgram.vertexPositionAttribute);\n\n\t\tthis.indexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1);\n\n\t\tthis.textureCoordBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2,\n\t\t\tthis.shaderProgram.textureCoordAttribute);\n\n\t\tthis._bindBuffers();\n\t}\n\n\t_bindTexture() {\n\t\t// Detect if it is EAC Format while CUBESTRIP mode.\n\t\t// We assume it is EAC if image is not 3/2 ratio.\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst isEAC = width && height && width / height !== 1.5;\n\n\t\t\tthis.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, \"uIsEAC\"), isEAC);\n\t\t} else if (this._imageType === ImageType.PANORAMA) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst imageAspectRatio = width && height && width / height;\n\n\t\t\tthis._renderer.updateShaderData({imageAspectRatio});\n\t\t}\n\n\t\t// intialize shader buffers after image is loaded.(by updateShaderData)\n\t\t// because buffer may be differ by image size.(eg. CylinderRenderer)\n\t\tthis._initBuffers();\n\n\t\tthis._renderer.bindTexture(\n\t\t\tthis.context,\n\t\t\tthis.texture,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t\tthis._shouldForceDraw = true;\n\n\t\tthis.trigger(EVENTS.BIND_TEXTURE);\n\t}\n\n\t_updateTexture() {\n\t\tthis._renderer.updateTexture(\n\t\t\tthis.context,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t}\n\n\tkeepUpdate(doUpdate) {\n\t\tif (doUpdate && this.isImageLoaded() === false) {\n\t\t\t// Force to draw a frame after image is loaded on render()\n\t\t\tthis._shouldForceDraw = true;\n\t\t}\n\n\t\tthis._keepUpdate = doUpdate;\n\t}\n\n\tstartRender() {\n\t\tthis._animator.setCallback(this._render.bind(this));\n\t\tthis._animator.start();\n\t}\n\n\tstopRender() {\n\t\tthis._animator.stop();\n\t}\n\n\trenderWithQuaternion(quaternion, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\tthis._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) &&\n\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// updatefieldOfView only if fieldOfView is changed.\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tthis.mvMatrix = mat4.fromQuat(mat4.create(), quaternion);\n\n\t\tthis._draw();\n\n\t\tthis._lastQuaternion = quat.clone(quaternion);\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\trenderWithYawPitch(yaw, pitch, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\t\tthis._lastYaw !== null && this._lastYaw === yaw &&\n\t\t\t\tthis._lastPitch !== null && this._lastPitch === pitch &&\n\t\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch));\n\t\tmat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw));\n\n\t\tthis._draw();\n\n\t\tthis._lastYaw = yaw;\n\t\tthis._lastPitch = pitch;\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\t_render() {\n\t\tconst yawPitchControl = this._yawPitchControl;\n\t\tconst fov = yawPitchControl.getFov();\n\n\t\tif (yawPitchControl.shouldRenderWithQuaternion()) {\n\t\t\tconst quaternion = yawPitchControl.getQuaternion();\n\n\t\t\tthis.renderWithQuaternion(quaternion, fov);\n\t\t} else {\n\t\t\tconst yawPitch = yawPitchControl.getYawPitch();\n\n\t\t\tthis.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov);\n\t\t}\n\t}\n\n\t_renderStereo = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\n\t\tconst eyeParams = vr.getEyeParams(gl, frame);\n\n\t\tif (!eyeParams) return;\n\n\t\tvr.beforeRender(gl, frame);\n\n\t\t// Render both eyes\n\t\tfor (const eyeIndex of [0, 1]) {\n\t\t\tconst eyeParam = eyeParams[eyeIndex];\n\n\t\t\tthis.mvMatrix = eyeParam.mvMatrix;\n\t\t\tthis.pMatrix = eyeParam.pMatrix;\n\n\t\t\tgl.viewport(...eyeParam.viewport);\n\t\t\tgl.uniform1f(this.shaderProgram.uEye, eyeIndex);\n\n\t\t\tthis._bindBuffers();\n\t\t\tthis._draw();\n\t\t}\n\n\t\tvr.afterRender();\n\t}\n\n\t_bindBuffers() {\n\t\tconst gl = this.context;\n\t\tconst program = this.shaderProgram;\n\n\t\tconst vertexBuffer = this.vertexBuffer;\n\t\tconst textureCoordBuffer = this.textureCoordBuffer;\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\t\tgl.enableVertexAttribArray(program.vertexPositionAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\n\t\tgl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\t\tgl.enableVertexAttribArray(program.textureCoordAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\t}\n\n\t_draw() {\n\t\tif (this._isVideo && this._keepUpdate) {\n\t\t\tthis._updateTexture();\n\t\t}\n\n\t\tthis._renderer.render({\n\t\t\tgl: this.context,\n\t\t\tshaderProgram: this.shaderProgram,\n\t\t\tindexBuffer: this.indexBuffer,\n\t\t\tmvMatrix: this.mvMatrix,\n\t\t\tpMatrix: this.pMatrix,\n\t\t});\n\t}\n\n\t/**\n\t * Returns projection renderer by each type\n\t */\n\tgetProjectionRenderer() {\n\t\treturn this._renderer;\n\t}\n\n\t/**\n\t * @return Promise\n\t */\n\tenterVR() {\n\t\tconst vr = this._vr;\n\n\t\tif (!WEBXR_SUPPORTED && !navigator.getVRDisplays) {\n\t\t\treturn Promise.reject(\"VR is not available on this browser.\");\n\t\t}\n\t\tif (vr && vr.isPresenting()) {\n\t\t\treturn Promise.resolve(\"VR already enabled.\");\n\t\t}\n\n\t\treturn this._requestPresent();\n\t}\n\n\texitVR = () => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\tif (!vr) return;\n\n\t\tvr.removeEndCallback(this.exitVR);\n\t\tvr.destroy();\n\t\tthis._vr = null;\n\n\t\t// Restore canvas & context on iOS\n\t\tif (IS_IOS) {\n\t\t\tthis._restoreStyle();\n\t\t}\n\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\tthis._updateViewport();\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t\tthis._bindBuffers();\n\t\tthis._shouldForceDraw = true;\n\n\t\tanimator.stop();\n\t\tanimator.setContext(window);\n\t\tanimator.setCallback(this._render.bind(this));\n\t\tanimator.start();\n\t}\n\n\t_requestPresent() {\n\t\tconst gl = this.context;\n\t\tconst canvas = this.canvas;\n\t\tconst animator = this._animator;\n\n\t\tthis._vr = WEBXR_SUPPORTED ?\n\t\t\tnew XRManager() :\n\t\t\tnew VRManager();\n\n\t\tconst vr = this._vr;\n\n\t\tanimator.stop();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvr.requestPresent(canvas, gl)\n\t\t\t\t.then(() => {\n\t\t\t\t\tvr.addEndCallback(this.exitVR);\n\t\t\t\t\tanimator.setContext(vr.context);\n\t\t\t\t\tanimator.setCallback(this._onFirstVRFrame);\n\n\t\t\t\t\tif (IS_IOS) {\n\t\t\t\t\t\tthis._setWrapperFullscreen();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shouldForceDraw = true;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\tresolve(\"success\");\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tvr.destroy();\n\t\t\t\t\tthis._vr = null;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t});\n\t}\n\n\t_onFirstVRFrame = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\t// If rendering is not ready, wait for next frame\n\t\tif (!vr.canRender(frame)) return;\n\n\t\tconst minusZDir = vec3.fromValues(0, 0, -1);\n\t\tconst eyeParam = vr.getEyeParams(gl, frame)[0];\n\t\t// Extract only rotation\n\t\tconst mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix);\n\t\tconst pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix);\n\n\t\tconst mvInv = mat3.invert(mat3.create(), mvMatrix);\n\t\tconst pInv = mat3.invert(mat3.create(), pMatrix);\n\t\tconst viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv);\n\n\t\tvec3.transformMat3(viewDir, viewDir, mvInv);\n\n\t\tconst yawOffset = mathUtil.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1));\n\n\t\tif (yawOffset === 0) {\n\t\t\t// If the yawOffset is exactly 0, then device sensor is not ready\n\t\t\t// So read it again until it has any value in it\n\t\t\treturn;\n\t\t}\n\n\t\tvr.setYawOffset(yawOffset);\n\t\tanimator.setCallback(this._renderStereo);\n\t}\n\n\t_setWrapperFullscreen() {\n\t\tconst wrapper = this._wrapper;\n\n\t\tif (!wrapper) return;\n\n\t\tthis._wrapperOrigStyle = wrapper.getAttribute(\"style\");\n\t\tconst wrapperStyle = wrapper.style;\n\n\t\twrapperStyle.width = \"100vw\";\n\t\twrapperStyle.height = \"100vh\";\n\t\twrapperStyle.position = \"fixed\";\n\t\twrapperStyle.left = \"0\";\n\t\twrapperStyle.top = \"0\";\n\t\twrapperStyle.zIndex = \"9999\";\n\t}\n\n\t_restoreStyle() {\n\t\tconst wrapper = this._wrapper;\n\t\tconst canvas = this.canvas;\n\n\t\tif (!wrapper) return;\n\n\t\tif (this._wrapperOrigStyle) {\n\t\t\twrapper.setAttribute(\"style\", this._wrapperOrigStyle);\n\t\t} else {\n\t\t\twrapper.removeAttribute(\"style\");\n\t\t}\n\n\t\tthis._wrapperOrigStyle = null;\n\n\t\t// Restore canvas style\n\t\tcanvas.removeAttribute(\"style\");\n\t\tthis._setDefaultCanvasStyle();\n\t}\n}\n\nexport default PanoImageRenderer;\n","import Component from \"@egjs/component\";\nimport {glMatrix} from \"gl-matrix\";\nimport {\n\tDeviceMotionEvent, checkXRSupport\n} from \"../utils/browserFeature\";\n\nimport YawPitchControl from \"../YawPitchControl/YawPitchControl\";\nimport PanoImageRenderer from \"../PanoImageRenderer/PanoImageRenderer\";\nimport WebGLUtils from \"../PanoImageRenderer/WebGLUtils\";\nimport {ERROR_TYPE, EVENTS, GYRO_MODE, PROJECTION_TYPE, STEREO_FORMAT} from \"./consts\";\nimport {util as mathUtil} from \"../utils/math-util.js\";\nimport {VERSION} from \"../version\";\n\nclass PanoViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.PanoViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic VERSION = VERSION;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\tstatic EVENTS = EVENTS;\n\tstatic PROJECTION_TYPE = PROJECTION_TYPE;\n\tstatic GYRO_MODE = GYRO_MODE;\n\t// It should be deprecated!\n\tstatic ProjectionType = PROJECTION_TYPE;\n\tstatic STEREO_FORMAT = STEREO_FORMAT;\n\t/**\n\t * Constant value for touch directions\n\t * @ko 터치 방향에 대한 상수 값.\n\t * @namespace\n\t * @name TOUCH_DIRECTION\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic TOUCH_DIRECTION = {\n\t\t/**\n\t\t * Constant value for none direction.\n\t\t * @ko none 방향에 대한 상수 값.\n\t\t * @name NONE\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 1\n\t\t */\n\t\tNONE: YawPitchControl.TOUCH_DIRECTION_NONE,\n\t\t/**\n\t\t * Constant value for horizontal(yaw) direction.\n\t\t * @ko horizontal(yaw) 방향에 대한 상수 값.\n\t\t * @name YAW\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 6\n\t\t */\n\t\tYAW: YawPitchControl.TOUCH_DIRECTION_YAW,\n\t\t/**\n\t\t * Constant value for vertical direction.\n\t\t * @ko vertical(pitch) 방향에 대한 상수 값.\n\t\t * @name PITCH\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 24\n\t\t */\n\t\tPITCH: YawPitchControl.TOUCH_DIRECTION_PITCH,\n\t\t/**\n\t\t * Constant value for all direction.\n\t\t * @ko all 방향에 대한 상수 값.\n\t\t * @name ALL\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 30\n\t\t */\n\t\tALL: YawPitchControl.TOUCH_DIRECTION_ALL\n\t};\n\n\t/**\n\t * @classdesc 360 media viewer\n\t * @ko 360 미디어 뷰어\n\t * @class\n\t * @name eg.view360.PanoViewer\n\t * @extends eg.Component\n\t *\n\t * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트\n\t * @param {Object} config\n\t *\n\t * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
\n\t * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.\n\t * @param {Object} [config.cubemapConfig.order = \"RLUDBF\"(ProjectionType === CUBEMAP) | \"RLUDFB\" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서\n\t * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.\n\t * @param {String} [config.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
\n\t * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위)\n\t * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위)\n\t *\n\t * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위)\n\t * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위)\n\t * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위)\n\t * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다\n\t * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다.\n\t * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE}
\n\t * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위\n\t * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위\n\t * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위\n\t * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
\n\t *\n\t * @example\n\t * // PanoViewer Creation\n\t * // create PanoViewer with option\n\t * var PanoViewer = eg.view360.PanoViewer;\n\t * // Area where the image will be displayed(HTMLElement)\n\t * var container = document.getElementById(\"myPanoViewer\");\n\t *\n\t * var panoViewer = new PanoViewer(container, {\n\t * // If projectionType is not specified, the default is \"equirectangular\".\n\t * // Specifies an image of the \"equirectangular\" type.\n\t * image: \"/path/to/image/image.jpg\"\n\t *});\n\t *\n\t * @example\n\t * // Cubemap Config Setting Example\n\t * // For support Youtube EAC projection, You should set cubemapConfig as follows.\n\t * cubemapConfig: {\n\t * \torder: \"LFRDBU\",\n\t * \ttileConfig: [\n\t * \t\ttileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}]\n\t * \t]\n\t * }\n\t */\n\tconstructor(container, options = {}) {\n\t\tsuper();\n\n\t\t// Raises the error event if webgl is not supported.\n\t\tif (!WebGLUtils.isWebGLAvailable()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\t\tmessage: \"no webgl support\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!WebGLUtils.isStableWebGL()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_DEVICE,\n\t\t\t\t\tmessage: \"blacklisted browser\"\n\t\t\t\t});\n\t\t\t}, 0);\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!!options.image && !!options.video) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_RESOURCE,\n\t\t\t\t\tmessage: \"Specifying multi resouces(both image and video) is not valid.\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\t// Check XR support at not when imported, but when created.\n\t\t// This is intended to make polyfills easier to use.\n\t\tcheckXRSupport();\n\n\t\tthis._container = container;\n\t\tthis._image = options.image || options.video;\n\t\tthis._isVideo = !!options.video;\n\t\tthis._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\tthis._cubemapConfig = Object.assign({\n\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/\n\t\t\torder: this._projectionType === PROJECTION_TYPE.CUBEMAP ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, options.cubemapConfig);\n\t\tthis._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\n\t\t// If the width and height are not provided, will use the size of the container.\n\t\tthis._width = options.width || parseInt(window.getComputedStyle(container).width, 10);\n\t\tthis._height = options.height || parseInt(window.getComputedStyle(container).height, 10);\n\n\t\t/**\n\t\t * Cache the direction for the performance in renderLoop\n\t\t *\n\t\t * This value should be updated by \"change\" event of YawPitchControl.\n\t\t */\n\t\tthis._yaw = options.yaw || 0;\n\t\tthis._pitch = options.pitch || 0;\n\t\tthis._fov = options.fov || 65;\n\n\t\tthis._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH;\n\t\tthis._quaternion = null;\n\n\t\tthis._aspectRatio = this._height !== 0 ? this._width / this._height : 1;\n\t\tconst fovRange = options.fovRange || [30, 110];\n\t\tconst touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ?\n\t\t\toptions.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL;\n\t\tconst yawPitchConfig = Object.assign(options, {\n\t\t\telement: container,\n\t\t\tyaw: this._yaw,\n\t\t\tpitch: this._pitch,\n\t\t\tfov: this._fov,\n\t\t\tgyroMode: this._gyroMode,\n\t\t\tfovRange,\n\t\t\taspectRatio: this._aspectRatio,\n\t\t\ttouchDirection\n\t\t});\n\n\t\tthis._isReady = false;\n\n\t\tthis._initYawPitchControl(yawPitchConfig);\n\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t}\n\n\t/**\n\t * Get the video element that the viewer is currently playing. You can use this for playback.\n\t * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다.\n\t * @method eg.view360.PanoViewer#getVideo\n\t * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement\n\t * @example\n\t * var videoTag = panoViewer.getVideo();\n\t * videoTag.play(); // play video!\n\t */\n\tgetVideo() {\n\t\tif (!this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the video information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setVideo\n\t * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정)\n\t * @param {Object} param\n\t * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}(\"equirectangular\")] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setVideo(\"/path/to/video/video.mp4\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR\n\t * });\n\t */\n\tsetVideo(video, param = {}) {\n\t\tif (video) {\n\t\t\tthis.setImage(video, {\n\t\t\t\tprojectionType: param.projectionType,\n\t\t\t\tisVideo: true,\n\t\t\t\tcubemapConfig: param.cubemapConfig,\n\t\t\t\tstereoFormat: param.stereoFormat\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the image information that the viewer is currently using.\n\t * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다.\n\t * @method eg.view360.PanoViewer#getImage\n\t * @return {Image} Image Object이미지 객체\n\t * @example\n\t * var imageObj = panoViewer.getImage();\n\t */\n\tgetImage() {\n\t\tif (this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the image information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setImage\n\t * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.)\n\t * @param {Object} param Additional information이미지 추가 정보\n\t * @param {String} [param.projectionType=\"equirectangular\"] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setImage(\"/path/to/image/image.png\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP\n\t * });\n\t */\n\tsetImage(image, param = {}) {\n\t\tconst cubemapConfig = Object.assign({\n\t\t\torder: \"RLUDBF\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, param.cubemapConfig);\n\t\tconst stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\t\tconst isVideo = !!(param.isVideo);\n\n\t\tif (this._image && this._isVideo !== isVideo) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.warn(\"Currently not supporting to change content type(Image <--> Video)\");\n\t\t\t/* eslint-enable no-console */\n\t\t\treturn this;\n\t\t}\n\n\t\tif (image) {\n\t\t\tthis._image = image;\n\t\t\tthis._isVideo = isVideo;\n\t\t\tthis._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\t\tthis._cubemapConfig = cubemapConfig;\n\t\t\tthis._stereoFormat = stereoFormat;\n\n\t\t\tthis._deactivate();\n\t\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set whether the renderer always updates the texture and renders.\n\t * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다.\n\t *\n\t * @method eg.view360.PanoViewer#keepUpdate\n\t * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다.\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tkeepUpdate(doUpdate) {\n\t\tthis._photoSphereRenderer.keepUpdate(doUpdate);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get projection type (equirectangular/cube)\n\t * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#getProjectionType\n\t * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE}\n\t */\n\tgetProjectionType() {\n\t\treturn this._projectionType;\n\t}\n\n\t/**\n\t * Activate the device's motion sensor, and return the Promise whether the sensor is enabled\n\t * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element.\n\t * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다.\n\t * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * @method eg.view360.PanoViewer#enableSensor\n\t * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다.\n\t */\n\tenableSensor() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\") {\n\t\t\t\tDeviceMotionEvent.requestPermission().then(permissionState => {\n\t\t\t\t\tif (permissionState === \"granted\") {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(new Error(\"permission denied\"));\n\t\t\t\t\t}\n\t\t\t\t}).catch(e => {\n\t\t\t\t\t// This can happen when this method wasn't triggered by user interaction\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disable the device's motion sensor.\n\t * @ko 디바이스의 모션 센서를 비활성화합니다.\n\t * @deprecated\n\t * @method eg.view360.PanoViewer#disableSensor\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdisableSensor() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred).\n\t * This method must be used in the context of user interaction, like onclick callback on the button element.\n\t * It can be rejected when an enabling device sensor fails or image/video is still loading(\"ready\" event not triggered).\n\t * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다)\n\t * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우(\"ready\"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다.\n\t * @method eg.view360.PanoViewer#enterVR\n\t * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error)\n\t */\n\tenterVR() {\n\t\tif (!this._isReady) {\n\t\t\treturn Promise.reject(new Error(\"PanoViewer is not ready to show image.\"));\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.enableSensor()\n\t\t\t\t.then(() => this._photoSphereRenderer.enterVR())\n\t\t\t\t.then(res => resolve(res))\n\t\t\t\t.catch(e => reject(e));\n\t\t});\n\t}\n\n\t/**\n\t * Exit VR stereo rendering mode.\n\t * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#exitVR\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\texitVR() {\n\t\tthis._photoSphereRenderer.exitVR();\n\t\treturn this;\n\t}\n\n\t// TODO: Remove parameters as they're just using private values\n\t_initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) {\n\t\tthis._photoSphereRenderer = new PanoImageRenderer(\n\t\t\tthis._image,\n\t\t\tthis._width,\n\t\t\tthis._height,\n\t\t\tthis._isVideo,\n\t\t\t{\n\t\t\t\tinitialYaw: yaw,\n\t\t\t\tinitialPitch: pitch,\n\t\t\t\tfieldOfView: fov,\n\t\t\t\timageType: projectionType,\n\t\t\t\tcubemapConfig,\n\t\t\t\tstereoFormat: this._stereoFormat\n\t\t\t},\n\t\t);\n\t\tthis._photoSphereRenderer.setYawPitchControl(this._yawPitchControl);\n\n\t\tthis._bindRendererHandler();\n\n\t\tthis._photoSphereRenderer\n\t\t\t.bindTexture()\n\t\t\t.then(() => this._activate())\n\t\t\t.catch(() => {\n\t\t\t\tthis._triggerEvent(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.FAIL_BIND_TEXTURE,\n\t\t\t\t\tmessage: \"failed to bind texture\"\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * update values of YawPitchControl if needed.\n\t * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image.\n\t *\n\t * This function should be called after isReady status is true.\n\t */\n\t_updateYawPitchIfNeeded() {\n\t\tif (this._projectionType === PanoViewer.ProjectionType.PANORAMA) {\n\t\t\t// update fov by aspect ratio\n\t\t\tconst image = this._photoSphereRenderer.getContent();\n\t\t\tlet imageAspectRatio = image.naturalWidth / image.naturalHeight;\n\t\t\tlet isCircular;\n\t\t\tlet yawSize;\n\t\t\tlet maxFov;\n\n\t\t\t// If height is larger than width, then we assume it's rotated by 90 degree.\n\t\t\tif (imageAspectRatio < 1) {\n\t\t\t\t// So inverse the aspect ratio.\n\t\t\t\timageAspectRatio = 1 / imageAspectRatio;\n\t\t\t}\n\n\t\t\tif (imageAspectRatio < 6) {\n\t\t\t\tyawSize = mathUtil.toDegree(imageAspectRatio);\n\t\t\t\tisCircular = false;\n\t\t\t\t// 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5\n\t\t\t\tmaxFov = mathUtil.toDegree(Math.atan(0.5)) * 2;\n\t\t\t} else {\n\t\t\t\tyawSize = 360;\n\t\t\t\tisCircular = true;\n\t\t\t\tmaxFov = (360 / imageAspectRatio); // Make it 5 fixed as axes does.\n\t\t\t}\n\n\t\t\t// console.log(\"_updateYawPitchIfNeeded\", maxFov, \"aspectRatio\", image.naturalWidth, image.naturalHeight, \"yawSize\", yawSize);\n\t\t\tconst minFov = (this._yawPitchControl.option(\"fovRange\"))[0];\n\n\t\t\t// this option should be called after fov is set.\n\t\t\tthis._yawPitchControl.option({\n\t\t\t\t\"fov\": maxFov, /* parameter for internal validation for pitchrange */\n\t\t\t\t\"yawRange\": [-yawSize / 2, yawSize / 2],\n\t\t\t\tisCircular,\n\t\t\t\t\"pitchRange\": [-maxFov / 2, maxFov / 2],\n\t\t\t\t\"fovRange\": [minFov, maxFov]\n\t\t\t});\n\t\t\tthis.lookAt({fov: maxFov});\n\t\t}\n\t}\n\n\t_bindRendererHandler() {\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, e);\n\t\t});\n\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, e => {\n\t\t\tthis._deactivate();\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERING_CONTEXT_LOST,\n\t\t\t\tmessage: \"webgl rendering context lost\"\n\t\t\t});\n\t\t});\n\t}\n\n\t_initYawPitchControl(yawPitchConfig) {\n\t\tthis._yawPitchControl = new YawPitchControl(yawPitchConfig);\n\n\t\tthis._yawPitchControl.on(EVENTS.ANIMATION_END, e => {\n\t\t\tthis._triggerEvent(EVENTS.ANIMATION_END, e);\n\t\t});\n\n\t\tthis._yawPitchControl.on(\"change\", e => {\n\t\t\tthis._yaw = e.yaw;\n\t\t\tthis._pitch = e.pitch;\n\t\t\tthis._fov = e.fov;\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis._triggerEvent(EVENTS.VIEW_CHANGE, e);\n\t\t});\n\t}\n\n\t_triggerEvent(name, param) {\n\t\tconst evt = param || {};\n\n\t\t/**\n\t\t * Events that is fired when error occurs\n\t\t * @ko 에러 발생 시 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#error\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.type Error type\n\t\t * \t\t10: INVALID_DEVICE: Unsupported device\n\t\t * \t\t11: NO_WEBGL: Webgl not support\n\t\t * \t\t12, FAIL_IMAGE_LOAD: Failed to load image\n\t\t * \t\t13: FAIL_BIND_TEXTURE: Failed to bind texture\n\t\t * \t\t14: INVALID_RESOURCE: Only one resource(image or video) should be specified\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost occurred\n\t\t * 에러 종류\n\t\t * \t\t10: INVALID_DEVICE: 미지원 기기\n\t\t * \t\t11: NO_WEBGL: WEBGL 미지원\n\t\t * \t\t12, FAIL_IMAGE_LOAD: 이미지 로드 실패\n\t\t * \t\t13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패\n\t\t * \t\t14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost 발생\n\t\t * \n\t\t * @param {String} param.message Error message 에러 메시지\n\t\t * @see {@link eg.view360.PanoViewer.ERROR_TYPE}\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"error\" : function(evt) {\n\t\t *\t\t// evt.type === 13\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t *\n\t\t * // constant can be used\n\t\t * viwer.on({\n\t\t *\teg.view360.PanoViewer.EVENTS.ERROR : function(evt) {\n\t\t *\t\t// evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when PanoViewer is ready to go.\n\t\t * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#ready\n\t\t * @event\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"ready\" : function(evt) {\n\t\t *\t\t// PanoViewer is ready to show image and handle user interaction.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when direction or fov is changed.\n\t\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#viewChange\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.yaw yawyaw\n\t\t * @param {Number} param.pitch pitch pitch\n\t\t * @param {Number} param.fov Field of view (fov) 화각\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"viewChange\" : function(evt) {\n\t\t *\t\t//evt.yaw, evt.pitch, evt.fov is available.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when animation which is triggered by inertia is ended.\n\t\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#animationEnd\n\t\t * @event\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"animationEnd\" : function(evt) {\n\t\t *\t\t// animation is ended.\n\t\t * });\n\t\t */\n\t\treturn this.trigger(name, evt);\n\t}\n\n\t/**\n\t * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}.\n\t * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다.\n\t * @method eg.view360.PanoViewer#setUseZoom\n\t * @param {Boolean} useZoom\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseZoom(useZoom) {\n\t\ttypeof useZoom === \"boolean\" && this._yawPitchControl.option(\"useZoom\", useZoom);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * When true, enables the keyboard move key control: awsd, arrow keys\n\t * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키)\n\t * @method eg.view360.PanoViewer#setUseKeyboard\n\t * @param {Boolean} useKeyboard\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseKeyboard(useKeyboard) {\n\t\tthis._yawPitchControl.option(\"useKeyboard\", useKeyboard);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")\n\t * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")\n\t * @method eg.view360.PanoViewer#setGyroMode\n\t * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE}\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setGyroMode(\"yawPitch\");\n\t * //equivalent\n\t * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH);\n\t */\n\tsetGyroMode(gyroMode) {\n\t\tthis._yawPitchControl.option(\"gyroMode\", gyroMode);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setFovRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setFovRange([50, 90]);\n\t */\n\tsetFovRange(range) {\n\t\tthis._yawPitchControl.option(\"fovRange\", range);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Getting the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFovRange\n\t * @return {Array}\n\t * @example\n\t * var range = panoViewer.getFovRange(); //[50, 90]\n\t */\n\tgetFovRange() {\n\t\treturn this._yawPitchControl.option(\"fovRange\");\n\t}\n\n\t/**\n\t * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size.\n\t * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다.\n\t * @method eg.view360.PanoViewer#updateViewportDimensions\n\t * @param {Object} [size]\n\t * @param {Number} [size.width=width of container]\n\t * @param {Number} [size.height=height of container]\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tupdateViewportDimensions(size = {width: undefined, height: undefined}) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet containerSize;\n\n\t\tif (size.width === undefined || size.height === undefined) {\n\t\t\tcontainerSize = window.getComputedStyle(this._container);\n\t\t}\n\n\t\tconst width = size.width || parseInt(containerSize.width, 10);\n\t\tconst height = size.height || parseInt(containerSize.height, 10);\n\n\t\t// Skip if viewport is not changed.\n\t\tif (width === this._width && height === this._height) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tthis._aspectRatio = width / height;\n\t\tthis._photoSphereRenderer.updateViewportDimensions(width, height);\n\t\tthis._yawPitchControl.option(\"aspectRatio\", this._aspectRatio);\n\t\tthis._yawPitchControl.updatePanScale({height});\n\n\t\tthis.lookAt({}, 0);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the current field of view(FOV)\n\t * @ko 현재 field of view(FOV) 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFov\n\t * @return {Number}\n\t */\n\tgetFov() {\n\t\treturn this._fov;\n\t}\n\n\t/**\n\t * Get the horizontal field of view in degree\n\t */\n\t_getHFov() {\n\t\treturn mathUtil.toDegree(\n\t\t\t2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2)));\n\t}\n\n\t/**\n\t * Get current yaw value\n\t * @ko 현재 yaw 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYaw\n\t * @return {Number}\n\t */\n\tgetYaw() {\n\t\treturn this._yaw;\n\t}\n\n\t/**\n\t * Get current pitch value\n\t * @ko 현재 pitch 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getPitch\n\t * @return {Number}\n\t */\n\tgetPitch() {\n\t\treturn this._pitch;\n\t}\n\n\t/**\n\t * Get the range of controllable Yaw values\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYawRange\n\t * @return {Array}\n\t */\n\tgetYawRange() {\n\t\treturn this._yawPitchControl.option(\"yawRange\");\n\t}\n\n\t/**\n\t * Get the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다.\n\t * @method eg.view360.PanoViewer#getPitchRange\n\t * @return {Array}\n\t */\n\tgetPitchRange() {\n\t\treturn this._yawPitchControl.option(\"pitchRange\");\n\t}\n\n\t/**\n\t * Set the range of controllable yaw\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#setYawRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setYawRange([-90, 90]);\n\t */\n\tsetYawRange(yawRange) {\n\t\tthis._yawPitchControl.option(\"yawRange\", yawRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setPitchRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setPitchRange([-40, 40]);\n\t */\n\tsetPitchRange(pitchRange) {\n\t\tthis._yawPitchControl.option(\"pitchRange\", pitchRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed.\n\t * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다.\n\t * @method eg.view360.PanoViewer#setShowPolePoint\n\t * @param {Boolean} showPolePoint\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetShowPolePoint(showPolePoint) {\n\t\tthis._yawPitchControl.option(\"showPolePoint\", showPolePoint);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a new view by setting camera configuration. Any parameters not specified remain the same.\n\t * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다.\n\t * @method eg.view360.PanoViewer#lookAt\n\t * @param {Object} orientation\n\t * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위)\n\t * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위)\n\t * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위)\n\t * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초)\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * // Change the yaw angle (absolute angle) to 30 degrees for one second.\n\t * panoViewer.lookAt({yaw: 30}, 1000);\n\t */\n\tlookAt(orientation, duration) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw;\n\t\tconst pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch;\n\t\tconst pitchRange = this._yawPitchControl.option(\"pitchRange\");\n\t\tconst verticalAngleOfImage = pitchRange[1] - pitchRange[0];\n\t\tlet fov = orientation.fov !== undefined ? orientation.fov : this._fov;\n\n\t\tif (verticalAngleOfImage < fov) {\n\t\t\tfov = verticalAngleOfImage;\n\t\t}\n\n\t\tthis._yawPitchControl.lookAt({yaw, pitch, fov}, duration);\n\n\t\tif (duration === 0) {\n\t\t\tthis._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_activate() {\n\t\tthis._photoSphereRenderer.attachTo(this._container);\n\t\tthis._yawPitchControl.enable();\n\n\t\tthis.updateViewportDimensions();\n\n\t\tthis._isReady = true;\n\n\t\t// update yawPitchControl after isReady status is true.\n\t\tthis._updateYawPitchIfNeeded();\n\n\t\tthis._triggerEvent(EVENTS.READY);\n\t\tthis._photoSphereRenderer.startRender();\n\t}\n\n\t/**\n\t * Destroy webgl context and block user interaction and stop rendering\n\t */\n\t_deactivate() {\n\t\tif (this._isReady) {\n\t\t\tthis._photoSphereRenderer.stopRender();\n\t\t\tthis._yawPitchControl.disable();\n\t\t\tthis._isReady = false;\n\t\t}\n\n\t\tif (this._photoSphereRenderer) {\n\t\t\tthis._photoSphereRenderer.destroy();\n\t\t\tthis._photoSphereRenderer = null;\n\t\t}\n\t}\n\n\tstatic _isValidTouchDirection(direction) {\n\t\treturn direction === PanoViewer.TOUCH_DIRECTION.NONE ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.YAW ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.PITCH ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.ALL;\n\t}\n\n\t/**\n\t * Set touch direction by which user can control.\n\t * @ko 사용자가 조작가능한 터치 방향을 지정합니다.\n\t * @method eg.view360.PanoViewer#setTouchDirection\n\t * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @return {eg.view360.PanoViewer} PanoViewer instance\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Limit the touch direction to the yaw direction only.\n\t * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW);\n\t */\n\tsetTouchDirection(direction) {\n\t\tif (PanoViewer._isValidTouchDirection(direction)) {\n\t\t\tthis._yawPitchControl.option(\"touchDirection\", direction);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns touch direction by which user can control\n\t * @ko 사용자가 조작가능한 터치 방향을 반환한다.\n\t * @method eg.view360.PanoViewer#getTouchDirection\n\t * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Returns the current touch direction.\n\t * var dir = panoViewer.getTouchDirection();\n\t */\n\tgetTouchDirection() {\n\t\treturn this._yawPitchControl.option(\"touchDirection\");\n\t}\n\n\t/**\n\t * Destroy viewer. Remove all registered event listeners and remove viewer canvas.\n\t * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다.\n\t * @method eg.view360.PanoViewer#destroy\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdestroy() {\n\t\tthis._deactivate();\n\n\t\tif (this._yawPitchControl) {\n\t\t\tthis._yawPitchControl.destroy();\n\t\t\tthis._yawPitchControl = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check whether the current environment can execute PanoViewer\n\t * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다.\n\t * @function isSupported\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부\n\t * @static\n\t */\n\tstatic isSupported() {\n\t\treturn WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the WebGL\n\t * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다.\n\t * @function isWebGLAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} WebGL support WebGL 지원여부\n\t * @static\n\t */\n\tstatic isWebGLAvailable() {\n\t\treturn WebGLUtils.isWebGLAvailable();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the gyro sensor.\n\t * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다.\n\t * @function isGyroSensorAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수\n\t * @static\n\t */\n\tstatic isGyroSensorAvailable(callback) {\n\t\tif (!DeviceMotionEvent) {\n\t\t\tcallback && callback(false);\n\t\t\treturn;\n\t\t}\n\n\t\tlet onDeviceMotionChange;\n\n\t\tfunction checkGyro() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tonDeviceMotionChange = function(deviceMotion) {\n\t\t\t\t\tconst isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null);\n\n\t\t\t\t\tres(isGyroSensorAvailable);\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener(\"devicemotion\", onDeviceMotionChange);\n\t\t\t});\n\t\t}\n\n\t\tfunction timeout() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tsetTimeout(() => res(false), 1000);\n\t\t\t});\n\t\t}\n\n\t\tPromise.race([checkGyro(), timeout()]).then(isGyroSensorAvailable => {\n\t\t\twindow.removeEventListener(\"devicemotion\", onDeviceMotionChange);\n\n\t\t\tcallback && callback(isGyroSensorAvailable);\n\n\t\t\tPanoViewer.isGyroSensorAvailable = function(fb) {\n\t\t\t\tfb && fb(isGyroSensorAvailable);\n\t\t\t\treturn isGyroSensorAvailable;\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport default PanoViewer;\n","import Component from \"@egjs/component\";\nimport {TRANSFORM, SUPPORT_WILLCHANGE} from \"../utils/browserFeature\";\nimport {VERSION} from \"../version\";\n/**\n * @class eg.view360.SpriteImage\n * @classdesc A module that displays a single or continuous image of any one of the \"sprite images\". SpinViewer internally uses SpriteImage to show each frame of the sprite image.\n * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the \"Sprite image\". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n *\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpriteImage\n *\n * var el = document.getElementById(\"image-div\");\n * var sprites = new eg.view360.SpriteImage(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24\n * });\n */\nclass SpriteImage extends Component {\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\t\tconst opt = options || {};\n\n\t\tthis._el = element;\n\t\tthis._rowCount = opt.rowCount || 1;\n\t\tthis._colCount = opt.colCount || 1;\n\t\tthis._totalCount = this._rowCount * this._colCount;// total frames\n\t\tthis._width = opt.width || \"auto\";\n\t\tthis._height = opt.height || \"auto\";\n\t\tthis._autoHeight = opt.autoHeight != null ? opt.autoHeight : \"true\"; // If autoHeight is specified, _height will be overwritten.\n\t\tthis._colRow = [0, 0];\n\n\t\tif (opt.colRow) {\n\t\t\tthis._colRow = opt.colRow;\n\t\t} else if (opt.frameIndex) {\n\t\t\tthis.setFrameIndex(opt.frameIndex);\n\t\t}\n\n\t\tthis._el.style.width = SpriteImage._getSizeString(this._width);\n\t\tthis._el.style.height = SpriteImage._getSizeString(this._height);\n\n\t\tif (!opt.imageUrl) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: opt.imageUrl\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._image = new Image();\n\t\t/**\n\t\t * Event\n\t\t */\n\t\tthis._image.onload = () => {\n\t\t\tthis._bg = SpriteImage._createBgDiv(\n\t\t\t\tthis._image, this._rowCount, this._colCount, this._autoHeight);\n\t\t\tthis._el.appendChild(this._bg);\n\t\t\tthis.setColRow(this._colRow[0], this._colRow[1]);\n\n\t\t\t/**\n\t\t\t * Events that occur when component loading is complete\n\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#load\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"load\" : function(evt) {\n\t\t\t *\t\tconsole.log(\"load event fired - e.target\", e.target, \"e.bgElement\", e.bgElement);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"load\", {\n\t\t\t\ttarget: this._el,\n\t\t\t\tbgElement: this._bg\n\t\t\t});\n\n\t\t\tif (this._autoPlayReservedInfo) {\n\t\t\t\tthis.play(this._autoPlayReservedInfo);\n\t\t\t\tthis._autoPlayReservedInfo = null;\n\t\t\t}\n\t\t};\n\n\t\tthis._image.onerror = e => {\n\t\t\t/**\n\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#imageError\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t *\t\t// Error handling\n\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\timageUrl: opt.imageUrl\n\t\t\t});\n\t\t};\n\n\t\tthis._image.src = opt.imageUrl;\n\t}\n\n\tstatic _createBgDiv(img, rowCount, colCount, autoHeight) {\n\t\tconst el = document.createElement(\"div\");\n\n\t\tel.style.position = \"relative\";\n\t\tel.style.overflow = \"hidden\";\n\n\t\timg.style.position = \"absolute\";\n\t\timg.style.width = `${colCount * 100}%`;\n\t\timg.style.height = `${rowCount * 100}%`;\n\t\t/** Prevent image from being dragged on IE10, IE11, Safari especially */\n\t\timg.ondragstart = () => (false); // img.style.pointerEvents = \"none\";\n\t\t// Use hardware accelerator if available\n\t\tSUPPORT_WILLCHANGE && (img.style.willChange = \"transform\");\n\n\t\tel.appendChild(img);\n\n\t\tconst unitWidth = img.width / colCount;\n\t\tconst unitHeight = img.height / rowCount;\n\n\t\tif (autoHeight) {\n\t\t\tconst r = unitHeight / unitWidth;\n\n\t\t\tel.style.paddingBottom = `${r * 100}%`;\n\t\t} else {\n\t\t\tel.style.height = \"100%\";\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/**\n\t * Specifies the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정\n\t * @method eg.view360.SpriteImage#setFrameIndex\n\t * @param {Number} frameIndex frame index of a frame프레임의 인덱스\n\t *\n\t * @example\n\t *\n\t * sprites.setFrameIndex(0, 1);// col = 0, row = 1\n\t */\n\tsetFrameIndex(index) {\n\t\tconst colRow = this.toColRow(index);\n\n\t\tthis.setColRow(colRow[0], colRow[1]);\n\t}\n\n\t/**\n\t * Returns the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환\n\t * @method eg.view360.SpriteImage#getFrameIndex\n\t * @return {Number} frame index frame 인덱스\n\t *\n\t * @example\n\t *\n\t * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1\n\t *\n\t */\n\tgetFrameIndex() {\n\t\treturn this._colRow[1] * this._colCount + this._colRow[0];\n\t}\n\n\t/**\n\t * Specifies the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정\n\t * @method eg.view360.SpriteImage#setColRow\n\t * @param {Number} col Column number of a frame프레임의 행값\n\t * @param {Number} row Row number of a frame프레임의 열값\n\t *\n\t * @example\n\t *\n\t * sprites.setlColRow(1, 2); // col = 1, row = 2\n\t */\n\tsetColRow(col, row) {\n\t\tif (row > this._rowCount - 1 || col > this._colCount - 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._image && TRANSFORM) {\n\t\t\t// NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser?\n\t\t\tthis._image.style[TRANSFORM] = `translate(${-(col / this._colCount * 100)}%, ${-(row / this._rowCount * 100)}%)`;\n\t\t}\n\n\t\tthis._colRow = [col, row];\n\t}\n\n\t/**\n\t * Returns the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환\n\t * @method eg.view360.SpriteImage#gelColRow\n\t * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열\n\t *\n\t * @example\n\t *\n\t * var colRow = sprites.getlColRow();\n\t * // colRow = [1, 2] - index of col is 1, index of row is 2\n\t *\n\t */\n\tgetColRow() {\n\t\treturn this._colRow;\n\t}\n\n\tstatic _getSizeString(size) {\n\t\tif (typeof size === \"number\") {\n\t\t\treturn `${size}px`;\n\t\t}\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Stop playing\n\t * @ko play 되고 있던 프레임 재생을 중지합니다.\n\t * @method eg.view360.SpriteImage#stop\n\t *\n\t * @example\n\t *\n\t * viewer.stop();\n\t *\n\t */\n\tstop() {\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\t}\n\n\t/**\n\t * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'.\n\t * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다.\n\t * @method eg.view360.SpriteImage#play\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위\n\t * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복\n\t *\n\t * @example\n\t *\n\t * viewer.play({angle: 16, playCount: 1});\n\t *\n\t */\n\tplay({interval, playCount} = {interval: 1000 / this._totalCount, playCount: 0}) {\n\t\tif (!this._bg) {\n\t\t\tthis._autoPlayReservedInfo = {interval, playCount};\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\n\t\tlet frameIndex = this.getFrameIndex();\n\t\tlet count = 0;\n\t\tlet frameCount = 0; // for checking 1 cycle\n\n\t\tthis._autoPlayTimer = setInterval(() => {\n\t\t\tframeIndex %= this._totalCount;\n\t\t\tconst colRow = this.toColRow(frameIndex);\n\n\t\t\tthis.setColRow(colRow[0], colRow[1]);\n\t\t\tframeIndex++;\n\n\t\t\t// Done 1 Cycle?\n\t\t\tif (++frameCount === this._totalCount) {\n\t\t\t\tframeCount = 0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (playCount > 0 && count === playCount) {\n\t\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\t}\n\t\t}, interval);\n\t}\n\n\ttoColRow(frameIndex) {\n\t\tconst colCount = this._colCount;\n\t\tconst rowCount = this._rowCount;\n\n\t\tif (frameIndex < 0) {\n\t\t\treturn [0, 0];\n\t\t} else if (frameIndex >= this._totalCount) {\n\t\t\treturn [colCount - 1, rowCount - 1];\n\t\t}\n\n\t\tconst col = frameIndex % colCount;\n\t\tconst row = Math.floor(frameIndex / colCount);\n\n\t\t// console.log(frameIndex, col, row);\n\t\treturn [col, row];\n\t}\n}\n\nexport default SpriteImage;\n","import Component from \"@egjs/component\";\nimport Axes, {PanInput} from \"@egjs/axes\";\nimport SpriteImage from \"./SpriteImage\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_PAN_SCALE = 0.21;\n\n/**\n * @class eg.view360.SpinViewer\n * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object.\n * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpinViewer\n * var el = document.getElementById(\"product-360\");\n * var viewer = new eg.view360.SpinViewer(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24 //required\n * });\n */\nclass SpinViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.SpinViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.SpinViewer\n\t */\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\n\t\tthis._el = element;\n\n\t\tconst opt = Object.assign({}, options);\n\t\tconst colCount = opt.colCount || 1;\n\t\tconst rowCount = opt.rowCount || 1;\n\n\t\tthis._scale = (opt.scale || 1);\n\t\tthis._panScale = this._scale * DEFAULT_PAN_SCALE;\n\n\t\tthis._frameCount = colCount * rowCount;\n\n\t\t// Init SpriteImage\n\t\tthis._sprites = new SpriteImage(element, opt).on({\n\t\t\t\"load\": evt => {\n\t\t\t\t/**\n\t\t\t\t * Events that occur when component loading is complete\n\t\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#load\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"load\" : function(evt) {\n\t\t\t\t *\t\tthis.spinBy(360, {duration: 300});\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"load\", evt);\n\t\t\t},\n\t\t\t\"imageError\": evt => {\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#imageError\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viewer.on({\n\t\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t\t *\t\t// Error handling\n\t\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: evt.imageUrl\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Init Axes\n\t\tthis._panInput = new PanInput(this._el, {\n\t\t\tscale: [this._panScale, this._panScale]\n\t\t});\n\t\tthis._axes = new Axes({\n\t\t\tangle: {\n\t\t\t\trange: [0, 359],\n\t\t\t\tcircular: true\n\t\t\t}\n\t\t}).on({\n\t\t\t\"change\": evt => {\n\t\t\t\tconst curr = Math.floor(evt.pos.angle / (360 / this._frameCount));\n\t\t\t\tconst frameIndex = this._frameCount - curr - 1;\n\n\t\t\t\tthis._sprites.setFrameIndex(frameIndex);\n\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#change\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row\n\t\t\t\t * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값\n\t\t\t\t * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님)\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"change\" : function(evt) {\n\t\t\t\t *\t\tconsole.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"change\", {\n\t\t\t\t\tframeIndex,\n\t\t\t\t\tcolRow: this._sprites.getColRow(),\n\t\t\t\t\tangle: evt.pos.angle\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"animationEnd\": evt => {\n\t\t\t\t/**\n\t\t\t\t * This event is fired when animation ends.\n\t\t\t\t * @ko 에니메이션이 끝났을 때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#animationEnd\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Boolean} param.isTrusted 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\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"animationEnd\" : function(evt) {\n\t\t\t\t *\t\t// evt.isTrusted === true or false\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"animationEnd\", {\n\t\t\t\t\tisTrusted: evt.isTrusted\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._axes.connect(\"angle\", this._panInput);\n\t}\n\n\t/**\n\t * Set spin scale\n\t * @ko scale 을 조정할 수 있는 함수\n\t * @method eg.view360.SpinViewer#setScale\n\t * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.setScale(2);// It moves twice as much.\n\t */\n\tsetScale(scale) {\n\t\tif (isNaN(scale) || scale < 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._scale = scale;\n\t\tthis._panScale = scale * DEFAULT_PAN_SCALE;\n\t\tthis._panInput.options.scale = [this._panScale, this._panScale];\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get spin scale\n\t * @ko scale 값을 반환한다.\n\t * @method eg.view360.SpinViewer#getScale\n\t *\n\t * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @example\n\t *\n\t * viewer.getScale();// It returns number\n\t */\n\tgetScale() {\n\t\treturn this._scale;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle.\n\t * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinBy\n\t *\n\t * @param {Number} [angle = 0] angle상대적 회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinBy(720, {duration: 500});\n\t */\n\tspinBy(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setBy({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle).\n\t * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinTo\n\t *\n\t * @param {Number} [angle = 0] angle회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinTo(30, {duration:100});\n\t */\n\tspinTo(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setTo({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns current angles\n\t * @ko 현재 각도를 반환한다.\n\t *\n\t * @return {Number} Current angle 현재 각도\n\t */\n\tgetAngle() {\n\t\treturn this._axes.get().angle || 0;\n\t}\n}\n\nexport default SpinViewer;\n"],"names":["this","require","global","create","glMatrix.ARRAY_TYPE","invert","identity","fromQuat","fromValues","copy","set","subtract","scale","clone","normalize","exactEquals","equals","glMatrix.EPSILON","forEach","multiply","vec4.clone","vec4.fromValues","vec4.copy","vec4.normalize","vec4.exactEquals","vec4.equals","vec3.create","vec3.fromValues","dot","vec3.dot","vec3.cross","vec3.len","vec3.normalize","mat3.create","win","window","Math","self","Function","doc","document","agent","getAgent","osName","os","name","browserName","browser","IS_IOS","IS_SAFARI_ON_DESKTOP","Float32Array","Array","getComputedStyle","userAgent","navigator","SUPPORT_TOUCH","SUPPORT_DEVICEMOTION","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","i","len","length","SUPPORT_WILLCHANGE","CSS","supports","WEBXR_SUPPORTED","checkXRSupport","xr","isSessionSupported","then","res","supportsSession","_extends","_inheritsLoose","_assertThisInitialized","round","getAngle","getRotation","some","find","getUserAgent","execRegExp","hasUserAgentData","findVersion","convertVersion","findPreset","findBrand","BROWSER_PRESETS","CHROMIUM_PRESETS","WEBKIT_PRESETS","WEBVIEW_PRESETS","OS_PRESETS","parseUserAgentData","parseUserAgent","toArray","SUPPORT_POINTER_EVENTS","Pan","Pinch","quatToVec3","quaternion","baseV","vec3","toDegree","a","PI","util","isPowerOfTwo","n","extractPitchFromQuat","atan2","sqrt","pow","hypot","x","y","ROTATE_CONSTANT","PITCH_DELTA","YAW_DELTA_BY_ROLL","YAW_DELTA_BY_YAW","targetAxis","meshPoint","getRotationDelta","prevQ","curQ","rotateKind","prevQuaternion","quat","curQuaternion","prevPoint","curPoint","rotateDistance","rotateDirection","meshPoint2","meshPoint3","vecU","vecV","vecN","coefficientA","coefficientB","coefficientC","distance","abs","projectedPrevPoint","trigonometricRatio","theta","acos","crossVec","thetaDirection","deltaRadian","angleBetweenVec2","v1","v2","det","vec2","yawOffsetBetween","viewDir","targetDir","viewDirXZ","targetDirXZ","toAxis","source","offset","reduce","acc","v","MathUtil","Util","version","branch","build","match","exec","parseInt","CHROME_VERSION","IS_CHROME_WITHOUT_DEVICE_MOTION","IS_ANDROID","test","CONTROL_MODE_VR","CONTROL_MODE_YAWPITCH","TOUCH_DIRECTION_NONE","TOUCH_DIRECTION_YAW","TOUCH_DIRECTION_PITCH","TOUCH_DIRECTION_ALL","MC_DECELERATION","MC_MAXIMUM_DURATION","MC_BIND_SCALE","MAX_FIELD_OF_VIEW","PAN_SCALE","YAW_RANGE_HALF","PITCH_RANGE_HALF","CIRCULAR_PITCH_RANGE_HALF","GYRO_MODE","NONE","YAWPITCH","VR","STILLNESS_THRESHOLD","DeviceMotion","_onDeviceMotion","bind","_onDeviceOrientation","_onChromeWithoutDeviceMotion","isWithoutDeviceMotion","isAndroid","stillGyroVec","rawGyroVec","adjustedGyroVec","_timer","lastDevicemotionTimestamp","_isEnabled","enable","e","alpha","beta","gamma","trigger","inputEvent","deviceorientation","clearTimeout","setTimeout","Date","getTime","isGyroSensorAvailable","rotationRate","isGravitySensorAvailable","accelerationIncludingGravity","interval","devicemotionEvent","timeStamp","type","z","acceleration","adjustedRotationRate","addEventListener","disable","removeEventListener","Component","SensorSample","ComplementaryFilter","prototype","run_","isOrientationInitialized","accelQ","accelToQuaternion_","currentAccelMeasurement","sample","previousFilterQ","deltaT","currentGyroMeasurement","timestampS","previousGyroMeasurement","gyroDeltaQ","gyroToQuaternionDelta_","gyroIntegralQ","filterQ","invFilterQ","Quaternion","inverse","estimatedGravity","applyQuaternion","measuredGravity","deltaQ","setFromUnitVectors","targetQ","slerp","kFilter","isFilterQuaternionInitialized","getOrientation","K_FILTER","PREDICTION_TIME_S","FusionPoseSensor","deviceMotion","accelerometer","Vector3","gyroscope","_onDeviceMotionChange","_onScreenOrientationChange","filter","posePredictor","PosePredictor","filterToWorldQ","isFirefoxAndroid","isIOS","isChromeUsingDegrees","setFromAxisAngle","inverseWorldToScreenQ","worldToScreenQ","originalPoseAdjustQ","orientation","_setScreenTransform","isLandscapeMode","resetQ","on","isEnabled","destroy","_triggerChange","_prevOrientation","_deviceOrientationQ","deviceOrientationFixQ","_alpha","out","multiplyQuaternions","out_","w","_convertFusionToPredicted","predictedQ","getPrediction","previousTimestampS","accGravity","rotRate","setFromEulerYXZ","multiplyScalar","addAccelMeasurement","addGyroMeasurement","screenOrientation","getDeltaYaw","prvQ","yawDeltaByYaw","yawDeltaByRoll","sin","getDeltaPitch","pitchDelta","TiltMotionInput","el","options","element","_prevQuaternion","_quaternion","fusionPoseSensor","threshold","_onPoseChange","mapAxes","axes","connect","observer","_attachEvent","disconnect","_dettachEvent","event","change","off","screenRotationAngleInst","refCount","ScreenRotationAngle","_onOrientationChange","_spinR","_screenOrientationAngle","betaR","glMatrix","gammaR","cos","screen","angle","undefined","getRadian","unref","RotationPanInput","_useRotation","_screenRotationAngle","setUseRotation","useRotation","_userDirection","Axes","DIRECTION_ALL","_direction","DIRECTION_HORIZONTAL","getOffset","properties","useDirection","newOffset","cosTheta","sinTheta","DIRECTION_VERTICAL","PanInput","Y_AXIS_VECTOR","DeviceQuaternion","_fusionPoseSensor","isTrusted","getCombinedQuaternion","yaw","yawQ","conj","outQ","VERSION","DEFAULT_YAW_RANGE","DEFAULT_PITCH_RANGE","CIRCULAR_PITCH_RANGE","YawPitchControl","opt","pitch","fov","showPolePoint","useZoom","useKeyboard","gyroMode","touchDirection","yawRange","pitchRange","fovRange","aspectRatio","_element","_initialFov","_enabled","_isAnimating","_deviceQuaternion","_initAxes","option","yRange","_updateYawRange","pRange","_updatePitchRange","axesPanInput","axesWheelInput","WheelInput","axesTiltMotionInput","axesPinchInput","PinchInput","axesMoveKeyInput","MoveKeyInput","range","circular","isCircular","bounce","deceleration","maximumDuration","hold","evt","delta","_updateControlScale","updatePanScale","release","animationStart","animationEnd","param","get","areaHeight","height","args","argLen","_getOptions","beforeOptions","newOptions","changedKeyList","Object","keys","push","_setOptions","_getValidatedOptions","_applyOptions","_getValidYawRange","_getValidPitchRange","key","value","arguments","prevOptions","isVR","isYawPitch","indexOf","setTo","prevFov","nextFov","axis","_initDeviceQuaternion","_togglePinchInputByOption","_enableTouch","_inputs","direction","yawEnabled","pitchEnabled","newYawRange","newFov","newAspectRatio","ratio","adjustAspectRatio","horizontalFov","isValid","newPitchRange","changeEvt","pos","p","verticalAngle","halfFov","isPanorama","concat","horizontalAngle","halfHorizontalFov","mathUtil","tan","targetElement","input","inputRange","outputRange","rangeIdx","inputA","inputB","outputA","outputB","lerp","b","fraction","persistOrientation","_resetOrientation","lookAt","duration","f","Infinity","setBy","getYawPitch","yawPitch","getFov","getQuaternion","shouldRenderWithQuaternion","axisPanInput","axesDeviceOrientationInput","STATUS","EVENT","ImageLoader","image","_image","_onceHandlers","_loadStatus","rej","LOADED","getElement","LOADING","isMaybeLoaded","READYSTATECHANGE","createElement","onceLoaded","ERROR","images","map","img","_img","Image","crossOrigin","src","result","complete","naturalWidth","onload","onerror","targets","targetsNotLoaded","loadPromises","_once","all","reason","listener","fn","getStatus","handler","READY_STATUS","HAVE_NOTHING","HAVE_METADATA","HAVE_CURRENT_DATA","HAVE_FUTURE_DATA","HAVE_ENOUGH_DATA","LOADING_FAILED","READYSTATECHANGE_EVENT_NAME","VideoLoader","video","_handlers","_sourceCount","_thresholdReadyState","_thresholdEventName","readyState","_onerror","_errorCount","_detachErrorHandler","_appendSourceElement","videoUrl","videoSrc","videoType","sourceElement","_video","appendChild","_reset","HTMLVideoElement","setAttribute","querySelectorAll","load","_attachErrorHandler","_sources","call","rejector","WEBGL_ERROR_CODE","webglAvailability","MAX_TEXTURE_SIZE_FOR_TEST","WebGLUtils","createShader","gl","shader","shaderSource","compileShader","success","getShaderParameter","COMPILE_STATUS","console","error","getShaderInfoLog","createProgram","vertexShader","fragmentShader","program","attachShader","linkProgram","detachShader","deleteShader","getProgramParameter","LINK_STATUS","deleteProgram","initBuffer","data","itemSize","attr","buffer","createBuffer","bindBuffer","bufferData","STATIC_DRAW","numItems","enableVertexAttribArray","vertexAttribPointer","FLOAT","getWebglContext","canvas","userContextAttributes","webglIdentifiers","context","contextAttributes","preserveDrawingBuffer","antialias","xrCompatible","onWebglcontextcreationerror","statusMessage","getContext","t","createTexture","textureTarget","texture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","isWebGLAvailable","webglContext","loseContextExtension","getExtension","loseContext","isStableWebGL","agentInfo","isStableWebgl","parseFloat","getErrorNameFromWebGLErrorCode","code","texImage2D","pixels","RGBA","UNSIGNED_BYTE","getMaxTextureSize","getParameter","MAX_TEXTURE_SIZE","Agent","isIE11","majorVersion","EVENTS","Renderer","_forceDimension","_pixelCanvas","_pixelContext","render","shaderProgram","indexBuffer","mvMatrix","pMatrix","uniformMatrix4fv","pMatrixUniform","mvMatrixUniform","drawElements","TRIANGLES","UNSIGNED_SHORT","getDimension","pixelSource","width","videoWidth","naturalHeight","videoHeight","updateShaderData","_initPixelSource","forceDimension","isIE11Video","_getPixelSource","contentDimension","textureDimension","drawImage","_extractTileConfig","imageConfig","tileConfig","isArray","config","flipHorizontal","rotation","_triggerError","message","CubeRenderer","getVertexPositionData","_VERTEX_POSITION_DATA","getIndexData","_INDEX_DATA","indexData","vertexPositionData","extractOrder","order","getTextureCoordData","vertexOrder","base","elemSize","vertexPerTile","textureCoordData","split","face","ordermap_","r","shift","unshift","pop","elemPerTile","tileVertex","slice","tileTemp","j","splice","join","getVertexShaderSource","getFragmentShaderSource","updateTexture","baseOrder","orderMap","surfaceIdx","tileIdx","TEXTURE_CUBE_MAP_POSITIVE_X","maxCubeMapTextureSize","getMaxCubeMapTextureSize","tile","extractTileFromImage","TEXTURE_CUBE_MAP","getSourceTileSize","inputTextureSize","outputTextureSize","tilePerRow","MAX_CUBE_MAP_TEXTURE_SIZE","_imageWidth","min","CubeStripRenderer","_vertices","indices","cols","rows","coords","c","coord","tileConfigs","_shrinkCoord","_transformCoord","index","val","TEXTURE_2D","size","max","maxSize","activeTexture","TEXTURE0","pixelStorei","UNPACK_FLIP_Y_WEBGL","newCoord","_flipHorizontalCoord","_rotateCoord","SHRINK_Y","SHRINK_X","rotationAngle","SIZE","shiftCount","moved","rotatedCoord","ERROR_TYPE","INVALID_DEVICE","NO_WEBGL","FAIL_IMAGE_LOAD","FAIL_BIND_TEXTURE","INVALID_RESOURCE","RENDERING_CONTEXT_LOST","READY","VIEW_CHANGE","ANIMATION_END","PROJECTION_TYPE","EQUIRECTANGULAR","CUBEMAP","CUBESTRIP","PANORAMA","STEREOSCOPIC_EQUI","STEREO_FORMAT","TOP_BOTTOM","LEFT_RIGHT","latitudeBands","longitudeBands","radius","ANGLE_CORRECTION_FOR_CENTER_ALIGN","latIdx","lngIdx","phi","sinPhi","cosPhi","u","SphereRenderer","format","_stereoFormat","ctx","leftEyeScaleOffset","rightEyeScaleOffset","uTexScaleOffset","getUniformLocation","uniform4fv","_TEXTURE_COORD_DATA","MIN_ASPECT_RATIO_FOR_FULL_PANORAMA","CylinderRenderer","resizeDimension","imageAspectRatio","cylinderMaxRadian","halfCylinderY","rotated","CYLIDER_Y","startAngleForCenterAlign","yIdx","yLength","VR_DISPLAY_PRESENT_CHANGE","DEFAULT_LEFT_BOUNDS","DEFAULT_RIGHT_BOUNDS","EYES","LEFT","RIGHT","VRManager","_vrDisplay","vrDisplay","removeEndCallback","isPresenting","exitPresent","_clear","_frameData","VRFrameData","canRender","Boolean","beforeRender","bindFramebuffer","FRAMEBUFFER","afterRender","submitFrame","getEyeParams","display","halfWidth","drawingBufferWidth","drawingBufferHeight","frameData","getFrameData","leftMVMatrix","leftViewMatrix","rightMVMatrix","rightViewMatrix","mat4","_yawOffset","viewport","leftProjectionMatrix","rightProjectionMatrix","addEndCallback","callback","requestPresent","resolve","reject","getVRDisplays","displays","Error","capabilities","canPresent","leftEye","getEyeParameters","rightEye","renderWidth","renderHeight","_setDisplay","setYawOffset","layers","getLayers","layer","_leftBounds","leftBounds","_rightBounds","rightBounds","XR_REFERENCE_SPACE","XRManager","_xrSession","xrSession","end","frame","pose","getViewerPose","_xrRefSpace","session","baseLayer","renderState","framebuffer","glLayer","views","view","getViewport","transform","matrix","projectionMatrix","_presenting","requestSession","requiredFeatures","xrLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","refSpace","_setSession","_xrLayer","WebGLAnimator","_onLoop","_callback","_rafId","_context","requestAnimationFrame","_onLoopNextTick","before","performance","now","diff","_rafTimer","setCallback","setContext","start","stop","cancelAnimationFrame","ImageType","DEVICE_PIXEL_RATIO","BIND_TEXTURE","IMAGE_LOADED","RENDERING_CONTEXT_RESTORE","RENDERER_ERROR","PanoImageRenderer","isVideo","sphericalConfig","renderingContextAttributes","_renderStereo","time","vr","_vr","eyeParams","eyeIndex","eyeParam","uniform1f","uEye","_bindBuffers","_draw","exitVR","animator","_animator","_restoreStyle","updateViewportDimensions","_updateViewport","_shouldForceDraw","_render","_onFirstVRFrame","minusZDir","mat3","mvInv","pInv","yawOffset","fieldOfView","_lastQuaternion","_lastYaw","_lastPitch","_lastFieldOfView","textureCoordBuffer","vertexBuffer","_initCanvas","_setDefaultCanvasStyle","_wrapper","_wrapperOrigStyle","_renderingContextAttributes","_imageConfig","_imageIsReady","_keepUpdate","_onContentLoad","_onContentError","setImage","imageType","cubemapConfig","setYawPitchControl","yawPitchControl","_yawPitchControl","getContent","_isVideo","_setImageType","_contentLoader","_imageType","_isCubeMap","_renderer","stereoFormat","_initWebGL","_onWebglcontextlost","_onWebglcontextrestored","bottom","left","right","top","margin","maxHeight","maxWidth","outline","position","_triggerContentLoad","content","projectionType","isImageLoaded","_bindTexture","attachTo","parentElement","detach","forceContextLoss","hasRenderingContext","removeChild","isContextLost","_initShaderProgram","renderer","vsSource","fsSource","VERTEX_SHADER","FRAGMENT_SHADER","getError","useProgram","vertexPositionAttribute","getAttribLocation","samplerUniform","textureCoordAttribute","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","uniform1i","preventDefault","updateFieldOfView","viewPortChanged","h","_initRenderingContext","clearColor","deleteTexture","CULL_FACE","WebGLRenderingContext","_initBuffers","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","Uint16Array","isEAC","_updateTexture","keepUpdate","doUpdate","startRender","stopRender","renderWithQuaternion","renderWithYawPitch","getProjectionRenderer","enterVR","_Promise","_requestPresent","_setWrapperFullscreen","wrapper","getAttribute","wrapperStyle","zIndex","removeAttribute","PanoViewer","container","_container","_projectionType","_cubemapConfig","_width","_height","_yaw","_pitch","_fov","_gyroMode","_aspectRatio","_isValidTouchDirection","yawPitchConfig","_isReady","_initYawPitchControl","_initRenderer","getVideo","_photoSphereRenderer","setVideo","getImage","warn","_deactivate","getProjectionType","enableSensor","requestPermission","permissionState","disableSensor","initialYaw","initialPitch","_bindRendererHandler","_activate","_triggerEvent","_updateYawPitchIfNeeded","ProjectionType","yawSize","maxFov","atan","minFov","setUseZoom","setUseKeyboard","setGyroMode","setFovRange","getFovRange","containerSize","_getHFov","getYaw","getPitch","getYawRange","getPitchRange","setYawRange","setPitchRange","setShowPolePoint","verticalAngleOfImage","TOUCH_DIRECTION","YAW","PITCH","ALL","setTouchDirection","getTouchDirection","isSupported","onDeviceMotionChange","checkGyro","timeout","race","fb","SpriteImage","_el","_rowCount","rowCount","_colCount","colCount","_totalCount","_autoHeight","autoHeight","_colRow","colRow","frameIndex","setFrameIndex","_getSizeString","imageUrl","_bg","_createBgDiv","setColRow","bgElement","_autoPlayReservedInfo","play","overflow","ondragstart","willChange","unitWidth","unitHeight","paddingBottom","toColRow","getFrameIndex","col","row","getColRow","_autoPlayTimer","clearInterval","playCount","count","frameCount","setInterval","floor","DEFAULT_PAN_SCALE","SpinViewer","_scale","_panScale","_frameCount","_sprites","_panInput","_axes","curr","setScale","isNaN","getScale","spinBy","spinTo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;EAQA,CAAC,UAAU,MAAM,EAAE,OAAO,EAAE;GAC3B,AAA+D,cAAc,GAAG,OAAO,EAAE,AAE1D,CAAC;GAChC,CAACA,cAAI,GAAG,YAAY;EAErB,SAAS,gBAAgB,CAAC,CAAC,EAAE;IAC3B,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC;IACpB,OAAO,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CAAC,CAAC;GACjE;;EAED,SAAS,UAAU,CAAC,CAAC,EAAE;IACrB,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BiF,KAAlB,EAAyC;EAAA,UAAlCjF,KAAkC;EAAlCA,QAAAA,KAAkC,GAA1B,CAA0B;EAAA;;EAAA,UAAvBiF,KAAuB;EAAvBA,QAAAA,KAAuB,GAAf;EAACsE,UAAAA,QAAQ,EAAE;EAAX,SAAe;EAAA;;EACxC,WAAKurB,KAAL,CAAWpuB,KAAX,CAAiB;EAAC1G,QAAAA,KAAK,EAALA;EAAD,OAAjB,EAA0BiF,KAAK,CAACsE,QAAhC;;EACA,aAAO,IAAP;EACA;EAED;;;;;;;;aAMA1a,WAAA,oBAAW;EACV,aAAO,KAAKimC,KAAL,CAAW5vB,GAAX,GAAiBlF,KAAjB,IAA0B,CAAjC;EACA;;;MAjOuBpH;;EAAnB47B,EAAAA,WAWEzyB,UAAUA;WAXZyyB;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/view360.pkgd.min.js b/dist/view360.pkgd.min.js new file mode 100644 index 000000000..4cc176774 --- /dev/null +++ b/dist/view360.pkgd.min.js @@ -0,0 +1,11 @@ +/* +Copyright (c) 2017 NAVER Corp. +@egjs/view360 project is licensed under the MIT license +@egjs/view360 JavaScript library +https://github.com/naver/egjs-view360 +@version 3.3.3 +All-in-one packaged file for ease use of '@egjs/view360' with below dependencies. +- @egjs/agent ^2.2.1, @egjs/axes ^2.7.1, @egjs/component ^2.1.2, es6-promise ^4.2.5, gl-matrix ^3.1.0, motion-sensors-polyfill ^0.3.1, webvr-polyfill ^0.9.41 +*/ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t.eg=t.eg||{},t.eg.view360={}))}(this,function(t){"use strict";function n(t,e){for(var i=0;i=Qt(e)?t<0?ae:ue:e<0?he:ce}function Pe(t,e,i){return{x:e/t||0,y:i/t||0}}function Ce(t,e){var i=t.session,n=e.pointers,r=n.length;i.firstInput||(i.firstInput=Ee(e)),1Qt(y.y)?y.x:y.y,e.scale=f?(v=f.pointers,Te((m=n)[0],m[1],ve)/Te(v[0],v[1],ve)):1,e.rotation=f?(g=f.pointers,be((_=n)[1],_[0],ve)+be(g[1],g[0],ve)):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,n,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==oe&&(ieQt(c.y)?c.x:c.y,o=Re(u,h),t.lastInterval=e}else i=s.velocity,n=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=i,e.velocityX=n,e.velocityY=r,e.direction=o}(i,e);var w,x=t.element,E=e.srcEvent;we(w=E.composedPath?E.composedPath()[0]:E.path?E.path[0]:E.target,x)&&(x=w),e.target=x}function Ae(t,e,i){var n=i.pointers.length,r=i.changedPointers.length,o=e&ne&&n-r==0,s=e&(re|oe)&&n-r==0;i.isFirst=!!o,i.isFinal=!!s,o&&(t.session={}),i.eventType=e,Ce(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function Ie(t){return t.trim().split(/\s+/g)}function Oe(e,t,i){me(Ie(t),function(t){e.addEventListener(t,i,!1)})}function Se(e,t,i){me(Ie(t),function(t){e.removeEventListener(t,i,!1)})}function De(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var Me=function(){function t(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){ge(e.options.enable,[e])&&i.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&Oe(this.element,this.evEl,this.domHandler),this.evTarget&&Oe(this.target,this.evTarget,this.domHandler),this.evWin&&Oe(De(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&Se(this.element,this.evEl,this.domHandler),this.evTarget&&Se(this.target,this.evTarget,this.domHandler),this.evWin&&Se(De(this.element),this.evWin,this.domHandler)},t}();function Le(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;ne[i]}):n.sort()),n}var We={touchstart:ne,touchmove:2,touchend:re,touchcancel:oe},Xe=function(e){function i(){var t;return i.prototype.evTarget="touchstart touchmove touchend touchcancel",(t=e.apply(this,arguments)||this).targetIds={},t}return Dt(i,e),i.prototype.handler=function(t){var e=We[t.type],i=function(t,e){var i,n,r=Qe(t.touches),o=this.targetIds;if(e&(2|ne)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=Qe(t.changedTouches),a=[],u=this.target;if(n=r.filter(function(t){return we(t.target,u)}),e===ne)for(i=0;ie.threshold&&r&e.direction},e.attrTest=function(t){return ei.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=ii(t.direction);e&&(t.additionalEvent=this.options.event+e),i.prototype.emit.call(this,t)},t}(ei),ri=function(i){function t(t){return void 0===t&&(t={}),i.call(this,St({event:"pinch",threshold:0,pointers:2},t))||this}Dt(t,i);var e=t.prototype;return e.getTouchAction=function(){return[Ht]},e.attrTest=function(t){return i.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},e.emit=function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}i.prototype.emit.call(this,t)},t}(ei),oi={domEvents:!1,touchAction:Bt,enable:!0,inputTarget:null,inputClass:null,cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function si(i,n){var r,o=i.element;o.style&&(me(i.options.cssProps,function(t,e){r=Wt(o.style,e),n?(i.oldCssProps[r]=o.style[r],o.style[r]=t):o.style[r]=i.oldCssProps[r]||""}),n||(i.oldCssProps={}))}var ai=function(){function t(t,e){var i,n=this;this.options=Ft({},oi,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((i=this).options.inputClass||(Jt?ze:$t?Xe:Zt?qe:Be))(i,Ae),this.touchAction=new ye(this,this.options.touchAction),si(this,!0),me(this.options.recognizers,function(t){var e=n.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return Ft(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var i;this.touchAction.preventDefaults(t);var n=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",i=window.console&&(window.console.warn||window.console.log);return i&&i.call(window.console,r,e),n.apply(this,arguments)}}var hi=ui(function(t,e,i){for(var n=Object.keys(e),r=0;re[1]}function Ai(t,e,i){return i[1]&&t>e[1]||i[0]&&t]*)>/)){var n=document.createElement("div");n.innerHTML=t,i=Oi(n.childNodes)}else i=Oi(document.querySelectorAll(t));e||(i=1<=i.length?i[0]:void 0)}else t===bi?i=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in bi&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return Si(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t;return i}var Di=(bi="undefined"==typeof window?{navigator:{userAgent:""}}:window).requestAnimationFrame||bi.webkitRequestAnimationFrame,Mi=bi.cancelAnimationFrame||bi.webkitCancelAnimationFrame;if(Di&&!Mi){var Li={},Fi=Di;Di=function(e){var i=Fi(function(t){Li[i]&&e(t)});return Li[i]=!0,i},Mi=function(t){delete Li[t]}}else Di&&Mi||(Di=function(t){return bi.setTimeout(function(){t(bi.performance&&bi.performance.now&&bi.performance.now()||(new Date).getTime())},16)},Mi=bi.clearTimeout);function Vi(t,e){var i={};for(var n in t)n&&(i[n]=e(t[n],n));return i}function Ni(t,e){var i={};for(var n in t)n&&e(t[n],n)&&(i[n]=t[n]);return i}function Ui(t,e){for(var i in t)if(i&&!e(t[i],i))return!1;return!0}function zi(t,i){return Ui(t,function(t,e){return t===i[e]})}var Qi={};function ki(t,e){var i,n;return Qi[e]||(Qi[e]=(n=(i=e)<1?Math.pow(10,Xi(i)):1,function(t){return 0===i?0:Math.round(Math.round(t/i)*i*n)/n})),Qi[e](t)}function Wi(t,i){if(!t||!i)return t;var n="number"==typeof i;return Vi(t,function(t,e){return ki(t,n?i:i[e])})}function Xi(t){if(!isFinite(t))return 0;var e=t+"";if(0<=e.indexOf("e")){for(var i=0,n=1;Math.round(t*n)/n!==t;)n*=10,i++;return i}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function Yi(t,e,i){return Math.max(Math.min(t,i),e)}var Bi,Gi=function(){function t(t){var e=t.options,i=t.itm,n=t.em,r=t.axm;this.options=e,this.itm=i,this.em=n,this.axm=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(o,t,e){var i,s=this;if(void 0!==e)i=e;else{var n=Vi(t,function(t,e){return i=Math.abs(t-o[e]),n=s.options.deceleration,(r=Math.sqrt(i/n*2))<100?0:r;var i,n,r});i=Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)}return Yi(i,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,i){var n=this.axm.get(),r=t,o=i&&i.event||null;return{depaPos:n,destPos:r,duration:Yi(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(n,r),inputEvent:o,input:i&&i.input||null,isTrusted:!!o,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var i=this.axm.get(t),n=this.axm.map(i,function(t,e){return Ii(t,e.range,e.circular)});Ui(n,function(t,e){return i[e]===t})||this.em.triggerChange(n,!1,i,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,Mi(r)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var r},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axm.get(),i=this.axm.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.animateTo(i,this.getDuration(e,i),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e){return Ai(t,e.range,e.circular)});0=i[e]-1e-6&&t<=i[e]+1e-6?i[e]:ki(t,n.getRoundUnit(t,e))})},e.getRoundUnit=function(t,e){var i,n=this.options.round,r=null;if(!n){var o=this.axm.getAxisOptions(e);i=Math.max(Xi(o.range[0]),Xi(o.range[1]),Xi(t)),r=1/Math.pow(10,i)}return r||n},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=Yi(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,i){var n=this,r=this.createAnimationParam(t,e,i),o=Ri({},r.depaPos),s=this.em.triggerAnimationStart(r),a=this.getUserControll(r);if(!s&&this.axm.every(a.destPos,function(t,e){return Ai(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),s&&!zi(a.destPos,o)){var u=i&&i.event||null;this.animateLoop({depaPos:o,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(o,a.destPos),isTrusted:!!u,inputEvent:u,input:i&&i.input||null},function(){return n.animationEnd()})}},e.easing=function(t){return 1window.innerWidth-e,this.panFlag=!0}}else t.isFinal&&this.onPanend(t)},e.onPanmove=function(t){var e=this;if(this.panFlag){var i=function(t,e){if(e<0||90Math.abs(t.z)?mn.set(-t.y,t.x,0):mn.set(0,-t.z,t.y)):mn.crossVectors(t,e),this.x=mn.x,this.y=mn.y,this.z=mn.z,this.w=gn,this.normalize(),this}};var yn,wn,xn,En,Tn,bn,Rn,Pn,Cn,An=_n,In=window.Util||{};function On(t,e,i,n,r){var o,s,a,u,h,c,l,f,d,p;o=t,s=n?n.fieldOfView:null,a=r.depthNear,u=r.depthFar,h=Math.tan(s?s.upDegrees*bn:Rn),c=Math.tan(s?s.downDegrees*bn:Rn),l=Math.tan(s?s.leftDegrees*bn:Rn),f=Math.tan(s?s.rightDegrees*bn:Rn),d=2/(l+f),p=2/(h+c),o[0]=d,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=p,o[6]=0,o[7]=0,o[8]=-(l-f)*d*.5,o[9]=(h-c)*p*.5,o[10]=u/(a-u),o[11]=-1,o[12]=0,o[13]=0,o[14]=u*a/(a-u),o[15]=0;var v,m,g,_,y,w,x,E,T,b,R,P,C,A,I,O,S,D,M,L,F,V,N,U,z,Q,k,W,X,Y,B,G,H,j,q,K,Z,J,$,tt,et,it,nt,rt,ot,st,at,ut,ht,ct,lt,ft,dt,pt,vt,mt,gt,_t,yt,wt,xt,Et,Tt,bt,Rt,Pt,Ct,At,It=i.orientation||Pn,Ot=i.position||Cn;v=e,g=Ot,_=(m=It)[0],y=m[1],w=m[2],x=m[3],R=_*(E=_+_),P=_*(T=y+y),C=_*(b=w+w),A=y*T,I=y*b,O=w*b,S=x*E,D=x*T,M=x*b,v[0]=1-(A+O),v[1]=P+M,v[2]=C-D,v[3]=0,v[4]=P-M,v[5]=1-(R+O),v[6]=I+S,v[7]=0,v[8]=C+D,v[9]=I-S,v[10]=1-(R+A),v[11]=0,v[12]=g[0],v[13]=g[1],v[14]=g[2],v[15]=1,n&&(F=L=e,V=n.offset,q=V[0],K=V[1],Z=V[2],F===L?(L[12]=F[0]*q+F[4]*K+F[8]*Z+F[12],L[13]=F[1]*q+F[5]*K+F[9]*Z+F[13],L[14]=F[2]*q+F[6]*K+F[10]*Z+F[14],L[15]=F[3]*q+F[7]*K+F[11]*Z+F[15]):(N=F[0],U=F[1],z=F[2],Q=F[3],k=F[4],W=F[5],X=F[6],Y=F[7],B=F[8],G=F[9],H=F[10],j=F[11],L[0]=N,L[1]=U,L[2]=z,L[3]=Q,L[4]=k,L[5]=W,L[6]=X,L[7]=Y,L[8]=B,L[9]=G,L[10]=H,L[11]=j,L[12]=N*q+k*K+B*Z+F[12],L[13]=U*q+W*K+G*Z+F[13],L[14]=z*q+X*K+H*Z+F[14],L[15]=Q*q+Y*K+j*Z+F[15])),tt=($=J=e)[0],et=$[1],it=$[2],nt=$[3],rt=$[4],ot=$[5],st=$[6],at=$[7],ut=$[8],ht=$[9],ct=$[10],lt=$[11],ft=$[12],dt=$[13],pt=$[14],vt=$[15],(At=(mt=tt*ot-et*rt)*(Ct=ct*vt-lt*pt)-(gt=tt*st-it*rt)*(Pt=ht*vt-lt*dt)+(_t=tt*at-nt*rt)*(Rt=ht*pt-ct*dt)+(yt=et*st-it*ot)*(bt=ut*vt-lt*ft)-(wt=et*at-nt*ot)*(Tt=ut*pt-ct*ft)+(xt=it*at-nt*st)*(Et=ut*dt-ht*ft))&&(At=1/At,J[0]=(ot*Ct-st*Pt+at*Rt)*At,J[1]=(it*Pt-et*Ct-nt*Rt)*At,J[2]=(dt*xt-pt*wt+vt*yt)*At,J[3]=(ct*wt-ht*xt-lt*yt)*At,J[4]=(st*bt-rt*Ct-at*Tt)*At,J[5]=(tt*Ct-it*bt+nt*Tt)*At,J[6]=(pt*_t-ft*xt-vt*gt)*At,J[7]=(ut*xt-ct*_t+lt*gt)*At,J[8]=(rt*Pt-ot*bt+at*Et)*At,J[9]=(et*bt-tt*Pt-nt*Et)*At,J[10]=(ft*wt-dt*_t+vt*mt)*At,J[11]=(ht*_t-ut*wt-lt*mt)*At,J[12]=(ot*Tt-rt*Rt-st*Et)*At,J[13]=(tt*Rt-et*Tt+it*Et)*At,J[14]=(dt*gt-ft*yt-pt*mt)*At,J[15]=(ut*yt-ht*gt+ct*mt)*At)}In.MIN_TIMESTEP=.001,In.MAX_TIMESTEP=1,In.base64=function(t,e){return"data:"+t+";base64,"+e},In.clamp=function(t,e,i){return Math.min(Math.max(e,t),i)},In.lerp=function(t,e,i){return t+(e-t)*i},In.race=function(n){return Promise.race?Promise.race(n):new Promise(function(t,e){for(var i=0;iIn.MAX_TIMESTEP))},In.getScreenWidth=function(){return Math.max(window.screen.width,window.screen.height)*window.devicePixelRatio},In.getScreenHeight=function(){return Math.min(window.screen.width,window.screen.height)*window.devicePixelRatio},In.requestFullscreen=function(t){if(In.isWebViewAndroid())return!1;if(t.requestFullscreen)t.requestFullscreen();else if(t.webkitRequestFullscreen)t.webkitRequestFullscreen();else if(t.mozRequestFullScreen)t.mozRequestFullScreen();else{if(!t.msRequestFullscreen)return!1;t.msRequestFullscreen()}return!0},In.exitFullscreen=function(){if(document.exitFullscreen)document.exitFullscreen();else if(document.webkitExitFullscreen)document.webkitExitFullscreen();else if(document.mozCancelFullScreen)document.mozCancelFullScreen();else{if(!document.msExitFullscreen)return!1;document.msExitFullscreen()}return!0},In.getFullscreenElement=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement},In.linkProgram=function(t,e,i,n){var r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);var o=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(o,i),t.compileShader(o);var s=t.createProgram();for(var a in t.attachShader(s,r),t.attachShader(s,o),n)t.bindAttribLocation(s,n[a],a);return t.linkProgram(s),t.deleteShader(r),t.deleteShader(o),s},In.getProgramUniforms=function(t,e){for(var i={},n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r="",o=0;os[1]&&(u=s[1]),a!==u&&(i.setTo({fov:u},0),this._updateControlScale(),this.updatePanScale())}t.some(function(t){return"gyroMode"===t})&&Rt&&(this.axesTiltMotionInput&&(this.axes.disconnect(this.axesTiltMotionInput),this.axesTiltMotionInput.destroy(),this.axesTiltMotionInput=null),this._deviceQuaternion&&(this._deviceQuaternion.destroy(),this._deviceQuaternion=null),n?this._initDeviceQuaternion():r&&(this.axesTiltMotionInput=new qn(this._element),this.axes.connect(["yaw","pitch"],this.axesTiltMotionInput)),this.axesPanInput.setUseRotation(n)),t.some(function(t){return"useKeyboard"===t})&&(e.useKeyboard?i.connect(["yaw","pitch"],this.axesMoveKeyInput):i.disconnect(this.axesMoveKeyInput));if(t.some(function(t){return"useZoom"===t})){var h=e.useZoom;i.disconnect(this.axesWheelInput),h&&i.connect(["fov"],this.axesWheelInput)}this._togglePinchInputByOption(e.touchDirection,e.useZoom),t.some(function(t){return"touchDirection"===t})&&this._enabled&&this._enableTouch(o)},t._togglePinchInputByOption=function(t,e){this.axesPinchInput&&(this.axes.disconnect(this.axesPinchInput),e&&6===t&&-1===this.axes._inputs.indexOf(this.axesPinchInput)&&this.axes.connect(["fov"],this.axesPinchInput))},t._enableTouch=function(t){this.axesPanInput&&this.axes.disconnect(this.axesPanInput);var e=2&t?"yaw":null,i=4&t?"pitch":null;this.axes.connect([e,i],this.axesPanInput)},t._initDeviceQuaternion=function(){var e=this;this._deviceQuaternion=new er,this._deviceQuaternion.on("change",function(t){e._triggerChange(t)})},t._getValidYawRange=function(t,e,i){var n=u.adjustAspectRatio(i||this.options.aspectRatio||1),r=(e||this.axes.get().fov)*n;return t[1]-t[0]>=r?t:this.options.yawRange||nr},t._getValidPitchRange=function(t,e){var i=e||this.axes.get().fov;return t[1]-t[0]>=i?t:this.options.pitchRange||rr},u.isCircular=function(t){return t[1]-t[0]<360?[!1,!1]:[!0,!0]},t._updateControlScale=function(t){var e=this.options,i=this.axes.get().fov,n=this._updatePitchRange(e.pitchRange,i,e.showPolePoint),r=this._updateYawRange(e.yawRange,i,e.aspectRatio),o=this.axes.get(),s=o.yaw,a=o.pitch;return K(this.axes.axis.yaw.range,r),K(this.axes.axis.pitch.range,n),this.axes.axis.yaw.circular=u.isCircular(r),this.axes.axis.pitch.circular=u.isCircular(n),sr[1]&&(s=r[1]),an[1]&&(a=n[1]),t&&t.set({yaw:s,pitch:a}),this.axes.setTo({yaw:s,pitch:a},0),this},t._updatePitchRange=function(t,e,i){if(this.options.gyroMode===Wn.VR)return or;var n=t[1]-t[0],r=e/2;return i&&!(n<180)?t.concat():[t[0]+r,t[1]-r]},t._updateYawRange=function(t,e,i){if(this.options.gyroMode===Wn.VR)return nr;if(360<=t[1]-t[0])return t.concat();var n=dn.toDegree(Math.atan2(i,1/Math.tan(w(e/2))));return[t[0]+n,t[1]-n]},t._triggerChange=function(t){var e=this.axes.get(),i=this.options,n={targetElement:i.element,isTrusted:t.isTrusted};n.yaw=e.yaw,n.pitch=e.pitch,n.fov=e.fov,i.gyroMode===Wn.VR&&this._deviceQuaternion&&(n.quaternion=this._deviceQuaternion.getCombinedQuaternion(e.yaw)),this.trigger("change",n)},u.adjustAspectRatio=function(t){for(var e=[.52,.54,.563,.57,.584,.59,.609,.67,.702,.72,.76,.78,.82,.92,.97,1,1.07,1.14,1.19,1.25,1.32,1.38,1.4,1.43,1.53,1.62,1.76,1.77,1.86,1.96,2.26,2.3,2.6,3,5,6],i=[.51,.54,.606,.56,.628,.63,.647,.71,.736,.757,.78,.77,.8,.89,.975,1,1.07,1.1,1.15,1.18,1.22,1.27,1.3,1.33,1.39,1.45,1.54,1.55,1.58,1.62,1.72,1.82,1.92,2,2.24,2.3],n=-1,r=0;r=this._sourceCount&&(this._loadStatus=gr,this._detachErrorHandler(this._onerror))},e._appendSourceElement=function(t){var e,i;if("object"==typeof t?(e=t.src,i=t.type):"string"==typeof t&&(e=t),!e)return!1;var n=document.createElement("source");return n.src=e,i&&(n.type=i),this._video.appendChild(n),!0},e.set=function(t){var e=this;this._reset(),t&&(t instanceof HTMLVideoElement?this._video=t:"string"!=typeof t&&"object"!=typeof t||(this._video=document.createElement("video"),this._video.setAttribute("crossorigin","anonymous"),this._video.setAttribute("webkit-playsinline",""),this._video.setAttribute("playsinline",""),t instanceof Array?t.forEach(function(t){return e._appendSourceElement(t)}):this._appendSourceElement(t),this._sourceCount=this._video.querySelectorAll("source").length,0=i._thresholdReadyState)t(i._video);else{i._attachErrorHandler(function t(){i._loadStatus===gr&&(i._detachErrorHandler(t),e("VideoLoader: video source is invalid"))}),i._once(i._thresholdEventName,function(){return t(i._video)})}else e("VideoLoader: video is undefined")})},e.getElement=function(){return this._video},e.destroy=function(){this._reset()},e._reset=function(){var e=this;this._handlers.forEach(function(t){e._video.removeEventListener(t.type,t.fn)}),this._handlers=[],this._video=null,this._sourceCount=0,this._errorCount=0},e._once=function(e,i){function n(t){r.removeEventListener(e,n),i(t)}var r=this._video;r.addEventListener(e,n,!0),this._handlers.push({type:e,fn:n})},t}(),Er={0:"NO_ERROR",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",37442:"CONTEXT_LOST_WEBGL"},Tr=null,br=function(){function n(){}return n.createShader=function(t,e,i){var n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS)?n:(console.error(t.getShaderInfoLog(n)),null)},n.createProgram=function(t,e,i){var n=t.createProgram();return t.attachShader(n,e),t.attachShader(n,i),t.linkProgram(n),t.detachShader(n,e),t.detachShader(n,i),t.deleteShader(e),t.deleteShader(i),t.getProgramParameter(n,t.LINK_STATUS)?n:(t.deleteProgram(n),null)},n.initBuffer=function(t,e,i,n,r){var o=t.createBuffer();return t.bindBuffer(e,o),t.bufferData(e,i,t.STATIC_DRAW),o&&(o.itemSize=n,o.numItems=i.length/n),void 0!==r&&(t.enableVertexAttribArray(r),t.vertexAttribPointer(r,o.itemSize,t.FLOAT,!1,0,0)),o},n.getWebglContext=function(t,e){var i=["webgl","experimental-webgl","webkit-3d","moz-webgl"],n=null,r=h({preserveDrawingBuffer:!1,antialias:!1,xrCompatible:!0},e);function o(t){return t.statusMessage}t.addEventListener("webglcontextcreationerror",o);for(var s=0;s= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"},i.getVertexPositionData=function(){return this._vertices||(this._vertices=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1]),this._vertices},i.getIndexData=function(){var i=this;return function(){for(var t=[],e=0;ethis._rowCount-1||t>this._colCount-1||(this._image&&At&&(this._image.style[At]="translate("+-t/this._colCount*100+"%, "+-e/this._rowCount*100+"%)"),this._colRow=[t,e])},t.getColRow=function(){return this._colRow},o._getSizeString=function(t){return"number"==typeof t?t+"px":t},t.stop=function(){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=null)},t.play=function(t){var e=this,i=void 0===t?{interval:1e3/this._totalCount,playCount:0}:t,n=i.interval,r=i.playCount;if(this._bg){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=null);var o=this.getFrameIndex(),s=0,a=0;this._autoPlayTimer=setInterval(function(){o%=e._totalCount;var t=e.toColRow(o);e.setColRow(t[0],t[1]),o++,++a===e._totalCount&&(a=0,s++),0=this._totalCount?[e-1,i-1]:[t%e,Math.floor(t/e)]},o}(o);return t.VERSION=ir,t}(),xo=function(){var t=function(s){function t(t,e){var n;(n=s.call(this)||this)._el=t;var i=h({},e),r=i.colCount||1,o=i.rowCount||1;return n._scale=i.scale||1,n._panScale=.21*n._scale,n._frameCount=r*o,n._sprites=new wo(t,i).on({load:function(t){n.trigger("load",t)},imageError:function(t){n.trigger("imageError",{imageUrl:t.imageUrl})}}),n._panInput=new un(n._el,{scale:[n._panScale,n._panScale]}),n._axes=new $i({angle:{range:[0,359],circular:!0}}).on({change:function(t){var e=Math.floor(t.pos.angle/(360/n._frameCount)),i=n._frameCount-e-1;n._sprites.setFrameIndex(i),n.trigger("change",{frameIndex:i,colRow:n._sprites.getColRow(),angle:t.pos.angle})},animationEnd:function(t){n.trigger("animationEnd",{isTrusted:t.isTrusted})}}),n._axes.connect("angle",n._panInput),n}c(t,s);var e=t.prototype;return e.setScale=function(t){return isNaN(t)||t<0||(this._scale=t,this._panScale=.21*t,this._panInput.options.scale=[this._panScale,this._panScale]),this},e.getScale=function(){return this._scale},e.spinBy=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setBy({angle:t},e.duration),this},e.spinTo=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setTo({angle:t},e.duration),this},e.getAngle=function(){return this._axes.get().angle||0},t}(o);return t.VERSION=ir,t}();t.PanoViewer=yo,t.SpinViewer=xo,t.SpriteImage=wo,t.VERSION=ir,Object.defineProperty(t,"__esModule",{value:!0})}); +//# sourceMappingURL=view360.pkgd.min.js.map diff --git a/dist/view360.pkgd.min.js.map b/dist/view360.pkgd.min.js.map new file mode 100644 index 000000000..020cbdd67 --- /dev/null +++ b/dist/view360.pkgd.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"view360.pkgd.min.js","sources":["../node_modules/es6-promise/dist/es6-promise.js","../node_modules/@egjs/component/dist/component.esm.js","../node_modules/gl-matrix/esm/common.js","../node_modules/gl-matrix/esm/mat3.js","../node_modules/gl-matrix/esm/mat4.js","../node_modules/gl-matrix/esm/vec3.js","../node_modules/gl-matrix/esm/vec4.js","../node_modules/gl-matrix/esm/quat.js","../node_modules/gl-matrix/esm/vec2.js","../node_modules/@egjs/agent/dist/agent.esm.js","../src/utils/browser.js","../src/utils/browserFeature.js","../node_modules/@egjs/hammerjs/dist/hammer.esm.js","../node_modules/@egjs/axes/node_modules/@egjs/agent/dist/agent.esm.js","../node_modules/@egjs/axes/dist/axes.esm.js","../src/utils/math-util.js","../node_modules/webvr-polyfill/src/math-util.js","../node_modules/webvr-polyfill/src/util.js","../node_modules/webvr-polyfill/src/sensor-fusion/pose-predictor.js","../src/YawPitchControl/consts.js","../src/YawPitchControl/input/DeviceMotion.js","../node_modules/webvr-polyfill/src/sensor-fusion/sensor-sample.js","../node_modules/webvr-polyfill/src/sensor-fusion/complementary-filter.js","../src/YawPitchControl/input/ComplementaryFilter.js","../src/YawPitchControl/input/FusionPoseSensor.js","../src/YawPitchControl/input/TiltMotionInput.js","../src/YawPitchControl/utils.js","../src/YawPitchControl/ScreenRotationAngle.js","../src/YawPitchControl/input/RotationPanInput.js","../src/YawPitchControl/DeviceQuaternion.js","../src/version.js","../src/YawPitchControl/YawPitchControl.js","../src/PanoImageRenderer/ImageLoader.js","../src/PanoImageRenderer/VideoLoader.js","../src/PanoImageRenderer/renderer/SphereRenderer.js","../src/PanoImageRenderer/WebGLUtils.js","../src/PanoImageRenderer/renderer/Renderer.js","../src/PanoImageRenderer/renderer/CubeRenderer.js","../src/PanoImageRenderer/renderer/CubeStripRenderer.js","../src/PanoViewer/consts.js","../src/PanoImageRenderer/renderer/CylinderRenderer.js","../src/PanoImageRenderer/vr/VRManager.js","../src/PanoImageRenderer/vr/XRManager.js","../src/PanoImageRenderer/WebGLAnimator.js","../src/PanoImageRenderer/PanoImageRenderer.js","../src/PanoViewer/PanoViewer.js","../src/SpinViewer/SpriteImage.js","../src/SpinViewer/SpinViewer.js"],"sourcesContent":["/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n\n(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.ES6Promise = factory());\n}(this, (function () { 'use strict';\n\nfunction objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n}\n\nfunction isFunction(x) {\n return typeof x === 'function';\n}\n\n\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== 'undefined' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve$1(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n}\n\nfunction tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n try {\n then$$1.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then$$1) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then$$1, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$1) {\n if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$1 === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$1)) {\n handleForeignThenable(promise, maybeThenable, then$$1);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then$$1 = void 0;\n try {\n then$$1 = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then$$1);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) {\n // noop\n } else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction validationError() {\n return new Error('Array Methods must be provided an Array');\n}\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve$$1 = c.resolve;\n\n\n if (resolve$$1 === resolve$1) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise$1) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$1) {\n return resolve$$1(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$1(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n\n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject$1(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n}\n\nfunction needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n\n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== 'undefined') {\n local = global;\n } else if (typeof self !== 'undefined') {\n local = self;\n } else {\n try {\n local = Function('return this')();\n } catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n//# sourceMappingURL=es6-promise.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/component project is licensed under the MIT license\n\n@egjs/component JavaScript library\nhttps://naver.github.io/egjs-component\n\n@version 2.1.2\n*/\n/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\n/**\n * A class used to manage events in a component\n * @ko 컴포넌트의 이벤트을 관리할 수 있게 하는 클래스\n * @alias eg.Component\n */\n\n\nvar Component =\n/*#__PURE__*/\nfunction () {\n var Component =\n /*#__PURE__*/\n function () {\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Component.VERSION; // ex) 2.0.0\n * @memberof eg.Component\n */\n\n /**\n * @support {\"ie\": \"7+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.1+ (except 3.x)\"}\n */\n function Component() {\n this._eventHandler = {};\n this.options = {};\n }\n /**\n * Triggers a custom event.\n * @ko 커스텀 이벤트를 발생시킨다\n * @param {String} eventName The name of the custom event to be triggered 발생할 커스텀 이벤트의 이름\n * @param {Object} customEvent Event data to be sent when triggering a custom event 커스텀 이벤트가 발생할 때 전달할 데이터\n * @return {Boolean} Indicates whether the event has occurred. If the stop() method is called by a custom event handler, it will return false and prevent the event from occurring. Ref 이벤트 발생 여부. 커스텀 이벤트 핸들러에서 stop() 메서드를 호출하면 'false'를 반환하고 이벤트 발생을 중단한다. 참고\n * @example\n class Some extends eg.Component {\n some(){\n \tif(this.trigger(\"beforeHi\")){ // When event call to stop return false.\n \tthis.trigger(\"hi\");// fire hi event.\n \t}\n }\n }\n const some = new Some();\n some.on(\"beforeHi\", (e) => {\n if(condition){\n \te.stop(); // When event call to stop, `hi` event not call.\n }\n });\n some.on(\"hi\", (e) => {\n // `currentTarget` is component instance.\n console.log(some === e.currentTarget); // true\n });\n // If you want to more know event design. You can see article.\n // https://github.com/naver/egjs-component/wiki/How-to-make-Component-event-design%3F\n */\n\n\n var _proto = Component.prototype;\n\n _proto.trigger = function trigger(eventName, customEvent) {\n if (customEvent === void 0) {\n customEvent = {};\n }\n\n var handlerList = this._eventHandler[eventName] || [];\n var hasHandlerList = handlerList.length > 0;\n\n if (!hasHandlerList) {\n return true;\n } // If detach method call in handler in first time then handler list calls.\n\n\n handlerList = handlerList.concat();\n customEvent.eventType = eventName;\n var isCanceled = false;\n var arg = [customEvent];\n var i = 0;\n\n customEvent.stop = function () {\n isCanceled = true;\n };\n\n customEvent.currentTarget = this;\n\n for (var _len = arguments.length, restParam = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n restParam[_key - 2] = arguments[_key];\n }\n\n if (restParam.length >= 1) {\n arg = arg.concat(restParam);\n }\n\n for (i = 0; handlerList[i]; i++) {\n handlerList[i].apply(this, arg);\n }\n\n return !isCanceled;\n };\n /**\n * Executed event just one time.\n * @ko 이벤트가 한번만 실행된다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n alert(\"hi\");\n }\n thing() {\n this.once(\"hi\", this.hi);\n }\n }\n var some = new Some();\n some.thing();\n some.trigger(\"hi\");\n // fire alert(\"hi\");\n some.trigger(\"hi\");\n // Nothing happens\n */\n\n\n _proto.once = function once(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var i;\n\n for (i in eventHash) {\n this.once(i, eventHash[i]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var self = this;\n this.on(eventName, function listener() {\n for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n arg[_key2] = arguments[_key2];\n }\n\n handlerToAttach.apply(self, arg);\n self.off(eventName, listener);\n });\n }\n\n return this;\n };\n /**\n * Checks whether an event has been attached to a component.\n * @ko 컴포넌트에 이벤트가 등록됐는지 확인한다.\n * @param {String} eventName The name of the event to be attached 등록 여부를 확인할 이벤트의 이름\n * @return {Boolean} Indicates whether the event is attached. 이벤트 등록 여부\n * @example\n class Some extends eg.Component {\n some() {\n this.hasOn(\"hi\");// check hi event.\n }\n }\n */\n\n\n _proto.hasOn = function hasOn(eventName) {\n return !!this._eventHandler[eventName];\n };\n /**\n * Attaches an event to a component.\n * @ko 컴포넌트에 이벤트를 등록한다.\n * @param {eventName} eventName The name of the event to be attached 등록할 이벤트의 이름\n * @param {Function} handlerToAttach The handler function of the event to be attached 등록할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.on(\"hi\",this.hi); //attach event\n }\n }\n */\n\n\n _proto.on = function on(eventName, handlerToAttach) {\n if (typeof eventName === \"object\" && isUndefined(handlerToAttach)) {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.on(name, eventHash[name]);\n }\n\n return this;\n } else if (typeof eventName === \"string\" && typeof handlerToAttach === \"function\") {\n var handlerList = this._eventHandler[eventName];\n\n if (isUndefined(handlerList)) {\n this._eventHandler[eventName] = [];\n handlerList = this._eventHandler[eventName];\n }\n\n handlerList.push(handlerToAttach);\n }\n\n return this;\n };\n /**\n * Detaches an event from the component.\n * @ko 컴포넌트에 등록된 이벤트를 해제한다\n * @param {eventName} eventName The name of the event to be detached 해제할 이벤트의 이름\n * @param {Function} handlerToDetach The handler function of the event to be detached 해제할 이벤트의 핸들러 함수\n * @return {eg.Component} An instance of a component itself 컴포넌트 자신의 인스턴스\n * @example\n class Some extends eg.Component {\n hi() {\n console.log(\"hi\");\n }\n some() {\n this.off(\"hi\",this.hi); //detach event\n }\n }\n */\n\n\n _proto.off = function off(eventName, handlerToDetach) {\n // All event detach.\n if (isUndefined(eventName)) {\n this._eventHandler = {};\n return this;\n } // All handler of specific event detach.\n\n\n if (isUndefined(handlerToDetach)) {\n if (typeof eventName === \"string\") {\n this._eventHandler[eventName] = undefined;\n return this;\n } else {\n var eventHash = eventName;\n var name;\n\n for (name in eventHash) {\n this.off(name, eventHash[name]);\n }\n\n return this;\n }\n } // The handler of specific event detach.\n\n\n var handlerList = this._eventHandler[eventName];\n\n if (handlerList) {\n var k;\n var handlerFunction;\n\n for (k = 0; (handlerFunction = handlerList[k]) !== undefined; k++) {\n if (handlerFunction === handlerToDetach) {\n handlerList = handlerList.splice(k, 1);\n break;\n }\n }\n }\n\n return this;\n };\n\n return Component;\n }();\n\n Component.VERSION = \"2.1.2\";\n return Component;\n}();\n\nexport default Component;\n//# sourceMappingURL=component.esm.js.map\n","/**\r\n * Common utilities\r\n * @module glMatrix\r\n */\n// Configuration Constants\nexport var EPSILON = 0.000001;\nexport var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;\nexport var RANDOM = Math.random;\n/**\r\n * Sets the type of array used when creating new vectors and matrices\r\n *\r\n * @param {Type} type Array type, such as Float32Array or Array\r\n */\n\nexport function setMatrixArrayType(type) {\n ARRAY_TYPE = type;\n}\nvar degree = Math.PI / 180;\n/**\r\n * Convert Degree To Radian\r\n *\r\n * @param {Number} a Angle in Degrees\r\n */\n\nexport function toRadian(a) {\n return a * degree;\n}\n/**\r\n * Tests whether or not the arguments have approximately the same value, within an absolute\r\n * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less\r\n * than or equal to 1.0, and a relative tolerance is used for larger values)\r\n *\r\n * @param {Number} a The first number to test.\r\n * @param {Number} b The second number to test.\r\n * @returns {Boolean} True if the numbers are approximately equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));\n}\nif (!Math.hypot) Math.hypot = function () {\n var y = 0,\n i = arguments.length;\n\n while (i--) {\n y += arguments[i] * arguments[i];\n }\n\n return Math.sqrt(y);\n};","import * as glMatrix from \"./common.js\";\n/**\r\n * 3x3 Matrix\r\n * @module mat3\r\n */\n\n/**\r\n * Creates a new identity mat3\r\n *\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(9);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n }\n\n out[0] = 1;\n out[4] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the upper-left 3x3 values into the given mat3.\r\n *\r\n * @param {mat3} out the receiving 3x3 matrix\r\n * @param {mat4} a the source 4x4 matrix\r\n * @returns {mat3} out\r\n */\n\nexport function fromMat4(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n}\n/**\r\n * Creates a new mat3 initialized with values from an existing matrix\r\n *\r\n * @param {mat3} a matrix to clone\r\n * @returns {mat3} a new 3x3 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Copy the values from one mat3 to another\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Create a new mat3 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} A new mat3\r\n */\n\nexport function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n var out = new glMatrix.ARRAY_TYPE(9);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set the components of a mat3 to the given values\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 3)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 4)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 5)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 6)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 7)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 8)\r\n * @returns {mat3} out\r\n */\n\nexport function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m10;\n out[4] = m11;\n out[5] = m12;\n out[6] = m20;\n out[7] = m21;\n out[8] = m22;\n return out;\n}\n/**\r\n * Set a mat3 to the identity matrix\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @returns {mat3} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b01 = a22 * a11 - a12 * a21;\n var b11 = -a22 * a10 + a12 * a20;\n var b21 = a21 * a10 - a11 * a20; // Calculate the determinant\n\n var det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the source matrix\r\n * @returns {mat3} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n out[0] = a11 * a22 - a12 * a21;\n out[1] = a02 * a21 - a01 * a22;\n out[2] = a01 * a12 - a02 * a11;\n out[3] = a12 * a20 - a10 * a22;\n out[4] = a00 * a22 - a02 * a20;\n out[5] = a02 * a10 - a00 * a12;\n out[6] = a10 * a21 - a11 * a20;\n out[7] = a01 * a20 - a00 * a21;\n out[8] = a00 * a11 - a01 * a10;\n return out;\n}\n/**\r\n * Calculates the determinant of a mat3\r\n *\r\n * @param {mat3} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n}\n/**\r\n * Multiplies two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2];\n var a10 = a[3],\n a11 = a[4],\n a12 = a[5];\n var a20 = a[6],\n a21 = a[7],\n a22 = a[8];\n var b00 = b[0],\n b01 = b[1],\n b02 = b[2];\n var b10 = b[3],\n b11 = b[4],\n b12 = b[5];\n var b20 = b[6],\n b21 = b[7],\n b22 = b[8];\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n}\n/**\r\n * Translate a mat3 by the given vector\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to translate\r\n * @param {vec2} v vector to translate by\r\n * @returns {mat3} out\r\n */\n\nexport function translate(out, a, v) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n x = v[0],\n y = v[1];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n}\n/**\r\n * Rotates a mat3 by the given angle\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function rotate(out, a, rad) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a10 = a[3],\n a11 = a[4],\n a12 = a[5],\n a20 = a[6],\n a21 = a[7],\n a22 = a[8],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n}\n;\n/**\r\n * Scales the mat3 by the dimensions in the given vec2\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to rotate\r\n * @param {vec2} v the vec2 to scale the matrix by\r\n * @returns {mat3} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1];\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.translate(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Translation vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = v[0];\n out[7] = v[1];\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.rotate(dest, dest, rad);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat3} out\r\n */\n\nexport function fromRotation(out, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = -s;\n out[4] = c;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat3.identity(dest);\r\n * mat3.scale(dest, dest, vec);\r\n *\r\n * @param {mat3} out mat3 receiving operation result\r\n * @param {vec2} v Scaling vector\r\n * @returns {mat3} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = v[1];\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n}\n/**\r\n * Copies the values from a mat2d into a mat3\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat2d} a the matrix to copy\r\n * @returns {mat3} out\r\n **/\n\nexport function fromMat2d(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n}\n/**\r\n* Calculates a 3x3 matrix from the given quaternion\r\n*\r\n* @param {mat3} out mat3 receiving operation result\r\n* @param {quat} q Quaternion to create matrix from\r\n*\r\n* @returns {mat3} out\r\n*/\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n return out;\n}\n/**\r\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\r\n*\r\n* @param {mat3} out mat3 receiving operation result\r\n* @param {mat4} a Mat4 to derive the normal matrix from\r\n*\r\n* @returns {mat3} out\r\n*/\n\nexport function normalFromMat4(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n return out;\n}\n/**\r\n * Generates a 2D projection matrix with the given bounds\r\n *\r\n * @param {mat3} out mat3 frustum matrix will be written into\r\n * @param {number} width Width of your gl context\r\n * @param {number} height Height of gl context\r\n * @returns {mat3} out\r\n */\n\nexport function projection(out, width, height) {\n out[0] = 2 / width;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = -2 / height;\n out[5] = 0;\n out[6] = -1;\n out[7] = 1;\n out[8] = 1;\n return out;\n}\n/**\r\n * Returns a string representation of a mat3\r\n *\r\n * @param {mat3} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';\n}\n/**\r\n * Returns Frobenius norm of a mat3\r\n *\r\n * @param {mat3} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]);\n}\n/**\r\n * Adds two mat3's\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @returns {mat3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat3} out the receiving matrix\r\n * @param {mat3} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n return out;\n}\n/**\r\n * Adds two mat3's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat3} out the receiving vector\r\n * @param {mat3} a the first operand\r\n * @param {mat3} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat3} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat3} a The first matrix.\r\n * @param {mat3} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3],\n a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7],\n a8 = a[8];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3],\n b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7],\n b8 = b[8];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8));\n}\n/**\r\n * Alias for {@link mat3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 4x4 Matrix
Format: column-major, when typed out it looks like row-major
The matrices are being post multiplied.\r\n * @module mat4\r\n */\n\n/**\r\n * Creates a new identity mat4\r\n *\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(16);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n }\n\n out[0] = 1;\n out[5] = 1;\n out[10] = 1;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 initialized with values from an existing matrix\r\n *\r\n * @param {mat4} a matrix to clone\r\n * @returns {mat4} a new 4x4 matrix\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Copy the values from one mat4 to another\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Create a new mat4 with the given values\r\n *\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} A new mat4\r\n */\n\nexport function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n var out = new glMatrix.ARRAY_TYPE(16);\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set the components of a mat4 to the given values\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {Number} m00 Component in column 0, row 0 position (index 0)\r\n * @param {Number} m01 Component in column 0, row 1 position (index 1)\r\n * @param {Number} m02 Component in column 0, row 2 position (index 2)\r\n * @param {Number} m03 Component in column 0, row 3 position (index 3)\r\n * @param {Number} m10 Component in column 1, row 0 position (index 4)\r\n * @param {Number} m11 Component in column 1, row 1 position (index 5)\r\n * @param {Number} m12 Component in column 1, row 2 position (index 6)\r\n * @param {Number} m13 Component in column 1, row 3 position (index 7)\r\n * @param {Number} m20 Component in column 2, row 0 position (index 8)\r\n * @param {Number} m21 Component in column 2, row 1 position (index 9)\r\n * @param {Number} m22 Component in column 2, row 2 position (index 10)\r\n * @param {Number} m23 Component in column 2, row 3 position (index 11)\r\n * @param {Number} m30 Component in column 3, row 0 position (index 12)\r\n * @param {Number} m31 Component in column 3, row 1 position (index 13)\r\n * @param {Number} m32 Component in column 3, row 2 position (index 14)\r\n * @param {Number} m33 Component in column 3, row 3 position (index 15)\r\n * @returns {mat4} out\r\n */\n\nexport function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {\n out[0] = m00;\n out[1] = m01;\n out[2] = m02;\n out[3] = m03;\n out[4] = m10;\n out[5] = m11;\n out[6] = m12;\n out[7] = m13;\n out[8] = m20;\n out[9] = m21;\n out[10] = m22;\n out[11] = m23;\n out[12] = m30;\n out[13] = m31;\n out[14] = m32;\n out[15] = m33;\n return out;\n}\n/**\r\n * Set a mat4 to the identity matrix\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @returns {mat4} out\r\n */\n\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Transpose the values of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function transpose(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a12 = a[6],\n a13 = a[7];\n var a23 = a[11];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Inverts a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function invert(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n\n det = 1.0 / det;\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n return out;\n}\n/**\r\n * Calculates the adjugate of a mat4\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the source matrix\r\n * @returns {mat4} out\r\n */\n\nexport function adjoint(out, a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22);\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12);\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22);\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12);\n out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21);\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11);\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21);\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11);\n return out;\n}\n/**\r\n * Calculates the determinant of a mat4\r\n *\r\n * @param {mat4} a the source matrix\r\n * @returns {Number} determinant of a\r\n */\n\nexport function determinant(a) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15];\n var b00 = a00 * a11 - a01 * a10;\n var b01 = a00 * a12 - a02 * a10;\n var b02 = a00 * a13 - a03 * a10;\n var b03 = a01 * a12 - a02 * a11;\n var b04 = a01 * a13 - a03 * a11;\n var b05 = a02 * a13 - a03 * a12;\n var b06 = a20 * a31 - a21 * a30;\n var b07 = a20 * a32 - a22 * a30;\n var b08 = a20 * a33 - a23 * a30;\n var b09 = a21 * a32 - a22 * a31;\n var b10 = a21 * a33 - a23 * a31;\n var b11 = a22 * a33 - a23 * a32; // Calculate the determinant\n\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n}\n/**\r\n * Multiplies two mat4s\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function multiply(out, a, b) {\n var a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3];\n var a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n var a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n var a30 = a[12],\n a31 = a[13],\n a32 = a[14],\n a33 = a[15]; // Cache only the current line of the second matrix\n\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[4];\n b1 = b[5];\n b2 = b[6];\n b3 = b[7];\n out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[8];\n b1 = b[9];\n b2 = b[10];\n b3 = b[11];\n out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n b0 = b[12];\n b1 = b[13];\n b2 = b[14];\n b3 = b[15];\n out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30;\n out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31;\n out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32;\n out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;\n return out;\n}\n/**\r\n * Translate a mat4 by the given vector\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to translate\r\n * @param {vec3} v vector to translate by\r\n * @returns {mat4} out\r\n */\n\nexport function translate(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11];\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n out[3] = a03;\n out[4] = a10;\n out[5] = a11;\n out[6] = a12;\n out[7] = a13;\n out[8] = a20;\n out[9] = a21;\n out[10] = a22;\n out[11] = a23;\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n}\n/**\r\n * Scales the mat4 by the dimensions in the given vec3 not using vectorization\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {vec3} v the vec3 to scale the matrix by\r\n * @returns {mat4} out\r\n **/\n\nexport function scale(out, a, v) {\n var x = v[0],\n y = v[1],\n z = v[2];\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n}\n/**\r\n * Rotates a mat4 by the given angle around the given axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function rotate(out, a, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n var a00, a01, a02, a03;\n var a10, a11, a12, a13;\n var a20, a21, a22, a23;\n var b00, b01, b02;\n var b10, b11, b12;\n var b20, b21, b22;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n a00 = a[0];\n a01 = a[1];\n a02 = a[2];\n a03 = a[3];\n a10 = a[4];\n a11 = a[5];\n a12 = a[6];\n a13 = a[7];\n a20 = a[8];\n a21 = a[9];\n a22 = a[10];\n a23 = a[11]; // Construct the elements of the rotation matrix\n\n b00 = x * x * t + c;\n b01 = y * x * t + z * s;\n b02 = z * x * t - y * s;\n b10 = x * y * t - z * s;\n b11 = y * y * t + c;\n b12 = z * y * t + x * s;\n b20 = x * z * t + y * s;\n b21 = y * z * t - x * s;\n b22 = z * z * t + c; // Perform rotation-specific matrix multiplication\n\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the X axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateX(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Y axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateY(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a20 = a[8];\n var a21 = a[9];\n var a22 = a[10];\n var a23 = a[11];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n}\n/**\r\n * Rotates a matrix by the given angle around the Z axis\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to rotate\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad);\n var a00 = a[0];\n var a01 = a[1];\n var a02 = a[2];\n var a03 = a[3];\n var a10 = a[4];\n var a11 = a[5];\n var a12 = a[6];\n var a13 = a[7];\n\n if (a !== out) {\n // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n } // Perform axis-specific matrix multiplication\n\n\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n}\n/**\r\n * Creates a matrix from a vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromTranslation(out, v) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a vector scaling\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.scale(dest, dest, vec);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {vec3} v Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromScaling(out, v) {\n out[0] = v[0];\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = v[1];\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = v[2];\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a given angle around a given axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotate(dest, dest, rad, axis);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @param {vec3} axis the axis to rotate around\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotation(out, rad, axis) {\n var x = axis[0],\n y = axis[1],\n z = axis[2];\n var len = Math.hypot(x, y, z);\n var s, c, t;\n\n if (len < glMatrix.EPSILON) {\n return null;\n }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c; // Perform rotation-specific matrix multiplication\n\n out[0] = x * x * t + c;\n out[1] = y * x * t + z * s;\n out[2] = z * x * t - y * s;\n out[3] = 0;\n out[4] = x * y * t - z * s;\n out[5] = y * y * t + c;\n out[6] = z * y * t + x * s;\n out[7] = 0;\n out[8] = x * z * t + y * s;\n out[9] = y * z * t - x * s;\n out[10] = z * z * t + c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the X axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateX(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromXRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = c;\n out[6] = s;\n out[7] = 0;\n out[8] = 0;\n out[9] = -s;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Y axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateY(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromYRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = 0;\n out[2] = -s;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = s;\n out[9] = 0;\n out[10] = c;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from the given angle around the Z axis\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.rotateZ(dest, dest, rad);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {Number} rad the angle to rotate the matrix by\r\n * @returns {mat4} out\r\n */\n\nexport function fromZRotation(out, rad) {\n var s = Math.sin(rad);\n var c = Math.cos(rad); // Perform axis-specific matrix multiplication\n\n out[0] = c;\n out[1] = s;\n out[2] = 0;\n out[3] = 0;\n out[4] = -s;\n out[5] = c;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation and vector translation\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a new mat4 from a dual quat.\r\n *\r\n * @param {mat4} out Matrix\r\n * @param {quat2} a Dual Quaternion\r\n * @returns {mat4} mat4 receiving operation result\r\n */\n\nexport function fromQuat2(out, a) {\n var translation = new glMatrix.ARRAY_TYPE(3);\n var bx = -a[0],\n by = -a[1],\n bz = -a[2],\n bw = a[3],\n ax = a[4],\n ay = a[5],\n az = a[6],\n aw = a[7];\n var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense\n\n if (magnitude > 0) {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude;\n } else {\n translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2;\n translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2;\n translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2;\n }\n\n fromRotationTranslation(out, a, translation);\n return out;\n}\n/**\r\n * Returns the translation vector component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslation,\r\n * the returned vector will be the same as the translation vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive translation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getTranslation(out, mat) {\n out[0] = mat[12];\n out[1] = mat[13];\n out[2] = mat[14];\n return out;\n}\n/**\r\n * Returns the scaling factor component of a transformation\r\n * matrix. If a matrix is built with fromRotationTranslationScale\r\n * with a normalized Quaternion paramter, the returned vector will be\r\n * the same as the scaling vector\r\n * originally supplied.\r\n * @param {vec3} out Vector to receive scaling factor component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {vec3} out\r\n */\n\nexport function getScaling(out, mat) {\n var m11 = mat[0];\n var m12 = mat[1];\n var m13 = mat[2];\n var m21 = mat[4];\n var m22 = mat[5];\n var m23 = mat[6];\n var m31 = mat[8];\n var m32 = mat[9];\n var m33 = mat[10];\n out[0] = Math.hypot(m11, m12, m13);\n out[1] = Math.hypot(m21, m22, m23);\n out[2] = Math.hypot(m31, m32, m33);\n return out;\n}\n/**\r\n * Returns a quaternion representing the rotational component\r\n * of a transformation matrix. If a matrix is built with\r\n * fromRotationTranslation, the returned quaternion will be the\r\n * same as the quaternion originally supplied.\r\n * @param {quat} out Quaternion to receive the rotation component\r\n * @param {mat4} mat Matrix to be decomposed (input)\r\n * @return {quat} out\r\n */\n\nexport function getRotation(out, mat) {\n var scaling = new glMatrix.ARRAY_TYPE(3);\n getScaling(scaling, mat);\n var is1 = 1 / scaling[0];\n var is2 = 1 / scaling[1];\n var is3 = 1 / scaling[2];\n var sm11 = mat[0] * is1;\n var sm12 = mat[1] * is2;\n var sm13 = mat[2] * is3;\n var sm21 = mat[4] * is1;\n var sm22 = mat[5] * is2;\n var sm23 = mat[6] * is3;\n var sm31 = mat[8] * is1;\n var sm32 = mat[9] * is2;\n var sm33 = mat[10] * is3;\n var trace = sm11 + sm22 + sm33;\n var S = 0;\n\n if (trace > 0) {\n S = Math.sqrt(trace + 1.0) * 2;\n out[3] = 0.25 * S;\n out[0] = (sm23 - sm32) / S;\n out[1] = (sm31 - sm13) / S;\n out[2] = (sm12 - sm21) / S;\n } else if (sm11 > sm22 && sm11 > sm33) {\n S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2;\n out[3] = (sm23 - sm32) / S;\n out[0] = 0.25 * S;\n out[1] = (sm12 + sm21) / S;\n out[2] = (sm31 + sm13) / S;\n } else if (sm22 > sm33) {\n S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2;\n out[3] = (sm31 - sm13) / S;\n out[0] = (sm12 + sm21) / S;\n out[1] = 0.25 * S;\n out[2] = (sm23 + sm32) / S;\n } else {\n S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2;\n out[3] = (sm12 - sm21) / S;\n out[0] = (sm31 + sm13) / S;\n out[1] = (sm23 + sm32) / S;\n out[2] = 0.25 * S;\n }\n\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScale(out, q, v, s) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n out[0] = (1 - (yy + zz)) * sx;\n out[1] = (xy + wz) * sx;\n out[2] = (xz - wy) * sx;\n out[3] = 0;\n out[4] = (xy - wz) * sy;\n out[5] = (1 - (xx + zz)) * sy;\n out[6] = (yz + wx) * sy;\n out[7] = 0;\n out[8] = (xz + wy) * sz;\n out[9] = (yz - wx) * sz;\n out[10] = (1 - (xx + yy)) * sz;\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n return out;\n}\n/**\r\n * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin\r\n * This is equivalent to (but much faster than):\r\n *\r\n * mat4.identity(dest);\r\n * mat4.translate(dest, vec);\r\n * mat4.translate(dest, origin);\r\n * let quatMat = mat4.create();\r\n * quat4.toMat4(quat, quatMat);\r\n * mat4.multiply(dest, quatMat);\r\n * mat4.scale(dest, scale)\r\n * mat4.translate(dest, negativeOrigin);\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat4} q Rotation quaternion\r\n * @param {vec3} v Translation vector\r\n * @param {vec3} s Scaling vector\r\n * @param {vec3} o The origin vector around which to scale and rotate\r\n * @returns {mat4} out\r\n */\n\nexport function fromRotationTranslationScaleOrigin(out, q, v, s, o) {\n // Quaternion math\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var xy = x * y2;\n var xz = x * z2;\n var yy = y * y2;\n var yz = y * z2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n var sx = s[0];\n var sy = s[1];\n var sz = s[2];\n var ox = o[0];\n var oy = o[1];\n var oz = o[2];\n var out0 = (1 - (yy + zz)) * sx;\n var out1 = (xy + wz) * sx;\n var out2 = (xz - wy) * sx;\n var out4 = (xy - wz) * sy;\n var out5 = (1 - (xx + zz)) * sy;\n var out6 = (yz + wx) * sy;\n var out8 = (xz + wy) * sz;\n var out9 = (yz - wx) * sz;\n var out10 = (1 - (xx + yy)) * sz;\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = 0;\n out[4] = out4;\n out[5] = out5;\n out[6] = out6;\n out[7] = 0;\n out[8] = out8;\n out[9] = out9;\n out[10] = out10;\n out[11] = 0;\n out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz);\n out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz);\n out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz);\n out[15] = 1;\n return out;\n}\n/**\r\n * Calculates a 4x4 matrix from the given quaternion\r\n *\r\n * @param {mat4} out mat4 receiving operation result\r\n * @param {quat} q Quaternion to create matrix from\r\n *\r\n * @returns {mat4} out\r\n */\n\nexport function fromQuat(out, q) {\n var x = q[0],\n y = q[1],\n z = q[2],\n w = q[3];\n var x2 = x + x;\n var y2 = y + y;\n var z2 = z + z;\n var xx = x * x2;\n var yx = y * x2;\n var yy = y * y2;\n var zx = z * x2;\n var zy = z * y2;\n var zz = z * z2;\n var wx = w * x2;\n var wy = w * y2;\n var wz = w * z2;\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a frustum matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Number} left Left bound of the frustum\r\n * @param {Number} right Right bound of the frustum\r\n * @param {Number} bottom Bottom bound of the frustum\r\n * @param {Number} top Top bound of the frustum\r\n * @param {Number} near Near bound of the frustum\r\n * @param {Number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function frustum(out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left);\n var tb = 1 / (top - bottom);\n var nf = 1 / (near - far);\n out[0] = near * 2 * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = near * 2 * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = far * near * 2 * nf;\n out[15] = 0;\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given bounds.\r\n * Passing null/undefined/no value for far will generate infinite projection matrix.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} fovy Vertical field of view in radians\r\n * @param {number} aspect Aspect ratio. typically viewport width/height\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum, can be null or Infinity\r\n * @returns {mat4} out\r\n */\n\nexport function perspective(out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf;\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[15] = 0;\n\n if (far != null && far !== Infinity) {\n nf = 1 / (near - far);\n out[10] = (far + near) * nf;\n out[14] = 2 * far * near * nf;\n } else {\n out[10] = -1;\n out[14] = -2 * near;\n }\n\n return out;\n}\n/**\r\n * Generates a perspective projection matrix with the given field of view.\r\n * This is primarily useful for generating projection matrices to be used\r\n * with the still experiemental WebVR API.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0);\n var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0);\n var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0);\n var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0);\n var xScale = 2.0 / (leftTan + rightTan);\n var yScale = 2.0 / (upTan + downTan);\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = (upTan - downTan) * yScale * 0.5;\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = far * near / (near - far);\n out[15] = 0.0;\n return out;\n}\n/**\r\n * Generates a orthogonal projection matrix with the given bounds\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {number} left Left bound of the frustum\r\n * @param {number} right Right bound of the frustum\r\n * @param {number} bottom Bottom bound of the frustum\r\n * @param {number} top Top bound of the frustum\r\n * @param {number} near Near bound of the frustum\r\n * @param {number} far Far bound of the frustum\r\n * @returns {mat4} out\r\n */\n\nexport function ortho(out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right);\n var bt = 1 / (bottom - top);\n var nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a look-at matrix with the given eye position, focal point, and up axis.\r\n * If you want a matrix that actually makes an object look at another object, you should use targetTo instead.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function lookAt(out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len;\n var eyex = eye[0];\n var eyey = eye[1];\n var eyez = eye[2];\n var upx = up[0];\n var upy = up[1];\n var upz = up[2];\n var centerx = center[0];\n var centery = center[1];\n var centerz = center[2];\n\n if (Math.abs(eyex - centerx) < glMatrix.EPSILON && Math.abs(eyey - centery) < glMatrix.EPSILON && Math.abs(eyez - centerz) < glMatrix.EPSILON) {\n return identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n len = 1 / Math.hypot(z0, z1, z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.hypot(x0, x1, x2);\n\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n len = Math.hypot(y0, y1, y2);\n\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n return out;\n}\n/**\r\n * Generates a matrix that makes something look at something else.\r\n *\r\n * @param {mat4} out mat4 frustum matrix will be written into\r\n * @param {vec3} eye Position of the viewer\r\n * @param {vec3} center Point the viewer is looking at\r\n * @param {vec3} up vec3 pointing up\r\n * @returns {mat4} out\r\n */\n\nexport function targetTo(out, eye, target, up) {\n var eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2];\n var z0 = eyex - target[0],\n z1 = eyey - target[1],\n z2 = eyez - target[2];\n var len = z0 * z0 + z1 * z1 + z2 * z2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n }\n\n var x0 = upy * z2 - upz * z1,\n x1 = upz * z0 - upx * z2,\n x2 = upx * z1 - upy * z0;\n len = x0 * x0 + x1 * x1 + x2 * x2;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n out[0] = x0;\n out[1] = x1;\n out[2] = x2;\n out[3] = 0;\n out[4] = z1 * x2 - z2 * x1;\n out[5] = z2 * x0 - z0 * x2;\n out[6] = z0 * x1 - z1 * x0;\n out[7] = 0;\n out[8] = z0;\n out[9] = z1;\n out[10] = z2;\n out[11] = 0;\n out[12] = eyex;\n out[13] = eyey;\n out[14] = eyez;\n out[15] = 1;\n return out;\n}\n;\n/**\r\n * Returns a string representation of a mat4\r\n *\r\n * @param {mat4} a matrix to represent as a string\r\n * @returns {String} string representation of the matrix\r\n */\n\nexport function str(a) {\n return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' + a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';\n}\n/**\r\n * Returns Frobenius norm of a mat4\r\n *\r\n * @param {mat4} a the matrix to calculate Frobenius norm of\r\n * @returns {Number} Frobenius norm\r\n */\n\nexport function frob(a) {\n return Math.hypot(a[0], a[1], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]);\n}\n/**\r\n * Adds two mat4's\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n out[4] = a[4] + b[4];\n out[5] = a[5] + b[5];\n out[6] = a[6] + b[6];\n out[7] = a[7] + b[7];\n out[8] = a[8] + b[8];\n out[9] = a[9] + b[9];\n out[10] = a[10] + b[10];\n out[11] = a[11] + b[11];\n out[12] = a[12] + b[12];\n out[13] = a[13] + b[13];\n out[14] = a[14] + b[14];\n out[15] = a[15] + b[15];\n return out;\n}\n/**\r\n * Subtracts matrix b from matrix a\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @returns {mat4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n out[4] = a[4] - b[4];\n out[5] = a[5] - b[5];\n out[6] = a[6] - b[6];\n out[7] = a[7] - b[7];\n out[8] = a[8] - b[8];\n out[9] = a[9] - b[9];\n out[10] = a[10] - b[10];\n out[11] = a[11] - b[11];\n out[12] = a[12] - b[12];\n out[13] = a[13] - b[13];\n out[14] = a[14] - b[14];\n out[15] = a[15] - b[15];\n return out;\n}\n/**\r\n * Multiply each element of the matrix by a scalar.\r\n *\r\n * @param {mat4} out the receiving matrix\r\n * @param {mat4} a the matrix to scale\r\n * @param {Number} b amount to scale the matrix's elements by\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalar(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n out[4] = a[4] * b;\n out[5] = a[5] * b;\n out[6] = a[6] * b;\n out[7] = a[7] * b;\n out[8] = a[8] * b;\n out[9] = a[9] * b;\n out[10] = a[10] * b;\n out[11] = a[11] * b;\n out[12] = a[12] * b;\n out[13] = a[13] * b;\n out[14] = a[14] * b;\n out[15] = a[15] * b;\n return out;\n}\n/**\r\n * Adds two mat4's after multiplying each element of the second operand by a scalar value.\r\n *\r\n * @param {mat4} out the receiving vector\r\n * @param {mat4} a the first operand\r\n * @param {mat4} b the second operand\r\n * @param {Number} scale the amount to scale b's elements by before adding\r\n * @returns {mat4} out\r\n */\n\nexport function multiplyScalarAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n out[4] = a[4] + b[4] * scale;\n out[5] = a[5] + b[5] * scale;\n out[6] = a[6] + b[6] * scale;\n out[7] = a[7] + b[7] * scale;\n out[8] = a[8] + b[8] * scale;\n out[9] = a[9] + b[9] * scale;\n out[10] = a[10] + b[10] * scale;\n out[11] = a[11] + b[11] * scale;\n out[12] = a[12] + b[12] * scale;\n out[13] = a[13] + b[13] * scale;\n out[14] = a[14] + b[14] * scale;\n out[15] = a[15] + b[15] * scale;\n return out;\n}\n/**\r\n * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15];\n}\n/**\r\n * Returns whether or not the matrices have approximately the same elements in the same position.\r\n *\r\n * @param {mat4} a The first matrix.\r\n * @param {mat4} b The second matrix.\r\n * @returns {Boolean} True if the matrices are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var a4 = a[4],\n a5 = a[5],\n a6 = a[6],\n a7 = a[7];\n var a8 = a[8],\n a9 = a[9],\n a10 = a[10],\n a11 = a[11];\n var a12 = a[12],\n a13 = a[13],\n a14 = a[14],\n a15 = a[15];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n var b4 = b[4],\n b5 = b[5],\n b6 = b[6],\n b7 = b[7];\n var b8 = b[8],\n b9 = b[9],\n b10 = b[10],\n b11 = b[11];\n var b12 = b[12],\n b13 = b[13],\n b14 = b[14],\n b15 = b[15];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15));\n}\n/**\r\n * Alias for {@link mat4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link mat4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;","import * as glMatrix from \"./common.js\";\n/**\r\n * 3 Dimensional Vector\r\n * @module vec3\r\n */\n\n/**\r\n * Creates a new, empty vec3\r\n *\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(3);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec3 initialized with values from an existing vector\r\n *\r\n * @param {vec3} a vector to clone\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Calculates the length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Creates a new vec3 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} a new 3D vector\r\n */\n\nexport function fromValues(x, y, z) {\n var out = new glMatrix.ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Copy the values from one vec3 to another\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the source vector\r\n * @returns {vec3} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n/**\r\n * Set the components of a vec3 to the given values\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @returns {vec3} out\r\n */\n\nexport function set(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n/**\r\n * Adds two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n/**\r\n * Multiplies two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n/**\r\n * Divides two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to ceil\r\n * @returns {vec3} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to floor\r\n * @returns {vec3} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n/**\r\n * Math.round the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to round\r\n * @returns {vec3} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n return out;\n}\n/**\r\n * Scales a vec3 by a scalar number\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec3} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n/**\r\n * Adds two vec3's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec3} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return Math.hypot(x, y, z);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Calculates the squared length of a vec3\r\n *\r\n * @param {vec3} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n return x * x + y * y + z * z;\n}\n/**\r\n * Negates the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to negate\r\n * @returns {vec3} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to invert\r\n * @returns {vec3} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n/**\r\n * Normalize a vec3\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a vector to normalize\r\n * @returns {vec3} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var len = x * x + y * y + z * z;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec3's\r\n *\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n/**\r\n * Computes the cross product of two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n var bx = b[0],\n by = b[1],\n bz = b[2];\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec3's\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n/**\r\n * Performs a hermite interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function hermite(out, a, b, c, d, t) {\n var factorTimes2 = t * t;\n var factor1 = factorTimes2 * (2 * t - 3) + 1;\n var factor2 = factorTimes2 * (t - 2) + t;\n var factor3 = factorTimes2 * (t - 1);\n var factor4 = factorTimes2 * (3 - 2 * t);\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Performs a bezier interpolation with two control points\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the first operand\r\n * @param {vec3} b the second operand\r\n * @param {vec3} c the third operand\r\n * @param {vec3} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec3} out\r\n */\n\nexport function bezier(out, a, b, c, d, t) {\n var inverseFactor = 1 - t;\n var inverseFactorTimesTwo = inverseFactor * inverseFactor;\n var factorTimes2 = t * t;\n var factor1 = inverseFactorTimesTwo * inverseFactor;\n var factor2 = 3 * t * inverseFactorTimesTwo;\n var factor3 = 3 * factorTimes2 * inverseFactor;\n var factor4 = factorTimes2 * t;\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec3} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n var z = glMatrix.RANDOM() * 2.0 - 1.0;\n var zScale = Math.sqrt(1.0 - z * z) * scale;\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat4.\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n/**\r\n * Transforms the vec3 with a mat3.\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {mat3} m the 3x3 matrix to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n/**\r\n * Transforms the vec3 with a quat\r\n * Can also be used for dual quaternions. (Multiply it with the real part)\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec3} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec3} out\r\n */\n\nexport function transformQuat(out, a, q) {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3];\n var x = a[0],\n y = a[1],\n z = a[2]; // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n\n var uvx = qy * z - qz * y,\n uvy = qz * x - qx * z,\n uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv);\n\n var uuvx = qy * uvz - qz * uvy,\n uuvy = qz * uvx - qx * uvz,\n uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w);\n\n var w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2; // vec3.scale(uuv, uuv, 2);\n\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv));\n\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n/**\r\n * Rotate a 3D vector around the x-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateX(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0];\n r[1] = p[1] * Math.cos(c) - p[2] * Math.sin(c);\n r[2] = p[1] * Math.sin(c) + p[2] * Math.cos(c); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the y-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateY(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[2] * Math.sin(c) + p[0] * Math.cos(c);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(c) - p[0] * Math.sin(c); //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Rotate a 3D vector around the z-axis\r\n * @param {vec3} out The receiving vec3\r\n * @param {vec3} a The vec3 point to rotate\r\n * @param {vec3} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec3} out\r\n */\n\nexport function rotateZ(out, a, b, c) {\n var p = [],\n r = []; //Translate point to the origin\n\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2]; //perform rotation\n\n r[0] = p[0] * Math.cos(c) - p[1] * Math.sin(c);\n r[1] = p[0] * Math.sin(c) + p[1] * Math.cos(c);\n r[2] = p[2]; //translate to correct position\n\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n return out;\n}\n/**\r\n * Get the angle between two 3D vectors\r\n * @param {vec3} a The first operand\r\n * @param {vec3} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var tempA = fromValues(a[0], a[1], a[2]);\n var tempB = fromValues(b[0], b[1], b[2]);\n normalize(tempA, tempA);\n normalize(tempB, tempB);\n var cosine = dot(tempA, tempB);\n\n if (cosine > 1.0) {\n return 0;\n } else if (cosine < -1.0) {\n return Math.PI;\n } else {\n return Math.acos(cosine);\n }\n}\n/**\r\n * Set the components of a vec3 to zero\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @returns {vec3} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec3} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec3} a The first vector.\r\n * @param {vec3} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2));\n}\n/**\r\n * Alias for {@link vec3.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec3.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec3.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec3.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec3.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec3.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec3.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec3s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 3;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 4 Dimensional Vector\r\n * @module vec4\r\n */\n\n/**\r\n * Creates a new, empty vec4\r\n *\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with values from an existing vector\r\n *\r\n * @param {vec4} a vector to clone\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a new vec4 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} a new 4D vector\r\n */\n\nexport function fromValues(x, y, z, w) {\n var out = new glMatrix.ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Copy the values from one vec4 to another\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the source vector\r\n * @returns {vec4} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to the given values\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {vec4} out\r\n */\n\nexport function set(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n}\n/**\r\n * Adds two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n}\n/**\r\n * Multiplies two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n}\n/**\r\n * Divides two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to ceil\r\n * @returns {vec4} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n out[3] = Math.ceil(a[3]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to floor\r\n * @returns {vec4} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n out[3] = Math.floor(a[3]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {vec4} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n}\n/**\r\n * Math.round the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to round\r\n * @returns {vec4} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n out[2] = Math.round(a[2]);\n out[3] = Math.round(a[3]);\n return out;\n}\n/**\r\n * Scales a vec4 by a scalar number\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec4} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n}\n/**\r\n * Adds two vec4's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec4} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n out[3] = a[3] + b[3] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n var z = b[2] - a[2];\n var w = b[3] - a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Calculates the length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return Math.hypot(x, y, z, w);\n}\n/**\r\n * Calculates the squared length of a vec4\r\n *\r\n * @param {vec4} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n return x * x + y * y + z * z + w * w;\n}\n/**\r\n * Negates the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to negate\r\n * @returns {vec4} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to invert\r\n * @returns {vec4} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n}\n/**\r\n * Normalize a vec4\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a vector to normalize\r\n * @returns {vec4} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0];\n var y = a[1];\n var z = a[2];\n var w = a[3];\n var len = x * x + y * y + z * z + w * w;\n\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = x * len;\n out[1] = y * len;\n out[2] = z * len;\n out[3] = w * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec4's\r\n *\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\n/**\r\n * Returns the cross-product of three vectors in a 4-dimensional space\r\n *\r\n * @param {vec4} result the receiving vector\r\n * @param {vec4} U the first vector\r\n * @param {vec4} V the second vector\r\n * @param {vec4} W the third vector\r\n * @returns {vec4} result\r\n */\n\nexport function cross(out, u, v, w) {\n var A = v[0] * w[1] - v[1] * w[0],\n B = v[0] * w[2] - v[2] * w[0],\n C = v[0] * w[3] - v[3] * w[0],\n D = v[1] * w[2] - v[2] * w[1],\n E = v[1] * w[3] - v[3] * w[1],\n F = v[2] * w[3] - v[3] * w[2];\n var G = u[0];\n var H = u[1];\n var I = u[2];\n var J = u[3];\n out[0] = H * F - I * E + J * D;\n out[1] = -(G * F) + I * C - J * B;\n out[2] = G * E - H * C + J * A;\n out[3] = -(G * D) + H * B - I * A;\n return out;\n}\n;\n/**\r\n * Performs a linear interpolation between two vec4's\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the first operand\r\n * @param {vec4} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec4} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0];\n var ay = a[1];\n var az = a[2];\n var aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec4} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a\n // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646.\n // http://projecteuclid.org/euclid.aoms/1177692644;\n\n var v1, v2, v3, v4;\n var s1, s2;\n\n do {\n v1 = glMatrix.RANDOM() * 2 - 1;\n v2 = glMatrix.RANDOM() * 2 - 1;\n s1 = v1 * v1 + v2 * v2;\n } while (s1 >= 1);\n\n do {\n v3 = glMatrix.RANDOM() * 2 - 1;\n v4 = glMatrix.RANDOM() * 2 - 1;\n s2 = v3 * v3 + v4 * v4;\n } while (s2 >= 1);\n\n var d = Math.sqrt((1 - s1) / s2);\n out[0] = scale * v1;\n out[1] = scale * v2;\n out[2] = scale * v3 * d;\n out[3] = scale * v4 * d;\n return out;\n}\n/**\r\n * Transforms the vec4 with a mat4.\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n}\n/**\r\n * Transforms the vec4 with a quat\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @param {vec4} a the vector to transform\r\n * @param {quat} q quaternion to transform with\r\n * @returns {vec4} out\r\n */\n\nexport function transformQuat(out, a, q) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var qx = q[0],\n qy = q[1],\n qz = q[2],\n qw = q[3]; // calculate quat * vec\n\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat\n\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n out[3] = a[3];\n return out;\n}\n/**\r\n * Set the components of a vec4 to zero\r\n *\r\n * @param {vec4} out the receiving vector\r\n * @returns {vec4} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec4} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n}\n/**\r\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec4} a The first vector.\r\n * @param {vec4} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var b0 = b[0],\n b1 = b[1],\n b2 = b[2],\n b3 = b[3];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3));\n}\n/**\r\n * Alias for {@link vec4.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec4.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec4.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec4.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec4.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec4.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec4.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec4s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 4;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n vec[2] = a[i + 2];\n vec[3] = a[i + 3];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n a[i + 2] = vec[2];\n a[i + 3] = vec[3];\n }\n\n return a;\n };\n}();","import * as glMatrix from \"./common.js\";\nimport * as mat3 from \"./mat3.js\";\nimport * as vec3 from \"./vec3.js\";\nimport * as vec4 from \"./vec4.js\";\n/**\r\n * Quaternion\r\n * @module quat\r\n */\n\n/**\r\n * Creates a new identity quat\r\n *\r\n * @returns {quat} a new quaternion\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(4);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n }\n\n out[3] = 1;\n return out;\n}\n/**\r\n * Set a quat to the identity quaternion\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @returns {quat} out\r\n */\n\nexport function identity(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n}\n/**\r\n * Sets a quat from the given angle and rotation axis,\r\n * then returns it.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {vec3} axis the axis around which to rotate\r\n * @param {Number} rad the angle in radians\r\n * @returns {quat} out\r\n **/\n\nexport function setAxisAngle(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n}\n/**\r\n * Gets the rotation axis and angle for a given\r\n * quaternion. If a quaternion is created with\r\n * setAxisAngle, this method will return the same\r\n * values as providied in the original parameter list\r\n * OR functionally equivalent values.\r\n * Example: The quaternion formed by axis [0, 0, 1] and\r\n * angle -90 is the same as the quaternion formed by\r\n * [0, 0, 1] and 270. This method favors the latter.\r\n * @param {vec3} out_axis Vector receiving the axis of rotation\r\n * @param {quat} q Quaternion to be decomposed\r\n * @return {Number} Angle, in radians, of the rotation\r\n */\n\nexport function getAxisAngle(out_axis, q) {\n var rad = Math.acos(q[3]) * 2.0;\n var s = Math.sin(rad / 2.0);\n\n if (s > glMatrix.EPSILON) {\n out_axis[0] = q[0] / s;\n out_axis[1] = q[1] / s;\n out_axis[2] = q[2] / s;\n } else {\n // If s is zero, return any axis (no rotation - axis does not matter)\n out_axis[0] = 1;\n out_axis[1] = 0;\n out_axis[2] = 0;\n }\n\n return rad;\n}\n/**\r\n * Gets the angular distance between two unit quaternions\r\n *\r\n * @param {quat} a Origin unit quaternion \r\n * @param {quat} b Destination unit quaternion\r\n * @return {Number} Angle, in radians, between the two quaternions\r\n */\n\nexport function getAngle(a, b) {\n var dotproduct = dot(a, b);\n return Math.acos(2 * dotproduct * dotproduct - 1);\n}\n/**\r\n * Multiplies two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {quat} out\r\n */\n\nexport function multiply(out, a, b) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the X axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateX(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the Y axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateY(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var by = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n}\n/**\r\n * Rotates a quaternion by the given angle about the Z axis\r\n *\r\n * @param {quat} out quat receiving operation result\r\n * @param {quat} a quat to rotate\r\n * @param {number} rad angle (in radians) to rotate\r\n * @returns {quat} out\r\n */\n\nexport function rotateZ(out, a, rad) {\n rad *= 0.5;\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bz = Math.sin(rad),\n bw = Math.cos(rad);\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n}\n/**\r\n * Calculates the W component of a quat from the X, Y, and Z components.\r\n * Assumes that quaternion is 1 unit in length.\r\n * Any existing W component will be ignored.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate W component of\r\n * @returns {quat} out\r\n */\n\nexport function calculateW(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n}\n/**\r\n * Calculate the exponential of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @returns {quat} out\r\n */\n\nexport function exp(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var et = Math.exp(w);\n var s = r > 0 ? et * Math.sin(r) / r : 0;\n out[0] = x * s;\n out[1] = y * s;\n out[2] = z * s;\n out[3] = et * Math.cos(r);\n return out;\n}\n/**\r\n * Calculate the natural logarithm of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @returns {quat} out\r\n */\n\nexport function ln(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var r = Math.sqrt(x * x + y * y + z * z);\n var t = r > 0 ? Math.atan2(r, w) / r : 0;\n out[0] = x * t;\n out[1] = y * t;\n out[2] = z * t;\n out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w);\n return out;\n}\n/**\r\n * Calculate the scalar power of a unit quaternion.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate the exponential of\r\n * @param {Number} b amount to scale the quaternion by\r\n * @returns {quat} out\r\n */\n\nexport function pow(out, a, b) {\n ln(out, a);\n scale(out, out, b);\n exp(out, out);\n return out;\n}\n/**\r\n * Performs a spherical linear interpolation between two quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n */\n\nexport function slerp(out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n var bx = b[0],\n by = b[1],\n bz = b[2],\n bw = b[3];\n var omega, cosom, sinom, scale0, scale1; // calc cosine\n\n cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary)\n\n if (cosom < 0.0) {\n cosom = -cosom;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n } // calculate coefficients\n\n\n if (1.0 - cosom > glMatrix.EPSILON) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n } // calculate final values\n\n\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n return out;\n}\n/**\r\n * Generates a random unit quaternion\r\n * \r\n * @param {quat} out the receiving quaternion\r\n * @returns {quat} out\r\n */\n\nexport function random(out) {\n // Implementation of http://planning.cs.uiuc.edu/node198.html\n // TODO: Calling random 3 times is probably not the fastest solution\n var u1 = glMatrix.RANDOM();\n var u2 = glMatrix.RANDOM();\n var u3 = glMatrix.RANDOM();\n var sqrt1MinusU1 = Math.sqrt(1 - u1);\n var sqrtU1 = Math.sqrt(u1);\n out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2);\n out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2);\n out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3);\n out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3);\n return out;\n}\n/**\r\n * Calculates the inverse of a quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate inverse of\r\n * @returns {quat} out\r\n */\n\nexport function invert(out, a) {\n var a0 = a[0],\n a1 = a[1],\n a2 = a[2],\n a3 = a[3];\n var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0 * invDot;\n out[1] = -a1 * invDot;\n out[2] = -a2 * invDot;\n out[3] = a3 * invDot;\n return out;\n}\n/**\r\n * Calculates the conjugate of a quat\r\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quat to calculate conjugate of\r\n * @returns {quat} out\r\n */\n\nexport function conjugate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n}\n/**\r\n * Creates a quaternion from the given 3x3 rotation matrix.\r\n *\r\n * NOTE: The resultant quaternion is not normalized, so you should be sure\r\n * to renormalize the quaternion yourself where necessary.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {mat3} m rotation matrix\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport function fromMat3(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if (fTrace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n\n out[3] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot; // 1/(4w)\n\n out[0] = (m[5] - m[7]) * fRoot;\n out[1] = (m[6] - m[2]) * fRoot;\n out[2] = (m[1] - m[3]) * fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if (m[4] > m[0]) i = 1;\n if (m[8] > m[i * 3 + i]) i = 2;\n var j = (i + 1) % 3;\n var k = (i + 2) % 3;\n fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot;\n out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot;\n out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot;\n }\n\n return out;\n}\n/**\r\n * Creates a quaternion from the given euler angle x, y, z.\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {x} Angle to rotate around X axis in degrees.\r\n * @param {y} Angle to rotate around Y axis in degrees.\r\n * @param {z} Angle to rotate around Z axis in degrees.\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport function fromEuler(out, x, y, z) {\n var halfToRad = 0.5 * Math.PI / 180.0;\n x *= halfToRad;\n y *= halfToRad;\n z *= halfToRad;\n var sx = Math.sin(x);\n var cx = Math.cos(x);\n var sy = Math.sin(y);\n var cy = Math.cos(y);\n var sz = Math.sin(z);\n var cz = Math.cos(z);\n out[0] = sx * cy * cz - cx * sy * sz;\n out[1] = cx * sy * cz + sx * cy * sz;\n out[2] = cx * cy * sz - sx * sy * cz;\n out[3] = cx * cy * cz + sx * sy * sz;\n return out;\n}\n/**\r\n * Returns a string representation of a quatenion\r\n *\r\n * @param {quat} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';\n}\n/**\r\n * Creates a new quat initialized with values from an existing quaternion\r\n *\r\n * @param {quat} a quaternion to clone\r\n * @returns {quat} a new quaternion\r\n * @function\r\n */\n\nexport var clone = vec4.clone;\n/**\r\n * Creates a new quat initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {quat} a new quaternion\r\n * @function\r\n */\n\nexport var fromValues = vec4.fromValues;\n/**\r\n * Copy the values from one quat to another\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the source quaternion\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var copy = vec4.copy;\n/**\r\n * Set the components of a quat to the given values\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @param {Number} z Z component\r\n * @param {Number} w W component\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var set = vec4.set;\n/**\r\n * Adds two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var add = vec4.add;\n/**\r\n * Alias for {@link quat.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Scales a quat by a scalar number\r\n *\r\n * @param {quat} out the receiving vector\r\n * @param {quat} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var scale = vec4.scale;\n/**\r\n * Calculates the dot product of two quat's\r\n *\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @returns {Number} dot product of a and b\r\n * @function\r\n */\n\nexport var dot = vec4.dot;\n/**\r\n * Performs a linear interpolation between two quat's\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var lerp = vec4.lerp;\n/**\r\n * Calculates the length of a quat\r\n *\r\n * @param {quat} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport var length = vec4.length;\n/**\r\n * Alias for {@link quat.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Calculates the squared length of a quat\r\n *\r\n * @param {quat} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n * @function\r\n */\n\nexport var squaredLength = vec4.squaredLength;\n/**\r\n * Alias for {@link quat.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Normalize a quat\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a quaternion to normalize\r\n * @returns {quat} out\r\n * @function\r\n */\n\nexport var normalize = vec4.normalize;\n/**\r\n * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)\r\n *\r\n * @param {quat} a The first quaternion.\r\n * @param {quat} b The second quaternion.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport var exactEquals = vec4.exactEquals;\n/**\r\n * Returns whether or not the quaternions have approximately the same elements in the same position.\r\n *\r\n * @param {quat} a The first vector.\r\n * @param {quat} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport var equals = vec4.equals;\n/**\r\n * Sets a quaternion to represent the shortest rotation from one\r\n * vector to another.\r\n *\r\n * Both vectors are assumed to be unit length.\r\n *\r\n * @param {quat} out the receiving quaternion.\r\n * @param {vec3} a the initial vector\r\n * @param {vec3} b the destination vector\r\n * @returns {quat} out\r\n */\n\nexport var rotationTo = function () {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1, 0, 0);\n var yUnitVec3 = vec3.fromValues(0, 1, 0);\n return function (out, a, b) {\n var dot = vec3.dot(a, b);\n\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.len(tmpvec3) < 0.000001) vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return normalize(out, out);\n }\n };\n}();\n/**\r\n * Performs a spherical linear interpolation with two control points\r\n *\r\n * @param {quat} out the receiving quaternion\r\n * @param {quat} a the first operand\r\n * @param {quat} b the second operand\r\n * @param {quat} c the third operand\r\n * @param {quat} d the fourth operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {quat} out\r\n */\n\nexport var sqlerp = function () {\n var temp1 = create();\n var temp2 = create();\n return function (out, a, b, c, d, t) {\n slerp(temp1, a, d, t);\n slerp(temp2, b, c, t);\n slerp(out, temp1, temp2, 2 * t * (1 - t));\n return out;\n };\n}();\n/**\r\n * Sets the specified quaternion with values corresponding to the given\r\n * axes. Each axis is a vec3 and is expected to be unit length and\r\n * perpendicular to all other specified axes.\r\n *\r\n * @param {vec3} view the vector representing the viewing direction\r\n * @param {vec3} right the vector representing the local \"right\" direction\r\n * @param {vec3} up the vector representing the local \"up\" direction\r\n * @returns {quat} out\r\n */\n\nexport var setAxes = function () {\n var matr = mat3.create();\n return function (out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n return normalize(out, fromMat3(out, matr));\n };\n}();","import * as glMatrix from \"./common.js\";\n/**\r\n * 2 Dimensional Vector\r\n * @module vec2\r\n */\n\n/**\r\n * Creates a new, empty vec2\r\n *\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function create() {\n var out = new glMatrix.ARRAY_TYPE(2);\n\n if (glMatrix.ARRAY_TYPE != Float32Array) {\n out[0] = 0;\n out[1] = 0;\n }\n\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with values from an existing vector\r\n *\r\n * @param {vec2} a vector to clone\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function clone(a) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Creates a new vec2 initialized with the given values\r\n *\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} a new 2D vector\r\n */\n\nexport function fromValues(x, y) {\n var out = new glMatrix.ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Copy the values from one vec2 to another\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the source vector\r\n * @returns {vec2} out\r\n */\n\nexport function copy(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n}\n/**\r\n * Set the components of a vec2 to the given values\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} x X component\r\n * @param {Number} y Y component\r\n * @returns {vec2} out\r\n */\n\nexport function set(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n}\n/**\r\n * Adds two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function add(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n}\n/**\r\n * Subtracts vector b from vector a\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function subtract(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n}\n/**\r\n * Multiplies two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function multiply(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n}\n/**\r\n * Divides two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function divide(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n}\n/**\r\n * Math.ceil the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to ceil\r\n * @returns {vec2} out\r\n */\n\nexport function ceil(out, a) {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n return out;\n}\n/**\r\n * Math.floor the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to floor\r\n * @returns {vec2} out\r\n */\n\nexport function floor(out, a) {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n return out;\n}\n/**\r\n * Returns the minimum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function min(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n}\n/**\r\n * Returns the maximum of two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec2} out\r\n */\n\nexport function max(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n}\n/**\r\n * Math.round the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to round\r\n * @returns {vec2} out\r\n */\n\nexport function round(out, a) {\n out[0] = Math.round(a[0]);\n out[1] = Math.round(a[1]);\n return out;\n}\n/**\r\n * Scales a vec2 by a scalar number\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to scale\r\n * @param {Number} b amount to scale the vector by\r\n * @returns {vec2} out\r\n */\n\nexport function scale(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n}\n/**\r\n * Adds two vec2's after scaling the second operand by a scalar value\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} scale the amount to scale b by before adding\r\n * @returns {vec2} out\r\n */\n\nexport function scaleAndAdd(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n}\n/**\r\n * Calculates the euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} distance between a and b\r\n */\n\nexport function distance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared euclidian distance between two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} squared distance between a and b\r\n */\n\nexport function squaredDistance(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x * x + y * y;\n}\n/**\r\n * Calculates the length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate length of\r\n * @returns {Number} length of a\r\n */\n\nexport function length(a) {\n var x = a[0],\n y = a[1];\n return Math.hypot(x, y);\n}\n/**\r\n * Calculates the squared length of a vec2\r\n *\r\n * @param {vec2} a vector to calculate squared length of\r\n * @returns {Number} squared length of a\r\n */\n\nexport function squaredLength(a) {\n var x = a[0],\n y = a[1];\n return x * x + y * y;\n}\n/**\r\n * Negates the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to negate\r\n * @returns {vec2} out\r\n */\n\nexport function negate(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n}\n/**\r\n * Returns the inverse of the components of a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to invert\r\n * @returns {vec2} out\r\n */\n\nexport function inverse(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n}\n/**\r\n * Normalize a vec2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a vector to normalize\r\n * @returns {vec2} out\r\n */\n\nexport function normalize(out, a) {\n var x = a[0],\n y = a[1];\n var len = x * x + y * y;\n\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n }\n\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n return out;\n}\n/**\r\n * Calculates the dot product of two vec2's\r\n *\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {Number} dot product of a and b\r\n */\n\nexport function dot(a, b) {\n return a[0] * b[0] + a[1] * b[1];\n}\n/**\r\n * Computes the cross product of two vec2's\r\n * Note that the cross product must by definition produce a 3D vector\r\n *\r\n * @param {vec3} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @returns {vec3} out\r\n */\n\nexport function cross(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n}\n/**\r\n * Performs a linear interpolation between two vec2's\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the first operand\r\n * @param {vec2} b the second operand\r\n * @param {Number} t interpolation amount, in the range [0-1], between the two inputs\r\n * @returns {vec2} out\r\n */\n\nexport function lerp(out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n}\n/**\r\n * Generates a random vector with the given scale\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\r\n * @returns {vec2} out\r\n */\n\nexport function random(out, scale) {\n scale = scale || 1.0;\n var r = glMatrix.RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat2d\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat2d} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat2d(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat3\r\n * 3rd vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat3} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat3(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n}\n/**\r\n * Transforms the vec2 with a mat4\r\n * 3rd vector component is implicitly '0'\r\n * 4th vector component is implicitly '1'\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @param {vec2} a the vector to transform\r\n * @param {mat4} m matrix to transform with\r\n * @returns {vec2} out\r\n */\n\nexport function transformMat4(out, a, m) {\n var x = a[0];\n var y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n}\n/**\r\n * Rotate a 2D vector\r\n * @param {vec2} out The receiving vec2\r\n * @param {vec2} a The vec2 point to rotate\r\n * @param {vec2} b The origin of the rotation\r\n * @param {Number} c The angle of rotation\r\n * @returns {vec2} out\r\n */\n\nexport function rotate(out, a, b, c) {\n //Translate point to the origin\n var p0 = a[0] - b[0],\n p1 = a[1] - b[1],\n sinC = Math.sin(c),\n cosC = Math.cos(c); //perform rotation and translate to correct position\n\n out[0] = p0 * cosC - p1 * sinC + b[0];\n out[1] = p0 * sinC + p1 * cosC + b[1];\n return out;\n}\n/**\r\n * Get the angle between two 2D vectors\r\n * @param {vec2} a The first operand\r\n * @param {vec2} b The second operand\r\n * @returns {Number} The angle in radians\r\n */\n\nexport function angle(a, b) {\n var x1 = a[0],\n y1 = a[1],\n x2 = b[0],\n y2 = b[1];\n var len1 = x1 * x1 + y1 * y1;\n\n if (len1 > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len1 = 1 / Math.sqrt(len1);\n }\n\n var len2 = x2 * x2 + y2 * y2;\n\n if (len2 > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len2 = 1 / Math.sqrt(len2);\n }\n\n var cosine = (x1 * x2 + y1 * y2) * len1 * len2;\n\n if (cosine > 1.0) {\n return 0;\n } else if (cosine < -1.0) {\n return Math.PI;\n } else {\n return Math.acos(cosine);\n }\n}\n/**\r\n * Set the components of a vec2 to zero\r\n *\r\n * @param {vec2} out the receiving vector\r\n * @returns {vec2} out\r\n */\n\nexport function zero(out) {\n out[0] = 0.0;\n out[1] = 0.0;\n return out;\n}\n/**\r\n * Returns a string representation of a vector\r\n *\r\n * @param {vec2} a vector to represent as a string\r\n * @returns {String} string representation of the vector\r\n */\n\nexport function str(a) {\n return 'vec2(' + a[0] + ', ' + a[1] + ')';\n}\n/**\r\n * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function exactEquals(a, b) {\n return a[0] === b[0] && a[1] === b[1];\n}\n/**\r\n * Returns whether or not the vectors have approximately the same elements in the same position.\r\n *\r\n * @param {vec2} a The first vector.\r\n * @param {vec2} b The second vector.\r\n * @returns {Boolean} True if the vectors are equal, false otherwise.\r\n */\n\nexport function equals(a, b) {\n var a0 = a[0],\n a1 = a[1];\n var b0 = b[0],\n b1 = b[1];\n return Math.abs(a0 - b0) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= glMatrix.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1));\n}\n/**\r\n * Alias for {@link vec2.length}\r\n * @function\r\n */\n\nexport var len = length;\n/**\r\n * Alias for {@link vec2.subtract}\r\n * @function\r\n */\n\nexport var sub = subtract;\n/**\r\n * Alias for {@link vec2.multiply}\r\n * @function\r\n */\n\nexport var mul = multiply;\n/**\r\n * Alias for {@link vec2.divide}\r\n * @function\r\n */\n\nexport var div = divide;\n/**\r\n * Alias for {@link vec2.distance}\r\n * @function\r\n */\n\nexport var dist = distance;\n/**\r\n * Alias for {@link vec2.squaredDistance}\r\n * @function\r\n */\n\nexport var sqrDist = squaredDistance;\n/**\r\n * Alias for {@link vec2.squaredLength}\r\n * @function\r\n */\n\nexport var sqrLen = squaredLength;\n/**\r\n * Perform some operation over an array of vec2s.\r\n *\r\n * @param {Array} a the array of vectors to iterate over\r\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\r\n * @param {Number} offset Number of elements to skip at the beginning of the array\r\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\r\n * @param {Function} fn Function to call for each vector in the array\r\n * @param {Object} [arg] additional argument to pass to fn\r\n * @returns {Array} a\r\n * @function\r\n */\n\nexport var forEach = function () {\n var vec = create();\n return function (a, stride, offset, count, fn, arg) {\n var i, l;\n\n if (!stride) {\n stride = 2;\n }\n\n if (!offset) {\n offset = 0;\n }\n\n if (count) {\n l = Math.min(count * stride + offset, a.length);\n } else {\n l = a.length;\n }\n\n for (i = offset; i < l; i += stride) {\n vec[0] = a[i];\n vec[1] = a[i + 1];\n fn(vec, vec, arg);\n a[i] = vec[0];\n a[i + 1] = vec[1];\n }\n\n return a;\n };\n}();","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport getAgent from \"@egjs/agent\";\n\n/* eslint-disable no-new-func, no-nested-ternary */\nconst win = typeof window !== \"undefined\" && window.Math === Math ? window : typeof self !== \"undefined\" && self.Math === Math ? self : Function(\"return this\")();\n/* eslint-enable no-new-func, no-nested-ternary */\n\nconst doc = win.document;\nconst agent = getAgent();\nconst osName = agent.os.name;\nconst browserName = agent.browser.name;\nconst IS_IOS = osName === \"ios\";\nconst IS_SAFARI_ON_DESKTOP = osName === \"mac\" && browserName === \"safari\";\nconst IS_SAMSUNG_BROWSER = browserName === \"samsung internet\";\n\nexport {\n\twin as window,\n\tdoc as document,\n\tIS_IOS,\n\tIS_SAFARI_ON_DESKTOP,\n\tIS_SAMSUNG_BROWSER\n};\n","/**\n * Copyright (c) 2015 NAVER Corp.\n * egjs projects are licensed under the MIT license\n */\nimport {window as win, document as doc} from \"./browser\";\n\nwin.Float32Array = (typeof win.Float32Array !== \"undefined\") ? win.Float32Array : win.Array;\n\nconst Float32Array = win.Float32Array;\nconst getComputedStyle = win.getComputedStyle;\nconst userAgent = win.navigator.userAgent;\nconst SUPPORT_TOUCH = \"ontouchstart\" in win;\nconst SUPPORT_DEVICEMOTION = \"ondevicemotion\" in win;\nconst DeviceMotionEvent = win.DeviceMotionEvent;\nconst devicePixelRatio = win.devicePixelRatio;\n\nconst TRANSFORM = (function() {\n\tconst docStyle = doc.documentElement.style;\n\tconst target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n\tfor (let i = 0, len = target.length; i < len; i++) {\n\t\tif (target[i] in docStyle) {\n\t\t\treturn target[i];\n\t\t}\n\t}\n\treturn \"\";\n})();\n\n// check for will-change support\nconst SUPPORT_WILLCHANGE = win.CSS && win.CSS.supports &&\n\twin.CSS.supports(\"will-change\", \"transform\");\n\nlet WEBXR_SUPPORTED = false;\n\nconst checkXRSupport = () => {\n\tif (!navigator.xr) {\n\t\treturn;\n\t}\n\n\tif (navigator.xr.isSessionSupported) {\n\t\tnavigator.xr.isSessionSupported(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t} else if (navigator.xr.supportsSession) {\n\t\tnavigator.xr.supportsSession(\"immersive-vr\").then(res => {\n\t\t\tWEBXR_SUPPORTED = res;\n\t\t}).catch(() => {});\n\t}\n}\n\nexport {\n\tFloat32Array,\n\tgetComputedStyle,\n\tuserAgent,\n\tTRANSFORM,\n\tSUPPORT_TOUCH,\n\tSUPPORT_DEVICEMOTION,\n\tSUPPORT_WILLCHANGE,\n\tcheckXRSupport,\n\tWEBXR_SUPPORTED,\n\tDeviceMotionEvent,\n\tdevicePixelRatio\n};\n\n","/*! Hammer.JS - v2.0.17-rc - 2019-12-16\n * http://naver.github.io/egjs\n *\n * Forked By Naver egjs\n * Copyright (c) hammerjs\n * Licensed under the MIT license */\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n subClass.__proto__ = superClass;\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\nvar assign;\n\nif (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var output = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n\n return output;\n };\n} else {\n assign = Object.assign;\n}\n\nvar assign$1 = assign;\n\nvar VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\nvar TEST_ELEMENT = typeof document === \"undefined\" ? {\n style: {}\n} : document.createElement('div');\nvar TYPE_FUNCTION = 'function';\nvar round = Math.round,\n abs = Math.abs;\nvar now = Date.now;\n\n/**\n * @private\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n\nfunction prefixed(obj, property) {\n var prefix;\n var prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = prefix ? prefix + camelProp : property;\n\n if (prop in obj) {\n return prop;\n }\n\n i++;\n }\n\n return undefined;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\n\nif (typeof window === \"undefined\") {\n // window is undefined in node.js\n win = {};\n} else {\n win = window;\n}\n\nvar PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\nvar NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\nfunction getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n\n var touchMap = {};\n var cssSupports = win.CSS && win.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n return touchMap[val] = cssSupports ? win.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n}\n\nvar TOUCH_ACTION_COMPUTE = 'compute';\nvar TOUCH_ACTION_AUTO = 'auto';\nvar TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n\nvar TOUCH_ACTION_NONE = 'none';\nvar TOUCH_ACTION_PAN_X = 'pan-x';\nvar TOUCH_ACTION_PAN_Y = 'pan-y';\nvar TOUCH_ACTION_MAP = getTouchActionProps();\n\nvar MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\nvar SUPPORT_TOUCH = 'ontouchstart' in win;\nvar SUPPORT_POINTER_EVENTS = prefixed(win, 'PointerEvent') !== undefined;\nvar SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\nvar INPUT_TYPE_TOUCH = 'touch';\nvar INPUT_TYPE_PEN = 'pen';\nvar INPUT_TYPE_MOUSE = 'mouse';\nvar INPUT_TYPE_KINECT = 'kinect';\nvar COMPUTE_INTERVAL = 25;\nvar INPUT_START = 1;\nvar INPUT_MOVE = 2;\nvar INPUT_END = 4;\nvar INPUT_CANCEL = 8;\nvar DIRECTION_NONE = 1;\nvar DIRECTION_LEFT = 2;\nvar DIRECTION_RIGHT = 4;\nvar DIRECTION_UP = 8;\nvar DIRECTION_DOWN = 16;\nvar DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\nvar DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\nvar DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\nvar PROPS_XY = ['x', 'y'];\nvar PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n/**\n * @private\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\nfunction each(obj, iterator, context) {\n var i;\n\n if (!obj) {\n return;\n }\n\n if (obj.forEach) {\n obj.forEach(iterator, context);\n } else if (obj.length !== undefined) {\n i = 0;\n\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n } else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n}\n\n/**\n * @private\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n\nfunction boolOrFn(val, args) {\n if (typeof val === TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n\n return val;\n}\n\n/**\n * @private\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\nfunction inStr(str, find) {\n return str.indexOf(find) > -1;\n}\n\n/**\n * @private\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n\nfunction cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n } // pan-x OR pan-y\n\n\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n } // manipulation\n\n\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n\n return TOUCH_ACTION_AUTO;\n}\n\n/**\n * @private\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n\nvar TouchAction =\n/*#__PURE__*/\nfunction () {\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n /**\n * @private\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n\n\n var _proto = TouchAction.prototype;\n\n _proto.set = function set(value) {\n // find out the touch-action by the event handlers\n if (value === TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n\n this.actions = value.toLowerCase().trim();\n };\n /**\n * @private\n * just re-set the touchAction value\n */\n\n\n _proto.update = function update() {\n this.set(this.manager.options.touchAction);\n };\n /**\n * @private\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n\n\n _proto.compute = function compute() {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n };\n /**\n * @private\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n\n\n _proto.preventDefaults = function preventDefaults(input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection; // if the touch action did prevented once this session\n\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n\n if (hasNone) {\n // do not prevent defaults if this is a tap gesture\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n\n if (hasNone || hasPanY && direction & DIRECTION_HORIZONTAL || hasPanX && direction & DIRECTION_VERTICAL) {\n return this.preventSrc(srcEvent);\n }\n };\n /**\n * @private\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n\n\n _proto.preventSrc = function preventSrc(srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n };\n\n return TouchAction;\n}();\n\n/**\n * @private\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\nfunction hasParent(node, parent) {\n while (node) {\n if (node === parent) {\n return true;\n }\n\n node = node.parentNode;\n }\n\n return false;\n}\n\n/**\n * @private\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n\nfunction getCenter(pointers) {\n var pointersLength = pointers.length; // no need to loop when only one touch\n\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n\n var x = 0;\n var y = 0;\n var i = 0;\n\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n}\n\n/**\n * @private\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n\nfunction simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n}\n\n/**\n * @private\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n\nfunction getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.sqrt(x * x + y * y);\n}\n\n/**\n * @private\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n\nfunction getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n\n var x = p2[props[0]] - p1[props[0]];\n var y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n}\n\n/**\n * @private\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n\nfunction getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n}\n\nfunction computeDeltaXY(session, input) {\n var center = input.center; // let { offsetDelta:offset = {}, prevDelta = {}, prevInput = {} } = session;\n // jscs throwing error on defalut destructured values and without defaults tests fail\n\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n}\n\n/**\n * @private\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\nfunction getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n}\n\n/**\n * @private\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n\nfunction getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n\nfunction getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n}\n\n/**\n * @private\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n\nfunction computeIntervalInputData(session, input) {\n var last = session.lastInterval || input;\n var deltaTime = input.timeStamp - last.timeStamp;\n var velocity;\n var velocityX;\n var velocityY;\n var direction;\n\n if (input.eventType !== INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = abs(v.x) > abs(v.y) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n } else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n}\n\n/**\n* @private\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n\nfunction computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length; // store the first input to calculate the distance and direction\n\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n } // to compute scale and rotation we need to store the multiple touches\n\n\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n } else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n\n var firstInput = session.firstInput,\n firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = abs(overallVelocity.x) > abs(overallVelocity.y) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : input.pointers.length > session.prevInput.maxPointers ? input.pointers.length : session.prevInput.maxPointers;\n computeIntervalInputData(session, input); // find the correct target\n\n var target = manager.element;\n var srcEvent = input.srcEvent;\n var srcEventTarget;\n\n if (srcEvent.composedPath) {\n srcEventTarget = srcEvent.composedPath()[0];\n } else if (srcEvent.path) {\n srcEventTarget = srcEvent.path[0];\n } else {\n srcEventTarget = srcEvent.target;\n }\n\n if (hasParent(srcEventTarget, target)) {\n target = srcEventTarget;\n }\n\n input.target = target;\n}\n\n/**\n * @private\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n\nfunction inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = eventType & INPUT_START && pointersLen - changedPointersLen === 0;\n var isFinal = eventType & (INPUT_END | INPUT_CANCEL) && pointersLen - changedPointersLen === 0;\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n\n if (isFirst) {\n manager.session = {};\n } // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n\n\n input.eventType = eventType; // compute scale, rotation etc\n\n computeInputData(manager, input); // emit secret event\n\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n}\n\n/**\n * @private\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\nfunction splitStr(str) {\n return str.trim().split(/\\s+/g);\n}\n\n/**\n * @private\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n\nfunction removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n}\n\n/**\n * @private\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\nfunction getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return doc.defaultView || doc.parentWindow || window;\n}\n\n/**\n * @private\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n\nvar Input =\n/*#__PURE__*/\nfunction () {\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n\n this.init();\n }\n /**\n * @private\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n\n\n var _proto = Input.prototype;\n\n _proto.handler = function handler() {};\n /**\n * @private\n * bind the events\n */\n\n\n _proto.init = function init() {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n /**\n * @private\n * unbind the events\n */\n\n\n _proto.destroy = function destroy() {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n };\n\n return Input;\n}();\n\n/**\n * @private\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\nfunction inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n } else {\n var i = 0;\n\n while (i < src.length) {\n if (findByKey && src[i][findByKey] == find || !findByKey && src[i] === find) {\n // do not use === here, test fails\n return i;\n }\n\n i++;\n }\n\n return -1;\n }\n}\n\nvar POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n}; // in IE10 the pointer types is defined as an enum\n\nvar IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n\n};\nvar POINTER_ELEMENT_EVENTS = 'pointerdown';\nvar POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive\n\nif (win.MSPointerEvent && !win.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n}\n/**\n * @private\n * Pointer events input\n * @constructor\n * @extends Input\n */\n\n\nvar PointerEventInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(PointerEventInput, _Input);\n\n function PointerEventInput() {\n var _this;\n\n var proto = PointerEventInput.prototype;\n proto.evEl = POINTER_ELEMENT_EVENTS;\n proto.evWin = POINTER_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.store = _this.manager.session.pointerEvents = [];\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = PointerEventInput.prototype;\n\n _proto.handler = function handler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = pointerType === INPUT_TYPE_TOUCH; // get index of the event in the store\n\n var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down\n\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n } // it not found, so the pointer hasn't been down (so it's probably a hover)\n\n\n if (storeIndex < 0) {\n return;\n } // update the event in the store\n\n\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n };\n\n return PointerEventInput;\n}(Input);\n\n/**\n * @private\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\nfunction toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n}\n\n/**\n * @private\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n\nfunction uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n\n values[i] = val;\n i++;\n }\n\n if (sort) {\n if (!key) {\n results = results.sort();\n } else {\n results = results.sort(function (a, b) {\n return a[key] > b[key];\n });\n }\n }\n\n return results;\n}\n\nvar TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n\nvar TouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(TouchInput, _Input);\n\n function TouchInput() {\n var _this;\n\n TouchInput.prototype.evTarget = TOUCH_TARGET_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.targetIds = {}; // this.evTarget = TOUCH_TARGET_EVENTS;\n\n return _this;\n }\n\n var _proto = TouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n\n if (!touches) {\n return;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return TouchInput;\n}(Input);\n\nfunction getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds; // when there is only one touch, the process can be simplified\n\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n\n var i;\n var targetTouches;\n var changedTouches = toArray(ev.changedTouches);\n var changedTargetTouches = [];\n var target = this.target; // get target touches from touches\n\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n }); // collect touches\n\n if (type === INPUT_START) {\n i = 0;\n\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n } // filter changed touches to only contain touches that exist in the collected target ids\n\n\n i = 0;\n\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n } // cleanup removed touches\n\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n\n i++;\n }\n\n if (!changedTargetTouches.length) {\n return;\n }\n\n return [// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches];\n}\n\nvar MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n};\nvar MOUSE_ELEMENT_EVENTS = 'mousedown';\nvar MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n/**\n * @private\n * Mouse events input\n * @constructor\n * @extends Input\n */\n\nvar MouseInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(MouseInput, _Input);\n\n function MouseInput() {\n var _this;\n\n var proto = MouseInput.prototype;\n proto.evEl = MOUSE_ELEMENT_EVENTS;\n proto.evWin = MOUSE_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.pressed = false; // mousedown state\n\n return _this;\n }\n /**\n * @private\n * handle mouse events\n * @param {Object} ev\n */\n\n\n var _proto = MouseInput.prototype;\n\n _proto.handler = function handler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down\n\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n } // mouse must be down\n\n\n if (!this.pressed) {\n return;\n }\n\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n };\n\n return MouseInput;\n}(Input);\n\n/**\n * @private\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n\nvar DEDUP_TIMEOUT = 2500;\nvar DEDUP_DISTANCE = 25;\n\nfunction setLastTouch(eventData) {\n var _eventData$changedPoi = eventData.changedPointers,\n touch = _eventData$changedPoi[0];\n\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = {\n x: touch.clientX,\n y: touch.clientY\n };\n var lts = this.lastTouches;\n this.lastTouches.push(lastTouch);\n\n var removeLastTouch = function removeLastTouch() {\n var i = lts.indexOf(lastTouch);\n\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n}\n\nfunction recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n}\n\nfunction isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX;\n var y = eventData.srcEvent.clientY;\n\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x);\n var dy = Math.abs(y - t.y);\n\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n\n return false;\n}\n\nvar TouchMouseInput =\n/*#__PURE__*/\nfunction () {\n var TouchMouseInput =\n /*#__PURE__*/\n function (_Input) {\n _inheritsLoose(TouchMouseInput, _Input);\n\n function TouchMouseInput(_manager, callback) {\n var _this;\n\n _this = _Input.call(this, _manager, callback) || this;\n\n _this.handler = function (manager, inputEvent, inputData) {\n var isTouch = inputData.pointerType === INPUT_TYPE_TOUCH;\n var isMouse = inputData.pointerType === INPUT_TYPE_MOUSE;\n\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n } // when we're in a touch event, record touches to de-dupe synthetic mouse event\n\n\n if (isTouch) {\n recordTouches.call(_assertThisInitialized(_assertThisInitialized(_this)), inputEvent, inputData);\n } else if (isMouse && isSyntheticEvent.call(_assertThisInitialized(_assertThisInitialized(_this)), inputData)) {\n return;\n }\n\n _this.callback(manager, inputEvent, inputData);\n };\n\n _this.touch = new TouchInput(_this.manager, _this.handler);\n _this.mouse = new MouseInput(_this.manager, _this.handler);\n _this.primaryTouch = null;\n _this.lastTouches = [];\n return _this;\n }\n /**\n * @private\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n\n\n var _proto = TouchMouseInput.prototype;\n\n /**\n * @private\n * remove the event listeners\n */\n _proto.destroy = function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n };\n\n return TouchMouseInput;\n }(Input);\n\n return TouchMouseInput;\n}();\n\n/**\n * @private\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n\nfunction createInputInstance(manager) {\n var Type; // let inputClass = manager.options.inputClass;\n\n var inputClass = manager.options.inputClass;\n\n if (inputClass) {\n Type = inputClass;\n } else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n } else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n } else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n } else {\n Type = TouchMouseInput;\n }\n\n return new Type(manager, inputHandler);\n}\n\n/**\n * @private\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n\nfunction invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n\n return false;\n}\n\nvar STATE_POSSIBLE = 1;\nvar STATE_BEGAN = 2;\nvar STATE_CHANGED = 4;\nvar STATE_ENDED = 8;\nvar STATE_RECOGNIZED = STATE_ENDED;\nvar STATE_CANCELLED = 16;\nvar STATE_FAILED = 32;\n\n/**\n * @private\n * get a unique id\n * @returns {number} uniqueId\n */\nvar _uniqueId = 1;\nfunction uniqueId() {\n return _uniqueId++;\n}\n\n/**\n * @private\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\nfunction getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n\n if (manager) {\n return manager.get(otherRecognizer);\n }\n\n return otherRecognizer;\n}\n\n/**\n * @private\n * get a usable string, used as event postfix\n * @param {constant} state\n * @returns {String} state\n */\n\nfunction stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n } else if (state & STATE_ENDED) {\n return 'end';\n } else if (state & STATE_CHANGED) {\n return 'move';\n } else if (state & STATE_BEGAN) {\n return 'start';\n }\n\n return '';\n}\n\n/**\n * @private\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n\n/**\n * @private\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n\nvar Recognizer =\n/*#__PURE__*/\nfunction () {\n function Recognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n this.options = _extends({\n enable: true\n }, options);\n this.id = uniqueId();\n this.manager = null; // default is enable true\n\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n\n\n var _proto = Recognizer.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state\n\n this.manager && this.manager.touchAction.update();\n return this;\n };\n /**\n * @private\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.recognizeWith = function recognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRecognizeWith = function dropRecognizeWith(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n };\n /**\n * @private\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.requireFailure = function requireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n\n return this;\n };\n /**\n * @private\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n\n\n _proto.dropRequireFailure = function dropRequireFailure(otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n\n return this;\n };\n /**\n * @private\n * has require failures boolean\n * @returns {boolean}\n */\n\n\n _proto.hasRequireFailures = function hasRequireFailures() {\n return this.requireFail.length > 0;\n };\n /**\n * @private\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n\n\n _proto.canRecognizeWith = function canRecognizeWith(otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n };\n /**\n * @private\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n\n\n _proto.emit = function emit(input) {\n var self = this;\n var state = this.state;\n\n function emit(event) {\n self.manager.emit(event, input);\n } // 'panstart' and 'panmove'\n\n\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n\n emit(self.options.event); // simple 'eventName' events\n\n if (input.additionalEvent) {\n // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n } // panend and pancancel\n\n\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n };\n /**\n * @private\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n\n\n _proto.tryEmit = function tryEmit(input) {\n if (this.canEmit()) {\n return this.emit(input);\n } // it's failing anyway\n\n\n this.state = STATE_FAILED;\n };\n /**\n * @private\n * can we emit?\n * @returns {boolean}\n */\n\n\n _proto.canEmit = function canEmit() {\n var i = 0;\n\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n\n i++;\n }\n\n return true;\n };\n /**\n * @private\n * update the recognizer\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign$1({}, inputData); // is is enabled and allow recognizing?\n\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n } // reset when we've reached the end\n\n\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n\n this.state = this.process(inputDataClone); // the recognizer has recognized a gesture\n // so trigger an event\n\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n };\n /**\n * @private\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {constant} STATE\n */\n\n /* jshint ignore:start */\n\n\n _proto.process = function process(inputData) {};\n /* jshint ignore:end */\n\n /**\n * @private\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n\n\n _proto.getTouchAction = function getTouchAction() {};\n /**\n * @private\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n\n\n _proto.reset = function reset() {};\n\n return Recognizer;\n}();\n\n/**\n * @private\n * A tap is recognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n\nvar TapRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(TapRecognizer, _Recognizer);\n\n function TapRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n // max time between the multi-tap taps\n time: 250,\n // max time of the pointer to be down (like finger on the screen)\n threshold: 9,\n // a minimal movement is ok, but keep it low\n posThreshold: 10\n }, options)) || this; // previous time and center,\n // used for tap counting\n\n _this.pTime = false;\n _this.pCenter = false;\n _this._timer = null;\n _this._input = null;\n _this.count = 0;\n return _this;\n }\n\n var _proto = TapRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_MANIPULATION];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n\n if (input.eventType & INPUT_START && this.count === 0) {\n return this.failTimeout();\n } // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType !== INPUT_END) {\n return this.failTimeout();\n }\n\n var validInterval = this.pTime ? input.timeStamp - this.pTime < options.interval : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n } else {\n this.count += 1;\n }\n\n this._input = input; // if tap count matches we have recognized it,\n // else it has began recognizing...\n\n var tapCount = this.count % options.taps;\n\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n } else {\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.interval);\n return STATE_BEGAN;\n }\n }\n }\n\n return STATE_FAILED;\n };\n\n _proto.failTimeout = function failTimeout() {\n var _this3 = this;\n\n this._timer = setTimeout(function () {\n _this3.state = STATE_FAILED;\n }, this.options.interval);\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit() {\n if (this.state === STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return TapRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n\nvar AttrRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(AttrRecognizer, _Recognizer);\n\n function AttrRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _Recognizer.call(this, _extends({\n pointers: 1\n }, options)) || this;\n }\n /**\n * @private\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n\n\n var _proto = AttrRecognizer.prototype;\n\n _proto.attrTest = function attrTest(input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n };\n /**\n * @private\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n\n\n _proto.process = function process(input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED\n\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n } else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n } else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n\n return state | STATE_CHANGED;\n }\n\n return STATE_FAILED;\n };\n\n return AttrRecognizer;\n}(Recognizer);\n\n/**\n * @private\n * direction cons to string\n * @param {constant} direction\n * @returns {String}\n */\n\nfunction directionStr(direction) {\n if (direction === DIRECTION_DOWN) {\n return 'down';\n } else if (direction === DIRECTION_UP) {\n return 'up';\n } else if (direction === DIRECTION_LEFT) {\n return 'left';\n } else if (direction === DIRECTION_RIGHT) {\n return 'right';\n }\n\n return '';\n}\n\n/**\n * @private\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PanRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PanRecognizer, _AttrRecognizer);\n\n function PanRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _AttrRecognizer.call(this, _extends({\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n }, options)) || this;\n _this.pX = null;\n _this.pY = null;\n return _this;\n }\n\n var _proto = PanRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n var direction = this.options.direction;\n var actions = [];\n\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n\n return actions;\n };\n\n _proto.directionTest = function directionTest(input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY; // lock to axis?\n\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x !== this.pX;\n distance = Math.abs(input.deltaX);\n } else {\n direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y !== this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n };\n\n _proto.attrTest = function attrTest(input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) && ( // replace with a super call\n this.state & STATE_BEGAN || !(this.state & STATE_BEGAN) && this.directionTest(input));\n };\n\n _proto.emit = function emit(input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PanRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar SwipeRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(SwipeRecognizer, _AttrRecognizer);\n\n function SwipeRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n }, options)) || this;\n }\n\n var _proto = SwipeRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return PanRecognizer.prototype.getTouchAction.call(this);\n };\n\n _proto.attrTest = function attrTest(input) {\n var direction = this.options.direction;\n var velocity;\n\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n } else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n } else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n\n return _AttrRecognizer.prototype.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers === this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n };\n\n _proto.emit = function emit(input) {\n var direction = directionStr(input.offsetDirection);\n\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n\n this.manager.emit(this.options.event, input);\n };\n\n return SwipeRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar PinchRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(PinchRecognizer, _AttrRecognizer);\n\n function PinchRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'pinch',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = PinchRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n _proto.emit = function emit(input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n\n _AttrRecognizer.prototype.emit.call(this, input);\n };\n\n return PinchRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n\nvar RotateRecognizer =\n/*#__PURE__*/\nfunction (_AttrRecognizer) {\n _inheritsLoose(RotateRecognizer, _AttrRecognizer);\n\n function RotateRecognizer(options) {\n if (options === void 0) {\n options = {};\n }\n\n return _AttrRecognizer.call(this, _extends({\n event: 'rotate',\n threshold: 0,\n pointers: 2\n }, options)) || this;\n }\n\n var _proto = RotateRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_NONE];\n };\n\n _proto.attrTest = function attrTest(input) {\n return _AttrRecognizer.prototype.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n };\n\n return RotateRecognizer;\n}(AttrRecognizer);\n\n/**\n * @private\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n\nvar PressRecognizer =\n/*#__PURE__*/\nfunction (_Recognizer) {\n _inheritsLoose(PressRecognizer, _Recognizer);\n\n function PressRecognizer(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Recognizer.call(this, _extends({\n event: 'press',\n pointers: 1,\n time: 251,\n // minimal time of the pointer to be pressed\n threshold: 9\n }, options)) || this;\n _this._timer = null;\n _this._input = null;\n return _this;\n }\n\n var _proto = PressRecognizer.prototype;\n\n _proto.getTouchAction = function getTouchAction() {\n return [TOUCH_ACTION_AUTO];\n };\n\n _proto.process = function process(input) {\n var _this2 = this;\n\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input; // we only allow little movement\n // and we've reached an end event, so a tap is possible\n\n if (!validMovement || !validPointers || input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime) {\n this.reset();\n } else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeout(function () {\n _this2.state = STATE_RECOGNIZED;\n\n _this2.tryEmit();\n }, options.time);\n } else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n\n return STATE_FAILED;\n };\n\n _proto.reset = function reset() {\n clearTimeout(this._timer);\n };\n\n _proto.emit = function emit(input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n\n if (input && input.eventType & INPUT_END) {\n this.manager.emit(this.options.event + \"up\", input);\n } else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n };\n\n return PressRecognizer;\n}(Recognizer);\n\nvar defaults = {\n /**\n * @private\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n\n /**\n * @private\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n\n /**\n * @private\n * @type {Boolean}\n * @default true\n */\n enable: true,\n\n /**\n * @private\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n\n /**\n * @private\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n\n /**\n * @private\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * @private\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: \"none\",\n\n /**\n * @private\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: \"none\",\n\n /**\n * @private\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: \"none\",\n\n /**\n * @private\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: \"none\",\n\n /**\n * @private\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: \"none\",\n\n /**\n * @private\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: \"rgba(0,0,0,0)\"\n }\n};\n/**\n * @private\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * This is separated with other defaults because of tree-shaking.\n * @type {Array}\n */\n\nvar preset = [[RotateRecognizer, {\n enable: false\n}], [PinchRecognizer, {\n enable: false\n}, ['rotate']], [SwipeRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}], [PanRecognizer, {\n direction: DIRECTION_HORIZONTAL\n}, ['swipe']], [TapRecognizer], [TapRecognizer, {\n event: 'doubletap',\n taps: 2\n}, ['tap']], [PressRecognizer]];\n\nvar STOP = 1;\nvar FORCED_STOP = 2;\n/**\n * @private\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n\nfunction toggleCssProps(manager, add) {\n var element = manager.element;\n\n if (!element.style) {\n return;\n }\n\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n } else {\n element.style[prop] = manager.oldCssProps[prop] || \"\";\n }\n });\n\n if (!add) {\n manager.oldCssProps = {};\n }\n}\n/**\n * @private\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n\n\nfunction triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent(\"Event\");\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n}\n/**\n* @private\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\n\nvar Manager =\n/*#__PURE__*/\nfunction () {\n function Manager(element, options) {\n var _this = this;\n\n this.options = assign$1({}, defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = _this.add(new item[0](item[1]));\n\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n /**\n * @private\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n\n\n var _proto = Manager.prototype;\n\n _proto.set = function set(options) {\n assign$1(this.options, options); // Options that need a little more setup\n\n if (options.touchAction) {\n this.touchAction.update();\n }\n\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n\n return this;\n };\n /**\n * @private\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n\n\n _proto.stop = function stop(force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n };\n /**\n * @private\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n\n\n _proto.recognize = function recognize(inputData) {\n var session = this.session;\n\n if (session.stopped) {\n return;\n } // run the touch-action polyfill\n\n\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers; // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n\n var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized\n // or when we're in a new session\n\n if (!curRecognizer || curRecognizer && curRecognizer.state & STATE_RECOGNIZED) {\n session.curRecognizer = null;\n curRecognizer = null;\n }\n\n var i = 0;\n\n while (i < recognizers.length) {\n recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer === curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) {\n // 3\n recognizer.recognize(inputData);\n } else {\n recognizer.reset();\n } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n\n\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n session.curRecognizer = recognizer;\n curRecognizer = recognizer;\n }\n\n i++;\n }\n };\n /**\n * @private\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n\n\n _proto.get = function get(recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n\n var recognizers = this.recognizers;\n\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event === recognizer) {\n return recognizers[i];\n }\n }\n\n return null;\n };\n /**\n * @private add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n\n\n _proto.add = function add(recognizer) {\n if (invokeArrayArg(recognizer, \"add\", this)) {\n return this;\n } // remove existing\n\n\n var existing = this.get(recognizer.options.event);\n\n if (existing) {\n this.remove(existing);\n }\n\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n };\n /**\n * @private\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n\n\n _proto.remove = function remove(recognizer) {\n if (invokeArrayArg(recognizer, \"remove\", this)) {\n return this;\n }\n\n var targetRecognizer = this.get(recognizer); // let's make sure this recognizer exists\n\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, targetRecognizer);\n\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n\n return this;\n };\n /**\n * @private\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n\n\n _proto.on = function on(events, handler) {\n if (events === undefined || handler === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n };\n /**\n * @private unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n\n\n _proto.off = function off(events, handler) {\n if (events === undefined) {\n return this;\n }\n\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n } else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n };\n /**\n * @private emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n\n\n _proto.emit = function emit(event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n } // no handlers, so skip it all\n\n\n var handlers = this.handlers[event] && this.handlers[event].slice();\n\n if (!handlers || !handlers.length) {\n return;\n }\n\n data.type = event;\n\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n\n var i = 0;\n\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n };\n /**\n * @private\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n\n\n _proto.destroy = function destroy() {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n };\n\n return Manager;\n}();\n\nvar SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n};\nvar SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\nvar SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n/**\n * @private\n * Touch events input\n * @constructor\n * @extends Input\n */\n\nvar SingleTouchInput =\n/*#__PURE__*/\nfunction (_Input) {\n _inheritsLoose(SingleTouchInput, _Input);\n\n function SingleTouchInput() {\n var _this;\n\n var proto = SingleTouchInput.prototype;\n proto.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n proto.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n _this = _Input.apply(this, arguments) || this;\n _this.started = false;\n return _this;\n }\n\n var _proto = SingleTouchInput.prototype;\n\n _proto.handler = function handler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events?\n\n if (type === INPUT_START) {\n this.started = true;\n }\n\n if (!this.started) {\n return;\n }\n\n var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state\n\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n };\n\n return SingleTouchInput;\n}(Input);\n\nfunction normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n\n return [all, changed];\n}\n\n/**\n * @private\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\nfunction deprecate(method, name, message) {\n var deprecationMessage = \"DEPRECATED METHOD: \" + name + \"\\n\" + message + \" AT \\n\";\n return function () {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '').replace(/^\\s+at\\s+/gm, '').replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n\n return method.apply(this, arguments);\n };\n}\n\n/**\n * @private\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n\nvar extend = deprecate(function (dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n\n while (i < keys.length) {\n if (!merge || merge && dest[keys[i]] === undefined) {\n dest[keys[i]] = src[keys[i]];\n }\n\n i++;\n }\n\n return dest;\n}, 'extend', 'Use `assign`.');\n\n/**\n * @private\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n\nvar merge = deprecate(function (dest, src) {\n return extend(dest, src, true);\n}, 'merge', 'Use `assign`.');\n\n/**\n * @private\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n\nfunction inherit(child, base, properties) {\n var baseP = base.prototype;\n var childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n\n if (properties) {\n assign$1(childP, properties);\n }\n}\n\n/**\n * @private\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\nfunction bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n}\n\n/**\n * @private\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n\nvar Hammer =\n/*#__PURE__*/\nfunction () {\n var Hammer =\n /**\n * @private\n * @const {string}\n */\n function Hammer(element, options) {\n if (options === void 0) {\n options = {};\n }\n\n return new Manager(element, _extends({\n recognizers: preset.concat()\n }, options));\n };\n\n Hammer.VERSION = \"2.0.17-rc\";\n Hammer.DIRECTION_ALL = DIRECTION_ALL;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.DIRECTION_LEFT = DIRECTION_LEFT;\n Hammer.DIRECTION_RIGHT = DIRECTION_RIGHT;\n Hammer.DIRECTION_UP = DIRECTION_UP;\n Hammer.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n Hammer.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n Hammer.DIRECTION_NONE = DIRECTION_NONE;\n Hammer.DIRECTION_DOWN = DIRECTION_DOWN;\n Hammer.INPUT_START = INPUT_START;\n Hammer.INPUT_MOVE = INPUT_MOVE;\n Hammer.INPUT_END = INPUT_END;\n Hammer.INPUT_CANCEL = INPUT_CANCEL;\n Hammer.STATE_POSSIBLE = STATE_POSSIBLE;\n Hammer.STATE_BEGAN = STATE_BEGAN;\n Hammer.STATE_CHANGED = STATE_CHANGED;\n Hammer.STATE_ENDED = STATE_ENDED;\n Hammer.STATE_RECOGNIZED = STATE_RECOGNIZED;\n Hammer.STATE_CANCELLED = STATE_CANCELLED;\n Hammer.STATE_FAILED = STATE_FAILED;\n Hammer.Manager = Manager;\n Hammer.Input = Input;\n Hammer.TouchAction = TouchAction;\n Hammer.TouchInput = TouchInput;\n Hammer.MouseInput = MouseInput;\n Hammer.PointerEventInput = PointerEventInput;\n Hammer.TouchMouseInput = TouchMouseInput;\n Hammer.SingleTouchInput = SingleTouchInput;\n Hammer.Recognizer = Recognizer;\n Hammer.AttrRecognizer = AttrRecognizer;\n Hammer.Tap = TapRecognizer;\n Hammer.Pan = PanRecognizer;\n Hammer.Swipe = SwipeRecognizer;\n Hammer.Pinch = PinchRecognizer;\n Hammer.Rotate = RotateRecognizer;\n Hammer.Press = PressRecognizer;\n Hammer.on = addEventListeners;\n Hammer.off = removeEventListeners;\n Hammer.each = each;\n Hammer.merge = merge;\n Hammer.extend = extend;\n Hammer.bindFn = bindFn;\n Hammer.assign = assign$1;\n Hammer.inherit = inherit;\n Hammer.bindFn = bindFn;\n Hammer.prefixed = prefixed;\n Hammer.toArray = toArray;\n Hammer.inArray = inArray;\n Hammer.uniqueArray = uniqueArray;\n Hammer.splitStr = splitStr;\n Hammer.boolOrFn = boolOrFn;\n Hammer.hasParent = hasParent;\n Hammer.addEventListeners = addEventListeners;\n Hammer.removeEventListeners = removeEventListeners;\n Hammer.defaults = assign$1({}, defaults, {\n preset: preset\n });\n return Hammer;\n}();\n\n// style loader but by script tag, not by the loader.\n\nvar defaults$1 = Hammer.defaults;\n\nexport default Hammer;\nexport { INPUT_START, INPUT_MOVE, INPUT_END, INPUT_CANCEL, STATE_POSSIBLE, STATE_BEGAN, STATE_CHANGED, STATE_ENDED, STATE_RECOGNIZED, STATE_CANCELLED, STATE_FAILED, DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, Input, TouchAction, TouchInput, MouseInput, PointerEventInput, TouchMouseInput, SingleTouchInput, Recognizer, AttrRecognizer, TapRecognizer as Tap, PanRecognizer as Pan, SwipeRecognizer as Swipe, PinchRecognizer as Pinch, RotateRecognizer as Rotate, PressRecognizer as Press, addEventListeners as on, removeEventListeners as off, each, merge, extend, assign$1 as assign, inherit, bindFn, prefixed, toArray, inArray, uniqueArray, splitStr, boolOrFn, hasParent, addEventListeners, removeEventListeners, defaults$1 as defaults };\n//# sourceMappingURL=hammer.esm.js.map\n","/*\nCopyright (c) 2015 NAVER Corp.\nname: @egjs/agent\nlicense: MIT\nauthor: NAVER Corp.\nrepository: git+https://github.com/naver/agent.git\nversion: 2.2.1\n*/\nfunction some(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return true;\n }\n }\n\n return false;\n}\nfunction find(arr, callback) {\n var length = arr.length;\n\n for (var i = 0; i < length; ++i) {\n if (callback(arr[i], i)) {\n return arr[i];\n }\n }\n\n return null;\n}\nfunction getUserAgent(agent) {\n var userAgent = agent;\n\n if (typeof userAgent === \"undefined\") {\n if (typeof navigator === \"undefined\" || !navigator) {\n return \"\";\n }\n\n userAgent = navigator.userAgent || \"\";\n }\n\n return userAgent.toLowerCase();\n}\nfunction execRegExp(pattern, text) {\n try {\n return new RegExp(pattern, \"g\").exec(text);\n } catch (e) {\n return null;\n }\n}\nfunction hasUserAgentData() {\n if (typeof navigator === \"undefined\" || !navigator || !navigator.userAgentData) {\n return false;\n }\n\n var userAgentData = navigator.userAgentData;\n var brands = userAgentData.brands || userAgentData.uaList;\n return !!(brands && brands.length);\n}\nfunction findVersion(versionTest, userAgent) {\n var result = execRegExp(\"(\" + versionTest + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n return result ? result[3] : \"\";\n}\nfunction convertVersion(text) {\n return text.replace(/_/g, \".\");\n}\nfunction findPreset(presets, userAgent) {\n var userPreset = null;\n var version = \"-1\";\n some(presets, function (preset) {\n var result = execRegExp(\"(\" + preset.test + \")((?:\\\\/|\\\\s|:)([0-9|\\\\.|_]+))?\", userAgent);\n\n if (!result || preset.brand) {\n return false;\n }\n\n userPreset = preset;\n version = result[3] || \"-1\";\n\n if (preset.versionAlias) {\n version = preset.versionAlias;\n } else if (preset.versionTest) {\n version = findVersion(preset.versionTest.toLowerCase(), userAgent) || version;\n }\n\n version = convertVersion(version);\n return true;\n });\n return {\n preset: userPreset,\n version: version\n };\n}\nfunction findBrand(brands, preset) {\n return find(brands, function (_a) {\n var brand = _a.brand;\n return execRegExp(\"\" + preset.test, brand.toLowerCase());\n });\n}\n\nvar BROWSER_PRESETS = [{\n test: \"phantomjs\",\n id: \"phantomjs\"\n}, {\n test: \"whale\",\n id: \"whale\"\n}, {\n test: \"edgios|edge|edg\",\n id: \"edge\"\n}, {\n test: \"msie|trident|windows phone\",\n id: \"ie\",\n versionTest: \"iemobile|msie|rv\"\n}, {\n test: \"miuibrowser\",\n id: \"miui browser\"\n}, {\n test: \"samsungbrowser\",\n id: \"samsung internet\"\n}, {\n test: \"samsung\",\n id: \"samsung internet\",\n versionTest: \"version\"\n}, {\n test: \"chrome|crios\",\n id: \"chrome\"\n}, {\n test: \"firefox|fxios\",\n id: \"firefox\"\n}, {\n test: \"android\",\n id: \"android browser\",\n versionTest: \"version\"\n}, {\n test: \"safari|iphone|ipad|ipod\",\n id: \"safari\",\n versionTest: \"version\"\n}]; // chromium's engine(blink) is based on applewebkit 537.36.\n\nvar CHROMIUM_PRESETS = [{\n test: \"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\\\schrome)\",\n id: \"chrome\"\n}, {\n test: \"chromium\",\n id: \"chrome\"\n}, {\n test: \"whale\",\n id: \"chrome\",\n brand: true\n}];\nvar WEBKIT_PRESETS = [{\n test: \"applewebkit\",\n id: \"webkit\"\n}];\nvar WEBVIEW_PRESETS = [{\n test: \"(?=(iphone|ipad))(?!(.*version))\",\n id: \"webview\"\n}, {\n test: \"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))\",\n id: \"webview\"\n}, {\n // test webview\n test: \"webview\",\n id: \"webview\"\n}];\nvar OS_PRESETS = [{\n test: \"windows phone\",\n id: \"windows phone\"\n}, {\n test: \"windows 2000\",\n id: \"window\",\n versionAlias: \"5.0\"\n}, {\n test: \"windows nt\",\n id: \"window\"\n}, {\n test: \"iphone|ipad|ipod\",\n id: \"ios\",\n versionTest: \"iphone os|cpu os\"\n}, {\n test: \"mac os x\",\n id: \"mac\"\n}, {\n test: \"android\",\n id: \"android\"\n}, {\n test: \"tizen\",\n id: \"tizen\"\n}, {\n test: \"webos|web0s\",\n id: \"webos\"\n}];\n\nfunction parseUserAgentData(osData) {\n var userAgentData = navigator.userAgentData;\n var brands = (userAgentData.uaList || userAgentData.brands).slice();\n var isMobile = userAgentData.mobile || false;\n var firstBrand = brands[0];\n var browser = {\n name: firstBrand.brand,\n version: firstBrand.version,\n majorVersion: -1,\n webkit: false,\n webview: some(WEBVIEW_PRESETS, function (preset) {\n return findBrand(brands, preset);\n }),\n chromium: some(CHROMIUM_PRESETS, function (preset) {\n return findBrand(brands, preset);\n })\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n browser.webkit = !browser.chromium && some(WEBKIT_PRESETS, function (preset) {\n return findBrand(brands, preset);\n });\n\n if (osData) {\n var platform_1 = osData.platform.toLowerCase();\n var result = find(OS_PRESETS, function (preset) {\n return new RegExp(\"\" + preset.test, \"g\").exec(platform_1);\n });\n os.name = result ? result.id : platform_1;\n os.version = osData.platformVersion;\n }\n\n some(BROWSER_PRESETS, function (preset) {\n var result = findBrand(brands, preset);\n\n if (!result) {\n return false;\n }\n\n browser.name = preset.id;\n browser.version = osData ? osData.uaFullVersion : result.version;\n return true;\n });\n\n if (navigator.platform === \"Linux armv8l\") {\n os.name = \"android\";\n } else if (browser.webkit) {\n os.name = isMobile ? \"ios\" : \"mac\";\n }\n\n if (os.name === \"ios\" && browser.webview) {\n browser.version = \"-1\";\n }\n\n os.version = convertVersion(os.version);\n browser.version = convertVersion(browser.version);\n os.majorVersion = parseInt(os.version, 10);\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: true\n };\n}\n\nfunction parseUserAgent(userAgent) {\n var nextAgent = getUserAgent(userAgent);\n var isMobile = !!/mobi/g.exec(nextAgent);\n var browser = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1,\n webview: !!findPreset(WEBVIEW_PRESETS, nextAgent).preset,\n chromium: !!findPreset(CHROMIUM_PRESETS, nextAgent).preset,\n webkit: false\n };\n var os = {\n name: \"unknown\",\n version: \"-1\",\n majorVersion: -1\n };\n\n var _a = findPreset(BROWSER_PRESETS, nextAgent),\n browserPreset = _a.preset,\n browserVersion = _a.version;\n\n var _b = findPreset(OS_PRESETS, nextAgent),\n osPreset = _b.preset,\n osVersion = _b.version;\n\n browser.webkit = !browser.chromium && !!findPreset(WEBKIT_PRESETS, nextAgent).preset;\n\n if (osPreset) {\n os.name = osPreset.id;\n os.version = osVersion;\n os.majorVersion = parseInt(osVersion, 10);\n }\n\n if (browserPreset) {\n browser.name = browserPreset.id;\n browser.version = browserVersion;\n\n if (browser.webview && os.name === \"ios\" && browser.name !== \"safari\") {\n browser.webview = false;\n }\n }\n\n browser.majorVersion = parseInt(browser.version, 10);\n return {\n browser: browser,\n os: os,\n isMobile: isMobile,\n isHints: false\n };\n}\n\n/**\n * @namespace eg.agent\n */\n\n/**\n* Extracts accuate browser and operating system information from the user agent string or client hints.\n* @ko 유저 에이전트 문자열 또는 client hints에서 정확한 브라우저와 운영체제 정보를 추출한다.\n* @function eg.agent#getAccurateAgent\n* @param - Callback function to get the accuate agent 정확한 에이전트를 가져오기 위한 callback 함수\n* @return - get the accuate agent promise. If Promise are not supported, null is returned. 정확한 에이전트 promise를 가져온다. Promise를 지원 하지 않는 경우, null을 반환한다. \n* @example\nimport { getAccurateAgent } from \"@egjs/agent\";\n// eg.agent.getAccurateAgent()\ngetAccurateAgent().then(agent => {\n const { os, browser, isMobile } = agent;\n});\ngetAccurateAgent(agent => {\n const { os, browser, isMobile } = agent;\n});\n*/\n\nfunction getAccurateAgent(callback) {\n if (hasUserAgentData()) {\n return navigator.userAgentData.getHighEntropyValues([\"architecture\", \"model\", \"platform\", \"platformVersion\", \"uaFullVersion\"]).then(function (info) {\n var agentInfo = parseUserAgentData(info);\n callback && callback(agentInfo);\n return agentInfo;\n });\n }\n\n callback && callback(agent());\n\n if (typeof Promise === \"undefined\" || !Promise) {\n return null;\n }\n\n return Promise.resolve(agent());\n}\n/**\n * Extracts browser and operating system information from the user agent string.\n * @ko 유저 에이전트 문자열에서 브라우저와 운영체제 정보를 추출한다.\n * @function eg.agent#agent\n * @param - user agent string to parse 파싱할 유저에이전트 문자열\n * @return - agent Info 에이전트 정보 \n * @example\nimport agent from \"@egjs/agent\";\n// eg.agent();\nconst { os, browser, isMobile } = agent();\n */\n\nfunction agent(userAgent) {\n if (typeof userAgent === \"undefined\" && hasUserAgentData()) {\n return parseUserAgentData();\n } else {\n return parseUserAgent(userAgent);\n }\n}\n\nexport default agent;\nexport { getAccurateAgent };\n//# sourceMappingURL=agent.esm.js.map\n","/*\nCopyright (c) 2017 NAVER Corp.\n@egjs/axes project is licensed under the MIT license\n\n@egjs/axes JavaScript library\nhttps://github.com/naver/egjs-axes\n\n@version 2.7.1\n*/\nimport { DIRECTION_NONE, DIRECTION_LEFT, DIRECTION_RIGHT, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_HORIZONTAL, DIRECTION_VERTICAL, DIRECTION_ALL, Manager, PointerEventInput, TouchMouseInput, TouchInput, MouseInput, Pan, Pinch } from '@egjs/hammerjs';\nimport getAgent from '@egjs/agent';\nimport Component from '@egjs/component';\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\n\n/* global Reflect, Promise */\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n };\n\n return extendStatics(d, b);\n};\n\nfunction __extends(d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n\n return t;\n };\n\n return __assign.apply(this, arguments);\n};\n\nfunction getInsidePosition(destPos, range, circular, bounce) {\n var toDestPos = destPos;\n var targetRange = [circular[0] ? range[0] : bounce ? range[0] - bounce[0] : range[0], circular[1] ? range[1] : bounce ? range[1] + bounce[1] : range[1]];\n toDestPos = Math.max(targetRange[0], toDestPos);\n toDestPos = Math.min(targetRange[1], toDestPos);\n return toDestPos;\n} // determine outside\n\nfunction isOutside(pos, range) {\n return pos < range[0] || pos > range[1];\n}\nfunction getDuration(distance, deceleration) {\n var duration = Math.sqrt(distance / deceleration * 2); // when duration is under 100, then value is zero\n\n return duration < 100 ? 0 : duration;\n}\nfunction isCircularable(destPos, range, circular) {\n return circular[1] && destPos > range[1] || circular[0] && destPos < range[0];\n}\nfunction getCirculatedPos(pos, range, circular) {\n var toPos = pos;\n var min = range[0];\n var max = range[1];\n var length = max - min;\n\n if (circular[1] && pos > max) {\n // right\n toPos = (toPos - max) % length + min;\n }\n\n if (circular[0] && pos < min) {\n // left\n toPos = (toPos - min) % length + max;\n }\n\n return toPos;\n}\n\n/* eslint-disable no-new-func, no-nested-ternary */\nvar win;\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\nfunction toArray(nodes) {\n // const el = Array.prototype.slice.call(nodes);\n // for IE8\n var el = [];\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n el.push(nodes[i]);\n }\n\n return el;\n}\nfunction $(param, multi) {\n if (multi === void 0) {\n multi = false;\n }\n\n var el;\n\n if (typeof param === \"string\") {\n // String (HTML, Selector)\n // check if string is HTML tag format\n var match = param.match(/^<([a-z]+)\\s*([^>]*)>/); // creating element\n\n if (match) {\n // HTML\n var dummy = document.createElement(\"div\");\n dummy.innerHTML = param;\n el = toArray(dummy.childNodes);\n } else {\n // Selector\n el = toArray(document.querySelectorAll(param));\n }\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n } else if (param === win) {\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 (\"jQuery\" in win && param instanceof jQuery || param.constructor.prototype.jquery) {\n // jQuery\n el = multi ? param.toArray() : param.get(0);\n } else if (Array.isArray(param)) {\n el = param.map(function (v) {\n return $(v);\n });\n\n if (!multi) {\n el = el.length >= 1 ? el[0] : undefined;\n }\n }\n\n return el;\n}\nvar raf = win.requestAnimationFrame || win.webkitRequestAnimationFrame;\nvar caf = win.cancelAnimationFrame || win.webkitCancelAnimationFrame;\n\nif (raf && !caf) {\n var keyInfo_1 = {};\n var oldraf_1 = raf;\n\n raf = function (callback) {\n function wrapCallback(timestamp) {\n if (keyInfo_1[key]) {\n callback(timestamp);\n }\n }\n\n var key = oldraf_1(wrapCallback);\n keyInfo_1[key] = true;\n return key;\n };\n\n caf = function (key) {\n delete keyInfo_1[key];\n };\n} else if (!(raf && caf)) {\n raf = function (callback) {\n return win.setTimeout(function () {\n callback(win.performance && win.performance.now && win.performance.now() || new Date().getTime());\n }, 16);\n };\n\n caf = win.clearTimeout;\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 */\n\n\nfunction 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*/\n\nfunction cancelAnimationFrame(key) {\n caf(key);\n}\nfunction map(obj, callback) {\n var tranformed = {};\n\n for (var k in obj) {\n k && (tranformed[k] = callback(obj[k], k));\n }\n\n return tranformed;\n}\nfunction filter(obj, callback) {\n var filtered = {};\n\n for (var k in obj) {\n k && callback(obj[k], k) && (filtered[k] = obj[k]);\n }\n\n return filtered;\n}\nfunction every(obj, callback) {\n for (var k in obj) {\n if (k && !callback(obj[k], k)) {\n return false;\n }\n }\n\n return true;\n}\nfunction equal(target, base) {\n return every(target, function (v, k) {\n return v === base[k];\n });\n}\nvar roundNumFunc = {};\nfunction roundNumber(num, roundUnit) {\n // Cache for performance\n if (!roundNumFunc[roundUnit]) {\n roundNumFunc[roundUnit] = getRoundFunc(roundUnit);\n }\n\n return roundNumFunc[roundUnit](num);\n}\nfunction roundNumbers(num, roundUnit) {\n if (!num || !roundUnit) {\n return num;\n }\n\n var isNumber = typeof roundUnit === \"number\";\n return map(num, function (value, key) {\n return roundNumber(value, isNumber ? roundUnit : roundUnit[key]);\n });\n}\nfunction getDecimalPlace(val) {\n if (!isFinite(val)) {\n return 0;\n }\n\n var v = val + \"\";\n\n if (v.indexOf(\"e\") >= 0) {\n // Exponential Format\n // 1e-10, 1e-12\n var p = 0;\n var e = 1;\n\n while (Math.round(val * e) / e !== val) {\n e *= 10;\n p++;\n }\n\n return p;\n } // In general, following has performance benefit.\n // https://jsperf.com/precision-calculation\n\n\n return v.indexOf(\".\") >= 0 ? v.length - v.indexOf(\".\") - 1 : 0;\n}\nfunction inversePow(n) {\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}\nfunction getRoundFunc(v) {\n var p = v < 1 ? Math.pow(10, getDecimalPlace(v)) : 1;\n return function (n) {\n if (v === 0) {\n return 0;\n }\n\n return Math.round(Math.round(n / v) * v * p) / p;\n };\n}\n\nfunction minMax(value, min, max) {\n return Math.max(Math.min(value, max), min);\n}\n\nvar AnimationManager =\n/*#__PURE__*/\nfunction () {\n function AnimationManager(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.animationEnd = this.animationEnd.bind(this);\n }\n\n var __proto = AnimationManager.prototype;\n\n __proto.getDuration = function (depaPos, destPos, wishDuration) {\n var _this = this;\n\n var duration;\n\n if (typeof wishDuration !== \"undefined\") {\n duration = wishDuration;\n } else {\n var durations_1 = map(destPos, function (v, k) {\n return getDuration(Math.abs(v - depaPos[k]), _this.options.deceleration);\n });\n duration = Object.keys(durations_1).reduce(function (max, v) {\n return Math.max(max, durations_1[v]);\n }, -Infinity);\n }\n\n return minMax(duration, this.options.minimumDuration, this.options.maximumDuration);\n };\n\n __proto.createAnimationParam = function (pos, duration, option) {\n var depaPos = this.axm.get();\n var destPos = pos;\n var inputEvent = option && option.event || null;\n return {\n depaPos: depaPos,\n destPos: destPos,\n duration: minMax(duration, this.options.minimumDuration, this.options.maximumDuration),\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: inputEvent,\n input: option && option.input || null,\n isTrusted: !!inputEvent,\n done: this.animationEnd\n };\n };\n\n __proto.grab = function (axes, option) {\n if (this._animateParam && axes.length) {\n var orgPos_1 = this.axm.get(axes);\n var pos = this.axm.map(orgPos_1, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n });\n\n if (!every(pos, function (v, k) {\n return orgPos_1[k] === v;\n })) {\n this.em.triggerChange(pos, false, orgPos_1, option, !!option);\n }\n\n this._animateParam = null;\n this._raf && cancelAnimationFrame(this._raf);\n this._raf = null;\n this.em.triggerAnimationEnd(!!(option && option.event));\n }\n };\n\n __proto.getEventInfo = function () {\n if (this._animateParam && this._animateParam.input && this._animateParam.inputEvent) {\n return {\n input: this._animateParam.input,\n event: this._animateParam.inputEvent\n };\n } else {\n return null;\n }\n };\n\n __proto.restore = function (option) {\n var pos = this.axm.get();\n var destPos = this.axm.map(pos, function (v, opt) {\n return Math.min(opt.range[1], Math.max(opt.range[0], v));\n });\n this.animateTo(destPos, this.getDuration(pos, destPos), option);\n };\n\n __proto.animationEnd = function () {\n var beforeParam = this.getEventInfo();\n this._animateParam = null; // for Circular\n\n var circularTargets = this.axm.filter(this.axm.get(), function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n });\n Object.keys(circularTargets).length > 0 && this.setTo(this.axm.map(circularTargets, function (v, opt) {\n return getCirculatedPos(v, opt.range, opt.circular);\n }));\n this.itm.setInterrupt(false);\n this.em.triggerAnimationEnd(!!beforeParam);\n\n if (this.axm.isOutside()) {\n this.restore(beforeParam);\n } else {\n this.finish(!!beforeParam);\n }\n };\n\n __proto.finish = function (isTrusted) {\n this._animateParam = null;\n this.itm.setInterrupt(false);\n this.em.triggerFinish(isTrusted);\n };\n\n __proto.animateLoop = function (param, complete) {\n if (param.duration) {\n this._animateParam = __assign({}, param);\n var info_1 = this._animateParam;\n var self_1 = this;\n var destPos_1 = info_1.destPos;\n var prevPos_1 = info_1.depaPos;\n var prevEasingPer_1 = 0;\n var directions_1 = map(prevPos_1, function (value, key) {\n return value <= destPos_1[key] ? 1 : -1;\n });\n var originalIntendedPos_1 = map(destPos_1, function (v) {\n return v;\n });\n var prevTime_1 = new Date().getTime();\n info_1.startTime = prevTime_1;\n\n (function loop() {\n self_1._raf = null;\n var currentTime = new Date().getTime();\n var ratio = (currentTime - info_1.startTime) / param.duration;\n var easingPer = self_1.easing(ratio);\n var toPos = self_1.axm.map(prevPos_1, function (pos, options, key) {\n var nextPos = ratio >= 1 ? destPos_1[key] : pos + info_1.delta[key] * (easingPer - prevEasingPer_1); // Subtract distance from distance already moved.\n // Recalculate the remaining distance.\n // Fix the bouncing phenomenon by changing the range.\n\n var circulatedPos = getCirculatedPos(nextPos, options.range, options.circular);\n\n if (nextPos !== circulatedPos) {\n // circular\n var rangeOffset = directions_1[key] * (options.range[1] - options.range[0]);\n destPos_1[key] -= rangeOffset;\n prevPos_1[key] -= rangeOffset;\n }\n\n return circulatedPos;\n });\n var isCanceled = !self_1.em.triggerChange(toPos, false, prevPos_1);\n prevPos_1 = toPos;\n prevTime_1 = currentTime;\n prevEasingPer_1 = easingPer;\n\n if (easingPer >= 1) {\n destPos_1 = self_1.getFinalPos(destPos_1, originalIntendedPos_1);\n\n if (!equal(destPos_1, self_1.axm.get(Object.keys(destPos_1)))) {\n self_1.em.triggerChange(destPos_1, true, prevPos_1);\n }\n\n complete();\n return;\n } else if (isCanceled) {\n self_1.finish(false);\n } else {\n // animationEnd\n self_1._raf = requestAnimationFrame(loop);\n }\n })();\n } else {\n this.em.triggerChange(param.destPos, true);\n complete();\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 *\n * @param originalIntendedPos\n * @param destPos\n */\n\n\n __proto.getFinalPos = function (destPos, originalIntendedPos) {\n var _this = this; // compare destPos and originalIntendedPos\n\n\n var ERROR_LIMIT = 0.000001;\n var finalPos = map(destPos, function (value, key) {\n if (value >= originalIntendedPos[key] - ERROR_LIMIT && value <= originalIntendedPos[key] + ERROR_LIMIT) {\n // In error range, return original intended\n return originalIntendedPos[key];\n } else {\n // Out of error range, return rounded pos.\n var roundUnit = _this.getRoundUnit(value, key);\n\n var result = roundNumber(value, roundUnit);\n return result;\n }\n });\n return finalPos;\n };\n\n __proto.getRoundUnit = function (val, key) {\n var roundUnit = this.options.round; // manual mode\n\n var minRoundUnit = null; // auto mode\n // auto mode\n\n if (!roundUnit) {\n // Get minimum round unit\n var options = this.axm.getAxisOptions(key);\n minRoundUnit = inversePow(Math.max(getDecimalPlace(options.range[0]), getDecimalPlace(options.range[1]), getDecimalPlace(val)));\n }\n\n return minRoundUnit || roundUnit;\n };\n\n __proto.getUserControll = function (param) {\n var userWish = param.setTo();\n userWish.destPos = this.axm.get(userWish.destPos);\n userWish.duration = minMax(userWish.duration, this.options.minimumDuration, this.options.maximumDuration);\n return userWish;\n };\n\n __proto.animateTo = function (destPos, duration, option) {\n var _this = this;\n\n var param = this.createAnimationParam(destPos, duration, option);\n\n var depaPos = __assign({}, param.depaPos);\n\n var retTrigger = this.em.triggerAnimationStart(param); // to control\n\n var userWish = this.getUserControll(param); // You can't stop the 'animationStart' event when 'circular' is true.\n\n if (!retTrigger && this.axm.every(userWish.destPos, function (v, opt) {\n return isCircularable(v, opt.range, opt.circular);\n })) {\n console.warn(\"You can't stop the 'animation' event when 'circular' is true.\");\n }\n\n if (retTrigger && !equal(userWish.destPos, depaPos)) {\n var inputEvent = option && option.event || null;\n this.animateLoop({\n depaPos: depaPos,\n destPos: userWish.destPos,\n duration: userWish.duration,\n delta: this.axm.getDelta(depaPos, userWish.destPos),\n isTrusted: !!inputEvent,\n inputEvent: inputEvent,\n input: option && option.input || null\n }, function () {\n return _this.animationEnd();\n });\n }\n };\n\n __proto.easing = function (p) {\n return p > 1 ? 1 : this.options.easing(p);\n };\n\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n var axes = Object.keys(pos);\n this.grab(axes);\n var orgPos = this.axm.get(axes);\n\n if (equal(pos, orgPos)) {\n return this;\n }\n\n this.itm.setInterrupt(true);\n var movedPos = filter(pos, function (v, k) {\n return orgPos[k] !== v;\n });\n\n if (!Object.keys(movedPos).length) {\n return this;\n }\n\n movedPos = this.axm.map(movedPos, function (v, opt) {\n var range = opt.range,\n circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else {\n return getInsidePosition(v, range, circular);\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.em.triggerChange(movedPos);\n this.finish(false);\n }\n\n return this;\n };\n\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n return this.setTo(map(this.axm.get(Object.keys(pos)), function (v, k) {\n return v + pos[k];\n }), duration);\n };\n\n return AnimationManager;\n}();\n\nvar EventManager =\n/*#__PURE__*/\nfunction () {\n function EventManager(axes) {\n this.axes = axes;\n }\n /**\n * This event is fired when a user holds an element on the screen of the device.\n * @ko 사용자가 기기의 화면에 손을 대고 있을 때 발생하는 이벤트\n * @name eg.Axes#hold\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n var __proto = EventManager.prototype;\n\n __proto.triggerHold = function (pos, option) {\n var roundPos = this.getRoundPos(pos).roundPos;\n this.axes.trigger(\"hold\", {\n pos: roundPos,\n input: option.input || null,\n inputEvent: option.event || null,\n isTrusted: true\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 * @name set\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @example\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 * @name setTo\n * @function\n * @param {Object.} pos The coordinate to move to 이동할 좌표\n * @param {Number} [duration] Duration of the animation (unit: ms) 애니메이션 진행 시간(단위: ms)\n * @example\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 * @name eg.Axes#release\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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} 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 * 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\n __proto.triggerRelease = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n this.axes.trigger(\"release\", param);\n };\n /**\n * This event is fired when coordinate changes.\n * @ko 좌표가 변경됐을 때 발생하는 이벤트\n * @name eg.Axes#change\n * @event\n * @type {object} The object of data to be sent when the event is fired 이벤트가 발생할 때 전달되는 데이터 객체\n * @property {Object.} pos The coordinate 좌표\n * @property {Object.} delta The movement variation of coordinate 좌표의 변화량\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 * 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\n __proto.triggerChange = function (pos, isAccurate, depaPos, option, holding) {\n if (holding === void 0) {\n holding = false;\n }\n\n var am = this.am;\n var axm = am.axm;\n var eventInfo = am.getEventInfo();\n\n var _a = this.getRoundPos(pos, depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n var moveTo = axm.moveTo(roundPos, roundDepa);\n var inputEvent = option && option.event || eventInfo && eventInfo.event || null;\n var param = {\n pos: moveTo.pos,\n delta: moveTo.delta,\n holding: holding,\n inputEvent: inputEvent,\n isTrusted: !!inputEvent,\n input: option && option.input || eventInfo && eventInfo.input || null,\n set: inputEvent ? this.createUserControll(moveTo.pos) : function () {}\n };\n var result = this.axes.trigger(\"change\", param);\n inputEvent && axm.set(param.set()[\"destPos\"]);\n return result;\n };\n /**\n * This event is fired when animation starts.\n * @ko 에니메이션이 시작할 때 발생한다.\n * @name eg.Axes#animationStart\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationStart = function (param) {\n var _a = this.getRoundPos(param.destPos, param.depaPos),\n roundPos = _a.roundPos,\n roundDepa = _a.roundDepa;\n\n param.destPos = roundPos;\n param.depaPos = roundDepa;\n param.setTo = this.createUserControll(param.destPos, param.duration);\n return this.axes.trigger(\"animationStart\", param);\n };\n /**\n * This event is fired when animation ends.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#animationEnd\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerAnimationEnd = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"animationEnd\", {\n isTrusted: isTrusted\n });\n };\n /**\n * This event is fired when all actions have been completed.\n * @ko 에니메이션이 끝났을 때 발생한다.\n * @name eg.Axes#finish\n * @event\n * @type {object} The object of data to be sent when the event is fired이벤트가 발생할 때 전달되는 데이터 객체\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 * 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\n __proto.triggerFinish = function (isTrusted) {\n if (isTrusted === void 0) {\n isTrusted = false;\n }\n\n this.axes.trigger(\"finish\", {\n isTrusted: isTrusted\n });\n };\n\n __proto.createUserControll = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n } // to controll\n\n\n var userControl = {\n destPos: __assign({}, pos),\n duration: duration\n };\n return function (toPos, userDuration) {\n toPos && (userControl.destPos = __assign({}, toPos));\n userDuration !== undefined && (userControl.duration = userDuration);\n return userControl;\n };\n };\n\n __proto.setAnimationManager = function (am) {\n this.am = am;\n };\n\n __proto.destroy = function () {\n this.axes.off();\n };\n\n __proto.getRoundPos = function (pos, depaPos) {\n // round value if round exist\n var roundUnit = this.axes.options.round; // if (round == null) {\n // \treturn {pos, depaPos}; // undefined, undefined\n // }\n\n return {\n roundPos: roundNumbers(pos, roundUnit),\n roundDepa: roundNumbers(depaPos, roundUnit)\n };\n };\n\n return EventManager;\n}();\n\nvar InterruptManager =\n/*#__PURE__*/\nfunction () {\n function InterruptManager(options) {\n this.options = options;\n this._prevented = false; // check whether the animation event was prevented\n }\n\n var __proto = InterruptManager.prototype;\n\n __proto.isInterrupting = function () {\n // when interruptable is 'true', return value is always 'true'.\n return this.options.interruptable || this._prevented;\n };\n\n __proto.isInterrupted = function () {\n return !this.options.interruptable && this._prevented;\n };\n\n __proto.setInterrupt = function (prevented) {\n !this.options.interruptable && (this._prevented = prevented);\n };\n\n return InterruptManager;\n}();\n\nvar AxisManager =\n/*#__PURE__*/\nfunction () {\n function AxisManager(axis, options) {\n var _this = this;\n\n this.axis = axis;\n this.options = options;\n\n this._complementOptions();\n\n this._pos = Object.keys(this.axis).reduce(function (acc, v) {\n acc[v] = _this.axis[v].range[0];\n return acc;\n }, {});\n }\n /**\n * set up 'css' expression\n * @private\n */\n\n\n var __proto = AxisManager.prototype;\n\n __proto._complementOptions = function () {\n var _this = this;\n\n Object.keys(this.axis).forEach(function (axis) {\n _this.axis[axis] = __assign({\n range: [0, 100],\n bounce: [0, 0],\n circular: [false, false]\n }, _this.axis[axis]);\n [\"bounce\", \"circular\"].forEach(function (v) {\n var axisOption = _this.axis;\n var 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 __proto.getDelta = function (depaPos, destPos) {\n var fullDepaPos = this.get(depaPos);\n return map(this.get(destPos), function (v, k) {\n return v - fullDepaPos[k];\n });\n };\n\n __proto.get = function (axes) {\n var _this = this;\n\n if (axes && Array.isArray(axes)) {\n return axes.reduce(function (acc, v) {\n if (v && v in _this._pos) {\n acc[v] = _this._pos[v];\n }\n\n return acc;\n }, {});\n } else {\n return __assign({}, this._pos, axes || {});\n }\n };\n\n __proto.moveTo = function (pos, depaPos) {\n if (depaPos === void 0) {\n depaPos = this._pos;\n }\n\n var delta = map(this._pos, function (v, key) {\n return key in pos && key in depaPos ? pos[key] - depaPos[key] : 0;\n });\n this.set(this.map(pos, function (v, opt) {\n return opt ? getCirculatedPos(v, opt.range, opt.circular) : 0;\n }));\n return {\n pos: __assign({}, this._pos),\n delta: delta\n };\n };\n\n __proto.set = function (pos) {\n for (var k in pos) {\n if (k && k in this._pos) {\n this._pos[k] = pos[k];\n }\n }\n };\n\n __proto.every = function (pos, callback) {\n var axisOptions = this.axis;\n return every(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.filter = function (pos, callback) {\n var axisOptions = this.axis;\n return filter(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.map = function (pos, callback) {\n var axisOptions = this.axis;\n return map(pos, function (value, key) {\n return callback(value, axisOptions[key], key);\n });\n };\n\n __proto.isOutside = function (axes) {\n return !this.every(axes ? this.get(axes) : this._pos, function (v, opt) {\n return !isOutside(v, opt.range);\n });\n };\n\n __proto.getAxisOptions = function (key) {\n return this.axis[key];\n };\n\n return AxisManager;\n}();\n\nvar InputObserver =\n/*#__PURE__*/\nfunction () {\n function InputObserver(_a) {\n var options = _a.options,\n itm = _a.itm,\n em = _a.em,\n axm = _a.axm,\n am = _a.am;\n this.isOutside = false;\n this.moveDistance = null;\n this.isStopped = false;\n this.options = options;\n this.itm = itm;\n this.em = em;\n this.axm = axm;\n this.am = am;\n } // when move pointer is held in outside\n\n\n var __proto = InputObserver.prototype;\n\n __proto.atOutside = function (pos) {\n var _this = this;\n\n if (this.isOutside) {\n return this.axm.map(pos, function (v, opt) {\n var tn = opt.range[0] - opt.bounce[0];\n var tx = opt.range[1] + opt.bounce[1];\n return v > tx ? tx : v < tn ? tn : v;\n });\n } else {\n // when start pointer is held in inside\n // get a initialization slope value to prevent smooth animation.\n var initSlope_1 = this.am.easing(0.00001) / 0.00001;\n return this.axm.map(pos, function (v, opt) {\n var min = opt.range[0];\n var max = opt.range[1];\n var out = opt.bounce;\n var circular = opt.circular;\n\n if (circular && (circular[0] || circular[1])) {\n return v;\n } else if (v < min) {\n // left\n return min - _this.am.easing((min - v) / (out[0] * initSlope_1)) * out[0];\n } else if (v > max) {\n // right\n return max + _this.am.easing((v - max) / (out[1] * initSlope_1)) * out[1];\n }\n\n return v;\n });\n }\n };\n\n __proto.get = function (input) {\n return this.axm.get(input.axes);\n };\n\n __proto.hold = function (input, event) {\n if (this.itm.isInterrupted() || !input.axes.length) {\n return;\n }\n\n var changeOption = {\n input: input,\n event: event\n };\n this.isStopped = false;\n this.itm.setInterrupt(true);\n this.am.grab(input.axes, changeOption);\n !this.moveDistance && this.em.triggerHold(this.axm.get(), changeOption);\n this.isOutside = this.axm.isOutside(input.axes);\n this.moveDistance = this.axm.get(input.axes);\n };\n\n __proto.change = function (input, event, offset) {\n if (this.isStopped || !this.itm.isInterrupting() || this.axm.every(offset, function (v) {\n return v === 0;\n })) {\n return;\n }\n\n var depaPos = this.moveDistance || this.axm.get(input.axes);\n var destPos; // for outside logic\n\n destPos = map(depaPos, function (v, k) {\n return v + (offset[k] || 0);\n });\n this.moveDistance && (this.moveDistance = destPos); // from outside to inside\n\n if (this.isOutside && this.axm.every(depaPos, function (v, opt) {\n return !isOutside(v, opt.range);\n })) {\n this.isOutside = false;\n }\n\n depaPos = this.atOutside(depaPos);\n destPos = this.atOutside(destPos);\n var isCanceled = !this.em.triggerChange(destPos, false, depaPos, {\n input: input,\n event: event\n }, true);\n\n if (isCanceled) {\n this.isStopped = true;\n this.moveDistance = null;\n this.am.finish(false);\n }\n };\n\n __proto.release = function (input, event, offset, inputDuration) {\n if (this.isStopped || !this.itm.isInterrupting() || !this.moveDistance) {\n return;\n }\n\n var pos = this.axm.get(input.axes);\n var depaPos = this.axm.get();\n var destPos = this.axm.get(this.axm.map(offset, function (v, opt, k) {\n if (opt.circular && (opt.circular[0] || opt.circular[1])) {\n return pos[k] + v;\n } else {\n return getInsidePosition(pos[k] + v, opt.range, opt.circular, opt.bounce);\n }\n }));\n var duration = this.am.getDuration(destPos, pos, inputDuration);\n\n if (duration === 0) {\n destPos = __assign({}, depaPos);\n } // prepare params\n\n\n var param = {\n depaPos: depaPos,\n destPos: destPos,\n duration: duration,\n delta: this.axm.getDelta(depaPos, destPos),\n inputEvent: event,\n input: input,\n isTrusted: true\n };\n this.em.triggerRelease(param);\n this.moveDistance = null; // to contol\n\n var userWish = this.am.getUserControll(param);\n var isEqual = equal(userWish.destPos, depaPos);\n var changeOption = {\n input: input,\n event: event\n };\n\n if (isEqual || userWish.duration === 0) {\n !isEqual && this.em.triggerChange(userWish.destPos, false, depaPos, changeOption, true);\n this.itm.setInterrupt(false);\n\n if (this.axm.isOutside()) {\n this.am.restore(changeOption);\n } else {\n this.em.triggerFinish(true);\n }\n } else {\n this.am.animateTo(userWish.destPos, userWish.duration, changeOption);\n }\n };\n\n return InputObserver;\n}();\n\n// export const DIRECTION_NONE = 1;\nvar IOS_EDGE_THRESHOLD = 30;\nvar IS_IOS_SAFARI = \"ontouchstart\" in win && getAgent().browser.name === \"safari\";\nvar TRANSFORM = function () {\n if (typeof document === \"undefined\") {\n return \"\";\n }\n\n var bodyStyle = (document.head || document.getElementsByTagName(\"head\")[0]).style;\n var target = [\"transform\", \"webkitTransform\", \"msTransform\", \"mozTransform\"];\n\n for (var i = 0, len = target.length; i < len; i++) {\n if (target[i] in bodyStyle) {\n return target[i];\n }\n }\n\n return \"\";\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 * @property {Number[]} [range] The coordinate of range 좌표 범위\n * @property {Number} [range.0=0] The coordinate of the minimum 최소 좌표\n * @property {Number} [range.1=0] The coordinate of the maximum 최대 좌표\n * @property {Number[]} [bounce] The size of bouncing area. The coordinates can exceed the coordinate area as much as the bouncing area based on user action. If the coordinates does not exceed the bouncing area when an element is dragged, the coordinates where bouncing effects are applied are retuned back into the coordinate area바운스 영역의 크기. 사용자의 동작에 따라 좌표가 좌표 영역을 넘어 바운스 영역의 크기만큼 더 이동할 수 있다. 사용자가 끌어다 놓는 동작을 했을 때 좌표가 바운스 영역에 있으면, 바운스 효과가 적용된 좌표가 다시 좌표 영역 안으로 들어온다\n * @property {Number} [bounce.0=0] The size of coordinate of the minimum area 최소 좌표 바운스 영역의 크기\n * @property {Number} [bounce.1=0] The size of coordinate of the maximum area 최대 좌표 바운스 영역의 크기\n * @property {Boolean[]} [circular] Indicates whether a circular element is available. If it is set to \"true\" and an element is dragged outside the coordinate area, the element will appear on the other side.순환 여부. 'true'로 설정한 방향의 좌표 영역 밖으로 엘리먼트가 이동하면 반대 방향에서 엘리먼트가 나타난다\n * @property {Boolean} [circular.0=false] Indicates whether to circulate to the coordinate of the minimum 최소 좌표 방향의 순환 여부\n * @property {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 * @property {Function} [easing=easing.easeOutCubic] The easing function to apply to an animation 애니메이션에 적용할 easing 함수\n * @property {Number} [maximumDuration=Infinity] Maximum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최대 좌표 이동 시간\n * @property {Number} [minimumDuration=0] Minimum duration of the animation 가속도에 의해 애니메이션이 동작할 때의 최소 좌표 이동 시간\n * @property {Number} [deceleration=0.0006] Deceleration of the animation where acceleration is manually enabled by user. A higher value indicates shorter running time. 사용자의 동작으로 가속도가 적용된 애니메이션의 감속도. 값이 높을수록 애니메이션 실행 시간이 짧아진다\n * @property {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가 적용되지 않는다
\n * @property {Number} [round = null] Rounding unit. For example, 0.1 rounds to 0.1 decimal point(6.1234 => 6.1), 5 rounds to 5 (93 => 95)
[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)
\n**/\n\n/**\n * @class eg.Axes\n * @classdesc A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.\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] 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 *\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\nvar Axes =\n/*#__PURE__*/\nfunction (_super) {\n __extends(Axes, _super);\n\n function Axes(axis, options, startPos) {\n if (axis === void 0) {\n axis = {};\n }\n\n if (options === void 0) {\n options = {};\n }\n\n var _this = _super.call(this) || this;\n\n _this.axis = axis;\n _this._inputs = [];\n _this.options = __assign({\n easing: function easeOutCubic(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 }, options);\n _this.itm = new InterruptManager(_this.options);\n _this.axm = new AxisManager(_this.axis, _this.options);\n _this.em = new EventManager(_this);\n _this.am = new AnimationManager(_this);\n _this.io = new InputObserver(_this);\n\n _this.em.setAnimationManager(_this.am);\n\n startPos && _this.em.triggerChange(startPos);\n return _this;\n }\n /**\n * Connect the axis of eg.Axes to the inputType.\n * @ko eg.Axes의 축과 inputType을 연결한다\n * @method eg.Axes#connect\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 * 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\n var __proto = Axes.prototype;\n\n __proto.connect = function (axes, inputType) {\n var mapped;\n\n if (typeof axes === \"string\") {\n mapped = axes.split(\" \");\n } else {\n mapped = axes.concat();\n } // check same instance\n\n\n if (~this._inputs.indexOf(inputType)) {\n this.disconnect(inputType);\n } // check same element in hammer type for share\n\n\n if (\"hammer\" in inputType) {\n var targets = this._inputs.filter(function (v) {\n return v.hammer && v.element === inputType.element;\n });\n\n if (targets.length) {\n inputType.hammer = targets[0].hammer;\n }\n }\n\n inputType.mapAxes(mapped);\n inputType.connect(this.io);\n\n this._inputs.push(inputType);\n\n return this;\n };\n /**\n * Disconnect the axis of eg.Axes from the inputType.\n * @ko eg.Axes의 축과 inputType의 연결을 끊는다.\n * @method eg.Axes#disconnect\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 * 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\n __proto.disconnect = function (inputType) {\n if (inputType) {\n var index = this._inputs.indexOf(inputType);\n\n if (index >= 0) {\n this._inputs[index].disconnect();\n\n this._inputs.splice(index, 1);\n }\n } else {\n this._inputs.forEach(function (v) {\n return v.disconnect();\n });\n\n this._inputs = [];\n }\n\n return this;\n };\n /**\n * Returns the current position of the coordinates.\n * @ko 좌표의 현재 위치를 반환한다\n * @method eg.Axes#get\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Object.} Axis coordinate information 축 좌표 정보\n * @example\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\n __proto.get = function (axes) {\n return this.axm.get(axes);\n };\n /**\n * Moves an axis to specific coordinates.\n * @ko 좌표를 이동한다.\n * @method eg.Axes#setTo\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 * 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\n __proto.setTo = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setTo(pos, duration);\n return this;\n };\n /**\n * Moves an axis from the current coordinates to specific coordinates.\n * @ko 현재 좌표를 기준으로 좌표를 이동한다.\n * @method eg.Axes#setBy\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 * 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\n __proto.setBy = function (pos, duration) {\n if (duration === void 0) {\n duration = 0;\n }\n\n this.am.setBy(pos, duration);\n return this;\n };\n /**\n * Returns whether there is a coordinate in the bounce area of ​​the target axis.\n * @ko 대상 축 중 bounce영역에 좌표가 존재하는지를 반환한다\n * @method eg.Axes#isBounceArea\n * @param {Object} [axes] The names of the axis 축 이름들\n * @return {Boolen} Whether the bounce area exists. bounce 영역 존재 여부\n * @example\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\n __proto.isBounceArea = function (axes) {\n return this.axm.isOutside(axes);\n };\n /**\n * Destroys properties, and events used in a module and disconnect all connections to inputTypes.\n * @ko 모듈에 사용한 속성, 이벤트를 해제한다. 모든 inputType과의 연결을 끊는다.\n * @method eg.Axes#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.em.destroy();\n };\n /**\n * Version info string\n * @ko 버전정보 문자열\n * @name VERSION\n * @static\n * @type {String}\n * @example\n * eg.Axes.VERSION; // ex) 3.3.3\n * @memberof eg.Axes\n */\n\n\n Axes.VERSION = \"2.7.1\";\n /**\n * @name eg.Axes.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 * eg.Axes.TRANSFORM; // \"transform\" or \"webkitTransform\"\n */\n\n Axes.TRANSFORM = TRANSFORM;\n /**\n * @name eg.Axes.DIRECTION_NONE\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_NONE = DIRECTION_NONE;\n /**\n * @name eg.Axes.DIRECTION_LEFT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_LEFT = DIRECTION_LEFT;\n /**\n * @name eg.Axes.DIRECTION_RIGHT\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_RIGHT = DIRECTION_RIGHT;\n /**\n * @name eg.Axes.DIRECTION_UP\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_UP = DIRECTION_UP;\n /**\n * @name eg.Axes.DIRECTION_DOWN\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_DOWN = DIRECTION_DOWN;\n /**\n * @name eg.Axes.DIRECTION_HORIZONTAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_HORIZONTAL = DIRECTION_HORIZONTAL;\n /**\n * @name eg.Axes.DIRECTION_VERTICAL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_VERTICAL = DIRECTION_VERTICAL;\n /**\n * @name eg.Axes.DIRECTION_ALL\n * @constant\n * @type {Number}\n */\n\n Axes.DIRECTION_ALL = DIRECTION_ALL;\n return Axes;\n}(Component);\n\nvar SUPPORT_POINTER_EVENTS = \"PointerEvent\" in win || \"MSPointerEvent\" in win;\nvar SUPPORT_TOUCH = (\"ontouchstart\" in win);\nvar UNIQUEKEY = \"_EGJS_AXES_INPUTTYPE_\";\nfunction toAxis(source, offset) {\n return offset.reduce(function (acc, v, i) {\n if (source[i]) {\n acc[source[i]] = v;\n }\n\n return acc;\n }, {});\n}\nfunction createHammer(element, options) {\n try {\n // create Hammer\n return new Manager(element, __assign({}, options));\n } catch (e) {\n return null;\n }\n}\nfunction convertInputType(inputType) {\n if (inputType === void 0) {\n inputType = [];\n }\n\n var hasTouch = false;\n var hasMouse = false;\n var hasPointer = false;\n inputType.forEach(function (v) {\n switch (v) {\n case \"mouse\":\n hasMouse = true;\n break;\n\n case \"touch\":\n hasTouch = SUPPORT_TOUCH;\n break;\n\n case \"pointer\":\n hasPointer = SUPPORT_POINTER_EVENTS;\n // no default\n }\n });\n\n if (hasPointer) {\n return PointerEventInput;\n } else if (hasTouch && hasMouse) {\n return TouchMouseInput;\n } else if (hasTouch) {\n return TouchInput;\n } else if (hasMouse) {\n return MouseInput;\n }\n\n return null;\n}\n\nfunction getDirectionByAngle(angle, thresholdAngle) {\n if (thresholdAngle < 0 || thresholdAngle > 90) {\n return DIRECTION_NONE;\n }\n\n var toAngle = Math.abs(angle);\n return toAngle > thresholdAngle && toAngle < 180 - thresholdAngle ? DIRECTION_VERTICAL : DIRECTION_HORIZONTAL;\n}\nfunction getNextOffset(speeds, deceleration) {\n var normalSpeed = Math.sqrt(speeds[0] * speeds[0] + speeds[1] * speeds[1]);\n var duration = Math.abs(normalSpeed / -deceleration);\n return [speeds[0] / 2 * duration, speeds[1] / 2 * duration];\n}\nfunction useDirection(checkType, direction, userDirection) {\n if (userDirection) {\n return !!(direction === DIRECTION_ALL || direction & checkType && userDirection & checkType);\n } else {\n return !!(direction & checkType);\n }\n}\n/**\n * @typedef {Object} PanInputOption The option object of the eg.Axes.PanInput module.\n * @ko eg.Axes.PanInput 모듈의 옵션 객체\n * @property {String[]} [inputType=[\"touch\",\"mouse\", \"pointer\"]] Types of input devices.
- touch: Touch screen
- mouse: Mouse 입력 장치 종류.
- touch: 터치 입력 장치
- mouse: 마우스
\n * @property {Number[]} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale.0=1] horizontal axis scale 수평축 배율\n * @property {Number} [scale.1=1] vertical axis scale 수직축 배율\n * @property {Number} [thresholdAngle=45] The threshold value that determines whether user action is horizontal or vertical (0~90) 사용자의 동작이 가로 방향인지 세로 방향인지 판단하는 기준 각도(0~90)\n * @property {Number} [threshold=0] Minimal pan distance required before recognizing 사용자의 Pan 동작을 인식하기 위해산 최소한의 거리\n * @property {Number} [iOSEdgeSwipeThreshold=30] Area (px) that can go to the next page when swiping the right edge in iOS safari iOS Safari에서 오른쪽 엣지를 스와이프 하는 경우 다음 페이지로 넘어갈 수 있는 영역(px)\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PanInput\n * @classdesc A module that passes the amount of change to eg.Axes when the mouse or touchscreen is down and moved. use less than two axes.\n * @ko 마우스나 터치 스크린을 누르고 움직일때의 변화량을 eg.Axes에 전달하는 모듈. 두개 이하의 축을 사용한다.\n *\n * @example\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 */\n\nvar PanInput =\n/*#__PURE__*/\nfunction () {\n function PanInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this.panRecognizer = null;\n this.isRightEdge = false;\n this.rightEdgeTimer = 0;\n this.panFlag = false;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PanInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n inputType: [\"touch\", \"mouse\", \"pointer\"],\n scale: [1, 1],\n thresholdAngle: 45,\n threshold: 0,\n iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD,\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onHammerInput = this.onHammerInput.bind(this);\n this.onPanmove = this.onPanmove.bind(this);\n this.onPanend = this.onPanend.bind(this);\n }\n\n var __proto = PanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n var useHorizontal = !!axes[0];\n var useVertical = !!axes[1];\n\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\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n direction: this._direction,\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PanRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.panRecognizer = new Pan(hammerOption);\n this.hammer.add(this.panRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.dettachEvent();\n }\n\n this._direction = DIRECTION_NONE;\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PanInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PanInput#enable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PanInput#disable\n * @return {eg.Axes.PanInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pan\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PanInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pan\").options.enable);\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.panRecognizer) {\n this.hammer.remove(this.panRecognizer);\n this.panRecognizer = null;\n }\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.panFlag = false;\n\n if (event.srcEvent.cancelable !== false) {\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n this.observer.hold(this, event);\n this.isRightEdge = IS_IOS_SAFARI && event.center.x > window.innerWidth - edgeThreshold;\n this.panFlag = true;\n }\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanmove = function (event) {\n var _this = this;\n\n if (!this.panFlag) {\n return;\n }\n\n var userDirection = getDirectionByAngle(event.angle, this.options.thresholdAngle); // not support offset properties in Hammerjs - start\n\n var prevInput = this.hammer.session.prevInput;\n\n if (prevInput && IS_IOS_SAFARI) {\n var swipeLeftToRight = event.center.x < 0;\n\n if (swipeLeftToRight) {\n // iOS swipe left => right\n this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n return;\n } else if (this.isRightEdge) {\n clearTimeout(this.rightEdgeTimer); // - is right to left\n\n var edgeThreshold = this.options.iOSEdgeSwipeThreshold;\n var swipeRightToLeft = event.deltaX < -edgeThreshold;\n\n if (swipeRightToLeft) {\n this.isRightEdge = false;\n } else {\n // iOS swipe right => left\n this.rightEdgeTimer = window.setTimeout(function () {\n _this.onPanend(__assign({}, prevInput, {\n velocityX: 0,\n velocityY: 0,\n offsetX: 0,\n offsetY: 0\n }));\n }, 100);\n }\n }\n }\n /* eslint-disable no-param-reassign */\n\n\n if (prevInput) {\n event.offsetX = event.deltaX - prevInput.deltaX;\n event.offsetY = event.deltaY - prevInput.deltaY;\n } else {\n event.offsetX = 0;\n event.offsetY = 0;\n }\n\n var offset = this.getOffset([event.offsetX, event.offsetY], [useDirection(DIRECTION_HORIZONTAL, this._direction, userDirection), useDirection(DIRECTION_VERTICAL, this._direction, userDirection)]);\n var prevent = offset.some(function (v) {\n return v !== 0;\n });\n\n if (prevent) {\n var srcEvent = event.srcEvent;\n\n if (srcEvent.cancelable !== false) {\n srcEvent.preventDefault();\n }\n\n srcEvent.stopPropagation();\n }\n\n event.preventSystemEvent = prevent;\n prevent && this.observer.change(this, event, toAxis(this.axes, offset));\n };\n\n __proto.onPanend = function (event) {\n if (!this.panFlag) {\n return;\n }\n\n clearTimeout(this.rightEdgeTimer);\n this.panFlag = false;\n var offset = this.getOffset([Math.abs(event.velocityX) * (event.deltaX < 0 ? -1 : 1), Math.abs(event.velocityY) * (event.deltaY < 0 ? -1 : 1)], [useDirection(DIRECTION_HORIZONTAL, this._direction), useDirection(DIRECTION_VERTICAL, this._direction)]);\n offset = getNextOffset(offset, this.observer.options.deceleration);\n this.observer.release(this, event, toAxis(this.axes, offset));\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"hammer.input\", this.onHammerInput).on(\"panstart panmove\", this.onPanmove);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"hammer.input\", this.onHammerInput).off(\"panstart panmove\", this.onPanmove);\n this.observer = null;\n };\n\n __proto.getOffset = function (properties, direction) {\n var offset = [0, 0];\n var scale = this.options.scale;\n\n if (direction[0]) {\n offset[0] = properties[0] * scale[0];\n }\n\n if (direction[1]) {\n offset[1] = properties[1] * scale[1];\n }\n\n return offset;\n };\n\n return PanInput;\n}();\n\n/**\n * @class eg.Axes.RotatePanInput\n * @classdesc 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)\n * @ko 터치에 의해 움직인 각도를 Axes 에 전달하며 1개의 회전축만 사용한다.
[상세내용](https://github.com/naver/egjs-axes/wiki/RotatePanInput-%7C-%ED%95%9C%EA%B5%AD%EC%96%B4)\n *\n * @example\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 eg.Axes.PanInput\n */\n\nvar RotatePanInput =\n/*#__PURE__*/\nfunction (_super) {\n __extends(RotatePanInput, _super);\n\n function RotatePanInput(el, options) {\n var _this = _super.call(this, el, options) || this;\n\n _this.prevQuadrant = null;\n _this.lastDiff = 0;\n return _this;\n }\n\n var __proto = RotatePanInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this._direction = Axes.DIRECTION_ALL;\n this.axes = axes;\n };\n\n __proto.onHammerInput = function (event) {\n if (this.isEnable()) {\n if (event.isFirst) {\n this.observer.hold(this, event);\n this.onPanstart(event);\n } else if (event.isFinal) {\n this.onPanend(event);\n }\n }\n };\n\n __proto.onPanstart = function (event) {\n var rect = this.element.getBoundingClientRect();\n /**\n * Responsive\n */\n // TODO: how to do if element is ellipse not circle.\n\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\n this.rotateOrigin = [rect.left + (rect.width - 1) / 2, rect.top + (rect.height - 1) / 2]; // init angle.\n\n this.prevAngle = null;\n this.triggerChange(event);\n };\n\n __proto.onPanmove = function (event) {\n this.triggerChange(event);\n };\n\n __proto.onPanend = function (event) {\n this.triggerChange(event);\n this.triggerAnimation(event);\n };\n\n __proto.triggerChange = function (event) {\n var angle = this.getAngle(event.center.x, event.center.y);\n var quadrant = this.getQuadrant(event.center.x, event.center.y);\n var diff = this.getDifference(this.prevAngle, angle, this.prevQuadrant, quadrant);\n this.prevAngle = angle;\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 __proto.triggerAnimation = function (event) {\n var vx = event.velocityX;\n var vy = event.velocityY;\n var velocity = Math.sqrt(vx * vx + vy * vy) * (this.lastDiff > 0 ? -1 : 1); // clockwise\n\n var duration = Math.abs(velocity / -this.observer.options.deceleration);\n var distance = velocity / 2 * duration;\n this.observer.release(this, event, toAxis(this.axes, [distance * this.coefficientForDistanceToAngle]));\n };\n\n __proto.getDifference = function (prevAngle, angle, prevQuadrant, quadrant) {\n var diff;\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 __proto.getPosFromOrigin = function (posX, posY) {\n return {\n x: posX - this.rotateOrigin[0],\n y: this.rotateOrigin[1] - posY\n };\n };\n\n __proto.getAngle = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var angle = Math.atan2(y, x) * 180 / Math.PI; // console.log(angle, x, y);\n\n return angle < 0 ? 360 + angle : angle;\n };\n /**\n * Quadrant\n * y(+)\n * |\n * 2 | 1\n * --------------->x(+)\n * 3 | 4\n * |\n */\n\n\n __proto.getQuadrant = function (posX, posY) {\n var _a = this.getPosFromOrigin(posX, posY),\n x = _a.x,\n y = _a.y;\n\n var 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\n return q;\n };\n\n return RotatePanInput;\n}(PanInput);\n\n/**\n * @typedef {Object} PinchInputOption The option object of the eg.Axes.PinchInput module\n * @ko eg.Axes.PinchInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [threshold=0] Minimal scale before recognizing 사용자의 Pinch 동작을 인식하기 위해산 최소한의 배율\n * @property {Object} [hammerManagerOptions={cssProps: {userSelect: \"none\",touchSelect: \"none\",touchCallout: \"none\",userDrag: \"none\"}] Options of Hammer.Manager Hammer.Manager의 옵션\n**/\n\n/**\n * @class eg.Axes.PinchInput\n * @classdesc A module that passes the amount of change to eg.Axes when two pointers are moving toward (zoom-in) or away from each other (zoom-out). use one axis.\n * @ko 2개의 pointer를 이용하여 zoom-in하거나 zoom-out 하는 동작의 변화량을 eg.Axes에 전달하는 모듈. 한 개 의 축을 사용한다.\n * @example\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 */\n\nvar PinchInput =\n/*#__PURE__*/\nfunction () {\n function PinchInput(el, options) {\n this.axes = [];\n this.hammer = null;\n this.element = null;\n this._base = null;\n this._prev = null;\n this.pinchRecognizer = null;\n /**\n * Hammer helps you add support for touch gestures to your page\n *\n * @external Hammer\n * @see {@link http://hammerjs.github.io|Hammer.JS}\n * @see {@link http://hammerjs.github.io/jsdoc/Hammer.html|Hammer.JS API documents}\n * @see Hammer.JS applies specific CSS properties by {@link http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html|default} when creating an instance. The eg.Axes module removes all default CSS properties provided by Hammer.JS\n */\n\n if (typeof Manager === \"undefined\") {\n throw new Error(\"The Hammerjs must be loaded before eg.Axes.PinchInput.\\nhttp://hammerjs.github.io/\");\n }\n\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n threshold: 0,\n inputType: [\"touch\", \"pointer\"],\n hammerManagerOptions: {\n // css properties were removed due to usablility issue\n // http://hammerjs.github.io/jsdoc/Hammer.defaults.cssProps.html\n cssProps: {\n userSelect: \"none\",\n touchSelect: \"none\",\n touchCallout: \"none\",\n userDrag: \"none\"\n }\n }\n }, options);\n this.onPinchStart = this.onPinchStart.bind(this);\n this.onPinchMove = this.onPinchMove.bind(this);\n this.onPinchEnd = this.onPinchEnd.bind(this);\n }\n\n var __proto = PinchInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n var hammerOption = {\n threshold: this.options.threshold\n };\n\n if (this.hammer) {\n // for sharing hammer instance.\n // hammer remove previous PinchRecognizer.\n this.removeRecognizer();\n this.dettachEvent();\n } else {\n var keyValue = this.element[UNIQUEKEY];\n\n if (!keyValue) {\n keyValue = String(Math.round(Math.random() * new Date().getTime()));\n }\n\n var inputClass = convertInputType(this.options.inputType);\n\n if (!inputClass) {\n throw new Error(\"Wrong inputType parameter!\");\n }\n\n this.hammer = createHammer(this.element, __assign({\n inputClass: inputClass\n }, this.options.hammerManagerOptions));\n this.element[UNIQUEKEY] = keyValue;\n }\n\n this.pinchRecognizer = new Pinch(hammerOption);\n this.hammer.add(this.pinchRecognizer);\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.removeRecognizer();\n\n if (this.hammer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n this.dettachEvent();\n }\n\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.PinchInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n\n if (this.hammer && this.hammer.recognizers.length === 0) {\n this.hammer.destroy();\n }\n\n delete this.element[UNIQUEKEY];\n this.element = null;\n this.hammer = null;\n };\n\n __proto.removeRecognizer = function () {\n if (this.hammer && this.pinchRecognizer) {\n this.hammer.remove(this.pinchRecognizer);\n this.pinchRecognizer = null;\n }\n };\n\n __proto.onPinchStart = function (event) {\n this._base = this.observer.get(this)[this.axes[0]];\n var offset = this.getOffset(event.scale);\n this.observer.hold(this, event);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchMove = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this._prev = event.scale;\n };\n\n __proto.onPinchEnd = function (event) {\n var offset = this.getOffset(event.scale, this._prev);\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n this.observer.release(this, event, toAxis(this.axes, [0]), 0);\n this._base = null;\n this._prev = null;\n };\n\n __proto.getOffset = function (pinchScale, prev) {\n if (prev === void 0) {\n prev = 1;\n }\n\n return this._base * (pinchScale - prev) * this.options.scale;\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.hammer.on(\"pinchstart\", this.onPinchStart).on(\"pinchmove\", this.onPinchMove).on(\"pinchend\", this.onPinchEnd);\n };\n\n __proto.dettachEvent = function () {\n this.hammer.off(\"pinchstart\", this.onPinchStart).off(\"pinchmove\", this.onPinchMove).off(\"pinchend\", this.onPinchEnd);\n this.observer = null;\n this._prev = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.PinchInput#enable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = true);\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.PinchInput#disable\n * @return {eg.Axes.PinchInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this.hammer && (this.hammer.get(\"pinch\").options.enable = false);\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.PinchInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return !!(this.hammer && this.hammer.get(\"pinch\").options.enable);\n };\n\n return PinchInput;\n}();\n\n/**\n * @typedef {Object} WheelInputOption The option object of the eg.Axes.WheelInput module\n * @ko eg.Axes.WheelInput 모듈의 옵션 객체\n * @property {Number} [scale=1] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n**/\n\n/**\n * @class eg.Axes.WheelInput\n * @classdesc 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 * 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 */\n\nvar WheelInput =\n/*#__PURE__*/\nfunction () {\n function WheelInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: 1,\n useNormalized: true\n }, options);\n this.onWheel = this.onWheel.bind(this);\n }\n\n var __proto = WheelInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent();\n this.attachEvent(observer);\n return this;\n };\n\n __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.WheelInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onWheel = function (event) {\n var _this = this;\n\n if (!this._isEnabled) {\n return;\n }\n\n event.preventDefault();\n\n if (event.deltaY === 0) {\n return;\n }\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n var offset = (event.deltaY > 0 ? -1 : 1) * this.options.scale * (this.options.useNormalized ? 1 : Math.abs(event.deltaY));\n this.observer.change(this, event, toAxis(this.axes, [offset]));\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n if (_this._isHolded) {\n _this._isHolded = false;\n\n _this.observer.release(_this, event, toAxis(_this.axes, [0]));\n }\n }, 50);\n };\n\n __proto.attachEvent = function (observer) {\n this.observer = observer;\n this.element.addEventListener(\"wheel\", this.onWheel);\n this._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\n this.element.removeEventListener(\"wheel\", this.onWheel);\n this._isEnabled = false;\n this.observer = null;\n\n if (this._timer) {\n clearTimeout(this._timer);\n this._timer = null;\n }\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.WheelInput#enable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.WheelInput#disable\n * @return {eg.Axes.WheelInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.WheelInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return WheelInput;\n}();\n\nvar KEY_LEFT_ARROW = 37;\nvar KEY_A = 65;\nvar KEY_UP_ARROW = 38;\nvar KEY_W = 87;\nvar KEY_RIGHT_ARROW = 39;\nvar KEY_D = 68;\nvar KEY_DOWN_ARROW = 40;\nvar KEY_S = 83;\nvar DIRECTION_REVERSE = -1;\nvar DIRECTION_FORWARD = 1;\nvar DIRECTION_HORIZONTAL$1 = -1;\nvar DIRECTION_VERTICAL$1 = 1;\nvar DELAY = 80;\n/**\n * @typedef {Object} MoveKeyInputOption The option object of the eg.Axes.MoveKeyInput module\n * @ko eg.Axes.MoveKeyInput 모듈의 옵션 객체\n * @property {Array} [scale] Coordinate scale that a user can move사용자의 동작으로 이동하는 좌표의 배율\n * @property {Number} [scale[0]=1] Coordinate scale for the first axis첫번째 축의 배율\n * @property {Number} [scale[1]=1] Coordinate scale for the decond axis두번째 축의 배율\n**/\n\n/**\n * @class eg.Axes.MoveKeyInput\n * @classdesc 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 * 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 */\n\nvar MoveKeyInput =\n/*#__PURE__*/\nfunction () {\n function MoveKeyInput(el, options) {\n this.axes = [];\n this.element = null;\n this._isEnabled = false;\n this._isHolded = false;\n this._timer = null;\n this.element = $(el);\n this.options = __assign({\n scale: [1, 1]\n }, options);\n this.onKeydown = this.onKeydown.bind(this);\n this.onKeyup = this.onKeyup.bind(this);\n }\n\n var __proto = MoveKeyInput.prototype;\n\n __proto.mapAxes = function (axes) {\n this.axes = axes;\n };\n\n __proto.connect = function (observer) {\n this.dettachEvent(); // add tabindex=\"0\" to the container for making it focusable\n\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 __proto.disconnect = function () {\n this.dettachEvent();\n return this;\n };\n /**\n * Destroys elements, properties, and events used in a module.\n * @ko 모듈에 사용한 엘리먼트와 속성, 이벤트를 해제한다.\n * @method eg.Axes.MoveKeyInput#destroy\n */\n\n\n __proto.destroy = function () {\n this.disconnect();\n this.element = null;\n };\n\n __proto.onKeydown = function (e) {\n if (!this._isEnabled) {\n return;\n }\n\n var isMoveKey = true;\n var direction = DIRECTION_FORWARD;\n var move = DIRECTION_HORIZONTAL$1;\n\n switch (e.keyCode) {\n case KEY_LEFT_ARROW:\n case KEY_A:\n direction = DIRECTION_REVERSE;\n break;\n\n case KEY_RIGHT_ARROW:\n case KEY_D:\n break;\n\n case KEY_DOWN_ARROW:\n case KEY_S:\n direction = DIRECTION_REVERSE;\n move = DIRECTION_VERTICAL$1;\n break;\n\n case KEY_UP_ARROW:\n case KEY_W:\n move = DIRECTION_VERTICAL$1;\n break;\n\n default:\n isMoveKey = false;\n }\n\n if (move === DIRECTION_HORIZONTAL$1 && !this.axes[0] || move === DIRECTION_VERTICAL$1 && !this.axes[1]) {\n isMoveKey = false;\n }\n\n if (!isMoveKey) {\n return;\n }\n\n var offsets = move === DIRECTION_HORIZONTAL$1 ? [+this.options.scale[0] * direction, 0] : [0, +this.options.scale[1] * direction];\n\n if (!this._isHolded) {\n this.observer.hold(this, event);\n this._isHolded = true;\n }\n\n clearTimeout(this._timer);\n this.observer.change(this, event, toAxis(this.axes, offsets));\n };\n\n __proto.onKeyup = function (e) {\n var _this = this;\n\n if (!this._isHolded) {\n return;\n }\n\n clearTimeout(this._timer);\n this._timer = setTimeout(function () {\n _this.observer.release(_this, e, toAxis(_this.axes, [0, 0]));\n\n _this._isHolded = false;\n }, DELAY);\n };\n\n __proto.attachEvent = function (observer) {\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._isEnabled = true;\n };\n\n __proto.dettachEvent = function () {\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._isEnabled = false;\n this.observer = null;\n };\n /**\n * Enables input devices\n * @ko 입력 장치를 사용할 수 있게 한다\n * @method eg.Axes.MoveKeyInput#enable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.enable = function () {\n this._isEnabled = true;\n return this;\n };\n /**\n * Disables input devices\n * @ko 입력 장치를 사용할 수 없게 한다.\n * @method eg.Axes.MoveKeyInput#disable\n * @return {eg.Axes.MoveKeyInput} An instance of a module itself 모듈 자신의 인스턴스\n */\n\n\n __proto.disable = function () {\n this._isEnabled = false;\n return this;\n };\n /**\n * Returns whether to use an input device\n * @ko 입력 장치를 사용 여부를 반환한다.\n * @method eg.Axes.MoveKeyInput#isEnable\n * @return {Boolean} Whether to use an input device 입력장치 사용여부\n */\n\n\n __proto.isEnable = function () {\n return this._isEnabled;\n };\n\n return MoveKeyInput;\n}();\n\nexport default Axes;\nexport { PanInput, RotatePanInput, PinchInput, WheelInput, MoveKeyInput };\n//# sourceMappingURL=axes.esm.js.map\n","/**\n * Original Code\n * https://github.com/toji/gl-matrix/blob/v2.3.2/src/gl-matrix.js\n * Math Util\n * modified by egjs\n */\n/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.3.2\n */\n\n/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. */\n\n// Some minimal math functionality borrowed from gl-Matrix and stripped down\n// for the purposes of this library.\n\nimport {vec2, vec3, quat} from \"gl-matrix\";\n\nfunction quatToVec3(quaternion) {\n\tconst baseV = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(baseV, baseV, quaternion);\n\treturn baseV;\n}\n\nfunction toDegree(a){\n\treturn a * 180 / Math.PI;\n}\n\nconst util = {};\n\nutil.isPowerOfTwo = function(n) {\n\treturn n && (n & (n - 1)) === 0;\n};\n\nutil.extractPitchFromQuat = function(quaternion) {\n\tconst baseV = quatToVec3(quaternion);\n\n\treturn -1 * Math.atan2(\n\t\tbaseV[1],\n\t\tMath.sqrt(Math.pow(baseV[0], 2) + Math.pow(baseV[2], 2)));\n};\n\nutil.hypot = Math.hypot || function(x, y) {\n\treturn Math.sqrt(x * x + y * y);\n};\n\n// implement reference\n// the general equation of a plane : http://www.gisdeveloper.co.kr/entry/평면의-공식\n// calculating angle between two vectors : http://darkpgmr.tistory.com/121\nconst ROTATE_CONSTANT = {\n\tPITCH_DELTA: 1,\n\tYAW_DELTA_BY_ROLL: 2,\n\tYAW_DELTA_BY_YAW: 3,\n};\n\nROTATE_CONSTANT[ROTATE_CONSTANT.PITCH_DELTA] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [0, 0, 1],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_ROLL] = {\n\ttargetAxis: [0, 1, 0],\n\tmeshPoint: [1, 0, 0],\n};\nROTATE_CONSTANT[ROTATE_CONSTANT.YAW_DELTA_BY_YAW] = {\n\ttargetAxis: [1, 0, 0],\n\tmeshPoint: [0, 0, 1],\n};\n\nfunction getRotationDelta(prevQ, curQ, rotateKind) {\n\tconst targetAxis = vec3.fromValues(\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[0],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[1],\n\t\tROTATE_CONSTANT[rotateKind].targetAxis[2]\n\t);\n\tconst meshPoint = ROTATE_CONSTANT[rotateKind].meshPoint;\n\n\tconst prevQuaternion = quat.clone(prevQ);\n\tconst curQuaternion = quat.clone(curQ);\n\n\tquat.normalize(prevQuaternion, prevQuaternion);\n\tquat.normalize(curQuaternion, curQuaternion);\n\n\tlet prevPoint = vec3.fromValues(0, 0, 1);\n\tlet curPoint = vec3.fromValues(0, 0, 1);\n\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\tvec3.transformQuat(targetAxis, targetAxis, curQuaternion);\n\n\tconst rotateDistance = vec3.dot(targetAxis, vec3.cross(vec3.create(), prevPoint, curPoint));\n\tconst rotateDirection = rotateDistance > 0 ? 1 : -1;\n\n\t// when counter clock wise, use vec3.fromValues(0,1,0)\n\t// when clock wise, use vec3.fromValues(0,-1,0)\n\t// const meshPoint1 = vec3.fromValues(0, 0, 0);\n\tconst meshPoint2 = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\n\tlet meshPoint3;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tmeshPoint3 = vec3.fromValues(0, rotateDirection, 0);\n\t} else {\n\t\tmeshPoint3 = vec3.fromValues(rotateDirection, 0, 0);\n\t}\n\n\tvec3.transformQuat(meshPoint2, meshPoint2, curQuaternion);\n\tvec3.transformQuat(meshPoint3, meshPoint3, curQuaternion);\n\n\tconst vecU = meshPoint2;\n\tconst vecV = meshPoint3;\n\tconst vecN = vec3.create();\n\n\tvec3.cross(vecN, vecU, vecV);\n\tvec3.normalize(vecN, vecN);\n\n\tconst coefficientA = vecN[0];\n\tconst coefficientB = vecN[1];\n\tconst coefficientC = vecN[2];\n//\tconst coefficientD = -1 * vec3.dot(vecN, meshPoint1);\n\n\t// a point on the plane\n\tcurPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(curPoint, curPoint, curQuaternion);\n\n\t// a point should project on the plane\n\tprevPoint = vec3.fromValues(meshPoint[0], meshPoint[1], meshPoint[2]);\n\tvec3.transformQuat(prevPoint, prevPoint, prevQuaternion);\n\n\t// distance between prevPoint and the plane\n\tlet distance = Math.abs(\n\t\tprevPoint[0] * coefficientA +\n\t\tprevPoint[1] * coefficientB +\n\t\tprevPoint[2] * coefficientC\n\t);\n\n\tconst projectedPrevPoint = vec3.create();\n\n\tvec3.subtract(projectedPrevPoint, prevPoint, vec3.scale(vec3.create(), vecN, distance));\n\n\tlet trigonometricRatio =\n\t\t(projectedPrevPoint[0] * curPoint[0] +\n\t\tprojectedPrevPoint[1] * curPoint[1] +\n\t\tprojectedPrevPoint[2] * curPoint[2]) /\n\t\t(vec3.length(projectedPrevPoint) * vec3.length(curPoint));\n\n\t// defensive block\n\ttrigonometricRatio > 1 && (trigonometricRatio = 1);\n\n\tconst theta = Math.acos(trigonometricRatio);\n\n\tconst crossVec = vec3.cross(vec3.create(), curPoint, projectedPrevPoint);\n\n\tdistance =\n\t\tcoefficientA * crossVec[0] +\n\t\tcoefficientB * crossVec[1] +\n\t\tcoefficientC * crossVec[2];\n\n\tlet thetaDirection;\n\n\tif (rotateKind !== ROTATE_CONSTANT.YAW_DELTA_BY_YAW) {\n\t\tthetaDirection = distance > 0 ? 1 : -1;\n\t} else {\n\t\tthetaDirection = distance < 0 ? 1 : -1;\n\t}\n\n\tconst deltaRadian = theta * thetaDirection * rotateDirection;\n\n\treturn toDegree(deltaRadian);\n}\n\nfunction angleBetweenVec2(v1, v2) {\n\tconst det = v1[0] * v2[1] - v2[0] * v1[1];\n\tconst theta = -Math.atan2(det, vec2.dot(v1, v2));\n\treturn theta;\n}\n\nutil.yawOffsetBetween = function(viewDir, targetDir) {\n\tconst viewDirXZ = vec2.fromValues(viewDir[0], viewDir[2]);\n\tconst targetDirXZ = vec2.fromValues(targetDir[0], targetDir[2]);\n\n\tvec2.normalize(viewDirXZ, viewDirXZ);\n\tvec2.normalize(targetDirXZ, targetDirXZ);\n\n\tconst theta = -angleBetweenVec2(viewDirXZ, targetDirXZ);\n\n\treturn theta;\n}\n\nutil.toDegree = toDegree;\nutil.getRotationDelta = getRotationDelta;\nutil.angleBetweenVec2 = angleBetweenVec2;\n\nexport {\n\tutil,\n\tROTATE_CONSTANT,\n};\n","/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar MathUtil = window.MathUtil || {};\n\nMathUtil.degToRad = Math.PI / 180;\nMathUtil.radToDeg = 180 / Math.PI;\n\n// Some minimal math functionality borrowed from THREE.Math and stripped down\n// for the purposes of this library.\n\n\nMathUtil.Vector2 = function ( x, y ) {\n this.x = x || 0;\n this.y = y || 0;\n};\n\nMathUtil.Vector2.prototype = {\n constructor: MathUtil.Vector2,\n\n set: function ( x, y ) {\n this.x = x;\n this.y = y;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n\n return this;\n },\n\n subVectors: function ( a, b ) {\n this.x = a.x - b.x;\n this.y = a.y - b.y;\n\n return this;\n },\n};\n\nMathUtil.Vector3 = function ( x, y, z ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n};\n\nMathUtil.Vector3.prototype = {\n constructor: MathUtil.Vector3,\n\n set: function ( x, y, z ) {\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n },\n\n copy: function ( v ) {\n this.x = v.x;\n this.y = v.y;\n this.z = v.z;\n\n return this;\n },\n\n length: function () {\n return Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z );\n },\n\n normalize: function () {\n var scalar = this.length();\n\n if ( scalar !== 0 ) {\n var invScalar = 1 / scalar;\n\n this.multiplyScalar(invScalar);\n } else {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n }\n\n return this;\n },\n\n multiplyScalar: function ( scalar ) {\n this.x *= scalar;\n this.y *= scalar;\n this.z *= scalar;\n },\n\n applyQuaternion: function ( q ) {\n var x = this.x;\n var y = this.y;\n var z = this.z;\n\n var qx = q.x;\n var qy = q.y;\n var qz = q.z;\n var qw = q.w;\n\n // calculate quat * vector\n var ix = qw * x + qy * z - qz * y;\n var iy = qw * y + qz * x - qx * z;\n var iz = qw * z + qx * y - qy * x;\n var iw = - qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n this.x = ix * qw + iw * - qx + iy * - qz - iz * - qy;\n this.y = iy * qw + iw * - qy + iz * - qx - ix * - qz;\n this.z = iz * qw + iw * - qz + ix * - qy - iy * - qx;\n\n return this;\n },\n\n dot: function ( v ) {\n return this.x * v.x + this.y * v.y + this.z * v.z;\n },\n\n crossVectors: function ( a, b ) {\n var ax = a.x, ay = a.y, az = a.z;\n var bx = b.x, by = b.y, bz = b.z;\n\n this.x = ay * bz - az * by;\n this.y = az * bx - ax * bz;\n this.z = ax * by - ay * bx;\n\n return this;\n },\n};\n\nMathUtil.Quaternion = function ( x, y, z, w ) {\n this.x = x || 0;\n this.y = y || 0;\n this.z = z || 0;\n this.w = ( w !== undefined ) ? w : 1;\n};\n\nMathUtil.Quaternion.prototype = {\n constructor: MathUtil.Quaternion,\n\n set: function ( x, y, z, w ) {\n this.x = x;\n this.y = y;\n this.z = z;\n this.w = w;\n\n return this;\n },\n\n copy: function ( quaternion ) {\n this.x = quaternion.x;\n this.y = quaternion.y;\n this.z = quaternion.z;\n this.w = quaternion.w;\n\n return this;\n },\n\n setFromEulerXYZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 + s1 * s2 * c3;\n this.w = c1 * c2 * c3 - s1 * s2 * s3;\n\n return this;\n },\n\n setFromEulerYXZ: function( x, y, z ) {\n var c1 = Math.cos( x / 2 );\n var c2 = Math.cos( y / 2 );\n var c3 = Math.cos( z / 2 );\n var s1 = Math.sin( x / 2 );\n var s2 = Math.sin( y / 2 );\n var s3 = Math.sin( z / 2 );\n\n this.x = s1 * c2 * c3 + c1 * s2 * s3;\n this.y = c1 * s2 * c3 - s1 * c2 * s3;\n this.z = c1 * c2 * s3 - s1 * s2 * c3;\n this.w = c1 * c2 * c3 + s1 * s2 * s3;\n\n return this;\n },\n\n setFromAxisAngle: function ( axis, angle ) {\n // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm\n // assumes axis is normalized\n\n var halfAngle = angle / 2, s = Math.sin( halfAngle );\n\n this.x = axis.x * s;\n this.y = axis.y * s;\n this.z = axis.z * s;\n this.w = Math.cos( halfAngle );\n\n return this;\n },\n\n multiply: function ( q ) {\n return this.multiplyQuaternions( this, q );\n },\n\n multiplyQuaternions: function ( a, b ) {\n // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm\n\n var qax = a.x, qay = a.y, qaz = a.z, qaw = a.w;\n var qbx = b.x, qby = b.y, qbz = b.z, qbw = b.w;\n\n this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby;\n this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz;\n this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx;\n this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz;\n\n return this;\n },\n\n inverse: function () {\n this.x *= -1;\n this.y *= -1;\n this.z *= -1;\n\n this.normalize();\n\n return this;\n },\n\n normalize: function () {\n var l = Math.sqrt( this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w );\n\n if ( l === 0 ) {\n this.x = 0;\n this.y = 0;\n this.z = 0;\n this.w = 1;\n } else {\n l = 1 / l;\n\n this.x = this.x * l;\n this.y = this.y * l;\n this.z = this.z * l;\n this.w = this.w * l;\n }\n\n return this;\n },\n\n slerp: function ( qb, t ) {\n if ( t === 0 ) return this;\n if ( t === 1 ) return this.copy( qb );\n\n var x = this.x, y = this.y, z = this.z, w = this.w;\n\n // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/\n\n var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z;\n\n if ( cosHalfTheta < 0 ) {\n this.w = - qb.w;\n this.x = - qb.x;\n this.y = - qb.y;\n this.z = - qb.z;\n\n cosHalfTheta = - cosHalfTheta;\n } else {\n this.copy( qb );\n }\n\n if ( cosHalfTheta >= 1.0 ) {\n this.w = w;\n this.x = x;\n this.y = y;\n this.z = z;\n\n return this;\n }\n\n var halfTheta = Math.acos( cosHalfTheta );\n var sinHalfTheta = Math.sqrt( 1.0 - cosHalfTheta * cosHalfTheta );\n\n if ( Math.abs( sinHalfTheta ) < 0.001 ) {\n this.w = 0.5 * ( w + this.w );\n this.x = 0.5 * ( x + this.x );\n this.y = 0.5 * ( y + this.y );\n this.z = 0.5 * ( z + this.z );\n\n return this;\n }\n\n var ratioA = Math.sin( ( 1 - t ) * halfTheta ) / sinHalfTheta,\n ratioB = Math.sin( t * halfTheta ) / sinHalfTheta;\n\n this.w = ( w * ratioA + this.w * ratioB );\n this.x = ( x * ratioA + this.x * ratioB );\n this.y = ( y * ratioA + this.y * ratioB );\n this.z = ( z * ratioA + this.z * ratioB );\n\n return this;\n },\n\n setFromUnitVectors: function () {\n // http://lolengine.net/blog/2014/02/24/quaternion-from-two-vectors-final\n // assumes direction vectors vFrom and vTo are normalized\n\n var v1, r;\n var EPS = 0.000001;\n\n return function ( vFrom, vTo ) {\n if ( v1 === undefined ) v1 = new MathUtil.Vector3();\n\n r = vFrom.dot( vTo ) + 1;\n\n if ( r < EPS ) {\n r = 0;\n\n if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {\n v1.set( - vFrom.y, vFrom.x, 0 );\n } else {\n v1.set( 0, - vFrom.z, vFrom.y );\n }\n } else {\n v1.crossVectors( vFrom, vTo );\n }\n\n this.x = v1.x;\n this.y = v1.y;\n this.z = v1.z;\n this.w = r;\n\n this.normalize();\n\n return this;\n }\n }(),\n};\n\nmodule.exports = MathUtil;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Util = window.Util || {};\n\nUtil.MIN_TIMESTEP = 0.001;\nUtil.MAX_TIMESTEP = 1;\n\nUtil.base64 = function(mimeType, base64) {\n return 'data:' + mimeType + ';base64,' + base64;\n};\n\nUtil.clamp = function(value, min, max) {\n return Math.min(Math.max(min, value), max);\n};\n\nUtil.lerp = function(a, b, t) {\n return a + ((b - a) * t);\n};\n\n/**\n * Light polyfill for `Promise.race`. Returns\n * a promise that resolves when the first promise\n * provided resolves.\n *\n * @param {Array} promises\n */\nUtil.race = function(promises) {\n if (Promise.race) {\n return Promise.race(promises);\n }\n\n return new Promise(function (resolve, reject) {\n for (var i = 0; i < promises.length; i++) {\n promises[i].then(resolve, reject);\n }\n });\n};\n\nUtil.isIOS = (function() {\n var isIOS = /iPad|iPhone|iPod/.test(navigator.platform);\n return function() {\n return isIOS;\n };\n})();\n\nUtil.isWebViewAndroid = (function() {\n var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1 &&\n navigator.userAgent.indexOf('Chrome') !== -1;\n return function() {\n return isWebViewAndroid;\n };\n})();\n\nUtil.isSafari = (function() {\n var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n return function() {\n return isSafari;\n };\n})();\n\nUtil.isFirefoxAndroid = (function() {\n var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 &&\n navigator.userAgent.indexOf('Android') !== -1;\n return function() {\n return isFirefoxAndroid;\n };\n})();\n\nUtil.isR7 = (function() {\n var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1;\n return function() {\n return isR7;\n };\n})();\n\nUtil.isLandscapeMode = function() {\n var rtn = (window.orientation == 90 || window.orientation == -90);\n return Util.isR7() ? !rtn : rtn;\n};\n\n// Helper method to validate the time steps of sensor timestamps.\nUtil.isTimestampDeltaValid = function(timestampDeltaS) {\n if (isNaN(timestampDeltaS)) {\n return false;\n }\n if (timestampDeltaS <= Util.MIN_TIMESTEP) {\n return false;\n }\n if (timestampDeltaS > Util.MAX_TIMESTEP) {\n return false;\n }\n return true;\n};\n\nUtil.getScreenWidth = function() {\n return Math.max(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.getScreenHeight = function() {\n return Math.min(window.screen.width, window.screen.height) *\n window.devicePixelRatio;\n};\n\nUtil.requestFullscreen = function(element) {\n if (Util.isWebViewAndroid()) {\n return false;\n }\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element.webkitRequestFullscreen) {\n element.webkitRequestFullscreen();\n } else if (element.mozRequestFullScreen) {\n element.mozRequestFullScreen();\n } else if (element.msRequestFullscreen) {\n element.msRequestFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.exitFullscreen = function() {\n if (document.exitFullscreen) {\n document.exitFullscreen();\n } else if (document.webkitExitFullscreen) {\n document.webkitExitFullscreen();\n } else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n } else if (document.msExitFullscreen) {\n document.msExitFullscreen();\n } else {\n return false;\n }\n\n return true;\n};\n\nUtil.getFullscreenElement = function() {\n return document.fullscreenElement ||\n document.webkitFullscreenElement ||\n document.mozFullScreenElement ||\n document.msFullscreenElement;\n};\n\nUtil.linkProgram = function(gl, vertexSource, fragmentSource, attribLocationMap) {\n // No error checking for brevity.\n var vertexShader = gl.createShader(gl.VERTEX_SHADER);\n gl.shaderSource(vertexShader, vertexSource);\n gl.compileShader(vertexShader);\n\n var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);\n gl.shaderSource(fragmentShader, fragmentSource);\n gl.compileShader(fragmentShader);\n\n var program = gl.createProgram();\n gl.attachShader(program, vertexShader);\n gl.attachShader(program, fragmentShader);\n\n for (var attribName in attribLocationMap)\n gl.bindAttribLocation(program, attribLocationMap[attribName], attribName);\n\n gl.linkProgram(program);\n\n gl.deleteShader(vertexShader);\n gl.deleteShader(fragmentShader);\n\n return program;\n};\n\nUtil.getProgramUniforms = function(gl, program) {\n var uniforms = {};\n var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n var uniformName = '';\n for (var i = 0; i < uniformCount; i++) {\n var uniformInfo = gl.getActiveUniform(program, i);\n uniformName = uniformInfo.name.replace('[0]', '');\n uniforms[uniformName] = gl.getUniformLocation(program, uniformName);\n }\n return uniforms;\n};\n\nUtil.orthoMatrix = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\nUtil.copyArray = function (source, dest) {\n for (var i = 0, n = source.length; i < n; i++) {\n dest[i] = source[i];\n }\n};\n\nUtil.isMobile = function() {\n var check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma)|i230|iac( |\\-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc\\-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|\\-[a-w])|libw|lynx|m1\\-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m\\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\\-2|po(ck|rt|se)|prox|psio|pt\\-g|qa\\-a|qc(07|12|21|32|60|\\-[2-7]|i\\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\\-|oo|p\\-)|sdk\\/|se(c(\\-|0|1)|47|mc|nd|ri)|sgh\\-|shar|sie(\\-|m)|sk\\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\\-|v\\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\\-|tdg\\-|tel(i|m)|tim\\-|t\\-mo|to(pl|sh)|ts(70|m\\-|m3|m5)|tx\\-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\\-|your|zeto|zte\\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);\n return check;\n};\n\nUtil.extend = function(dest, src) {\n for (var key in src) {\n if (src.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n\n return dest;\n}\n\nUtil.safariCssSizeWorkaround = function(canvas) {\n // TODO(smus): Remove this workaround when Safari for iOS is fixed.\n // iOS only workaround (for https://bugs.webkit.org/show_bug.cgi?id=152556).\n //\n // \"To the last I grapple with thee;\n // from hell's heart I stab at thee;\n // for hate's sake I spit my last breath at thee.\"\n // -- Moby Dick, by Herman Melville\n if (Util.isIOS()) {\n var width = canvas.style.width;\n var height = canvas.style.height;\n canvas.style.width = (parseInt(width) + 1) + 'px';\n canvas.style.height = (parseInt(height)) + 'px';\n setTimeout(function() {\n canvas.style.width = width;\n canvas.style.height = height;\n }, 100);\n }\n\n // Debug only.\n window.Util = Util;\n window.canvas = canvas;\n};\n\nUtil.isDebug = function() {\n return Util.getQueryParameter('debug');\n};\n\nUtil.getQueryParameter = function(name) {\n var name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n results = regex.exec(location.search);\n return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n};\n\nUtil.frameDataFromPose = (function() {\n var piOver180 = Math.PI / 180.0;\n var rad45 = Math.PI * 0.25;\n\n // Borrowed from glMatrix.\n function mat4_perspectiveFromFieldOfView(out, fov, near, far) {\n var upTan = Math.tan(fov ? (fov.upDegrees * piOver180) : rad45),\n downTan = Math.tan(fov ? (fov.downDegrees * piOver180) : rad45),\n leftTan = Math.tan(fov ? (fov.leftDegrees * piOver180) : rad45),\n rightTan = Math.tan(fov ? (fov.rightDegrees * piOver180) : rad45),\n xScale = 2.0 / (leftTan + rightTan),\n yScale = 2.0 / (upTan + downTan);\n\n out[0] = xScale;\n out[1] = 0.0;\n out[2] = 0.0;\n out[3] = 0.0;\n out[4] = 0.0;\n out[5] = yScale;\n out[6] = 0.0;\n out[7] = 0.0;\n out[8] = -((leftTan - rightTan) * xScale * 0.5);\n out[9] = ((upTan - downTan) * yScale * 0.5);\n out[10] = far / (near - far);\n out[11] = -1.0;\n out[12] = 0.0;\n out[13] = 0.0;\n out[14] = (far * near) / (near - far);\n out[15] = 0.0;\n return out;\n }\n\n function mat4_fromRotationTranslation(out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n };\n\n function mat4_translate(out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n };\n\n function mat4_invert(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n };\n\n var defaultOrientation = new Float32Array([0, 0, 0, 1]);\n var defaultPosition = new Float32Array([0, 0, 0]);\n\n function updateEyeMatrices(projection, view, pose, parameters, vrDisplay) {\n mat4_perspectiveFromFieldOfView(projection, parameters ? parameters.fieldOfView : null, vrDisplay.depthNear, vrDisplay.depthFar);\n\n var orientation = pose.orientation || defaultOrientation;\n var position = pose.position || defaultPosition;\n\n mat4_fromRotationTranslation(view, orientation, position);\n if (parameters)\n mat4_translate(view, view, parameters.offset);\n mat4_invert(view, view);\n }\n\n return function(frameData, pose, vrDisplay) {\n if (!frameData || !pose)\n return false;\n\n frameData.pose = pose;\n frameData.timestamp = pose.timestamp;\n\n updateEyeMatrices(\n frameData.leftProjectionMatrix, frameData.leftViewMatrix,\n pose, vrDisplay.getEyeParameters(\"left\"), vrDisplay);\n updateEyeMatrices(\n frameData.rightProjectionMatrix, frameData.rightViewMatrix,\n pose, vrDisplay.getEyeParameters(\"right\"), vrDisplay);\n\n return true;\n };\n})();\n\nUtil.isInsideCrossDomainIFrame = function() {\n var isFramed = (window.self !== window.top);\n var refDomain = Util.getDomainFromUrl(document.referrer);\n var thisDomain = Util.getDomainFromUrl(window.location.href);\n\n return isFramed && (refDomain !== thisDomain);\n};\n\n// From http://stackoverflow.com/a/23945027.\nUtil.getDomainFromUrl = function(url) {\n var domain;\n // Find & remove protocol (http, ftp, etc.) and get domain.\n if (url.indexOf(\"://\") > -1) {\n domain = url.split('/')[2];\n }\n else {\n domain = url.split('/')[0];\n }\n\n //find & remove port number\n domain = domain.split(':')[0];\n\n return domain;\n}\n\nmodule.exports = Util;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nvar MathUtil = require('../math-util');\nvar Util = require('../util');\n\n/**\n * Given an orientation and the gyroscope data, predicts the future orientation\n * of the head. This makes rendering appear faster.\n *\n * Also see: http://msl.cs.uiuc.edu/~lavalle/papers/LavYerKatAnt14.pdf\n *\n * @param {Number} predictionTimeS time from head movement to the appearance of\n * the corresponding image.\n */\nfunction PosePredictor(predictionTimeS) {\n this.predictionTimeS = predictionTimeS;\n\n // The quaternion corresponding to the previous state.\n this.previousQ = new MathUtil.Quaternion();\n // Previous time a prediction occurred.\n this.previousTimestampS = null;\n\n // The delta quaternion that adjusts the current pose.\n this.deltaQ = new MathUtil.Quaternion();\n // The output quaternion.\n this.outQ = new MathUtil.Quaternion();\n}\n\nPosePredictor.prototype.getPrediction = function(currentQ, gyro, timestampS) {\n if (!this.previousTimestampS) {\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n return currentQ;\n }\n\n // Calculate axis and angle based on gyroscope rotation rate data.\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n\n var angularSpeed = gyro.length();\n\n // If we're rotating slowly, don't do prediction.\n if (angularSpeed < MathUtil.degToRad * 20) {\n if (Util.isDebug()) {\n console.log('Moving slowly, at %s deg/s: no prediction',\n (MathUtil.radToDeg * angularSpeed).toFixed(1));\n }\n this.outQ.copy(currentQ);\n this.previousQ.copy(currentQ);\n return this.outQ;\n }\n\n // Get the predicted angle based on the time delta and latency.\n var deltaT = timestampS - this.previousTimestampS;\n var predictAngle = angularSpeed * this.predictionTimeS;\n\n this.deltaQ.setFromAxisAngle(axis, predictAngle);\n this.outQ.copy(this.previousQ);\n this.outQ.multiply(this.deltaQ);\n\n this.previousQ.copy(currentQ);\n this.previousTimestampS = timestampS;\n\n return this.outQ;\n};\n\n\nmodule.exports = PosePredictor;\n","import {userAgent} from \"../utils/browserFeature\";\n/**\n * Returns a number value indiciating the version of Chrome being used,\n * or otherwise `null` if not on Chrome.\n *\n * Ref: https://github.com/immersive-web/cardboard-vr-display/pull/19\n */\n/**\n * In Chrome m65, `devicemotion` events are broken but subsequently fixed\n * in 65.0.3325.148. Since many browsers use Chromium, ensure that\n * we scope this detection by branch and build numbers to provide\n * a proper fallback.\n * https://github.com/immersive-web/webvr-polyfill/issues/307\n */\nlet version = -1; // It should not be null because it will be compared with number\nlet branch = null;\nlet build = null;\n\nconst match = /Chrome\\/([0-9]+)\\.(?:[0-9]*)\\.([0-9]*)\\.([0-9]*)/i.exec(userAgent);\n\nif (match) {\n\tversion = parseInt(match[1], 10);\n\tbranch = match[2];\n\tbuild = match[3];\n}\n\nconst CHROME_VERSION = version;\nconst IS_CHROME_WITHOUT_DEVICE_MOTION = version === 65 && branch === \"3325\" && parseInt(build, 10) < 148;\nconst IS_ANDROID = /Android/i.test(userAgent);\n\nconst CONTROL_MODE_VR = 1;\nconst CONTROL_MODE_YAWPITCH = 2;\n\nconst TOUCH_DIRECTION_NONE = 1;\nconst TOUCH_DIRECTION_YAW = 2;\nconst TOUCH_DIRECTION_PITCH = 4;\nconst TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_YAW | TOUCH_DIRECTION_PITCH;\n\n/* Const for MovableCoord */\nconst MC_DECELERATION = 0.0014;\nconst MC_MAXIMUM_DURATION = 1000;\nconst MC_BIND_SCALE = [0.20, 0.20];\n\nconst MIN_FIELD_OF_VIEW = 20;\nconst MAX_FIELD_OF_VIEW = 110;\nconst PAN_SCALE = 320;\n\n// const DELTA_THRESHOLD = 0.015;\n// const DELTA_THRESHOLD = 0.09; // Note4\n// const DELTA_THRESHOLD = 0.0825;\n// const DELTA_THRESHOLD = 0.075;\n// const DELTA_THRESHOLD = 0.06;\n// const DELTA_THRESHOLD = 0.045;\nconst DELTA_THRESHOLD = 0.0375; // Note2\n\nconst YAW_RANGE_HALF = 180;\nconst PITCH_RANGE_HALF = 90;\nconst CIRCULAR_PITCH_RANGE_HALF = 180;\nconst PINCH_EVENTS = \"pinchstart pinchmove pinchend\";\n\nconst KEYMAP = {\n\tLEFT_ARROW: 37,\n\tA: 65,\n\tUP_ARROW: 38,\n\tW: 87,\n\tRIGHT_ARROW: 39,\n\tD: 68,\n\tDOWN_ARROW: 40,\n\tS: 83,\n};\n\nconst GYRO_MODE = {\n\tNONE: \"none\",\n\tYAWPITCH: \"yawPitch\",\n\tVR: \"VR\"\n};\n\nexport {\n\tGYRO_MODE,\n\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\n\tTOUCH_DIRECTION_NONE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMIN_FIELD_OF_VIEW,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tDELTA_THRESHOLD,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tPINCH_EVENTS,\n\tKEYMAP,\n\n\tCHROME_VERSION,\n\tIS_CHROME_WITHOUT_DEVICE_MOTION,\n\tIS_ANDROID\n};\n","import Component from \"@egjs/component\";\nimport {vec3} from \"gl-matrix\";\nimport {window} from \"../../utils/browser\";\nimport {IS_CHROME_WITHOUT_DEVICE_MOTION, IS_ANDROID} from \"../consts\";\n\nconst STILLNESS_THRESHOLD = 200; // millisecond\n\nexport default class DeviceMotion extends Component {\n\tconstructor() {\n\t\tsuper();\n\t\tthis._onDeviceMotion = this._onDeviceMotion.bind(this);\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onChromeWithoutDeviceMotion = this._onChromeWithoutDeviceMotion.bind(this);\n\n\t\tthis.isWithoutDeviceMotion = IS_CHROME_WITHOUT_DEVICE_MOTION;\n\t\tthis.isAndroid = IS_ANDROID;\n\n\t\tthis.stillGyroVec = vec3.create();\n\t\tthis.rawGyroVec = vec3.create();\n\t\tthis.adjustedGyroVec = vec3.create();\n\n\t\tthis._timer = null;\n\n\t\tthis.lastDevicemotionTimestamp = 0;\n\t\tthis._isEnabled = false;\n\t\tthis.enable();\n\t}\n\t_onChromeWithoutDeviceMotion(e) {\n\t\tlet {alpha, beta, gamma} = e;\n\n\t\t// There is deviceorientation event trigged with empty values\n\t\t// on Headless Chrome.\n\t\tif (alpha === null) {\n\t\t\treturn;\n\t\t}\n\n\t\t// convert to radian\n\t\talpha = (alpha || 0) * Math.PI / 180;\n\t\tbeta = (beta || 0) * Math.PI / 180;\n\t\tgamma = (gamma || 0) * Math.PI / 180;\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: {\n\t\t\t\tdeviceorientation: {\n\t\t\t\t\talpha,\n\t\t\t\t\tbeta,\n\t\t\t\t\tgamma: -gamma\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t_onDeviceOrientation() {\n\t\tthis._timer && clearTimeout(this._timer);\n\t\tthis._timer = setTimeout(() => {\n\t\t\tif ((new Date().getTime() - this.lastDevicemotionTimestamp) < STILLNESS_THRESHOLD) {\n\t\t\t\tvec3.copy(this.stillGyroVec, this.rawGyroVec);\n\t\t\t}\n\t\t}, STILLNESS_THRESHOLD);\n\t}\n\t_onDeviceMotion(e) {\n\t\t// desktop chrome triggers devicemotion event with empthy sensor values.\n\t\t// Those events should ignored.\n\t\tconst isGyroSensorAvailable = !(e.rotationRate.alpha == null);\n\t\tconst isGravitySensorAvailable = !(e.accelerationIncludingGravity.x == null);\n\n\t\tif (e.interval === 0 || !(isGyroSensorAvailable && isGravitySensorAvailable)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst devicemotionEvent = Object.assign({}, e);\n\n\t\tdevicemotionEvent.interval = e.interval;\n\t\tdevicemotionEvent.timeStamp = e.timeStamp;\n\t\tdevicemotionEvent.type = e.type;\n\t\tdevicemotionEvent.rotationRate = {\n\t\t\talpha: e.rotationRate.alpha,\n\t\t\tbeta: e.rotationRate.beta,\n\t\t\tgamma: e.rotationRate.gamma,\n\t\t};\n\t\tdevicemotionEvent.accelerationIncludingGravity = {\n\t\t\tx: e.accelerationIncludingGravity.x,\n\t\t\ty: e.accelerationIncludingGravity.y,\n\t\t\tz: e.accelerationIncludingGravity.z,\n\t\t};\n\t\tdevicemotionEvent.acceleration = {\n\t\t\tx: e.acceleration.x,\n\t\t\ty: e.acceleration.y,\n\t\t\tz: e.acceleration.z,\n\t\t};\n\n\t\tif (this.isAndroid) {\n\t\t\tvec3.set(\n\t\t\t\tthis.rawGyroVec,\n\t\t\t\te.rotationRate.alpha || 0,\n\t\t\t\te.rotationRate.beta || 0,\n\t\t\t\te.rotationRate.gamma || 0);\n\t\t\tvec3.subtract(this.adjustedGyroVec, this.rawGyroVec, this.stillGyroVec);\n\t\t\tthis.lastDevicemotionTimestamp = new Date().getTime();\n\n\t\t\tdevicemotionEvent.adjustedRotationRate = {\n\t\t\t\talpha: this.adjustedGyroVec[0],\n\t\t\t\tbeta: this.adjustedGyroVec[1],\n\t\t\t\tgamma: this.adjustedGyroVec[2]};\n\t\t}\n\n\t\tthis.trigger(\"devicemotion\", {\n\t\t\tinputEvent: devicemotionEvent\n\t\t});\n\t}\n\tenable() {\n\t\tif (this.isAndroid) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\t}\n\t\tif (this.isWithoutDeviceMotion) {\n\t\t\twindow.addEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\t} else {\n\t\t\twindow.addEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\t}\n\t\tthis._isEnabled = true;\n\t}\n\tdisable() {\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"deviceorientation\", this._onChromeWithoutDeviceMotion);\n\t\twindow.removeEventListener(\"devicemotion\", this._onDeviceMotion);\n\t\tthis._isEnabled = false;\n\t}\n}\n","function SensorSample(sample, timestampS) {\n this.set(sample, timestampS);\n};\n\nSensorSample.prototype.set = function(sample, timestampS) {\n this.sample = sample;\n this.timestampS = timestampS;\n};\n\nSensorSample.prototype.copy = function(sensorSample) {\n this.set(sensorSample.sample, sensorSample.timestampS);\n};\n\nmodule.exports = SensorSample;\n","/*\n * Copyright 2015 Google Inc. All Rights Reserved.\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar SensorSample = require('./sensor-sample.js');\nvar MathUtil = require('../math-util.js');\nvar Util = require('../util.js');\n\n/**\n * An implementation of a simple complementary filter, which fuses gyroscope and\n * accelerometer data from the 'devicemotion' event.\n *\n * Accelerometer data is very noisy, but stable over the long term.\n * Gyroscope data is smooth, but tends to drift over the long term.\n *\n * This fusion is relatively simple:\n * 1. Get orientation estimates from accelerometer by applying a low-pass filter\n * on that data.\n * 2. Get orientation estimates from gyroscope by integrating over time.\n * 3. Combine the two estimates, weighing (1) in the long term, but (2) for the\n * short term.\n */\nfunction ComplementaryFilter(kFilter) {\n this.kFilter = kFilter;\n\n // Raw sensor measurements.\n this.currentAccelMeasurement = new SensorSample();\n this.currentGyroMeasurement = new SensorSample();\n this.previousGyroMeasurement = new SensorSample();\n\n // Set default look direction to be in the correct direction.\n if (Util.isIOS()) {\n this.filterQ = new MathUtil.Quaternion(-1, 0, 0, 1);\n } else {\n this.filterQ = new MathUtil.Quaternion(1, 0, 0, 1);\n }\n this.previousFilterQ = new MathUtil.Quaternion();\n this.previousFilterQ.copy(this.filterQ);\n\n // Orientation based on the accelerometer.\n this.accelQ = new MathUtil.Quaternion();\n // Whether or not the orientation has been initialized.\n this.isOrientationInitialized = false;\n // Running estimate of gravity based on the current orientation.\n this.estimatedGravity = new MathUtil.Vector3();\n // Measured gravity based on accelerometer.\n this.measuredGravity = new MathUtil.Vector3();\n\n // Debug only quaternion of gyro-based orientation.\n this.gyroIntegralQ = new MathUtil.Quaternion();\n}\n\nComplementaryFilter.prototype.addAccelMeasurement = function(vector, timestampS) {\n this.currentAccelMeasurement.set(vector, timestampS);\n};\n\nComplementaryFilter.prototype.addGyroMeasurement = function(vector, timestampS) {\n this.currentGyroMeasurement.set(vector, timestampS);\n\n var deltaT = timestampS - this.previousGyroMeasurement.timestampS;\n if (Util.isTimestampDeltaValid(deltaT)) {\n this.run_();\n }\n\n this.previousGyroMeasurement.copy(this.currentGyroMeasurement);\n};\n\nComplementaryFilter.prototype.run_ = function() {\n\n if (!this.isOrientationInitialized) {\n this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n this.previousFilterQ.copy(this.accelQ);\n this.isOrientationInitialized = true;\n return;\n }\n\n var deltaT = this.currentGyroMeasurement.timestampS -\n this.previousGyroMeasurement.timestampS;\n\n // Convert gyro rotation vector to a quaternion delta.\n var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n this.gyroIntegralQ.multiply(gyroDeltaQ);\n\n // filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n this.filterQ.copy(this.previousFilterQ);\n this.filterQ.multiply(gyroDeltaQ);\n\n // Calculate the delta between the current estimated gravity and the real\n // gravity vector from accelerometer.\n var invFilterQ = new MathUtil.Quaternion();\n invFilterQ.copy(this.filterQ);\n invFilterQ.inverse();\n\n this.estimatedGravity.set(0, 0, -1);\n this.estimatedGravity.applyQuaternion(invFilterQ);\n this.estimatedGravity.normalize();\n\n this.measuredGravity.copy(this.currentAccelMeasurement.sample);\n this.measuredGravity.normalize();\n\n // Compare estimated gravity with measured gravity, get the delta quaternion\n // between the two.\n var deltaQ = new MathUtil.Quaternion();\n deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n deltaQ.inverse();\n\n if (Util.isDebug()) {\n console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)',\n MathUtil.radToDeg * Util.getQuaternionAngle(deltaQ),\n (this.estimatedGravity.x).toFixed(1),\n (this.estimatedGravity.y).toFixed(1),\n (this.estimatedGravity.z).toFixed(1),\n (this.measuredGravity.x).toFixed(1),\n (this.measuredGravity.y).toFixed(1),\n (this.measuredGravity.z).toFixed(1));\n }\n\n // Calculate the SLERP target: current orientation plus the measured-estimated\n // quaternion delta.\n var targetQ = new MathUtil.Quaternion();\n targetQ.copy(this.filterQ);\n targetQ.multiply(deltaQ);\n\n // SLERP factor: 0 is pure gyro, 1 is pure accel.\n this.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n this.previousFilterQ.copy(this.filterQ);\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n return this.filterQ;\n};\n\nComplementaryFilter.prototype.accelToQuaternion_ = function(accel) {\n var normAccel = new MathUtil.Vector3();\n normAccel.copy(accel);\n normAccel.normalize();\n var quat = new MathUtil.Quaternion();\n quat.setFromUnitVectors(new MathUtil.Vector3(0, 0, -1), normAccel);\n quat.inverse();\n return quat;\n};\n\nComplementaryFilter.prototype.gyroToQuaternionDelta_ = function(gyro, dt) {\n // Extract axis and angle from the gyroscope data.\n var quat = new MathUtil.Quaternion();\n var axis = new MathUtil.Vector3();\n axis.copy(gyro);\n axis.normalize();\n quat.setFromAxisAngle(axis, gyro.length() * dt);\n return quat;\n};\n\n\nmodule.exports = ComplementaryFilter;\n","import MathUtil from \"webvr-polyfill/src/math-util\";\nimport ComplementaryFilter from \"webvr-polyfill/src/sensor-fusion/complementary-filter\";\n\nComplementaryFilter.prototype.run_ = function() {\n\tif (!this.isOrientationInitialized) {\n\t\tthis.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample);\n\t\tthis.previousFilterQ.copy(this.accelQ);\n\t\tthis.isOrientationInitialized = true;\n\t\treturn;\n\t}\n\n\tconst deltaT = this.currentGyroMeasurement.timestampS -\n\tthis.previousGyroMeasurement.timestampS;\n\n\t// Convert gyro rotation vector to a quaternion delta.\n\tconst gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT);\n\n\tthis.gyroIntegralQ.multiply(gyroDeltaQ);\n\n\t// filter_1 = K * (filter_0 + gyro * dT) + (1 - K) * accel.\n\tthis.filterQ.copy(this.previousFilterQ);\n\tthis.filterQ.multiply(gyroDeltaQ);\n\n\t// Calculate the delta between the current estimated gravity and the real\n\t// gravity vector from accelerometer.\n\tconst invFilterQ = new MathUtil.Quaternion();\n\n\tinvFilterQ.copy(this.filterQ);\n\tinvFilterQ.inverse();\n\n\tthis.estimatedGravity.set(0, 0, -1);\n\tthis.estimatedGravity.applyQuaternion(invFilterQ);\n\tthis.estimatedGravity.normalize();\n\n\tthis.measuredGravity.copy(this.currentAccelMeasurement.sample);\n\tthis.measuredGravity.normalize();\n\n\t// Compare estimated gravity with measured gravity, get the delta quaternion\n\t// between the two.\n\tconst deltaQ = new MathUtil.Quaternion();\n\n\tdeltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity);\n\tdeltaQ.inverse();\n\n\t// Calculate the SLERP target: current orientation plus the measured-estimated\n\t// quaternion delta.\n\tconst targetQ = new MathUtil.Quaternion();\n\n\ttargetQ.copy(this.filterQ);\n\ttargetQ.multiply(deltaQ);\n\n\t// SLERP factor: 0 is pure gyro, 1 is pure accel.\n\tthis.filterQ.slerp(targetQ, 1 - this.kFilter);\n\n\tthis.previousFilterQ.copy(this.filterQ);\n\n\tif (!this.isFilterQuaternionInitialized) {\n\t\tthis.isFilterQuaternionInitialized = true;\n\t}\n};\n\nComplementaryFilter.prototype.getOrientation = function() {\n\tif (this.isFilterQuaternionInitialized) {\n\t\treturn this.filterQ;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nexport default ComplementaryFilter;\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport PosePredictor from \"webvr-polyfill/src/sensor-fusion/pose-predictor\";\nimport MathUtil from \"webvr-polyfill/src/math-util\";\nimport Util from \"webvr-polyfill/src/util\";\nimport {window, IS_IOS, IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\nimport DeviceMotion from \"./DeviceMotion\";\nimport ComplementaryFilter from \"./ComplementaryFilter\";\nimport {CHROME_VERSION} from \"../consts\";\n\nconst K_FILTER = 0.98;\nconst PREDICTION_TIME_S = 0.040;\n\nexport default class FusionPoseSensor extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.deviceMotion = new DeviceMotion();\n\n\t\tthis.accelerometer = new MathUtil.Vector3();\n\t\tthis.gyroscope = new MathUtil.Vector3();\n\n\t\tthis._onDeviceMotionChange = this._onDeviceMotionChange.bind(this);\n\t\tthis._onScreenOrientationChange = this._onScreenOrientationChange.bind(this);\n\n\t\tthis.filter = new ComplementaryFilter(K_FILTER);\n\t\tthis.posePredictor = new PosePredictor(PREDICTION_TIME_S);\n\n\t\tthis.filterToWorldQ = new MathUtil.Quaternion();\n\n\t\tthis.isFirefoxAndroid = Util.isFirefoxAndroid();\n\t\t// This includes iPhone & iPad(both desktop and mobile mode) ref #326\n\t\tthis.isIOS = IS_IOS || IS_SAFARI_ON_DESKTOP;\n\n\t\t// Ref https://github.com/immersive-web/cardboard-vr-display/issues/18\n\t\tthis.isChromeUsingDegrees = CHROME_VERSION >= 66;\n\n\t\tthis._isEnabled = false;\n\n\t\t// Set the filter to world transform, depending on OS.\n\t\tif (this.isIOS) {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), Math.PI / 2);\n\t\t} else {\n\t\t\tthis.filterToWorldQ.setFromAxisAngle(new MathUtil.Vector3(1, 0, 0), -Math.PI / 2);\n\t\t}\n\n\t\tthis.inverseWorldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.worldToScreenQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ = new MathUtil.Quaternion();\n\t\tthis.originalPoseAdjustQ.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1),\n\t\t\t-window.orientation * Math.PI / 180);\n\n\t\tthis._setScreenTransform();\n\t\t// Adjust this filter for being in landscape mode.\n\t\tif (Util.isLandscapeMode()) {\n\t\t\tthis.filterToWorldQ.multiply(this.inverseWorldToScreenQ);\n\t\t}\n\n\t\t// Keep track of a reset transform for resetSensor.\n\t\tthis.resetQ = new MathUtil.Quaternion();\n\n\t\tthis.deviceMotion.on(\"devicemotion\", this._onDeviceMotionChange);\n\t\tthis.enable();\n\t}\n\tenable() {\n\t\tif (this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.enable();\n\t\tthis._isEnabled = true;\n\t\twindow.addEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tdisable() {\n\t\tif (!this.isEnabled()) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deviceMotion.disable();\n\t\tthis._isEnabled = false;\n\t\twindow.removeEventListener(\"orientationchange\", this._onScreenOrientationChange);\n\t}\n\tisEnabled() {\n\t\treturn this._isEnabled;\n\t}\n\tdestroy() {\n\t\tthis.disable();\n\t\tthis.deviceMotion = null;\n\t}\n\t_triggerChange() {\n\t\tconst orientation = this.getOrientation();\n\n\t\t// if orientation is not prepared. don't trigger change event\n\t\tif (!orientation) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._prevOrientation) {\n\t\t\tthis._prevOrientation = orientation;\n\t\t\treturn;\n\t\t}\n\n\t\tif (quat.equals(this._prevOrientation, orientation)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.trigger(\"change\", {quaternion: orientation});\n\t}\n\tgetOrientation() {\n\t\tlet orientation;\n\n\t\t// Hack around using deviceorientation instead of devicemotion\n\t\tif (this.deviceMotion.isWithoutDeviceMotion && this._deviceOrientationQ) {\n\t\t\tthis.deviceOrientationFixQ = this.deviceOrientationFixQ || (() => {\n\t\t\t\tconst y = new MathUtil.Quaternion()\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 1, 0), -this._alpha);\n\n\t\t\t\treturn y;\n\t\t\t})();\n\n\t\t\torientation = this._deviceOrientationQ;\n\t\t\tconst out = new MathUtil.Quaternion();\n\n\t\t\tout.copy(orientation);\n\t\t\tout.multiply(this.filterToWorldQ);\n\t\t\tout.multiply(this.resetQ);\n\t\t\tout.multiply(this.worldToScreenQ);\n\t\t\tout.multiplyQuaternions(this.deviceOrientationFixQ, out);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t} else {\n\t\t\t// Convert from filter space to the the same system used by the\n\t\t\t// deviceorientation event.\n\t\t\torientation = this.filter.getOrientation();\n\n\t\t\tif (!orientation) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst out = this._convertFusionToPredicted(orientation);\n\n\t\t\t// return quaternion as glmatrix quaternion object\n\t\t\tconst out_ = quat.fromValues(\n\t\t\t\tout.x,\n\t\t\t\tout.y,\n\t\t\t\tout.z,\n\t\t\t\tout.w\n\t\t\t);\n\n\t\t\treturn quat.normalize(out_, out_);\n\t\t}\n\t}\n\t_convertFusionToPredicted(orientation) {\n\t\t// Predict orientation.\n\t\tthis.predictedQ =\n\t\t\tthis.posePredictor.getPrediction(orientation, this.gyroscope, this.previousTimestampS);\n\n\t\t// Convert to THREE coordinate system: -Z forward, Y up, X right.\n\t\tconst out = new MathUtil.Quaternion();\n\n\t\tout.copy(this.filterToWorldQ);\n\t\tout.multiply(this.resetQ);\n\t\tout.multiply(this.predictedQ);\n\t\tout.multiply(this.worldToScreenQ);\n\n\t\treturn out;\n\t}\n\t_onDeviceMotionChange({inputEvent}) {\n\t\tconst deviceorientation = inputEvent.deviceorientation;\n\t\tconst deviceMotion = inputEvent;\n\t\tconst accGravity = deviceMotion.accelerationIncludingGravity;\n\t\tconst rotRate = deviceMotion.adjustedRotationRate || deviceMotion.rotationRate;\n\t\tlet timestampS = deviceMotion.timeStamp / 1000;\n\n\t\tif (deviceorientation) {\n\t\t\tif (!this._alpha) {\n\t\t\t\tthis._alpha = deviceorientation.alpha;\n\t\t\t}\n\t\t\tthis._deviceOrientationQ = this._deviceOrientationQ || new MathUtil.Quaternion();\n\t\t\tthis._deviceOrientationQ.setFromEulerYXZ(\n\t\t\t\tdeviceorientation.beta,\n\t\t\t\tdeviceorientation.alpha,\n\t\t\t\tdeviceorientation.gamma\n\t\t\t);\n\n\t\t\tthis._triggerChange();\n\t\t} else {\n\t\t\t// Firefox Android timeStamp returns one thousandth of a millisecond.\n\t\t\tif (this.isFirefoxAndroid) {\n\t\t\t\ttimestampS /= 1000;\n\t\t\t}\n\n\t\t\tthis.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z);\n\t\t\tthis.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma);\n\n\t\t\t// Browsers on iOS, Firefox/Android, and Chrome m66/Android `rotationRate`\n\t\t\t// is reported in degrees, so we first convert to radians.\n\t\t\tif (this.isIOS || this.isFirefoxAndroid || this.isChromeUsingDegrees) {\n\t\t\t\tthis.gyroscope.multiplyScalar(Math.PI / 180);\n\t\t\t}\n\n\t\t\tthis.filter.addAccelMeasurement(this.accelerometer, timestampS);\n\t\t\tthis.filter.addGyroMeasurement(this.gyroscope, timestampS);\n\n\t\t\tthis._triggerChange();\n\n\t\t\tthis.previousTimestampS = timestampS;\n\t\t}\n\t}\n\t_onScreenOrientationChange(screenOrientation) {\n\t\tthis._setScreenTransform(window.orientation);\n\t}\n\t_setScreenTransform() {\n\t\tthis.worldToScreenQ.set(0, 0, 0, 1);\n\n\t\tconst orientation = window.orientation;\n\n\t\tswitch (orientation) {\n\t\t\tcase 0:\n\t\t\t\tbreak;\n\t\t\tcase 90:\n\t\t\tcase -90:\n\t\t\tcase 180:\n\t\t\t\tthis.worldToScreenQ\n\t\t\t\t\t.setFromAxisAngle(new MathUtil.Vector3(0, 0, 1), orientation / -180 * Math.PI);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tthis.inverseWorldToScreenQ.copy(this.worldToScreenQ);\n\t\tthis.inverseWorldToScreenQ.inverse();\n\t}\n}\n","import Component from \"@egjs/component\";\nimport {quat} from \"gl-matrix\";\nimport {toAxis} from \"../utils\";\nimport FusionPoseSensor from \"./FusionPoseSensor\";\nimport {util, ROTATE_CONSTANT} from \"../../utils/math-util\";\n\nfunction getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(util.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nfunction getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = util.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n\nexport default class TiltMotionInput extends Component {\n\tconstructor(el, options) {\n\t\tsuper();\n\t\tthis.element = el;\n\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\n\t\tthis.fusionPoseSensor = null;\n\n\t\tthis.options = Object.assign({\n\t\t\tscale: 1,\n\t\t\tthreshold: 0,\n\t\t}, options);\n\n\t\tthis._onPoseChange = this._onPoseChange.bind(this);\n\t}\n\tmapAxes(axes) {\n\t\tthis.axes = axes;\n\t}\n\tconnect(observer) {\n\t\tif (this.observer) {\n\t\t\treturn this;\n\t\t}\n\t\tthis.observer = observer;\n\t\tthis.fusionPoseSensor = new FusionPoseSensor();\n\t\tthis.fusionPoseSensor.enable();\n\t\tthis._attachEvent();\n\t\treturn this;\n\t}\n\tdisconnect() {\n\t\tif (!this.observer) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._dettachEvent();\n\t\tthis.fusionPoseSensor.disable();\n\t\tthis.fusionPoseSensor.destroy();\n\t\tthis.fusionPoseSensor = null;\n\t\tthis.observer = null;\n\t\treturn this;\n\t}\n\tdestroy() {\n\t\tthis.disconnect();\n\t\tthis.element = null;\n\t\tthis.options = null;\n\t\tthis.axes = null;\n\t\tthis._prevQuaternion = null;\n\t\tthis._quaternion = null;\n\t}\n\t_onPoseChange(event) {\n\t\tif (!this._prevQuaternion) {\n\t\t\tthis._prevQuaternion = quat.clone(event.quaternion);\n\t\t\tthis._quaternion = quat.clone(event.quaternion);\n\t\t\treturn;\n\t\t}\n\n\t\tquat.copy(this._prevQuaternion, this._quaternion);\n\t\tquat.copy(this._quaternion, event.quaternion);\n\n\t\tthis.observer.change(this, event, toAxis(this.axes, [\n\t\t\tgetDeltaYaw(this._prevQuaternion, this._quaternion),\n\t\t\tgetDeltaPitch(this._prevQuaternion, this._quaternion)\n\t\t]));\n\t}\n\t_attachEvent() {\n\t\tthis.fusionPoseSensor.on(\"change\", this._onPoseChange);\n\t}\n\t_dettachEvent() {\n\t\tthis.fusionPoseSensor.off(\"change\", this._onPoseChange);\n\t}\n}\n","import {\n\tutil as mathUtil,\n\tROTATE_CONSTANT,\n} from \"../utils/math-util\";\n\nexport function toAxis(source, offset) {\n\treturn offset.reduce((acc, v, i) => {\n\t\tif (source[i]) {\n\t\t\tacc[source[i]] = v;\n\t\t}\n\t\treturn acc;\n\t}, {});\n}\n\nexport function getDeltaYaw(prvQ, curQ) {\n\tconst yawDeltaByYaw = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_YAW);\n\tconst yawDeltaByRoll = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.YAW_DELTA_BY_ROLL) *\n\t\tMath.sin(mathUtil.extractPitchFromQuat(curQ));\n\n\treturn yawDeltaByRoll + yawDeltaByYaw;\n}\n\nexport function getDeltaPitch(prvQ, curQ) {\n\tconst pitchDelta = mathUtil.getRotationDelta(prvQ, curQ, ROTATE_CONSTANT.PITCH_DELTA);\n\n\treturn pitchDelta;\n}\n","import {glMatrix} from \"gl-matrix\";\nimport {window} from \"../utils/browser\";\n\n// Singleton\nlet screenRotationAngleInst = null;\nlet refCount = 0;\n\nexport default class ScreenRotationAngle {\n\tconstructor() {\n\t\trefCount++;\n\n\t\tif (screenRotationAngleInst) {\n\t\t\treturn screenRotationAngleInst;\n\t\t}\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = this;\n\t\t/* eslint-enable */\n\t\tthis._onDeviceOrientation = this._onDeviceOrientation.bind(this);\n\t\tthis._onOrientationChange = this._onOrientationChange.bind(this);\n\n\t\tthis._spinR = 0;\n\n\t\tthis._screenOrientationAngle = 0;\n\t\twindow.addEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.addEventListener(\"orientationchange\", this._onOrientationChange);\n\t}\n\n\t_onDeviceOrientation(e) {\n\t\tif (e.beta === null || e.gamma === null) {\n\t\t\t// (Chrome) deviceorientation is fired with invalid information {alpha=null, beta=null, ...} despite of not dispatching it. We skip it.\n\t\t\treturn;\n\t\t}\n\n\t\t// Radian\n\t\tconst betaR = glMatrix.toRadian(e.beta);\n\t\tconst gammaR = glMatrix.toRadian(e.gamma);\n\n\t\t/* spinR range = [-180, 180], left side: 0 ~ -180(deg), right side: 0 ~ 180(deg) */\n\t\tthis._spinR = Math.atan2(Math.cos(betaR) * Math.sin(gammaR), Math.sin(betaR));\n\t}\n\n\t_onOrientationChange(e) {\n\t\tif (window.screen && window.screen.orientation && window.screen.orientation.angle !== undefined) {\n\t\t\tthis._screenOrientationAngle = screen.orientation.angle;\n\t\t} else if (window.orientation !== undefined) {\n\t\t\t/* iOS */\n\t\t\tthis._screenOrientationAngle = window.orientation >= 0 ?\n\t\t\t\twindow.orientation : 360 + window.orientation;\n\t\t}\n\t}\n\n\tgetRadian() {\n\t\t// Join with screen orientation\n\t\t// this._testVal = this._spinR + \", \" + this._screenOrientationAngle + \", \" + window.orientation;\n\t\treturn this._spinR + glMatrix.toRadian(this._screenOrientationAngle);\n\t}\n\n\tunref() {\n\t\tif (--refCount > 0) {\n\t\t\treturn;\n\t\t}\n\n\t\twindow.removeEventListener(\"deviceorientation\", this._onDeviceOrientation);\n\t\twindow.removeEventListener(\"orientationchange\", this._onOrientationChange);\n\n\t\tthis._spinR = 0;\n\t\tthis._screenOrientationAngle = 0;\n\t\t/* eslint-disable */\n\t\tscreenRotationAngleInst = null;\n\t\t/* eslint-enable */\n\t\trefCount = 0;\n\t}\n}\n","import Axes, {PanInput} from \"@egjs/axes\";\nimport ScreenRotationAngle from \"../ScreenRotationAngle\";\n\n/**\n * RotationPanInput is extension of PanInput to compensate coordinates by screen rotation angle.\n *\n * The reason for using this function is that in VR mode,\n * the roll angle is adjusted in the direction opposite to the screen rotation angle.\n *\n * Therefore, the angle that the user touches and moves does not match the angle at which the actual object should move.\n * @extends PanInput\n */\nexport default class RotationPanInput extends PanInput {\n\t/**\n\t * Constructor\n\t *\n\t * @private\n\t * @param {HTMLElement} el target element\n\t * @param {Object} [options] The option object\n\t * @param {Boolean} [options.useRotation] Whether to use rotation(or VR)\n\t */\n\tconstructor(el, options) {\n\t\tsuper(el, options);\n\n\t\tthis._useRotation = false;\n\t\tthis._screenRotationAngle = null;\n\n\t\tthis.setUseRotation(!!(options && options.useRotation));\n\n\t\tthis._userDirection = Axes.DIRECTION_ALL;\n\t}\n\n\tsetUseRotation(useRotation) {\n\t\tthis._useRotation = useRotation;\n\n\t\tif (this._screenRotationAngle) {\n\t\t\tthis._screenRotationAngle.unref();\n\t\t\tthis._screenRotationAngle = null;\n\t\t}\n\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle = new ScreenRotationAngle();\n\t\t}\n\t}\n\n\tconnect(observer) {\n\t\t// User intetened direction\n\t\tthis._userDirection = this._direction;\n\n\t\t// In VR Mode, Use ALL direction if direction is not none\n\t\t// Because horizontal and vertical is changed dynamically by screen rotation.\n\t\t// this._direction is used to initialize hammerjs\n\t\tif (this._useRotation && (this._direction & Axes.DIRECTION_ALL)) {\n\t\t\tthis._direction = Axes.DIRECTION_HORIZONTAL;\n\t\t}\n\n\t\tsuper.connect(observer);\n\t}\n\n\tgetOffset(properties, useDirection) {\n\t\tif (this._useRotation === false) {\n\t\t\treturn super.getOffset(properties, useDirection);\n\t\t}\n\n\t\tconst offset = super.getOffset(properties, [true, true]);\n\t\tconst newOffset = [0, 0];\n\n\t\tconst theta = this._screenRotationAngle.getRadian();\n\n\t\tconst cosTheta = Math.cos(theta);\n\t\tconst sinTheta = Math.sin(theta);\n\n\t\t// RotateZ\n\t\tnewOffset[0] = offset[0] * cosTheta - offset[1] * sinTheta;\n\t\tnewOffset[1] = offset[1] * cosTheta + offset[0] * sinTheta;\n\n\t\t// Use only user allowed direction.\n\t\tif (!(this._userDirection & Axes.DIRECTION_HORIZONTAL)) {\n\t\t\tnewOffset[0] = 0;\n\t\t} else if (!(this._userDirection & Axes.DIRECTION_VERTICAL)) {\n\t\t\tnewOffset[1] = 0;\n\t\t}\n\n\t\treturn newOffset;\n\t}\n\n\tdestroy() {\n\t\tif (this._useRotation) {\n\t\t\tthis._screenRotationAngle && this._screenRotationAngle.unref();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n\n/**\n * Override getDirectionByAngle to return DIRECTION_ALL\n * Ref: https://github.com/naver/egjs-axes/issues/99\n *\n * But we obey axes's rule. If axes's rule is problem, let's apply following code.\n */\n// PanInput.getDirectionByAngle = function (angle, thresholdAngle) {\n// \treturn DIRECTION_ALL;\n// };\n","import Component from \"@egjs/component\";\nimport {vec3, glMatrix, quat} from \"gl-matrix\";\nimport FusionPoseSensor from \"./input/FusionPoseSensor\";\n\nconst Y_AXIS_VECTOR = vec3.fromValues(0, 1, 0);\n\nexport default class DeviceQuaternion extends Component {\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._fusionPoseSensor = new FusionPoseSensor();\n\t\tthis._quaternion = quat.create();\n\n\t\tthis._fusionPoseSensor.enable();\n\t\tthis._fusionPoseSensor.on(\"change\", e => {\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis.trigger(\"change\", {isTrusted: true});\n\t\t});\n\t}\n\n\tgetCombinedQuaternion(yaw) {\n\t\tconst yawQ = quat.setAxisAngle(quat.create(), Y_AXIS_VECTOR, glMatrix.toRadian(-yaw));\n\t\tconst conj = quat.conjugate(quat.create(), this._quaternion);\n\t\t// Multiply pitch quaternion -> device quaternion -> yaw quaternion\n\t\tconst outQ = quat.multiply(quat.create(), conj, yawQ);\n\n\t\treturn outQ;\n\t}\n\n\tdestroy() {\n\t\t// detach all event handler\n\t\tthis.off();\n\n\t\tif (this._fusionPoseSensor) {\n\t\t\tthis._fusionPoseSensor.off();\n\t\t\tthis._fusionPoseSensor.destroy();\n\t\t\tthis._fusionPoseSensor = null;\n\t\t}\n\t}\n}\n","const VERSION = \"#__VERSION__#\";\n\nexport {\n\tVERSION\n};\n","import Component from \"@egjs/component\";\nimport Axes, {PinchInput, MoveKeyInput, WheelInput} from \"@egjs/axes\";\nimport {vec2, glMatrix} from \"gl-matrix\";\nimport {getComputedStyle, SUPPORT_TOUCH, SUPPORT_DEVICEMOTION} from \"../utils/browserFeature\";\nimport TiltMotionInput from \"./input/TiltMotionInput\";\nimport RotationPanInput from \"./input/RotationPanInput\";\nimport DeviceQuaternion from \"./DeviceQuaternion\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {\n\tGYRO_MODE,\n\tTOUCH_DIRECTION_YAW,\n\tTOUCH_DIRECTION_PITCH,\n\tTOUCH_DIRECTION_ALL,\n\tMC_DECELERATION,\n\tMC_MAXIMUM_DURATION,\n\tMC_BIND_SCALE,\n\tMAX_FIELD_OF_VIEW,\n\tPAN_SCALE,\n\tYAW_RANGE_HALF,\n\tPITCH_RANGE_HALF,\n\tCIRCULAR_PITCH_RANGE_HALF,\n\tCONTROL_MODE_VR,\n\tCONTROL_MODE_YAWPITCH,\n\tTOUCH_DIRECTION_NONE,\n} from \"./consts\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_YAW_RANGE = [-YAW_RANGE_HALF, YAW_RANGE_HALF];\nconst DEFAULT_PITCH_RANGE = [-PITCH_RANGE_HALF, PITCH_RANGE_HALF];\nconst CIRCULAR_PITCH_RANGE = [-CIRCULAR_PITCH_RANGE_HALF, CIRCULAR_PITCH_RANGE_HALF];\n\n/**\n * A module used to provide coordinate based on yaw/pitch orientation. This module receives user touch action, keyboard, mouse and device orientation(if it exists) as input, then combines them and converts it to yaw/pitch coordinates.\n *\n * @alias eg.YawPitchControl\n * @extends eg.Component\n *\n * @support {\"ie\": \"10+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n */\nclass YawPitchControl extends Component {\n\tstatic VERSION = VERSION;\n\t// Expose DeviceOrientationControls sub module for test purpose\n\tstatic CONTROL_MODE_VR = CONTROL_MODE_VR;\n\tstatic CONTROL_MODE_YAWPITCH = CONTROL_MODE_YAWPITCH;\n\tstatic TOUCH_DIRECTION_ALL = TOUCH_DIRECTION_ALL;\n\tstatic TOUCH_DIRECTION_YAW = TOUCH_DIRECTION_YAW;\n\tstatic TOUCH_DIRECTION_PITCH = TOUCH_DIRECTION_PITCH;\n\tstatic TOUCH_DIRECTION_NONE = TOUCH_DIRECTION_NONE;\n\t/**\n\t * @param {Object} options The option object of the eg.YawPitch module\n\t * @param {Element}[options.element=null] element A base element for the eg.YawPitch module\n\t * @param {Number} [options.yaw=0] initial yaw (degree)\n\t * @param {Number} [options.pitch=0] initial pitch (degree)\n\t * @param {Number} [options.fov=65] initial field of view (degree)\n\t * @param {Boolean} [optiosn.showPolePoint=true] Indicates whether pole is shown\n\t * @param {Boolean} [options.useZoom=true] Indicates whether zoom is available\n\t * @param {Boolean} [options.useKeyboard=true] Indicates whether keyboard is enabled\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion.\n\t * @param {Number} [options.touchDirection=TOUCH_DIRECTION_ALL] Direction of the touch movement (TOUCH_DIRECTION_ALL: all, TOUCH_DIRECTION_YAW: horizontal, TOUCH_DIRECTION_PITCH: vertical, TOUCH_DIRECTION_NONE: no move)\n\t * @param {Array} [options.yawRange=[-180, 180] Range of visible yaw\n\t * @param {Array} [options.pitchRange=[-90, 90] Range of visible pitch\n\t * @param {Array} [options.fovRange=[30, 110] Range of FOV\n\t * @param {Number} [options.aspectRatio=1] Aspect Ratio\n\t */\n\tconstructor(options) {\n\t\tsuper();\n\n\t\tconst opt = Object.assign({\n\t\t\telement: null,\n\t\t\tyaw: 0,\n\t\t\tpitch: 0,\n\t\t\tfov: 65,\n\t\t\tshowPolePoint: false,\n\t\t\tuseZoom: true,\n\t\t\tuseKeyboard: true,\n\t\t\tgyroMode: GYRO_MODE.YAWPITCH,\n\t\t\ttouchDirection: TOUCH_DIRECTION_ALL,\n\t\t\tyawRange: DEFAULT_YAW_RANGE,\n\t\t\tpitchRange: DEFAULT_PITCH_RANGE,\n\t\t\tfovRange: [30, 110],\n\t\t\taspectRatio: 1, /* TODO: Need Mandatory? */\n\t\t}, options);\n\n\t\tthis._element = opt.element;\n\t\tthis._initialFov = opt.fov;\n\t\tthis._enabled = false;\n\t\tthis._isAnimating = false;\n\t\tthis._deviceQuaternion = null;\n\n\t\tthis._initAxes(opt);\n\t\tthis.option(opt);\n\t}\n\n\t_initAxes(opt) {\n\t\tconst yRange = this._updateYawRange(opt.yawRange, opt.fov, opt.aspectRatio);\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, opt.fov, opt.showPolePoint);\n\t\tconst useRotation = opt.gyroMode === GYRO_MODE.VR;\n\n\t\tthis.axesPanInput = new RotationPanInput(this._element, {useRotation});\n\t\tthis.axesWheelInput = new WheelInput(this._element, {scale: -4});\n\t\tthis.axesTiltMotionInput = null;\n\t\tthis.axesPinchInput = SUPPORT_TOUCH ? new PinchInput(this._element, {scale: -1}) : null;\n\t\tthis.axesMoveKeyInput = new MoveKeyInput(this._element, {scale: [-6, 6]});\n\n\t\tthis.axes = new Axes({\n\t\t\tyaw: {\n\t\t\t\trange: yRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(yRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tpitch: {\n\t\t\t\trange: pRange,\n\t\t\t\tcircular: YawPitchControl.isCircular(pRange),\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t\tfov: {\n\t\t\t\trange: opt.fovRange,\n\t\t\t\tcircular: [false, false],\n\t\t\t\tbounce: [0, 0]\n\t\t\t},\n\t\t}, {\n\t\t\tdeceleration: MC_DECELERATION,\n\t\t\tmaximumDuration: MC_MAXIMUM_DURATION\n\t\t}, {\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov\n\t\t}).on({\n\t\t\thold: evt => {\n\t\t\t\t// Restore maximumDuration not to be spin too mush.\n\t\t\t\tthis.axes.options.maximumDuration = MC_MAXIMUM_DURATION;\n\n\t\t\t\tthis.trigger(\"hold\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t\tchange: evt => {\n\t\t\t\tif (evt.delta.fov !== 0) {\n\t\t\t\t\tthis._updateControlScale(evt);\n\t\t\t\t\tthis.updatePanScale();\n\t\t\t\t}\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\trelease: evt => {\n\t\t\t\tthis._triggerChange(evt);\n\t\t\t},\n\t\t\tanimationStart: evt => {\n\t\t\t},\n\t\t\tanimationEnd: evt => {\n\t\t\t\tthis.trigger(\"animationEnd\", {isTrusted: evt.isTrusted});\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * Update Pan Scale\n\t *\n\t * Scale(Sensitivity) values of panning is related with fov and height.\n\t * If at least one of them is changed, this function need to be called.\n\t * @param {*} param\n\t */\n\tupdatePanScale(param = {}) {\n\t\tconst fov = this.axes.get().fov;\n\t\tconst areaHeight = param.height || parseInt(getComputedStyle(this._element).height, 10);\n\t\tconst scale = MC_BIND_SCALE[0] * fov / this._initialFov * PAN_SCALE / areaHeight;\n\n\t\tthis.axesPanInput.options.scale = [scale, scale];\n\t\tthis.axes.options.deceleration = MC_DECELERATION * fov / MAX_FIELD_OF_VIEW;\n\n\t\treturn this;\n\t}\n\n\t/*\n\t * Override component's option method\n\t * to call method for updating values which is affected by option change.\n\t *\n\t * @param {*} args\n\t */\n\toption(...args) {\n\t\tconst argLen = args.length;\n\n\t\t// Getter\n\t\tif (argLen === 0) {\n\t\t\treturn this._getOptions();\n\t\t} else if (argLen === 1 && typeof args[0] === \"string\") {\n\t\t\treturn this._getOptions(args[0]);\n\t\t}\n\n\t\t// Setter\n\t\tconst beforeOptions = Object.assign({}, this.options);\n\t\tlet newOptions = {};\n\t\tlet changedKeyList = []; // TODO: if value is not changed, then do not push on changedKeyList.\n\n\t\tif (argLen === 1) {\n\t\t\tchangedKeyList = Object.keys(args[0]);\n\t\t\tnewOptions = Object.assign({}, args[0]);\n\t\t} else if (argLen >= 2) {\n\t\t\tchangedKeyList.push(args[0]);\n\t\t\tnewOptions[args[0]] = args[1];\n\t\t}\n\n\t\tthis._setOptions(this._getValidatedOptions(newOptions));\n\t\tthis._applyOptions(changedKeyList, beforeOptions);\n\t\treturn this;\n\t}\n\n\t_getValidatedOptions(newOptions) {\n\t\tif (newOptions.yawRange) {\n\t\t\tnewOptions.yawRange =\n\t\t\t\tthis._getValidYawRange(newOptions.yawRange, newOptions.fov, newOptions.aspectRatio);\n\t\t}\n\t\tif (newOptions.pitchRange) {\n\t\t\tnewOptions.pitchRange = this._getValidPitchRange(newOptions.pitchRange, newOptions.fov);\n\t\t}\n\t\treturn newOptions;\n\t}\n\n\t_getOptions(key) {\n\t\tlet value;\n\n\t\tif (typeof key === \"string\") {\n\t\t\tvalue = this.options[key];\n\t\t} else if (arguments.length === 0) {\n\t\t\tvalue = this.options;\n\t\t}\n\t\treturn value;\n\t}\n\n\t_setOptions(options) {\n\t\tfor (const key in options) {\n\t\t\tthis.options[key] = options[key];\n\t\t}\n\t}\n\n\t_applyOptions(keys, prevOptions) {\n\t\tconst options = this.options;\n\t\tconst axes = this.axes;\n\t\tconst isVR = options.gyroMode === GYRO_MODE.VR;\n\t\tconst isYawPitch = options.gyroMode === GYRO_MODE.YAWPITCH;\n\t\t// If it's VR mode, restrict user interaction to yaw direction only\n\t\tconst touchDirection = isVR ?\n\t\t\t(TOUCH_DIRECTION_YAW & options.touchDirection) :\n\t\t\toptions.touchDirection;\n\n\t\t// If one of below is changed, call updateControlScale()\n\t\tif (keys.some(key =>\n\t\t\tkey === \"showPolePoint\" || key === \"fov\" || key === \"aspectRatio\" ||\n\t\t\tkey === \"yawRange\" || key === \"pitchRange\"\n\t\t)) {\n\t\t\t// If fov is changed, update pan scale\n\t\t\tif (keys.indexOf(\"fov\") >= 0) {\n\t\t\t\taxes.setTo({\"fov\": options.fov});\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\n\t\t\tthis._updateControlScale();\n\t\t}\n\n\t\tif (keys.some(key => key === \"fovRange\")) {\n\t\t\tconst fovRange = options.fovRange;\n\t\t\tconst prevFov = axes.get().fov;\n\t\t\tlet nextFov = axes.get().fov;\n\n\t\t\tvec2.copy(axes.axis.fov.range, fovRange);\n\n\t\t\tif (nextFov < fovRange[0]) {\n\t\t\t\tnextFov = fovRange[0];\n\t\t\t} else if (prevFov > fovRange[1]) {\n\t\t\t\tnextFov = fovRange[1];\n\t\t\t}\n\n\t\t\tif (prevFov !== nextFov) {\n\t\t\t\taxes.setTo({\n\t\t\t\t\tfov: nextFov\n\t\t\t\t}, 0);\n\t\t\t\tthis._updateControlScale();\n\t\t\t\tthis.updatePanScale();\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"gyroMode\") && SUPPORT_DEVICEMOTION) {\n\t\t\t// Disconnect first\n\t\t\tif (this.axesTiltMotionInput) {\n\t\t\t\tthis.axes.disconnect(this.axesTiltMotionInput);\n\t\t\t\tthis.axesTiltMotionInput.destroy();\n\t\t\t\tthis.axesTiltMotionInput = null;\n\t\t\t}\n\n\t\t\tif (this._deviceQuaternion) {\n\t\t\t\tthis._deviceQuaternion.destroy();\n\t\t\t\tthis._deviceQuaternion = null;\n\t\t\t}\n\n\t\t\tif (isVR) {\n\t\t\t\tthis._initDeviceQuaternion();\n\t\t\t} else if (isYawPitch) {\n\t\t\t\tthis.axesTiltMotionInput = new TiltMotionInput(this._element);\n\t\t\t\tthis.axes.connect([\"yaw\", \"pitch\"], this.axesTiltMotionInput);\n\t\t\t}\n\n\t\t\tthis.axesPanInput.setUseRotation(isVR);\n\t\t}\n\n\t\tif (keys.some(key => key === \"useKeyboard\")) {\n\t\t\tconst useKeyboard = options.useKeyboard;\n\n\t\t\tif (useKeyboard) {\n\t\t\t\taxes.connect([\"yaw\", \"pitch\"], this.axesMoveKeyInput);\n\t\t\t} else {\n\t\t\t\taxes.disconnect(this.axesMoveKeyInput);\n\t\t\t}\n\t\t}\n\n\t\tif (keys.some(key => key === \"useZoom\")) {\n\t\t\tconst useZoom = options.useZoom;\n\n\t\t\t// Disconnect first\n\t\t\taxes.disconnect(this.axesWheelInput);\n\t\t\tif (useZoom) {\n\t\t\t\taxes.connect([\"fov\"], this.axesWheelInput);\n\t\t\t}\n\t\t}\n\n\t\tthis._togglePinchInputByOption(options.touchDirection, options.useZoom);\n\n\t\tif (keys.some(key => key === \"touchDirection\")) {\n\t\t\tthis._enabled && this._enableTouch(touchDirection);\n\t\t}\n\t}\n\n\t_togglePinchInputByOption(touchDirection, useZoom) {\n\t\tif (this.axesPinchInput) {\n\t\t\t// disconnect first\n\t\t\tthis.axes.disconnect(this.axesPinchInput);\n\n\t\t\t// If the touchDirection option is not ALL, pinchInput should be disconnected to make use of a native scroll.\n\t\t\tif (\n\t\t\t\tuseZoom &&\n\t\t\t\ttouchDirection === TOUCH_DIRECTION_ALL &&\n\t\t\t\t// TODO: Get rid of using private property of axes instance.\n\t\t\t\tthis.axes._inputs.indexOf(this.axesPinchInput) === -1\n\t\t\t) {\n\t\t\t\tthis.axes.connect([\"fov\"], this.axesPinchInput);\n\t\t\t}\n\t\t}\n\t}\n\n\t_enableTouch(direction) {\n\t\t// Disconnect first\n\t\tthis.axesPanInput && this.axes.disconnect(this.axesPanInput);\n\n\t\tconst yawEnabled = direction & TOUCH_DIRECTION_YAW ? \"yaw\" : null;\n\t\tconst pitchEnabled = direction & TOUCH_DIRECTION_PITCH ? \"pitch\" : null;\n\n\t\tthis.axes.connect([yawEnabled, pitchEnabled], this.axesPanInput);\n\t}\n\n\t_initDeviceQuaternion() {\n\t\tthis._deviceQuaternion = new DeviceQuaternion();\n\t\tthis._deviceQuaternion.on(\"change\", e => {\n\t\t\tthis._triggerChange(e);\n\t\t});\n\t}\n\n\t_getValidYawRange(newYawRange, newFov, newAspectRatio) {\n\t\tconst ratio = YawPitchControl.adjustAspectRatio(newAspectRatio || this.options.aspectRatio || 1);\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst horizontalFov = fov * ratio;\n\t\tconst isValid = newYawRange[1] - newYawRange[0] >= horizontalFov;\n\n\t\tif (isValid) {\n\t\t\treturn newYawRange;\n\t\t} else {\n\t\t\treturn this.options.yawRange || DEFAULT_YAW_RANGE;\n\t\t}\n\t}\n\n\t_getValidPitchRange(newPitchRange, newFov) {\n\t\tconst fov = newFov || this.axes.get().fov;\n\t\tconst isValid = newPitchRange[1] - newPitchRange[0] >= fov;\n\n\t\tif (isValid) {\n\t\t\treturn newPitchRange;\n\t\t} else {\n\t\t\treturn this.options.pitchRange || DEFAULT_PITCH_RANGE;\n\t\t}\n\t}\n\n\tstatic isCircular(range) {\n\t\treturn range[1] - range[0] < 360 ? [false, false] : [true, true];\n\t}\n\n\t/**\n\t * Update yaw/pitch min/max by 5 factor\n\t *\n\t * 1. showPolePoint\n\t * 2. fov\n\t * 3. yawRange\n\t * 4. pitchRange\n\t * 5. aspectRatio\n\t *\n\t * If one of above is changed, call this function\n\t */\n\t_updateControlScale(changeEvt) {\n\t\tconst opt = this.options;\n\t\tconst fov = this.axes.get().fov;\n\n\t\tconst pRange = this._updatePitchRange(opt.pitchRange, fov, opt.showPolePoint);\n\t\tconst yRange = this._updateYawRange(opt.yawRange, fov, opt.aspectRatio);\n\n\t\t// TODO: If not changed!?\n\t\tconst pos = this.axes.get();\n\t\tlet y = pos.yaw;\n\t\tlet p = pos.pitch;\n\n\t\tvec2.copy(this.axes.axis.yaw.range, yRange);\n\t\tvec2.copy(this.axes.axis.pitch.range, pRange);\n\t\tthis.axes.axis.yaw.circular = YawPitchControl.isCircular(yRange);\n\t\tthis.axes.axis.pitch.circular = YawPitchControl.isCircular(pRange);\n\n\t\t/**\n\t\t * update yaw/pitch by it's range.\n\t\t */\n\t\tif (y < yRange[0]) {\n\t\t\ty = yRange[0];\n\t\t} else if (y > yRange[1]) {\n\t\t\ty = yRange[1];\n\t\t}\n\n\t\tif (p < pRange[0]) {\n\t\t\tp = pRange[0];\n\t\t} else if (p > pRange[1]) {\n\t\t\tp = pRange[1];\n\t\t}\n\n\t\tif (changeEvt) {\n\t\t\tchangeEvt.set({\n\t\t\t\tyaw: y,\n\t\t\t\tpitch: p,\n\t\t\t});\n\t\t}\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\t_updatePitchRange(pitchRange, fov, showPolePoint) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\t// Circular pitch on VR\n\t\t\treturn CIRCULAR_PITCH_RANGE;\n\t\t}\n\n\t\tconst verticalAngle = pitchRange[1] - pitchRange[0];\n\t\tconst halfFov = fov / 2;\n\t\tconst isPanorama = verticalAngle < 180;\n\n\t\tif (showPolePoint && !isPanorama) {\n\t\t\t// Use full pinch range\n\t\t\treturn pitchRange.concat();\n\t\t}\n\n\t\t// Round value as movableCood do.\n\t\treturn [pitchRange[0] + halfFov, pitchRange[1] - halfFov];\n\t}\n\n\t_updateYawRange(yawRange, fov, aspectRatio) {\n\t\tif (this.options.gyroMode === GYRO_MODE.VR) {\n\t\t\treturn DEFAULT_YAW_RANGE;\n\t\t}\n\n\t\tconst horizontalAngle = yawRange[1] - yawRange[0];\n\n\t\t/**\n\t\t * Full 360 Mode\n\t\t */\n\t\tif (horizontalAngle >= 360) {\n\t\t\t// Don't limit yaw range on Full 360 mode.\n\t\t\treturn yawRange.concat();\n\t\t}\n\n\t\t/**\n\t\t * Panorama mode\n\t\t */\n\t\t// Ref : https://github.com/naver/egjs-view360/issues/290\n\t\tconst halfHorizontalFov =\n\t\t\tmathUtil.toDegree(Math.atan2(aspectRatio, 1 / Math.tan(glMatrix.toRadian(fov / 2))));\n\n\t\t// Round value as movableCood do.\n\t\treturn [\n\t\t\tyawRange[0] + halfHorizontalFov,\n\t\t\tyawRange[1] - halfHorizontalFov\n\t\t];\n\t}\n\n\t_triggerChange(evt) {\n\t\tconst pos = this.axes.get();\n\t\tconst opt = this.options;\n\t\tconst event = {\n\t\t\ttargetElement: opt.element,\n\t\t\tisTrusted: evt.isTrusted,\n\t\t};\n\n\t\tevent.yaw = pos.yaw;\n\t\tevent.pitch = pos.pitch;\n\t\tevent.fov = pos.fov;\n\n\t\tif (opt.gyroMode === GYRO_MODE.VR && this._deviceQuaternion) {\n\t\t\tevent.quaternion = this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t\t}\n\t\tthis.trigger(\"change\", event);\n\t}\n\n\t// TODO: makes constant to be logic\n\tstatic adjustAspectRatio(input) {\n\t\tconst inputRange = [\n\t\t\t0.520, 0.540, 0.563, 0.570, 0.584, 0.590, 0.609, 0.670,\n\t\t\t0.702, 0.720, 0.760, 0.780, 0.820, 0.920, 0.970, 1.00, 1.07, 1.14, 1.19,\n\t\t\t1.25, 1.32, 1.38, 1.40, 1.43, 1.53, 1.62, 1.76, 1.77, 1.86, 1.96, 2.26,\n\t\t\t2.30, 2.60, 3.00, 5.00, 6.00\n\t\t];\n\t\tconst outputRange = [\n\t\t\t0.510, 0.540, 0.606, 0.560, 0.628, 0.630, 0.647, 0.710,\n\t\t\t0.736, 0.757, 0.780, 0.770, 0.800, 0.890, 0.975, 1.00, 1.07, 1.10, 1.15,\n\t\t\t1.18, 1.22, 1.27, 1.30, 1.33, 1.39, 1.45, 1.54, 1.55, 1.58, 1.62, 1.72,\n\t\t\t1.82, 1.92, 2.00, 2.24, 2.30\n\t\t];\n\n\t\tlet rangeIdx = -1;\n\n\t\tfor (let i = 0; i < inputRange.length - 1; i++) {\n\t\t\tif (inputRange[i] <= input && inputRange[i + 1] >= input) {\n\t\t\t\trangeIdx = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (rangeIdx === -1) {\n\t\t\tif (inputRange[0] > input) {\n\t\t\t\treturn outputRange[0];\n\t\t\t} else {\n\t\t\t\treturn outputRange[outputRange[0].length - 1];\n\t\t\t}\n\t\t}\n\n\t\tconst inputA = inputRange[rangeIdx];\n\t\tconst inputB = inputRange[rangeIdx + 1];\n\t\tconst outputA = outputRange[rangeIdx];\n\t\tconst outputB = outputRange[rangeIdx + 1];\n\n\t\treturn YawPitchControl.lerp(outputA, outputB, (input - inputA) / (inputB - inputA));\n\t}\n\n\tstatic lerp(a, b, fraction) {\n\t\treturn a + fraction * (b - a);\n\t}\n\n\t/**\n\t * Enable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#enable\n\t */\n\tenable() {\n\t\tif (this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._enabled = true;\n\n\t\t// touchDirection is decided by parameter is valid string (Ref. Axes.connect)\n\t\tthis._applyOptions(Object.keys(this.options), this.options);\n\n\t\t// TODO: Is this code is needed? Check later.\n\t\tthis.updatePanScale();\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Disable YawPitch functionality\n\t *\n\t * @method eg.YawPitch#disable\n\t */\n\tdisable(persistOrientation) {\n\t\tif (!this._enabled) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// TODO: Check peristOrientation is needed!\n\t\tif (!persistOrientation) {\n\t\t\tthis._resetOrientation();\n\t\t}\n\t\tthis.axes.disconnect();\n\t\tthis._enabled = false;\n\t\treturn this;\n\t}\n\n\t_resetOrientation() {\n\t\tconst opt = this.options;\n\n\t\tthis.axes.setTo({\n\t\t\tyaw: opt.yaw,\n\t\t\tpitch: opt.pitch,\n\t\t\tfov: opt.fov,\n\t\t}, 0);\n\n\t\treturn this;\n\t}\n\n\n\t/**\n\t * Set one or more of yaw, pitch, fov\n\t *\n\t * @param {Object} coordinate yaw, pitch, fov\n\t * @param {Number} duration Animation duration. if it is above 0 then it's animated.\n\t */\n\tlookAt({yaw, pitch, fov}, duration) {\n\t\tconst pos = this.axes.get();\n\n\t\tconst y = yaw === undefined ? 0 : yaw - pos.yaw;\n\t\tconst p = pitch === undefined ? 0 : pitch - pos.pitch;\n\t\tconst f = fov === undefined ? 0 : fov - pos.fov;\n\n\t\t// Allow duration of animation to have more than MC_MAXIMUM_DURATION.\n\t\tthis.axes.options.maximumDuration = Infinity;\n\n\t\tthis.axes.setBy({\n\t\t\tyaw: y,\n\t\t\tpitch: p,\n\t\t\tfov: f\n\t\t}, duration);\n\t}\n\n\tgetYawPitch() {\n\t\tconst yawPitch = this.axes.get();\n\n\t\treturn {\n\t\t\tyaw: yawPitch.yaw,\n\t\t\tpitch: yawPitch.pitch,\n\t\t};\n\t}\n\n\tgetFov() {\n\t\treturn this.axes.get().fov;\n\t}\n\n\tgetQuaternion() {\n\t\tconst pos = this.axes.get();\n\n\t\treturn this._deviceQuaternion.getCombinedQuaternion(pos.yaw);\n\t}\n\n\tshouldRenderWithQuaternion() {\n\t\treturn this.options.gyroMode === GYRO_MODE.VR;\n\t}\n\n\t/**\n\t * Destroys objects\n\t */\n\tdestroy() {\n\t\tthis.axes && this.axes.destroy();\n\t\tthis.axisPanInput && this.axisPanInput.destroy();\n\t\tthis.axesWheelInput && this.axesWheelInput.destroy();\n\t\tthis.axesTiltMotionInput && this.axesTiltMotionInput.destroy();\n\t\tthis.axesDeviceOrientationInput && this.axesDeviceOrientationInput.destroy();\n\t\tthis.axesPinchInput && this.axesPinchInput.destroy();\n\t\tthis.axesMoveKeyInput && this.axesMoveKeyInput.destroy();\n\t\tthis._deviceQuaternion && this._deviceQuaternion.destroy();\n\t}\n}\n\nexport default YawPitchControl;\n","import Component from \"@egjs/component\";\n\nconst STATUS = {\n\t\"NONE\": 0,\n\t\"LOADING\": 1,\n\t\"LOADED\": 2,\n\t\"ERROR\": 3\n};\n\nconst EVENT = {\n\t\"READYSTATECHANGE\": \"readystatechange\"\n};\n\nclass ImageLoader extends Component {\n\tstatic STATUS = STATUS;\n\tconstructor(image) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis._image = null;\n\t\tthis._onceHandlers = [];\n\t\tthis._loadStatus = STATUS.NONE;\n\n\t\timage && this.set(image);\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._image) {\n\t\t\t\trej(\"ImageLoader: image is not defiend\");\n\t\t\t} else if (this._loadStatus === STATUS.LOADED) {\n\t\t\t\tres(this.getElement());\n\t\t\t} else if (this._loadStatus === STATUS.LOADING) {\n\t\t\t\t/* Check isMaybeLoaded() first because there may have\n\t\t\t\t\tposibilities that image already loaded before get is called.\n\t\t\t\t\tfor example calling get on external image onload callback.*/\n\t\t\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\t\tres(this.getElement());\n\t\t\t\t} else {\n\t\t\t\t\tthis.on(EVENT.READYSTATECHANGE, e => {\n\t\t\t\t\t\tif (e.type === STATUS.LOADED) {\n\t\t\t\t\t\t\tres(this.getElement());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\trej(\"ImageLoader: failed to load images.\");\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\trej(\"ImageLoader: failed to load images\");\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * @param image img element or img url or array of img element or array of img url\n\t */\n\tset(image) {\n\t\tthis._loadStatus = STATUS.LOADING;\n\n\t\tthis._image = ImageLoader.createElement(image);\n\n\t\tif (ImageLoader.isMaybeLoaded(this._image)) {\n\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.onceLoaded(\n\t\t\tthis._image,\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.LOADED;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.LOADED\n\t\t\t\t});\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tthis._loadStatus = STATUS.ERROR;\n\t\t\t\tthis.trigger(EVENT.READYSTATECHANGE, {\n\t\t\t\t\ttype: STATUS.ERROR\n\t\t\t\t});\n\t\t\t}\n\t\t);\n\t}\n\n\tstatic createElement(image) {\n\t\tconst images = image instanceof Array ? image : [image];\n\n\t\treturn images.map(img => {\n\t\t\tlet _img = img;\n\n\t\t\tif (typeof img === \"string\") {\n\t\t\t\t_img = new Image();\n\t\t\t\t_img.crossOrigin = \"anonymous\";\n\t\t\t\t_img.src = img;\n\t\t\t}\n\t\t\treturn _img;\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._image.length === 1 ? this._image[0] : this._image;\n\t}\n\n\tstatic isMaybeLoaded(image) {\n\t\tlet result = false;\n\n\t\tif (image instanceof Image) {\n\t\t\tresult = image.complete && image.naturalWidth !== 0;\n\t\t} else if (image instanceof Array) {\n\t\t\tresult = !image.some(img => !img.complete || img.naturalWidth === 0);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tonceLoaded(target, onload, onerror) {\n\t\tconst targets = target instanceof Array ? target : [target];\n\t\tconst targetsNotLoaded = targets.filter(img => !ImageLoader.isMaybeLoaded(img));\n\t\tconst loadPromises = targetsNotLoaded.map(img => new Promise((res, rej) => {\n\t\t\tthis._once(img, \"load\", () => (res(img)));\n\t\t\tthis._once(img, \"error\", () => (rej(img)));\n\t\t}));\n\n\t\tPromise.all(loadPromises).then(\n\t\t\tresult => (onload(targets.length === 1 ? targets[0] : targets)),\n\t\t\treason => (onerror(reason))\n\t\t);\n\t}\n\n\t_once(target, type, listener) {\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\ttarget.addEventListener(type, fn);\n\t\tthis._onceHandlers.push({target, type, fn});\n\t}\n\n\tgetStatus() {\n\t\treturn this._loadStatus;\n\t}\n\n\tdestroy() {\n\t\tthis._onceHandlers.forEach(handler => {\n\t\t\thandler.target.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._onceHandlers = [];\n\t\tthis._image.src = \"\";\n\t\tthis._image = null;\n\t\tthis._loadStatus = STATUS.NONE;\n\t}\n}\n\nexport default ImageLoader;\n","// import Agent from \"@egjs/agent\";\n\n/* Ref https://www.w3schools.com/tags/av_prop_readystate.asp */\nconst READY_STATUS = {\n\tHAVE_NOTHING: 0, // no information whether or not the audio/video is ready\n\tHAVE_METADATA: 1, // HAVE_METADATA - metadata for the audio/video is ready\n\tHAVE_CURRENT_DATA: 2, // data for the current playback position is available, but not enough data to play next frame/millisecond\n\tHAVE_FUTURE_DATA: 3, // data for the current and at least the next frame is available\n\tHAVE_ENOUGH_DATA: 4, // enough data available to start playing\n\t// below is custom status for failed to load status\n\tLOADING_FAILED: -1\n};\n\nconst READYSTATECHANGE_EVENT_NAME = {};\n\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_METADATA] = \"loadedmetadata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_CURRENT_DATA] = \"loadeddata\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_FUTURE_DATA] = \"canplay\";\nREADYSTATECHANGE_EVENT_NAME[READY_STATUS.HAVE_ENOUGH_DATA] = \"canplaythrough\";\n\nexport default class VideoLoader {\n\tconstructor(video) {\n\t\tthis._handlers = [];\n\t\tthis._sourceCount = 0;\n\n\t\t// on iOS safari, 'loadeddata' will not triggered unless the user hits play,\n\t\t// so used 'loadedmetadata' instead.\n\t\tthis._thresholdReadyState = READY_STATUS.HAVE_METADATA;\n\t\tthis._thresholdEventName = READYSTATECHANGE_EVENT_NAME[this._thresholdReadyState];\n\n\t\tthis._loadStatus = (video && video.readyState) || READY_STATUS.HAVE_NOTHING;\n\n\t\tthis._onerror = this._onerror.bind(this);\n\n\t\tvideo && this.set(video);\n\t}\n\n\t_onerror() {\n\t\tthis._errorCount++;\n\t\tif (this._errorCount >= this._sourceCount) {\n\t\t\tthis._loadStatus = READY_STATUS.LOADING_FAILED;\n\t\t\tthis._detachErrorHandler(this._onerror);\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {Object | String} video Object or String containing Video Source URL비디오 URL 정보를 담고 있는 문자열이나 객체 {type, src}\n\t */\n\t_appendSourceElement(videoUrl) {\n\t\tlet videoSrc;\n\t\tlet videoType;\n\n\t\tif (typeof videoUrl === \"object\") {\n\t\t\tvideoSrc = videoUrl.src;\n\t\t\tvideoType = videoUrl.type;\n\t\t} else if (typeof videoUrl === \"string\") {\n\t\t\tvideoSrc = videoUrl;\n\t\t}\n\n\t\tif (!videoSrc) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst sourceElement = document.createElement(\"source\");\n\n\t\tsourceElement.src = videoSrc;\n\t\tvideoType && (sourceElement.type = videoType);\n\n\t\tthis._video.appendChild(sourceElement);\n\t\treturn true;\n\t}\n\n\tset(video) {\n\t\tthis._reset(); // reset resources.\n\n\t\tif (!video) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (video instanceof HTMLVideoElement) {\n\t\t\t// video tag\n\t\t\tthis._video = video;\n\t\t} else if (typeof video === \"string\" || typeof video === \"object\") {\n\t\t\t// url\n\t\t\tthis._video = document.createElement(\"video\");\n\t\t\tthis._video.setAttribute(\"crossorigin\", \"anonymous\");\n\t\t\tthis._video.setAttribute(\"webkit-playsinline\", \"\");\n\t\t\tthis._video.setAttribute(\"playsinline\", \"\");\n\n\t\t\tif (video instanceof Array) {\n\t\t\t\tvideo.forEach(v => this._appendSourceElement(v));\n\t\t\t} else {\n\t\t\t\tthis._appendSourceElement(video);\n\t\t\t}\n\n\t\t\tthis._sourceCount = this._video.querySelectorAll(\"source\").length;\n\n\t\t\tif (this._sourceCount > 0) {\n\t\t\t\tif (this._video.readyState < this._thresholdReadyState) {\n\t\t\t\t\tthis._video.load();\n\t\t\t\t\t// attach loading error listener\n\t\t\t\t\tthis._attachErrorHandler(this._onerror);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis._video = null;\n\t\t\t}\n\t\t}\n\t}\n\n\t_attachErrorHandler(handler) {\n\t\tthis._video.addEventListener(\"error\", handler);\n\t\tthis._sources = this._video.querySelectorAll(\"source\");\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.addEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\t_detachErrorHandler(handler) {\n\t\tthis._video.removeEventListener(\"error\", handler);\n\t\t[].forEach.call(this._sources, source => {\n\t\t\tsource.removeEventListener(\"error\", handler);\n\t\t});\n\t}\n\n\tget() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._video) {\n\t\t\t\trej(\"VideoLoader: video is undefined\");\n\t\t\t} else if (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t} else if (this._video.readyState >= this._thresholdReadyState) {\n\t\t\t\tres(this._video);\n\t\t\t} else {\n\t\t\t\t// check errorCnt and reject\n\t\t\t\tconst rejector = () => {\n\t\t\t\t\tif (this._loadStatus === READY_STATUS.LOADING_FAILED) {\n\t\t\t\t\t\tthis._detachErrorHandler(rejector);\n\t\t\t\t\t\trej(\"VideoLoader: video source is invalid\");\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tthis._attachErrorHandler(rejector);\n\t\t\t\tthis._once(this._thresholdEventName, () => res(this._video));\n\t\t\t}\n\t\t});\n\t}\n\n\tgetElement() {\n\t\treturn this._video;\n\t}\n\n\tdestroy() {\n\t\tthis._reset();\n\t}\n\n\t_reset() {\n\t\tthis._handlers.forEach(handler => {\n\t\t\tthis._video.removeEventListener(handler.type, handler.fn);\n\t\t});\n\t\tthis._handlers = [];\n\t\tthis._video = null;\n\n\t\tthis._sourceCount = 0;\n\t\tthis._errorCount = 0;\n\t}\n\n\t_once(type, listener) {\n\t\tconst target = this._video;\n\n\t\tconst fn = event => {\n\t\t\ttarget.removeEventListener(type, fn);\n\t\t\tlistener(event);\n\t\t};\n\n\t\t/* By useCapture mode enabled, you can capture the error event being fired on source(child)*/\n\t\ttarget.addEventListener(type, fn, true);\n\t\tthis._handlers.push({type, fn});\n\t}\n}\n","import Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {STEREO_FORMAT} from \"../../PanoViewer/consts\";\n\nconst latitudeBands = 60;\nconst longitudeBands = 60;\nconst radius = 2;\nconst ANGLE_CORRECTION_FOR_CENTER_ALIGN = -0.5 * Math.PI;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\nlet latIdx;\nlet lngIdx;\n\nfor (latIdx = 0; latIdx <= latitudeBands; latIdx++) {\n\tconst theta = (latIdx / latitudeBands - 0.5) * Math.PI;\n\tconst sinTheta = Math.sin(theta);\n\tconst cosTheta = Math.cos(theta);\n\n\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\tconst phi = (lngIdx / longitudeBands - 0.5) * 2 * Math.PI + ANGLE_CORRECTION_FOR_CENTER_ALIGN;\n\t\tconst sinPhi = Math.sin(phi);\n\t\tconst cosPhi = Math.cos(phi);\n\t\tconst x = cosPhi * cosTheta;\n\t\tconst y = sinTheta;\n\t\tconst z = sinPhi * cosTheta;\n\t\tconst u = lngIdx / longitudeBands;\n\t\tconst v = latIdx / latitudeBands;\n\n\t\ttextureCoordData.push(u, v);\n\t\tvertexPositionData.push(radius * x, radius * y, radius * z);\n\n\t\tif (lngIdx !== longitudeBands && latIdx !== latitudeBands) {\n\t\t\tconst a = latIdx * (longitudeBands + 1) + lngIdx;\n\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t}\n\t}\n}\n\nclass SphereRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tconstructor(format) {\n\t\tsuper();\n\n\t\tthis._stereoFormat = format;\n\t}\n\n\trender(ctx) {\n\t\tconst {gl, shaderProgram} = ctx;\n\n\t\tlet leftEyeScaleOffset;\n\t\tlet rightEyeScaleOffset;\n\n\t\tswitch (this._stereoFormat) {\n\t\t\tcase STEREO_FORMAT.TOP_BOTTOM:\n\t\t\t\tleftEyeScaleOffset = [1, 0.5, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 0.5, 0, 0.5];\n\t\t\t\tbreak;\n\t\t\tcase STEREO_FORMAT.LEFT_RIGHT:\n\t\t\t\tleftEyeScaleOffset = [0.5, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [0.5, 1, 0.5, 0];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tleftEyeScaleOffset = [1, 1, 0, 0];\n\t\t\t\trightEyeScaleOffset = [1, 1, 0, 0];\n\t\t}\n\n\t\tconst uTexScaleOffset = gl.getUniformLocation(shaderProgram, \"uTexScaleOffset\");\n\n\t\tgl.uniform4fv(uTexScaleOffset, [...leftEyeScaleOffset, ...rightEyeScaleOffset]);\n\n\t\tsuper.render(ctx);\n\t}\n\n\tgetVertexPositionData() {\n\t\treturn SphereRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn SphereRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn SphereRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvec4 scaleOffset = uTexScaleOffset[int(uEye)];\n\tvTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n}\n\nexport default SphereRenderer;\n","import agent from \"@egjs/agent\";\n\nconst WEBGL_ERROR_CODE = {\n\t\"0\": \"NO_ERROR\",\n\t\"1280\": \"INVALID_ENUM\",\n\t\"1281\": \"INVALID_VALUE\",\n\t\"1282\": \"INVALID_OPERATION\",\n\t\"1285\": \"OUT_OF_MEMORY\",\n\t\"1286\": \"INVALID_FRAMEBUFFER_OPERATION\",\n\t\"37442\": \"CONTEXT_LOST_WEBGL\"\n};\n\nlet webglAvailability = null;\nlet MAX_TEXTURE_SIZE_FOR_TEST = null;\n\nexport default class WebGLUtils {\n\tstatic createShader(gl, type, source) {\n\t\tconst shader = gl.createShader(type);\n\n\t\tgl.shaderSource(shader, source);\n\t\tgl.compileShader(shader);\n\t\tconst success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);\n\n\t\tif (success) {\n\t\t\treturn shader;\n\t\t} else {\n\t\t\t// eslint-disable-next-line\n\t\t\tconsole.error(gl.getShaderInfoLog(shader));\n\t\t}\n\t\treturn null;\n\t}\n\n\tstatic createProgram(gl, vertexShader, fragmentShader) {\n\t\tconst program = gl.createProgram();\n\n\t\tgl.attachShader(program, vertexShader);\n\t\tgl.attachShader(program, fragmentShader);\n\t\tgl.linkProgram(program);\n\n\t\tgl.detachShader(program, vertexShader);\n\t\tgl.detachShader(program, fragmentShader);\n\t\tgl.deleteShader(vertexShader);\n\t\tgl.deleteShader(fragmentShader);\n\n\t\tconst success = gl.getProgramParameter(program, gl.LINK_STATUS);\n\n\t\tif (success) {\n\t\t\treturn program;\n\t\t}\n\n\t\tgl.deleteProgram(program);\n\t\treturn null;\n\t}\n\n\tstatic initBuffer(gl, target /* bind point */, data, itemSize, attr) {\n\t\tconst buffer = gl.createBuffer();\n\n\t\tgl.bindBuffer(target, buffer);\n\t\tgl.bufferData(target, data, gl.STATIC_DRAW);\n\n\t\tif (buffer) {\n\t\t\tbuffer.itemSize = itemSize;\n\t\t\tbuffer.numItems = data.length / itemSize;\n\t\t}\n\n\t\tif (attr !== undefined) {\n\t\t\tgl.enableVertexAttribArray(attr);\n\t\t\tgl.vertexAttribPointer(attr, buffer.itemSize, gl.FLOAT, false, 0, 0);\n\t\t}\n\n\t\treturn buffer;\n\t}\n\n\tstatic getWebglContext(canvas, userContextAttributes) {\n\t\tconst webglIdentifiers = [\"webgl\", \"experimental-webgl\", \"webkit-3d\", \"moz-webgl\"];\n\t\tlet context = null;\n\t\tconst contextAttributes = Object.assign({\n\t\t\tpreserveDrawingBuffer: false,\n\t\t\tantialias: false,\n\t\t\txrCompatible: true\n\t\t}, userContextAttributes);\n\n\t\tfunction onWebglcontextcreationerror(e) {\n\t\t\treturn e.statusMessage;\n\t\t}\n\n\t\tcanvas.addEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\tfor (let i = 0; i < webglIdentifiers.length; i++) {\n\t\t\ttry {\n\t\t\t\tcontext = canvas.getContext(webglIdentifiers[i], contextAttributes);\n\t\t\t} catch (t) {}\n\t\t\tif (context) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tcanvas.removeEventListener(\"webglcontextcreationerror\", onWebglcontextcreationerror);\n\n\t\treturn context;\n\t}\n\n\tstatic createTexture(gl, textureTarget) {\n\t\tconst texture = gl.createTexture();\n\n\t\tgl.bindTexture(textureTarget, texture);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n\t\tgl.texParameteri(textureTarget, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n\t\tgl.bindTexture(textureTarget, null);\n\n\t\treturn texture;\n\t}\n\n\t/**\n\t * Returns the webgl availability of the current browser.\n\t * @method WebGLUtils#isWebGLAvailable\n\t * @retuen {Boolean} isWebGLAvailable\n\t */\n\tstatic isWebGLAvailable() {\n\t\tif (webglAvailability === null) {\n\t\t\tconst canvas = document.createElement(\"canvas\");\n\t\t\tconst webglContext = WebGLUtils.getWebglContext(canvas);\n\n\t\t\twebglAvailability = !!webglContext;\n\n\t\t\t// webglContext Resource forced collection\n\t\t\tif (webglContext) {\n\t\t\t\tconst loseContextExtension = webglContext.getExtension(\"WEBGL_lose_context\");\n\n\t\t\t\tloseContextExtension && loseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t\treturn webglAvailability;\n\t}\n\n\t/**\n\t * Returns whether webgl is stable in the current browser.\n\t * @method WebGLUtils#isStableWebGL\n\t * @retuen {Boolean} isStableWebGL\n\t */\n\tstatic isStableWebGL() {\n\t\tconst agentInfo = agent();\n\t\tlet isStableWebgl = true;\n\n\t\tif (agentInfo.os.name === \"android\") {\n\t\t\tconst version = parseFloat(agentInfo.os.version);\n\n\t\t\tif (version <= 4.3) {\n\t\t\t\tisStableWebgl = false;\n\t\t\t} else if (version === 4.4) {\n\t\t\t\tif (agentInfo.browser.name !== \"chrome\") {\n\t\t\t\t\tisStableWebgl = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn isStableWebgl;\n\t}\n\n\tstatic getErrorNameFromWebGLErrorCode(code) {\n\t\tif (!(code in WEBGL_ERROR_CODE)) {\n\t\t\treturn \"UNKNOWN_ERROR\";\n\t\t}\n\n\t\treturn WEBGL_ERROR_CODE[code];\n\t}\n\n\n\t/**\n\t * This function is wrapper for texImage2D to handle exceptions on texImage2D.\n\t * Purpose is to prevent service from being stopped by script error.\n\t *\n\t * @param {*} gl\n\t * @param {*} target\n\t * @param {*} pixels\n\t */\n\tstatic texImage2D(gl, target, pixels) {\n\t\ttry {\n\t\t\tgl.texImage2D(target, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, pixels);\n\t\t} catch (error) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.error(\"WebGLUtils.texImage2D error:\", error);\n\t\t\t/* eslint-enable no-console */\n\t\t}\n\t}\n\n\tstatic getMaxTextureSize(gl) {\n\t\t// WARN: MAX_TEXTURE_SIZE_FOR_TEST is used for test\n\t\treturn MAX_TEXTURE_SIZE_FOR_TEST || gl.getParameter(gl.MAX_TEXTURE_SIZE);\n\t}\n}\n\n/**\n * This function should not be used in service code. It's provided only for test purpose.\n * It should be set to null or 0 when test is done.\n *\n * @param {Number} size\n */\nfunction setMaxTextureSizeForTestOnlyPurpose(size) {\n\tMAX_TEXTURE_SIZE_FOR_TEST = size;\n}\n\nexport {\n\tsetMaxTextureSizeForTestOnlyPurpose\n};\n","import Component from \"@egjs/component\";\nimport Agent from \"@egjs/agent\";\n\nconst agent = Agent();\nconst isIE11 = agent.browser.name === \"ie\" && agent.browser.majorVersion === 11;\n\nconst EVENTS = {\n\tERROR: \"error\"\n};\n\n/**\n *\n * Extends Component for firing errors occurs internally.\n */\nclass Renderer extends Component {\n\tstatic EVENTS = EVENTS;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis._forceDimension = null;\n\t\tthis._pixelCanvas = null;\n\t\tthis._pixelContext = null;\n\t}\n\n\trender({gl, shaderProgram, indexBuffer, mvMatrix, pMatrix}) {\n\t\tgl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n\t\tgl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n\n\t\tif (indexBuffer) {\n\t\t\tgl.drawElements(gl.TRIANGLES, indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);\n\t\t}\n\t}\n\n\t// Define interface for Renderers\n\t/**\n\t * Following MUST BE DEFINED on Child of Renderer\n\t *\n\t * DATA\n\t *\n\t * - getVertexPositionData\n\t * - getIndexData\n\t * - getTextureCoordData\n\t *\n\t * SOURCE\n\t *\n\t * - getVertexShaderSource\n\t * - getFragmentShaderSource\n\t *\n\t * TEXTURE\n\t *\n\t * - bindTexture\n\t */\n\tgetDimension(pixelSource) {\n\t\tconst width = pixelSource.naturalWidth || pixelSource.videoWidth;\n\t\tconst height = pixelSource.naturalHeight || pixelSource.videoHeight;\n\n\t\treturn {width, height};\n\t}\n\n\t/**\n\t * Update data used by shader\n\t * \t-\n\t *\n\t *\n\t * @param {*} param\n\t */\n\tupdateShaderData(param) {\n\t\t/*\n\t\t* Update following data in implementation layer.\n\t\t* If the data is not changed, it does not need to implement this function.\n\t\t*\n\t\t* - _VERTEX_POSITION_DATA\n\t\t* - _TEXTURE_COORD_DATA\n\t\t* - _INDEX_DATA\n\t\t*/\n\t}\n\n\t/**\n\t *\n\t * @param {HTMLImageElement | HTMLVideoElement} image\n\t * @param {Object = {width, height}} forceDimension Forced dimension to resize\n\t */\n\t_initPixelSource(image, forceDimension) {\n\t\tconst isIE11Video = isIE11 && (image instanceof HTMLVideoElement);\n\n\t\tif (isIE11Video || forceDimension) {\n\t\t\tconst {width, height} = forceDimension || this.getDimension(image);\n\n\t\t\tthis._pixelCanvas = document.createElement(\"canvas\");\n\t\t\tthis._pixelCanvas.width = width;\n\t\t\tthis._pixelCanvas.height = height;\n\t\t\tthis._pixelContext = this._pixelCanvas.getContext(\"2d\");\n\t\t}\n\t\tthis._forceDimension = forceDimension;\n\t}\n\n\t_getPixelSource(image) {\n\t\tif (!this._pixelCanvas) {\n\t\t\treturn image;\n\t\t}\n\n\t\t/**\n\t\t * IE11 && Video\n\t\t * or\n\t\t * Dimension is forced (Image is larger than texture size.)\n\t\t */\n\t\tconst contentDimension = this.getDimension(image);\n\t\tconst textureDimension = this._forceDimension || contentDimension;\n\n\t\tif (this._pixelCanvas.width !== textureDimension.width) {\n\t\t\tthis._pixelCanvas.width = textureDimension.width;\n\t\t}\n\n\t\tif (this._pixelCanvas.height !== textureDimension.height) {\n\t\t\tthis._pixelCanvas.height = textureDimension.height;\n\t\t}\n\n\t\tif (this._forceDimension) {\n\t\t\tthis._pixelContext.drawImage(image,\n\t\t\t\t0, 0, contentDimension.width, contentDimension.height,\n\t\t\t\t0, 0, textureDimension.width, textureDimension.height);\n\t\t} else {\n\t\t\tthis._pixelContext.drawImage(image, 0, 0);\n\t\t}\n\n\t\treturn this._pixelCanvas;\n\t}\n\n\t_extractTileConfig(imageConfig) {\n\t\tlet tileConfig =\n\t\t\tArray.isArray(imageConfig.tileConfig) ?\n\t\t\t\timageConfig.tileConfig : Array(...Array(6)).map(() => imageConfig.tileConfig);\n\n\t\ttileConfig = tileConfig.map(\n\t\t\tconfig => Object.assign({\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}, config)\n\t\t);\n\n\t\treturn tileConfig;\n\t}\n\n\t_triggerError(error) {\n\t\t/* eslint-disable no-console */\n\t\tconsole.error(\"Renderer Error:\", error);\n\t\t/* eslint-enable no-console */\n\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\tmessage: typeof error === \"string\" ? error : error.message\n\t\t});\n\t}\n}\n\nexport default Renderer;\n","import Agent from \"@egjs/agent\";\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\nimport {util as mathUtil} from \"../../utils/math-util.js\";\n\nclass CubeRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = null;\n\tstatic _INDEX_DATA = null;\n\tgetVertexPositionData() {\n\t\tCubeRenderer._VERTEX_POSITION_DATA =\n\t\t\tCubeRenderer._VERTEX_POSITION_DATA !== null ? CubeRenderer._VERTEX_POSITION_DATA : [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// top\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// bottom\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\n\t\treturn CubeRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\tif (CubeRenderer._INDEX_DATA) {\n\t\t\treturn CubeRenderer._INDEX_DATA;\n\t\t}\n\n\t\tconst indexData = [];\n\t\tconst vertexPositionData = this.getVertexPositionData();\n\n\t\tfor (let i = 0; i < (vertexPositionData.length / 3); i += 4) {\n\t\t\tindexData.push(\n\t\t\t\ti,\n\t\t\t\ti + 2,\n\t\t\t\ti + 1,\n\t\t\t\ti,\n\t\t\t\ti + 3,\n\t\t\t\ti + 2\n\t\t\t);\n\t\t}\n\n\t\tCubeRenderer._INDEX_DATA = indexData;\n\t\treturn indexData;\n\t}\n\n\tstatic extractOrder(imageConfig) {\n\t\treturn imageConfig.order || \"RLUDBF\";\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\tconst vertexOrder = \"BFUDRL\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst base = this.getVertexPositionData();\n\t\tconst tileConfig = this._extractTileConfig(imageConfig);\n\t\tconst elemSize = 3;\n\t\tconst vertexPerTile = 4;\n\t\tconst textureCoordData =\n\t\t\tvertexOrder.split(\"\")\n\t\t\t\t.map(face => tileConfig[order.indexOf(face)])\n\t\t\t\t.map((config, i) => {\n\t\t\t\t\tconst rotation = parseInt(config.rotation / 90, 10);\n\t\t\t\t\tconst ordermap_ = config.flipHorizontal ? [0, 1, 2, 3] : [1, 0, 3, 2];\n\n\t\t\t\t\tfor (let r = 0; r < Math.abs(rotation); r++) {\n\t\t\t\t\t\tif ((config.flipHorizontal && rotation > 0) ||\n\t\t\t\t\t\t\t(!config.flipHorizontal && rotation < 0)) {\n\t\t\t\t\t\t\tordermap_.push(ordermap_.shift());\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tordermap_.unshift(ordermap_.pop());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst elemPerTile = elemSize * vertexPerTile;\n\t\t\t\t\tconst tileVertex = base.slice(i * elemPerTile, i * elemPerTile + elemPerTile);\n\t\t\t\t\tconst tileTemp = [];\n\n\t\t\t\t\tfor (let j = 0; j < vertexPerTile; j++) {\n\t\t\t\t\t\ttileTemp[ordermap_[j]] = tileVertex.splice(0, elemSize);\n\t\t\t\t\t}\n\t\t\t\t\treturn tileTemp;\n\t\t\t\t})\n\t\t\t\t.join()\n\t\t\t\t.split(\",\")\n\t\t\t\t.map(v => parseInt(v, 10));\n\n\t\treturn textureCoordData;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tvVertexDirectionVector = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n\tgl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}`;\n\t}\n\n\tupdateTexture(gl, image, imageConfig) {\n\t\tconst baseOrder = \"RLUDBF\";\n\t\tconst order = CubeRenderer.extractOrder(imageConfig);\n\t\tconst orderMap = {};\n\n\t\torder.split(\"\").forEach((v, i) => {\n\t\t\torderMap[v] = i;\n\t\t});\n\n\t\ttry {\n\t\t\tif (image instanceof Array) {\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, image[tileIdx]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst maxCubeMapTextureSize = this.getMaxCubeMapTextureSize(gl, image);\n\n\t\t\t\tfor (let surfaceIdx = 0; surfaceIdx < 6; surfaceIdx++) {\n\t\t\t\t\tconst tileIdx = orderMap[baseOrder[surfaceIdx]];\n\t\t\t\t\tconst tile = this.extractTileFromImage(\n\t\t\t\t\t\timage, tileIdx, maxCubeMapTextureSize\n\t\t\t\t\t);\n\n\t\t\t\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_CUBE_MAP_POSITIVE_X + surfaceIdx, tile);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tthis._triggerError(e);\n\t\t}\n\t}\n\n\tbindTexture(gl, texture, image, imageConfig) {\n\t\tgl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);\n\t\tthis.updateTexture(gl, image, imageConfig);\n\t}\n\n\tgetSourceTileSize(image) {\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst aspectRatio = width / height;\n\t\tlet inputTextureSize;\n\n\t\tif (aspectRatio === 1 / 6) {\n\t\t\tinputTextureSize = width;\n\t\t} else if (aspectRatio === 6) {\n\t\t\tinputTextureSize = height;\n\t\t} else if (aspectRatio === 2 / 3) {\n\t\t\tinputTextureSize = width / 2;\n\t\t} else {\n\t\t\tinputTextureSize = width / 3;\n\t\t}\n\t\treturn inputTextureSize;\n\t}\n\n\textractTileFromImage(image, tileIdx, outputTextureSize) {\n\t\tconst {width} = this.getDimension(image);\n\t\tconst inputTextureSize = this.getSourceTileSize(image);\n\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = outputTextureSize;\n\t\tcanvas.height = outputTextureSize;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tconst tilePerRow = width / inputTextureSize;\n\n\t\tconst x = inputTextureSize * tileIdx % (inputTextureSize * tilePerRow);\n\t\tconst y = parseInt(tileIdx / tilePerRow, 10) * (inputTextureSize);\n\n\t\tcontext.drawImage(\n\t\t\timage, x, y,\n\t\t\tinputTextureSize, inputTextureSize, 0, 0, outputTextureSize, outputTextureSize\n\t\t);\n\t\treturn canvas;\n\t}\n\n\tgetMaxCubeMapTextureSize(gl, image) {\n\t\tconst agent = Agent();\n\t\tconst maxCubeMapTextureSize = gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE);\n\t\tlet _imageWidth = this.getSourceTileSize(image);\n\n\t\tif (agent.browser.name === \"ie\" && agent.browser.majorVersion === 11) {\n\t\t\tif (!mathUtil.isPowerOfTwo(_imageWidth)) {\n\t\t\t\tfor (let i = 1; i < maxCubeMapTextureSize; i *= 2) {\n\t\t\t\t\tif (i < _imageWidth) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t_imageWidth = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (agent.os.name === \"ios\") {\n\t\t\tconst majorVersion = agent.os.majorVersion;\n\n\t\t\t// ios 9 의 경우 텍스쳐 최대사이즈는 1024 이다.\n\t\t\tif (majorVersion === 9) {\n\t\t\t\t_imageWidth = 1024;\n\t\t\t}\n\t\t\t// ios 8 의 경우 텍스쳐 최대사이즈는 512 이다.\n\t\t\tif (majorVersion === 8) {\n\t\t\t\t_imageWidth = 512;\n\t\t\t}\n\t\t}\n\t\t// maxCubeMapTextureSize 보다는 작고, imageWidth 보다 큰 2의 승수 중 가장 작은 수\n\t\treturn Math.min(maxCubeMapTextureSize, _imageWidth);\n\t}\n}\n\nexport default CubeRenderer;\n","\nimport Renderer from \"./Renderer.js\";\nimport WebGLUtils from \"../WebGLUtils\";\n\nexport default class CubeStripRenderer extends Renderer {\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n\tfloat unit = 1.0 / (domainRange[1] - domainRange[0]);\n\treturn targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n\tfloat transformedCoordX;\n\tfloat transformedCoordY;\n\n\tif (uIsEAC) {\n\t\tvec2 orgTextureRangeX;\n\t\tvec2 orgTextureRangeY;\n\n\t\t// Apply EAC transform\n\t\tif (vTextureCoord.s >= TEXTURE_DIVISION_X[2]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n\t\t} else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n\t\t} else {\n\t\t\torgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n\t\t}\n\n\t\tif (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n\t\t} else {\n\t\t\torgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n\t\t}\n\n\t\t// scaling coors by the coordinates following the range from -1.0 to 1.0.\n\t\tfloat px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n\t\tfloat py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n\t\tfloat qu = EAC_CONST * atan(px) + 0.5;\n\t\tfloat qv = EAC_CONST * atan(py) + 0.5;\n\n\t\t// re-scaling coors by original coordinates ranges\n\t\ttransformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n\t\ttransformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n\t} else {\n\t\t// normal cubemap\n\t\ttransformedCoordX = vTextureCoord.s;\n\t\ttransformedCoordY = vTextureCoord.t;\n\t}\n\n\tgl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}`;\n\t}\n\n\tgetVertexPositionData() {\n\t\tif (!this._vertices) {\n\t\t\tthis._vertices = [\n\t\t\t\t// back\n\t\t\t\t1, -1, 1,\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, 1, 1,\n\t\t\t\t1, 1, 1,\n\n\t\t\t\t// front\n\t\t\t\t-1, -1, -1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t-1, 1, -1,\n\n\t\t\t\t// up\n\t\t\t\t-1, 1, -1,\n\t\t\t\t1, 1, -1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t-1, 1, 1,\n\n\t\t\t\t// down\n\t\t\t\t-1, -1, 1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, -1, -1,\n\t\t\t\t-1, -1, -1,\n\n\t\t\t\t// right\n\t\t\t\t1, -1, -1,\n\t\t\t\t1, -1, 1,\n\t\t\t\t1, 1, 1,\n\t\t\t\t1, 1, -1,\n\n\t\t\t\t// left\n\t\t\t\t-1, -1, 1,\n\t\t\t\t-1, -1, -1,\n\t\t\t\t-1, 1, -1,\n\t\t\t\t-1, 1, 1\n\t\t\t];\n\t\t}\n\n\t\treturn this._vertices;\n\t}\n\n\tgetIndexData() {\n\t\t// TODO: 한번만 계산하도록 수정하기\n\t\tconst indices = (() => {\n\t\t\tconst indexData = [];\n\n\t\t\tfor (let i = 0; i < (this._vertices.length / 3); i += 4) {\n\t\t\t\tindexData.push(\n\t\t\t\t\ti,\n\t\t\t\t\ti + 1,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti,\n\t\t\t\t\ti + 2,\n\t\t\t\t\ti + 3\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn indexData;\n\t\t})();\n\n\t\treturn indices;\n\t}\n\n\tgetTextureCoordData(imageConfig) {\n\t\t// TODO: make it cols, rows as config.\n\t\tconst cols = 3;\n\t\tconst rows = 2;\n\t\tconst order = imageConfig.order || \"RLUDFB\";\n\t\tlet coords = [];\n\n\t\t// 텍스쳐의 좌표는 윗쪽이 큰 값을 가지므로 row 는 역순으로 넣는다.\n\t\tfor (let r = rows - 1; r >= 0; r--) {\n\t\t\tfor (let c = 0; c < cols; c++) {\n\t\t\t\tconst coord = [\n\t\t\t\t\tc / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, r / rows,\n\t\t\t\t\t(c + 1) / cols, (r + 1) / rows,\n\t\t\t\t\tc / cols, (r + 1) / rows\n\t\t\t\t];\n\n\t\t\t\tcoords.push(coord);\n\t\t\t}\n\t\t}\n\n\t\tconst tileConfigs = this._extractTileConfig(imageConfig);\n\n\t\t// Transform Coord By Flip & Rotation\n\t\tcoords = coords\n\t\t// shrink coord to avoid pixel bleeding\n\t\t\t.map(coord => this._shrinkCoord(coord))\n\t\t\t.map((coord, i) => this._transformCoord(coord, tileConfigs[i]));\n\n\t\t// vertices 에서 지정된 순서대로 그대로 그리기 위해 vertex 의 순서를 BFUDRL 로 재배치\n\t\treturn \"BFUDRL\".split(\"\")\n\t\t\t.map(face => order.indexOf(face))\n\t\t\t.map(index => coords[index])\n\t\t\t.reduce((acc, val) => acc.concat(val), []);\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device limit(${maxSize}))`);\n\t\t\treturn;\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video\n\t\tthis._initPixelSource(image);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\t_transformCoord(coord, tileConfig) {\n\t\tlet newCoord = coord.slice();\n\n\t\tif (tileConfig.flipHorizontal) {\n\t\t\tnewCoord = this._flipHorizontalCoord(newCoord);\n\t\t}\n\n\t\tif (tileConfig.rotation) {\n\t\t\tnewCoord = this._rotateCoord(newCoord, tileConfig.rotation);\n\t\t}\n\n\t\treturn newCoord;\n\t}\n\n\t_shrinkCoord(coord) {\n\t\tconst SHRINK_Y = 0.00;\n\t\tconst SHRINK_X = 0.00;\n\n\t\treturn [\n\t\t\tcoord[0] + SHRINK_X, coord[1] + SHRINK_Y,\n\t\t\tcoord[2] - SHRINK_X, coord[3] + SHRINK_Y,\n\t\t\tcoord[4] - SHRINK_X, coord[5] - SHRINK_Y,\n\t\t\tcoord[6] + SHRINK_X, coord[7] - SHRINK_Y\n\t\t];\n\t}\n\n\t_rotateCoord(coord, rotationAngle) {\n\t\tconst SIZE = 2; // coord means x,y coordinates. Two values(x, y) makes a one coord.\n\t\tconst shiftCount = parseInt(rotationAngle / 90, 10) % 4;\n\n\t\tif (shiftCount === 0) {\n\t\t\treturn coord;\n\t\t}\n\n\t\tlet moved;\n\t\tlet rotatedCoord = [];\n\n\t\tif (shiftCount > 0) {\n\t\t\tmoved = coord.splice(0, shiftCount * SIZE);\n\t\t\trotatedCoord = coord.concat(moved);\n\t\t} else {\n\t\t\tmoved = coord.splice((4 + shiftCount) * SIZE, -shiftCount * SIZE);\n\t\t\trotatedCoord = moved.concat(coord);\n\t\t}\n\n\t\treturn rotatedCoord;\n\t}\n\n\t_flipHorizontalCoord(coord) {\n\t\treturn [\n\t\t\tcoord[2], coord[3],\n\t\t\tcoord[0], coord[1],\n\t\t\tcoord[6], coord[7],\n\t\t\tcoord[4], coord[5]\n\t\t];\n\t}\n}\n","/**\n * Constant value for gyro mode.
(Reference {@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide})\n * @ko gyro 모드 대한 상수 값.
({@link https://github.com/naver/egjs-view360/wiki/PanoViewer-3.0-User-Guide} 참고)\n * @namespace\n * @name GYRO_MODE\n * @memberof eg.view360.PanoViewer\n */\n/**\n * Disable gyro\n * @ko gyro 비활성화\n * @name NONE\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"none\"\n */\n/**\n * YawPitch Mode\n * @ko YawPitch Mode\n * @name YAWPITCH\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"yawPitch\"\n */\n/**\n * VR Mode\n * @ko VR Mode\n * @name VR\n * @memberof eg.view360.PanoViewer.GYRO_MODE\n * @constant\n * @type {String}\n * @default \"VR\"\n */\nimport {GYRO_MODE} from \"../YawPitchControl/consts\";\n\n/**\n * Constant value for errors\n * @ko 에러에 대한 상수 값\n * @namespace\n * @name ERROR_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst ERROR_TYPE = {\n\t/**\n\t * Unsupported device\n\t * @ko 미지원 기기\n\t * @name INVALID_DEVICE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 10\n\t */\n\tINVALID_DEVICE: 10,\n\t/**\n\t * Webgl not support\n\t * @ko WEBGL 미지원\n\t * @name NO_WEBGL\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 11\n\t */\n\tNO_WEBGL: 11,\n\t/**\n\t * Failed to load image\n\t * @ko 이미지 로드 실패\n\t * @name FAIL_IMAGE_LOAD\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 12\n\t */\n\tFAIL_IMAGE_LOAD: 12,\n\t/**\n\t * Failed to bind texture\n\t * @ko 텍스쳐 바인딩 실패\n\t * @name FAIL_BIND_TEXTURE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 13\n\t */\n\tFAIL_BIND_TEXTURE: 13,\n\t/**\n\t * Only one resource(image or video) should be specified\n\t * @ko 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t * @name INVALID_RESOURCE\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 14\n\t */\n\tINVALID_RESOURCE: 14,\n\t/**\n\t * WebGL context lost occurred\n\t * @ko WebGL context lost 발생\n\t * @name RENDERING_CONTEXT_LOST\n\t * @memberof eg.view360.PanoViewer.ERROR_TYPE\n\t * @constant\n\t * @type {Number}\n\t * @default 15\n\t */\n\tRENDERING_CONTEXT_LOST: 15,\n};\n\n/**\n * Constant value for events\n * @ko 이벤트에 대한 상수 값\n * @namespace\n * @name EVENTS\n * @memberof eg.view360.PanoViewer\n */\nconst EVENTS = {\n\t/**\n\t * Events that is fired when PanoViewer is ready to show image and handle user interaction.\n\t * @ko PanoViewer 가 사용자의 인터렉션 및 렌더링이 준비되상태에 발생하는 이벤트\n\t * @name READY\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default ready\n\t */\n\tREADY: \"ready\",\n\t/**\n\t * Events that is fired when direction or fov is changed.\n\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t * @name VIEW_CHANGE\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default viewChange\n\t */\n\tVIEW_CHANGE: \"viewChange\",\n\t/**\n\t * Events that is fired when animation which is triggered by inertia is ended.\n\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t * @name ANIMATION_END\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default animationEnd\n\t */\n\tANIMATION_END: \"animationEnd\",\n\t/**\n\t * Events that is fired when error occurs\n\t * @ko 에러 발생 시 발생하는 이벤트\n\t * @name ERROR\n\t * @memberof eg.view360.PanoViewer.EVENTS\n\t * @constant\n\t * @type {String}\n\t * @default error\n\t */\n\tERROR: \"error\"\n};\n\n/**\n * Constant value for projection type\n * @ko 프로젝션 타입 대한 상수 값\n * @namespace\n * @name PROJECTION_TYPE\n * @memberof eg.view360.PanoViewer\n */\nconst PROJECTION_TYPE = {\n\t/**\n\t * Constant value for equirectangular type.\n\t * @ko equirectangular 에 대한 상수 값.\n\t * @name EQUIRECTANGULAR\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default equirectangular\n\t */\n\tEQUIRECTANGULAR: \"equirectangular\",\n\t/**\n\t * Constant value for cubemap type.\n\t * @ko cubemap 에 대한 상수 값.\n\t * @name CUBEMAP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubemap\n\t */\n\tCUBEMAP: \"cubemap\",\n\t/**\n\t * Constant value for cubestrip type.\n\t * Cubestrip is a format for a single image with a combination of six cube faces. It is almost identical to cubemap, but it is implemented in a different way. It aims at better performance and efficiency. In addition, it automatically detects and supports EAC.\n\t *\n\t * @ko cubemap 에 대한 상수 값.Cubestrip 은 cube 면이 6개가 조합된 조합을 한장의 이미지를 위한 포맷이다. cubemap 과 사용방법이 거의 동일하지만 다른 방식으로 구현되었다. 보다 좋은 성능과 효율성을 목적으로 한다. 더불어 자동으로 EAC 를 감지하고 지원한다.\n\t * @name CUBESTRIP\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default cubestrip\n\t */\n\tCUBESTRIP: \"cubestrip\",\n\t/**\n\t * Constant value for PANORAMA type.\n\t *\n\t * PANORAMA is a format for a panorma image which is taken from smartphone.\n\t *\n\t * @ko PANORAMA 에 대한 상수값. 파노라마는 스마트 폰에서 가져온 파노라마 이미지의 형식입니다.\n\t *\n\t * @name PANORAMA\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default panorama\n\t */\n\tPANORAMA: \"panorama\",\n\t/**\n\t * Constant value for EQUI_STEREOSCOPY type.\n\t *\n\t * Constant value for EQUI_STEREOSCOPY. Stereoscopy image format of EQUIRECTANGULAR. It is an experimental function to show a stereoscopic type equirectangular image on a plane. It does not support stereoscopic viewing function through special visual equipment at present.\n\t *\n\t * @ko EQUI_STEREOSCOPY 에 대한 상수값. EQUIRECTANGULAR 의 Stereoscopy 이미지 형식입니다. Stereoscopic 형태의 equirectangular 이미지를 평면에 보여주기 위한 실험적인 기능으로 현재는 특수한 시각 장비를 통한 입체적인 보기 기능은 지원하지 않습니다.\n\t *\n\t * @name STEREOSCOPIC_EQUI\n\t * @memberof eg.view360.PanoViewer.PROJECTION_TYPE\n\t * @constant\n\t * @type {String}\n\t * @default stereoequi\n\t */\n\tSTEREOSCOPIC_EQUI: \"stereoequi\",\n};\n\n/**\n * A constant value for the format of the stereoscopic equirectangular projection type.\n * @ko Stereoscopic equirectangular 프로젝션 타입의 포맷에 대한 상수 값\n * @namespace\n * @name STEREO_FORMAT\n * @memberof eg.view360.PanoViewer\n */\nconst STEREO_FORMAT = {\n\t/**\n\t * A constant value for format of top bottom stereoscopic 360 equirectangular projection.\n\t * @ko top bottom stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name TOP_BOTTOM\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dv\"\n\t */\n\tTOP_BOTTOM: \"3dv\",\n\t/**\n\t * A constant value for format of left right stereoscopic 360 equirectangular projection.\n\t * @ko Left right stereoscopic 360 equirectangular projection 콘텐츠 포맷에 대한 상수값.\n\t * @name LEFT_RIGHT\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"3dh\"\n\t */\n\tLEFT_RIGHT: \"3dh\",\n\t/**\n\t * A constant value specifying media is not in stereoscopic format.\n\t * @ko Stereoscopic 영상이 아닐 경우에 적용하는 상수값.\n\t * @name NONE\n\t * @memberof eg.view360.PanoViewer.STEREO_FORMAT\n\t * @constant\n\t * @type {String}\n\t * @default \"\"\n\t */\n\tNONE: \"\",\n};\n\nexport {\n\tGYRO_MODE,\n\tEVENTS,\n\tERROR_TYPE,\n\tPROJECTION_TYPE,\n\tSTEREO_FORMAT\n};\n","import {glMatrix} from \"gl-matrix\";\nimport Renderer from \"./Renderer\";\nimport WebGLUtils from \"../WebGLUtils\";\n\n// const latitudeBands = 60;\nconst MIN_ASPECT_RATIO_FOR_FULL_PANORAMA = 6;\nconst longitudeBands = 60;\n\nconst textureCoordData = [];\nconst vertexPositionData = [];\nconst indexData = [];\n\nclass CylinderRenderer extends Renderer {\n\tstatic _VERTEX_POSITION_DATA = vertexPositionData;\n\tstatic _TEXTURE_COORD_DATA = textureCoordData;\n\tstatic _INDEX_DATA = indexData;\n\n\tgetVertexPositionData() {\n\t\treturn CylinderRenderer._VERTEX_POSITION_DATA;\n\t}\n\n\tgetIndexData() {\n\t\treturn CylinderRenderer._INDEX_DATA;\n\t}\n\n\tgetTextureCoordData() {\n\t\treturn CylinderRenderer._TEXTURE_COORD_DATA;\n\t}\n\n\tgetVertexShaderSource() {\n\t\treturn `\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n\tvTextureCoord = aTextureCoord;\n\tgl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}`;\n\t}\n\n\tgetFragmentShaderSource() {\n\t\treturn `\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n\tgl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}`;\n\t}\n\n\tupdateTexture(gl, image) {\n\t\tWebGLUtils.texImage2D(gl, gl.TEXTURE_2D, this._getPixelSource(image));\n\t}\n\n\tbindTexture(gl, texture, image) {\n\t\t// Make sure image isn't too big\n\t\tconst {width, height} = this.getDimension(image);\n\t\tconst size = Math.max(width, height);\n\t\tconst maxSize = WebGLUtils.getMaxTextureSize(gl);\n\t\tlet resizeDimension;\n\n\t\tif (size > maxSize) {\n\t\t\tthis._triggerError(`Image width(${width}) exceeds device texture limit(${maxSize}))`);\n\n\t\t\t// Request resizing texture.\n\t\t\t/**\n\t\t\t * TODO: Is it need to apply on another projection type?\n\t\t\t */\n\t\t\tresizeDimension = width > height ?\n\t\t\t\t{width: maxSize, height: maxSize * height / width} :\n\t\t\t\t{width: maxSize * width / height, height: maxSize};\n\t\t}\n\n\t\t// Pixel Source for IE11 & Video or resizing needed\n\t\tthis._initPixelSource(image, resizeDimension);\n\n\t\tgl.activeTexture(gl.TEXTURE0);\n\t\tgl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);\n\t\tgl.bindTexture(gl.TEXTURE_2D, texture);\n\n\t\tthis.updateTexture(gl, image);\n\t}\n\n\tupdateShaderData({imageAspectRatio = MIN_ASPECT_RATIO_FOR_FULL_PANORAMA}) {\n\t\tlet lngIdx;\n\t\tlet cylinderMaxRadian;\n\t\tlet halfCylinderY;\n\t\tlet rotated;\n\t\tlet aspectRatio;\n\n\t\t// Exception case: orientation is rotated.\n\t\tif (imageAspectRatio < 1) {\n\t\t\t/**\n\t\t\t * If rotated is true, we assume that image is rotated counter clockwise.\n\t\t\t * TODO: If there's other rotation, it is need to implement by each rotation.\n\t\t\t */\n\t\t\trotated = true;\n\t\t\taspectRatio = 1 / imageAspectRatio;\n\t\t} else {\n\t\t\trotated = false;\n\t\t\taspectRatio = imageAspectRatio;\n\t\t}\n\n\t\tif (aspectRatio >= MIN_ASPECT_RATIO_FOR_FULL_PANORAMA) {\n\t\t\tconst fov = 360 / aspectRatio;\n\n\t\t\tcylinderMaxRadian = 2 * Math.PI; // 360 deg\n\t\t\thalfCylinderY = Math.tan(glMatrix.toRadian(fov / 2));\n\t\t} else {\n\t\t\tcylinderMaxRadian = aspectRatio;\n\t\t\thalfCylinderY = 0.5;// Range of cylinder is [-0.5, 0.5] to make height to 1.\n\t\t}\n\n\t\t// intialize shader data before update\n\t\ttextureCoordData.length = 0;\n\t\tvertexPositionData.length = 0;\n\t\tindexData.length = 0;\n\n\t\tconst CYLIDER_Y = [-halfCylinderY, halfCylinderY];\n\t\tconst startAngleForCenterAlign = Math.PI / 2 + (2 * Math.PI - cylinderMaxRadian) / 2; // Math.PI / 2 start point when cylinderMaxRadian is 2 phi(360)\n\n\t\t// console.log(\"cylinderMaxRadian:\", glMatrix.toDegree(cylinderMaxRadian), \"CYLIDER_Y\", CYLIDER_Y, \"start angle\", glMatrix.toDegree(startAngleForCenterAlign));\n\t\tfor (let yIdx = 0, yLength = CYLIDER_Y.length; yIdx < yLength/* bottom & top */; yIdx++) {\n\t\t\tfor (lngIdx = 0; lngIdx <= longitudeBands; lngIdx++) {\n\t\t\t\tconst angle = startAngleForCenterAlign + (lngIdx / longitudeBands * cylinderMaxRadian);\n\t\t\t\tconst x = Math.cos(angle);\n\t\t\t\tconst y = CYLIDER_Y[yIdx];\n\t\t\t\tconst z = Math.sin(angle);\n\t\t\t\tlet u;\n\t\t\t\tlet v;\n\n\t\t\t\tif (rotated) {\n\t\t\t\t\t// Rotated 90 degree (counter clock wise)\n\t\t\t\t\tu = 1 - yIdx; // yLength - yIdx;\n\t\t\t\t\tv = lngIdx / longitudeBands;\n\t\t\t\t} else {\n\t\t\t\t// \t// Normal case (Not rotated)\n\t\t\t\t\tu = lngIdx / longitudeBands;\n\t\t\t\t\tv = yIdx;\n\t\t\t\t}\n\n\t\t\t\ttextureCoordData.push(u, v);\n\t\t\t\tvertexPositionData.push(x, y, z);\n\n\t\t\t\tif (yIdx === 0 && lngIdx < longitudeBands) {\n\t\t\t\t\tconst a = lngIdx;\n\t\t\t\t\tconst b = a + longitudeBands + 1;\n\n\t\t\t\t\tindexData.push(a, b, a + 1, b, b + 1, a + 1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default CylinderRenderer;\n","import {mat4} from \"gl-matrix\";\n\nconst VR_DISPLAY_PRESENT_CHANGE = \"vrdisplaypresentchange\";\nconst DEFAULT_LEFT_BOUNDS = [0, 0, 0.5, 1];\nconst DEFAULT_RIGHT_BOUNDS = [0.5, 0, 0.5, 1];\nconst EYES = {\n\tLEFT: \"left\",\n\tRIGHT: \"right\"\n};\n\nclass VRManager {\n\tget context() { return this._vrDisplay; }\n\n\tconstructor() {\n\t\tthis._frameData = new window.VRFrameData();\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst vrDisplay = this._vrDisplay;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (vrDisplay && vrDisplay.isPresenting) {\n\t\t\tvrDisplay.exitPresent();\n\t\t}\n\n\t\tthis._clear();\n\t}\n\n\tcanRender() {\n\t\treturn Boolean(this._vrDisplay);\n\t}\n\n\tbeforeRender(gl) {\n\t\t// Render to the default backbuffer\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t}\n\n\tafterRender() {\n\t\tthis._vrDisplay.submitFrame();\n\t}\n\n\tgetEyeParams(gl) {\n\t\tconst display = this._vrDisplay;\n\t\tconst halfWidth = gl.drawingBufferWidth * 0.5;\n\t\tconst height = gl.drawingBufferHeight;\n\t\tconst frameData = this._frameData;\n\n\t\tdisplay.getFrameData(frameData);\n\n\t\tconst leftMVMatrix = frameData.leftViewMatrix;\n\t\tconst rightMVMatrix = frameData.rightViewMatrix;\n\n\t\tmat4.rotateY(leftMVMatrix, leftMVMatrix, this._yawOffset);\n\t\tmat4.rotateY(rightMVMatrix, rightMVMatrix, this._yawOffset);\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tviewport: [0, 0, halfWidth, height],\n\t\t\t\tmvMatrix: leftMVMatrix,\n\t\t\t\tpMatrix: frameData.leftProjectionMatrix,\n\t\t\t},\n\t\t\t{\n\t\t\t\tviewport: [halfWidth, 0, halfWidth, height],\n\t\t\t\tmvMatrix: rightMVMatrix,\n\t\t\t\tpMatrix: frameData.rightProjectionMatrix,\n\t\t\t}\n\t\t];\n\t}\n\n\tisPresenting() {\n\t\treturn Boolean(this._vrDisplay && this._vrDisplay.isPresenting);\n\t}\n\n\taddEndCallback(callback) {\n\t\twindow.addEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\twindow.removeEventListener(VR_DISPLAY_PRESENT_CHANGE, callback);\n\t}\n\n\trequestPresent(canvas) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tnavigator.getVRDisplays().then(displays => {\n\t\t\t\tconst vrDisplay = displays.length && displays[0];\n\n\t\t\t\tif (!vrDisplay) {\n\t\t\t\t\treject(new Error(\"No displays available.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!vrDisplay.capabilities.canPresent) {\n\t\t\t\t\treject(new Error(\"Display lacking capability to present.\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvrDisplay.requestPresent([{source: canvas}]).then(() => {\n\t\t\t\t\tconst leftEye = vrDisplay.getEyeParameters(EYES.LEFT);\n\t\t\t\t\tconst rightEye = vrDisplay.getEyeParameters(EYES.RIGHT);\n\n\t\t\t\t\tcanvas.width = Math.max(leftEye.renderWidth, rightEye.renderWidth) * 2;\n\t\t\t\t\tcanvas.height = Math.max(leftEye.renderHeight, rightEye.renderHeight);\n\n\t\t\t\t\tthis._setDisplay(vrDisplay);\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setDisplay(vrDisplay) {\n\t\tthis._vrDisplay = vrDisplay;\n\n\t\tconst layers = vrDisplay.getLayers();\n\n\t\tif (layers.length) {\n\t\t\tconst layer = layers[0];\n\n\t\t\tthis._leftBounds = layer.leftBounds;\n\t\t\tthis._rightBounds = layer.rightBounds;\n\t\t}\n\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._vrDisplay = null;\n\t\tthis._leftBounds = DEFAULT_LEFT_BOUNDS;\n\t\tthis._rightBounds = DEFAULT_RIGHT_BOUNDS;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default VRManager;\n","import {mat4, glMatrix} from \"gl-matrix\";\nimport {IS_SAFARI_ON_DESKTOP} from \"../../utils/browser\";\n\nconst XR_REFERENCE_SPACE = \"local\";\n\nclass XRManager {\n\tget context() { return this._xrSession; }\n\n\tconstructor() {\n\t\tthis._clear();\n\t}\n\n\tdestroy = () => {\n\t\tconst xrSession = this._xrSession;\n\n\t\tthis.removeEndCallback(this.destroy);\n\n\t\tif (xrSession) {\n\t\t\t// Capture to avoid errors\n\t\t\txrSession.end().then(() => {}, () => {});\n\t\t}\n\t\tthis._clear();\n\t}\n\n\tcanRender(frame) {\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\treturn Boolean(pose);\n\t}\n\n\tbeforeRender(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst baseLayer = session.renderState.baseLayer;\n\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, baseLayer.framebuffer);\n\t}\n\n\tafterRender() {}\n\n\tgetEyeParams(gl, frame) {\n\t\tconst session = frame.session;\n\t\tconst pose = frame.getViewerPose(this._xrRefSpace);\n\n\t\tif (!pose) {\n\t\t\t// Can't render\n\t\t\treturn null;\n\t\t}\n\n\t\tconst glLayer = session.renderState.baseLayer;\n\n\t\treturn pose.views.map(view => {\n\t\t\tconst viewport = glLayer.getViewport(view);\n\t\t\tconst mvMatrix = view.transform.inverse.matrix;\n\n\t\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\t\tmat4.rotateX(mvMatrix, mvMatrix, glMatrix.toRadian(180));\n\t\t\t}\n\n\t\t\tmat4.rotateY(mvMatrix, mvMatrix, this._yawOffset);\n\n\t\t\treturn {\n\t\t\t\tviewport: [viewport.x, viewport.y, viewport.width, viewport.height],\n\t\t\t\tmvMatrix,\n\t\t\t\tpMatrix: view.projectionMatrix\n\t\t\t};\n\t\t});\n\t}\n\n\tisPresenting() {\n\t\treturn this._presenting;\n\t}\n\n\taddEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.addEventListener(\"end\", callback);\n\t}\n\n\tremoveEndCallback(callback) {\n\t\tconst session = this._xrSession;\n\n\t\tif (!session) return;\n\n\t\tsession.removeEventListener(\"end\", callback);\n\t}\n\n\trequestPresent(canvas, gl) {\n\t\treturn navigator.xr.requestSession(\"immersive-vr\", {\n\t\t\trequiredFeatures: [XR_REFERENCE_SPACE],\n\t\t}).then(session => {\n\t\t\tconst xrLayer = new window.XRWebGLLayer(session, gl);\n\n\t\t\tsession.updateRenderState({baseLayer: xrLayer});\n\t\t\treturn session.requestReferenceSpace(XR_REFERENCE_SPACE)\n\t\t\t\t.then(refSpace => {\n\t\t\t\t\tthis._setSession(session, xrLayer, refSpace);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tsetYawOffset(offset) {\n\t\tthis._yawOffset = offset;\n\t}\n\n\t_setSession(session, xrLayer, refSpace) {\n\t\tthis._xrSession = session;\n\t\tthis._xrLayer = xrLayer;\n\t\tthis._xrRefSpace = refSpace;\n\t\tthis._presenting = true;\n\t\tthis.addEndCallback(this.destroy);\n\t}\n\n\t_clear() {\n\t\tthis._xrSession = null;\n\t\tthis._xrLayer = null;\n\t\tthis._xrRefSpace = null;\n\t\tthis._presenting = false;\n\t\tthis._yawOffset = 0;\n\t}\n}\n\nexport default XRManager;\n","import {IS_SAFARI_ON_DESKTOP} from \"../utils/browser\";\n\nclass WebGLAnimator {\n\tconstructor() {\n\t\tthis._callback = null;\n\t\tthis._context = window;\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\tsetCallback(callback) {\n\t\tthis._callback = callback;\n\t}\n\n\tsetContext(context) {\n\t\tthis._context = context;\n\t}\n\n\tstart() {\n\t\tconst context = this._context;\n\t\tconst callback = this._callback;\n\n\t\t// No context / callback set\n\t\tif (!context || !callback) return;\n\t\t// Animation already started\n\t\tif (this._rafId >= 0 || this._rafTimer >= 0) return;\n\n\t\tif (IS_SAFARI_ON_DESKTOP) {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoopNextTick);\n\t\t} else {\n\t\t\tthis._rafId = context.requestAnimationFrame(this._onLoop);\n\t\t}\n\t}\n\n\tstop() {\n\t\tif (this._rafId >= 0) {\n\t\t\tthis._context.cancelAnimationFrame(this._rafId);\n\t\t}\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t}\n\n\t\tthis._rafId = -1;\n\t\tthis._rafTimer = -1;\n\t}\n\n\t/**\n\t * There can be more than 1 argument when we use XRSession's raf\n\t */\n\t_onLoop = (...args) => {\n\t\tthis._callback(...args);\n\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t}\n\n\t/**\n\t * MacOS X Safari Bug Fix\n\t * This code guarantees that rendering should be occurred.\n\t *\n\t * In MacOS X(10.14.2), Safari (12.0.2)\n\t * The requestAnimationFrame(RAF) callback is called just after previous RAF callback without term\n\t * only if requestAnimationFrame is called for next frame while updating frame is delayed (~over 2ms)\n\t * So browser cannot render the frame and may be freezing.\n\t */\n\t_onLoopNextTick = (...args) => {\n\t\tconst before = performance.now();\n\n\t\tthis._callback(...args);\n\n\t\tconst diff = performance.now() - before;\n\n\t\tif (this._rafTimer >= 0) {\n\t\t\tclearTimeout(this._rafTimer);\n\t\t\tthis._rafTimer = -1;\n\t\t}\n\n\t\t/** Use requestAnimationFrame only if current rendering could be possible over 60fps (1000/60) */\n\t\tif (diff < 16) {\n\t\t\tthis._rafId = this._context.requestAnimationFrame(this._onLoop);\n\t\t} else {\n\t\t\t/** Otherwise, Call setTimeout instead of requestAnimationFrame to gaurantee renering should be occurred*/\n\t\t\tthis._rafTimer = setTimeout(this._onLoop, 0);\n\t\t}\n\t}\n}\n\nexport default WebGLAnimator;\n","import Component from \"@egjs/component\";\nimport {glMatrix, vec3, mat3, mat4, quat} from \"gl-matrix\";\nimport ImageLoader from \"./ImageLoader\";\nimport VideoLoader from \"./VideoLoader\";\nimport WebGLUtils from \"./WebGLUtils\";\nimport Renderer from \"./renderer/Renderer\";\nimport CubeRenderer from \"./renderer/CubeRenderer\";\nimport CubeStripRenderer from \"./renderer/CubeStripRenderer\";\nimport SphereRenderer from \"./renderer/SphereRenderer\";\nimport CylinderRenderer from \"./renderer/CylinderRenderer\";\nimport VRManager from \"./vr/VRManager\";\nimport XRManager from \"./vr/XRManager\";\nimport WebGLAnimator from \"./WebGLAnimator\";\nimport {util as mathUtil} from \"../utils/math-util\";\nimport {devicePixelRatio, WEBXR_SUPPORTED} from \"../utils/browserFeature\";\nimport {PROJECTION_TYPE, STEREO_FORMAT} from \"../PanoViewer/consts\";\nimport {IS_IOS} from \"../utils/browser\";\n\nconst ImageType = PROJECTION_TYPE;\n\nlet DEVICE_PIXEL_RATIO = devicePixelRatio || 1;\n\n// DEVICE_PIXEL_RATIO 가 2를 초과하는 경우는 리소스 낭비이므로 2로 맞춘다.\nif (DEVICE_PIXEL_RATIO > 2) {\n\tDEVICE_PIXEL_RATIO = 2;\n}\n\n// define custom events name\n/**\n * TODO: how to manage events/errortype with PanoViewer\n *\n * I think renderer events should be seperated from viewer events although it has same name.\n */\nconst EVENTS = {\n\tBIND_TEXTURE: \"bindTexture\",\n\tIMAGE_LOADED: \"imageLoaded\",\n\tERROR: \"error\",\n\tRENDERING_CONTEXT_LOST: \"renderingContextLost\",\n\tRENDERING_CONTEXT_RESTORE: \"renderingContextRestore\",\n};\n\nconst ERROR_TYPE = {\n\tINVALID_DEVICE: 10,\n\tNO_WEBGL: 11,\n\tFAIL_IMAGE_LOAD: 12,\n\tRENDERER_ERROR: 13\n};\n\nclass PanoImageRenderer extends Component {\n\tstatic EVENTS = EVENTS;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\n\tconstructor(\n\t\timage, width, height, isVideo, sphericalConfig, renderingContextAttributes\n\t) {\n\t\t// Super constructor\n\t\tsuper();\n\n\t\tthis.sphericalConfig = sphericalConfig;\n\t\tthis.fieldOfView = sphericalConfig.fieldOfView;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tthis._lastQuaternion = null;\n\t\tthis._lastYaw = null;\n\t\tthis._lastPitch = null;\n\t\tthis._lastFieldOfView = null;\n\n\t\tthis.pMatrix = mat4.create();\n\t\tthis.mvMatrix = mat4.create();\n\n\t\t// initialzie pMatrix\n\t\tmat4.perspective(this.pMatrix, glMatrix.toRadian(this.fieldOfView), width / height, 0.1, 100);\n\n\t\tthis.textureCoordBuffer = null;\n\t\tthis.vertexBuffer = null;\n\t\tthis.indexBuffer = null;\n\n\t\tthis.canvas = this._initCanvas(width, height);\n\t\tthis._setDefaultCanvasStyle();\n\t\tthis._wrapper = null; // canvas wrapper\n\t\tthis._wrapperOrigStyle = null;\n\n\t\tthis._renderingContextAttributes = renderingContextAttributes;\n\t\tthis._image = null;\n\t\tthis._imageConfig = null;\n\t\tthis._imageIsReady = false;\n\t\tthis._shouldForceDraw = false;\n\t\tthis._keepUpdate = false; // Flag to specify 'continuous update' on video even when still.\n\n\t\tthis._onContentLoad = this._onContentLoad.bind(this);\n\t\tthis._onContentError = \tthis._onContentError.bind(this);\n\n\t\tthis._animator = new WebGLAnimator();\n\n\t\t// VR/XR manager\n\t\tthis._vr = null;\n\n\t\tif (image) {\n\t\t\tthis.setImage({\n\t\t\t\timage,\n\t\t\t\timageType: sphericalConfig.imageType,\n\t\t\t\tisVideo,\n\t\t\t\tcubemapConfig: sphericalConfig.cubemapConfig\n\t\t\t});\n\t\t}\n\t}\n\n\t// FIXME: Please refactor me to have more loose connection to yawpitchcontrol\n\tsetYawPitchControl(yawPitchControl) {\n\t\tthis._yawPitchControl = yawPitchControl;\n\t}\n\n\tgetContent() {\n\t\treturn this._image;\n\t}\n\n\tsetImage({image, imageType, isVideo = false, cubemapConfig}) {\n\t\tthis._imageIsReady = false;\n\t\tthis._isVideo = isVideo;\n\t\tthis._imageConfig = Object.assign(\n\t\t\t{\n\t\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only */\n\t\t\t\torder: (imageType === ImageType.CUBEMAP) ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\t\ttileConfig: {\n\t\t\t\t\tflipHorizontal: false,\n\t\t\t\t\trotation: 0\n\t\t\t\t}\n\t\t\t},\n\t\t\tcubemapConfig\n\t\t);\n\t\tthis._setImageType(imageType);\n\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tif (isVideo) {\n\t\t\tthis._contentLoader = new VideoLoader();\n\t\t\tthis._keepUpdate = true;\n\t\t} else {\n\t\t\tthis._contentLoader = new ImageLoader();\n\t\t\tthis._keepUpdate = false;\n\t\t}\n\n\t\t// img element or img url\n\t\tthis._contentLoader.set(image);\n\n\t\t// 이미지의 사이즈를 캐시한다.\n\t\t// image is reference for content in contentLoader, so it may be not valid if contentLoader is destroyed.\n\t\tthis._image = this._contentLoader.getElement();\n\n\t\treturn this._contentLoader.get()\n\t\t\t.then(this._onContentLoad, this._onContentError)\n\t\t\t.catch(e => setTimeout(() => { throw e; }));// Prevent exceptions from being isolated in promise chain.\n\t}\n\n\t_setImageType(imageType) {\n\t\tif (!imageType || this._imageType === imageType) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._imageType = imageType;\n\t\tthis._isCubeMap = imageType === ImageType.CUBEMAP;\n\n\t\tif (this._renderer) {\n\t\t\tthis._renderer.off();\n\t\t}\n\n\t\tswitch (imageType) {\n\t\t\tcase ImageType.CUBEMAP:\n\t\t\t\tthis._renderer = new CubeRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.CUBESTRIP:\n\t\t\t\tthis._renderer = new CubeStripRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.PANORAMA:\n\t\t\t\tthis._renderer = new CylinderRenderer();\n\t\t\t\tbreak;\n\t\t\tcase ImageType.STEREOSCOPIC_EQUI:\n\t\t\t\tthis._renderer = new SphereRenderer(this.sphericalConfig.stereoFormat);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis._renderer = new SphereRenderer(STEREO_FORMAT.NONE);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis._renderer.on(Renderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERER_ERROR,\n\t\t\t\tmessage: e.message\n\t\t\t});\n\t\t});\n\n\t\tthis._initWebGL();\n\t}\n\n\t_initCanvas(width, height) {\n\t\tconst canvas = document.createElement(\"canvas\");\n\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\n\t\tthis._onWebglcontextlost = this._onWebglcontextlost.bind(this);\n\t\tthis._onWebglcontextrestored = this._onWebglcontextrestored.bind(this);\n\n\t\tcanvas.addEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tcanvas.addEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\n\t\treturn canvas;\n\t}\n\n\t_setDefaultCanvasStyle() {\n\t\tconst canvas = this.canvas;\n\n\t\tcanvas.style.bottom = 0;\n\t\tcanvas.style.left = 0;\n\t\tcanvas.style.right = 0;\n\t\tcanvas.style.top = 0;\n\t\tcanvas.style.margin = \"auto\";\n\t\tcanvas.style.maxHeight = \"100%\";\n\t\tcanvas.style.maxWidth = \"100%\";\n\t\tcanvas.style.outline = \"none\";\n\t\tcanvas.style.position = \"absolute\";\n\t}\n\n\t_onContentError(error) {\n\t\tthis._imageIsReady = false;\n\t\tthis._image = null;\n\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\ttype: ERROR_TYPE.FAIL_IMAGE_LOAD,\n\t\t\tmessage: \"failed to load image\"\n\t\t});\n\n\t\treturn false;\n\t}\n\n\t_triggerContentLoad() {\n\t\tthis.trigger(EVENTS.IMAGE_LOADED, {\n\t\t\tcontent: this._image,\n\t\t\tisVideo: this._isVideo,\n\t\t\tprojectionType: this._imageType\n\t\t});\n\t}\n\t_onContentLoad(image) {\n\t\tthis._imageIsReady = true;\n\n\t\tthis._triggerContentLoad();\n\t\treturn true;\n\t}\n\n\tisImageLoaded() {\n\t\treturn !!this._image && this._imageIsReady &&\n\t\t\t(!this._isVideo || this._image.readyState >= 2 /* HAVE_CURRENT_DATA */);\n\t}\n\n\tbindTexture() {\n\t\treturn new Promise((res, rej) => {\n\t\t\tif (!this._contentLoader) {\n\t\t\t\trej(\"ImageLoader is not initialized\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._contentLoader.get()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis._bindTexture();\n\t\t\t\t}, rej)\n\t\t\t\t.then(res);\n\t\t});\n\t}\n\n\t// 부모 엘리먼트에 canvas 를 붙임\n\tattachTo(parentElement) {\n\t\tthis.detach();\n\t\tparentElement.appendChild(this.canvas);\n\t\tthis._wrapper = parentElement;\n\t}\n\n\tforceContextLoss() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\tconst loseContextExtension = this.context.getExtension(\"WEBGL_lose_context\");\n\n\t\t\tif (loseContextExtension) {\n\t\t\t\tloseContextExtension.loseContext();\n\t\t\t}\n\t\t}\n\t}\n\n\t// 부모 엘리먼트에서 canvas 를 제거\n\tdetach() {\n\t\tif (this.canvas.parentElement) {\n\t\t\tthis.canvas.parentElement.removeChild(this.canvas);\n\t\t}\n\t}\n\n\tdestroy() {\n\t\tif (this._contentLoader) {\n\t\t\tthis._contentLoader.destroy();\n\t\t}\n\n\t\tthis._animator.stop();\n\t\tthis.detach();\n\t\tthis.forceContextLoss();\n\n\t\tthis.off();\n\n\t\tthis.canvas.removeEventListener(\"webglcontextlost\", this._onWebglcontextlost);\n\t\tthis.canvas.removeEventListener(\"webglcontextrestored\", this._onWebglcontextrestored);\n\t}\n\n\thasRenderingContext() {\n\t\tif (!(this.context && !this.context.isContextLost())) {\n\t\t\treturn false;\n\t\t} else if (\n\t\t\tthis.context &&\n\t\t\t!this.context.getProgramParameter(this.shaderProgram, this.context.LINK_STATUS)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\t_initShaderProgram() {\n\t\tconst gl = this.context;\n\n\t\tif (this.shaderProgram) {\n\t\t\tgl.deleteProgram(this.shaderProgram);\n\t\t\tthis.shaderProgram = null;\n\t\t}\n\n\t\tconst renderer = this._renderer;\n\n\t\tconst vsSource = renderer.getVertexShaderSource();\n\t\tconst fsSource = renderer.getFragmentShaderSource();\n\n\t\tconst vertexShader = WebGLUtils.createShader(gl, gl.VERTEX_SHADER, vsSource);\n\t\tconst fragmentShader = WebGLUtils.createShader(gl, gl.FRAGMENT_SHADER, fsSource);\n\n\t\tconst shaderProgram = WebGLUtils.createProgram(gl, vertexShader, fragmentShader);\n\n\t\tif (!shaderProgram) {\n\t\t\tthrow new Error(`Failed to intialize shaders: ${WebGLUtils.getErrorNameFromWebGLErrorCode(gl.getError())}`);\n\t\t}\n\n\t\tgl.useProgram(shaderProgram);\n\t\tshaderProgram.vertexPositionAttribute = gl.getAttribLocation(shaderProgram, \"aVertexPosition\");\n\t\tgl.enableVertexAttribArray(shaderProgram.vertexPositionAttribute);\n\t\tshaderProgram.pMatrixUniform = gl.getUniformLocation(shaderProgram, \"uPMatrix\");\n\t\tshaderProgram.mvMatrixUniform = gl.getUniformLocation(shaderProgram, \"uMVMatrix\");\n\t\tshaderProgram.samplerUniform = gl.getUniformLocation(shaderProgram, \"uSampler\");\n\t\tshaderProgram.textureCoordAttribute = gl.getAttribLocation(shaderProgram, \"aTextureCoord\");\n\t\tshaderProgram.uEye = gl.getUniformLocation(shaderProgram, \"uEye\");\n\n\t\tgl.enableVertexAttribArray(shaderProgram.textureCoordAttribute);\n\n\t\t// clear buffer\n\t\tgl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);\n\t\t// Use TEXTURE0\n\t\tgl.uniform1i(shaderProgram.samplerUniform, 0);\n\n\t\tthis.shaderProgram = shaderProgram;\n\t}\n\n\t_onWebglcontextlost(e) {\n\t\te.preventDefault();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_LOST);\n\t}\n\n\t_onWebglcontextrestored(e) {\n\t\tthis._initWebGL();\n\t\tthis.trigger(EVENTS.RENDERING_CONTEXT_RESTORE);\n\t}\n\n\tupdateFieldOfView(fieldOfView) {\n\t\tthis.fieldOfView = fieldOfView;\n\t\tthis._updateViewport();\n\t}\n\n\tupdateViewportDimensions(width, height) {\n\t\tlet viewPortChanged = false;\n\n\t\tthis.width = width;\n\t\tthis.height = height;\n\n\t\tconst w = width * DEVICE_PIXEL_RATIO;\n\t\tconst h = height * DEVICE_PIXEL_RATIO;\n\n\t\tif (w !== this.canvas.width) {\n\t\t\tthis.canvas.width = w;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (h !== this.canvas.height) {\n\t\t\tthis.canvas.height = h;\n\t\t\tviewPortChanged = true;\n\t\t}\n\n\t\tif (!viewPortChanged) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._updateViewport();\n\t\tthis._shouldForceDraw = true;\n\t}\n\n\t_updateViewport() {\n\t\tmat4.perspective(\n\t\t\tthis.pMatrix,\n\t\t\tglMatrix.toRadian(this.fieldOfView),\n\t\t\tthis.canvas.width / this.canvas.height,\n\t\t\t0.1,\n\t\t\t100);\n\n\t\tthis.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight);\n\t}\n\n\t_initWebGL() {\n\t\tlet gl;\n\n\t\t// TODO: Following code does need to be executed only if width/height, cubicStrip property is changed.\n\t\ttry {\n\t\t\tthis._initRenderingContext();\n\t\t\tgl = this.context;\n\n\t\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\t\tthis._initShaderProgram();\n\t\t} catch (e) {\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\tmessage: \"no webgl support\"\n\t\t\t});\n\t\t\tthis.destroy();\n\t\t\tconsole.error(e); // eslint-disable-line no-console\n\t\t\treturn;\n\t\t}\n\t\t// 캔버스를 투명으로 채운다.\n\t\tgl.clearColor(0, 0, 0, 0);\n\t\tconst textureTarget = this._isCubeMap ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\n\n\t\tif (this.texture) {\n\t\t\tgl.deleteTexture(this.texture);\n\t\t}\n\n\t\tthis.texture = WebGLUtils.createTexture(gl, textureTarget);\n\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\t// TODO: Apply following options on other projection type.\n\t\t\tgl.enable(gl.CULL_FACE);\n\t\t\t// gl.enable(gl.DEPTH_TEST);\n\t\t}\n\t}\n\n\t_initRenderingContext() {\n\t\tif (this.hasRenderingContext()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!window.WebGLRenderingContext) {\n\t\t\tthrow new Error(\"WebGLRenderingContext not available.\");\n\t\t}\n\n\t\tthis.context = WebGLUtils.getWebglContext(this.canvas, this._renderingContextAttributes);\n\n\t\tif (!this.context) {\n\t\t\tthrow new Error(\"Failed to acquire 3D rendering context\");\n\t\t}\n\t}\n\n\t_initBuffers() {\n\t\tconst vertexPositionData = this._renderer.getVertexPositionData();\n\t\tconst indexData = this._renderer.getIndexData();\n\t\tconst textureCoordData = this._renderer.getTextureCoordData(this._imageConfig);\n\t\tconst gl = this.context;\n\n\t\tthis.vertexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(vertexPositionData), 3,\n\t\t\tthis.shaderProgram.vertexPositionAttribute);\n\n\t\tthis.indexBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indexData), 1);\n\n\t\tthis.textureCoordBuffer = WebGLUtils.initBuffer(\n\t\t\tgl, gl.ARRAY_BUFFER, new Float32Array(textureCoordData), this._isCubeMap ? 3 : 2,\n\t\t\tthis.shaderProgram.textureCoordAttribute);\n\n\t\tthis._bindBuffers();\n\t}\n\n\t_bindTexture() {\n\t\t// Detect if it is EAC Format while CUBESTRIP mode.\n\t\t// We assume it is EAC if image is not 3/2 ratio.\n\t\tif (this._imageType === ImageType.CUBESTRIP) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst isEAC = width && height && width / height !== 1.5;\n\n\t\t\tthis.context.uniform1f(this.context.getUniformLocation(this.shaderProgram, \"uIsEAC\"), isEAC);\n\t\t} else if (this._imageType === ImageType.PANORAMA) {\n\t\t\tconst {width, height} = this._renderer.getDimension(this._image);\n\t\t\tconst imageAspectRatio = width && height && width / height;\n\n\t\t\tthis._renderer.updateShaderData({imageAspectRatio});\n\t\t}\n\n\t\t// intialize shader buffers after image is loaded.(by updateShaderData)\n\t\t// because buffer may be differ by image size.(eg. CylinderRenderer)\n\t\tthis._initBuffers();\n\n\t\tthis._renderer.bindTexture(\n\t\t\tthis.context,\n\t\t\tthis.texture,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t\tthis._shouldForceDraw = true;\n\n\t\tthis.trigger(EVENTS.BIND_TEXTURE);\n\t}\n\n\t_updateTexture() {\n\t\tthis._renderer.updateTexture(\n\t\t\tthis.context,\n\t\t\tthis._image,\n\t\t\tthis._imageConfig,\n\t\t);\n\t}\n\n\tkeepUpdate(doUpdate) {\n\t\tif (doUpdate && this.isImageLoaded() === false) {\n\t\t\t// Force to draw a frame after image is loaded on render()\n\t\t\tthis._shouldForceDraw = true;\n\t\t}\n\n\t\tthis._keepUpdate = doUpdate;\n\t}\n\n\tstartRender() {\n\t\tthis._animator.setCallback(this._render.bind(this));\n\t\tthis._animator.start();\n\t}\n\n\tstopRender() {\n\t\tthis._animator.stop();\n\t}\n\n\trenderWithQuaternion(quaternion, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\tthis._lastQuaternion && quat.exactEquals(this._lastQuaternion, quaternion) &&\n\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// updatefieldOfView only if fieldOfView is changed.\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tthis.mvMatrix = mat4.fromQuat(mat4.create(), quaternion);\n\n\t\tthis._draw();\n\n\t\tthis._lastQuaternion = quat.clone(quaternion);\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\trenderWithYawPitch(yaw, pitch, fieldOfView) {\n\t\tif (!this.isImageLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._keepUpdate === false &&\n\t\t\t\tthis._lastYaw !== null && this._lastYaw === yaw &&\n\t\t\t\tthis._lastPitch !== null && this._lastPitch === pitch &&\n\t\t\t\tthis.fieldOfView && this.fieldOfView === fieldOfView &&\n\t\t\t\tthis._shouldForceDraw === false) {\n\t\t\treturn;\n\t\t}\n\n\t\t// fieldOfView 가 존재하면서 기존의 값과 다를 경우에만 업데이트 호출\n\t\tif (fieldOfView !== undefined && fieldOfView !== this.fieldOfView) {\n\t\t\tthis.updateFieldOfView(fieldOfView);\n\t\t}\n\n\t\tmat4.identity(this.mvMatrix);\n\t\tmat4.rotateX(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(pitch));\n\t\tmat4.rotateY(this.mvMatrix, this.mvMatrix, -glMatrix.toRadian(yaw));\n\n\t\tthis._draw();\n\n\t\tthis._lastYaw = yaw;\n\t\tthis._lastPitch = pitch;\n\t\tif (this._shouldForceDraw) {\n\t\t\tthis._shouldForceDraw = false;\n\t\t}\n\t}\n\n\t_render() {\n\t\tconst yawPitchControl = this._yawPitchControl;\n\t\tconst fov = yawPitchControl.getFov();\n\n\t\tif (yawPitchControl.shouldRenderWithQuaternion()) {\n\t\t\tconst quaternion = yawPitchControl.getQuaternion();\n\n\t\t\tthis.renderWithQuaternion(quaternion, fov);\n\t\t} else {\n\t\t\tconst yawPitch = yawPitchControl.getYawPitch();\n\n\t\t\tthis.renderWithYawPitch(yawPitch.yaw, yawPitch.pitch, fov);\n\t\t}\n\t}\n\n\t_renderStereo = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\n\t\tconst eyeParams = vr.getEyeParams(gl, frame);\n\n\t\tif (!eyeParams) return;\n\n\t\tvr.beforeRender(gl, frame);\n\n\t\t// Render both eyes\n\t\tfor (const eyeIndex of [0, 1]) {\n\t\t\tconst eyeParam = eyeParams[eyeIndex];\n\n\t\t\tthis.mvMatrix = eyeParam.mvMatrix;\n\t\t\tthis.pMatrix = eyeParam.pMatrix;\n\n\t\t\tgl.viewport(...eyeParam.viewport);\n\t\t\tgl.uniform1f(this.shaderProgram.uEye, eyeIndex);\n\n\t\t\tthis._bindBuffers();\n\t\t\tthis._draw();\n\t\t}\n\n\t\tvr.afterRender();\n\t}\n\n\t_bindBuffers() {\n\t\tconst gl = this.context;\n\t\tconst program = this.shaderProgram;\n\n\t\tconst vertexBuffer = this.vertexBuffer;\n\t\tconst textureCoordBuffer = this.textureCoordBuffer;\n\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);\n\t\tgl.enableVertexAttribArray(program.vertexPositionAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.vertexPositionAttribute, vertexBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\n\t\tgl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);\n\t\tgl.bindBuffer(gl.ARRAY_BUFFER, textureCoordBuffer);\n\t\tgl.enableVertexAttribArray(program.textureCoordAttribute);\n\t\tgl.vertexAttribPointer(\n\t\t\tprogram.textureCoordAttribute, textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0\n\t\t);\n\t}\n\n\t_draw() {\n\t\tif (this._isVideo && this._keepUpdate) {\n\t\t\tthis._updateTexture();\n\t\t}\n\n\t\tthis._renderer.render({\n\t\t\tgl: this.context,\n\t\t\tshaderProgram: this.shaderProgram,\n\t\t\tindexBuffer: this.indexBuffer,\n\t\t\tmvMatrix: this.mvMatrix,\n\t\t\tpMatrix: this.pMatrix,\n\t\t});\n\t}\n\n\t/**\n\t * Returns projection renderer by each type\n\t */\n\tgetProjectionRenderer() {\n\t\treturn this._renderer;\n\t}\n\n\t/**\n\t * @return Promise\n\t */\n\tenterVR() {\n\t\tconst vr = this._vr;\n\n\t\tif (!WEBXR_SUPPORTED && !navigator.getVRDisplays) {\n\t\t\treturn Promise.reject(\"VR is not available on this browser.\");\n\t\t}\n\t\tif (vr && vr.isPresenting()) {\n\t\t\treturn Promise.resolve(\"VR already enabled.\");\n\t\t}\n\n\t\treturn this._requestPresent();\n\t}\n\n\texitVR = () => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\tif (!vr) return;\n\n\t\tvr.removeEndCallback(this.exitVR);\n\t\tvr.destroy();\n\t\tthis._vr = null;\n\n\t\t// Restore canvas & context on iOS\n\t\tif (IS_IOS) {\n\t\t\tthis._restoreStyle();\n\t\t}\n\t\tthis.updateViewportDimensions(this.width, this.height);\n\t\tthis._updateViewport();\n\t\tgl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\t\tthis._bindBuffers();\n\t\tthis._shouldForceDraw = true;\n\n\t\tanimator.stop();\n\t\tanimator.setContext(window);\n\t\tanimator.setCallback(this._render.bind(this));\n\t\tanimator.start();\n\t}\n\n\t_requestPresent() {\n\t\tconst gl = this.context;\n\t\tconst canvas = this.canvas;\n\t\tconst animator = this._animator;\n\n\t\tthis._vr = WEBXR_SUPPORTED ?\n\t\t\tnew XRManager() :\n\t\t\tnew VRManager();\n\n\t\tconst vr = this._vr;\n\n\t\tanimator.stop();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvr.requestPresent(canvas, gl)\n\t\t\t\t.then(() => {\n\t\t\t\t\tvr.addEndCallback(this.exitVR);\n\t\t\t\t\tanimator.setContext(vr.context);\n\t\t\t\t\tanimator.setCallback(this._onFirstVRFrame);\n\n\t\t\t\t\tif (IS_IOS) {\n\t\t\t\t\t\tthis._setWrapperFullscreen();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._shouldForceDraw = true;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\tresolve(\"success\");\n\t\t\t\t})\n\t\t\t\t.catch(e => {\n\t\t\t\t\tvr.destroy();\n\t\t\t\t\tthis._vr = null;\n\t\t\t\t\tanimator.start();\n\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t});\n\t}\n\n\t_onFirstVRFrame = (time, frame) => {\n\t\tconst vr = this._vr;\n\t\tconst gl = this.context;\n\t\tconst animator = this._animator;\n\n\t\t// If rendering is not ready, wait for next frame\n\t\tif (!vr.canRender(frame)) return;\n\n\t\tconst minusZDir = vec3.fromValues(0, 0, -1);\n\t\tconst eyeParam = vr.getEyeParams(gl, frame)[0];\n\t\t// Extract only rotation\n\t\tconst mvMatrix = mat3.fromMat4(mat3.create(), eyeParam.mvMatrix);\n\t\tconst pMatrix = mat3.fromMat4(mat3.create(), eyeParam.pMatrix);\n\n\t\tconst mvInv = mat3.invert(mat3.create(), mvMatrix);\n\t\tconst pInv = mat3.invert(mat3.create(), pMatrix);\n\t\tconst viewDir = vec3.transformMat3(vec3.create(), minusZDir, pInv);\n\n\t\tvec3.transformMat3(viewDir, viewDir, mvInv);\n\n\t\tconst yawOffset = mathUtil.yawOffsetBetween(viewDir, vec3.fromValues(0, 0, 1));\n\n\t\tif (yawOffset === 0) {\n\t\t\t// If the yawOffset is exactly 0, then device sensor is not ready\n\t\t\t// So read it again until it has any value in it\n\t\t\treturn;\n\t\t}\n\n\t\tvr.setYawOffset(yawOffset);\n\t\tanimator.setCallback(this._renderStereo);\n\t}\n\n\t_setWrapperFullscreen() {\n\t\tconst wrapper = this._wrapper;\n\n\t\tif (!wrapper) return;\n\n\t\tthis._wrapperOrigStyle = wrapper.getAttribute(\"style\");\n\t\tconst wrapperStyle = wrapper.style;\n\n\t\twrapperStyle.width = \"100vw\";\n\t\twrapperStyle.height = \"100vh\";\n\t\twrapperStyle.position = \"fixed\";\n\t\twrapperStyle.left = \"0\";\n\t\twrapperStyle.top = \"0\";\n\t\twrapperStyle.zIndex = \"9999\";\n\t}\n\n\t_restoreStyle() {\n\t\tconst wrapper = this._wrapper;\n\t\tconst canvas = this.canvas;\n\n\t\tif (!wrapper) return;\n\n\t\tif (this._wrapperOrigStyle) {\n\t\t\twrapper.setAttribute(\"style\", this._wrapperOrigStyle);\n\t\t} else {\n\t\t\twrapper.removeAttribute(\"style\");\n\t\t}\n\n\t\tthis._wrapperOrigStyle = null;\n\n\t\t// Restore canvas style\n\t\tcanvas.removeAttribute(\"style\");\n\t\tthis._setDefaultCanvasStyle();\n\t}\n}\n\nexport default PanoImageRenderer;\n","import Component from \"@egjs/component\";\nimport {glMatrix} from \"gl-matrix\";\nimport {\n\tDeviceMotionEvent, checkXRSupport\n} from \"../utils/browserFeature\";\n\nimport YawPitchControl from \"../YawPitchControl/YawPitchControl\";\nimport PanoImageRenderer from \"../PanoImageRenderer/PanoImageRenderer\";\nimport WebGLUtils from \"../PanoImageRenderer/WebGLUtils\";\nimport {ERROR_TYPE, EVENTS, GYRO_MODE, PROJECTION_TYPE, STEREO_FORMAT} from \"./consts\";\nimport {util as mathUtil} from \"../utils/math-util.js\";\nimport {VERSION} from \"../version\";\n\nclass PanoViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.PanoViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic VERSION = VERSION;\n\tstatic ERROR_TYPE = ERROR_TYPE;\n\tstatic EVENTS = EVENTS;\n\tstatic PROJECTION_TYPE = PROJECTION_TYPE;\n\tstatic GYRO_MODE = GYRO_MODE;\n\t// It should be deprecated!\n\tstatic ProjectionType = PROJECTION_TYPE;\n\tstatic STEREO_FORMAT = STEREO_FORMAT;\n\t/**\n\t * Constant value for touch directions\n\t * @ko 터치 방향에 대한 상수 값.\n\t * @namespace\n\t * @name TOUCH_DIRECTION\n\t * @memberof eg.view360.PanoViewer\n\t */\n\tstatic TOUCH_DIRECTION = {\n\t\t/**\n\t\t * Constant value for none direction.\n\t\t * @ko none 방향에 대한 상수 값.\n\t\t * @name NONE\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 1\n\t\t */\n\t\tNONE: YawPitchControl.TOUCH_DIRECTION_NONE,\n\t\t/**\n\t\t * Constant value for horizontal(yaw) direction.\n\t\t * @ko horizontal(yaw) 방향에 대한 상수 값.\n\t\t * @name YAW\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 6\n\t\t */\n\t\tYAW: YawPitchControl.TOUCH_DIRECTION_YAW,\n\t\t/**\n\t\t * Constant value for vertical direction.\n\t\t * @ko vertical(pitch) 방향에 대한 상수 값.\n\t\t * @name PITCH\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 24\n\t\t */\n\t\tPITCH: YawPitchControl.TOUCH_DIRECTION_PITCH,\n\t\t/**\n\t\t * Constant value for all direction.\n\t\t * @ko all 방향에 대한 상수 값.\n\t\t * @name ALL\n\t\t * @memberof eg.view360.PanoViewer.TOUCH_DIRECTION\n\t\t * @constant\n\t\t * @type {Number}\n\t\t * @default 30\n\t\t */\n\t\tALL: YawPitchControl.TOUCH_DIRECTION_ALL\n\t};\n\n\t/**\n\t * @classdesc 360 media viewer\n\t * @ko 360 미디어 뷰어\n\t * @class\n\t * @name eg.view360.PanoViewer\n\t * @extends eg.Component\n\t *\n\t * @param {HTMLElement} container The container element for the renderer. 렌더러의 컨테이너 엘리먼트\n\t * @param {Object} config\n\t *\n\t * @param {String|Image} config.image Input image url or element (Use only image property or video property)입력 이미지 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String|HTMLVideoElement} config.video Input video url or element(Use only image property or video property)입력 비디오 URL 혹은 엘리먼트(image 와 video 둘 중 하나만 설정)\n\t * @param {String} [config.projectionType=equirectangular] The type of projection: equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}Projection 유형 : equirectangular, cubemap
{@link eg.view360.PanoViewer.PROJECTION_TYPE}
\n\t * @param {Object} config.cubemapConfig config cubemap projection layout. It is applied when projectionType is {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} or {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP}cubemap projection type 의 레이아웃을 설정한다. 이 설정은 ProjectionType이 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP} 혹은 {@link eg.view360.PanoViewer.PROJECTION_TYPE.CUBESTRIP} 인 경우에만 적용된다.\n\t * @param {Object} [config.cubemapConfig.order = \"RLUDBF\"(ProjectionType === CUBEMAP) | \"RLUDFB\" (ProjectionType === CUBESTRIP)] Order of cubemap faces Cubemap 형태의 이미지가 배치된 순서\n\t * @param {Object} [config.cubemapConfig.tileConfig = {flipHorizontal:false, rotation: 0}] Setting about rotation angle(degree) and whether to flip horizontal for each cubemap faces, if you put this object as a array, you can set each faces with different setting. For example, [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]각 Cubemap 면에 대한 회전 각도/좌우반전 여부 설정, 객체를 배열 형태로 지정하여 각 면에 대한 설정을 다르게 지정할 수도 있다. 예를 들어 [{flipHorizontal:false, rotation:90}, {flipHorizontal: true, rotation: 180}, ...]과 같이 지정할 수 있다.\n\t * @param {String} [config.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection.
See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다.
{@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.
\n\t * @param {Number} [config.width=width of container] the viewer's width. (in px) 뷰어의 너비 (px 단위)\n\t * @param {Number} [config.height=height of container] the viewer's height.(in px) 뷰어의 높이 (px 단위)\n\t *\n\t * @param {Number} [config.yaw=0] Initial Yaw of camera (in degree) 카메라의 초기 Yaw (degree 단위)\n\t * @param {Number} [config.pitch=0] Initial Pitch of camera (in degree) 카메라의 초기 Pitch (degree 단위)\n\t * @param {Number} [config.fov=65] Initial vertical field of view of camera (in degree) 카메라의 초기 수직 field of view (degree 단위)\n\t * @param {Boolean} [config.showPolePoint=false] If false, the pole is not displayed inside the viewport false 인 경우, 극점은 뷰포트 내부에 표시되지 않습니다\n\t * @param {Boolean} [config.useZoom=true] When true, enables zoom with the wheel and Pinch gesture true 일 때 휠 및 집기 제스춰로 확대 / 축소 할 수 있습니다.\n\t * @param {Boolean} [config.useKeyboard=true] When true, enables the keyboard move key control: awsd, arrow keys true 이면 키보드 이동 키 컨트롤을 활성화합니다: awsd, 화살표 키\n\t * @param {String} [config.gyroMode=yawPitch] Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE} 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")
{@link eg.view360.PanoViewer.GYRO_MODE}
\n\t * @param {Array} [config.yawRange=[-180, 180]] Range of controllable Yaw values 제어 가능한 Yaw 값의 범위\n\t * @param {Array} [config.pitchRange=[-90, 90]] Range of controllable Pitch values 제어 가능한 Pitch 값의 범위\n\t * @param {Array} [config.fovRange=[30, 110]] Range of controllable vertical field of view values 제어 가능한 수직 field of view 값의 범위\n\t * @param {Number} [config.touchDirection= {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}(6)] Direction of touch that can be controlled by user
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}사용자가 터치로 조작 가능한 방향
{@link eg.view360.PanoViewer.TOUCH_DIRECTION}
\n\t *\n\t * @example\n\t * // PanoViewer Creation\n\t * // create PanoViewer with option\n\t * var PanoViewer = eg.view360.PanoViewer;\n\t * // Area where the image will be displayed(HTMLElement)\n\t * var container = document.getElementById(\"myPanoViewer\");\n\t *\n\t * var panoViewer = new PanoViewer(container, {\n\t * // If projectionType is not specified, the default is \"equirectangular\".\n\t * // Specifies an image of the \"equirectangular\" type.\n\t * image: \"/path/to/image/image.jpg\"\n\t *});\n\t *\n\t * @example\n\t * // Cubemap Config Setting Example\n\t * // For support Youtube EAC projection, You should set cubemapConfig as follows.\n\t * cubemapConfig: {\n\t * \torder: \"LFRDBU\",\n\t * \ttileConfig: [\n\t * \t\ttileConfig: [{rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: 0}, {rotation: -90}, {rotation: 180}]\n\t * \t]\n\t * }\n\t */\n\tconstructor(container, options = {}) {\n\t\tsuper();\n\n\t\t// Raises the error event if webgl is not supported.\n\t\tif (!WebGLUtils.isWebGLAvailable()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.NO_WEBGL,\n\t\t\t\t\tmessage: \"no webgl support\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!WebGLUtils.isStableWebGL()) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_DEVICE,\n\t\t\t\t\tmessage: \"blacklisted browser\"\n\t\t\t\t});\n\t\t\t}, 0);\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif (!!options.image && !!options.video) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.INVALID_RESOURCE,\n\t\t\t\t\tmessage: \"Specifying multi resouces(both image and video) is not valid.\"\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn this;\n\t\t}\n\n\t\t// Check XR support at not when imported, but when created.\n\t\t// This is intended to make polyfills easier to use.\n\t\tcheckXRSupport();\n\n\t\tthis._container = container;\n\t\tthis._image = options.image || options.video;\n\t\tthis._isVideo = !!options.video;\n\t\tthis._projectionType = options.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\tthis._cubemapConfig = Object.assign({\n\t\t\t/* RLUDBF is abnormal, we use it on CUBEMAP only for backward compatibility*/\n\t\t\torder: this._projectionType === PROJECTION_TYPE.CUBEMAP ? \"RLUDBF\" : \"RLUDFB\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, options.cubemapConfig);\n\t\tthis._stereoFormat = options.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\n\t\t// If the width and height are not provided, will use the size of the container.\n\t\tthis._width = options.width || parseInt(window.getComputedStyle(container).width, 10);\n\t\tthis._height = options.height || parseInt(window.getComputedStyle(container).height, 10);\n\n\t\t/**\n\t\t * Cache the direction for the performance in renderLoop\n\t\t *\n\t\t * This value should be updated by \"change\" event of YawPitchControl.\n\t\t */\n\t\tthis._yaw = options.yaw || 0;\n\t\tthis._pitch = options.pitch || 0;\n\t\tthis._fov = options.fov || 65;\n\n\t\tthis._gyroMode = options.gyroMode || GYRO_MODE.YAWPITCH;\n\t\tthis._quaternion = null;\n\n\t\tthis._aspectRatio = this._height !== 0 ? this._width / this._height : 1;\n\t\tconst fovRange = options.fovRange || [30, 110];\n\t\tconst touchDirection = PanoViewer._isValidTouchDirection(options.touchDirection) ?\n\t\t\toptions.touchDirection : YawPitchControl.TOUCH_DIRECTION_ALL;\n\t\tconst yawPitchConfig = Object.assign(options, {\n\t\t\telement: container,\n\t\t\tyaw: this._yaw,\n\t\t\tpitch: this._pitch,\n\t\t\tfov: this._fov,\n\t\t\tgyroMode: this._gyroMode,\n\t\t\tfovRange,\n\t\t\taspectRatio: this._aspectRatio,\n\t\t\ttouchDirection\n\t\t});\n\n\t\tthis._isReady = false;\n\n\t\tthis._initYawPitchControl(yawPitchConfig);\n\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t}\n\n\t/**\n\t * Get the video element that the viewer is currently playing. You can use this for playback.\n\t * @ko 뷰어가 현재 사용 중인 비디오 요소를 얻습니다. 이 요소를 이용해 비디오의 컨트롤을 할 수 있습니다.\n\t * @method eg.view360.PanoViewer#getVideo\n\t * @return {HTMLVideoElement} HTMLVideoElementHTMLVideoElement\n\t * @example\n\t * var videoTag = panoViewer.getVideo();\n\t * videoTag.play(); // play video!\n\t */\n\tgetVideo() {\n\t\tif (!this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the video information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setVideo\n\t * @param {String|HTMLVideoElement|Object} video Input video url or element or config object입력 비디오 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정)\n\t * @param {Object} param\n\t * @param {String} [param.projectionType={@link eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR}(\"equirectangular\")] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 의 레이아웃 설정\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setVideo(\"/path/to/video/video.mp4\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.EQUIRECTANGULAR\n\t * });\n\t */\n\tsetVideo(video, param = {}) {\n\t\tif (video) {\n\t\t\tthis.setImage(video, {\n\t\t\t\tprojectionType: param.projectionType,\n\t\t\t\tisVideo: true,\n\t\t\t\tcubemapConfig: param.cubemapConfig,\n\t\t\t\tstereoFormat: param.stereoFormat\n\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the image information that the viewer is currently using.\n\t * @ko 뷰어가 현재 사용하고있는 이미지 정보를 얻습니다.\n\t * @method eg.view360.PanoViewer#getImage\n\t * @return {Image} Image Object이미지 객체\n\t * @example\n\t * var imageObj = panoViewer.getImage();\n\t */\n\tgetImage() {\n\t\tif (this._isVideo) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn this._photoSphereRenderer.getContent();\n\t}\n\n\t/**\n\t * Set the image information to be used by the viewer.\n\t * @ko 뷰어가 사용할 이미지 정보를 설정합니다.\n\t * @method eg.view360.PanoViewer#setImage\n\t * @param {String|Image|Object} image Input image url or element or config object입력 이미지 URL 혹은 엘리먼트 혹은 설정객체를 활용(image 와 video 둘 중 하나만 설정한다.)\n\t * @param {Object} param Additional information이미지 추가 정보\n\t * @param {String} [param.projectionType=\"equirectangular\"] Projection Type프로젝션 타입\n\t * @param {Object} param.cubemapConfig config cubemap projection layout. cubemap projection type 레이아웃\n\t * @param {String} [param.stereoFormat=\"3dv\"] Contents format of the stereoscopic equirectangular projection. See {@link eg.view360.PanoViewer.STEREO_FORMAT}.Stereoscopic equirectangular projection type의 콘텐츠 포맷을 설정한다. {@link eg.view360.PanoViewer.STEREO_FORMAT} 참조.\n\t *\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setImage(\"/path/to/image/image.png\", {\n\t * projectionType: eg.view360.PanoViewer.PROJECTION_TYPE.CUBEMAP\n\t * });\n\t */\n\tsetImage(image, param = {}) {\n\t\tconst cubemapConfig = Object.assign({\n\t\t\torder: \"RLUDBF\",\n\t\t\ttileConfig: {\n\t\t\t\tflipHorizontal: false,\n\t\t\t\trotation: 0\n\t\t\t}\n\t\t}, param.cubemapConfig);\n\t\tconst stereoFormat = param.stereoFormat || STEREO_FORMAT.TOP_BOTTOM;\n\t\tconst isVideo = !!(param.isVideo);\n\n\t\tif (this._image && this._isVideo !== isVideo) {\n\t\t\t/* eslint-disable no-console */\n\t\t\tconsole.warn(\"Currently not supporting to change content type(Image <--> Video)\");\n\t\t\t/* eslint-enable no-console */\n\t\t\treturn this;\n\t\t}\n\n\t\tif (image) {\n\t\t\tthis._image = image;\n\t\t\tthis._isVideo = isVideo;\n\t\t\tthis._projectionType = param.projectionType || PROJECTION_TYPE.EQUIRECTANGULAR;\n\t\t\tthis._cubemapConfig = cubemapConfig;\n\t\t\tthis._stereoFormat = stereoFormat;\n\n\t\t\tthis._deactivate();\n\t\t\tthis._initRenderer(this._yaw, this._pitch, this._fov, this._projectionType, this._cubemapConfig);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set whether the renderer always updates the texture and renders.\n\t * @ko 렌더러가 항상 텍스쳐를 갱신하고 화면을 렌더링 할지 여부를 설정할 수 있습니다.\n\t *\n\t * @method eg.view360.PanoViewer#keepUpdate\n\t * @param {Boolean} doUpdate When true viewer will always update texture and render, when false viewer will not update texture and render only camera config is changed.true면 항상 텍스쳐를 갱신하고 화면을 그리는 반면, false면 텍스쳐 갱신은 하지 않으며, 카메라 요소에 변화가 있을 때에만 화면을 그립니다.\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tkeepUpdate(doUpdate) {\n\t\tthis._photoSphereRenderer.keepUpdate(doUpdate);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get projection type (equirectangular/cube)\n\t * @ko 프로젝션 타입(Equirectangular 혹은 Cube)을 반환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#getProjectionType\n\t * @return {String} {@link eg.view360.PanoViewer.PROJECTION_TYPE}\n\t */\n\tgetProjectionType() {\n\t\treturn this._projectionType;\n\t}\n\n\t/**\n\t * Activate the device's motion sensor, and return the Promise whether the sensor is enabled\n\t * If it's iOS13+, this method must be used in the context of user interaction, like onclick callback on the button element.\n\t * @ko 디바이스의 모션 센서를 활성화하고, 활성화 여부를 담는 Promise를 리턴합니다.\n\t * iOS13+일 경우, 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * @method eg.view360.PanoViewer#enableSensor\n\t * @return {Promise} Promise containing nothing when resolved, or string of the rejected reason when rejected.Promise. resolve되었을 경우 아무것도 반환하지 않고, reject되었을 경우 그 이유를 담고있는 string을 반환한다.\n\t */\n\tenableSensor() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === \"function\") {\n\t\t\t\tDeviceMotionEvent.requestPermission().then(permissionState => {\n\t\t\t\t\tif (permissionState === \"granted\") {\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(new Error(\"permission denied\"));\n\t\t\t\t\t}\n\t\t\t\t}).catch(e => {\n\t\t\t\t\t// This can happen when this method wasn't triggered by user interaction\n\t\t\t\t\treject(e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tresolve();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Disable the device's motion sensor.\n\t * @ko 디바이스의 모션 센서를 비활성화합니다.\n\t * @deprecated\n\t * @method eg.view360.PanoViewer#disableSensor\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdisableSensor() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Switch to VR stereo rendering mode which uses WebXR / WebVR API (WebXR is preferred).\n\t * This method must be used in the context of user interaction, like onclick callback on the button element.\n\t * It can be rejected when an enabling device sensor fails or image/video is still loading(\"ready\" event not triggered).\n\t * @ko WebXR / WebVR API를 사용하는 VR 스테레오 렌더링 모드로 전환합니다. (WebXR을 더 선호합니다)\n\t * 이 메소드는 사용자 인터렉션에 의해서 호출되어야 합니다. 예로, 버튼의 onclick 콜백과 같은 콘텍스트에서 호출되어야 합니다.\n\t * 디바이스 센서 활성화에 실패시 혹은 아직 이미지/비디오가 로딩중인 경우(\"ready\"이벤트가 아직 트리거되지 않은 경우)에는 Promise가 reject됩니다.\n\t * @method eg.view360.PanoViewer#enterVR\n\t * @return {Promise} Promise containing either a string of resolved reason or an Error instance of rejected reason.Promise가 resolve된 이유(string) 혹은 reject된 이유(Error)\n\t */\n\tenterVR() {\n\t\tif (!this._isReady) {\n\t\t\treturn Promise.reject(new Error(\"PanoViewer is not ready to show image.\"));\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis.enableSensor()\n\t\t\t\t.then(() => this._photoSphereRenderer.enterVR())\n\t\t\t\t.then(res => resolve(res))\n\t\t\t\t.catch(e => reject(e));\n\t\t});\n\t}\n\n\t/**\n\t * Exit VR stereo rendering mode.\n\t * @ko VR 스테레오 렌더링 모드에서 일반 렌더링 모드로 전환합니다.\n\t *\n\t * @method eg.view360.PanoViewer#exitVR\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\texitVR() {\n\t\tthis._photoSphereRenderer.exitVR();\n\t\treturn this;\n\t}\n\n\t// TODO: Remove parameters as they're just using private values\n\t_initRenderer(yaw, pitch, fov, projectionType, cubemapConfig) {\n\t\tthis._photoSphereRenderer = new PanoImageRenderer(\n\t\t\tthis._image,\n\t\t\tthis._width,\n\t\t\tthis._height,\n\t\t\tthis._isVideo,\n\t\t\t{\n\t\t\t\tinitialYaw: yaw,\n\t\t\t\tinitialPitch: pitch,\n\t\t\t\tfieldOfView: fov,\n\t\t\t\timageType: projectionType,\n\t\t\t\tcubemapConfig,\n\t\t\t\tstereoFormat: this._stereoFormat\n\t\t\t},\n\t\t);\n\t\tthis._photoSphereRenderer.setYawPitchControl(this._yawPitchControl);\n\n\t\tthis._bindRendererHandler();\n\n\t\tthis._photoSphereRenderer\n\t\t\t.bindTexture()\n\t\t\t.then(() => this._activate())\n\t\t\t.catch(() => {\n\t\t\t\tthis._triggerEvent(EVENTS.ERROR, {\n\t\t\t\t\ttype: ERROR_TYPE.FAIL_BIND_TEXTURE,\n\t\t\t\t\tmessage: \"failed to bind texture\"\n\t\t\t\t});\n\t\t\t});\n\t}\n\n\t/**\n\t * update values of YawPitchControl if needed.\n\t * For example, In Panorama mode, initial fov and pitchRange is changed by aspect ratio of image.\n\t *\n\t * This function should be called after isReady status is true.\n\t */\n\t_updateYawPitchIfNeeded() {\n\t\tif (this._projectionType === PanoViewer.ProjectionType.PANORAMA) {\n\t\t\t// update fov by aspect ratio\n\t\t\tconst image = this._photoSphereRenderer.getContent();\n\t\t\tlet imageAspectRatio = image.naturalWidth / image.naturalHeight;\n\t\t\tlet isCircular;\n\t\t\tlet yawSize;\n\t\t\tlet maxFov;\n\n\t\t\t// If height is larger than width, then we assume it's rotated by 90 degree.\n\t\t\tif (imageAspectRatio < 1) {\n\t\t\t\t// So inverse the aspect ratio.\n\t\t\t\timageAspectRatio = 1 / imageAspectRatio;\n\t\t\t}\n\n\t\t\tif (imageAspectRatio < 6) {\n\t\t\t\tyawSize = mathUtil.toDegree(imageAspectRatio);\n\t\t\t\tisCircular = false;\n\t\t\t\t// 0.5 means ratio of half height of cylinder(0.5) and radius of cylider(1). 0.5/1 = 0.5\n\t\t\t\tmaxFov = mathUtil.toDegree(Math.atan(0.5)) * 2;\n\t\t\t} else {\n\t\t\t\tyawSize = 360;\n\t\t\t\tisCircular = true;\n\t\t\t\tmaxFov = (360 / imageAspectRatio); // Make it 5 fixed as axes does.\n\t\t\t}\n\n\t\t\t// console.log(\"_updateYawPitchIfNeeded\", maxFov, \"aspectRatio\", image.naturalWidth, image.naturalHeight, \"yawSize\", yawSize);\n\t\t\tconst minFov = (this._yawPitchControl.option(\"fovRange\"))[0];\n\n\t\t\t// this option should be called after fov is set.\n\t\t\tthis._yawPitchControl.option({\n\t\t\t\t\"fov\": maxFov, /* parameter for internal validation for pitchrange */\n\t\t\t\t\"yawRange\": [-yawSize / 2, yawSize / 2],\n\t\t\t\tisCircular,\n\t\t\t\t\"pitchRange\": [-maxFov / 2, maxFov / 2],\n\t\t\t\t\"fovRange\": [minFov, maxFov]\n\t\t\t});\n\t\t\tthis.lookAt({fov: maxFov});\n\t\t}\n\t}\n\n\t_bindRendererHandler() {\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.ERROR, e => {\n\t\t\tthis.trigger(EVENTS.ERROR, e);\n\t\t});\n\n\t\tthis._photoSphereRenderer.on(PanoImageRenderer.EVENTS.RENDERING_CONTEXT_LOST, e => {\n\t\t\tthis._deactivate();\n\t\t\tthis.trigger(EVENTS.ERROR, {\n\t\t\t\ttype: ERROR_TYPE.RENDERING_CONTEXT_LOST,\n\t\t\t\tmessage: \"webgl rendering context lost\"\n\t\t\t});\n\t\t});\n\t}\n\n\t_initYawPitchControl(yawPitchConfig) {\n\t\tthis._yawPitchControl = new YawPitchControl(yawPitchConfig);\n\n\t\tthis._yawPitchControl.on(EVENTS.ANIMATION_END, e => {\n\t\t\tthis._triggerEvent(EVENTS.ANIMATION_END, e);\n\t\t});\n\n\t\tthis._yawPitchControl.on(\"change\", e => {\n\t\t\tthis._yaw = e.yaw;\n\t\t\tthis._pitch = e.pitch;\n\t\t\tthis._fov = e.fov;\n\t\t\tthis._quaternion = e.quaternion;\n\n\t\t\tthis._triggerEvent(EVENTS.VIEW_CHANGE, e);\n\t\t});\n\t}\n\n\t_triggerEvent(name, param) {\n\t\tconst evt = param || {};\n\n\t\t/**\n\t\t * Events that is fired when error occurs\n\t\t * @ko 에러 발생 시 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#error\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.type Error type\n\t\t * \t\t10: INVALID_DEVICE: Unsupported device\n\t\t * \t\t11: NO_WEBGL: Webgl not support\n\t\t * \t\t12, FAIL_IMAGE_LOAD: Failed to load image\n\t\t * \t\t13: FAIL_BIND_TEXTURE: Failed to bind texture\n\t\t * \t\t14: INVALID_RESOURCE: Only one resource(image or video) should be specified\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost occurred\n\t\t * 에러 종류\n\t\t * \t\t10: INVALID_DEVICE: 미지원 기기\n\t\t * \t\t11: NO_WEBGL: WEBGL 미지원\n\t\t * \t\t12, FAIL_IMAGE_LOAD: 이미지 로드 실패\n\t\t * \t\t13: FAIL_BIND_TEXTURE: 텍스쳐 바인딩 실패\n\t\t * \t\t14: INVALID_RESOURCE: 리소스 지정 오류 (image 혹은 video 중 하나만 지정되어야 함)\n\t\t * \t\t15: RENDERING_CONTEXT_LOST: WebGL context lost 발생\n\t\t * \n\t\t * @param {String} param.message Error message 에러 메시지\n\t\t * @see {@link eg.view360.PanoViewer.ERROR_TYPE}\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"error\" : function(evt) {\n\t\t *\t\t// evt.type === 13\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t *\n\t\t * // constant can be used\n\t\t * viwer.on({\n\t\t *\teg.view360.PanoViewer.EVENTS.ERROR : function(evt) {\n\t\t *\t\t// evt.type === eg.view360.PanoViewer.ERROR_TYPE.FAIL_BIND_TEXTURE\n\t\t *\t\t// evt.message === \"failed to bind texture\"\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when PanoViewer is ready to go.\n\t\t * @ko PanoViewer 가 준비된 상태에 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#ready\n\t\t * @event\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"ready\" : function(evt) {\n\t\t *\t\t// PanoViewer is ready to show image and handle user interaction.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when direction or fov is changed.\n\t\t * @ko PanoViewer 에서 바라보고 있는 방향이나 FOV(화각)가 변경되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#viewChange\n\t\t * @event\n\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t * @param {Number} param.yaw yawyaw\n\t\t * @param {Number} param.pitch pitch pitch\n\t\t * @param {Number} param.fov Field of view (fov) 화각\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"viewChange\" : function(evt) {\n\t\t *\t\t//evt.yaw, evt.pitch, evt.fov is available.\n\t\t * });\n\t\t */\n\n\t\t/**\n\t\t * Events that is fired when animation which is triggered by inertia is ended.\n\t\t * @ko 관성에 의한 애니메이션 동작이 완료되었을때 발생하는 이벤트\n\t\t * @name eg.view360.PanoViewer#animationEnd\n\t\t * @event\n\t\t * @example\n\t\t *\n\t\t * viwer.on({\n\t\t *\t\"animationEnd\" : function(evt) {\n\t\t *\t\t// animation is ended.\n\t\t * });\n\t\t */\n\t\treturn this.trigger(name, evt);\n\t}\n\n\t/**\n\t * When set true, enables zoom with the wheel or pinch gesture. However, in the case of touch, pinch works only when the touchDirection setting is {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL}.\n\t * @ko true 로 설정 시 휠 혹은 집기 동작으로 확대/축소 할 수 있습니다. false 설정 시 확대/축소 기능을 비활성화 합니다. 단, 터치인 경우 touchDirection 설정이 {@link eg.view360.PanoViewer.TOUCH_DIRECTION.ALL} 인 경우에만 pinch 가 동작합니다.\n\t * @method eg.view360.PanoViewer#setUseZoom\n\t * @param {Boolean} useZoom\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseZoom(useZoom) {\n\t\ttypeof useZoom === \"boolean\" && this._yawPitchControl.option(\"useZoom\", useZoom);\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * When true, enables the keyboard move key control: awsd, arrow keys\n\t * @ko true이면 키보드 이동 키 컨트롤을 활성화합니다. (awsd, 화살표 키)\n\t * @method eg.view360.PanoViewer#setUseKeyboard\n\t * @param {Boolean} useKeyboard\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetUseKeyboard(useKeyboard) {\n\t\tthis._yawPitchControl.option(\"useKeyboard\", useKeyboard);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Enables control through device motion. (\"none\", \"yawPitch\", \"VR\")\n\t * @ko 디바이스 움직임을 통한 컨트롤을 활성화 합니다. (\"none\", \"yawPitch\", \"VR\")\n\t * @method eg.view360.PanoViewer#setGyroMode\n\t * @param {String} gyroMode {@link eg.view360.PanoViewer.GYRO_MODE}\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setGyroMode(\"yawPitch\");\n\t * //equivalent\n\t * panoViewer.setGyroMode(eg.view360.PanoViewer.GYRO_MODE.YAWPITCH);\n\t */\n\tsetGyroMode(gyroMode) {\n\t\tthis._yawPitchControl.option(\"gyroMode\", gyroMode);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setFovRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setFovRange([50, 90]);\n\t */\n\tsetFovRange(range) {\n\t\tthis._yawPitchControl.option(\"fovRange\", range);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Getting the range of controllable FOV values\n\t * @ko 제어 가능한 FOV 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFovRange\n\t * @return {Array}\n\t * @example\n\t * var range = panoViewer.getFovRange(); //[50, 90]\n\t */\n\tgetFovRange() {\n\t\treturn this._yawPitchControl.option(\"fovRange\");\n\t}\n\n\t/**\n\t * Update size of canvas element by it's container element's or specified size. If size is not specified, the size of the container area is obtained and updated to that size.\n\t * @ko 캔버스 엘리먼트의 크기를 컨테이너 엘리먼트의 크기나 지정된 크기로 업데이트합니다. 만약 size 가 지정되지 않으면 컨테이너 영역의 크기를 얻어와 해당 크기로 갱신합니다.\n\t * @method eg.view360.PanoViewer#updateViewportDimensions\n\t * @param {Object} [size]\n\t * @param {Number} [size.width=width of container]\n\t * @param {Number} [size.height=height of container]\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tupdateViewportDimensions(size = {width: undefined, height: undefined}) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tlet containerSize;\n\n\t\tif (size.width === undefined || size.height === undefined) {\n\t\t\tcontainerSize = window.getComputedStyle(this._container);\n\t\t}\n\n\t\tconst width = size.width || parseInt(containerSize.width, 10);\n\t\tconst height = size.height || parseInt(containerSize.height, 10);\n\n\t\t// Skip if viewport is not changed.\n\t\tif (width === this._width && height === this._height) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._width = width;\n\t\tthis._height = height;\n\n\t\tthis._aspectRatio = width / height;\n\t\tthis._photoSphereRenderer.updateViewportDimensions(width, height);\n\t\tthis._yawPitchControl.option(\"aspectRatio\", this._aspectRatio);\n\t\tthis._yawPitchControl.updatePanScale({height});\n\n\t\tthis.lookAt({}, 0);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get the current field of view(FOV)\n\t * @ko 현재 field of view(FOV) 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getFov\n\t * @return {Number}\n\t */\n\tgetFov() {\n\t\treturn this._fov;\n\t}\n\n\t/**\n\t * Get the horizontal field of view in degree\n\t */\n\t_getHFov() {\n\t\treturn mathUtil.toDegree(\n\t\t\t2 * Math.atan(this._aspectRatio * Math.tan(glMatrix.toRadian(this._fov) / 2)));\n\t}\n\n\t/**\n\t * Get current yaw value\n\t * @ko 현재 yaw 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYaw\n\t * @return {Number}\n\t */\n\tgetYaw() {\n\t\treturn this._yaw;\n\t}\n\n\t/**\n\t * Get current pitch value\n\t * @ko 현재 pitch 값을 반환합니다.\n\t * @method eg.view360.PanoViewer#getPitch\n\t * @return {Number}\n\t */\n\tgetPitch() {\n\t\treturn this._pitch;\n\t}\n\n\t/**\n\t * Get the range of controllable Yaw values\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#getYawRange\n\t * @return {Array}\n\t */\n\tgetYawRange() {\n\t\treturn this._yawPitchControl.option(\"yawRange\");\n\t}\n\n\t/**\n\t * Get the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 가져옵니다.\n\t * @method eg.view360.PanoViewer#getPitchRange\n\t * @return {Array}\n\t */\n\tgetPitchRange() {\n\t\treturn this._yawPitchControl.option(\"pitchRange\");\n\t}\n\n\t/**\n\t * Set the range of controllable yaw\n\t * @ko 컨트롤 가능한 Yaw 구간을 반환합니다.\n\t * @method eg.view360.PanoViewer#setYawRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setYawRange([-90, 90]);\n\t */\n\tsetYawRange(yawRange) {\n\t\tthis._yawPitchControl.option(\"yawRange\", yawRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the range of controllable Pitch values\n\t * @ko 컨트롤 가능한 Pitch 구간을 설정합니다.\n\t * @method eg.view360.PanoViewer#setPitchRange\n\t * @param {Array} range\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * panoViewer.setPitchRange([-40, 40]);\n\t */\n\tsetPitchRange(pitchRange) {\n\t\tthis._yawPitchControl.option(\"pitchRange\", pitchRange);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Specifies whether to display the pole by limiting the pitch range. If it is true, pole point can be displayed. If it is false, it is not displayed.\n\t * @ko pitch 범위를 제한하여 극점을 표시할지를 지정합니다. true 인 경우 극점까지 표현할 수 있으며 false 인 경우 극점까지 표시하지 않습니다.\n\t * @method eg.view360.PanoViewer#setShowPolePoint\n\t * @param {Boolean} showPolePoint\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tsetShowPolePoint(showPolePoint) {\n\t\tthis._yawPitchControl.option(\"showPolePoint\", showPolePoint);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a new view by setting camera configuration. Any parameters not specified remain the same.\n\t * @ko 카메라 설정을 지정하여 화면을 갱신합니다. 지정되지 않은 매개 변수는 동일하게 유지됩니다.\n\t * @method eg.view360.PanoViewer#lookAt\n\t * @param {Object} orientation\n\t * @param {Number} orientation.yaw Target yaw in degree 목표 yaw (degree 단위)\n\t * @param {Number} orientation.pitch Target pitch in degree 목표 pitch (degree 단위)\n\t * @param {Number} orientation.fov Target vertical fov in degree 목표 수직 fov (degree 단위)\n\t * @param {Number} duration Animation duration in milliseconds 애니메이션 시간 (밀리 초)\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t * @example\n\t * // Change the yaw angle (absolute angle) to 30 degrees for one second.\n\t * panoViewer.lookAt({yaw: 30}, 1000);\n\t */\n\tlookAt(orientation, duration) {\n\t\tif (!this._isReady) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst yaw = orientation.yaw !== undefined ? orientation.yaw : this._yaw;\n\t\tconst pitch = orientation.pitch !== undefined ? orientation.pitch : this._pitch;\n\t\tconst pitchRange = this._yawPitchControl.option(\"pitchRange\");\n\t\tconst verticalAngleOfImage = pitchRange[1] - pitchRange[0];\n\t\tlet fov = orientation.fov !== undefined ? orientation.fov : this._fov;\n\n\t\tif (verticalAngleOfImage < fov) {\n\t\t\tfov = verticalAngleOfImage;\n\t\t}\n\n\t\tthis._yawPitchControl.lookAt({yaw, pitch, fov}, duration);\n\n\t\tif (duration === 0) {\n\t\t\tthis._photoSphereRenderer.renderWithYawPitch(yaw, pitch, fov);\n\t\t}\n\t\treturn this;\n\t}\n\n\t_activate() {\n\t\tthis._photoSphereRenderer.attachTo(this._container);\n\t\tthis._yawPitchControl.enable();\n\n\t\tthis.updateViewportDimensions();\n\n\t\tthis._isReady = true;\n\n\t\t// update yawPitchControl after isReady status is true.\n\t\tthis._updateYawPitchIfNeeded();\n\n\t\tthis._triggerEvent(EVENTS.READY);\n\t\tthis._photoSphereRenderer.startRender();\n\t}\n\n\t/**\n\t * Destroy webgl context and block user interaction and stop rendering\n\t */\n\t_deactivate() {\n\t\tif (this._isReady) {\n\t\t\tthis._photoSphereRenderer.stopRender();\n\t\t\tthis._yawPitchControl.disable();\n\t\t\tthis._isReady = false;\n\t\t}\n\n\t\tif (this._photoSphereRenderer) {\n\t\t\tthis._photoSphereRenderer.destroy();\n\t\t\tthis._photoSphereRenderer = null;\n\t\t}\n\t}\n\n\tstatic _isValidTouchDirection(direction) {\n\t\treturn direction === PanoViewer.TOUCH_DIRECTION.NONE ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.YAW ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.PITCH ||\n\t\t\tdirection === PanoViewer.TOUCH_DIRECTION.ALL;\n\t}\n\n\t/**\n\t * Set touch direction by which user can control.\n\t * @ko 사용자가 조작가능한 터치 방향을 지정합니다.\n\t * @method eg.view360.PanoViewer#setTouchDirection\n\t * @param {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @return {eg.view360.PanoViewer} PanoViewer instance\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Limit the touch direction to the yaw direction only.\n\t * panoViewer.setTouchDirection(eg.view360.PanoViewer.TOUCH_DIRECTION.YAW);\n\t */\n\tsetTouchDirection(direction) {\n\t\tif (PanoViewer._isValidTouchDirection(direction)) {\n\t\t\tthis._yawPitchControl.option(\"touchDirection\", direction);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns touch direction by which user can control\n\t * @ko 사용자가 조작가능한 터치 방향을 반환한다.\n\t * @method eg.view360.PanoViewer#getTouchDirection\n\t * @return {Number} direction of the touch. {@link eg.view360.PanoViewer.TOUCH_DIRECTION}컨트롤 가능한 방향 {@link eg.view360.PanoViewer.TOUCH_DIRECTION}\n\t * @example\n\t *\n\t * panoViewer = new PanoViewer(el);\n\t * // Returns the current touch direction.\n\t * var dir = panoViewer.getTouchDirection();\n\t */\n\tgetTouchDirection() {\n\t\treturn this._yawPitchControl.option(\"touchDirection\");\n\t}\n\n\t/**\n\t * Destroy viewer. Remove all registered event listeners and remove viewer canvas.\n\t * @ko 뷰어 인스턴스를 해제합니다. 모든 등록된 이벤트리스너를 제거하고 뷰어 캔버스를 삭제합니다.\n\t * @method eg.view360.PanoViewer#destroy\n\t * @return {eg.view360.PanoViewer} PanoViewer instancePanoViewer 인스턴스\n\t */\n\tdestroy() {\n\t\tthis._deactivate();\n\n\t\tif (this._yawPitchControl) {\n\t\t\tthis._yawPitchControl.destroy();\n\t\t\tthis._yawPitchControl = null;\n\t\t}\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check whether the current environment can execute PanoViewer\n\t * @ko 현재 브라우저 환경에서 PanoViewer 실행이 가능한지 여부를 반환합니다.\n\t * @function isSupported\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} PanoViewer executable PanoViewer 실행가능 여부\n\t * @static\n\t */\n\tstatic isSupported() {\n\t\treturn WebGLUtils.isWebGLAvailable() && WebGLUtils.isStableWebGL();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the WebGL\n\t * @ko 현재 브라우저 환경이 WebGL 을 지원하는지 여부를 확인합니다.\n\t * @function isWebGLAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @return {Boolean} WebGL support WebGL 지원여부\n\t * @static\n\t */\n\tstatic isWebGLAvailable() {\n\t\treturn WebGLUtils.isWebGLAvailable();\n\t}\n\n\t/**\n\t * Check whether the current environment supports the gyro sensor.\n\t * @ko 현재 브라우저 환경이 자이로 센서를 지원하는지 여부를 확인합니다.\n\t * @function isGyroSensorAvailable\n\t * @memberof eg.view360.PanoViewer\n\t * @param {Function} callback Function to take the gyro sensor availability as argument 자이로 센서를 지원하는지 여부를 인자로 받는 함수\n\t * @static\n\t */\n\tstatic isGyroSensorAvailable(callback) {\n\t\tif (!DeviceMotionEvent) {\n\t\t\tcallback && callback(false);\n\t\t\treturn;\n\t\t}\n\n\t\tlet onDeviceMotionChange;\n\n\t\tfunction checkGyro() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tonDeviceMotionChange = function(deviceMotion) {\n\t\t\t\t\tconst isGyroSensorAvailable = !(deviceMotion.rotationRate.alpha == null);\n\n\t\t\t\t\tres(isGyroSensorAvailable);\n\t\t\t\t};\n\n\t\t\t\twindow.addEventListener(\"devicemotion\", onDeviceMotionChange);\n\t\t\t});\n\t\t}\n\n\t\tfunction timeout() {\n\t\t\treturn new Promise((res, rej) => {\n\t\t\t\tsetTimeout(() => res(false), 1000);\n\t\t\t});\n\t\t}\n\n\t\tPromise.race([checkGyro(), timeout()]).then(isGyroSensorAvailable => {\n\t\t\twindow.removeEventListener(\"devicemotion\", onDeviceMotionChange);\n\n\t\t\tcallback && callback(isGyroSensorAvailable);\n\n\t\t\tPanoViewer.isGyroSensorAvailable = function(fb) {\n\t\t\t\tfb && fb(isGyroSensorAvailable);\n\t\t\t\treturn isGyroSensorAvailable;\n\t\t\t};\n\t\t});\n\t}\n}\n\nexport default PanoViewer;\n","import Component from \"@egjs/component\";\nimport {TRANSFORM, SUPPORT_WILLCHANGE} from \"../utils/browserFeature\";\nimport {VERSION} from \"../version\";\n/**\n * @class eg.view360.SpriteImage\n * @classdesc A module that displays a single or continuous image of any one of the \"sprite images\". SpinViewer internally uses SpriteImage to show each frame of the sprite image.\n * @ko 스프라이트 이미지 중 임의의 한 프레임을 단발성 혹은 연속적으로 보여주는 컴포넌트입니다. SpinViewer 는 내부적으로 SpriteImage 를 사용하여 스프라이트 이미지의 각 프레임을 보여줍니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.frameIndex=0] frameIndex specifies the index of the frame to be displayed in the \"Sprite image\". The frameIndex order is zero-based and indexed in Z form (left-to-right, top-to-bottom, and newline again from left to right).
- colRow is equivalent to frameIndex. However, if colRow is specified at the same time, colRow takes precedence.스프라이트 이미지 중에서 보여질 프레임의 인덱스를 지정합니다. frameIndex 순서는 0부터 시작하며 Z 형태(왼쪽에서 오른쪽, 위에서 아래, 개행 시 다시 왼쪽 부터)로 인덱싱합니다.
- colRow 는 frameIndex 와 동일한 기능을 합니다. 단, colRow 가 동시에 지정된 경우 colRow 가 우선합니다.
\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n *\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpriteImage\n *\n * var el = document.getElementById(\"image-div\");\n * var sprites = new eg.view360.SpriteImage(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24\n * });\n */\nclass SpriteImage extends Component {\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\t\tconst opt = options || {};\n\n\t\tthis._el = element;\n\t\tthis._rowCount = opt.rowCount || 1;\n\t\tthis._colCount = opt.colCount || 1;\n\t\tthis._totalCount = this._rowCount * this._colCount;// total frames\n\t\tthis._width = opt.width || \"auto\";\n\t\tthis._height = opt.height || \"auto\";\n\t\tthis._autoHeight = opt.autoHeight != null ? opt.autoHeight : \"true\"; // If autoHeight is specified, _height will be overwritten.\n\t\tthis._colRow = [0, 0];\n\n\t\tif (opt.colRow) {\n\t\t\tthis._colRow = opt.colRow;\n\t\t} else if (opt.frameIndex) {\n\t\t\tthis.setFrameIndex(opt.frameIndex);\n\t\t}\n\n\t\tthis._el.style.width = SpriteImage._getSizeString(this._width);\n\t\tthis._el.style.height = SpriteImage._getSizeString(this._height);\n\n\t\tif (!opt.imageUrl) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: opt.imageUrl\n\t\t\t\t});\n\t\t\t}, 0);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._image = new Image();\n\t\t/**\n\t\t * Event\n\t\t */\n\t\tthis._image.onload = () => {\n\t\t\tthis._bg = SpriteImage._createBgDiv(\n\t\t\t\tthis._image, this._rowCount, this._colCount, this._autoHeight);\n\t\t\tthis._el.appendChild(this._bg);\n\t\t\tthis.setColRow(this._colRow[0], this._colRow[1]);\n\n\t\t\t/**\n\t\t\t * Events that occur when component loading is complete\n\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#load\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"load\" : function(evt) {\n\t\t\t *\t\tconsole.log(\"load event fired - e.target\", e.target, \"e.bgElement\", e.bgElement);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"load\", {\n\t\t\t\ttarget: this._el,\n\t\t\t\tbgElement: this._bg\n\t\t\t});\n\n\t\t\tif (this._autoPlayReservedInfo) {\n\t\t\t\tthis.play(this._autoPlayReservedInfo);\n\t\t\t\tthis._autoPlayReservedInfo = null;\n\t\t\t}\n\t\t};\n\n\t\tthis._image.onerror = e => {\n\t\t\t/**\n\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t * @name eg.view360.SpriteImage#imageError\n\t\t\t * @event\n\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t *\n\t\t\t * @example\n\t\t\t *\n\t\t\t * sprites.on({\n\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t *\t\t// Error handling\n\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t *\t}\n\t\t\t * });\n\t\t\t */\n\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\timageUrl: opt.imageUrl\n\t\t\t});\n\t\t};\n\n\t\tthis._image.src = opt.imageUrl;\n\t}\n\n\tstatic _createBgDiv(img, rowCount, colCount, autoHeight) {\n\t\tconst el = document.createElement(\"div\");\n\n\t\tel.style.position = \"relative\";\n\t\tel.style.overflow = \"hidden\";\n\n\t\timg.style.position = \"absolute\";\n\t\timg.style.width = `${colCount * 100}%`;\n\t\timg.style.height = `${rowCount * 100}%`;\n\t\t/** Prevent image from being dragged on IE10, IE11, Safari especially */\n\t\timg.ondragstart = () => (false); // img.style.pointerEvents = \"none\";\n\t\t// Use hardware accelerator if available\n\t\tSUPPORT_WILLCHANGE && (img.style.willChange = \"transform\");\n\n\t\tel.appendChild(img);\n\n\t\tconst unitWidth = img.width / colCount;\n\t\tconst unitHeight = img.height / rowCount;\n\n\t\tif (autoHeight) {\n\t\t\tconst r = unitHeight / unitWidth;\n\n\t\t\tel.style.paddingBottom = `${r * 100}%`;\n\t\t} else {\n\t\t\tel.style.height = \"100%\";\n\t\t}\n\n\t\treturn el;\n\t}\n\n\t/**\n\t * Specifies the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 frameIndex 값을 지정\n\t * @method eg.view360.SpriteImage#setFrameIndex\n\t * @param {Number} frameIndex frame index of a frame프레임의 인덱스\n\t *\n\t * @example\n\t *\n\t * sprites.setFrameIndex(0, 1);// col = 0, row = 1\n\t */\n\tsetFrameIndex(index) {\n\t\tconst colRow = this.toColRow(index);\n\n\t\tthis.setColRow(colRow[0], colRow[1]);\n\t}\n\n\t/**\n\t * Returns the frameIndex of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 index 값을 반환\n\t * @method eg.view360.SpriteImage#getFrameIndex\n\t * @return {Number} frame index frame 인덱스\n\t *\n\t * @example\n\t *\n\t * var frameIndex = sprites.getFrameIndex(); // eg. frameIndex = 1\n\t *\n\t */\n\tgetFrameIndex() {\n\t\treturn this._colRow[1] * this._colCount + this._colRow[0];\n\t}\n\n\t/**\n\t * Specifies the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여질 프레임의 col, row 값을 지정\n\t * @method eg.view360.SpriteImage#setColRow\n\t * @param {Number} col Column number of a frame프레임의 행값\n\t * @param {Number} row Row number of a frame프레임의 열값\n\t *\n\t * @example\n\t *\n\t * sprites.setlColRow(1, 2); // col = 1, row = 2\n\t */\n\tsetColRow(col, row) {\n\t\tif (row > this._rowCount - 1 || col > this._colCount - 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._image && TRANSFORM) {\n\t\t\t// NOTE: Currently, do not apply translate3D for using layer hack. Do we need layer hack for old browser?\n\t\t\tthis._image.style[TRANSFORM] = `translate(${-(col / this._colCount * 100)}%, ${-(row / this._rowCount * 100)}%)`;\n\t\t}\n\n\t\tthis._colRow = [col, row];\n\t}\n\n\t/**\n\t * Returns the col and row values of the frame to be shown in the sprite image.\n\t * @ko 스프라이트 이미지 중 보여지는 프레임의 col, row 값을환반환\n\t * @method eg.view360.SpriteImage#gelColRow\n\t * @return {Number[]} Array containing col, rowcol, row 정보를 담는 배열\n\t *\n\t * @example\n\t *\n\t * var colRow = sprites.getlColRow();\n\t * // colRow = [1, 2] - index of col is 1, index of row is 2\n\t *\n\t */\n\tgetColRow() {\n\t\treturn this._colRow;\n\t}\n\n\tstatic _getSizeString(size) {\n\t\tif (typeof size === \"number\") {\n\t\t\treturn `${size}px`;\n\t\t}\n\n\t\treturn size;\n\t}\n\n\t/**\n\t * Stop playing\n\t * @ko play 되고 있던 프레임 재생을 중지합니다.\n\t * @method eg.view360.SpriteImage#stop\n\t *\n\t * @example\n\t *\n\t * viewer.stop();\n\t *\n\t */\n\tstop() {\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\t}\n\n\t/**\n\t * Switches frames sequentially in the 'interval' starting from the currently displayed frame and plays all frames by 'playCount'.\n\t * @ko 현재 보여지고 있는 프레임을 시작으로 'interval' 간격으로 순차적으로 프레임을 전환하며 모든 프레임을 'playCount' 만큼 재생한다.\n\t * @method eg.view360.SpriteImage#play\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.interval=1000 / totalFrameCount] Interframe Interval - in milliseconds프레임간 간격 - 밀리세컨드 단위\n\t * @param {Number} [param.playCount=0] PlayCount = 1 in which all frames are reproduced once, and playCount = n in which all frames are repeated n times. playCount = 0 in which all frames are repeated infinitely모든 프레임을 1회씩 재생한 것이 playCount = 1, 모든 프레임을 n 회 재상한 것이 playCount = n 이 된다. 0 dms 무한반복\n\t *\n\t * @example\n\t *\n\t * viewer.play({angle: 16, playCount: 1});\n\t *\n\t */\n\tplay({interval, playCount} = {interval: 1000 / this._totalCount, playCount: 0}) {\n\t\tif (!this._bg) {\n\t\t\tthis._autoPlayReservedInfo = {interval, playCount};\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._autoPlayTimer) {\n\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\tthis._autoPlayTimer = null;\n\t\t}\n\n\t\tlet frameIndex = this.getFrameIndex();\n\t\tlet count = 0;\n\t\tlet frameCount = 0; // for checking 1 cycle\n\n\t\tthis._autoPlayTimer = setInterval(() => {\n\t\t\tframeIndex %= this._totalCount;\n\t\t\tconst colRow = this.toColRow(frameIndex);\n\n\t\t\tthis.setColRow(colRow[0], colRow[1]);\n\t\t\tframeIndex++;\n\n\t\t\t// Done 1 Cycle?\n\t\t\tif (++frameCount === this._totalCount) {\n\t\t\t\tframeCount = 0;\n\t\t\t\tcount++;\n\t\t\t}\n\n\t\t\tif (playCount > 0 && count === playCount) {\n\t\t\t\tclearInterval(this._autoPlayTimer);\n\t\t\t}\n\t\t}, interval);\n\t}\n\n\ttoColRow(frameIndex) {\n\t\tconst colCount = this._colCount;\n\t\tconst rowCount = this._rowCount;\n\n\t\tif (frameIndex < 0) {\n\t\t\treturn [0, 0];\n\t\t} else if (frameIndex >= this._totalCount) {\n\t\t\treturn [colCount - 1, rowCount - 1];\n\t\t}\n\n\t\tconst col = frameIndex % colCount;\n\t\tconst row = Math.floor(frameIndex / colCount);\n\n\t\t// console.log(frameIndex, col, row);\n\t\treturn [col, row];\n\t}\n}\n\nexport default SpriteImage;\n","import Component from \"@egjs/component\";\nimport Axes, {PanInput} from \"@egjs/axes\";\nimport SpriteImage from \"./SpriteImage\";\nimport {VERSION} from \"../version\";\n\nconst DEFAULT_PAN_SCALE = 0.21;\n\n/**\n * @class eg.view360.SpinViewer\n * @classdesc A module used to displays each image sequentially according to the direction of the user's touch movement (left / right) of the sprite image that is collected by rotating the object.\n * @ko 물체 주위를 회전하여 촬영한 이미지들을 모은 스프라이트 이미지를 사용자의 터치 이동 방향(좌 / 우) 에 따라 각 이미지들을 순차적으로 보여주는 컴포넌트입니다.\n * @extends eg.Component\n *\n * @param {HTMLElement} element The element to show the image 이미지를 보여줄 대상 요소\n * @param {Object} options The option object파라미터 객체\n * @param {String} options.imageUrl The url of the sprite image 스프라이트 이미지의 url\n * @param {Number} [options.rowCount=1] Number of horizontal frames in the sprite image 스프라이트 이미지의 가로 프레임 갯수\n * @param {Number} [options.colCount=1] Number of vertical frames in the sprite image 스프라이트 이미지의 세로 프레임 갯수\n * @param {Number|String} [options.width=\"auto\"] The width of the target element to show the image 이미지를 보여줄 대상 요소의 너비\n * @param {Number|String} [options.height=\"auto\"] The height of the target element to show the image 이미지를 보여줄 대상 요소의 높이\n * @param {Boolean} [options.autoHeight=true] Whether to automatically set the height of the image area to match the original image's proportion 원본 이미지 비율에 맞게 이미지 영역의 높이를 자동으로 설정할지 여부\n * @param {Number[]} [options.colRow=[0, 0]] The column, row coordinates of the first frame of the sprite image (based on 0 index) 스프라이트 이미지 중 처음 보여줄 프레임의 (column, row) 좌표 (0 index 기반)\n * @param {Number} [options.scale=1] Spin scale (The larger the spin, the more).Spin 배율 (클 수록 더 많이 움직임)\n * @support {\"ie\": \"9+\", \"ch\" : \"latest\", \"ff\" : \"latest\", \"sf\" : \"latest\", \"edge\" : \"latest\", \"ios\" : \"7+\", \"an\" : \"2.3+ (except 3.x)\"}\n * @example\n *\n * // Initialize SpinViewer\n * var el = document.getElementById(\"product-360\");\n * var viewer = new eg.view360.SpinViewer(el, {\n * \timageUrl: \"/img/bag360.jpg\", // required\n * \trowCount: 24 //required\n * });\n */\nclass SpinViewer extends Component {\n\t/**\n\t * Version info string\n\t * @ko 버전정보 문자열\n\t * @name VERSION\n\t * @static\n\t * @type {String}\n\t * @example\n\t * eg.view360.SpinViewer.VERSION; // ex) 3.0.1\n\t * @memberof eg.view360.SpinViewer\n\t */\n\tstatic VERSION = VERSION;\n\tconstructor(element, options) {\n\t\tsuper();\n\n\t\tthis._el = element;\n\n\t\tconst opt = Object.assign({}, options);\n\t\tconst colCount = opt.colCount || 1;\n\t\tconst rowCount = opt.rowCount || 1;\n\n\t\tthis._scale = (opt.scale || 1);\n\t\tthis._panScale = this._scale * DEFAULT_PAN_SCALE;\n\n\t\tthis._frameCount = colCount * rowCount;\n\n\t\t// Init SpriteImage\n\t\tthis._sprites = new SpriteImage(element, opt).on({\n\t\t\t\"load\": evt => {\n\t\t\t\t/**\n\t\t\t\t * Events that occur when component loading is complete\n\t\t\t\t * @ko 컴포넌트 로딩이 완료되면 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#load\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {HTMLElement} param.target The target element for which to display the image 이미지를 보여줄 대상 엘리먼트\n\t\t\t\t * @param {HTMLElement} param.bgElement Generated background image element 생성된 background 이미지 엘리먼트\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"load\" : function(evt) {\n\t\t\t\t *\t\tthis.spinBy(360, {duration: 300});\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"load\", evt);\n\t\t\t},\n\t\t\t\"imageError\": evt => {\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#imageError\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {String} param.imageUrl User-specified image URL 사용자가 지정한 이미지 URL\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viewer.on({\n\t\t\t\t *\t\"imageError\" : function(evt) {\n\t\t\t\t *\t\t// Error handling\n\t\t\t\t *\t\tconsole.log(e.imageUrl);\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"imageError\", {\n\t\t\t\t\timageUrl: evt.imageUrl\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// Init Axes\n\t\tthis._panInput = new PanInput(this._el, {\n\t\t\tscale: [this._panScale, this._panScale]\n\t\t});\n\t\tthis._axes = new Axes({\n\t\t\tangle: {\n\t\t\t\trange: [0, 359],\n\t\t\t\tcircular: true\n\t\t\t}\n\t\t}).on({\n\t\t\t\"change\": evt => {\n\t\t\t\tconst curr = Math.floor(evt.pos.angle / (360 / this._frameCount));\n\t\t\t\tconst frameIndex = this._frameCount - curr - 1;\n\n\t\t\t\tthis._sprites.setFrameIndex(frameIndex);\n\n\t\t\t\t/**\n\t\t\t\t * An event that occurs when the image index is changed by the user's left / right panning\n\t\t\t\t * @ko 사용자의 좌우 Panning 에 의해 이미지 인덱스가 변경되었을때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#change\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Number[]} param.colRow Column, row of the frame in the sprite image 스프라이트 이미지 내 프레임의 column, row\n\t\t\t\t * @param {Number} param.frameIndex Index value that is sequentially appended in Z direction based on col and row.col, row 를 기반으로 Z 방향으로 순차적으로 붙여지는 index 값\n\t\t\t\t * @param {Number} param.angle The angle that is currently internally held at an angle between 0 and 359. (not a real product angle) 0 ~ 359 범위의 각도로 현재 내부적으로 유지하고 있는 각도 (실제 이미지의 각도가 아님)\n\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"change\" : function(evt) {\n\t\t\t\t *\t\tconsole.log(event.frameIndex, event.colRow, event.angle); // event.colRow = [0, 4] event.frameIndex = 4, event = 30\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"change\", {\n\t\t\t\t\tframeIndex,\n\t\t\t\t\tcolRow: this._sprites.getColRow(),\n\t\t\t\t\tangle: evt.pos.angle\n\t\t\t\t});\n\t\t\t},\n\t\t\t\"animationEnd\": evt => {\n\t\t\t\t/**\n\t\t\t\t * This event is fired when animation ends.\n\t\t\t\t * @ko 에니메이션이 끝났을 때 발생하는 이벤트\n\t\t\t\t * @name eg.view360.SpinViewer#animationEnd\n\t\t\t\t * @event\n\t\t\t\t * @param {Object} param The object of data to be sent to an event 이벤트에 전달되는 데이터 객체\n\t\t\t\t * @param {Boolean} param.isTrusted 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\t\t\t\t *\n\t\t\t\t * @example\n\t\t\t\t *\n\t\t\t\t * viwer.on({\n\t\t\t\t *\t\"animationEnd\" : function(evt) {\n\t\t\t\t *\t\t// evt.isTrusted === true or false\n\t\t\t\t *\t}\n\t\t\t\t * });\n\t\t\t\t */\n\t\t\t\tthis.trigger(\"animationEnd\", {\n\t\t\t\t\tisTrusted: evt.isTrusted\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._axes.connect(\"angle\", this._panInput);\n\t}\n\n\t/**\n\t * Set spin scale\n\t * @ko scale 을 조정할 수 있는 함수\n\t * @method eg.view360.SpinViewer#setScale\n\t * @param {Number} scale Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.setScale(2);// It moves twice as much.\n\t */\n\tsetScale(scale) {\n\t\tif (isNaN(scale) || scale < 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tthis._scale = scale;\n\t\tthis._panScale = scale * DEFAULT_PAN_SCALE;\n\t\tthis._panInput.options.scale = [this._panScale, this._panScale];\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Get spin scale\n\t * @ko scale 값을 반환한다.\n\t * @method eg.view360.SpinViewer#getScale\n\t *\n\t * @return {Number} Rotation multiples at spin, the larger the rotationSpin 시 회전 배수값, 커질 수록 더 많이 회전\n\t *\n\t * @example\n\t *\n\t * viewer.getScale();// It returns number\n\t */\n\tgetScale() {\n\t\treturn this._scale;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration by the specified angle based on the current rotation angle.\n\t * @ko 현재 회전 각도를 기준으로 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinBy\n\t *\n\t * @param {Number} [angle = 0] angle상대적 회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinBy(720, {duration: 500});\n\t */\n\tspinBy(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setBy({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * It gives the effect of rotating for a certain duration (duration) by the specified angle (angle).\n\t * @ko 지정된 각도(angle)만큼 일정 시간동안(duration) 회전하는 효과를 준다.\n\t * @method eg.view360.SpinViewer#spinTo\n\t *\n\t * @param {Number} [angle = 0] angle회전 각도\n\t * @param {Object} param The parameter object파라미터 객체\n\t * @param {Number} [param.duration = 0] duration회전할 시간 - 밀리세컨드 단위\n\t *\n\t * @return {Object} Instance of SpinViewer SpinViewer 인스턴스\n\t *\n\t * @example\n\t *\n\t * viewer.spinTo(30, {duration:100});\n\t */\n\tspinTo(angle = 0, param = {duration: 0}) {\n\t\tthis._axes.setTo({angle}, param.duration);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Returns current angles\n\t * @ko 현재 각도를 반환한다.\n\t *\n\t * @return {Number} Current angle 현재 각도\n\t */\n\tgetAngle() {\n\t\treturn this._axes.get().angle || 0;\n\t}\n}\n\nexport default SpinViewer;\n"],"names":["module","objectOrFunction","x","type","isFunction","_isArray","Array","isArray","Object","prototype","toString","call","len","vertxNext","customSchedulerFn","asap","callback","arg","queue","flush","scheduleFlush","setScheduler","scheduleFn","setAsap","asapFn","browserWindow","window","undefined","browserGlobal","BrowserMutationObserver","MutationObserver","WebKitMutationObserver","isNode","self","process","isWorker","Uint8ClampedArray","importScripts","MessageChannel","useNextTick","nextTick","useVertxTimer","useSetTimeout","useMutationObserver","iterations","observer","node","document","createTextNode","observe","characterData","data","useMessageChannel","channel","port1","onmessage","port2","postMessage","globalSetTimeout","setTimeout","i","attemptVertx","vertx","Function","require","runOnLoop","runOnContext","e","then","onFulfillment","onRejection","parent","this","child","constructor","noop","PROMISE_ID","makePromise","_state","arguments","invokeCallback","_result","subscribe","resolve$1","object","Constructor","promise","resolve","Math","random","substring","PENDING","FULFILLED","REJECTED","selfFulfillment","TypeError","cannotReturnOwn","tryThen","then$$1","value","fulfillmentHandler","rejectionHandler","handleForeignThenable","thenable","sealed","error","fulfill","reason","reject","_label","handleOwnThenable","handleMaybeThenable","maybeThenable","publishRejection","_onerror","publish","_subscribers","length","subscribers","settled","detail","hasCallback","succeeded","initializePromise","resolver","resolvePromise","rejectPromise","id","nextId","validationError","Error","Enumerator","input","_instanceConstructor","_remaining","_enumerate","_eachEntry","entry","c","resolve$$1","_then","didError","_settledAt","Promise$1","_willSettleAt","state","enumerator","all","entries","race","_","reject$1","needsResolver","needsNew","Promise","catch","_catch","finally","_finally","polyfill","local","global","P","promiseToString","cast","_setScheduler","_setAsap","_asap","factory","isUndefined","Component","_eventHandler","options","_proto","trigger","eventName","customEvent","handlerList","concat","eventType","isCanceled","stop","currentTarget","_len","restParam","_key","apply","once","handlerToAttach","eventHash","on","listener","_len2","_key2","off","hasOn","name","push","handlerToDetach","k","handlerFunction","splice","VERSION","EPSILON","ARRAY_TYPE","Float32Array","degree","PI","toRadian","a","create","out","glMatrix.ARRAY_TYPE","fromMat4","invert","a00","a01","a02","a10","a11","a12","a20","a21","a22","b01","b11","b21","det","rotateX","rad","s","sin","cos","a13","a23","rotateY","a03","perspective","fovy","aspect","near","far","nf","f","tan","Infinity","y","z","hypot","fromValues","subtract","b","normalize","sqrt","dot","cross","ax","ay","az","bx","by","bz","transformMat3","m","transformQuat","q","qx","qy","qz","qw","uvx","uvy","uvz","uuvx","uuvy","uuvz","w2","vec","setAxisAngle","axis","slerp","t","omega","cosom","sinom","scale0","scale1","aw","bw","glMatrix.EPSILON","acos","tmpvec3","xUnitVec3","yUnitVec3","temp1","temp2","matr","clone","w","copy","exactEquals","equals","a0","a1","a2","a3","b0","b1","b2","b3","abs","max","vec3.create","vec3.fromValues","mat3.create","some","arr","find","execRegExp","pattern","text","RegExp","exec","convertVersion","replace","findPreset","presets","userAgent","userPreset","version","preset","versionTest","result","test","brand","versionAlias","toLowerCase","findBrand","brands","_a","BROWSER_PRESETS","CHROMIUM_PRESETS","WEBKIT_PRESETS","WEBVIEW_PRESETS","OS_PRESETS","parseUserAgent","nextAgent","agent","navigator","getUserAgent","isMobile","browser","majorVersion","webview","chromium","webkit","os","browserPreset","browserVersion","_b","osPreset","osVersion","parseInt","isHints","userAgentData","uaList","hasUserAgentData","osData","slice","mobile","firstBrand","platform_1","platform","platformVersion","uaFullVersion","parseUserAgentData","win","doc","getAgent","osName","browserName","IS_IOS","IS_SAFARI_ON_DESKTOP","getComputedStyle","SUPPORT_TOUCH","SUPPORT_DEVICEMOTION","DeviceMotionEvent","devicePixelRatio","TRANSFORM","docStyle","documentElement","style","target","SUPPORT_WILLCHANGE","CSS","supports","WEBXR_SUPPORTED","_extends","assign","source","key","hasOwnProperty","_inheritsLoose","subClass","superClass","__proto__","_assertThisInitialized","ReferenceError","assign$1","output","index","nextKey","VENDOR_PREFIXES","TEST_ELEMENT","createElement","TYPE_FUNCTION","round","now","Date","prefixed","obj","property","prefix","prop","camelProp","toUpperCase","PREFIXED_TOUCH_ACTION","NATIVE_TOUCH_ACTION","TOUCH_ACTION_COMPUTE","TOUCH_ACTION_MANIPULATION","TOUCH_ACTION_NONE","TOUCH_ACTION_PAN_X","TOUCH_ACTION_PAN_Y","TOUCH_ACTION_MAP","touchMap","cssSupports","forEach","val","getTouchActionProps","SUPPORT_POINTER_EVENTS","SUPPORT_ONLY_TOUCH","INPUT_TYPE_TOUCH","INPUT_TYPE_MOUSE","COMPUTE_INTERVAL","INPUT_START","INPUT_END","INPUT_CANCEL","DIRECTION_NONE","DIRECTION_LEFT","DIRECTION_RIGHT","DIRECTION_UP","DIRECTION_DOWN","DIRECTION_HORIZONTAL","DIRECTION_VERTICAL","DIRECTION_ALL","PROPS_XY","PROPS_CLIENT_XY","each","iterator","context","boolOrFn","args","inStr","str","indexOf","TouchAction","manager","set","compute","element","actions","trim","update","touchAction","recognizers","recognizer","enable","getTouchAction","hasPanX","hasPanY","cleanTouchActions","join","preventDefaults","srcEvent","direction","offsetDirection","session","prevented","preventDefault","hasNone","isTapPointer","pointers","isTapMovement","distance","isTapTouchTime","deltaTime","preventSrc","hasParent","parentNode","getCenter","pointersLength","clientX","clientY","simpleCloneInputData","timeStamp","center","deltaX","deltaY","getDistance","p1","p2","props","getAngle","atan2","getDirection","getVelocity","computeInputData","firstInput","firstMultiple","offset","prevDelta","prevInput","offsetCenter","angle","offsetDelta","start","end","overallVelocity","overallVelocityX","overallVelocityY","scale","rotation","maxPointers","velocity","velocityX","velocityY","last","lastInterval","v","computeIntervalInputData","srcEventTarget","composedPath","path","inputHandler","pointersLen","changedPointersLen","changedPointers","isFirst","isFinal","emit","recognize","splitStr","split","addEventListeners","types","handler","addEventListener","removeEventListeners","removeEventListener","getWindowForElement","ownerDocument","defaultView","parentWindow","Input","inputTarget","domHandler","ev","init","evEl","evTarget","evWin","destroy","inArray","src","findByKey","POINTER_INPUT_MAP","pointerdown","pointermove","pointerup","pointercancel","pointerout","IE10_POINTER_TYPE_ENUM","2","3","4","5","POINTER_ELEMENT_EVENTS","POINTER_WINDOW_EVENTS","MSPointerEvent","PointerEvent","PointerEventInput","_Input","_this","proto","store","pointerEvents","removePointer","eventTypeNormalized","pointerType","isTouch","storeIndex","pointerId","button","toArray","uniqueArray","sort","results","values","TOUCH_INPUT_MAP","touchstart","touchmove","touchend","touchcancel","TouchInput","targetIds","touches","targetTouches","allTouches","identifier","changedTouches","changedTargetTouches","filter","touch","MOUSE_INPUT_MAP","mousedown","mousemove","mouseup","MouseInput","pressed","which","DEDUP_TIMEOUT","DEDUP_DISTANCE","setLastTouch","eventData","primaryTouch","lastTouch","lts","lastTouches","TouchMouseInput","_manager","inputEvent","inputData","isMouse","sourceCapabilities","firesTouchEvents","dx","dy","mouse","invokeArrayArg","fn","_uniqueId","getRecognizerByNameIfManager","otherRecognizer","get","stateStr","Recognizer","simultaneous","requireFail","recognizeWith","dropRecognizeWith","requireFailure","dropRequireFailure","hasRequireFailures","canRecognizeWith","event","additionalEvent","tryEmit","canEmit","inputDataClone","reset","AttrRecognizer","_Recognizer","attrTest","optionPointers","isRecognized","isValid","directionStr","PanRecognizer","_AttrRecognizer","threshold","pX","pY","directionTest","hasMoved","PinchRecognizer","inOut","defaults","domEvents","inputClass","cssProps","userSelect","touchSelect","touchCallout","contentZooming","userDrag","tapHighlightColor","toggleCssProps","add","oldCssProps","Manager","handlers","item","force","stopped","curRecognizer","existing","remove","targetRecognizer","events","gestureEvent","createEvent","initEvent","gesture","dispatchEvent","deprecate","method","message","deprecationMessage","stack","log","console","warn","extend","dest","merge","keys","extendStatics","d","setPrototypeOf","p","__extends","__","__assign","n","getInsidePosition","destPos","range","circular","bounce","toDestPos","targetRange","min","isOutside","pos","isCircularable","getCirculatedPos","toPos","nodes","el","$","param","multi","match","dummy","innerHTML","childNodes","querySelectorAll","nodeName","nodeType","jQuery","jquery","map","raf","requestAnimationFrame","webkitRequestAnimationFrame","caf","cancelAnimationFrame","webkitCancelAnimationFrame","keyInfo_1","oldraf_1","timestamp","performance","getTime","clearTimeout","tranformed","filtered","every","equal","base","roundNumFunc","roundNumber","num","roundUnit","pow","getDecimalPlace","roundNumbers","isNumber","isFinite","minMax","AnimationManager","itm","em","axm","animationEnd","bind","__proto","getDuration","depaPos","wishDuration","duration","durations_1","deceleration","reduce","minimumDuration","maximumDuration","createAnimationParam","option","delta","getDelta","isTrusted","done","grab","axes","_animateParam","orgPos_1","opt","triggerChange","_raf","triggerAnimationEnd","getEventInfo","restore","animateTo","beforeParam","circularTargets","setTo","setInterrupt","finish","triggerFinish","animateLoop","complete","info_1","self_1","destPos_1","prevPos_1","prevEasingPer_1","directions_1","originalIntendedPos_1","prevTime_1","startTime","loop","currentTime","ratio","easingPer","easing","nextPos","circulatedPos","rangeOffset","getFinalPos","originalIntendedPos","getRoundUnit","minRoundUnit","getAxisOptions","getUserControll","userWish","retTrigger","triggerAnimationStart","orgPos","movedPos","setBy","EventManager","triggerHold","roundPos","getRoundPos","triggerRelease","roundDepa","createUserControll","isAccurate","holding","am","eventInfo","moveTo","userControl","userDuration","setAnimationManager","InterruptManager","_prevented","isInterrupting","interruptable","isInterrupted","AxisManager","_complementOptions","_pos","acc","axisOption","fullDepaPos","axisOptions","InputObserver","moveDistance","isStopped","atOutside","tn","tx","initSlope_1","hold","changeOption","change","release","inputDuration","isEqual","IS_IOS_SAFARI","bodyStyle","head","getElementsByTagName","Axes","_super","startPos","_inputs","io","connect","inputType","mapped","disconnect","targets","hammer","mapAxes","isBounceArea","UNIQUEKEY","toAxis","createHammer","convertInputType","hasTouch","hasMouse","hasPointer","useDirection","checkType","userDirection","PanInput","panRecognizer","isRightEdge","rightEdgeTimer","panFlag","thresholdAngle","iOSEdgeSwipeThreshold","hammerManagerOptions","onHammerInput","onPanmove","onPanend","useHorizontal","useVertical","_direction","hammerOption","removeRecognizer","dettachEvent","keyValue","String","Pan","attachEvent","disable","isEnable","cancelable","edgeThreshold","innerWidth","toAngle","getDirectionByAngle","offsetX","offsetY","getOffset","prevent","stopPropagation","preventSystemEvent","speeds","normalSpeed","properties","PinchInput","_base","_prev","pinchRecognizer","onPinchStart","onPinchMove","onPinchEnd","Pinch","pinchScale","prev","WheelInput","_isEnabled","_isHolded","_timer","useNormalized","onWheel","MoveKeyInput","onKeydown","onKeyup","getAttribute","setAttribute","isMoveKey","move","keyCode","offsets","toDegree","util","extractPitchFromQuat","quaternion","baseV","vec3","ROTATE_CONSTANT","PITCH_DELTA","YAW_DELTA_BY_ROLL","YAW_DELTA_BY_YAW","angleBetweenVec2","v1","v2","targetAxis","meshPoint","yawOffsetBetween","viewDir","targetDir","viewDirXZ","vec2","targetDirXZ","getRotationDelta","prevQ","curQ","rotateKind","prevQuaternion","quat","curQuaternion","prevPoint","curPoint","meshPoint3","rotateDirection","meshPoint2","vecU","vecV","vecN","coefficientA","coefficientB","coefficientC","projectedPrevPoint","trigonometricRatio","theta","crossVec","r","MathUtil","degToRad","radToDeg","Vector2","subVectors","Vector3","scalar","invScalar","multiplyScalar","applyQuaternion","ix","iy","iz","iw","crossVectors","Quaternion","setFromEulerXYZ","c1","c2","c3","s1","s2","s3","setFromEulerYXZ","setFromAxisAngle","halfAngle","multiply","multiplyQuaternions","qax","qay","qaz","qaw","qbx","qby","qbz","qbw","inverse","l","qb","cosHalfTheta","halfTheta","sinHalfTheta","ratioA","ratioB","setFromUnitVectors","vFrom","vTo","isIOS","isWebViewAndroid","isSafari","isFirefoxAndroid","isR7","piOver180","rad45","defaultOrientation","defaultPosition","Util","updateEyeMatrices","projection","view","pose","parameters","vrDisplay","fov","upTan","downTan","leftTan","rightTan","xScale","yScale","fieldOfView","depthNear","depthFar","upDegrees","downDegrees","leftDegrees","rightDegrees","x2","y2","z2","xx","xy","xz","yy","yz","zz","wx","wy","wz","a30","a31","a32","a33","b00","b02","b03","b04","b05","b06","b07","b08","b09","b10","orientation","position","MIN_TIMESTEP","MAX_TIMESTEP","base64","mimeType","clamp","lerp","promises","isLandscapeMode","rtn","isTimestampDeltaValid","timestampDeltaS","isNaN","getScreenWidth","screen","width","height","getScreenHeight","requestFullscreen","webkitRequestFullscreen","mozRequestFullScreen","msRequestFullscreen","exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen","getFullscreenElement","fullscreenElement","webkitFullscreenElement","mozFullScreenElement","msFullscreenElement","linkProgram","gl","vertexSource","fragmentSource","attribLocationMap","vertexShader","createShader","VERTEX_SHADER","shaderSource","compileShader","fragmentShader","FRAGMENT_SHADER","program","createProgram","attribName","attachShader","bindAttribLocation","deleteShader","getProgramUniforms","uniforms","uniformCount","getProgramParameter","ACTIVE_UNIFORMS","uniformName","getActiveUniform","getUniformLocation","orthoMatrix","left","right","bottom","top","lr","bt","copyArray","check","vendor","opera","substr","safariCssSizeWorkaround","canvas","isDebug","getQueryParameter","location","search","decodeURIComponent","frameDataFromPose","frameData","leftProjectionMatrix","leftViewMatrix","getEyeParameters","rightProjectionMatrix","rightViewMatrix","isInsideCrossDomainIFrame","isFramed","refDomain","getDomainFromUrl","referrer","thisDomain","href","url","PosePredictor","predictionTimeS","previousQ","previousTimestampS","deltaQ","outQ","getPrediction","currentQ","gyro","timestampS","angularSpeed","toFixed","predictAngle","branch","build","CHROME_VERSION","IS_CHROME_WITHOUT_DEVICE_MOTION","IS_ANDROID","MC_BIND_SCALE","GYRO_MODE","NONE","YAWPITCH","VR","DeviceMotion","_onDeviceMotion","_onDeviceOrientation","_onChromeWithoutDeviceMotion","isWithoutDeviceMotion","isAndroid","stillGyroVec","rawGyroVec","adjustedGyroVec","lastDevicemotionTimestamp","alpha","beta","gamma","deviceorientation","_this2","isGyroSensorAvailable","rotationRate","isGravitySensorAvailable","accelerationIncludingGravity","interval","devicemotionEvent","acceleration","adjustedRotationRate","SensorSample","sample","sensorSample","ComplementaryFilter","kFilter","currentAccelMeasurement","currentGyroMeasurement","previousGyroMeasurement","filterQ","previousFilterQ","accelQ","isOrientationInitialized","estimatedGravity","measuredGravity","gyroIntegralQ","addAccelMeasurement","vector","addGyroMeasurement","deltaT","run_","accelToQuaternion_","gyroDeltaQ","gyroToQuaternionDelta_","invFilterQ","getQuaternionAngle","targetQ","getOrientation","accel","normAccel","dt","isFilterQuaternionInitialized","FusionPoseSensor","deviceMotion","accelerometer","gyroscope","_onDeviceMotionChange","_onScreenOrientationChange","posePredictor","filterToWorldQ","isChromeUsingDegrees","inverseWorldToScreenQ","worldToScreenQ","originalPoseAdjustQ","_setScreenTransform","resetQ","isEnabled","_triggerChange","_prevOrientation","_deviceOrientationQ","deviceOrientationFixQ","_alpha","out_","_convertFusionToPredicted","predictedQ","accGravity","rotRate","TiltMotionInput","_prevQuaternion","_quaternion","fusionPoseSensor","_onPoseChange","_attachEvent","_dettachEvent","prvQ","yawDeltaByYaw","screenRotationAngleInst","refCount","ScreenRotationAngle","_onOrientationChange","_spinR","_screenOrientationAngle","betaR","glMatrix","gammaR","getRadian","unref","RotationPanInput","_useRotation","_screenRotationAngle","setUseRotation","useRotation","_userDirection","newOffset","cosTheta","sinTheta","Y_AXIS_VECTOR","DeviceQuaternion","_fusionPoseSensor","getCombinedQuaternion","yaw","yawQ","conj","DEFAULT_YAW_RANGE","DEFAULT_PITCH_RANGE","CIRCULAR_PITCH_RANGE","YawPitchControl","pitch","showPolePoint","useZoom","useKeyboard","gyroMode","touchDirection","TOUCH_DIRECTION_YAW","yawRange","pitchRange","fovRange","aspectRatio","_element","_initialFov","_enabled","_isAnimating","_deviceQuaternion","_initAxes","yRange","_updateYawRange","pRange","_updatePitchRange","axesPanInput","axesWheelInput","axesTiltMotionInput","axesPinchInput","axesMoveKeyInput","isCircular","evt","_updateControlScale","updatePanScale","animationStart","areaHeight","argLen","_getOptions","beforeOptions","newOptions","changedKeyList","_setOptions","_getValidatedOptions","_applyOptions","_getValidYawRange","_getValidPitchRange","isVR","isYawPitch","prevFov","nextFov","_initDeviceQuaternion","_togglePinchInputByOption","_enableTouch","yawEnabled","pitchEnabled","_this3","newYawRange","newFov","newAspectRatio","adjustAspectRatio","horizontalFov","newPitchRange","changeEvt","verticalAngle","halfFov","halfHorizontalFov","mathUtil","targetElement","inputRange","outputRange","rangeIdx","inputA","fraction","persistOrientation","_resetOrientation","lookAt","getYawPitch","yawPitch","getFov","getQuaternion","shouldRenderWithQuaternion","axisPanInput","axesDeviceOrientationInput","CONTROL_MODE_VR","CONTROL_MODE_YAWPITCH","TOUCH_DIRECTION_ALL","TOUCH_DIRECTION_PITCH","TOUCH_DIRECTION_NONE","STATUS","EVENT","ImageLoader","image","_image","_onceHandlers","_loadStatus","res","rej","LOADED","getElement","LOADING","isMaybeLoaded","onceLoaded","ERROR","img","_img","Image","crossOrigin","naturalWidth","onload","onerror","loadPromises","_this4","_once","getStatus","READY_STATUS","READYSTATECHANGE_EVENT_NAME","latIdx","lngIdx","VideoLoader","video","_handlers","_sourceCount","_thresholdReadyState","_thresholdEventName","readyState","_errorCount","_detachErrorHandler","_appendSourceElement","videoUrl","videoSrc","videoType","sourceElement","_video","appendChild","_reset","HTMLVideoElement","load","_attachErrorHandler","_sources","rejector","WEBGL_ERROR_CODE","webglAvailability","WebGLUtils","shader","getShaderParameter","COMPILE_STATUS","getShaderInfoLog","detachShader","LINK_STATUS","deleteProgram","initBuffer","itemSize","attr","buffer","createBuffer","bindBuffer","bufferData","STATIC_DRAW","numItems","enableVertexAttribArray","vertexAttribPointer","FLOAT","getWebglContext","userContextAttributes","webglIdentifiers","contextAttributes","preserveDrawingBuffer","antialias","xrCompatible","onWebglcontextcreationerror","statusMessage","getContext","createTexture","textureTarget","texture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","LINEAR","TEXTURE_MIN_FILTER","TEXTURE_WRAP_S","CLAMP_TO_EDGE","TEXTURE_WRAP_T","isWebGLAvailable","webglContext","loseContextExtension","getExtension","loseContext","isStableWebGL","agentInfo","isStableWebgl","parseFloat","getErrorNameFromWebGLErrorCode","code","texImage2D","pixels","RGBA","UNSIGNED_BYTE","getMaxTextureSize","getParameter","MAX_TEXTURE_SIZE","Agent","isIE11","EVENTS","Renderer","_forceDimension","_pixelCanvas","_pixelContext","render","shaderProgram","indexBuffer","mvMatrix","pMatrix","uniformMatrix4fv","pMatrixUniform","mvMatrixUniform","drawElements","TRIANGLES","UNSIGNED_SHORT","getDimension","pixelSource","videoWidth","naturalHeight","videoHeight","updateShaderData","_initPixelSource","forceDimension","_getPixelSource","contentDimension","textureDimension","drawImage","_extractTileConfig","imageConfig","tileConfig","config","flipHorizontal","_triggerError","CubeRenderer","getVertexPositionData","_VERTEX_POSITION_DATA","getIndexData","_INDEX_DATA","indexData","vertexPositionData","extractOrder","order","getTextureCoordData","face","ordermap_","shift","unshift","pop","tileVertex","elemSize","tileTemp","j","getVertexShaderSource","getFragmentShaderSource","updateTexture","orderMap","surfaceIdx","tileIdx","TEXTURE_CUBE_MAP_POSITIVE_X","maxCubeMapTextureSize","getMaxCubeMapTextureSize","tile","extractTileFromImage","TEXTURE_CUBE_MAP","getSourceTileSize","outputTextureSize","inputTextureSize","tilePerRow","MAX_CUBE_MAP_TEXTURE_SIZE","_imageWidth","isPowerOfTwo","CubeStripRenderer","_vertices","coords","rows","coord","tileConfigs","_shrinkCoord","_transformCoord","TEXTURE_2D","size","maxSize","activeTexture","TEXTURE0","pixelStorei","UNPACK_FLIP_Y_WEBGL","newCoord","_flipHorizontalCoord","_rotateCoord","rotationAngle","moved","shiftCount","ERROR_TYPE","INVALID_DEVICE","NO_WEBGL","FAIL_IMAGE_LOAD","FAIL_BIND_TEXTURE","INVALID_RESOURCE","RENDERING_CONTEXT_LOST","READY","VIEW_CHANGE","ANIMATION_END","PROJECTION_TYPE","EQUIRECTANGULAR","CUBEMAP","CUBESTRIP","PANORAMA","STEREOSCOPIC_EQUI","STEREO_FORMAT","TOP_BOTTOM","LEFT_RIGHT","ANGLE_CORRECTION_FOR_CENTER_ALIGN","textureCoordData","phi","sinPhi","u","SphereRenderer","format","_stereoFormat","ctx","leftEyeScaleOffset","rightEyeScaleOffset","uTexScaleOffset","uniform4fv","_TEXTURE_COORD_DATA","CylinderRenderer","resizeDimension","cylinderMaxRadian","halfCylinderY","rotated","imageAspectRatio","CYLIDER_Y","startAngleForCenterAlign","yIdx","yLength","VR_DISPLAY_PRESENT_CHANGE","DEFAULT_LEFT_BOUNDS","DEFAULT_RIGHT_BOUNDS","EYES","VRManager","_vrDisplay","removeEndCallback","isPresenting","exitPresent","_clear","_frameData","VRFrameData","canRender","Boolean","beforeRender","bindFramebuffer","FRAMEBUFFER","afterRender","submitFrame","getEyeParams","display","halfWidth","drawingBufferWidth","drawingBufferHeight","getFrameData","leftMVMatrix","rightMVMatrix","mat4","_yawOffset","viewport","addEndCallback","requestPresent","getVRDisplays","displays","capabilities","canPresent","leftEye","rightEye","renderWidth","renderHeight","_setDisplay","setYawOffset","layers","getLayers","layer","_leftBounds","leftBounds","_rightBounds","rightBounds","XRManager","xrSession","_xrSession","frame","getViewerPose","_xrRefSpace","baseLayer","renderState","framebuffer","glLayer","views","getViewport","transform","matrix","projectionMatrix","_presenting","xr","requestSession","requiredFeatures","xrLayer","XRWebGLLayer","updateRenderState","requestReferenceSpace","refSpace","_setSession","_xrLayer","WebGLAnimator","_onLoop","_callback","_rafId","_context","_onLoopNextTick","before","diff","_rafTimer","setCallback","setContext","ImageType","DEVICE_PIXEL_RATIO","BIND_TEXTURE","IMAGE_LOADED","RENDERING_CONTEXT_RESTORE","RENDERER_ERROR","PanoImageRenderer","isVideo","sphericalConfig","renderingContextAttributes","_renderStereo","time","vr","_vr","eyeParams","eyeIndex","eyeParam","uniform1f","uEye","_bindBuffers","_draw","exitVR","animator","_animator","_restoreStyle","updateViewportDimensions","_updateViewport","_shouldForceDraw","_render","_onFirstVRFrame","minusZDir","mat3","mvInv","pInv","yawOffset","_lastQuaternion","_lastYaw","_lastPitch","_lastFieldOfView","textureCoordBuffer","vertexBuffer","_initCanvas","_setDefaultCanvasStyle","_wrapper","_wrapperOrigStyle","_renderingContextAttributes","_imageConfig","_imageIsReady","_keepUpdate","_onContentLoad","_onContentError","setImage","imageType","cubemapConfig","setYawPitchControl","yawPitchControl","_yawPitchControl","getContent","_isVideo","_setImageType","_contentLoader","_imageType","_isCubeMap","_renderer","stereoFormat","_initWebGL","_onWebglcontextlost","_onWebglcontextrestored","margin","maxHeight","maxWidth","outline","_triggerContentLoad","content","projectionType","isImageLoaded","_bindTexture","attachTo","parentElement","detach","forceContextLoss","hasRenderingContext","removeChild","isContextLost","_initShaderProgram","renderer","vsSource","fsSource","getError","useProgram","vertexPositionAttribute","getAttribLocation","samplerUniform","textureCoordAttribute","clear","COLOR_BUFFER_BIT","DEPTH_BUFFER_BIT","STENCIL_BUFFER_BIT","uniform1i","updateFieldOfView","viewPortChanged","h","_initRenderingContext","clearColor","deleteTexture","CULL_FACE","WebGLRenderingContext","_initBuffers","ARRAY_BUFFER","ELEMENT_ARRAY_BUFFER","Uint16Array","isEAC","_updateTexture","keepUpdate","doUpdate","startRender","stopRender","renderWithQuaternion","yx","zx","zy","renderWithYawPitch","getProjectionRenderer","enterVR","_Promise","_requestPresent","_setWrapperFullscreen","wrapper","wrapperStyle","zIndex","removeAttribute","PanoViewer","container","isSessionSupported","supportsSession","_container","_projectionType","_cubemapConfig","_width","_height","_yaw","_pitch","_fov","_gyroMode","_aspectRatio","_isValidTouchDirection","yawPitchConfig","_isReady","_initYawPitchControl","_initRenderer","getVideo","_photoSphereRenderer","setVideo","getImage","_deactivate","getProjectionType","enableSensor","requestPermission","permissionState","disableSensor","initialYaw","initialPitch","_bindRendererHandler","_activate","_triggerEvent","_updateYawPitchIfNeeded","ProjectionType","yawSize","maxFov","atan","minFov","_this5","setUseZoom","setUseKeyboard","setGyroMode","setFovRange","getFovRange","containerSize","_getHFov","getYaw","getPitch","getYawRange","getPitchRange","setYawRange","setPitchRange","setShowPolePoint","verticalAngleOfImage","TOUCH_DIRECTION","YAW","PITCH","ALL","setTouchDirection","getTouchDirection","isSupported","onDeviceMotionChange","fb","SpriteImage","_el","_rowCount","rowCount","_colCount","colCount","_totalCount","_autoHeight","autoHeight","_colRow","colRow","frameIndex","setFrameIndex","_getSizeString","imageUrl","_bg","_createBgDiv","setColRow","bgElement","_autoPlayReservedInfo","play","overflow","ondragstart","willChange","unitWidth","unitHeight","paddingBottom","toColRow","getFrameIndex","col","row","getColRow","_autoPlayTimer","clearInterval","playCount","count","frameCount","setInterval","floor","SpinViewer","_scale","_panScale","_frameCount","_sprites","_panInput","_axes","curr","setScale","getScale","spinBy","spinTo"],"mappings":";;;;;;;;;0mCASgEA,qBAKhE,SAASC,EAAiBC,GACxB,IAAIC,SAAcD,EAClB,OAAOA,IAAM,OAASC,IAAS,UAAYA,IAAS,YAGtD,SAASC,EAAWF,GAClB,cAAcA,IAAM,WAKtB,IAAIG,OAAgB,EACpB,GAAIC,MAAMC,QAAS,CACjBF,EAAWC,MAAMC,YACZ,CACLF,EAAW,SAAUH,GACnB,OAAOM,OAAOC,UAAUC,SAASC,KAAKT,KAAO,kBAIjD,IAAIK,EAAUF,EAEVO,EAAM,EACNC,OAAiB,EACjBC,OAAyB,EAEzBC,EAAO,SAASA,EAAKC,EAAUC,GACjCC,EAAMN,GAAOI,EACbE,EAAMN,EAAM,GAAKK,EACjBL,GAAO,EACP,GAAIA,IAAQ,EAAG,CAIb,GAAIE,EAAmB,CACrBA,EAAkBK,OACb,CACLC,OAKN,SAASC,EAAaC,GACpBR,EAAoBQ,EAGtB,SAASC,EAAQC,GACfT,EAAOS,EAGT,IAAIC,SAAuBC,SAAW,YAAcA,OAASC,UACzDC,EAAgBH,GAAiB,GACjCI,EAA0BD,EAAcE,kBAAoBF,EAAcG,uBAC1EC,SAAgBC,OAAS,oBAAsBC,UAAY,aAAe,GAAGxB,SAASC,KAAKuB,WAAa,mBAGxGC,SAAkBC,oBAAsB,oBAAsBC,gBAAkB,oBAAsBC,iBAAmB,YAG7H,SAASC,IAGP,OAAO,WACL,OAAOL,QAAQM,SAASrB,IAK5B,SAASsB,IACP,UAAW5B,IAAc,YAAa,CACpC,OAAO,WACLA,EAAUM,IAId,OAAOuB,IAGT,SAASC,IACP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b/package.json index a8ad947b5..7ec2b993f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@egjs/view360", - "version": "3.3.2-snapshot", + "version": "3.3.3", "description": "360 integrated viewing solution from inside-out view to outside-in view. It provides user-friendly service by rotating 360 degrees through various user interaction such as motion sensor and touch.", "main": "dist/view360.js", "module": "dist/view360.esm.js",