diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 1fad2416d..000000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,9 +0,0 @@ -# Guidelines for contributing - -## Work on `dev` -Any merge request should be created from and issued to the `dev` branch. - -## Unit tests -There are very few unit tests because it's somehow difficult to setup, but please don't break them and create new ones if you can. - -I won't merge any branch not passing the CI build. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 23d3fc60a..5461d3808 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,4 +1,4 @@ -## Issues guidelines +**Issues guidelines** - **Indicate your Photo-Sphere-Viewer, three.js and web browser versions** - Please search in the [documentation](http://photo-sphere-viewer.js.org) before asking. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index ab14ad110..89ee2b825 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,6 @@ **Merge request checklist** -- [ ] I read the [guidelines for contributing](https://github.com/mistic100/Photo-Sphere-Viewer/blob/master/.github/CONTRIBUTING.md) -- [ ] I created my branch from `dev` and I am issuing the PR to `dev` -- [ ] Unit tests are OK +- [ ] I created my branch from `dev` and I am issuing the PR to `dev`. +- [ ] All tests pass. If needed, new unit tests were added (only for utils). +- [ ] If needed, the [types](https://github.com/mistic100/Photo-Sphere-Viewer/tree/dev/types) have been updated. +- [ ] If needed, the [documentation](https://github.com/mistic100/Photo-Sphere-Viewer/tree/dev/docs) has been updated. diff --git a/.github/stale.yml b/.github/stale.yml index 8d2ccd042..d8c6a18a6 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -2,6 +2,7 @@ daysUntilStale: 7 daysUntilClose: 7 onlyLabels: - invalid + - "info requested" staleLabel: wontfix markComment: > This issue has been automatically marked as wontfix because not enough diff --git a/dist/adapters/cubemap-tiles.js b/dist/adapters/cubemap-tiles.js index 2a5c30140..ef293ca82 100644 --- a/dist/adapters/cubemap-tiles.js +++ b/dist/adapters/cubemap-tiles.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/adapters/cubemap-video.js b/dist/adapters/cubemap-video.js index 25c22cea9..d90999ad8 100644 --- a/dist/adapters/cubemap-video.js +++ b/dist/adapters/cubemap-video.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/adapters/cubemap.js b/dist/adapters/cubemap.js index 3143f4fae..f94c2afa6 100644 --- a/dist/adapters/cubemap.js +++ b/dist/adapters/cubemap.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/adapters/equirectangular-tiles.d.ts b/dist/adapters/equirectangular-tiles.d.ts index 0cc8694be..47accd71b 100644 --- a/dist/adapters/equirectangular-tiles.d.ts +++ b/dist/adapters/equirectangular-tiles.d.ts @@ -1,10 +1,11 @@ -import { AbstractAdapter, Viewer } from 'photo-sphere-viewer'; +import { PanoData, PanoDataProvider, AbstractAdapter, Viewer } from 'photo-sphere-viewer'; /** * @summary Configuration of a tiled panorama */ type EquirectangularTilesPanorama = { baseUrl?: string; + basePanoData?: PanoData | PanoDataProvider; width: number; cols: number; rows: number; diff --git a/dist/adapters/equirectangular-tiles.js b/dist/adapters/equirectangular-tiles.js index 08965b9f6..f15edded2 100644 --- a/dist/adapters/equirectangular-tiles.js +++ b/dist/adapters/equirectangular-tiles.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -250,6 +250,7 @@ * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama * @summary Configuration of a tiled panorama * @property {string} [baseUrl] - low resolution panorama loaded before tiles + * @property {PSV.PanoData | PSV.PanoDataProvider} [basePanoData] - panoData configuration associated to low resolution panorama loaded before tiles * @property {int} width - complete panorama width (height is always width/2) * @property {int} cols - number of vertical tiles * @property {int} rows - number of horizontal tiles @@ -514,7 +515,7 @@ }; if (panorama.baseUrl) { - return _EquirectangularAdapt.prototype.loadTexture.call(this, panorama.baseUrl).then(function (textureData) { + return _EquirectangularAdapt.prototype.loadTexture.call(this, panorama.baseUrl, panorama.basePanoData).then(function (textureData) { return { panorama: panorama, texture: textureData.texture, diff --git a/dist/adapters/equirectangular-tiles.js.map b/dist/adapters/equirectangular-tiles.js.map index 36e6f1a0c..76b7384c4 100644 --- a/dist/adapters/equirectangular-tiles.js.map +++ b/dist/adapters/equirectangular-tiles.js.map @@ -1 +1 @@ -{"version":3,"file":"equirectangular-tiles.js","sources":["../../src/adapters/shared/Task.js","../../src/adapters/shared/Queue.js","../../src/adapters/shared/tiles-utils.js","../../src/adapters/equirectangular-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters\n * @private\n */\nexport class Task {\n\n static STATUS = {\n DISABLED : -1,\n PENDING : 0,\n RUNNING : 1,\n CANCELLED: 2,\n DONE : 3,\n ERROR : 4,\n };\n\n /**\n * @param {string} id\n * @param {number} priority\n * @param {function(Task): Promise} fn\n */\n constructor(id, priority, fn) {\n this.id = id;\n this.priority = priority;\n this.fn = fn;\n this.status = Task.STATUS.PENDING;\n }\n\n start() {\n this.status = Task.STATUS.RUNNING;\n return this.fn(this)\n .then(() => {\n this.status = Task.STATUS.DONE;\n }, () => {\n this.status = Task.STATUS.ERROR;\n });\n }\n\n cancel() {\n this.status = Task.STATUS.CANCELLED;\n }\n\n isCancelled() {\n return this.status === Task.STATUS.CANCELLED;\n }\n\n}\n","import { Task } from './Task';\n\n/**\n * @summary Loading queue\n * @memberOf PSV.adapters\n * @private\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency = 4) {\n this.concurency = concurency;\n this.runningTasks = {};\n this.tasks = {};\n }\n\n enqueue(task) {\n this.tasks[task.id] = task;\n }\n\n clear() {\n Object.values(this.tasks).forEach(task => task.cancel());\n this.tasks = {};\n this.runningTasks = {};\n }\n\n setPriority(taskId, priority) {\n const task = this.tasks[taskId];\n if (task) {\n task.priority = priority;\n if (task.status === Task.STATUS.DISABLED) {\n task.status = Task.STATUS.PENDING;\n }\n }\n }\n\n disableAllTasks() {\n Object.values(this.tasks).forEach((task) => {\n task.status = Task.STATUS.DISABLED;\n });\n }\n\n start() {\n if (Object.keys(this.runningTasks).length >= this.concurency) {\n return;\n }\n\n const nextTask = Object.values(this.tasks)\n .filter(task => task.status === Task.STATUS.PENDING)\n .sort((a, b) => b.priority - a.priority)\n .pop();\n\n if (nextTask) {\n this.runningTasks[nextTask.id] = true;\n\n nextTask.start()\n .then(() => {\n if (!nextTask.isCancelled()) {\n delete this.tasks[nextTask.id];\n delete this.runningTasks[nextTask.id];\n this.start();\n }\n });\n\n this.start(); // start tasks until max concurrency is reached\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { SYSTEM, utils } from '../..';\n\n/**\n * @summary Generates an material for errored tiles\n * @memberOf PSV.adapters\n * @return {external:THREE.MeshBasicMaterial}\n * @private\n */\nexport function buildErrorMaterial(width, height) {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#333';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.font = `${canvas.width / 5}px serif`;\n ctx.fillStyle = '#a22';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText('⚠', canvas.width / 2, canvas.height / 2);\n\n const texture = new THREE.CanvasTexture(canvas);\n return new THREE.MeshBasicMaterial({ map: texture });\n}\n\n/**\n * @summary Create the texture for the base image\n * @memberOf PSV.adapters\n * @param {HTMLImageElement} img\n * @param {boolean} blur\n * @param {function} getHeight\n * @return {external:THREE.Texture}\n * @private\n */\nexport function createBaseTexture(img, blur, getHeight) {\n if (blur || img.width > SYSTEM.maxTextureWidth) {\n const ratio = Math.min(1, SYSTEM.getMaxCanvasWidth() / img.width);\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = getHeight(img.width);\n\n const ctx = buffer.getContext('2d');\n if (blur) {\n ctx.filter = 'blur(1px)';\n }\n ctx.drawImage(img, 0, 0, buffer.width, buffer.height);\n\n return utils.createTexture(buffer);\n }\n\n return utils.createTexture(img);\n}\n\n/**\n * @summary Creates a wireframe geometry, for debug\n * @memberOf PSV.adapters\n * @param {THREE.BufferGeometry} geometry\n * @return {THREE.Object3D}\n * @private\n */\nexport function createWireFrame(geometry) {\n const wireframe = new THREE.WireframeGeometry(geometry);\n const line = new THREE.LineSegments(wireframe);\n line.material.depthTest = false;\n line.material.opacity = 0.25;\n line.material.transparent = true;\n return line;\n}\n\n/**\n * @summary Creates a small red sphere, for debug\n * @memberOf PSV.adapters\n * @return {THREE.Object3D}\n * @private\n */\nexport function createDot(x, y, z) {\n const geom = new THREE.SphereGeometry(0.1);\n const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new THREE.Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, EquirectangularAdapter, PSVError, utils } from '../..';\nimport { Queue } from '../shared/Queue';\nimport { Task } from '../shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../shared/tiles-utils';\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.EquirectangularTilesAdapter\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama\n * @summary Configuration of a tiled panorama\n * @property {string} [baseUrl] - low resolution panorama loaded before tiles\n * @property {int} width - complete panorama width (height is always width/2)\n * @property {int} cols - number of vertical tiles\n * @property {int} rows - number of horizontal tiles\n * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile\n * @private\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n/* the faces of the top and bottom rows are made of a single triangle (3 vertices)\n * all other faces are made of two triangles (6 vertices)\n * bellow is the indexing of each face vertices\n *\n * first row faces:\n * ⋀\n * /0\\\n * / \\\n * / \\\n * /1 2\\\n * ¯¯¯¯¯¯¯¯¯\n *\n * other rows faces:\n * _________\n * |\\1 0|\n * |3\\ |\n * | \\ |\n * | \\ |\n * | \\ |\n * | \\2|\n * |4 5\\|\n * ¯¯¯¯¯¯¯¯¯\n *\n * last row faces:\n * _________\n * \\1 0/\n * \\ /\n * \\ /\n * \\2/\n * ⋁\n */\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.col}x${tile.row}`;\n}\n\nconst frustum = new THREE.Frustum();\nconst projScreenMatrix = new THREE.Matrix4();\nconst vertexPosition = new THREE.Vector3();\n\n\n/**\n * @summary Adapter for tiled panoramas\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularTilesAdapter extends EquirectangularAdapter {\n\n static id = 'equirectangular-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n this.psv.config.useXmpData = false;\n\n /**\n * @member {PSV.adapters.EquirectangularTilesAdapter.Options}\n * @private\n */\n this.config = {\n resolution : 64,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n if (!utils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n this.NB_VERTICES_BY_FACE = 6;\n this.NB_VERTICES_BY_SMALL_FACE = 3;\n this.NB_VERTICES = 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.SPHERE_HORIZONTAL_SEGMENTS - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n this.NB_GROUPS = this.SPHERE_SEGMENTS * this.SPHERE_HORIZONTAL_SEGMENTS;\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} colSize - size in pixels of a column\n * @property {int} rowSize - size in pixels of a row\n * @property {int} facesByCol - number of mesh faces by column\n * @property {int} facesByRow - number of mesh faces by row\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.SphereGeometry} geom\n * @property {external:THREE.MeshBasicMaterial[]} materials\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n colSize : 0,\n rowSize : 0,\n facesByCol : 0,\n facesByRow : 0,\n tiles : {},\n geom : null,\n materials : [],\n errorMaterial: null,\n };\n\n /**\n * @member {external:THREE.ImageLoader}\n * @private\n */\n this.loader = new THREE.ImageLoader();\n if (this.psv.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders);\n }\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n\n this.__cleanup();\n\n this.prop.errorMaterial?.map?.dispose();\n this.prop.errorMaterial?.dispose();\n\n delete this.queue;\n delete this.loader;\n delete this.prop.geom;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__refresh();\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Clears loading queue, dispose all materials\n * @private\n */\n __cleanup() {\n this.queue.clear();\n this.prop.tiles = {};\n\n this.prop.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.prop.materials.length = 0;\n }\n\n /**\n * @override\n */\n supportsTransition(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n */\n supportsPreload(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.cols > this.SPHERE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama cols must not be greater than ${this.SPHERE_SEGMENTS}.`));\n }\n if (panorama.rows > this.SPHERE_HORIZONTAL_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama rows must not be greater than ${this.SPHERE_HORIZONTAL_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.cols) || !utils.isPowerOfTwo(panorama.rows)) {\n return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.'));\n }\n\n const panoData = {\n fullWidth : panorama.width,\n fullHeight : panorama.width / 2,\n croppedWidth : panorama.width,\n croppedHeight: panorama.width / 2,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n };\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n panoData: panoData,\n }));\n }\n else {\n return Promise.resolve({ panorama, panoData });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(\n CONSTANTS.SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1)\n .toNonIndexed();\n\n geometry.clearGroups();\n let i = 0;\n let k = 0;\n // first row\n for (; i < this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n // second to before last rows\n for (; i < this.NB_VERTICES - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_FACE, k++);\n }\n // last row\n for (; i < this.NB_VERTICES; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n\n geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone());\n\n return new THREE.Mesh(geometry, []);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData, transition) {\n const { panorama, texture } = textureData;\n\n if (transition) {\n this.__setTexture(mesh, texture);\n return;\n }\n\n this.__cleanup();\n this.__setTexture(mesh, texture);\n\n this.prop.materials = mesh.material;\n this.prop.geom = mesh.geometry;\n this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone());\n\n this.prop.colSize = panorama.width / panorama.cols;\n this.prop.rowSize = panorama.width / 2 / panorama.rows;\n this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols;\n this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows;\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\n }\n\n /**\n * @private\n */\n __setTexture(mesh, texture) {\n let material;\n if (texture) {\n material = new THREE.MeshBasicMaterial({ map: texture });\n }\n else {\n material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let i = 0; i < this.NB_GROUPS; i++) {\n mesh.material.push(material);\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material[0].opacity = opacity;\n mesh.material[0].transparent = opacity < 1;\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @param {boolean} [init=false] Indicates initial call\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n if (!this.prop.geom) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const panorama = this.psv.config.panorama;\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let col = 0; col < panorama.cols; col++) {\n for (let row = 0; row < panorama.rows; row++) {\n // for each tile, find the vertices corresponding to the four corners (three for first and last rows)\n // if at least one vertex is visible, the tile must be loaded\n // for larger tiles we also test the four edges centers and the tile center\n\n const verticesIndex = [];\n\n if (row === 0) {\n // bottom-left\n const v0 = this.prop.facesByRow === 1\n ? col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.prop.facesByRow - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 4;\n\n // bottom-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE + 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top (all vertices are equal)\n const v2 = 0;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // bottom-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else if (row === panorama.rows - 1) {\n // top-left\n const v0 = this.prop.facesByRow === 1\n ? -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE - 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n // bottom (all vertices are equal)\n const v2 = this.NB_VERTICES - 1;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else {\n // top-left\n const v0 = -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // bottom-left\n const v1 = v0 + (this.prop.facesByRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE + 3;\n\n // bottom-right\n const v2 = v1 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v3 = v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v3 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // center-center\n const v8 = v6 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v8);\n }\n }\n }\n\n // if (init && col === 0 && row === 0) {\n // verticesIndex.forEach((vertexIdx) => {\n // this.psv.renderer.scene.add(createDot(\n // verticesPosition.getX(vertexIdx),\n // verticesPosition.getY(vertexIdx),\n // verticesPosition.getZ(vertexIdx)\n // ));\n // });\n // }\n\n const vertexVisible = verticesIndex.some((vertexIdx) => {\n vertexPosition.set(\n verticesPosition.getX(vertexIdx),\n verticesPosition.getY(vertexIdx),\n verticesPosition.getZ(vertexIdx)\n );\n vertexPosition.applyEuler(this.psv.renderer.meshContainer.rotation);\n return frustum.containsPoint(vertexPosition);\n });\n\n if (vertexVisible) {\n let angle = vertexPosition.angleTo(this.psv.prop.direction);\n if (row === 0 || row === panorama.rows - 1) {\n angle *= 2; // lower priority to top and bottom tiles\n }\n tilesToLoad.push({ col, row, angle });\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile[]} tiles\n * @private\n */\n __loadTiles(tiles) {\n this.queue.disableAllTasks();\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, tile.angle);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, tile.angle, task => this.__loadTile(tile, task)));\n }\n });\n\n this.queue.start();\n }\n\n /**\n * @summary Loads and draw a tile\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile} tile\n * @param {PSV.adapters.Task} task\n * @return {Promise}\n * @private\n */\n __loadTile(tile, task) {\n const panorama = this.psv.config.panorama;\n const url = panorama.tileUrl(tile.col, tile.row);\n\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n this.loader.load(url, resolve, undefined, reject);\n })\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new THREE.MeshBasicMaterial({ map: utils.createTexture(image) });\n this.__swapMaterial(tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n })\n .catch(() => {\n if (!task.isCancelled() && this.config.showErrorTile) {\n if (!this.prop.errorMaterial) {\n this.prop.errorMaterial = buildErrorMaterial(this.prop.colSize, this.prop.rowSize);\n }\n this.__swapMaterial(tile.col, tile.row, this.prop.errorMaterial);\n this.psv.needsUpdate();\n }\n });\n }\n\n /**\n * @summary Applies a new texture to the faces\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(col, row, material) {\n const uvs = this.prop.geom.getAttribute(ATTR_UV);\n\n for (let c = 0; c < this.prop.facesByCol; c++) {\n for (let r = 0; r < this.prop.facesByRow; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByCol + c;\n const faceRow = row * this.prop.facesByRow + r;\n const isFirstRow = faceRow === 0;\n const isLastRow = faceRow === (this.SPHERE_HORIZONTAL_SEGMENTS - 1);\n\n // first vertex for this face (3 or 6 vertices in total)\n let firstVertex;\n if (isFirstRow) {\n firstVertex = faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else if (isLastRow) {\n firstVertex = this.NB_VERTICES\n - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else {\n firstVertex = this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (faceRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + faceCol * this.NB_VERTICES_BY_FACE;\n }\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.prop.materials[matIndex] = material;\n\n // define new uvs\n const top = 1 - r / this.prop.facesByRow;\n const bottom = 1 - (r + 1) / this.prop.facesByRow;\n const left = c / this.prop.facesByCol;\n const right = (c + 1) / this.prop.facesByCol;\n\n if (isFirstRow) {\n uvs.setXY(firstVertex, (left + right) / 2, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, bottom);\n }\n else if (isLastRow) {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, (left + right) / 2, bottom);\n }\n else {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, right, bottom);\n uvs.setXY(firstVertex + 3, left, top);\n uvs.setXY(firstVertex + 4, left, bottom);\n uvs.setXY(firstVertex + 5, right, bottom);\n }\n }\n }\n\n uvs.needsUpdate = true;\n }\n\n /**\n * @summary Create the texture for the base image\n * @param {HTMLImageElement} img\n * @return {external:THREE.Texture}\n * @private\n */\n __createBaseTexture(img) {\n if (img.width !== img.height * 2) {\n utils.logWarn('Invalid base image, the width should be twice the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w / 2);\n }\n\n}\n"],"names":["Task","id","priority","fn","status","STATUS","PENDING","start","RUNNING","then","DONE","ERROR","cancel","CANCELLED","isCancelled","DISABLED","Queue","concurency","runningTasks","tasks","enqueue","task","clear","Object","values","forEach","setPriority","taskId","disableAllTasks","keys","length","nextTask","filter","sort","a","b","pop","buildErrorMaterial","width","height","canvas","document","createElement","ctx","getContext","fillStyle","fillRect","font","textAlign","textBaseline","fillText","texture","THREE","CanvasTexture","MeshBasicMaterial","map","createBaseTexture","img","blur","getHeight","SYSTEM","maxTextureWidth","ratio","Math","min","getMaxCanvasWidth","buffer","drawImage","utils","createTexture","ATTR_UV","ATTR_ORIGINAL_UV","ATTR_POSITION","tileId","tile","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","EquirectangularTilesAdapter","psv","options","config","useXmpData","resolution","showErrorTile","baseBlur","isPowerOfTwo","PSVError","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_SMALL_FACE","NB_VERTICES","NB_GROUPS","queue","prop","colSize","rowSize","facesByCol","facesByRow","tiles","geom","materials","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","supportsTransition","panorama","baseUrl","supportsPreload","loadTexture","cols","rows","tileUrl","Promise","reject","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","textureData","resolve","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","opacity","transparent","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v4","v6","v7","v3","v5","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","rotation","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","isFirstRow","isLastRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createBaseTexture","logWarn","w","EquirectangularAdapter","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;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AlB;EACD;EAED;EACF;EACA;EACA;EACA;EACA;EA1kBA;;EAAA,SA2kBEoB,mBA3kBF,GA2kBE,6BAAoBpL,GAApB,EAAyB;EACvB,QAAIA,GAAG,CAACnB,KAAJ,KAAcmB,GAAG,CAAClB,MAAJ,GAAa,CAA/B,EAAkC;EAChC6B,MAAAA,uBAAK,CAAC0K,OAAN,CAAc,0DAAd;EACD;;EAED,WAAOtL,iBAAiB,CAACC,GAAD,EAAM,KAAK6B,MAAL,CAAYI,QAAlB,EAA4B,UAAAqJ,CAAC;EAAA,aAAIA,CAAC,GAAG,CAAR;EAAA,KAA7B,CAAxB;EACD,GAjlBH;;EAAA;EAAA,EAAiDC,wCAAjD;EAAa7J,4BAEJlF,KAAK;EAFDkF,4BAGJ8J,mBAAmB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"equirectangular-tiles.js","sources":["../../src/adapters/shared/Task.js","../../src/adapters/shared/Queue.js","../../src/adapters/shared/tiles-utils.js","../../src/adapters/equirectangular-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters\n * @private\n */\nexport class Task {\n\n static STATUS = {\n DISABLED : -1,\n PENDING : 0,\n RUNNING : 1,\n CANCELLED: 2,\n DONE : 3,\n ERROR : 4,\n };\n\n /**\n * @param {string} id\n * @param {number} priority\n * @param {function(Task): Promise} fn\n */\n constructor(id, priority, fn) {\n this.id = id;\n this.priority = priority;\n this.fn = fn;\n this.status = Task.STATUS.PENDING;\n }\n\n start() {\n this.status = Task.STATUS.RUNNING;\n return this.fn(this)\n .then(() => {\n this.status = Task.STATUS.DONE;\n }, () => {\n this.status = Task.STATUS.ERROR;\n });\n }\n\n cancel() {\n this.status = Task.STATUS.CANCELLED;\n }\n\n isCancelled() {\n return this.status === Task.STATUS.CANCELLED;\n }\n\n}\n","import { Task } from './Task';\n\n/**\n * @summary Loading queue\n * @memberOf PSV.adapters\n * @private\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency = 4) {\n this.concurency = concurency;\n this.runningTasks = {};\n this.tasks = {};\n }\n\n enqueue(task) {\n this.tasks[task.id] = task;\n }\n\n clear() {\n Object.values(this.tasks).forEach(task => task.cancel());\n this.tasks = {};\n this.runningTasks = {};\n }\n\n setPriority(taskId, priority) {\n const task = this.tasks[taskId];\n if (task) {\n task.priority = priority;\n if (task.status === Task.STATUS.DISABLED) {\n task.status = Task.STATUS.PENDING;\n }\n }\n }\n\n disableAllTasks() {\n Object.values(this.tasks).forEach((task) => {\n task.status = Task.STATUS.DISABLED;\n });\n }\n\n start() {\n if (Object.keys(this.runningTasks).length >= this.concurency) {\n return;\n }\n\n const nextTask = Object.values(this.tasks)\n .filter(task => task.status === Task.STATUS.PENDING)\n .sort((a, b) => b.priority - a.priority)\n .pop();\n\n if (nextTask) {\n this.runningTasks[nextTask.id] = true;\n\n nextTask.start()\n .then(() => {\n if (!nextTask.isCancelled()) {\n delete this.tasks[nextTask.id];\n delete this.runningTasks[nextTask.id];\n this.start();\n }\n });\n\n this.start(); // start tasks until max concurrency is reached\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { SYSTEM, utils } from '../..';\n\n/**\n * @summary Generates an material for errored tiles\n * @memberOf PSV.adapters\n * @return {external:THREE.MeshBasicMaterial}\n * @private\n */\nexport function buildErrorMaterial(width, height) {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#333';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.font = `${canvas.width / 5}px serif`;\n ctx.fillStyle = '#a22';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText('⚠', canvas.width / 2, canvas.height / 2);\n\n const texture = new THREE.CanvasTexture(canvas);\n return new THREE.MeshBasicMaterial({ map: texture });\n}\n\n/**\n * @summary Create the texture for the base image\n * @memberOf PSV.adapters\n * @param {HTMLImageElement} img\n * @param {boolean} blur\n * @param {function} getHeight\n * @return {external:THREE.Texture}\n * @private\n */\nexport function createBaseTexture(img, blur, getHeight) {\n if (blur || img.width > SYSTEM.maxTextureWidth) {\n const ratio = Math.min(1, SYSTEM.getMaxCanvasWidth() / img.width);\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = getHeight(img.width);\n\n const ctx = buffer.getContext('2d');\n if (blur) {\n ctx.filter = 'blur(1px)';\n }\n ctx.drawImage(img, 0, 0, buffer.width, buffer.height);\n\n return utils.createTexture(buffer);\n }\n\n return utils.createTexture(img);\n}\n\n/**\n * @summary Creates a wireframe geometry, for debug\n * @memberOf PSV.adapters\n * @param {THREE.BufferGeometry} geometry\n * @return {THREE.Object3D}\n * @private\n */\nexport function createWireFrame(geometry) {\n const wireframe = new THREE.WireframeGeometry(geometry);\n const line = new THREE.LineSegments(wireframe);\n line.material.depthTest = false;\n line.material.opacity = 0.25;\n line.material.transparent = true;\n return line;\n}\n\n/**\n * @summary Creates a small red sphere, for debug\n * @memberOf PSV.adapters\n * @return {THREE.Object3D}\n * @private\n */\nexport function createDot(x, y, z) {\n const geom = new THREE.SphereGeometry(0.1);\n const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new THREE.Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, EquirectangularAdapter, PSVError, utils } from '../..';\nimport { Queue } from '../shared/Queue';\nimport { Task } from '../shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../shared/tiles-utils';\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.EquirectangularTilesAdapter\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama\n * @summary Configuration of a tiled panorama\n * @property {string} [baseUrl] - low resolution panorama loaded before tiles\n * @property {PSV.PanoData | PSV.PanoDataProvider} [basePanoData] - panoData configuration associated to low resolution panorama loaded before tiles\n * @property {int} width - complete panorama width (height is always width/2)\n * @property {int} cols - number of vertical tiles\n * @property {int} rows - number of horizontal tiles\n * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile\n * @private\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n/* the faces of the top and bottom rows are made of a single triangle (3 vertices)\n * all other faces are made of two triangles (6 vertices)\n * bellow is the indexing of each face vertices\n *\n * first row faces:\n * ⋀\n * /0\\\n * / \\\n * / \\\n * /1 2\\\n * ¯¯¯¯¯¯¯¯¯\n *\n * other rows faces:\n * _________\n * |\\1 0|\n * |3\\ |\n * | \\ |\n * | \\ |\n * | \\ |\n * | \\2|\n * |4 5\\|\n * ¯¯¯¯¯¯¯¯¯\n *\n * last row faces:\n * _________\n * \\1 0/\n * \\ /\n * \\ /\n * \\2/\n * ⋁\n */\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.col}x${tile.row}`;\n}\n\nconst frustum = new THREE.Frustum();\nconst projScreenMatrix = new THREE.Matrix4();\nconst vertexPosition = new THREE.Vector3();\n\n\n/**\n * @summary Adapter for tiled panoramas\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularTilesAdapter extends EquirectangularAdapter {\n\n static id = 'equirectangular-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n this.psv.config.useXmpData = false;\n\n /**\n * @member {PSV.adapters.EquirectangularTilesAdapter.Options}\n * @private\n */\n this.config = {\n resolution : 64,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n if (!utils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n this.NB_VERTICES_BY_FACE = 6;\n this.NB_VERTICES_BY_SMALL_FACE = 3;\n this.NB_VERTICES = 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.SPHERE_HORIZONTAL_SEGMENTS - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n this.NB_GROUPS = this.SPHERE_SEGMENTS * this.SPHERE_HORIZONTAL_SEGMENTS;\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} colSize - size in pixels of a column\n * @property {int} rowSize - size in pixels of a row\n * @property {int} facesByCol - number of mesh faces by column\n * @property {int} facesByRow - number of mesh faces by row\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.SphereGeometry} geom\n * @property {external:THREE.MeshBasicMaterial[]} materials\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n colSize : 0,\n rowSize : 0,\n facesByCol : 0,\n facesByRow : 0,\n tiles : {},\n geom : null,\n materials : [],\n errorMaterial: null,\n };\n\n /**\n * @member {external:THREE.ImageLoader}\n * @private\n */\n this.loader = new THREE.ImageLoader();\n if (this.psv.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders);\n }\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n\n this.__cleanup();\n\n this.prop.errorMaterial?.map?.dispose();\n this.prop.errorMaterial?.dispose();\n\n delete this.queue;\n delete this.loader;\n delete this.prop.geom;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__refresh();\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Clears loading queue, dispose all materials\n * @private\n */\n __cleanup() {\n this.queue.clear();\n this.prop.tiles = {};\n\n this.prop.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.prop.materials.length = 0;\n }\n\n /**\n * @override\n */\n supportsTransition(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n */\n supportsPreload(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.cols > this.SPHERE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama cols must not be greater than ${this.SPHERE_SEGMENTS}.`));\n }\n if (panorama.rows > this.SPHERE_HORIZONTAL_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama rows must not be greater than ${this.SPHERE_HORIZONTAL_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.cols) || !utils.isPowerOfTwo(panorama.rows)) {\n return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.'));\n }\n\n const panoData = {\n fullWidth : panorama.width,\n fullHeight : panorama.width / 2,\n croppedWidth : panorama.width,\n croppedHeight: panorama.width / 2,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n };\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl, panorama.basePanoData)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n panoData: panoData,\n }));\n }\n else {\n return Promise.resolve({ panorama, panoData });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(\n CONSTANTS.SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1)\n .toNonIndexed();\n\n geometry.clearGroups();\n let i = 0;\n let k = 0;\n // first row\n for (; i < this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n // second to before last rows\n for (; i < this.NB_VERTICES - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_FACE, k++);\n }\n // last row\n for (; i < this.NB_VERTICES; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n\n geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone());\n\n return new THREE.Mesh(geometry, []);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData, transition) {\n const { panorama, texture } = textureData;\n\n if (transition) {\n this.__setTexture(mesh, texture);\n return;\n }\n\n this.__cleanup();\n this.__setTexture(mesh, texture);\n\n this.prop.materials = mesh.material;\n this.prop.geom = mesh.geometry;\n this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone());\n\n this.prop.colSize = panorama.width / panorama.cols;\n this.prop.rowSize = panorama.width / 2 / panorama.rows;\n this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols;\n this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows;\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\n }\n\n /**\n * @private\n */\n __setTexture(mesh, texture) {\n let material;\n if (texture) {\n material = new THREE.MeshBasicMaterial({ map: texture });\n }\n else {\n material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let i = 0; i < this.NB_GROUPS; i++) {\n mesh.material.push(material);\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material[0].opacity = opacity;\n mesh.material[0].transparent = opacity < 1;\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @param {boolean} [init=false] Indicates initial call\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n if (!this.prop.geom) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const panorama = this.psv.config.panorama;\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let col = 0; col < panorama.cols; col++) {\n for (let row = 0; row < panorama.rows; row++) {\n // for each tile, find the vertices corresponding to the four corners (three for first and last rows)\n // if at least one vertex is visible, the tile must be loaded\n // for larger tiles we also test the four edges centers and the tile center\n\n const verticesIndex = [];\n\n if (row === 0) {\n // bottom-left\n const v0 = this.prop.facesByRow === 1\n ? col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.prop.facesByRow - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 4;\n\n // bottom-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE + 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top (all vertices are equal)\n const v2 = 0;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // bottom-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else if (row === panorama.rows - 1) {\n // top-left\n const v0 = this.prop.facesByRow === 1\n ? -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE - 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n // bottom (all vertices are equal)\n const v2 = this.NB_VERTICES - 1;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else {\n // top-left\n const v0 = -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // bottom-left\n const v1 = v0 + (this.prop.facesByRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE + 3;\n\n // bottom-right\n const v2 = v1 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v3 = v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v3 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // center-center\n const v8 = v6 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v8);\n }\n }\n }\n\n // if (init && col === 0 && row === 0) {\n // verticesIndex.forEach((vertexIdx) => {\n // this.psv.renderer.scene.add(createDot(\n // verticesPosition.getX(vertexIdx),\n // verticesPosition.getY(vertexIdx),\n // verticesPosition.getZ(vertexIdx)\n // ));\n // });\n // }\n\n const vertexVisible = verticesIndex.some((vertexIdx) => {\n vertexPosition.set(\n verticesPosition.getX(vertexIdx),\n verticesPosition.getY(vertexIdx),\n verticesPosition.getZ(vertexIdx)\n );\n vertexPosition.applyEuler(this.psv.renderer.meshContainer.rotation);\n return frustum.containsPoint(vertexPosition);\n });\n\n if (vertexVisible) {\n let angle = vertexPosition.angleTo(this.psv.prop.direction);\n if (row === 0 || row === panorama.rows - 1) {\n angle *= 2; // lower priority to top and bottom tiles\n }\n tilesToLoad.push({ col, row, angle });\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile[]} tiles\n * @private\n */\n __loadTiles(tiles) {\n this.queue.disableAllTasks();\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, tile.angle);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, tile.angle, task => this.__loadTile(tile, task)));\n }\n });\n\n this.queue.start();\n }\n\n /**\n * @summary Loads and draw a tile\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile} tile\n * @param {PSV.adapters.Task} task\n * @return {Promise}\n * @private\n */\n __loadTile(tile, task) {\n const panorama = this.psv.config.panorama;\n const url = panorama.tileUrl(tile.col, tile.row);\n\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n this.loader.load(url, resolve, undefined, reject);\n })\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new THREE.MeshBasicMaterial({ map: utils.createTexture(image) });\n this.__swapMaterial(tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n })\n .catch(() => {\n if (!task.isCancelled() && this.config.showErrorTile) {\n if (!this.prop.errorMaterial) {\n this.prop.errorMaterial = buildErrorMaterial(this.prop.colSize, this.prop.rowSize);\n }\n this.__swapMaterial(tile.col, tile.row, this.prop.errorMaterial);\n this.psv.needsUpdate();\n }\n });\n }\n\n /**\n * @summary Applies a new texture to the faces\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(col, row, material) {\n const uvs = this.prop.geom.getAttribute(ATTR_UV);\n\n for (let c = 0; c < this.prop.facesByCol; c++) {\n for (let r = 0; r < this.prop.facesByRow; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByCol + c;\n const faceRow = row * this.prop.facesByRow + r;\n const isFirstRow = faceRow === 0;\n const isLastRow = faceRow === (this.SPHERE_HORIZONTAL_SEGMENTS - 1);\n\n // first vertex for this face (3 or 6 vertices in total)\n let firstVertex;\n if (isFirstRow) {\n firstVertex = faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else if (isLastRow) {\n firstVertex = this.NB_VERTICES\n - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else {\n firstVertex = this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (faceRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + faceCol * this.NB_VERTICES_BY_FACE;\n }\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.prop.materials[matIndex] = material;\n\n // define new uvs\n const top = 1 - r / this.prop.facesByRow;\n const bottom = 1 - (r + 1) / this.prop.facesByRow;\n const left = c / this.prop.facesByCol;\n const right = (c + 1) / this.prop.facesByCol;\n\n if (isFirstRow) {\n uvs.setXY(firstVertex, (left + right) / 2, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, bottom);\n }\n else if (isLastRow) {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, (left + right) / 2, bottom);\n }\n else {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, right, bottom);\n uvs.setXY(firstVertex + 3, left, top);\n uvs.setXY(firstVertex + 4, left, bottom);\n uvs.setXY(firstVertex + 5, right, bottom);\n }\n }\n }\n\n uvs.needsUpdate = true;\n }\n\n /**\n * @summary Create the texture for the base image\n * @param {HTMLImageElement} img\n * @return {external:THREE.Texture}\n * @private\n */\n __createBaseTexture(img) {\n if (img.width !== img.height * 2) {\n utils.logWarn('Invalid base image, the width should be twice the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w / 2);\n }\n\n}\n"],"names":["Task","id","priority","fn","status","STATUS","PENDING","start","RUNNING","then","DONE","ERROR","cancel","CANCELLED","isCancelled","DISABLED","Queue","concurency","runningTasks","tasks","enqueue","task","clear","Object","values","forEach","setPriority","taskId","disableAllTasks","keys","length","nextTask","filter","sort","a","b","pop","buildErrorMaterial","width","height","canvas","document","createElement","ctx","getContext","fillStyle","fillRect","font","textAlign","textBaseline","fillText","texture","THREE","CanvasTexture","MeshBasicMaterial","map","createBaseTexture","img","blur","getHeight","SYSTEM","maxTextureWidth","ratio","Math","min","getMaxCanvasWidth","buffer","drawImage","utils","createTexture","ATTR_UV","ATTR_ORIGINAL_UV","ATTR_POSITION","tileId","tile","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","EquirectangularTilesAdapter","psv","options","config","useXmpData","resolution","showErrorTile","baseBlur","isPowerOfTwo","PSVError","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_SMALL_FACE","NB_VERTICES","NB_GROUPS","queue","prop","colSize","rowSize","facesByCol","facesByRow","tiles","geom","materials","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","supportsTransition","panorama","baseUrl","supportsPreload","loadTexture","cols","rows","tileUrl","Promise","reject","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","basePanoData","textureData","resolve","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","opacity","transparent","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v4","v6","v7","v3","v5","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","rotation","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","isFirstRow","isLastRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createBaseTexture","logWarn","w","EquirectangularAdapter","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;MACaA,IAAb;EAWE;EACF;EACA;EACA;EACA;EACE,gBAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;EAC5B,SAAKF,EA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GAAG,CAAClB,MAAJ,GAAa,CAA/B,EAAkC;EAChC6B,MAAAA,uBAAK,CAAC2K,OAAN,CAAc,0DAAd;EACD;;EAED,WAAOvL,iBAAiB,CAACC,GAAD,EAAM,KAAK6B,MAAL,CAAYI,QAAlB,EAA4B,UAAAsJ,CAAC;EAAA,aAAIA,CAAC,GAAG,CAAR;EAAA,KAA7B,CAAxB;EACD,GAjlBH;;EAAA;EAAA,EAAiDC,wCAAjD;EAAa9J,4BAEJlF,KAAK;EAFDkF,4BAGJ+J,mBAAmB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/adapters/equirectangular-video.js b/dist/adapters/equirectangular-video.js index 08d75ef27..ca8a04470 100644 --- a/dist/adapters/equirectangular-video.js +++ b/dist/adapters/equirectangular-video.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -358,11 +358,12 @@ _proto.loadTexture = function loadTexture(panorama) { return _AbstractVideoAdapter.prototype.loadTexture.call(this, panorama).then(function (_ref) { var texture = _ref.texture; + var video = texture.image; var panoData = { - fullWidth: texture.image.width, - fullHeight: texture.image.height, - croppedWidth: texture.image.width, - croppedHeight: texture.image.height, + fullWidth: video.videoWidth, + fullHeight: video.videoHeight, + croppedWidth: video.videoWidth, + croppedHeight: video.videoHeight, croppedX: 0, croppedY: 0, poseHeading: 0, diff --git a/dist/adapters/equirectangular-video.js.map b/dist/adapters/equirectangular-video.js.map index c45bb16ba..4368a0a4c 100644 --- a/dist/adapters/equirectangular-video.js.map +++ b/dist/adapters/equirectangular-video.js.map @@ -1 +1 @@ -{"version":3,"file":"equirectangular-video.js","sources":["../../src/adapters/shared/AbstractVideoAdapter.js","../../src/adapters/equirectangular-video/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractAdapter, CONSTANTS, PSVError } from '../..';\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n */\n\n/**\n * @summary Base video adapters class\n * @memberof PSV.adapters\n * @abstract\n * @private\n */\nexport class AbstractVideoAdapter extends AbstractAdapter {\n\n static supportsTransition = false;\n static supportsPreload = false;\n static supportsDownload = false;\n\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.AbstractVideoAdapter.Options}\n * @private\n */\n this.config = {\n autoplay: false,\n muted : options?.autoplay ?? false,\n ...options,\n };\n\n /**\n * @member {HTMLVideoElement}\n * @private\n */\n this.video = null;\n\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.__removeVideo();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n if (this.video) {\n this.psv.needsUpdate();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {PSV.adapters.AbstractVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.source) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n\n if (!this.psv.getPlugin('video')) {\n return Promise.reject(new PSVError('Video adapters require VideoPlugin to be loaded too.'));\n }\n\n const video = this.__createVideo(panorama.source);\n\n return this.__videoLoadPromise(video)\n .then(() => {\n const texture = new THREE.VideoTexture(video);\n return { panorama, texture };\n });\n }\n\n /**\n * @override\n */\n __switchVideo(texture) {\n let currentTime;\n let duration;\n let paused = !this.config.autoplay;\n let muted = this.config.muted;\n let volume = 1;\n if (this.video) {\n ({ currentTime, duration, paused, muted, volume } = this.video);\n }\n\n this.__removeVideo();\n this.video = texture.image;\n\n // keep current time when switching resolution\n if (this.video.duration === duration) {\n this.video.currentTime = currentTime;\n }\n\n // keep volume\n this.video.muted = muted;\n this.video.volume = volume;\n\n // play\n if (!paused) {\n this.video.play();\n }\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n if (textureData.texture) {\n const video = textureData.texture.image;\n video.pause();\n this.psv.container.removeChild(video);\n }\n textureData.texture?.dispose();\n }\n\n /**\n * @summary Removes the current video element\n * @private\n */\n __removeVideo() {\n if (this.video) {\n this.video.pause();\n this.psv.container.removeChild(this.video);\n delete this.video;\n }\n }\n\n /**\n * @summary Creates a new video element\n * @memberOf PSV.adapters\n * @param {string} src\n * @return {HTMLVideoElement}\n * @private\n */\n __createVideo(src) {\n const video = document.createElement('video');\n video.crossOrigin = this.psv.config.withCredentials ? 'use-credentials' : 'anonymous';\n video.loop = true;\n video.playsinline = true;\n video.style.display = 'none';\n video.muted = this.config.muted;\n video.src = src;\n video.preload = 'metadata';\n\n this.psv.container.appendChild(video);\n\n return video;\n }\n\n /**\n * @private\n */\n __videoLoadPromise(video) {\n const self = this;\n\n return new Promise((resolve, reject) => {\n video.addEventListener('loadedmetadata', function onLoaded() {\n if (this.video && video.duration === this.video.duration) {\n resolve(self.__videoBufferPromise(video, this.video.currentTime));\n }\n else {\n resolve();\n }\n video.removeEventListener('loadedmetadata', onLoaded);\n });\n\n video.addEventListener('error', function onError(err) {\n reject(err);\n video.removeEventListener('error', onError);\n });\n });\n }\n\n /**\n * @private\n */\n __videoBufferPromise(video, currentTime) {\n return new Promise((resolve) => {\n function onBuffer() {\n const buffer = video.buffered;\n for (let i = 0, l = buffer.length; i < l; i++) {\n if (buffer.start(i) <= video.currentTime && buffer.end(i) >= video.currentTime) {\n video.pause();\n video.removeEventListener('buffer', onBuffer);\n video.removeEventListener('progress', onBuffer);\n resolve();\n break;\n }\n }\n }\n\n // try to reduce the switching time by preloading in advance\n // FIXME find a better way ?\n video.currentTime = Math.min(currentTime + 2000, video.duration.currentTime);\n video.muted = true;\n\n video.addEventListener('buffer', onBuffer);\n video.addEventListener('progress', onBuffer);\n\n video.play();\n });\n }\n\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, PSVError, utils } from '../..';\nimport { AbstractVideoAdapter } from '../shared/AbstractVideoAdapter';\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n */\n\n\n/**\n * @summary Adapter for equirectangular videos\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularVideoAdapter extends AbstractVideoAdapter {\n\n static id = 'equirectangular-video';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularVideoAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv, {\n resolution: 64,\n ...options,\n });\n\n if (!utils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularVideoAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n return super.loadTexture(panorama)\n .then(({ texture }) => {\n const panoData = {\n fullWidth : texture.image.width,\n fullHeight : texture.image.height,\n croppedWidth : texture.image.width,\n croppedHeight: texture.image.height,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n };\n\n return { panorama, texture, panoData };\n });\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(\n CONSTANTS.SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1);\n\n const material = new THREE.MeshBasicMaterial();\n\n return new THREE.Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n mesh.material.map?.dispose();\n mesh.material.map = textureData.texture;\n\n this.__switchVideo(textureData.texture);\n }\n\n}\n"],"names":["AbstractVideoAdapter","psv","options","config","autoplay","muted","video","on","CONSTANTS","EVENTS","BEFORE_RENDER","destroy","off","__removeVideo","handleEvent","e","type","needsUpdate","loadTexture","panorama","source","Promise","reject","PSVError","getPlugin","__createVideo","__videoLoadPromise","then","texture","THREE","VideoTexture","__switchVideo","currentTime","duration","paused","volume","image","play","disposeTexture","textureData","pause","container","removeChild","dispose","src","document","createElement","crossOrigin","withCredentials","loop","playsinline","style","display","preload","appendChild","self","resolve","addEventListener","onLoaded","__videoBufferPromise","removeEventListener","onError","err","onBuffer","buffer","buffered","i","l","length","start","end","Math","min","AbstractAdapter","supportsTransition","supportsPreload","supportsDownload","EquirectangularVideoAdapter","resolution","utils","isPowerOfTwo","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","panoData","fullWidth","width","fullHeight","height","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","material","MeshBasicMaterial","Mesh","setTexture","mesh","map","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;MACaA,oBAAb;EAAA;;EAME,gCAAYC,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA;;EAAA;;EACxB,wCAAMD,GAAN;EAEA;EACJ;EACA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EA,WAAO,IAAIzE,KAAK,CAAC0E,IAAV,CAAeN,QAAf,EAAyBI,QAAzB,CAAP;EACD;EAED;EACF;EACA;EAjEA;;EAAA,SAkEEG,UAlEF,GAkEE,oBAAWC,IAAX,EAAiBlE,WAAjB,EAA8B;EAAA;;EAC5B,0BAAAkE,IAAI,CAACJ,QAAL,CAAcK,GAAd,wCAAmB/D,OAAnB;EACA8D,IAAAA,IAAI,CAACJ,QAAL,CAAcK,GAAd,GAAoBnE,WAAW,CAACX,OAAhC;;EAEA,SAAKG,aAAL,CAAmBQ,WAAW,CAACX,OAA/B;EACD,GAvEH;;EAAA;EAAA,EAAiD5B,oBAAjD;EAAa6E,4BAEJ8B,KAAK;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"equirectangular-video.js","sources":["../../src/adapters/shared/AbstractVideoAdapter.js","../../src/adapters/equirectangular-video/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractAdapter, CONSTANTS, PSVError } from '../..';\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n */\n\n/**\n * @summary Base video adapters class\n * @memberof PSV.adapters\n * @abstract\n * @private\n */\nexport class AbstractVideoAdapter extends AbstractAdapter {\n\n static supportsTransition = false;\n static supportsPreload = false;\n static supportsDownload = false;\n\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.AbstractVideoAdapter.Options}\n * @private\n */\n this.config = {\n autoplay: false,\n muted : options?.autoplay ?? false,\n ...options,\n };\n\n /**\n * @member {HTMLVideoElement}\n * @private\n */\n this.video = null;\n\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.__removeVideo();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n if (this.video) {\n this.psv.needsUpdate();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {PSV.adapters.AbstractVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.source) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n\n if (!this.psv.getPlugin('video')) {\n return Promise.reject(new PSVError('Video adapters require VideoPlugin to be loaded too.'));\n }\n\n const video = this.__createVideo(panorama.source);\n\n return this.__videoLoadPromise(video)\n .then(() => {\n const texture = new THREE.VideoTexture(video);\n return { panorama, texture };\n });\n }\n\n /**\n * @override\n */\n __switchVideo(texture) {\n let currentTime;\n let duration;\n let paused = !this.config.autoplay;\n let muted = this.config.muted;\n let volume = 1;\n if (this.video) {\n ({ currentTime, duration, paused, muted, volume } = this.video);\n }\n\n this.__removeVideo();\n this.video = texture.image;\n\n // keep current time when switching resolution\n if (this.video.duration === duration) {\n this.video.currentTime = currentTime;\n }\n\n // keep volume\n this.video.muted = muted;\n this.video.volume = volume;\n\n // play\n if (!paused) {\n this.video.play();\n }\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n if (textureData.texture) {\n const video = textureData.texture.image;\n video.pause();\n this.psv.container.removeChild(video);\n }\n textureData.texture?.dispose();\n }\n\n /**\n * @summary Removes the current video element\n * @private\n */\n __removeVideo() {\n if (this.video) {\n this.video.pause();\n this.psv.container.removeChild(this.video);\n delete this.video;\n }\n }\n\n /**\n * @summary Creates a new video element\n * @memberOf PSV.adapters\n * @param {string} src\n * @return {HTMLVideoElement}\n * @private\n */\n __createVideo(src) {\n const video = document.createElement('video');\n video.crossOrigin = this.psv.config.withCredentials ? 'use-credentials' : 'anonymous';\n video.loop = true;\n video.playsinline = true;\n video.style.display = 'none';\n video.muted = this.config.muted;\n video.src = src;\n video.preload = 'metadata';\n\n this.psv.container.appendChild(video);\n\n return video;\n }\n\n /**\n * @private\n */\n __videoLoadPromise(video) {\n const self = this;\n\n return new Promise((resolve, reject) => {\n video.addEventListener('loadedmetadata', function onLoaded() {\n if (this.video && video.duration === this.video.duration) {\n resolve(self.__videoBufferPromise(video, this.video.currentTime));\n }\n else {\n resolve();\n }\n video.removeEventListener('loadedmetadata', onLoaded);\n });\n\n video.addEventListener('error', function onError(err) {\n reject(err);\n video.removeEventListener('error', onError);\n });\n });\n }\n\n /**\n * @private\n */\n __videoBufferPromise(video, currentTime) {\n return new Promise((resolve) => {\n function onBuffer() {\n const buffer = video.buffered;\n for (let i = 0, l = buffer.length; i < l; i++) {\n if (buffer.start(i) <= video.currentTime && buffer.end(i) >= video.currentTime) {\n video.pause();\n video.removeEventListener('buffer', onBuffer);\n video.removeEventListener('progress', onBuffer);\n resolve();\n break;\n }\n }\n }\n\n // try to reduce the switching time by preloading in advance\n // FIXME find a better way ?\n video.currentTime = Math.min(currentTime + 2000, video.duration.currentTime);\n video.muted = true;\n\n video.addEventListener('buffer', onBuffer);\n video.addEventListener('progress', onBuffer);\n\n video.play();\n });\n }\n\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, PSVError, utils } from '../..';\nimport { AbstractVideoAdapter } from '../shared/AbstractVideoAdapter';\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n */\n\n\n/**\n * @summary Adapter for equirectangular videos\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularVideoAdapter extends AbstractVideoAdapter {\n\n static id = 'equirectangular-video';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularVideoAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv, {\n resolution: 64,\n ...options,\n });\n\n if (!utils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularVideoAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n return super.loadTexture(panorama)\n .then(({ texture }) => {\n const video = texture.image;\n const panoData = {\n fullWidth : video.videoWidth,\n fullHeight : video.videoHeight,\n croppedWidth : video.videoWidth,\n croppedHeight: video.videoHeight,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n };\n\n return { panorama, texture, panoData };\n });\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(\n CONSTANTS.SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1);\n\n const material = new THREE.MeshBasicMaterial();\n\n return new THREE.Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n mesh.material.map?.dispose();\n mesh.material.map = textureData.texture;\n\n this.__switchVideo(textureData.texture);\n }\n\n}\n"],"names":["AbstractVideoAdapter","psv","options","config","autoplay","muted","video","on","CONSTANTS","EVENTS","BEFORE_RENDER","destroy","off","__removeVideo","handleEvent","e","type","needsUpdate","loadTexture","panorama","source","Promise","reject","PSVError","getPlugin","__createVideo","__videoLoadPromise","then","texture","THREE","VideoTexture","__switchVideo","currentTime","duration","paused","volume","image","play","disposeTexture","textureData","pause","container","removeChild","dispose","src","document","createElement","crossOrigin","withCredentials","loop","playsinline","style","display","preload","appendChild","self","resolve","addEventListener","onLoaded","__videoBufferPromise","removeEventListener","onError","err","onBuffer","buffer","buffered","i","l","length","start","end","Math","min","AbstractAdapter","supportsTransition","supportsPreload","supportsDownload","EquirectangularVideoAdapter","resolution","utils","isPowerOfTwo","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","panoData","fullWidth","videoWidth","fullHeight","videoHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","material","MeshBasicMaterial","Mesh","setTexture","mesh","map","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;MACaA,oBAAb;EAAA;;EAME,gCAAYC,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA;;EAAA;;EACxB,wCAAMD,GAAN;EAEA;EACJ;EACA;EACA;;EACI,UAAKE,MAAL;EACEC,MAAAA,QAAQ,EAAE,KADZ;EAEEC,MAAAA,KAAK,uBAAKH,OAAL,oBAAKA,OAAO,CAAEE,QAAd,gCAA0B;EAFjC,OAGKF,OAHL;EAMA;EACJ;EACA;EACA;;EACI,UAAKI,KAAL,GAAa,IAAb;;EAEA,UAAKL,GAAL,CAASM,EAAT,CAAYC,2BAAS,CAACC,MAAV,CAAiBC,aAA7B;;EAnBwB;EAoBzB;EAED;EACF;EACA;;;EA9BA;;EAAA,SA+BEC,OA/BF,GA+BE,mBAAU;EACR,SAAKV,GAAL,CAASW,GAAT,CAAaJ,2BAAS,CAACC,MAAV,CAAiBC,aAA9B,EAA6C,IAA7C;;EAEA,SAAKG,aAAL;;EAEA,+BAAMF,OAAN;EACD;EAED;EACF;EACA;EAzCA;;EAAA,SA0CEG,WA1CF,GA0CE,qBAAYC,CAAZ,EAAe;EACb;EACA,YAAQA,CAAC,CAACC,I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AM,CARA;EASfC,QAAAA,QAAQ,EAAO;EATA,OAAjB;EAYA,aAAO;EAAE3E,QAAAA,QAAQ,EAARA,QAAF;EAAYS,QAAAA,OAAO,EAAPA,OAAZ;EAAqBuD,QAAAA,QAAQ,EAARA;EAArB,OAAP;EACD,KAhBI,CAAP;EAiBD;EAED;EACF;EACA;EAjDA;;EAAA,SAkDEY,UAlDF,GAkDE,oBAAWC,KAAX,EAAsB;EAAA,QAAXA,KAAW;EAAXA,MAAAA,KAAW,GAAH,CAAG;EAAA;;EACpB,QAAMC,QAAQ,GAAG,IAAIpE,KAAK,CAACqE,cAAV,CACf1F,2BAAS,CAAC2F,aAAV,GAA0BH,KADX,EAEf,KAAKf,eAFU,EAGf,KAAKC,0BAHU,EAIf,CAACX,IAAI,CAAC6B,EAAN,GAAW,CAJI,EAMdJ,KANc,CAMR,CAAC,CANO,EAMJ,CANI,EAMD,CANC,CAAjB;EAQA,QAAMK,QAAQ,GAAG,IAAIxE,KAAK,CAACyE,iBAAV,EAAjB;EAEA,WAAO,IAAIzE,KAAK,CAAC0E,IAAV,CAAeN,QAAf,EAAyBI,QAAzB,CAAP;EACD;EAED;EACF;EACA;EAlEA;;EAAA,SAmEEG,UAnEF,GAmEE,oBAAWC,IAAX,EAAiBlE,WAAjB,EAA8B;EAAA;;EAC5B,0BAAAkE,IAAI,CAACJ,QAAL,CAAcK,GAAd,wCAAmB/D,OAAnB;EACA8D,IAAAA,IAAI,CAACJ,QAAL,CAAcK,GAAd,GAAoBnE,WAAW,CAACX,OAAhC;;EAEA,SAAKG,aAAL,CAAmBQ,WAAW,CAACX,OAA/B;EACD,GAxEH;;EAAA;EAAA,EAAiD5B,oBAAjD;EAAa6E,4BAEJ8B,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/photo-sphere-viewer.css b/dist/photo-sphere-viewer.css index e0535c6eb..47a63102e 100644 --- a/dist/photo-sphere-viewer.css +++ b/dist/photo-sphere-viewer.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.6.3 + * Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/photo-sphere-viewer.d.ts b/dist/photo-sphere-viewer.d.ts index c71ec55ce..0e509cc80 100644 --- a/dist/photo-sphere-viewer.d.ts +++ b/dist/photo-sphere-viewer.d.ts @@ -982,6 +982,7 @@ type ViewerOptions = { moveSpeed?: number; zoomSpeed?: number; autorotateDelay?: number, + autorotateIdle?: boolean; autorotateSpeed?: string | number; autorotateLat?: number; moveInertia?: boolean; diff --git a/dist/photo-sphere-viewer.js b/dist/photo-sphere-viewer.js index 45e0dd1c8..746cf2b6d 100644 --- a/dist/photo-sphere-viewer.js +++ b/dist/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -3568,6 +3568,11 @@ ; _proto.onClick = function onClick() { + if (this.psv.isAutorotateEnabled()) { + this.psv.config.autorotateIdle = false; + this.psv.resetIdleTimer(); + } + this.psv.toggleAutorotate(); }; @@ -3659,126 +3664,6 @@ return CustomButton; }(AbstractButton); - /** - * @summary Navbar caption class - * @extends PSV.components.AbstractComponent - * @memberof PSV.components - */ - - var NavbarCaption = /*#__PURE__*/function (_AbstractComponent) { - _inheritsLoose(NavbarCaption, _AbstractComponent); - - /** - * @param {PSV.components.Navbar} navbar - * @param {string} caption - */ - function NavbarCaption(navbar, caption) { - var _this; - - _this = _AbstractComponent.call(this, navbar, 'psv-caption') || this; - /** - * @override - * @property {string} id - * @property {boolean} collapsable - * @property {number} width - * @property {number} contentWidth - width of the caption content - */ - - _this.prop = _extends({}, _this.prop, { - id: _this.constructor.id, - collapsable: false, - width: 0, - contentWidth: 0 - }); - /** - * @member {HTMLElement} - * @readonly - * @private - */ - - _this.content = document.createElement('div'); - _this.content.className = 'psv-caption-content'; - - _this.container.appendChild(_this.content); - - _this.setCaption(caption); - - return _this; - } - /** - * @override - */ - - - var _proto = NavbarCaption.prototype; - - _proto.destroy = function destroy() { - delete this.content; - - _AbstractComponent.prototype.destroy.call(this); - } - /** - * @summary Sets the bar caption - * @param {string} html - */ - ; - - _proto.setCaption = function setCaption(html) { - this.show(); - this.content.innerHTML = html; - this.prop.contentWidth = html ? this.content.offsetWidth : 0; - this.refreshUi(); - } - /** - * @summary Toggles content and icon depending on available space - * @private - */ - ; - - _proto.refreshUi = function refreshUi() { - var availableWidth = this.container.offsetWidth; - - if (availableWidth >= this.prop.contentWidth) { - this.show(); - } else if (availableWidth < this.prop.contentWidth) { - this.hide(); - } - - this.__refreshButton(); - } - /** - * @override - */ - ; - - _proto.hide = function hide() { - this.content.style.display = 'none'; - this.prop.visible = false; - } - /** - * @override - */ - ; - - _proto.show = function show() { - this.content.style.display = ''; - this.prop.visible = true; - } - /** - * @private - */ - ; - - _proto.__refreshButton = function __refreshButton() { - var _this$psv$navbar$getB; - - (_this$psv$navbar$getB = this.psv.navbar.getButton(DescriptionButton.id, false)) == null ? void 0 : _this$psv$navbar$getB.refreshUi(true); - }; - - return NavbarCaption; - }(AbstractComponent); - NavbarCaption.id = 'caption'; - var info = "\n"; var MODE_NOTIF = 1; @@ -3894,7 +3779,7 @@ } if (refresh) { - var caption = this.psv.navbar.getButton(NavbarCaption.id, false); + var caption = this.psv.navbar.getButton('caption', false); var captionHidden = caption && !caption.isVisible(); var hasDescription = !!this.psv.config.description; @@ -4460,7 +4345,9 @@ } this.prop.handler.up(function () { - return _this2.psv.dynamics.position.stop(); + _this2.psv.dynamics.position.stop(); + + _this2.psv.resetIdleTimer(); }); }; @@ -4838,6 +4725,7 @@ delete this.zoomRange; delete this.zoomValue; this.psv.off(EVENTS.ZOOM_UPDATED, this); + this.psv.off(EVENTS.READY, this); _AbstractButton.prototype.destroy.call(this); } @@ -5015,6 +4903,7 @@ moveSpeed: 1, zoomSpeed: 1, autorotateDelay: null, + autorotateIdle: false, autorotateSpeed: '2rpm', autorotateLat: null, moveInertia: true, @@ -5149,6 +5038,14 @@ autorotateSpeed: function autorotateSpeed(_autorotateSpeed) { return parseSpeed(_autorotateSpeed); }, + autorotateIdle: function autorotateIdle(_autorotateIdle, config) { + if (_autorotateIdle && isNil(config.autorotateDelay)) { + logWarn('autorotateIdle requires a non null autorotateDelay'); + return false; + } + + return _autorotateIdle; + }, fisheye: function fisheye(_fisheye) { // translate boolean fisheye to amount if (_fisheye === true) { @@ -5206,6 +5103,126 @@ return config; } + /** + * @summary Navbar caption class + * @extends PSV.components.AbstractComponent + * @memberof PSV.components + */ + + var NavbarCaption = /*#__PURE__*/function (_AbstractComponent) { + _inheritsLoose(NavbarCaption, _AbstractComponent); + + /** + * @param {PSV.components.Navbar} navbar + * @param {string} caption + */ + function NavbarCaption(navbar, caption) { + var _this; + + _this = _AbstractComponent.call(this, navbar, 'psv-caption') || this; + /** + * @override + * @property {string} id + * @property {boolean} collapsable + * @property {number} width + * @property {number} contentWidth - width of the caption content + */ + + _this.prop = _extends({}, _this.prop, { + id: _this.constructor.id, + collapsable: false, + width: 0, + contentWidth: 0 + }); + /** + * @member {HTMLElement} + * @readonly + * @private + */ + + _this.content = document.createElement('div'); + _this.content.className = 'psv-caption-content'; + + _this.container.appendChild(_this.content); + + _this.setCaption(caption); + + return _this; + } + /** + * @override + */ + + + var _proto = NavbarCaption.prototype; + + _proto.destroy = function destroy() { + delete this.content; + + _AbstractComponent.prototype.destroy.call(this); + } + /** + * @summary Sets the bar caption + * @param {string} html + */ + ; + + _proto.setCaption = function setCaption(html) { + this.show(); + this.content.innerHTML = html; + this.prop.contentWidth = html ? this.content.offsetWidth : 0; + this.refreshUi(); + } + /** + * @summary Toggles content and icon depending on available space + * @private + */ + ; + + _proto.refreshUi = function refreshUi() { + var availableWidth = this.container.offsetWidth; + + if (availableWidth >= this.prop.contentWidth) { + this.show(); + } else if (availableWidth < this.prop.contentWidth) { + this.hide(); + } + + this.__refreshButton(); + } + /** + * @override + */ + ; + + _proto.hide = function hide() { + this.content.style.display = 'none'; + this.prop.visible = false; + } + /** + * @override + */ + ; + + _proto.show = function show() { + this.content.style.display = ''; + this.prop.visible = true; + } + /** + * @private + */ + ; + + _proto.__refreshButton = function __refreshButton() { + var _this$psv$navbar$getB; + + (_this$psv$navbar$getB = this.psv.navbar.getButton(DescriptionButton.id, false)) == null ? void 0 : _this$psv$navbar$getB.refreshUi(true); + }; + + return NavbarCaption; + }(AbstractComponent); + NavbarCaption.id = 'caption'; + /** * @summary List of available buttons * @type {Object>} @@ -6872,11 +6889,18 @@ return; } - if (this.config.keyboard[e.key] === ACTIONS.TOGGLE_AUTOROTATE) { + var action = this.config.keyboard[e.key]; + + if (action === ACTIONS.TOGGLE_AUTOROTATE) { this.psv.toggleAutorotate(); - } else if (this.config.keyboard[e.key] && !this.state.keyHandler.time) { + } else if (action && !this.state.keyHandler.time) { + if (action !== ACTIONS.ZOOM_IN && action !== ACTIONS.ZOOM_OUT) { + this.psv.__stopAll(); + } /* eslint-disable */ - switch (this.config.keyboard[e.key]) { + + + switch (action) { // @formatter:off case ACTIONS.ROTATE_LAT_UP: this.psv.dynamics.position.roll({ @@ -6936,6 +6960,8 @@ _this2.psv.dynamics.position.stop(); _this2.psv.dynamics.zoom.stop(); + + _this2.psv.resetIdleTimer(); }); } /** @@ -7247,8 +7273,7 @@ _proto.__startMove = function __startMove(evt) { var _this6 = this; - this.psv.stopAutorotate(); - this.psv.stopAnimation().then(function () { + this.psv.__stopAll().then(function () { _this6.state.mouseX = evt.clientX; _this6.state.mouseY = evt.clientY; _this6.state.startMouseX = _this6.state.mouseX; @@ -7268,21 +7293,25 @@ ; _proto.__startMoveZoom = function __startMoveZoom(evt) { - var p1 = { - x: evt.touches[0].clientX, - y: evt.touches[0].clientY - }; - var p2 = { - x: evt.touches[1].clientX, - y: evt.touches[1].clientY - }; - this.state.pinchDist = distance(p1, p2); - this.state.mouseX = (p1.x + p2.x) / 2; - this.state.mouseY = (p1.y + p2.y) / 2; - this.state.startMouseX = this.state.mouseX; - this.state.startMouseY = this.state.mouseY; - this.state.moving = true; - this.state.zooming = true; + var _this7 = this; + + this.psv.__stopAll().then(function () { + var p1 = { + x: evt.touches[0].clientX, + y: evt.touches[0].clientY + }; + var p2 = { + x: evt.touches[1].clientX, + y: evt.touches[1].clientY + }; + _this7.state.pinchDist = distance(p1, p2); + _this7.state.mouseX = (p1.x + p2.x) / 2; + _this7.state.mouseY = (p1.y + p2.y) / 2; + _this7.state.startMouseX = _this7.state.mouseX; + _this7.state.startMouseY = _this7.state.mouseY; + _this7.state.moving = true; + _this7.state.zooming = true; + }); } /** * @summary Stops the movement @@ -7293,6 +7322,8 @@ ; _proto.__stopMove = function __stopMove(evt) { + this.psv.resetIdleTimer(); + if (!getClosest(evt.target, '.psv-container')) { this.state.moving = false; this.state.mouseHistory.length = 0; @@ -7324,6 +7355,7 @@ ; _proto.__stopMoveZoom = function __stopMoveZoom() { + this.psv.resetIdleTimer(); this.state.mouseHistory.length = 0; this.state.moving = false; this.state.zooming = false; @@ -7336,7 +7368,7 @@ ; _proto.__stopMoveInertia = function __stopMoveInertia(evt) { - var _this7 = this; + var _this8 = this; var direction = { x: evt.clientX - this.state.mouseHistory[0][1], @@ -7357,11 +7389,11 @@ duration: norm * INERTIA_WINDOW / 100, easing: 'outCirc', onTick: function onTick(properties) { - _this7.__move(properties, false); + _this8.__move(properties, false); } }); this.prop.animationPromise.then(function () { - _this7.state.moving = false; + _this8.state.moving = false; }); } /** @@ -7375,7 +7407,7 @@ ; _proto.__click = function __click(evt, longtouch) { - var _this8 = this; + var _this9 = this; if (longtouch === void 0) { longtouch = false; @@ -7425,8 +7457,8 @@ this.psv.trigger(EVENTS.CLICK, data); this.state.dblclickData = clone(data); this.state.dblclickTimeout = setTimeout(function () { - _this8.state.dblclickTimeout = null; - _this8.state.dblclickData = null; + _this9.state.dblclickTimeout = null; + _this9.state.dblclickData = null; }, DBLCLICK_DELAY); } else { if (Math.abs(this.state.dblclickData.clientX - data.clientX) < this.state.moveThreshold && Math.abs(this.state.dblclickData.clientY - data.clientY) < this.state.moveThreshold) { @@ -7790,6 +7822,10 @@ return d.update(elapsed); }); + if (this.prop.idleTime > 0 && timestamp - this.prop.idleTime > this.config.autorotateDelay) { + this.psv.startAutorotate(); + } + if (this.prop.needsUpdate) { this.render(); this.prop.needsUpdate = false; @@ -8590,7 +8626,7 @@ * @property {boolean} autorotateEnabled - automatic rotation is enabled * @property {PSV.Animation} animationPromise - promise of the current animation * @property {Promise} loadingPromise - promise of the setPanorama method - * @property startTimeout - timeout id of the automatic rotation delay + * @property {number} idleTime - time of the last user action * @property {object} objectsObservers * @property {PSV.Size} size - size of the container * @property {PSV.PanoData} panoData - panorama metadata, if supported @@ -8609,7 +8645,7 @@ autorotateEnabled: false, animationPromise: null, loadingPromise: null, - startTimeout: null, + idleTime: -1, objectsObservers: {}, size: { width: 0, @@ -8802,10 +8838,8 @@ } // Queue autorotate - if (_this.config.autorotateDelay) { - _this.prop.startTimeout = setTimeout(function () { - return _this.startAutorotate(); - }, _this.config.autorotateDelay); + if (!isNil(_this.config.autorotateDelay)) { + _this.prop.idleTime = performance.now(); } _this.prop.ready = true; @@ -9051,6 +9085,8 @@ console.error(err); throw err; } else { + _this3.resetIdleTimer(); + _this3.navbar.setCaption(_this3.config.caption); return true; @@ -9120,6 +9156,8 @@ _proto.setOptions = function setOptions(options) { var _this4 = this; + var rawConfig = _extends({}, this.config, options); + each(options, function (value, key) { if (DEPRECATED_OPTIONS[key]) { logWarn(DEPRECATED_OPTIONS[key]); @@ -9135,7 +9173,7 @@ } if (CONFIG_PARSERS[key]) { - _this4.config[key] = CONFIG_PARSERS[key](value, options); + _this4.config[key] = CONFIG_PARSERS[key](value, rawConfig); } else { _this4.config[key] = value; } @@ -9180,6 +9218,11 @@ case 'canvasBackground': _this4.renderer.canvasContainer.style.background = _this4.config.canvasBackground; break; + + case 'autorotateIdle': + _this4.resetIdleTimer(); + + break; } }); this.needsUpdate(); @@ -9200,6 +9243,24 @@ this.setOptions((_this$setOptions = {}, _this$setOptions[option] = value, _this$setOptions)); } + /** + * @summary Restarts the idle timer (if `autorotateIdle=true`) + * @package + */ + ; + + _proto.resetIdleTimer = function resetIdleTimer() { + this.prop.idleTime = this.config.autorotateIdle ? performance.now() : -1; + } + /** + * @summary Stops the idle timer + * @package + */ + ; + + _proto.disableIdleTimer = function disableIdleTimer() { + this.prop.idleTime = -1; + } /** * @summary Starts the automatic rotation * @fires PSV.autorotate @@ -9215,6 +9276,10 @@ return; } + if (!refresh && this.isAutorotateEnabled()) { + return; + } + if (!refresh) { this.__stopAll(); } @@ -9238,11 +9303,6 @@ ; _proto.stopAutorotate = function stopAutorotate() { - if (this.prop.startTimeout) { - clearTimeout(this.prop.startTimeout); - this.prop.startTimeout = null; - } - if (this.isAutorotateEnabled()) { this.dynamics.position.stop(); this.prop.autorotateEnabled = false; @@ -9376,6 +9436,11 @@ } } }); + this.prop.animationPromise.then(function () { + _this5.prop.animationPromise = null; + + _this5.resetIdleTimer(); + }); return this.prop.animationPromise; } /** @@ -9540,14 +9605,16 @@ } /** * @summary Stops all current animations + * @returns {Promise} * @package */ ; _proto.__stopAll = function __stopAll() { - this.stopAutorotate(); - this.stopAnimation(); this.trigger(EVENTS.STOP_ALL); + this.disableIdleTimer(); + this.stopAutorotate(); + return this.stopAnimation(); } /** * @summary Recomputes dynamics speeds diff --git a/dist/photo-sphere-viewer.js.map b/dist/photo-sphere-viewer.js.map index 05270038e..92cce3d6d 100644 --- a/dist/photo-sphere-viewer.js.map +++ b/dist/photo-sphere-viewer.js.map @@ -1 +1 @@ -{"version":3,"file":"photo-sphere-viewer.js","sources":["../src/PSVError.js","../src/adapters/AbstractAdapter.js","../src/data/constants.js","../src/data/system.js","../src/utils/browser.js","../src/utils/math.js","../src/utils/misc.js","../src/utils/psv.js","../src/utils/Animation.js","../src/utils/Dynamic.js","../src/utils/MultiDynamic.js","../src/utils/Slider.js","../src/utils/index.js","../src/adapters/equirectangular/index.js","../src/components/AbstractComponent.js","../src/buttons/AbstractButton.js","../src/buttons/AutorotateButton.js","../src/buttons/CustomButton.js","../src/components/NavbarCaption.js","../src/buttons/DescriptionButton.js","../src/buttons/DownloadButton.js","../src/buttons/FullscreenButton.js","../src/buttons/MenuButton.js","../src/utils/PressHandler.js","../src/buttons/AbstractMoveButton.js","../src/buttons/MoveDownButton.js","../src/buttons/MoveLeftButton.js","../src/buttons/MoveRightButton.js","../src/buttons/MoveUpButton.js","../src/buttons/AbstractZoomButton.js","../src/buttons/ZoomInButton.js","../src/buttons/ZoomOutButton.js","../src/buttons/ZoomRangeButton.js","../src/plugins/AbstractPlugin.js","../src/data/config.js","../src/components/Navbar.js","../src/components/Loader.js","../src/components/Notification.js","../src/components/Overlay.js","../src/components/Panel.js","../src/services/AbstractService.js","../src/services/DataHelper.js","../src/services/EventsHandler.js","../src/services/Renderer.js","../src/services/TextureLoader.js","../src/components/Tooltip.js","../src/services/TooltipRenderer.js","../src/Viewer.js"],"sourcesContent":["/**\n * @summary Custom error used in the lib\n * @param {string} message\n * @constructor\n * @memberOf PSV\n */\nfunction PSVError(message) {\n this.message = message;\n\n // Use V8's native method if available, otherwise fallback\n if ('captureStackTrace' in Error) {\n Error.captureStackTrace(this, PSVError);\n }\n else {\n this.stack = (new Error()).stack;\n }\n}\n\nPSVError.prototype = Object.create(Error.prototype);\nPSVError.prototype.name = 'PSVError';\nPSVError.prototype.constructor = PSVError;\n\nexport { PSVError };\n","import { PSVError } from '../PSVError';\n\n/**\n * @namespace PSV.adapters\n */\n\n/**\n * @summary Base adapters class\n * @memberof PSV.adapters\n * @abstract\n */\nexport class AbstractAdapter {\n\n /**\n * @summary Unique identifier of the adapter\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @summary Indicates if the adapter supports panorama download natively\n * @type {boolean}\n * @readonly\n * @static\n */\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n }\n\n /**\n * @summary Destroys the adapter\n */\n destroy() {\n delete this.psv;\n }\n\n /**\n * @summary Indicates if the adapter supports transitions between panoramas\n * @param {*} panorama\n * @return {boolean}\n */\n supportsTransition(panorama) { // eslint-disable-line no-unused-vars\n return false;\n }\n\n /**\n * @summary Indicates if the adapter supports preload of a panorama\n * @param {*} panorama\n * @return {boolean}\n */\n supportsPreload(panorama) { // eslint-disable-line no-unused-vars\n return false;\n }\n\n /**\n * @abstract\n * @summary Loads the panorama texture(s)\n * @param {*} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n */\n loadTexture(panorama, newPanoData) { // eslint-disable-line no-unused-vars\n throw new PSVError('loadTexture not implemented');\n }\n\n /**\n * @abstract\n * @summary Creates the cube mesh\n * @param {number} [scale=1]\n * @returns {external:THREE.Mesh}\n */\n createMesh(scale = 1) { // eslint-disable-line no-unused-vars\n throw new PSVError('createMesh not implemented');\n }\n\n /**\n * @abstract\n * @summary Applies the texture to the mesh\n * @param {external:THREE.Mesh} mesh\n * @param {PSV.TextureData} textureData\n * @param {boolean} [transition=false]\n */\n setTexture(mesh, textureData, transition = false) { // eslint-disable-line no-unused-vars\n throw new PSVError('setTexture not implemented');\n }\n\n /**\n * @abstract\n * @summary Changes the opacity of the mesh\n * @param {external:THREE.Mesh} mesh\n * @param {number} opacity\n */\n setTextureOpacity(mesh, opacity) { // eslint-disable-line no-unused-vars\n throw new PSVError('setTextureOpacity not implemented');\n }\n\n /**\n * @abstract\n * @summary Clear a loaded texture from memory\n * @param {PSV.TextureData} textureData\n */\n disposeTexture(textureData) { // eslint-disable-line no-unused-vars\n throw new PSVError('disposeTexture not implemented');\n }\n\n}\n","/**\n * @namespace PSV.constants\n */\n\n/**\n * @summary Default duration of the transition between panoramas\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const DEFAULT_TRANSITION = 1500;\n\n/**\n * @summary Number of pixels bellow which a mouse move will be considered as a click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const MOVE_THRESHOLD = 4;\n\n/**\n * @summary Delay in milliseconds between two clicks to consider a double click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const DBLCLICK_DELAY = 300;\n\n/**\n * @summary Delay in milliseconds to emulate a long touch\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const LONGTOUCH_DELAY = 500;\n\n/**\n * @summary Delay in milliseconds to for the two fingers overlay to appear\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const TWOFINGERSOVERLAY_DELAY = 100;\n\n/**\n * @summary Duration in milliseconds of the \"ctrl zoom\" overlay\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const CTRLZOOM_TIMEOUT = 2000;\n\n/**\n * @summary Time size of the mouse position history used to compute inertia\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const INERTIA_WINDOW = 300;\n\n/**\n * @summary Radius of the THREE.SphereGeometry, Half-length of the THREE.BoxGeometry\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const SPHERE_RADIUS = 10;\n\n/**\n * @summary Property name added to viewer element\n * @memberOf PSV.constants\n * @type {string}\n * @constant\n */\nexport const VIEWER_DATA = 'photoSphereViewer';\n\n/**\n * @summary Property added the the main Mesh object\n * @memberOf PSV.constants\n * @type {string}\n * @constant\n */\nexport const MESH_USER_DATA = 'psvSphere';\n\n/**\n * @summary Available actions\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const ACTIONS = {\n ROTATE_LAT_UP : 'rotateLatitudeUp',\n ROTATE_LAT_DOWN : 'rotateLatitudeDown',\n ROTATE_LONG_RIGHT: 'rotateLongitudeRight',\n ROTATE_LONG_LEFT : 'rotateLongitudeLeft',\n ZOOM_IN : 'zoomIn',\n ZOOM_OUT : 'zoomOut',\n TOGGLE_AUTOROTATE: 'toggleAutorotate',\n};\n\n/**\n * @summary Available events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event autorotate\n * @memberof PSV\n * @summary Triggered when the automatic rotation is enabled/disabled\n * @param {boolean} enabled\n */\n AUTOROTATE : 'autorotate',\n /**\n * @event before-render\n * @memberof PSV\n * @summary Triggered before a render, used to modify the view\n * @param {number} timestamp - time provided by requestAnimationFrame\n * @param {number} elapsed - time elapsed from the previous frame\n */\n BEFORE_RENDER : 'before-render',\n /**\n * @event before-rotate\n * @memberOf PSV\n * @summary Triggered before a rotate operation, can be cancelled\n * @param {PSV.ExtendedPosition}\n */\n BEFORE_ROTATE : 'before-rotate',\n /**\n * @event click\n * @memberof PSV\n * @summary Triggered when the user clicks on the viewer (everywhere excluding the navbar and the side panel)\n * @param {PSV.ClickData} data\n */\n CLICK : 'click',\n /**\n * @event close-panel\n * @memberof PSV\n * @summary Triggered when the panel is closed\n * @param {string} [id]\n */\n CLOSE_PANEL : 'close-panel',\n /**\n * @event config-changed\n * @memberOf PSV\n * @summary Triggered after a call to setOption/setOptions\n * @param {string[]} name of changed options\n */\n CONFIG_CHANGED : 'config-changed',\n /**\n * @event dblclick\n * @memberof PSV\n * @summary Triggered when the user double clicks on the viewer. The simple `click` event is always fired before `dblclick`\n * @param {PSV.ClickData} data\n */\n DOUBLE_CLICK : 'dblclick',\n /**\n * @event fullscreen-updated\n * @memberof PSV\n * @summary Triggered when the fullscreen mode is enabled/disabled\n * @param {boolean} enabled\n */\n FULLSCREEN_UPDATED: 'fullscreen-updated',\n /**\n * @event hide-notification\n * @memberof PSV\n * @summary Triggered when the notification is hidden\n * @param {string} [id]\n */\n HIDE_NOTIFICATION : 'hide-notification',\n /**\n * @event hide-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is hidden\n * @param {string} [id]\n */\n HIDE_OVERLAY : 'hide-overlay',\n /**\n * @event hide-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is hidden\n * @param {*} Data associated to this tooltip\n */\n HIDE_TOOLTIP : 'hide-tooltip',\n /**\n * @event key-press\n * @memberof PSV\n * @summary Triggered when a key is pressed, can be cancelled\n * @param {string} key\n */\n KEY_PRESS : 'key-press',\n /**\n * @event load-progress\n * @memberof PSV\n * @summary Triggered when the loader value changes\n * @param {number} value from 0 to 100\n */\n LOAD_PROGRESS : 'load-progress',\n /**\n * @event open-panel\n * @memberof PSV\n * @summary Triggered when the panel is opened\n * @param {string} [id]\n */\n OPEN_PANEL : 'open-panel',\n /**\n * @event panorama-loaded\n * @memberof PSV\n * @summary Triggered when a panorama image has been loaded\n * @param {PSV.TextureData} textureData\n */\n PANORAMA_LOADED : 'panorama-loaded',\n /**\n * @event position-updated\n * @memberof PSV\n * @summary Triggered when the view longitude and/or latitude changes\n * @param {PSV.Position} position\n */\n POSITION_UPDATED : 'position-updated',\n /**\n * @event ready\n * @memberof PSV\n * @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render\n */\n READY : 'ready',\n /**\n * @event render\n * @memberof PSV\n * @summary Triggered on each viewer render, **this event is triggered very often**\n */\n RENDER : 'render',\n /**\n * @event show-notification\n * @memberof PSV\n * @summary Triggered when the notification is shown\n * @param {string} [id]\n */\n SHOW_NOTIFICATION : 'show-notification',\n /**\n * @event show-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is shown\n * @param {string} [id]\n */\n SHOW_OVERLAY : 'show-overlay',\n /**\n * @event show-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is shown\n * @param {*} Data associated to this tooltip\n * @param {PSV.components.Tooltip} Instance of the tooltip\n */\n SHOW_TOOLTIP : 'show-tooltip',\n /**\n * @event size-updated\n * @memberof PSV\n * @summary Triggered when the viewer size changes\n * @param {PSV.Size} size\n */\n SIZE_UPDATED : 'size-updated',\n /**\n * @event stop-all\n * @memberof PSV\n * @summary Triggered when all current animations are stopped\n */\n STOP_ALL : 'stop-all',\n /**\n * @event zoom-updated\n * @memberof PSV\n * @summary Triggered when the zoom level changes\n * @param {number} zoomLevel\n */\n ZOOM_UPDATED : 'zoom-updated',\n};\n\n/**\n * @summary Available change events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const CHANGE_EVENTS = {\n /**\n * @event get-animate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of an animation\n */\n GET_ANIMATE_POSITION: 'get-animate-position',\n /**\n * @event get-rotate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of a rotation\n */\n GET_ROTATE_POSITION : 'get-rotate-position',\n};\n\n/**\n * @summary Special events emitted to listener using {@link Viewer#observeObjects}\n * @memberOf PSV.constants\n * @constant\n * @package\n */\nexport const OBJECT_EVENTS = {\n ENTER_OBJECT: 'enter-object',\n HOVER_OBJECT: 'hover-object',\n LEAVE_OBJECT: 'leave-object',\n};\n\n/**\n * @summary Internal identifiers for various stuff\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const IDS = {\n MENU : 'menu',\n TWO_FINGERS: 'twoFingers',\n CTRL_ZOOM : 'ctrlZoom',\n ERROR : 'error',\n DESCRIPTION: 'description',\n};\n\n/* eslint-disable */\n// @formatter:off\n/**\n * @summary Collection of easing functions\n * @memberOf PSV.constants\n * @see {@link https://gist.github.com/frederickk/6165768}\n * @type {Object}\n * @constant\n */\nexport const EASINGS = {\n linear : (t) => t,\n\n inQuad : (t) => t*t,\n outQuad : (t) => t*(2-t),\n inOutQuad : (t) => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\n inCubic : (t) => t*t*t,\n outCubic : (t) => (--t)*t*t+1,\n inOutCubic: (t) => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\n inQuart : (t) => t*t*t*t,\n outQuart : (t) => 1-(--t)*t*t*t,\n inOutQuart: (t) => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\n inQuint : (t) => t*t*t*t*t,\n outQuint : (t) => 1+(--t)*t*t*t*t,\n inOutQuint: (t) => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t,\n\n inSine : (t) => 1-Math.cos(t*(Math.PI/2)),\n outSine : (t) => Math.sin(t*(Math.PI/2)),\n inOutSine : (t) => .5-.5*Math.cos(Math.PI*t),\n\n inExpo : (t) => Math.pow(2, 10*(t-1)),\n outExpo : (t) => 1-Math.pow(2, -10*t),\n inOutExpo : (t) => (t=t*2-1)<0 ? .5*Math.pow(2, 10*t) : 1-.5*Math.pow(2, -10*t),\n\n inCirc : (t) => 1-Math.sqrt(1-t*t),\n outCirc : (t) => Math.sqrt(1-(t-1)*(t-1)),\n inOutCirc : (t) => (t*=2)<1 ? .5-.5*Math.sqrt(1-t*t) : .5+.5*Math.sqrt(1-(t-=2)*t)\n};\n// @formatter:on\n/* eslint-enable */\n\n/**\n * @summary Subset of key codes\n * @memberOf PSV.constants\n * @type {Object}\n * @constant\n */\nexport const KEY_CODES = {\n Enter : 'Enter',\n Control : 'Control',\n Escape : 'Escape',\n Space : ' ',\n PageUp : 'PageUp',\n PageDown : 'PageDown',\n ArrowLeft : 'ArrowLeft',\n ArrowUp : 'ArrowUp',\n ArrowRight: 'ArrowRight',\n ArrowDown : 'ArrowDown',\n Delete : 'Delete',\n Plus : '+',\n Minus : '-',\n};\n","import { PSVError } from '../PSVError';\nimport { VIEWER_DATA } from './constants';\n\nconst LOCALSTORAGE_TOUCH_SUPPORT = `${VIEWER_DATA}_touchSupport`;\n\n/**\n * @summary General information about the system\n * @constant\n * @memberOf PSV\n * @property {boolean} loaded - Indicates if the system data has been loaded\n * @property {Function} load - Loads the system if not already loaded\n * @property {number} pixelRatio\n * @property {boolean} isWebGLSupported\n * @property {number} maxCanvasWidth\n * @property {string} mouseWheelEvent\n * @property {string} fullscreenEvent\n * @property {Function} getMaxCanvasWidth - Returns the max width of a canvas allowed by the browser\n * @property {{initial: boolean, promise: Promise}} isTouchEnabled\n */\nexport const SYSTEM = {\n loaded : false,\n pixelRatio : 1,\n isWebGLSupported: false,\n isTouchEnabled : null,\n maxTextureWidth : 0,\n mouseWheelEvent : null,\n fullscreenEvent : null,\n};\n\n/**\n * @summary Loads the system if not already loaded\n */\nSYSTEM.load = () => {\n if (!SYSTEM.loaded) {\n const ctx = getWebGLCtx();\n\n SYSTEM.loaded = true;\n SYSTEM.pixelRatio = window.devicePixelRatio || 1;\n SYSTEM.isWebGLSupported = ctx != null;\n SYSTEM.isTouchEnabled = isTouchEnabled();\n SYSTEM.maxTextureWidth = getMaxTextureWidth(ctx);\n SYSTEM.mouseWheelEvent = getMouseWheelEvent();\n SYSTEM.fullscreenEvent = getFullscreenEvent();\n }\n};\n\nlet maxCanvasWidth = null;\nSYSTEM.getMaxCanvasWidth = () => {\n if (maxCanvasWidth === null) {\n maxCanvasWidth = getMaxCanvasWidth(SYSTEM.maxTextureWidth);\n }\n return maxCanvasWidth;\n};\n\n/**\n * @summary Tries to return a canvas webgl context\n * @returns {WebGLRenderingContext}\n * @private\n */\nfunction getWebGLCtx() {\n const canvas = document.createElement('canvas');\n const names = ['webgl', 'experimental-webgl', 'moz-webgl', 'webkit-3d'];\n let context = null;\n\n if (!canvas.getContext) {\n return null;\n }\n\n if (names.some((name) => {\n try {\n context = canvas.getContext(name);\n return context !== null;\n }\n catch (e) {\n return false;\n }\n })) {\n return context;\n }\n else {\n return null;\n }\n}\n\n/**\n * @summary Detects if the user is using a touch screen\n * @returns {{initial: boolean, promise: Promise}}\n * @private\n */\nfunction isTouchEnabled() {\n let initial = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);\n if (LOCALSTORAGE_TOUCH_SUPPORT in localStorage) {\n initial = localStorage[LOCALSTORAGE_TOUCH_SUPPORT] === 'true';\n }\n\n const promise = new Promise((resolve) => {\n let clear;\n\n const listenerMouse = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = false;\n resolve(false);\n };\n\n const listenerTouch = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = true;\n resolve(true);\n };\n\n const listenerTimeout = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = initial;\n resolve(initial);\n };\n\n clear = () => {\n window.removeEventListener('mousedown', listenerMouse);\n window.removeEventListener('touchstart', listenerTouch);\n };\n\n window.addEventListener('mousedown', listenerMouse, false);\n window.addEventListener('touchstart', listenerTouch, false);\n setTimeout(listenerTimeout, 10000);\n });\n\n return { initial, promise };\n}\n\n/**\n * @summary Gets max texture width in WebGL context\n * @returns {number}\n * @private\n */\nfunction getMaxTextureWidth(ctx) {\n if (ctx !== null) {\n return ctx.getParameter(ctx.MAX_TEXTURE_SIZE);\n }\n else {\n return 0;\n }\n}\n\n/**\n * @summary Gets max canvas width supported by the browser.\n * We only test powers of 2 and height = width / 2 because that's what we need to generate WebGL textures\n * @param maxWidth\n * @return {number}\n * @private\n */\nfunction getMaxCanvasWidth(maxWidth) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = maxWidth;\n canvas.height = maxWidth / 2;\n\n while (canvas.width > 1024) {\n ctx.fillStyle = 'white';\n ctx.fillRect(0, 0, 1, 1);\n\n try {\n if (ctx.getImageData(0, 0, 1, 1).data[0] === 255) {\n return canvas.width;\n }\n }\n catch (e) {\n // continue\n }\n\n canvas.width /= 2;\n canvas.height /= 2;\n }\n\n throw new PSVError('Unable to detect system capabilities');\n}\n\n/**\n * @summary Gets the event name for mouse wheel\n * @returns {string}\n * @private\n */\nfunction getMouseWheelEvent() {\n if ('onwheel' in document.createElement('div')) { // Modern browsers support \"wheel\"\n return 'wheel';\n }\n else if (document.onmousewheel !== undefined) { // Webkit and IE support at least \"mousewheel\"\n return 'mousewheel';\n }\n else { // let's assume that remaining browsers are older Firefox\n return 'DOMMouseScroll';\n }\n}\n\n/**\n * @summary Map between fullsceen method and fullscreen event name\n * @type {Object}\n * @readonly\n * @private\n */\nconst FULLSCREEN_EVT_MAP = {\n exitFullscreen : 'fullscreenchange',\n webkitExitFullscreen: 'webkitfullscreenchange',\n mozCancelFullScreen : 'mozfullscreenchange',\n msExitFullscreen : 'MSFullscreenChange',\n};\n\n\n/**\n * @summary Gets the event name for fullscreen\n * @returns {string}\n * @private\n */\nfunction getFullscreenEvent() {\n const validExits = Object.keys(FULLSCREEN_EVT_MAP).filter(exit => exit in document);\n\n if (validExits.length) {\n return FULLSCREEN_EVT_MAP[validExits[0]];\n }\n else {\n return null;\n }\n}\n","/**\n * @summary Toggles a CSS class\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} element\n * @param {string} className\n * @param {boolean} [active] - forced state\n */\nexport function toggleClass(element, className, active) {\n if (active === undefined) {\n element.classList.toggle(className);\n }\n else if (active && !element.classList.contains(className)) {\n element.classList.add(className);\n }\n else if (!active) {\n element.classList.remove(className);\n }\n}\n\n/**\n * @summary Adds one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function addClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, true);\n });\n }\n}\n\n/**\n * @summary Removes one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function removeClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, false);\n });\n }\n}\n\n/**\n * @summary Searches if an element has a particular parent at any level including itself\n * @memberOf PSV.utils\n * @param {HTMLElement} el\n * @param {HTMLElement} parent\n * @returns {boolean}\n */\nexport function hasParent(el, parent) {\n let test = el;\n\n do {\n if (test === parent) {\n return true;\n }\n test = test.parentNode;\n } while (test);\n\n return false;\n}\n\n/**\n * @summary Gets the closest parent (can by itself)\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} el\n * @param {string} selector\n * @returns {HTMLElement}\n */\nexport function getClosest(el, selector) {\n // When el is document or window, the matches does not exist\n if (!el.matches) {\n return null;\n }\n\n let test = el;\n\n do {\n if (test.matches(selector)) {\n return test;\n }\n test = test instanceof SVGElement ? test.parentNode : test.parentElement;\n } while (test);\n\n return null;\n}\n\n/**\n * @summary Gets the position of an element in the viewer without reflow\n * @description Will gives the same result as getBoundingClientRect() as soon as there are no CSS transforms\n * @memberOf PSV.utils\n * @param {HTMLElement} el\n * @return {{left: number, top: number}}\n */\nexport function getPosition(el) {\n let left = 0;\n let top = 0;\n let test = el;\n\n while (test) {\n left += (test.offsetLeft - test.scrollLeft + test.clientLeft);\n top += (test.offsetTop - test.scrollTop + test.clientTop);\n test = test.offsetParent;\n }\n\n return { left, top };\n}\n\n/**\n * @summary Detects if fullscreen is enabled\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @returns {boolean}\n */\nexport function isFullscreenEnabled(elt) {\n return (document.fullscreenElement || document.webkitFullscreenElement) === elt;\n}\n\n/**\n * @summary Enters fullscreen mode\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n */\nexport function requestFullscreen(elt) {\n (elt.requestFullscreen || elt.webkitRequestFullscreen).call(elt);\n}\n\n/**\n * @summary Exits fullscreen mode\n * @memberOf PSV.utils\n */\nexport function exitFullscreen() {\n (document.exitFullscreen || document.webkitExitFullscreen).call(document);\n}\n\n/**\n * @summary Gets an element style\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @param {string} prop\n * @returns {*}\n */\nexport function getStyle(elt, prop) {\n return window.getComputedStyle(elt, null)[prop];\n}\n\n/**\n * @summary Normalize mousewheel values accross browsers\n * @memberOf PSV.utils\n * @description From Facebook's Fixed Data Table\n * {@link https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js}\n * @copyright Facebook\n * @param {WheelEvent} event\n * @returns {{spinX: number, spinY: number, pixelX: number, pixelY: number}}\n */\nexport function normalizeWheel(event) {\n const PIXEL_STEP = 10;\n const LINE_HEIGHT = 40;\n const PAGE_HEIGHT = 800;\n\n let spinX = 0;\n let spinY = 0;\n let pixelX = 0;\n let pixelY = 0;\n\n // Legacy\n if ('detail' in event) {\n spinY = event.detail;\n }\n if ('wheelDelta' in event) {\n spinY = -event.wheelDelta / 120;\n }\n if ('wheelDeltaY' in event) {\n spinY = -event.wheelDeltaY / 120;\n }\n if ('wheelDeltaX' in event) {\n spinX = -event.wheelDeltaX / 120;\n }\n\n // side scrolling on FF with DOMMouseScroll\n if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {\n spinX = spinY;\n spinY = 0;\n }\n\n pixelX = spinX * PIXEL_STEP;\n pixelY = spinY * PIXEL_STEP;\n\n if ('deltaY' in event) {\n pixelY = event.deltaY;\n }\n if ('deltaX' in event) {\n pixelX = event.deltaX;\n }\n\n if ((pixelX || pixelY) && event.deltaMode) {\n // delta in LINE units\n if (event.deltaMode === 1) {\n pixelX *= LINE_HEIGHT;\n pixelY *= LINE_HEIGHT;\n }\n // delta in PAGE units\n else {\n pixelX *= PAGE_HEIGHT;\n pixelY *= PAGE_HEIGHT;\n }\n }\n\n // Fall-back if spin cannot be determined\n if (pixelX && !spinX) {\n spinX = (pixelX < 1) ? -1 : 1;\n }\n if (pixelY && !spinY) {\n spinY = (pixelY < 1) ? -1 : 1;\n }\n\n return { spinX, spinY, pixelX, pixelY };\n}\n","/**\n * @summary Ensures that a number is in a given interval\n * @memberOf PSV.utils\n * @param {number} x\n * @param {number} min\n * @param {number} max\n * @returns {number}\n */\nexport function bound(x, min, max) {\n return Math.max(min, Math.min(max, x));\n}\n\n/**\n * @summary Ensure a value is within 0 and `max`\n * @param {number} value\n * @param {number} max\n * @return {number}\n */\nexport function loop(value, max) {\n let result = value % max;\n\n if (result < 0) {\n result += max;\n }\n\n return result;\n}\n\n/**\n * @summary Checks if a value is an integer\n * @memberOf PSV.utils\n * @param {*} value\n * @returns {boolean}\n */\nexport function isInteger(value) {\n if (Number.isInteger) {\n return Number.isInteger(value);\n }\n return typeof value === 'number' && Number.isFinite(value) && Math.floor(value) === value;\n}\n\n/**\n * @summary Tests if a number is power of two\n * @memberOf PSV.utils\n * @param {number} x\n * @return {boolean}\n */\nexport function isPowerOfTwo(x) {\n return (Math.log(x) / Math.log(2)) % 1 === 0;\n}\n\n/**\n * @summary Computes the sum of an array\n * @memberOf PSV.utils\n * @param {number[]} array\n * @returns {number}\n */\nexport function sum(array) {\n return array.reduce((a, b) => a + b, 0);\n}\n\n/**\n * @summary Computes the distance between two points\n * @memberOf PSV.utils\n * @param {PSV.Point} p1\n * @param {PSV.Point} p2\n * @returns {number}\n */\nexport function distance(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\n/**\n * @summary Compute the shortest offset between two longitudes\n * @memberOf PSV.utils\n * @param {number} from\n * @param {number} to\n * @returns {number}\n */\nexport function getShortestArc(from, to) {\n const tCandidates = [\n 0, // direct\n Math.PI * 2, // clock-wise cross zero\n -Math.PI * 2, // counter-clock-wise cross zero\n ];\n\n return tCandidates.reduce((value, candidate) => {\n const newCandidate = to - from + candidate;\n return Math.abs(newCandidate) < Math.abs(value) ? newCandidate : value;\n }, Infinity);\n}\n\n/**\n * @summary Computes the angle between the current position and a target position\n * @memberOf PSV.utils\n * @param {PSV.Position} position1\n * @param {PSV.Position} position2\n * @returns {number}\n */\nexport function getAngle(position1, position2) {\n return Math.acos(\n Math.cos(position1.latitude)\n * Math.cos(position2.latitude)\n * Math.cos(position1.longitude - position2.longitude)\n + Math.sin(position1.latitude)\n * Math.sin(position2.latitude)\n );\n}\n\n/**\n * @summary Returns the distance between two points on a sphere of radius one\n * {@link http://www.movable-type.co.uk/scripts/latlong.html}\n * @memberOf PSV.utils\n * @param {number[]} p1\n * @param {number[]} p2\n * @returns {number}\n */\nexport function greatArcDistance(p1, p2) {\n const [λ1, φ1] = p1;\n const [λ2, φ2] = p2;\n\n const x = (λ2 - λ1) * Math.cos((φ1 + φ2) / 2);\n const y = (φ2 - φ1);\n return Math.sqrt(x * x + y * y);\n}\n","/**\n * @summary Transforms a string to dash-case {@link https://github.com/shahata/dasherize}\n * @memberOf PSV.utils\n * @param {string} str\n * @returns {string}\n */\nexport function dasherize(str) {\n return str.replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {\n return (i > 0 ? '-' : '') + s.toLowerCase();\n });\n}\n\n/**\n * @summary Returns a function, that, when invoked, will only be triggered at most once during a given window of time.\n * @memberOf PSV.utils\n * @copyright underscore.js - modified by Clément Prévost {@link http://stackoverflow.com/a/27078401}\n * @param {Function} func\n * @param {number} wait\n * @returns {Function}\n */\nexport function throttle(func, wait) {\n /* eslint-disable */\n let self, args, result;\n let timeout;\n let previous = 0;\n const later = function() {\n previous = Date.now();\n timeout = undefined;\n result = func.apply(self, args);\n if (!timeout) {\n self = args = null;\n }\n };\n return function() {\n const now = Date.now();\n if (!previous) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n self = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n previous = now;\n result = func.apply(self, args);\n if (!timeout) {\n self = args = null;\n }\n }\n else if (!timeout) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n /* eslint-enable */\n}\n\n/**\n * @summary Test if an object is a plain object\n * @memberOf PSV.utils\n * @description Test if an object is a plain object, i.e. is constructed\n * by the built-in Object constructor and inherits directly from Object.prototype\n * or null. Some built-in objects pass the test, e.g. Math which is a plain object\n * and some host or exotic objects may pass also.\n * {@link http://stackoverflow.com/a/5878101/1207670}\n * @param {*} obj\n * @returns {boolean}\n */\nexport function isPlainObject(obj) {\n // Basic check for Type object that's not null\n if (typeof obj === 'object' && obj !== null) {\n // If Object.getPrototypeOf supported, use it\n if (typeof Object.getPrototypeOf === 'function') {\n const proto = Object.getPrototypeOf(obj);\n return proto === Object.prototype || proto === null;\n }\n\n // Otherwise, use internal class\n // This should be reliable as if getPrototypeOf not supported, is pre-ES5\n return Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n // Not an object\n return false;\n}\n\n/**\n * @summary Merges the enumerable attributes of two objects\n * @memberOf PSV.utils\n * @description Replaces arrays and alters the target object.\n * @copyright Nicholas Fisher \n * @param {Object} target\n * @param {Object} src\n * @returns {Object} target\n */\nexport function deepmerge(target, src) {\n /* eslint-disable */\n let first = src;\n\n return (function merge(target, src) {\n if (Array.isArray(src)) {\n if (!target || !Array.isArray(target)) {\n target = [];\n }\n else {\n target.length = 0;\n }\n src.forEach(function(e, i) {\n target[i] = merge(null, e);\n });\n }\n else if (typeof src === 'object') {\n if (!target || Array.isArray(target)) {\n target = {};\n }\n Object.keys(src).forEach(function(key) {\n if (typeof src[key] !== 'object' || !src[key] || !isPlainObject(src[key])) {\n target[key] = src[key];\n }\n else if (src[key] != first) {\n if (!target[key]) {\n target[key] = merge(null, src[key]);\n }\n else {\n merge(target[key], src[key]);\n }\n }\n });\n }\n else {\n target = src;\n }\n\n return target;\n }(target, src));\n /* eslint-enable */\n}\n\n/**\n * @summary Deeply clones an object\n * @memberOf PSV.utils\n * @param {Object} src\n * @returns {Object}\n */\nexport function clone(src) {\n return deepmerge(null, src);\n}\n\n/**\n * @summery Test of an object is empty\n * @memberOf PSV.utils\n * @param {object} obj\n * @returns {boolean}\n */\nexport function isEmpty(obj) {\n return !obj || (Object.keys(obj).length === 0 && obj.constructor === Object);\n}\n\n/**\n * @summary Loops over enumerable properties of an object\n * @memberOf PSV.utils\n * @param {Object} object\n * @param {Function} callback\n */\nexport function each(object, callback) {\n Object.keys(object).forEach((key) => {\n callback(object[key], key);\n });\n}\n\n/**\n * @summary Returns if a valu is null or undefined\n * @memberOf PSV.utils\n * @param {*} val\n * @return {boolean}\n */\nexport function isNil(val) {\n return val === null || val === undefined;\n}\n\n/**\n * @summary Returns the first non null non undefined parameter\n * @memberOf PSV.utils\n * @param {*} values\n * @return {*}\n */\nexport function firstNonNull(...values) {\n for (const val of values) {\n if (!isNil(val)) {\n return val;\n }\n }\n\n return undefined;\n}\n","import * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound, loop } from './math';\n\n/**\n * @summary Returns the plugin constructor from the imported object\n * For retrocompatibility with previous default exports\n * @memberOf PSV.utils\n * @package\n */\nexport function pluginInterop(plugin, target) {\n if (plugin) {\n for (const [, p] of [['_', plugin], ...Object.entries(plugin)]) {\n if (p.prototype instanceof target) {\n return p;\n }\n }\n }\n return null;\n}\n\n/**\n * @summary Builds an Error with name 'AbortError'\n * @memberOf PSV.utils\n * @return {Error}\n */\nexport function getAbortError() {\n const error = new Error('Loading was aborted.');\n error.name = 'AbortError';\n return error;\n}\n\n/**\n * @summary Tests if an Error has name 'AbortError'\n * @memberOf PSV.utils\n * @param {Error} err\n * @return {boolean}\n */\nexport function isAbortError(err) {\n return err?.name === 'AbortError';\n}\n\n/**\n * @summary Displays a warning in the console\n * @memberOf PSV.utils\n * @param {string} message\n */\nexport function logWarn(message) {\n console.warn(`PhotoSphereViewer: ${message}`);\n}\n\n/**\n * @summary Checks if an object is a {PSV.ExtendedPosition}, ie has x/y or longitude/latitude\n * @memberOf PSV.utils\n * @param {object} object\n * @returns {boolean}\n */\nexport function isExtendedPosition(object) {\n return [['x', 'y'], ['longitude', 'latitude']].some(([key1, key2]) => {\n return object[key1] !== undefined && object[key2] !== undefined;\n });\n}\n\n/**\n * @summary Returns the value of a given attribute in the panorama metadata\n * @memberOf PSV.utils\n * @param {string} data\n * @param {string} attr\n * @returns (number)\n */\nexport function getXMPValue(data, attr) {\n // XMP data are stored in children\n let result = data.match('(.*)');\n if (result !== null) {\n const val = parseInt(result[1], 10);\n return isNaN(val) ? null : val;\n }\n\n // XMP data are stored in attributes\n result = data.match('GPano:' + attr + '=\"(.*?)\"');\n if (result !== null) {\n const val = parseInt(result[1], 10);\n return isNaN(val) ? null : val;\n }\n\n return null;\n}\n\n/**\n * @readonly\n * @private\n * @type {{top: string, left: string, bottom: string, center: string, right: string}}\n */\nconst CSS_POSITIONS = {\n top : '0%',\n bottom: '100%',\n left : '0%',\n right : '100%',\n center: '50%',\n};\n\n/**\n * @summary Translate CSS values like \"top center\" or \"10% 50%\" as top and left positions\n * @memberOf PSV.utils\n * @description The implementation is as close as possible to the \"background-position\" specification\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}\n * @param {string|PSV.Point} value\n * @returns {PSV.Point}\n */\nexport function parsePosition(value) {\n if (!value) {\n return { x: 0.5, y: 0.5 };\n }\n\n if (typeof value === 'object') {\n return value;\n }\n\n let tokens = value.toLocaleLowerCase().split(' ').slice(0, 2);\n\n if (tokens.length === 1) {\n if (CSS_POSITIONS[tokens[0]] !== undefined) {\n tokens = [tokens[0], 'center'];\n }\n else {\n tokens = [tokens[0], tokens[0]];\n }\n }\n\n const xFirst = tokens[1] !== 'left' && tokens[1] !== 'right' && tokens[0] !== 'top' && tokens[0] !== 'bottom';\n\n tokens = tokens.map(token => CSS_POSITIONS[token] || token);\n\n if (!xFirst) {\n tokens.reverse();\n }\n\n const parsed = tokens.join(' ').match(/^([0-9.]+)% ([0-9.]+)%$/);\n\n if (parsed) {\n return {\n x: parseFloat(parsed[1]) / 100,\n y: parseFloat(parsed[2]) / 100,\n };\n }\n else {\n return { x: 0.5, y: 0.5 };\n }\n}\n\n/**\n * @readonly\n * @private\n */\nconst LEFT_MAP = { 0: 'left', 0.5: 'center', 1: 'right' };\n/**\n * @readonly\n * @private\n */\nconst TOP_MAP = { 0: 'top', 0.5: 'center', 1: 'bottom' };\n\n/**\n * @summary Parse a CSS-like position into an array of position keywords among top, bottom, left, right and center\n * @memberOf PSV.utils\n * @param {string | string[]} value\n * @param {string} defaultValue\n * @param {boolean} [allowCenter=true]\n * @return {string[]}\n */\nexport function cleanPosition(value, defaultValue, allowCenter = true) {\n if (!value) {\n return defaultValue.split(' ');\n }\n\n if (typeof value === 'string') {\n const tempPos = parsePosition(value);\n\n if (!(tempPos.x in LEFT_MAP) || !(tempPos.y in TOP_MAP)) {\n throw new PSVError(`Unable to parse position \"${value}\"`);\n }\n\n value = [TOP_MAP[tempPos.y], LEFT_MAP[tempPos.x]];\n }\n\n if (!allowCenter && value[0] === 'center' && value[1] === 'center') {\n throw new PSVError('Unable to parse position \"center center\"');\n }\n\n return value;\n}\n\n/**\n * @summary Parses an speed\n * @memberOf PSV.utils\n * @param {string|number} speed - The speed, in radians/degrees/revolutions per second/minute\n * @returns {number} radians per second\n * @throws {PSV.PSVError} when the speed cannot be parsed\n */\nexport function parseSpeed(speed) {\n let parsed;\n\n if (typeof speed === 'string') {\n const speedStr = speed.toString().trim();\n\n // Speed extraction\n let speedValue = parseFloat(speedStr.replace(/^(-?[0-9]+(?:\\.[0-9]*)?).*$/, '$1'));\n const speedUnit = speedStr.replace(/^-?[0-9]+(?:\\.[0-9]*)?(.*)$/, '$1').trim();\n\n // \"per minute\" -> \"per second\"\n if (speedUnit.match(/(pm|per minute)$/)) {\n speedValue /= 60;\n }\n\n // Which unit?\n switch (speedUnit) {\n // Degrees per minute / second\n case 'dpm':\n case 'degrees per minute':\n case 'dps':\n case 'degrees per second':\n parsed = THREE.MathUtils.degToRad(speedValue);\n break;\n\n // Radians per minute / second\n case 'rdpm':\n case 'radians per minute':\n case 'rdps':\n case 'radians per second':\n parsed = speedValue;\n break;\n\n // Revolutions per minute / second\n case 'rpm':\n case 'revolutions per minute':\n case 'rps':\n case 'revolutions per second':\n parsed = speedValue * Math.PI * 2;\n break;\n\n // Unknown unit\n default:\n throw new PSVError('Unknown speed unit \"' + speedUnit + '\"');\n }\n }\n else {\n parsed = speed;\n }\n\n return parsed;\n}\n\n/**\n * @summary Parses an angle value in radians or degrees and returns a normalized value in radians\n * @memberOf PSV.utils\n * @param {string|number} angle - eg: 3.14, 3.14rad, 180deg\n * @param {boolean} [zeroCenter=false] - normalize between -Pi - Pi instead of 0 - 2*Pi\n * @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi/2 - Pi/2 instead of -Pi - Pi\n * @returns {number}\n * @throws {PSV.PSVError} when the angle cannot be parsed\n */\nexport function parseAngle(angle, zeroCenter = false, halfCircle = zeroCenter) {\n let parsed;\n\n if (typeof angle === 'string') {\n const match = angle.toLowerCase().trim().match(/^(-?[0-9]+(?:\\.[0-9]*)?)(.*)$/);\n\n if (!match) {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n const value = parseFloat(match[1]);\n const unit = match[2];\n\n if (unit) {\n switch (unit) {\n case 'deg':\n case 'degs':\n parsed = THREE.MathUtils.degToRad(value);\n break;\n case 'rad':\n case 'rads':\n parsed = value;\n break;\n default:\n throw new PSVError('Unknown angle unit \"' + unit + '\"');\n }\n }\n else {\n parsed = value;\n }\n }\n else if (typeof angle === 'number' && !isNaN(angle)) {\n parsed = angle;\n }\n else {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n parsed = loop(zeroCenter ? parsed + Math.PI : parsed, Math.PI * 2);\n\n return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed;\n}\n\n/**\n * @summary Creates a THREE texture from an image\n * @memberOf PSV.utils\n * @param {HTMLImageElement | HTMLCanvasElement} img\n * @return {external:THREE.Texture}\n */\nexport function createTexture(img) {\n const texture = new THREE.Texture(img);\n texture.needsUpdate = true;\n texture.minFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n return texture;\n}\n\nconst quaternion = new THREE.Quaternion();\n\n/**\n * @summary Applies the inverse of Euler angles to a vector\n * @memberOf PSV.utils\n * @param {external:THREE.Vector3} vector\n * @param {external:THREE.Euler} euler\n */\nexport function applyEulerInverse(vector, euler) {\n quaternion.setFromEuler(euler).invert();\n vector.applyQuaternion(quaternion);\n}\n","import { EASINGS } from '../data/constants';\nimport { each } from './misc';\nimport { logWarn } from './psv';\n\n/**\n * @callback OnTick\n * @summary Function called for each animation frame with computed properties\n * @memberOf PSV.utils.Animation\n * @param {Object.} properties - current values\n * @param {float} progress - 0 to 1\n */\n\n/**\n * @summary Interpolation helper for animations\n * @memberOf PSV.utils\n * @description\n * Implements the Promise API with an additional \"cancel\" method.\n * The promise is resolved with `true` when the animation is completed and `false` if the animation is cancelled.\n * @example\n * const anim = new Animation({\n * properties: {\n * width: {start: 100, end: 200}\n * },\n * duration: 5000,\n * onTick: (properties) => element.style.width = `${properties.width}px`;\n * });\n *\n * anim.then((completed) => ...);\n *\n * anim.cancel()\n */\nexport class Animation {\n\n /**\n * @param {Object} options\n * @param {Object.} options.properties\n * @param {number} options.properties[].start\n * @param {number} options.properties[].end\n * @param {number} options.duration\n * @param {number} [options.delay=0]\n * @param {string} [options.easing='linear']\n * @param {PSV.utils.Animation.OnTick} options.onTick - called on each frame\n */\n constructor(options) {\n this.__callbacks = [];\n\n if (options) {\n if (!options.easing || typeof options.easing === 'string') {\n options.easing = EASINGS[options.easing || 'linear'];\n }\n\n this.__start = null;\n this.options = options;\n\n if (options.delay) {\n this.__delayTimeout = setTimeout(() => {\n this.__delayTimeout = null;\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }, options.delay);\n }\n else {\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }\n }\n else {\n this.__resolved = true;\n }\n }\n\n /**\n * @summary Main loop for the animation\n * @param {number} timestamp\n * @private\n */\n __run(timestamp) {\n // first iteration\n if (this.__start === null) {\n this.__start = timestamp;\n }\n\n // compute progress\n const progress = (timestamp - this.__start) / this.options.duration;\n const current = {};\n\n if (progress < 1.0) {\n // interpolate properties\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.start + (prop.end - prop.start) * this.options.easing(progress);\n }\n });\n this.options.onTick(current, progress);\n\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }\n else {\n // call onTick one last time with final values\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.end;\n }\n });\n this.options.onTick(current, 1.0);\n\n this.__animationFrame = window.requestAnimationFrame(() => {\n this.__resolved = true;\n this.__resolve(true);\n });\n }\n }\n\n /**\n * @private\n */\n __resolve(value) {\n this.__callbacks.forEach(cb => cb(value));\n this.__callbacks.length = 0;\n }\n\n /**\n * @summary Promise chaining\n * @param {Function} [onFulfilled] - Called when the animation is complete (true) or cancelled (false)\n * @param {Function} [onRejected] - deprecated\n * @returns {Promise}\n */\n then(onFulfilled = null, onRejected = null) {\n if (onRejected) {\n logWarn('Animation#then does not accept a rejection handler anymore');\n }\n\n if (this.__resolved || this.__cancelled) {\n return Promise.resolve(this.__resolved)\n .then(onFulfilled);\n }\n\n return new Promise((resolve) => {\n this.__callbacks.push(resolve);\n })\n .then(onFulfilled);\n }\n\n /**\n * @summary Cancels the animation\n */\n cancel() {\n if (!this.__cancelled && !this.__resolved) {\n this.__cancelled = true;\n this.__resolve(false);\n\n if (this.__delayTimeout) {\n window.clearTimeout(this.__delayTimeout);\n this.__delayTimeout = null;\n }\n if (this.__animationFrame) {\n window.cancelAnimationFrame(this.__animationFrame);\n this.__animationFrame = null;\n }\n }\n }\n\n /**\n * @deprecated not supported anymore\n */\n catch() {\n logWarn('Animation#catch is not supported anymore');\n return this.then();\n }\n\n /**\n * @deprecated not supported anymore\n */\n finally(onFinally) {\n logWarn('Animation#finally is not supported anymore');\n return this.then(onFinally);\n }\n\n /**\n * @deprecated not supported anymore\n */\n static resolve() {\n logWarn('Animation.resolve is not supported anymore');\n }\n\n}\n","import { PSVError } from '../PSVError';\nimport { bound, loop } from './index';\n\n/**\n * @summary Represents a variable that can dynamically change with time (using requestAnimationFrame)\n * @memberOf PSV.utils\n */\nexport class Dynamic {\n\n static STOP = 0;\n static INFINITE = 1;\n static POSITION = 2;\n\n /**\n * @param {Function} [fn] Callback function\n * @param {number} [defaultValue] Default position\n * @param {number} [min] Minimum position\n * @param {number} [max] Maximum position\n * @param {boolean} [loopValue] Loop value between min and max\n */\n constructor(fn, defaultValue = 0, min = -Infinity, max = Infinity, loopValue = false) {\n /**\n * @type {Function}\n * @private\n * @readonly\n */\n this.fn = fn;\n\n /**\n * @type {number}\n * @private\n */\n this.mode = Dynamic.STOP;\n\n /**\n * @type {number}\n * @private\n */\n this.speed = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.speedMult = 1;\n\n /**\n * @type {number}\n * @private\n */\n this.currentSpeed = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.target = 0;\n\n /**\n * @type {number}\n * @readonly\n */\n this.current = defaultValue;\n\n /**\n * @type {number}\n * @private\n */\n this.min = min;\n\n /**\n * @type {number}\n * @private\n */\n this.max = max;\n\n /**\n * @type {boolean}\n * @private\n */\n this.loopValue = loopValue;\n\n if (loopValue && min !== 0) {\n throw new PSVError('invalid config');\n }\n\n if (this.fn) {\n this.fn(defaultValue);\n }\n }\n\n /**\n * Changes base speed\n * @param {number} speed\n */\n setSpeed(speed) {\n this.speed = speed;\n }\n\n /**\n * Defines the target position\n * @param {number} position\n * @param {number} [speedMult=1]\n */\n goto(position, speedMult = 1) {\n this.mode = Dynamic.POSITION;\n this.target = this.loopValue ? loop(position, this.max) : bound(position, this.min, this.max);\n this.speedMult = speedMult;\n }\n\n /**\n * Increase/decrease the target position\n * @param {number} step\n * @param {number} [speedMult=1]\n */\n step(step, speedMult = 1) {\n if (this.mode !== Dynamic.POSITION) {\n this.target = this.current;\n }\n this.goto(this.target + step, speedMult);\n }\n\n /**\n * Starts infinite movement\n * @param {boolean} [invert=false]\n * @param {number} [speedMult=1]\n */\n roll(invert = false, speedMult = 1) {\n this.mode = Dynamic.INFINITE;\n this.target = invert ? -Infinity : Infinity;\n this.speedMult = speedMult;\n }\n\n /**\n * Stops movement\n */\n stop() {\n this.mode = Dynamic.STOP;\n }\n\n /**\n * Defines the current position and immediately stops movement\n * @param {number} value\n */\n setValue(value) {\n this.target = this.loopValue ? loop(value, this.max) : bound(value, this.min, this.max);\n this.mode = Dynamic.STOP;\n if (this.target !== this.current) {\n this.current = this.target;\n if (this.fn) {\n this.fn(this.current);\n }\n return true;\n }\n return false;\n }\n\n /**\n * @package\n */\n update(elapsed) {\n // in position mode switch to stop mode when in the decceleration window\n if (this.mode === Dynamic.POSITION) {\n // in loop mode, alter \"current\" to avoid crossing the origin\n if (this.loopValue && Math.abs(this.target - this.current) > this.max / 2) {\n this.current = this.current < this.target ? this.current + this.max : this.current - this.max;\n }\n\n const dstStop = this.currentSpeed * this.currentSpeed / (this.speed * this.speedMult * 4);\n if (Math.abs(this.target - this.current) <= dstStop) {\n this.mode = Dynamic.STOP;\n }\n }\n\n // compute speed\n let targetSpeed = this.mode === Dynamic.STOP ? 0 : this.speed * this.speedMult;\n if (this.target < this.current) {\n targetSpeed = -targetSpeed;\n }\n if (this.currentSpeed < targetSpeed) {\n this.currentSpeed = Math.min(targetSpeed, this.currentSpeed + elapsed / 1000 * this.speed * this.speedMult * 2);\n }\n else if (this.currentSpeed > targetSpeed) {\n this.currentSpeed = Math.max(targetSpeed, this.currentSpeed - elapsed / 1000 * this.speed * this.speedMult * 2);\n }\n\n // compute new position\n let next = null;\n if (this.current > this.target && this.currentSpeed) {\n next = Math.max(this.target, this.current + this.currentSpeed * elapsed / 1000);\n }\n else if (this.current < this.target && this.currentSpeed) {\n next = Math.min(this.target, this.current + this.currentSpeed * elapsed / 1000);\n }\n\n // apply value\n if (next !== null) {\n next = this.loopValue ? loop(next, this.max) : bound(next, this.min, this.max);\n if (next !== this.current) {\n this.current = next;\n if (this.fn) {\n this.fn(this.current);\n }\n return true;\n }\n }\n\n return false;\n }\n\n}\n","import { each } from './index';\n\n/**\n * @summary Wrapper for multiple {@link PSV.utils.Dynamic} evolving together\n * @memberOf PSV.utils\n */\nexport class MultiDynamic {\n\n /**\n * @type {Object}\n * @readonly\n */\n get current() {\n const values = {};\n each(this.dynamics, (dynamic, name) => {\n values[name] = dynamic.current;\n });\n return values;\n }\n\n /**\n * @param {Record} dynamics\n * @param {Function} [fn] Callback function\n */\n constructor(dynamics, fn) {\n /**\n * @type {Function}\n * @private\n * @readonly\n */\n this.fn = fn;\n\n /**\n * @type {Record}\n * @private\n * @readonly\n */\n this.dynamics = dynamics;\n\n if (this.fn) {\n this.fn(this.current);\n }\n }\n\n /**\n * Changes base speed\n * @param {number} speed\n */\n setSpeed(speed) {\n each(this.dynamics, (d) => {\n d.setSpeed(speed);\n });\n }\n\n /**\n * Defines the target positions\n * @param {Record} positions\n * @param {number} [speedMult=1]\n */\n goto(positions, speedMult = 1) {\n each(positions, (position, name) => {\n this.dynamics[name].goto(position, speedMult);\n });\n }\n\n /**\n * Increase/decrease the target positions\n * @param {Record} steps\n * @param {number} [speedMult=1]\n */\n step(steps, speedMult = 1) {\n each(steps, (step, name) => {\n this.dynamics[name].step(step, speedMult);\n });\n }\n\n /**\n * Starts infinite movements\n * @param {Record} rolls\n * @param {number} [speedMult=1]\n */\n roll(rolls, speedMult = 1) {\n each(rolls, (roll, name) => {\n this.dynamics[name].roll(roll, speedMult);\n });\n }\n\n /**\n * Stops movements\n */\n stop() {\n each(this.dynamics, d => d.stop());\n }\n\n /**\n * Defines the current positions and immediately stops movements\n * @param {Record} values\n */\n setValue(values) {\n let hasUpdates = false;\n each(values, (value, name) => {\n hasUpdates |= this.dynamics[name].setValue(value);\n });\n\n if (hasUpdates && this.fn) {\n this.fn(this.current);\n }\n\n return hasUpdates;\n }\n\n /**\n * @package\n */\n update(elapsed) {\n let hasUpdates = false;\n each(this.dynamics, (dynamic) => {\n hasUpdates |= dynamic.update(elapsed);\n });\n\n if (hasUpdates && this.fn) {\n this.fn(this.current);\n }\n\n return hasUpdates;\n }\n\n}\n","import { EventEmitter } from 'uevent';\n\n/**\n * @summary Helper to make sliders elements\n * @memberOf PSV.utils\n */\nexport class Slider extends EventEmitter {\n\n static VERTICAL = 1;\n static HORIZONTAL = 2;\n\n /**\n * @type {boolean}\n * @readonly\n */\n get vertical() {\n return this.prop.direction === Slider.VERTICAL;\n }\n\n constructor({ psv, container, direction, onUpdate }) {\n super();\n\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = container;\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} mousedown\n * @property {number} mediaMinWidth\n */\n this.prop = {\n onUpdate : onUpdate,\n direction: direction,\n mousedown: false,\n mouseover: false,\n };\n\n this.container.addEventListener('click', this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mouseenter', this);\n this.container.addEventListener('mouseleave', this);\n this.container.addEventListener('touchstart', this);\n this.container.addEventListener('mousemove', this, true);\n this.container.addEventListener('touchmove', this, true);\n window.addEventListener('mouseup', this);\n window.addEventListener('touchend', this);\n }\n\n /**\n * @protected\n */\n destroy() {\n window.removeEventListener('mouseup', this);\n window.removeEventListener('touchend', this);\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'click': e.stopPropagation(); break;\n case 'mousedown': this.__onMouseDown(e); break;\n case 'mouseenter': this.__onMouseEnter(e); break;\n case 'mouseleave': this.__onMouseLeave(e); break;\n case 'touchstart': this.__onTouchStart(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'touchmove': this.__onTouchMove(e); break;\n case 'mouseup': this.__onMouseUp(e); break;\n case 'touchend': this.__onTouchEnd(e); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @private\n */\n __onMouseDown(evt) {\n this.prop.mousedown = true;\n this.__update(evt, true);\n }\n\n /**\n * @private\n */\n __onMouseEnter(evt) {\n this.prop.mouseover = true;\n this.__update(evt, true);\n }\n\n /**\n * @private\n */\n __onTouchStart(evt) {\n this.prop.mouseover = true;\n this.prop.mousedown = true;\n this.__update(evt.changedTouches[0], true);\n }\n\n /**\n * @private\n */\n __onMouseMove(evt) {\n if (this.prop.mousedown || this.prop.mouseover) {\n evt.stopPropagation();\n this.__update(evt, true);\n }\n }\n\n /**\n * @private\n */\n __onTouchMove(evt) {\n if (this.prop.mousedown || this.prop.mouseover) {\n evt.stopPropagation();\n this.__update(evt.changedTouches[0], true);\n }\n }\n\n /**\n * @private\n */\n __onMouseUp(evt) {\n if (this.prop.mousedown) {\n this.prop.mousedown = false;\n this.__update(evt, false);\n }\n }\n\n /**\n * @private\n */\n __onMouseLeave(evt) {\n if (this.prop.mouseover) {\n this.prop.mouseover = false;\n this.__update(evt, true);\n }\n }\n\n /**\n * @private\n */\n __onTouchEnd(evt) {\n if (this.prop.mousedown) {\n this.prop.mouseover = false;\n this.prop.mousedown = false;\n this.__update(evt.changedTouches[0], false);\n }\n }\n\n /**\n * @private\n */\n __update(evt, moving) {\n const boundingClientRect = this.container.getBoundingClientRect();\n const cursor = evt[this.vertical ? 'clientY' : 'clientX'];\n const pos = boundingClientRect[this.vertical ? 'bottom' : 'left'];\n const size = boundingClientRect[this.vertical ? 'height' : 'width'];\n const val = Math.abs((pos - cursor) / size);\n\n this.prop.onUpdate({\n value : val,\n click : !moving,\n mousedown: this.prop.mousedown,\n mouseover: this.prop.mouseover,\n cursor : evt,\n });\n }\n\n}\n","/**\n * @namespace PSV.utils\n */\n\nexport * from './browser';\nexport * from './math';\nexport * from './misc';\nexport * from './psv';\n\nexport * from './Animation';\nexport * from './Dynamic';\nexport * from './MultiDynamic';\nexport * from './Slider';\n","import * as THREE from 'three';\nimport { SPHERE_RADIUS } from '../../data/constants';\nimport { SYSTEM } from '../../data/system';\nimport { PSVError } from '../../PSVError';\nimport { createTexture, firstNonNull, getXMPValue, isPowerOfTwo, logWarn } from '../../utils';\nimport { AbstractAdapter } from '../AbstractAdapter';\n\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n */\n\n\n/**\n * @summary Adapter for equirectangular panoramas\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularAdapter extends AbstractAdapter {\n\n static id = 'equirectangular';\n static supportsDownload = true;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.EquirectangularAdapter.Options}\n * @private\n */\n this.config = {\n resolution: 64,\n ...options,\n };\n\n if (!isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n }\n\n /**\n * @override\n */\n supportsTransition() {\n return true;\n }\n\n /**\n * @override\n */\n supportsPreload() {\n return true;\n }\n\n /**\n * @override\n * @param {string} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n */\n loadTexture(panorama, newPanoData) {\n if (typeof panorama !== 'string') {\n if (Array.isArray(panorama) || typeof panorama === 'object' && !!panorama.left) {\n logWarn('Cubemap support now requires an additional adapter, see https://photo-sphere-viewer.js.org/guide/adapters');\n }\n return Promise.reject(new PSVError('Invalid panorama url, are you using the right adapter?'));\n }\n\n return (\n !this.psv.config.useXmpData\n ? this.psv.textureLoader.loadImage(panorama, p => this.psv.loader.setProgress(p))\n .then(img => ({ img: img, xmpPanoData: null }))\n : this.__loadXMP(panorama, p => this.psv.loader.setProgress(p))\n .then(xmpPanoData => this.psv.textureLoader.loadImage(panorama).then(img => ({ img, xmpPanoData })))\n )\n .then(({ img, xmpPanoData }) => {\n if (typeof newPanoData === 'function') {\n newPanoData = newPanoData(img);\n }\n\n const panoData = {\n fullWidth : firstNonNull(newPanoData?.fullWidth, xmpPanoData?.fullWidth, img.width),\n fullHeight : firstNonNull(newPanoData?.fullHeight, xmpPanoData?.fullHeight, img.height),\n croppedWidth : firstNonNull(newPanoData?.croppedWidth, xmpPanoData?.croppedWidth, img.width),\n croppedHeight: firstNonNull(newPanoData?.croppedHeight, xmpPanoData?.croppedHeight, img.height),\n croppedX : firstNonNull(newPanoData?.croppedX, xmpPanoData?.croppedX, 0),\n croppedY : firstNonNull(newPanoData?.croppedY, xmpPanoData?.croppedY, 0),\n poseHeading : firstNonNull(newPanoData?.poseHeading, xmpPanoData?.poseHeading, 0),\n posePitch : firstNonNull(newPanoData?.posePitch, xmpPanoData?.posePitch, 0),\n poseRoll : firstNonNull(newPanoData?.poseRoll, xmpPanoData?.poseRoll, 0),\n };\n\n if (panoData.croppedWidth !== img.width || panoData.croppedHeight !== img.height) {\n logWarn(`Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image.\n panoData: ${panoData.croppedWidth}x${panoData.croppedHeight}, image: ${img.width}x${img.height}`);\n }\n if ((newPanoData || xmpPanoData) && panoData.fullWidth !== panoData.fullHeight * 2) {\n logWarn('Invalid panoData, fullWidth should be twice fullHeight');\n }\n\n const texture = this.__createEquirectangularTexture(img, panoData);\n\n return { panorama, texture, panoData };\n });\n }\n\n /**\n * @summary Loads the XMP data of an image\n * @param {string} panorama\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @private\n */\n __loadXMP(panorama, onProgress) {\n return this.psv.textureLoader.loadFile(panorama, onProgress)\n .then(blob => this.__loadBlobAsString(blob))\n .then((binary) => {\n const a = binary.indexOf('');\n const data = binary.substring(a, b);\n\n if (a !== -1 && b !== -1 && data.includes('GPano:')) {\n return {\n fullWidth : getXMPValue(data, 'FullPanoWidthPixels'),\n fullHeight : getXMPValue(data, 'FullPanoHeightPixels'),\n croppedWidth : getXMPValue(data, 'CroppedAreaImageWidthPixels'),\n croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'),\n croppedX : getXMPValue(data, 'CroppedAreaLeftPixels'),\n croppedY : getXMPValue(data, 'CroppedAreaTopPixels'),\n poseHeading : getXMPValue(data, 'PoseHeadingDegrees'),\n posePitch : getXMPValue(data, 'PosePitchDegrees'),\n poseRoll : getXMPValue(data, 'PoseRollDegrees'),\n };\n }\n\n return null;\n });\n }\n\n /**\n * @summmary read a Blob as string\n * @param {Blob} blob\n * @returns {Promise}\n * @private\n */\n __loadBlobAsString(blob) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result);\n reader.onerror = reject;\n reader.readAsText(blob);\n });\n }\n\n /**\n * @summary Creates the final texture from image and panorama data\n * @param {Image} img\n * @param {PSV.PanoData} panoData\n * @returns {external:THREE.Texture}\n * @private\n */\n __createEquirectangularTexture(img, panoData) {\n // resize image / fill cropped parts with black\n if (panoData.fullWidth > SYSTEM.maxTextureWidth\n || panoData.croppedWidth !== panoData.fullWidth\n || panoData.croppedHeight !== panoData.fullHeight\n ) {\n const ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth;\n\n const resizedPanoData = { ...panoData };\n if (ratio < 1) {\n resizedPanoData.fullWidth *= ratio;\n resizedPanoData.fullHeight *= ratio;\n resizedPanoData.croppedWidth *= ratio;\n resizedPanoData.croppedHeight *= ratio;\n resizedPanoData.croppedX *= ratio;\n resizedPanoData.croppedY *= ratio;\n }\n\n const buffer = document.createElement('canvas');\n buffer.width = resizedPanoData.fullWidth;\n buffer.height = resizedPanoData.fullHeight;\n\n const ctx = buffer.getContext('2d');\n ctx.drawImage(img,\n resizedPanoData.croppedX, resizedPanoData.croppedY,\n resizedPanoData.croppedWidth, resizedPanoData.croppedHeight);\n\n return createTexture(buffer);\n }\n\n return createTexture(img);\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n // The middle of the panorama is placed at longitude=0\n const geometry = new THREE.SphereGeometry(\n SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1);\n\n const material = new THREE.MeshBasicMaterial();\n\n return new THREE.Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n mesh.material.map?.dispose();\n mesh.material.map = textureData.texture;\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material.opacity = opacity;\n mesh.material.transparent = opacity < 1;\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n textureData.texture?.dispose();\n }\n\n}\n","/**\n * @namespace PSV.components\n */\n\n/**\n * @summary Base component class\n * @memberof PSV.components\n * @abstract\n */\nexport class AbstractComponent {\n\n /**\n * @param {PSV.Viewer | PSV.components.AbstractComponent} parent\n * @param {string} className - CSS class added to the component's container\n */\n constructor(parent, className) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = parent.psv || parent;\n\n /**\n * @member {PSV.Viewer|PSV.components.AbstractComponent}\n * @readonly\n */\n this.parent = parent;\n this.parent.children.push(this);\n\n /**\n * @summary All child components\n * @type {PSV.components.AbstractComponent[]}\n * @readonly\n * @package\n */\n this.children = [];\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} visible - Visibility of the component\n */\n this.prop = {\n visible: true,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.className = className;\n this.parent.container.appendChild(this.container);\n }\n\n /**\n * @summary Destroys the component\n * @protected\n */\n destroy() {\n this.parent.container.removeChild(this.container);\n\n const childIdx = this.parent.children.indexOf(this);\n if (childIdx !== -1) {\n this.parent.children.splice(childIdx, 1);\n }\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n delete this.container;\n delete this.parent;\n delete this.psv;\n delete this.prop;\n }\n\n /**\n * @summary Refresh UI\n * @description Must be be a very lightweight operation\n * @package\n */\n refreshUi() {\n this.children.every((child) => {\n child.refreshUi();\n return this.psv.prop.uiRefresh === true;\n });\n }\n\n /**\n * @summary Displays or hides the component\n */\n toggle() {\n if (this.isVisible()) {\n this.hide();\n }\n else {\n this.show();\n }\n }\n\n /**\n * @summary Hides the component\n */\n hide() {\n this.container.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @summary Displays the component\n */\n show() {\n this.container.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @summary Checks if the component is visible\n * @returns {boolean}\n */\n isVisible() {\n return this.prop.visible;\n }\n\n}\n","import { AbstractComponent } from '../components/AbstractComponent';\nimport { KEY_CODES } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { isPlainObject, toggleClass } from '../utils';\n\n/**\n * @namespace PSV.buttons\n */\n\n/**\n * @summary Base navbar button class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.buttons\n * @abstract\n */\nexport class AbstractButton extends AbstractComponent {\n\n /**\n * @summary Unique identifier of the button\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @summary Identifier to declare a group of buttons\n * @member {string}\n * @readonly\n * @static\n */\n static groupId = null;\n\n /**\n * @summary SVG icon name injected in the button\n * @member {string}\n * @readonly\n * @static\n */\n static icon = null;\n\n /**\n * @summary SVG icon name injected in the button when it is active\n * @member {string}\n * @readonly\n * @static\n */\n static iconActive = null;\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} [className] - Additional CSS classes\n * @param {boolean} [collapsable=false] - `true` if the button can be moved to menu when the navbar is too small\n * @param {boolean} [tabbable=true] - `true` if the button is accessible with the keyboard\n */\n constructor(navbar, className = '', collapsable = false, tabbable = true) {\n super(navbar, 'psv-button ' + className);\n\n /**\n * @override\n * @property {string} id - Unique identifier of the button\n * @property {boolean} enabled\n * @property {boolean} supported\n * @property {boolean} collapsed\n * @property {boolean} active\n * @property {number} width\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable: collapsable,\n enabled : true,\n supported : true,\n collapsed : false,\n active : false,\n width : this.container.offsetWidth,\n };\n\n if (this.constructor.icon) {\n this.__setIcon(this.constructor.icon);\n }\n\n if (this.prop.id && this.psv.config.lang[this.prop.id]) {\n this.container.title = this.psv.config.lang[this.prop.id];\n }\n\n if (tabbable) {\n this.container.tabIndex = 0;\n }\n\n this.container.addEventListener('click', (e) => {\n if (this.prop.enabled) {\n this.onClick();\n }\n e.stopPropagation();\n });\n\n this.container.addEventListener('keydown', (e) => {\n if (e.key === KEY_CODES.Enter && this.prop.enabled) {\n this.onClick();\n e.stopPropagation();\n }\n });\n }\n\n /**\n * @package\n */\n checkSupported() {\n const supportedOrObject = this.isSupported();\n if (isPlainObject(supportedOrObject)) {\n if (supportedOrObject.initial === false) {\n this.hide();\n this.prop.supported = false;\n }\n\n supportedOrObject.promise.then((supported) => {\n if (!this.prop) {\n return; // the component has been destroyed\n }\n this.prop.supported = supported;\n if (!supported) {\n this.hide();\n }\n else {\n this.show();\n }\n });\n }\n else {\n this.prop.supported = supportedOrObject;\n if (!supportedOrObject) {\n this.hide();\n }\n }\n }\n\n /**\n * @summary Checks if the button can be displayed\n * @returns {boolean|{initial: boolean, promise: Promise}}\n */\n isSupported() {\n return true;\n }\n\n /**\n * @summary Changes the active state of the button\n * @param {boolean} [active] - forced state\n */\n toggleActive(active) {\n this.prop.active = active !== undefined ? active : !this.prop.active;\n toggleClass(this.container, 'psv-button--active', this.prop.active);\n\n if (this.constructor.iconActive) {\n this.__setIcon(this.prop.active ? this.constructor.iconActive : this.constructor.icon);\n }\n }\n\n /**\n * @override\n */\n show(refresh = true) {\n if (!this.isVisible()) {\n this.prop.visible = true;\n if (!this.prop.collapsed) {\n this.container.style.display = '';\n }\n if (refresh) {\n this.psv.refreshUi(`show button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @override\n */\n hide(refresh = true) {\n if (this.isVisible()) {\n this.prop.visible = false;\n this.container.style.display = 'none';\n if (refresh) {\n this.psv.refreshUi(`hide button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @summary Disables the button\n */\n disable() {\n this.container.classList.add('psv-button--disabled');\n this.prop.enabled = false;\n }\n\n /**\n * @summary Enables the button\n */\n enable() {\n this.container.classList.remove('psv-button--disabled');\n this.prop.enabled = true;\n }\n\n /**\n * @summary Collapses the button in the navbar menu\n */\n collapse() {\n this.prop.collapsed = true;\n this.container.style.display = 'none';\n }\n\n /**\n * @summary Uncollapses the button from the navbar menu\n */\n uncollapse() {\n this.prop.collapsed = false;\n if (this.prop.visible) {\n this.container.style.display = '';\n }\n }\n\n /**\n * @summary Set the button icon\n * @param {string} icon SVG\n * @param {HTMLElement} [container] - default is the main button container\n * @private\n */\n __setIcon(icon, container = this.container) {\n if (icon) {\n container.innerHTML = icon;\n // className is read-only on SVGElement\n container.querySelector('svg').classList.add('psv-button-svg');\n }\n else {\n container.innerHTML = '';\n }\n }\n\n /**\n * @summary Action when the button is clicked\n * @private\n * @abstract\n */\n onClick() {\n throw new PSVError(`onClick not implemented for button \"${this.prop.id}\".`);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport playActive from '../icons/play-active.svg';\nimport play from '../icons/play.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar autorotate button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AutorotateButton extends AbstractButton {\n\n static id = 'autorotate';\n static icon = play;\n static iconActive = playActive;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-autorotate-button', true);\n\n this.psv.on(EVENTS.AUTOROTATE, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.AUTOROTATE, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.AUTOROTATE: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles autorotate\n */\n onClick() {\n this.psv.toggleAutorotate();\n }\n\n}\n","import { addClasses } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar custom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CustomButton extends AbstractButton {\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {PSV.NavbarCustomButton} config\n */\n constructor(navbar, config) {\n super(navbar, 'psv-custom-button', config.collapsable !== false, config.tabbable !== false);\n\n /**\n * @member {Object}\n * @readonly\n * @private\n */\n this.config = config;\n\n if (this.config.id) {\n this.prop.id = this.config.id;\n }\n else {\n this.prop.id = 'psvButton-' + Math.random().toString(36).substr(2, 9);\n }\n\n if (this.config.className) {\n addClasses(this.container, this.config.className);\n }\n\n if (this.config.title) {\n this.container.title = this.config.title;\n }\n\n if (this.config.content) {\n this.container.innerHTML = this.config.content;\n }\n\n this.prop.width = this.container.offsetWidth;\n\n if (this.config.enabled === false) {\n this.disable();\n }\n\n if (this.config.visible === false) {\n this.hide();\n }\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.config;\n\n super.destroy();\n }\n\n /**\n * @override\n * @description Calls user method\n */\n onClick() {\n if (this.config.onClick) {\n this.config.onClick.apply(this.psv);\n }\n }\n\n}\n","import { DescriptionButton } from '../buttons/DescriptionButton';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Navbar caption class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class NavbarCaption extends AbstractComponent {\n\n static id = 'caption';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} caption\n */\n constructor(navbar, caption) {\n super(navbar, 'psv-caption');\n\n /**\n * @override\n * @property {string} id\n * @property {boolean} collapsable\n * @property {number} width\n * @property {number} contentWidth - width of the caption content\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable : false,\n width : 0,\n contentWidth: 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-caption-content';\n this.container.appendChild(this.content);\n\n this.setCaption(caption);\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n this.show();\n this.content.innerHTML = html;\n this.prop.contentWidth = html ? this.content.offsetWidth : 0;\n this.refreshUi();\n }\n\n /**\n * @summary Toggles content and icon depending on available space\n * @private\n */\n refreshUi() {\n const availableWidth = this.container.offsetWidth;\n if (availableWidth >= this.prop.contentWidth) {\n this.show();\n }\n else if (availableWidth < this.prop.contentWidth) {\n this.hide();\n }\n this.__refreshButton();\n }\n\n /**\n * @override\n */\n hide() {\n this.content.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @override\n */\n show() {\n this.content.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @private\n */\n __refreshButton() {\n this.psv.navbar.getButton(DescriptionButton.id, false)?.refreshUi(true);\n }\n\n}\n","import { NavbarCaption } from '../components/NavbarCaption';\nimport { EVENTS, IDS } from '../data/constants';\nimport info from '../icons/info.svg';\nimport { AbstractButton } from './AbstractButton';\n\nconst MODE_NOTIF = 1;\nconst MODE_PANEL = 2;\n\n/**\n * @summary Navigation bar description button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class DescriptionButton extends AbstractButton {\n\n static id = 'description';\n static icon = info;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-description-button');\n\n /**\n * @override\n * @property {string} mode - notification or panel\n */\n this.prop = {\n ...this.prop,\n mode: null,\n };\n\n this.psv.on(EVENTS.HIDE_NOTIFICATION, this);\n this.psv.on(EVENTS.SHOW_NOTIFICATION, this);\n this.psv.on(EVENTS.CLOSE_PANEL, this);\n this.psv.on(EVENTS.OPEN_PANEL, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.HIDE_NOTIFICATION, this);\n this.psv.off(EVENTS.SHOW_NOTIFICATION, this);\n this.psv.off(EVENTS.CLOSE_PANEL, this);\n this.psv.off(EVENTS.OPEN_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (!this.prop.mode) {\n return;\n }\n\n let closed = false;\n switch (e.type) {\n case EVENTS.HIDE_NOTIFICATION:\n closed = this.prop.mode === MODE_NOTIF;\n break;\n\n case EVENTS.SHOW_NOTIFICATION:\n closed = this.prop.mode === MODE_NOTIF && e.args[0] !== IDS.DESCRIPTION;\n break;\n\n case EVENTS.CLOSE_PANEL:\n closed = this.prop.mode === MODE_PANEL;\n break;\n\n case EVENTS.OPEN_PANEL:\n closed = this.prop.mode === MODE_PANEL && e.args[0] !== IDS.DESCRIPTION;\n break;\n\n default:\n }\n\n if (closed) {\n this.toggleActive(false);\n this.prop.mode = null;\n }\n }\n\n /**\n * @override\n */\n hide(refresh) {\n super.hide(refresh);\n\n if (this.prop.mode) {\n this.__close();\n }\n }\n\n /**\n * This button can only be refresh from NavbarCaption\n * @override\n */\n refreshUi(refresh = false) {\n if (refresh) {\n const caption = this.psv.navbar.getButton(NavbarCaption.id, false);\n const captionHidden = caption && !caption.isVisible();\n const hasDescription = !!this.psv.config.description;\n\n if (captionHidden || hasDescription) {\n this.show(false);\n }\n else {\n this.hide(false);\n }\n }\n }\n\n /**\n * @override\n * @description Toggles caption\n */\n onClick() {\n if (this.prop.mode) {\n this.__close();\n }\n else {\n this.__open();\n }\n }\n\n /**\n * @private\n */\n __close() {\n switch (this.prop.mode) {\n case MODE_NOTIF:\n this.psv.notification.hide(IDS.DESCRIPTION);\n break;\n case MODE_PANEL:\n this.psv.panel.hide(IDS.DESCRIPTION);\n break;\n default:\n }\n }\n\n /**\n * @private\n */\n __open() {\n this.toggleActive(true);\n\n if (this.psv.config.description) {\n this.prop.mode = MODE_PANEL;\n this.psv.panel.show({\n id : IDS.DESCRIPTION,\n content: `${this.psv.config.caption ? `

${this.psv.config.caption}

` : ''}${this.psv.config.description}`,\n });\n }\n else {\n this.prop.mode = MODE_NOTIF;\n this.psv.notification.show({\n id : IDS.DESCRIPTION,\n content: this.psv.config.caption,\n });\n }\n }\n\n}\n","import download from '../icons/download.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar download button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class DownloadButton extends AbstractButton {\n\n static id = 'download';\n static icon = download;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-download-button', true);\n }\n\n /**\n * @override\n * @description Asks the browser to download the panorama source file\n */\n onClick() {\n const link = document.createElement('a');\n link.href = this.psv.config.downloadUrl || this.psv.config.panorama;\n link.download = link.href.split('/').pop();\n this.psv.container.appendChild(link);\n link.click();\n\n setTimeout(() => {\n this.psv.container.removeChild(link);\n }, 100);\n }\n\n /**\n * @override\n */\n refreshUi() {\n const supported = this.psv.adapter.constructor.supportsDownload || this.psv.config.downloadUrl;\n if (supported && !this.prop.visible) {\n this.show();\n }\n else if (!supported && this.prop.visible) {\n this.hide();\n }\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport fullscreenIn from '../icons/fullscreen-in.svg';\nimport fullscreenOut from '../icons/fullscreen-out.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar fullscreen button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class FullscreenButton extends AbstractButton {\n\n static id = 'fullscreen';\n static icon = fullscreenIn;\n static iconActive = fullscreenOut;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-fullscreen-button');\n\n this.psv.on(EVENTS.FULLSCREEN_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.FULLSCREEN_UPDATED, this);\n\n super.destroy();\n }\n\n /**\n * Handle events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.FULLSCREEN_UPDATED: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles fullscreen\n */\n onClick() {\n this.psv.toggleFullscreen();\n }\n\n}\n","import { EVENTS, IDS } from '../data/constants';\nimport menuIcon from '../icons/menu.svg';\nimport { dasherize, getClosest } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar menu button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class MenuButton extends AbstractButton {\n\n static id = 'menu';\n static icon = menuIcon;\n\n /**\n * @summary Property name added to buttons list\n * @type {string}\n * @constant\n */\n static BUTTON_DATA = 'psvButton';\n\n /**\n * @summary Menu template\n * @param {AbstractButton[]} buttons\n * @param {PSV.Viewer} psv\n * @param {string} dataKey\n * @returns {string}\n */\n static MENU_TEMPLATE = (buttons, psv, dataKey) => `\n
\n

${menuIcon} ${psv.config.lang.menu}

\n
    \n ${buttons.map(button => `\n
  • \n ${button.container.innerHTML}\n ${button.container.title}\n
  • \n `).join('')}\n
\n
\n`;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-menu-button');\n\n this.psv.on(EVENTS.OPEN_PANEL, this);\n this.psv.on(EVENTS.CLOSE_PANEL, this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.OPEN_PANEL, this);\n this.psv.off(EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === IDS.MENU); break;\n case EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n hide(refresh) {\n super.hide(refresh);\n this.__hideMenu();\n }\n\n /**\n * @override\n */\n show(refresh) {\n super.show(refresh);\n\n if (this.prop.active) {\n this.__showMenu();\n }\n }\n\n /**\n * @override\n * @description Toggles menu\n */\n onClick() {\n if (this.prop.active) {\n this.__hideMenu();\n }\n else {\n this.__showMenu();\n }\n }\n\n __showMenu() {\n this.psv.panel.show({\n id : IDS.MENU,\n content : MenuButton.MENU_TEMPLATE(this.parent.collapsed, this.psv, dasherize(MenuButton.BUTTON_DATA)),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? getClosest(e.target, 'li') : undefined;\n const buttonId = li ? li.dataset[MenuButton.BUTTON_DATA] : undefined;\n\n if (buttonId) {\n this.parent.getButton(buttonId).onClick();\n this.__hideMenu();\n }\n },\n });\n }\n\n __hideMenu() {\n this.psv.panel.hide(IDS.MENU);\n }\n\n}\n","/**\n * @summary Helper for pressable things (buttons, keyboard)\n * @description When the pressed thing goes up and was not pressed long enough, wait a bit more before execution\n * @private\n */\nexport class PressHandler {\n\n constructor(delay = 200) {\n this.delay = delay;\n this.time = 0;\n this.timeout = null;\n }\n\n down() {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n\n this.time = new Date().getTime();\n }\n\n up(cb) {\n if (!this.time) {\n return;\n }\n\n const elapsed = new Date().getTime() - this.time;\n if (elapsed < this.delay) {\n this.timeout = setTimeout(() => {\n cb();\n this.timeout = null;\n this.time = 0;\n }, this.delay);\n }\n else {\n cb();\n this.time = 0;\n }\n }\n\n}\n","import { KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport arrow from '../icons/arrow.svg';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractButton } from './AbstractButton';\n\nexport function getOrientedArrow(direction) {\n let angle = 0;\n switch (direction) {\n // @formatter:off\n case 'up': angle = 90; break;\n case 'right': angle = 180; break;\n case 'down': angle = -90; break;\n default: angle = 0; break;\n // @formatter:on\n }\n\n return arrow.replace('rotate(0', `rotate(${angle}`);\n}\n\n/**\n * @summary Navigation bar move button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractMoveButton extends AbstractButton {\n\n static groupId = 'move';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-move-button');\n\n this.container.title = this.psv.config.lang.move;\n\n /**\n * @override\n * @property {{longitude: boolean, latitude: boolean}} value\n * @property {PressHandler} handler\n */\n this.prop = {\n ...this.prop,\n value : value,\n handler: new PressHandler(),\n };\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('keydown', this);\n this.container.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.__onMouseUp();\n\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(); break;\n case 'mouseup': this.__onMouseUp(); break;\n case 'touchend': this.__onMouseUp(); break;\n case 'keydown': e.key === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': e.key === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.psv.__stopAll();\n this.psv.dynamics.position.roll(this.prop.value);\n this.prop.handler.down();\n }\n\n /**\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.handler.up(() => this.psv.dynamics.position.stop());\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move down button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveDownButton extends AbstractMoveButton {\n\n static id = 'moveDown';\n static icon = getOrientedArrow('down');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { latitude: true });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move left button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveLeftButton extends AbstractMoveButton {\n\n static id = 'moveLeft';\n static icon = getOrientedArrow('left');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { longitude: true });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move right button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveRightButton extends AbstractMoveButton {\n\n static id = 'moveRight';\n static icon = getOrientedArrow('right');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { longitude: false });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move up button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveUpButton extends AbstractMoveButton {\n\n static id = 'moveUp';\n static icon = getOrientedArrow('up');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { latitude: false });\n }\n\n}\n","import { KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractZoomButton extends AbstractButton {\n\n static groupId = 'zoom';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-zoom-button');\n\n /**\n * @override\n * @property {boolean} value\n * @property {PressHandler} handler\n */\n this.prop = {\n ...this.prop,\n value : value,\n handler: new PressHandler(),\n };\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('keydown', this);\n this.container.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.__onMouseUp();\n\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(); break;\n case 'mouseup': this.__onMouseUp(); break;\n case 'touchend': this.__onMouseUp(); break;\n case 'keydown': e.key === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': e.key === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.psv.dynamics.zoom.roll(this.prop.value);\n this.prop.handler.down();\n }\n\n /**\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.handler.up(() => this.psv.dynamics.zoom.stop());\n }\n\n}\n","import { AbstractZoomButton } from './AbstractZoomButton';\nimport zoomIn from '../icons/zoom-in.svg';\n\n/**\n * @summary Navigation bar zoom-in button class\n * @extends PSV.buttons.AbstractZoomButton\n * @memberof PSV.buttons\n */\nexport class ZoomInButton extends AbstractZoomButton {\n\n static id = 'zoomIn';\n static icon = zoomIn;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, false);\n }\n\n}\n","import { AbstractZoomButton } from './AbstractZoomButton';\nimport zoomOut from '../icons/zoom-out.svg';\n\n/**\n * @summary Navigation bar zoom-out button class\n * @extends PSV.buttons.AbstractZoomButton\n * @memberof PSV.buttons\n */\nexport class ZoomOutButton extends AbstractZoomButton {\n\n static id = 'zoomOut';\n static icon = zoomOut;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, true);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { getStyle, Slider } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class ZoomRangeButton extends AbstractButton {\n\n static id = 'zoomRange';\n static groupId = 'zoom';\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-zoom-range', false, false);\n\n /**\n * @override\n * @property {number} mediaMinWidth\n */\n this.prop = {\n ...this.prop,\n mediaMinWidth: 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomRange = document.createElement('div');\n this.zoomRange.className = 'psv-zoom-range-line';\n this.container.appendChild(this.zoomRange);\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomValue = document.createElement('div');\n this.zoomValue.className = 'psv-zoom-range-handle';\n this.zoomRange.appendChild(this.zoomValue);\n\n /**\n * @member {PSV.Slider}\n * @readonly\n * @private\n */\n this.slider = new Slider({\n container: this.container,\n direction: Slider.HORIZONTAL,\n onUpdate : e => this.__onSliderUpdate(e),\n });\n\n this.prop.mediaMinWidth = parseInt(getStyle(this.container, 'maxWidth'), 10);\n\n this.psv.on(EVENTS.ZOOM_UPDATED, this);\n if (this.psv.prop.ready) {\n this.__moveZoomValue(this.psv.getZoomLevel());\n }\n else {\n this.psv.once(EVENTS.READY, this);\n }\n\n this.refreshUi();\n }\n\n /**\n * @override\n */\n destroy() {\n this.slider.destroy();\n\n delete this.zoomRange;\n delete this.zoomValue;\n\n this.psv.off(EVENTS.ZOOM_UPDATED, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.ZOOM_UPDATED: this.__moveZoomValue(e.args[0]); break;\n case EVENTS.READY: this.__moveZoomValue(this.psv.getZoomLevel()); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n refreshUi() {\n if (this.prop.supported) {\n if (this.psv.prop.size.width <= this.prop.mediaMinWidth && this.prop.visible) {\n this.hide();\n }\n else if (this.psv.prop.size.width > this.prop.mediaMinWidth && !this.prop.visible) {\n this.show();\n }\n }\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @summary Moves the zoom cursor\n * @param {number} level\n * @private\n */\n __moveZoomValue(level) {\n this.zoomValue.style.left = (level / 100 * this.zoomRange.offsetWidth - this.zoomValue.offsetWidth / 2) + 'px';\n }\n\n\n /**\n * @summary Zoom change\n * @private\n */\n __onSliderUpdate(e) {\n if (e.mousedown) {\n this.psv.zoom(e.value * 100);\n }\n }\n\n}\n","import { EventEmitter } from 'uevent';\n\n/**\n * @namespace PSV.plugins\n */\n\n/**\n * @summary Base plugins class\n * @memberof PSV.plugins\n * @abstract\n */\nexport class AbstractPlugin extends EventEmitter {\n\n /**\n * @summary Unique identifier of the plugin\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super();\n\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n }\n\n /**\n * @summary Initializes the plugin\n * @package\n */\n init() {\n }\n\n /**\n * @summary Destroys the plugin\n * @package\n */\n destroy() {\n delete this.psv;\n }\n\n}\n","import { AbstractAdapter } from '../adapters/AbstractAdapter';\nimport { EquirectangularAdapter } from '../adapters/equirectangular';\nimport { AbstractPlugin } from '../plugins/AbstractPlugin';\nimport { PSVError } from '../PSVError';\nimport { bound, clone, deepmerge, each, logWarn, parseAngle, parseSpeed, pluginInterop } from '../utils';\nimport { ACTIONS, KEY_CODES } from './constants';\n\n/**\n * @summary Default options\n * @type {PSV.Options}\n * @memberOf PSV\n * @constant\n */\nexport const DEFAULTS = {\n panorama : null,\n container : null,\n adapter : null,\n plugins : [],\n caption : null,\n description : null,\n downloadUrl : null,\n loadingImg : null,\n loadingTxt : 'Loading...',\n size : null,\n fisheye : false,\n minFov : 30,\n maxFov : 90,\n defaultZoomLvl : 50,\n defaultLong : 0,\n defaultLat : 0,\n sphereCorrection : null,\n moveSpeed : 1,\n zoomSpeed : 1,\n autorotateDelay : null,\n autorotateSpeed : '2rpm',\n autorotateLat : null,\n moveInertia : true,\n mousewheel : true,\n mousemove : true,\n captureCursor : false,\n mousewheelCtrlKey : false,\n touchmoveTwoFingers: false,\n useXmpData : true,\n panoData : null,\n requestHeaders : null,\n canvasBackground : '#000',\n withCredentials : false,\n navbar : [\n 'autorotate',\n 'zoom',\n 'move',\n 'download',\n 'description',\n 'caption',\n 'fullscreen',\n ],\n lang : {\n autorotate: 'Automatic rotation',\n zoom : 'Zoom',\n zoomOut : 'Zoom out',\n zoomIn : 'Zoom in',\n move : 'Move',\n download : 'Download',\n fullscreen: 'Fullscreen',\n menu : 'Menu',\n twoFingers: 'Use two fingers to navigate',\n ctrlZoom : 'Use ctrl + scroll to zoom the image',\n loadError : 'The panorama can\\'t be loaded',\n },\n keyboard : {\n [KEY_CODES.ArrowUp] : ACTIONS.ROTATE_LAT_UP,\n [KEY_CODES.ArrowDown] : ACTIONS.ROTATE_LAT_DOWN,\n [KEY_CODES.ArrowRight]: ACTIONS.ROTATE_LONG_RIGHT,\n [KEY_CODES.ArrowLeft] : ACTIONS.ROTATE_LONG_LEFT,\n [KEY_CODES.PageUp] : ACTIONS.ZOOM_IN,\n [KEY_CODES.PageDown] : ACTIONS.ZOOM_OUT,\n [KEY_CODES.Plus] : ACTIONS.ZOOM_IN,\n [KEY_CODES.Minus] : ACTIONS.ZOOM_OUT,\n [KEY_CODES.Space] : ACTIONS.TOGGLE_AUTOROTATE,\n },\n};\n\n/**\n * @summary List of unmodifiable options and their error messages\n * @private\n */\nexport const READONLY_OPTIONS = {\n panorama : 'Use setPanorama method to change the panorama',\n panoData : 'Use setPanorama method to change the panorama',\n container: 'Cannot change viewer container',\n adapter : 'Cannot change adapter',\n plugins : 'Cannot change plugins',\n};\n\n/**\n * @summary List of deprecated options and their warning messages\n * @private\n */\nexport const DEPRECATED_OPTIONS = {\n zoomButtonIncrement : 'zoomButtonIncrement is deprecated, use zoomSpeed',\n mousewheelSpeed : 'mousewheelSpeed is deprecated, use zoomSpeed',\n sphereCorrectionReorder: 'sphereCorrectionReorder is deprecated',\n};\n\n/**\n * @summary Parsers/validators for each option\n * @private\n */\nexport const CONFIG_PARSERS = {\n container : (container) => {\n if (!container) {\n throw new PSVError('No value given for container.');\n }\n return container;\n },\n adapter : (adapter) => {\n if (!adapter) {\n adapter = [EquirectangularAdapter];\n }\n else if (Array.isArray(adapter)) {\n adapter = [pluginInterop(adapter[0], AbstractAdapter), adapter[1]];\n }\n else {\n adapter = [pluginInterop(adapter, AbstractAdapter)];\n }\n if (!adapter[0]) {\n throw new PSVError('Un undefined value with given for adapter.');\n }\n return adapter;\n },\n defaultLong : (defaultLong) => {\n // defaultLat is between 0 and PI\n return parseAngle(defaultLong);\n },\n defaultLat : (defaultLat) => {\n // defaultLat is between -PI/2 and PI/2\n return parseAngle(defaultLat, true);\n },\n minFov : (minFov, config) => {\n // minFov and maxFov must be ordered\n if (config.maxFov < minFov) {\n logWarn('maxFov cannot be lower than minFov');\n minFov = config.maxFov;\n }\n // minFov between 1 and 179\n return bound(minFov, 1, 179);\n },\n maxFov : (maxFov, config) => {\n // minFov and maxFov must be ordered\n if (maxFov < config.minFov) {\n maxFov = config.minFov;\n }\n // maxFov between 1 and 179\n return bound(maxFov, 1, 179);\n },\n lang : (lang) => {\n if (Array.isArray(lang.twoFingers)) {\n logWarn('lang.twoFingers must not be an array');\n lang.twoFingers = lang.twoFingers[0];\n }\n return {\n ...DEFAULTS.lang,\n ...lang,\n };\n },\n keyboard : (keyboard) => {\n // keyboard=true becomes the default map\n if (keyboard === true) {\n return clone(DEFAULTS.keyboard);\n }\n return keyboard;\n },\n autorotateLat : (autorotateLat, config) => {\n // default autorotateLat is defaultLat\n if (autorotateLat === null) {\n return parseAngle(config.defaultLat, true);\n }\n // autorotateLat is between -PI/2 and PI/2\n else {\n return parseAngle(autorotateLat, true);\n }\n },\n autorotateSpeed: (autorotateSpeed) => {\n return parseSpeed(autorotateSpeed);\n },\n fisheye : (fisheye) => {\n // translate boolean fisheye to amount\n if (fisheye === true) {\n return 1;\n }\n else if (fisheye === false) {\n return 0;\n }\n return fisheye;\n },\n plugins : (plugins) => {\n return plugins\n .map((plugin) => {\n if (Array.isArray(plugin)) {\n plugin = [pluginInterop(plugin[0], AbstractPlugin), plugin[1]];\n }\n else {\n plugin = [pluginInterop(plugin, AbstractPlugin)];\n }\n if (!plugin[0]) {\n throw new PSVError('Un undefined value was given for plugins.');\n }\n return plugin;\n });\n },\n};\n\n/**\n * @summary Merge user config with default config and performs validation\n * @param {PSV.Options} options\n * @returns {PSV.Options}\n * @memberOf PSV\n * @private\n */\nexport function getConfig(options) {\n const tempConfig = clone(DEFAULTS);\n deepmerge(tempConfig, options);\n\n const config = {};\n\n each(tempConfig, (value, key) => {\n if (DEPRECATED_OPTIONS[key]) {\n logWarn(DEPRECATED_OPTIONS[key]);\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (CONFIG_PARSERS[key]) {\n config[key] = CONFIG_PARSERS[key](value, tempConfig);\n }\n else {\n config[key] = value;\n }\n });\n\n return config;\n}\n","import { AutorotateButton } from '../buttons/AutorotateButton';\nimport { CustomButton } from '../buttons/CustomButton';\nimport { DescriptionButton } from '../buttons/DescriptionButton';\nimport { DownloadButton } from '../buttons/DownloadButton';\nimport { FullscreenButton } from '../buttons/FullscreenButton';\nimport { MenuButton } from '../buttons/MenuButton';\nimport { MoveDownButton } from '../buttons/MoveDownButton';\nimport { MoveLeftButton } from '../buttons/MoveLeftButton';\nimport { MoveRightButton } from '../buttons/MoveRightButton';\nimport { MoveUpButton } from '../buttons/MoveUpButton';\nimport { ZoomInButton } from '../buttons/ZoomInButton';\nimport { ZoomOutButton } from '../buttons/ZoomOutButton';\nimport { ZoomRangeButton } from '../buttons/ZoomRangeButton';\nimport { DEFAULTS } from '../data/config';\nimport { PSVError } from '../PSVError';\nimport { clone, logWarn } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\nimport { NavbarCaption } from './NavbarCaption';\n\n/**\n * @summary List of available buttons\n * @type {Object>}\n * @private\n */\nconst AVAILABLE_BUTTONS = {};\n\n/**\n * @summary List of available buttons\n * @type {Object>>}\n * @private\n */\nconst AVAILABLE_GROUPS = {};\n\n/**\n * @summary Register a new button available for all viewers\n * @param {Class} button\n * @param {'start' | 'end' | '[id]:left' | '[id]:right'} [defaultPosition]\n * If provided the default configuration of the navbar will be modified.\n * @memberOf PSV\n */\nexport function registerButton(button, defaultPosition) {\n if (!button.id) {\n throw new PSVError('Button ID is required');\n }\n\n AVAILABLE_BUTTONS[button.id] = button;\n\n if (button.groupId) {\n AVAILABLE_GROUPS[button.groupId] = AVAILABLE_GROUPS[button.groupId] || [];\n AVAILABLE_GROUPS[button.groupId].push(button);\n }\n\n if (typeof defaultPosition === 'string') {\n switch (defaultPosition) {\n case 'start':\n DEFAULTS.navbar.unshift(button.id);\n break;\n case 'end':\n DEFAULTS.navbar.push(button.id);\n break;\n default:\n const [id, pos] = defaultPosition.split(':');\n DEFAULTS.navbar.splice(DEFAULTS.navbar.indexOf(id) + (pos === 'right' ? 1 : 0), 0, button.id);\n }\n }\n}\n\n[\n AutorotateButton,\n ZoomOutButton,\n ZoomRangeButton,\n ZoomInButton,\n DescriptionButton,\n DownloadButton,\n FullscreenButton,\n MoveLeftButton,\n MoveRightButton,\n MoveUpButton,\n MoveDownButton,\n].forEach(registerButton);\n\n/**\n * @summary Navigation bar component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Navbar extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-navbar');\n\n /**\n * @summary List of buttons of the navbar\n * @member {PSV.buttons.AbstractButton[]}\n * @override\n */\n this.children = [];\n\n /**\n * @summary List of collapsed buttons\n * @member {PSV.buttons.AbstractButton[]}\n * @private\n */\n this.collapsed = [];\n }\n\n /**\n * @summary Change the buttons visible on the navbar\n * @param {string|Array} buttons\n * @throws {PSV.PSVError} when a button is unknown\n */\n setButtons(buttons) {\n this.children.slice().forEach(item => item.destroy());\n this.children.length = 0;\n\n const cleanedButtons = this.__cleanButtons(buttons);\n\n // force description button if caption is present (used on narrow screens)\n if (cleanedButtons.indexOf(NavbarCaption.id) !== -1 && cleanedButtons.indexOf(DescriptionButton.id) === -1) {\n cleanedButtons.splice(cleanedButtons.indexOf(NavbarCaption.id), 0, DescriptionButton.id);\n }\n\n /* eslint-disable no-new */\n cleanedButtons.forEach((button) => {\n if (typeof button === 'object') {\n new CustomButton(this, button);\n }\n else if (AVAILABLE_BUTTONS[button]) {\n new AVAILABLE_BUTTONS[button](this);\n }\n else if (AVAILABLE_GROUPS[button]) {\n AVAILABLE_GROUPS[button].forEach(buttonCtor => new buttonCtor(this)); // eslint-disable-line new-cap\n }\n else if (button === NavbarCaption.id) {\n new NavbarCaption(this, this.psv.config.caption);\n }\n else {\n throw new PSVError('Unknown button ' + button);\n }\n });\n\n new MenuButton(this);\n /* eslint-enable no-new */\n\n this.children.forEach((item) => {\n if (typeof item.checkSupported === 'function') {\n item.checkSupported();\n }\n });\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n const caption = this.getButton(NavbarCaption.id, false);\n caption?.setCaption(html);\n }\n\n /**\n * @summary Returns a button by its identifier\n * @param {string} id\n * @param {boolean} [warnNotFound=true]\n * @returns {PSV.buttons.AbstractButton}\n */\n getButton(id, warnNotFound = true) {\n let button = null;\n\n this.children.some((item) => {\n if (item.prop.id === id) {\n button = item;\n return true;\n }\n else {\n return false;\n }\n });\n\n if (!button && warnNotFound) {\n logWarn(`button \"${id}\" not found in the navbar`);\n }\n\n return button;\n }\n\n /**\n * @summary Shows the navbar\n */\n show() {\n this.container.classList.add('psv-navbar--open');\n this.prop.visible = true;\n }\n\n /**\n * @summary Hides the navbar\n */\n hide() {\n this.container.classList.remove('psv-navbar--open');\n this.prop.visible = false;\n }\n\n /**\n * @override\n */\n refreshUi() {\n super.refreshUi();\n\n if (this.psv.prop.uiRefresh === true) {\n const availableWidth = this.container.offsetWidth;\n\n let totalWidth = 0;\n const visibleButtons = [];\n const collapsableButtons = [];\n\n this.children.forEach((item) => {\n if (item.prop.visible) {\n totalWidth += item.prop.width;\n visibleButtons.push(item);\n if (item.prop.collapsable) {\n collapsableButtons.push(item);\n }\n }\n });\n\n if (!visibleButtons.length) {\n return;\n }\n\n if (availableWidth < totalWidth && collapsableButtons.length > 0) {\n collapsableButtons.forEach(item => item.collapse());\n this.collapsed = collapsableButtons;\n\n this.getButton(MenuButton.id).show(false);\n }\n else if (availableWidth >= totalWidth && this.collapsed.length > 0) {\n this.collapsed.forEach(item => item.uncollapse());\n this.collapsed = [];\n\n this.getButton(MenuButton.id).hide(false);\n }\n\n const caption = this.getButton(NavbarCaption.id, false);\n if (caption) {\n caption.refreshUi();\n }\n }\n }\n\n /**\n * @summary Ensure the buttons configuration is correct\n * @private\n */\n __cleanButtons(buttons) {\n // true becomes the default array\n if (buttons === true) {\n return clone(DEFAULTS.navbar);\n }\n // can be a space or coma separated list\n else if (typeof buttons === 'string') {\n return buttons.split(/[ ,]/);\n }\n else {\n return buttons || [];\n }\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { bound, getStyle } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Loader component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Loader extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-loader-container');\n\n /**\n * @summary Inner container for vertical center\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.loader = document.createElement('div');\n this.loader.className = 'psv-loader';\n this.container.appendChild(this.loader);\n\n /**\n * @summary Animation canvas\n * @member {HTMLCanvasElement}\n * @readonly\n * @private\n */\n this.canvas = document.createElement('canvas');\n this.canvas.className = 'psv-loader-canvas';\n\n this.canvas.width = this.loader.clientWidth * SYSTEM.pixelRatio;\n this.canvas.height = this.loader.clientWidth * SYSTEM.pixelRatio;\n this.loader.appendChild(this.canvas);\n\n /**\n * @override\n * @property {number} thickness\n * @property {string} current\n */\n this.prop = {\n ...this.prop,\n tickness: (this.loader.offsetWidth - this.loader.clientWidth) / 2 * SYSTEM.pixelRatio,\n current : null,\n };\n\n this.refreshUi();\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.loader;\n delete this.canvas;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n refreshUi() {\n if (this.prop.current !== (this.psv.config.loadingImg || this.psv.config.loadingTxt)) {\n if (this.prop.current) {\n this.loader.removeChild(this.loader.lastChild);\n }\n\n let inner;\n if (this.psv.config.loadingImg) {\n inner = document.createElement('img');\n inner.className = 'psv-loader-image';\n inner.src = this.psv.config.loadingImg;\n }\n else if (this.psv.config.loadingTxt) {\n inner = document.createElement('div');\n inner.className = 'psv-loader-text';\n inner.innerHTML = this.psv.config.loadingTxt;\n }\n if (inner) {\n const size = Math.round(Math.sqrt(2 * Math.pow((this.canvas.width / 2 - this.prop.tickness / 2) / SYSTEM.pixelRatio, 2)));\n inner.style.maxWidth = size + 'px';\n inner.style.maxHeight = size + 'px';\n this.loader.appendChild(inner);\n }\n\n this.prop.current = this.psv.config.loadingImg || this.psv.config.loadingTxt;\n }\n }\n\n /**\n * @summary Sets the loader progression\n * @param {number} value - from 0 to 100\n */\n setProgress(value) {\n const context = this.canvas.getContext('2d');\n\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n context.lineWidth = this.prop.tickness;\n context.strokeStyle = getStyle(this.loader, 'color');\n\n context.beginPath();\n context.arc(\n this.canvas.width / 2, this.canvas.height / 2,\n this.canvas.width / 2 - this.prop.tickness / 2,\n -Math.PI / 2, bound(value, 0, 100) / 100 * 2 * Math.PI - Math.PI / 2\n );\n context.stroke();\n\n this.psv.trigger(EVENTS.LOAD_PROGRESS, Math.round(value));\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Notification component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Notification extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-notification');\n\n /**\n * @override\n * @property {*} timeout\n */\n this.prop = {\n ...this.prop,\n visible : false,\n contentId: undefined,\n timeout : null,\n };\n\n /**\n * Notification content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-notification-content';\n this.container.appendChild(this.content);\n\n this.content.addEventListener('click', () => this.hide());\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Notification cannot be toggled');\n }\n\n /**\n * @summary Displays a notification on the viewer\n * @param {Object|string} config\n * @param {string} [config.id] - unique identifier to use with \"hide\"\n * @param {string} config.content\n * @param {number} [config.timeout]\n * @fires PSV.show-notification\n *\n * @example\n * viewer.showNotification({ content: 'Hello world', timeout: 5000 })\n * @example\n * viewer.showNotification('Hello world')\n */\n show(config) {\n if (this.prop.timeout) {\n clearTimeout(this.prop.timeout);\n this.prop.timeout = null;\n }\n\n if (typeof config === 'string') {\n config = { content: config };\n }\n\n this.prop.contentId = config.id;\n this.content.innerHTML = config.content;\n\n this.container.classList.add('psv-notification--visible');\n this.prop.visible = true;\n\n this.psv.trigger(EVENTS.SHOW_NOTIFICATION, config.id);\n\n if (config.timeout) {\n this.prop.timeout = setTimeout(() => this.hide(config.id), config.timeout);\n }\n }\n\n /**\n * @summary Hides the notification\n * @param {string} [id]\n * @fires PSV.hide-notification\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n this.container.classList.remove('psv-notification--visible');\n this.prop.visible = false;\n\n this.prop.contentId = undefined;\n\n this.psv.trigger(EVENTS.HIDE_NOTIFICATION, contentId);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Overlay component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Overlay extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-overlay');\n\n /**\n * @override\n * @property {string} contentId\n * @property {boolean} dissmisable\n */\n this.prop = {\n ...this.prop,\n contentId : undefined,\n dissmisable: true,\n };\n\n /**\n * Image container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.image = document.createElement('div');\n this.image.className = 'psv-overlay-image';\n this.container.appendChild(this.image);\n\n /**\n * Text container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.text = document.createElement('div');\n this.text.className = 'psv-overlay-text';\n this.container.appendChild(this.text);\n\n /**\n * Subtext container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.subtext = document.createElement('div');\n this.subtext.className = 'psv-overlay-subtext';\n this.container.appendChild(this.subtext);\n\n this.psv.on(EVENTS.CLICK, this);\n this.psv.on(EVENTS.KEY_PRESS, this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.CLICK, this);\n this.psv.off(EVENTS.KEY_PRESS, this);\n\n delete this.image;\n delete this.text;\n delete this.subtext;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case EVENTS.CLICK:\n if (this.isVisible() && this.prop.dissmisable) {\n this.hide();\n e.stopPropagation();\n }\n break;\n case EVENTS.KEY_PRESS:\n if (this.isVisible() && this.prop.dissmisable && e.args[0] === KEY_CODES.Escape) {\n this.hide();\n e.preventDefault();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Overlay cannot be toggled');\n }\n\n /**\n * @summary Displays an overlay on the viewer\n * @param {Object|string} config\n * @param {string} [config.id] - unique identifier to use with \"hide\"\n * @param {string} config.image - SVG image/icon displayed above the text\n * @param {string} config.text - main message\n * @param {string} [config.subtext] - secondary message\n * @param {boolean} [config.dissmisable=true] - if the user can hide the overlay by clicking\n * @fires PSV.show-overlay\n */\n show(config) {\n if (typeof config === 'string') {\n config = { text: config };\n }\n\n this.prop.contentId = config.id;\n this.prop.dissmisable = config.dissmisable !== false;\n this.image.innerHTML = config.image || '';\n this.text.innerHTML = config.text || '';\n this.subtext.innerHTML = config.subtext || '';\n\n super.show();\n\n this.psv.trigger(EVENTS.SHOW_OVERLAY, config.id);\n }\n\n /**\n * @summary Hides the overlay\n * @param {string} [id]\n * @fires PSV.hide-overlay\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n super.hide();\n\n this.prop.contentId = undefined;\n\n this.psv.trigger(EVENTS.HIDE_OVERLAY, contentId);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { PSVError } from '../PSVError';\nimport { toggleClass } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Minimum width of the panel\n * @type {number}\n * @constant\n * @private\n */\nconst PANEL_MIN_WIDTH = 200;\n\n/**\n * @summary Panel component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Panel extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-panel');\n\n /**\n * @override\n * @property {string} contentId\n * @property {number} mouseX\n * @property {number} mouseY\n * @property {boolean} mousedown\n * @property {function} clickHandler\n * @property {function} keyHandler\n */\n this.prop = {\n ...this.prop,\n visible : false,\n contentId : undefined,\n mouseX : 0,\n mouseY : 0,\n mousedown : false,\n clickHandler: null,\n keyHandler : null,\n width : {},\n };\n\n const resizer = document.createElement('div');\n resizer.className = 'psv-panel-resizer';\n this.container.appendChild(resizer);\n\n const closeBtn = document.createElement('div');\n closeBtn.className = 'psv-panel-close-button';\n this.container.appendChild(closeBtn);\n\n /**\n * @summary Content container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-panel-content';\n this.container.appendChild(this.content);\n\n // Stop wheel event bubbling from panel\n this.container.addEventListener(SYSTEM.mouseWheelEvent, e => e.stopPropagation());\n\n closeBtn.addEventListener('click', () => this.hide());\n\n // Event for panel resizing + stop bubling\n resizer.addEventListener('mousedown', this);\n resizer.addEventListener('touchstart', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', this);\n\n this.psv.on(EVENTS.KEY_PRESS, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.KEY_PRESS, this);\n\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n delete this.prop;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(e); break;\n case 'touchstart': this.__onTouchStart(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'touchmove': this.__onTouchMove(e); break;\n case 'mouseup': this.__onMouseUp(e); break;\n case 'touchend': this.__onMouseUp(e); break;\n case EVENTS.KEY_PRESS:\n if (this.isVisible() && e.args[0] === KEY_CODES.Escape) {\n this.hide();\n e.preventDefault();\n }\n break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Panel cannot be toggled');\n }\n\n /**\n * @summary Shows the panel\n * @param {string|Object} config\n * @param {string} [config.id] - unique identifier to use with \"hide\" and to store the user desired width\n * @param {string} config.content - HTML content of the panel\n * @param {boolean} [config.noMargin=false] - remove the default margins\n * @param {string} [config.width] - initial width\n * @param {Function} [config.clickHandler] - called when the user clicks inside the panel or presses the Enter key while an element focused\n * @fires PSV.open-panel\n */\n show(config) {\n const wasVisible = this.isVisible(config.id);\n\n if (typeof config === 'string') {\n config = { content: config };\n }\n\n this.prop.contentId = config.id;\n this.prop.visible = true;\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.content.removeEventListener('keydown', this.prop.keyHandler);\n this.prop.clickHandler = null;\n this.prop.keyHandler = null;\n }\n\n if (config.id && this.prop.width[config.id]) {\n this.container.style.width = this.prop.width[config.id];\n }\n else if (config.width) {\n this.container.style.width = config.width;\n }\n else {\n this.container.style.width = null;\n }\n\n this.content.innerHTML = config.content;\n this.content.scrollTop = 0;\n this.container.classList.add('psv-panel--open');\n\n toggleClass(this.content, 'psv-panel-content--no-margin', config.noMargin === true);\n\n if (config.clickHandler) {\n this.prop.clickHandler = config.clickHandler;\n this.prop.keyHandler = (e) => {\n if (e.key === KEY_CODES.Enter) {\n config.clickHandler(e);\n }\n };\n this.content.addEventListener('click', this.prop.clickHandler);\n this.content.addEventListener('keydown', this.prop.keyHandler);\n\n // focus the first element if possible, after animation ends\n if (!wasVisible) {\n setTimeout(() => {\n this.content.querySelector('a,button,[tabindex]')?.focus();\n }, 300);\n }\n }\n\n this.psv.trigger(EVENTS.OPEN_PANEL, config.id);\n }\n\n /**\n * @summary Hides the panel\n * @param {string} [id]\n * @fires PSV.close-panel\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n this.prop.visible = false;\n this.prop.contentId = undefined;\n\n this.content.innerHTML = null;\n this.container.classList.remove('psv-panel--open');\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.prop.clickHandler = null;\n }\n\n this.psv.trigger(EVENTS.CLOSE_PANEL, contentId);\n }\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n evt.stopPropagation();\n this.__startResize(evt);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchStart(evt) {\n evt.stopPropagation();\n this.__startResize(evt.changedTouches[0]);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.prop.mousedown = false;\n this.content.classList.remove('psv-panel-content--no-interaction');\n }\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.__resize(evt);\n }\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchMove(evt) {\n if (this.prop.mousedown) {\n this.__resize(evt.touches[0]);\n }\n }\n\n /**\n * @summary Initializes the panel resize\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startResize(evt) {\n this.prop.mouseX = evt.clientX;\n this.prop.mouseY = evt.clientY;\n this.prop.mousedown = true;\n this.content.classList.add('psv-panel-content--no-interaction');\n }\n\n /**\n * @summary Resizes the panel\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __resize(evt) {\n const x = evt.clientX;\n const y = evt.clientY;\n const width = Math.max(PANEL_MIN_WIDTH, this.container.offsetWidth - (x - this.prop.mouseX)) + 'px';\n\n if (this.prop.contentId) {\n this.prop.width[this.prop.contentId] = width;\n }\n\n this.container.style.width = width;\n\n this.prop.mouseX = x;\n this.prop.mouseY = y;\n }\n\n}\n","/**\n * @namespace PSV.services\n */\n\n/**\n * @summary Base services class\n * @memberof PSV.services\n * @abstract\n */\nexport class AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n\n /**\n * @summary Configuration holder\n * @type {PSV.Options}\n * @readonly\n */\n this.config = psv.config;\n\n /**\n * @summary Properties holder\n * @type {Object}\n * @readonly\n */\n this.prop = psv.prop;\n }\n\n /**\n * @summary Destroys the service\n */\n destroy() {\n delete this.psv;\n delete this.config;\n delete this.prop;\n }\n\n}\n","import * as THREE from 'three';\nimport { MESH_USER_DATA, SPHERE_RADIUS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { applyEulerInverse, parseAngle, parseSpeed } from '../utils';\nimport { AbstractService } from './AbstractService';\n\nconst vector2 = new THREE.Vector2();\nconst vector3 = new THREE.Vector3();\nconst eulerZero = new THREE.Euler(0, 0, 0, 'ZXY');\n\n/**\n * @summary Collections of data converters for the current viewer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class DataHelper extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n }\n\n /**\n * @summary Converts vertical FOV to zoom level\n * @param {number} fov\n * @returns {number}\n */\n fovToZoomLevel(fov) {\n const temp = Math.round((fov - this.config.minFov) / (this.config.maxFov - this.config.minFov) * 100);\n return temp - 2 * (temp - 50);\n }\n\n /**\n * @summary Converts zoom level to vertical FOV\n * @param {number} level\n * @returns {number}\n */\n zoomLevelToFov(level) {\n return this.config.maxFov + (level / 100) * (this.config.minFov - this.config.maxFov);\n }\n\n /**\n * @summary Convert vertical FOV to horizontal FOV\n * @param {number} vFov\n * @returns {number}\n */\n vFovToHFov(vFov) {\n return THREE.MathUtils.radToDeg(2 * Math.atan(Math.tan(THREE.MathUtils.degToRad(vFov) / 2) * this.prop.aspect));\n }\n\n /**\n * @summary Converts a speed into a duration from current position to a new position\n * @param {string|number} value\n * @param {number} angle\n * @returns {number}\n */\n speedToDuration(value, angle) {\n if (!value || typeof value !== 'number') {\n // desired radial speed\n const speed = value ? parseSpeed(value) : this.config.autorotateSpeed;\n // compute duration\n return angle / Math.abs(speed) * 1000;\n }\n else {\n return Math.abs(value);\n }\n }\n\n /**\n * @summary Converts pixel texture coordinates to spherical radians coordinates\n * @param {PSV.Point} point\n * @returns {PSV.Position}\n * @throws {PSV.PSVError} when the current adapter does not support texture coordinates\n */\n textureCoordsToSphericalCoords(point) {\n const panoData = this.prop.panoData;\n if (!panoData) {\n throw new PSVError('Current adapter does not support texture coordinates.');\n }\n\n const relativeX = (point.x + panoData.croppedX) / panoData.fullWidth * Math.PI * 2;\n const relativeY = (point.y + panoData.croppedY) / panoData.fullHeight * Math.PI;\n\n const result = {\n longitude: relativeX >= Math.PI ? relativeX - Math.PI : relativeX + Math.PI,\n latitude : Math.PI / 2 - relativeY,\n };\n\n // Apply panoData pose and sphereCorrection\n if (!eulerZero.equals(this.psv.renderer.mesh.rotation) || !eulerZero.equals(this.psv.renderer.meshContainer.rotation)) {\n this.sphericalCoordsToVector3(result, vector3);\n vector3.applyEuler(this.psv.renderer.mesh.rotation);\n vector3.applyEuler(this.psv.renderer.meshContainer.rotation);\n return this.vector3ToSphericalCoords(vector3);\n }\n else {\n return result;\n }\n }\n\n /**\n * @summary Converts spherical radians coordinates to pixel texture coordinates\n * @param {PSV.Position} position\n * @returns {PSV.Point}\n * @throws {PSV.PSVError} when the current adapter does not support texture coordinates\n */\n sphericalCoordsToTextureCoords(position) {\n const panoData = this.prop.panoData;\n if (!panoData) {\n throw new PSVError('Current adapter does not support texture coordinates.');\n }\n\n // Apply panoData pose and sphereCorrection\n if (!eulerZero.equals(this.psv.renderer.mesh.rotation) || !eulerZero.equals(this.psv.renderer.meshContainer.rotation)) {\n this.sphericalCoordsToVector3(position, vector3);\n applyEulerInverse(vector3, this.psv.renderer.meshContainer.rotation);\n applyEulerInverse(vector3, this.psv.renderer.mesh.rotation);\n position = this.vector3ToSphericalCoords(vector3);\n }\n\n const relativeLong = position.longitude / Math.PI / 2 * panoData.fullWidth;\n const relativeLat = position.latitude / Math.PI * panoData.fullHeight;\n\n return {\n x: Math.round(position.longitude < Math.PI ? relativeLong + panoData.fullWidth / 2 : relativeLong - panoData.fullWidth / 2) - panoData.croppedX,\n y: Math.round(panoData.fullHeight / 2 - relativeLat) - panoData.croppedY,\n };\n }\n\n /**\n * @summary Converts spherical radians coordinates to a THREE.Vector3\n * @param {PSV.Position} position\n * @param {external:THREE.Vector3} [vector]\n * @returns {external:THREE.Vector3}\n */\n sphericalCoordsToVector3(position, vector) {\n if (!vector) {\n vector = new THREE.Vector3();\n }\n vector.x = SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude);\n vector.y = SPHERE_RADIUS * Math.sin(position.latitude);\n vector.z = SPHERE_RADIUS * Math.cos(position.latitude) * Math.cos(position.longitude);\n return vector;\n }\n\n /**\n * @summary Converts a THREE.Vector3 to spherical radians coordinates\n * @param {external:THREE.Vector3} vector\n * @returns {PSV.Position}\n */\n vector3ToSphericalCoords(vector) {\n const phi = Math.acos(vector.y / Math.sqrt(vector.x * vector.x + vector.y * vector.y + vector.z * vector.z));\n const theta = Math.atan2(vector.x, vector.z);\n\n return {\n longitude: theta < 0 ? -theta : Math.PI * 2 - theta,\n latitude : Math.PI / 2 - phi,\n };\n }\n\n /**\n * @summary Converts position on the viewer to a THREE.Vector3\n * @param {PSV.Point} viewerPoint\n * @returns {external:THREE.Vector3}\n */\n viewerCoordsToVector3(viewerPoint) {\n const sphereIntersect = this.getIntersections(viewerPoint).filter(i => i.object.userData[MESH_USER_DATA]);\n\n if (sphereIntersect.length) {\n return sphereIntersect[0].point;\n }\n else {\n return null;\n }\n }\n\n /**\n * @summary Converts a THREE.Vector3 to position on the viewer\n * @param {external:THREE.Vector3} vector\n * @returns {PSV.Point}\n */\n vector3ToViewerCoords(vector) {\n const vectorClone = vector.clone();\n vectorClone.project(this.psv.renderer.camera);\n\n return {\n x: Math.round((vectorClone.x + 1) / 2 * this.prop.size.width),\n y: Math.round((1 - vectorClone.y) / 2 * this.prop.size.height),\n };\n }\n\n /**\n * @summary Converts spherical radians coordinates to position on the viewer\n * @param {PSV.Position} position\n * @returns {PSV.Point}\n */\n sphericalCoordsToViewerCoords(position) {\n return this.vector3ToViewerCoords(this.sphericalCoordsToVector3(position, vector3));\n }\n\n /**\n * @summary Returns intersections with objects in the scene\n * @param {PSV.Point} viewerPoint\n * @return {external:THREE.Intersection[]}\n */\n getIntersections(viewerPoint) {\n vector2.x = 2 * viewerPoint.x / this.prop.size.width - 1;\n vector2.y = -2 * viewerPoint.y / this.prop.size.height + 1;\n\n this.psv.renderer.raycaster.setFromCamera(vector2, this.psv.renderer.camera);\n\n return this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children, true)\n .filter(i => !!i.object.userData);\n }\n\n /**\n * @summary Converts x/y to latitude/longitude if present and ensure boundaries\n * @param {PSV.ExtendedPosition} position\n * @returns {PSV.Position}\n */\n cleanPosition(position) {\n if (position.x !== undefined && position.y !== undefined) {\n return this.textureCoordsToSphericalCoords(position);\n }\n else {\n return {\n longitude: parseAngle(position.longitude),\n latitude : parseAngle(position.latitude, true),\n };\n }\n }\n\n /**\n * @summary Ensure a SphereCorrection object is valid\n * @param {PSV.SphereCorrection} sphereCorrection\n * @returns {PSV.SphereCorrection}\n */\n cleanSphereCorrection(sphereCorrection) {\n return {\n pan : parseAngle(sphereCorrection?.pan || 0),\n tilt: parseAngle(sphereCorrection?.tilt || 0, true),\n roll: parseAngle(sphereCorrection?.roll || 0, true, false),\n };\n }\n\n /**\n * @summary Parse the pose angles of the pano data\n * @param {PSV.PanoData} panoData\n * @returns {PSV.SphereCorrection}\n */\n cleanPanoramaPose(panoData) {\n return {\n pan : THREE.MathUtils.degToRad(panoData?.poseHeading || 0),\n tilt: THREE.MathUtils.degToRad(panoData?.posePitch || 0),\n roll: THREE.MathUtils.degToRad(panoData?.poseRoll || 0),\n };\n }\n\n}\n","import * as THREE from 'three';\nimport {\n ACTIONS,\n CTRLZOOM_TIMEOUT,\n DBLCLICK_DELAY,\n EVENTS,\n IDS,\n INERTIA_WINDOW,\n KEY_CODES,\n LONGTOUCH_DELAY,\n MOVE_THRESHOLD,\n OBJECT_EVENTS,\n TWOFINGERSOVERLAY_DELAY\n} from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport gestureIcon from '../icons/gesture.svg';\nimport mousewheelIcon from '../icons/mousewheel.svg';\nimport { clone, distance, each, getClosest, getPosition, isEmpty, isFullscreenEnabled, normalizeWheel, throttle } from '../utils';\nimport { Animation } from '../utils/Animation';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Events handler\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class EventsHandler extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @property {number} moveThreshold - computed threshold based on device pixel ratio\n * @property {boolean} moving - is the user moving\n * @property {boolean} zooming - is the user zooming\n * @property {number} startMouseX - start x position of the click/touch\n * @property {number} startMouseY - start y position of the click/touch\n * @property {number} mouseX - current x position of the cursor\n * @property {number} mouseY - current y position of the cursor\n * @property {number[][]} mouseHistory - list of latest positions of the cursor, [time, x, y]\n * @property {number} pinchDist - distance between fingers when zooming\n * @property {PressHandler} keyHandler\n * @property {boolean} ctrlKeyDown - when the Ctrl key is pressed\n * @property {PSV.ClickData} dblclickData - temporary storage of click data between two clicks\n * @property {number} dblclickTimeout - timeout id for double click\n * @property {number} twofingersTimeout - timeout id for \"two fingers\" overlay\n * @property {number} ctrlZoomTimeout - timeout id for \"ctrol zoom\" overlay\n * @protected\n */\n this.state = {\n moveThreshold : MOVE_THRESHOLD * SYSTEM.pixelRatio,\n keyboardEnabled : false,\n moving : false,\n zooming : false,\n startMouseX : 0,\n startMouseY : 0,\n mouseX : 0,\n mouseY : 0,\n mouseHistory : [],\n pinchDist : 0,\n keyHandler : new PressHandler(),\n ctrlKeyDown : false,\n dblclickData : null,\n dblclickTimeout : null,\n longtouchTimeout : null,\n twofingersTimeout: null,\n ctrlZoomTimeout : null,\n };\n\n /**\n * @summary Throttled wrapper of {@link PSV.Viewer#autoSize}\n * @type {Function}\n * @private\n */\n this.__onResize = throttle(() => this.psv.autoSize(), 50);\n }\n\n /**\n * @summary Initializes event handlers\n * @protected\n */\n init() {\n window.addEventListener('resize', this);\n window.addEventListener('keydown', this);\n window.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseenter', this);\n this.psv.container.addEventListener('mousedown', this);\n this.psv.container.addEventListener('mouseleave', this);\n this.psv.container.addEventListener('mousemove', this);\n window.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchstart', this);\n this.psv.container.addEventListener('touchmove', this);\n window.addEventListener('touchend', this);\n this.psv.container.addEventListener(SYSTEM.mouseWheelEvent, this);\n\n if (SYSTEM.fullscreenEvent) {\n document.addEventListener(SYSTEM.fullscreenEvent, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n window.removeEventListener('resize', this);\n window.removeEventListener('keydown', this);\n window.removeEventListener('keyup', this);\n this.psv.container.removeEventListener('mouseenter', this);\n this.psv.container.removeEventListener('mousedown', this);\n this.psv.container.removeEventListener('mouseleave', this);\n this.psv.container.removeEventListener('mousemove', this);\n window.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchstart', this);\n this.psv.container.removeEventListener('touchmove', this);\n window.removeEventListener('touchend', this);\n this.psv.container.removeEventListener(SYSTEM.mouseWheelEvent, this);\n\n if (SYSTEM.fullscreenEvent) {\n document.removeEventListener(SYSTEM.fullscreenEvent, this);\n }\n\n clearTimeout(this.state.dblclickTimeout);\n clearTimeout(this.state.longtouchTimeout);\n clearTimeout(this.state.twofingersTimeout);\n clearTimeout(this.state.ctrlZoomTimeout);\n\n delete this.state;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} evt\n * @private\n */\n handleEvent(evt) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'resize': this.__onResize(); break;\n case 'keydown': this.__onKeyDown(evt); break;\n case 'keyup': this.__onKeyUp(); break;\n case 'mouseup': this.__onMouseUp(evt); break;\n case 'touchend': this.__onTouchEnd(evt); break;\n case SYSTEM.fullscreenEvent: this.__fullscreenToggled(); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n if (!getClosest(evt.target, '.psv-navbar') && !getClosest(evt.target, '.psv-panel')) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(evt); break;\n case 'mouseenter': this.__onMouseEnter(evt); break;\n case 'mouseleave': this.__onMouseLeave(evt); break;\n case 'mousemove': this.__onMouseMove(evt); break;\n case 'touchstart': this.__onTouchStart(evt); break;\n case 'touchmove': this.__onTouchMove(evt); break;\n case SYSTEM.mouseWheelEvent: this.__onMouseWheel(evt); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n }\n\n /**\n * @summary Enables the keyboard controls\n * @protected\n */\n enableKeyboard() {\n this.state.keyboardEnabled = true;\n }\n\n /**\n * @summary Disables the keyboard controls\n * @protected\n */\n disableKeyboard() {\n this.state.keyboardEnabled = false;\n }\n\n /**\n * @summary Handles keyboard events\n * @param {KeyboardEvent} e\n * @private\n */\n __onKeyDown(e) {\n if (this.config.mousewheelCtrlKey) {\n this.state.ctrlKeyDown = e.key === KEY_CODES.Control;\n\n if (this.state.ctrlKeyDown) {\n clearTimeout(this.state.ctrlZoomTimeout);\n this.psv.overlay.hide(IDS.CTRL_ZOOM);\n }\n }\n\n const e2 = this.psv.trigger(EVENTS.KEY_PRESS, e.key);\n if (e2.isDefaultPrevented()) {\n return;\n }\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n if (this.config.keyboard[e.key] === ACTIONS.TOGGLE_AUTOROTATE) {\n this.psv.toggleAutorotate();\n }\n else if (this.config.keyboard[e.key] && !this.state.keyHandler.time) {\n /* eslint-disable */\n switch (this.config.keyboard[e.key]) {\n // @formatter:off\n case ACTIONS.ROTATE_LAT_UP: this.psv.dynamics.position.roll({latitude: false}); break;\n case ACTIONS.ROTATE_LAT_DOWN: this.psv.dynamics.position.roll({latitude: true}); break;\n case ACTIONS.ROTATE_LONG_RIGHT: this.psv.dynamics.position.roll({longitude: false}); break;\n case ACTIONS.ROTATE_LONG_LEFT: this.psv.dynamics.position.roll({longitude: true}); break;\n case ACTIONS.ZOOM_IN: this.psv.dynamics.zoom.roll(false); break;\n case ACTIONS.ZOOM_OUT: this.psv.dynamics.zoom.roll(true); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n this.state.keyHandler.down();\n }\n }\n\n /**\n * @summary Handles keyboard events\n * @private\n */\n __onKeyUp() {\n this.state.ctrlKeyDown = false;\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n this.state.keyHandler.up(() => {\n this.psv.dynamics.position.stop();\n this.psv.dynamics.zoom.stop();\n });\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n if (!this.config.mousemove || this.config.captureCursor) {\n return;\n }\n\n this.__startMove(evt);\n }\n\n /**\n * @summary Handles mouse enter events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseEnter(evt) {\n if (!this.config.mousemove || !this.config.captureCursor) {\n return;\n }\n\n this.__startMove(evt);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (!this.config.mousemove || this.config.captureCursor) {\n return;\n }\n\n this.__stopMove(evt);\n }\n\n /**\n * @summary Handles mouse leave events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseLeave(evt) {\n if (!this.config.mousemove || !this.config.captureCursor) {\n return;\n }\n\n this.__stopMove(evt);\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (this.config.mousemove) {\n if (evt.buttons !== 0) {\n evt.preventDefault();\n this.__move(evt);\n }\n else if (this.config.captureCursor) {\n this.__moveAbsolute(evt);\n }\n }\n\n if (!isEmpty(this.prop.objectsObservers)) {\n const viewerPos = getPosition(this.psv.container);\n\n const viewerPoint = {\n x: evt.clientX - viewerPos.left,\n y: evt.clientY - viewerPos.top,\n };\n\n const intersections = this.psv.dataHelper.getIntersections(viewerPoint);\n\n const emit = (observer, key, type) => {\n observer.listener.handleEvent(new CustomEvent(type, {\n detail: {\n originalEvent: evt,\n object : observer.object,\n data : observer.object.userData[key],\n viewerPoint : viewerPoint,\n },\n }));\n };\n\n each(this.prop.objectsObservers, (observer, key) => {\n const intersection = intersections.find(i => i.object.userData[key]);\n\n if (intersection) {\n if (observer.object && intersection.object !== observer.object) {\n emit(observer, key, OBJECT_EVENTS.LEAVE_OBJECT);\n delete observer.object;\n }\n\n if (!observer.object) {\n observer.object = intersection.object;\n emit(observer, key, OBJECT_EVENTS.ENTER_OBJECT);\n }\n else {\n emit(observer, key, OBJECT_EVENTS.HOVER_OBJECT);\n }\n }\n else if (observer.object) {\n emit(observer, key, OBJECT_EVENTS.LEAVE_OBJECT);\n delete observer.object;\n }\n });\n }\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchStart(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n if (evt.touches.length === 1) {\n if (!this.config.touchmoveTwoFingers) {\n this.__startMove(evt.touches[0]);\n evt.preventDefault(); // prevent mouse events emulation\n }\n\n if (!this.prop.longtouchTimeout) {\n this.prop.longtouchTimeout = setTimeout(() => {\n this.__click(evt.touches[0], true);\n this.prop.longtouchTimeout = null;\n }, LONGTOUCH_DELAY);\n }\n }\n else if (evt.touches.length === 2) {\n this.__cancelLongTouch();\n this.__cancelTwoFingersOverlay();\n this.__startMoveZoom(evt);\n evt.preventDefault();\n }\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchEnd(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n this.__cancelLongTouch();\n this.__cancelTwoFingersOverlay();\n\n if (evt.touches.length === 1) {\n this.__stopMoveZoom();\n }\n else if (evt.touches.length === 0) {\n this.__stopMove(evt.changedTouches[0]);\n }\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchMove(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n this.__cancelLongTouch();\n\n if (evt.touches.length === 1) {\n if (this.config.touchmoveTwoFingers) {\n if (!this.prop.twofingersTimeout) {\n this.prop.twofingersTimeout = setTimeout(() => {\n this.psv.overlay.show({\n id : IDS.TWO_FINGERS,\n image: gestureIcon,\n text : this.config.lang.twoFingers,\n });\n }, TWOFINGERSOVERLAY_DELAY);\n }\n }\n else {\n evt.preventDefault();\n this.__move(evt.touches[0]);\n }\n }\n else if (evt.touches.length === 2) {\n evt.preventDefault();\n this.__moveZoom(evt);\n this.__cancelTwoFingersOverlay();\n }\n }\n\n /**\n * @summary Cancel the long touch timer if any\n * @private\n */\n __cancelLongTouch() {\n if (this.prop.longtouchTimeout) {\n clearTimeout(this.prop.longtouchTimeout);\n this.prop.longtouchTimeout = null;\n }\n }\n\n /**\n * @summary Cancel the two fingers overlay timer if any\n * @private\n */\n __cancelTwoFingersOverlay() {\n if (this.prop.twofingersTimeout) {\n clearTimeout(this.prop.twofingersTimeout);\n this.prop.twofingersTimeout = null;\n }\n this.psv.overlay.hide(IDS.TWO_FINGERS);\n }\n\n /**\n * @summary Handles mouse wheel events\n * @param {WheelEvent} evt\n * @private\n */\n __onMouseWheel(evt) {\n if (!this.config.mousewheel) {\n return;\n }\n\n if (this.config.mousewheelCtrlKey && !this.state.ctrlKeyDown) {\n this.psv.overlay.show({\n id : IDS.CTRL_ZOOM,\n image: mousewheelIcon,\n text : this.config.lang.ctrlZoom,\n });\n\n clearTimeout(this.state.ctrlZoomTimeout);\n this.state.ctrlZoomTimeout = setTimeout(() => this.psv.overlay.hide(IDS.CTRL_ZOOM), CTRLZOOM_TIMEOUT);\n\n return;\n }\n\n evt.preventDefault();\n evt.stopPropagation();\n\n const delta = normalizeWheel(evt).spinY * 5 * this.config.zoomSpeed;\n if (delta !== 0) {\n this.psv.dynamics.zoom.step(-delta, 5);\n }\n }\n\n /**\n * @summary Handles fullscreen events\n * @param {boolean} [force] force state\n * @fires PSV.fullscreen-updated\n * @package\n */\n __fullscreenToggled(force) {\n this.prop.fullscreen = force !== undefined ? force : isFullscreenEnabled(this.psv.container);\n\n if (this.config.keyboard) {\n if (this.prop.fullscreen) {\n this.psv.startKeyboardControl();\n }\n else {\n this.psv.stopKeyboardControl();\n }\n }\n\n this.psv.trigger(EVENTS.FULLSCREEN_UPDATED, this.prop.fullscreen);\n }\n\n /**\n * @summary Initializes the movement\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startMove(evt) {\n this.psv.stopAutorotate();\n this.psv.stopAnimation()\n .then(() => {\n this.state.mouseX = evt.clientX;\n this.state.mouseY = evt.clientY;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = false;\n\n this.state.mouseHistory.length = 0;\n this.__logMouseMove(evt);\n });\n }\n\n /**\n * @summary Initializes the combines move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __startMoveZoom(evt) {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n this.state.pinchDist = distance(p1, p2);\n this.state.mouseX = (p1.x + p2.x) / 2;\n this.state.mouseY = (p1.y + p2.y) / 2;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = true;\n }\n\n /**\n * @summary Stops the movement\n * @description If the move threshold was not reached a click event is triggered, otherwise an animation is launched to simulate inertia\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMove(evt) {\n if (!getClosest(evt.target, '.psv-container')) {\n this.state.moving = false;\n this.state.mouseHistory.length = 0;\n return;\n }\n\n if (this.state.moving) {\n // move threshold to trigger a click\n if (Math.abs(evt.clientX - this.state.startMouseX) < this.state.moveThreshold\n && Math.abs(evt.clientY - this.state.startMouseY) < this.state.moveThreshold) {\n this.__click(evt);\n this.state.moving = false;\n }\n // inertia animation\n else if (this.config.moveInertia) {\n this.__logMouseMove(evt);\n this.__stopMoveInertia(evt);\n }\n else {\n this.state.moving = false;\n }\n\n this.state.mouseHistory.length = 0;\n }\n }\n\n /**\n * @summary Stops the combined move and zoom\n * @private\n */\n __stopMoveZoom() {\n this.state.mouseHistory.length = 0;\n this.state.moving = false;\n this.state.zooming = false;\n }\n\n /**\n * @summary Performs an animation to simulate inertia when the movement stops\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMoveInertia(evt) {\n const direction = {\n x: evt.clientX - this.state.mouseHistory[0][1],\n y: evt.clientY - this.state.mouseHistory[0][2],\n };\n\n const norm = Math.sqrt(direction.x * direction.x + direction.y * direction.y);\n\n this.prop.animationPromise = new Animation({\n properties: {\n clientX: { start: evt.clientX, end: evt.clientX + direction.x },\n clientY: { start: evt.clientY, end: evt.clientY + direction.y },\n },\n duration : norm * INERTIA_WINDOW / 100,\n easing : 'outCirc',\n onTick : (properties) => {\n this.__move(properties, false);\n },\n });\n\n this.prop.animationPromise\n .then(() => {\n this.state.moving = false;\n });\n }\n\n /**\n * @summary Triggers an event with all coordinates when a simple click is performed\n * @param {MouseEvent|Touch} evt\n * @param {boolean} [longtouch=false]\n * @fires PSV.click\n * @fires PSV.dblclick\n * @private\n */\n __click(evt, longtouch = false) {\n const boundingRect = this.psv.container.getBoundingClientRect();\n\n /**\n * @type {PSV.ClickData}\n */\n const data = {\n rightclick: longtouch || evt.button === 2,\n target : evt.target,\n clientX : evt.clientX,\n clientY : evt.clientY,\n viewerX : evt.clientX - boundingRect.left,\n viewerY : evt.clientY - boundingRect.top,\n };\n\n const intersections = this.psv.dataHelper.getIntersections({\n x: data.viewerX,\n y: data.viewerY,\n });\n\n const sphereIntersection = intersections.find(i => i.object.userData.psvSphere);\n\n if (sphereIntersection) {\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(sphereIntersection.point);\n data.longitude = sphericalCoords.longitude;\n data.latitude = sphericalCoords.latitude;\n\n data.objects = intersections.map(i => i.object).filter(o => !o.userData.psvSphere);\n\n try {\n const textureCoords = this.psv.dataHelper.sphericalCoordsToTextureCoords(data);\n data.textureX = textureCoords.x;\n data.textureY = textureCoords.y;\n }\n catch (e) {\n data.textureX = NaN;\n data.textureY = NaN;\n }\n\n if (!this.state.dblclickTimeout) {\n this.psv.trigger(EVENTS.CLICK, data);\n\n this.state.dblclickData = clone(data);\n this.state.dblclickTimeout = setTimeout(() => {\n this.state.dblclickTimeout = null;\n this.state.dblclickData = null;\n }, DBLCLICK_DELAY);\n }\n else {\n if (Math.abs(this.state.dblclickData.clientX - data.clientX) < this.state.moveThreshold\n && Math.abs(this.state.dblclickData.clientY - data.clientY) < this.state.moveThreshold) {\n this.psv.trigger(EVENTS.DOUBLE_CLICK, this.state.dblclickData);\n }\n\n clearTimeout(this.state.dblclickTimeout);\n this.state.dblclickTimeout = null;\n this.state.dblclickData = null;\n }\n }\n }\n\n /**\n * @summary Performs movement\n * @param {MouseEvent|Touch} evt\n * @param {boolean} [log=true]\n * @private\n */\n __move(evt, log) {\n if (this.state.moving) {\n const x = evt.clientX;\n const y = evt.clientY;\n\n const rotation = {\n longitude: (x - this.state.mouseX) / this.prop.size.width * this.config.moveSpeed * THREE.MathUtils.degToRad(this.prop.hFov),\n latitude : (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * THREE.MathUtils.degToRad(this.prop.vFov),\n };\n\n const currentPosition = this.psv.getPosition();\n this.psv.rotate({\n longitude: currentPosition.longitude - rotation.longitude,\n latitude : currentPosition.latitude + rotation.latitude,\n });\n\n this.state.mouseX = x;\n this.state.mouseY = y;\n\n if (log !== false) {\n this.__logMouseMove(evt);\n }\n }\n }\n\n /**\n * @summary Performs movement absolute to cursor position in viewer\n * @param {MouseEvent} evt\n * @private\n */\n __moveAbsolute(evt) {\n if (this.state.moving) {\n const containerRect = this.psv.container.getBoundingClientRect();\n this.psv.dynamics.position.goto({\n longitude: ((evt.clientX - containerRect.left) / containerRect.width - 0.5) * Math.PI * 2,\n latitude : -((evt.clientY - containerRect.top) / containerRect.height - 0.5) * Math.PI,\n }, 10);\n }\n }\n\n /**\n * @summary Perfoms combined move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __moveZoom(evt) {\n if (this.state.zooming && this.state.moving) {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n const p = distance(p1, p2);\n const delta = 80 * (p - this.state.pinchDist) / this.prop.size.width * this.config.zoomSpeed;\n\n this.psv.zoom(this.psv.getZoomLevel() + delta);\n\n this.__move({\n clientX: (p1.x + p2.x) / 2,\n clientY: (p1.y + p2.y) / 2,\n });\n\n this.state.pinchDist = p;\n }\n }\n\n /**\n * @summary Stores each mouse position during a mouse move\n * @description Positions older than \"INERTIA_WINDOW\" are removed
\n * Positions before a pause of \"INERTIA_WINDOW\" / 10 are removed\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __logMouseMove(evt) {\n const now = Date.now();\n this.state.mouseHistory.push([now, evt.clientX, evt.clientY]);\n\n let previous = null;\n\n for (let i = 0; i < this.state.mouseHistory.length;) {\n if (this.state.mouseHistory[0][i] < now - INERTIA_WINDOW) {\n this.state.mouseHistory.splice(i, 1);\n }\n else if (previous && this.state.mouseHistory[0][i] - previous > INERTIA_WINDOW / 10) {\n this.state.mouseHistory.splice(0, i);\n i = 0;\n previous = this.state.mouseHistory[0][i];\n }\n else {\n i++;\n previous = this.state.mouseHistory[0][i];\n }\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { Animation } from '../utils/Animation';\nimport { EVENTS, MESH_USER_DATA, SPHERE_RADIUS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { each, isExtendedPosition } from '../utils';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Viewer and renderer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class Renderer extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @member {external:THREE.WebGLRenderer}\n * @readonly\n * @protected\n */\n this.renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });\n this.renderer.setPixelRatio(SYSTEM.pixelRatio);\n this.renderer.domElement.className = 'psv-canvas';\n\n /**\n * @member {external:THREE.Scene}\n * @readonly\n * @protected\n */\n this.scene = new THREE.Scene();\n\n /**\n * @member {external:THREE.PerspectiveCamera}\n * @readonly\n * @protected\n */\n this.camera = new THREE.PerspectiveCamera(50, 16 / 9, 1, 2 * SPHERE_RADIUS);\n\n /**\n * @member {external:THREE.Mesh}\n * @readonly\n * @protected\n */\n this.mesh = this.psv.adapter.createMesh();\n this.mesh.userData = { [MESH_USER_DATA]: true };\n\n /**\n * @member {external:THREE.Group}\n * @readonly\n * @private\n */\n this.meshContainer = new THREE.Group();\n this.meshContainer.add(this.mesh);\n this.scene.add(this.meshContainer);\n\n /**\n * @member {external:THREE.Raycaster}\n * @readonly\n * @protected\n */\n this.raycaster = new THREE.Raycaster();\n\n /**\n * @member {number}\n * @private\n */\n this.timestamp = null;\n\n /**\n * @member {boolean}\n * @private\n */\n this.ready = false;\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @package\n */\n this.canvasContainer = document.createElement('div');\n this.canvasContainer.className = 'psv-canvas-container';\n this.canvasContainer.style.background = this.psv.config.canvasBackground;\n this.canvasContainer.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n this.canvasContainer.appendChild(this.renderer.domElement);\n this.psv.container.appendChild(this.canvasContainer);\n\n psv.on(EVENTS.SIZE_UPDATED, this);\n psv.on(EVENTS.ZOOM_UPDATED, this);\n psv.on(EVENTS.POSITION_UPDATED, this);\n psv.on(EVENTS.CONFIG_CHANGED, this);\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n // cancel render loop\n this.renderer.setAnimationLoop(null);\n\n // destroy ThreeJS view\n this.__cleanTHREEScene(this.scene);\n\n // remove container\n this.psv.container.removeChild(this.canvasContainer);\n\n delete this.canvasContainer;\n delete this.renderer;\n delete this.scene;\n delete this.camera;\n delete this.mesh;\n delete this.meshContainer;\n delete this.raycaster;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} evt\n * @private\n */\n handleEvent(evt) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case EVENTS.SIZE_UPDATED: this.__onSizeUpdated(); break;\n case EVENTS.ZOOM_UPDATED: this.__onZoomUpdated(); break;\n case EVENTS.POSITION_UPDATED: this.__onPositionUpdated(); break;\n case EVENTS.CONFIG_CHANGED:\n if (evt.args[0].includes('fisheye')) {\n this.__onPositionUpdated();\n }\n if (evt.args[0].includes('mousemove')) {\n this.canvasContainer.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n }\n break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Hides the viewer\n */\n hide() {\n this.canvasContainer.style.opacity = 0;\n }\n\n /**\n * @summary Shows the viewer\n */\n show() {\n this.canvasContainer.style.opacity = 1;\n }\n\n /**\n * @summary Updates the size of the renderer and the aspect of the camera\n * @private\n */\n __onSizeUpdated() {\n this.renderer.setSize(this.prop.size.width, this.prop.size.height);\n this.camera.aspect = this.prop.aspect;\n this.camera.updateProjectionMatrix();\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Updates the fov of the camera\n * @private\n */\n __onZoomUpdated() {\n this.camera.fov = this.prop.vFov;\n this.camera.updateProjectionMatrix();\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Updates the position of the camera\n * @private\n */\n __onPositionUpdated() {\n this.camera.position.set(0, 0, 0);\n this.camera.lookAt(this.prop.direction);\n if (this.config.fisheye) {\n this.camera.position.copy(this.prop.direction).multiplyScalar(this.config.fisheye / 2).negate();\n }\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Main event loop, calls {@link render} if `prop.needsUpdate` is true\n * @param {number} timestamp\n * @fires PSV.before-render\n * @private\n */\n __renderLoop(timestamp) {\n const elapsed = this.timestamp !== null ? timestamp - this.timestamp : 0;\n this.timestamp = timestamp;\n\n this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp, elapsed);\n each(this.psv.dynamics, d => d.update(elapsed));\n\n if (this.prop.needsUpdate) {\n this.render();\n this.prop.needsUpdate = false;\n }\n }\n\n /**\n * @summary Performs a render\n * @description Do not call this method directly, instead call\n * {@link PSV.Viewer#needsUpdate} on {@link PSV.event:before-render}.\n * @fires PSV.render\n */\n render() {\n this.renderer.render(this.scene, this.camera);\n this.psv.trigger(EVENTS.RENDER);\n }\n\n /**\n * @summary Applies the texture to the scene, creates the scene if needed\n * @param {PSV.TextureData} textureData\n * @fires PSV.panorama-loaded\n * @package\n */\n setTexture(textureData) {\n this.prop.panoData = textureData.panoData;\n\n this.psv.adapter.setTexture(this.mesh, textureData);\n\n if (!this.ready) {\n this.renderer.setAnimationLoop(t => this.__renderLoop(t));\n this.ready = true;\n }\n\n this.psv.needsUpdate();\n\n this.psv.trigger(EVENTS.PANORAMA_LOADED, textureData);\n }\n\n /**\n * @summary Apply a panorama data pose to a Mesh\n * @param {PSV.PanoData} [panoData]\n * @param {external:THREE.Mesh} [mesh=this.mesh]\n * @package\n */\n setPanoramaPose(panoData, mesh = this.mesh) {\n // By Google documentation the angles are applied on the camera in order : heading, pitch, roll\n // here we apply the reverse transformation on the sphere\n const cleanCorrection = this.psv.dataHelper.cleanPanoramaPose(panoData);\n\n mesh.rotation.set(\n -cleanCorrection.tilt,\n -cleanCorrection.pan,\n -cleanCorrection.roll,\n 'ZXY'\n );\n }\n\n /**\n * @summary Apply a SphereCorrection to a Mesh\n * @param {PSV.SphereCorrection} [sphereCorrection]\n * @param {external:THREE.Mesh} [mesh=this.meshContainer]\n * @package\n */\n setSphereCorrection(sphereCorrection, mesh = this.meshContainer) {\n const cleanCorrection = this.psv.dataHelper.cleanSphereCorrection(sphereCorrection);\n\n mesh.rotation.set(\n cleanCorrection.tilt,\n cleanCorrection.pan,\n cleanCorrection.roll,\n 'ZXY'\n );\n }\n\n /**\n * @summary Performs transition between the current and a new texture\n * @param {PSV.TextureData} textureData\n * @param {PSV.PanoramaOptions} options\n * @returns {PSV.Animation}\n * @package\n */\n transition(textureData, options) {\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n // create temp group and new mesh, half size to be in \"front\" of the first one\n const group = new THREE.Group();\n const mesh = this.psv.adapter.createMesh(0.5);\n this.psv.adapter.setTexture(mesh, textureData, true);\n this.psv.adapter.setTextureOpacity(mesh, 0);\n this.setPanoramaPose(textureData.panoData, mesh);\n this.setSphereCorrection(options.sphereCorrection, group);\n\n // rotate the new sphere to make the target position face the camera\n if (positionProvided) {\n const cleanPosition = this.psv.dataHelper.cleanPosition(options);\n const currentPosition = this.psv.getPosition();\n\n // Longitude rotation along the vertical axis\n const verticalAxis = new THREE.Vector3(0, 1, 0);\n group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - currentPosition.longitude);\n\n // Latitude rotation along the camera horizontal axis\n const horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.camera.getWorldDirection(new THREE.Vector3())).normalize();\n group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - currentPosition.latitude);\n }\n\n group.add(mesh);\n this.scene.add(group);\n\n const animation = new Animation({\n properties: {\n opacity: { start: 0.0, end: 1.0 },\n zoom : zoomProvided ? { start: this.psv.getZoomLevel(), end: options.zoom } : undefined,\n },\n duration : options.transition,\n easing : 'outCubic',\n onTick : (properties) => {\n this.psv.adapter.setTextureOpacity(mesh, properties.opacity);\n this.psv.adapter.setTextureOpacity(this.mesh, 1 - properties.opacity);\n\n if (zoomProvided) {\n this.psv.zoom(properties.zoom);\n }\n\n this.psv.needsUpdate();\n },\n });\n\n animation\n .then((completed) => {\n if (completed) {\n // remove temp sphere and transfer the texture to the main mesh\n this.setTexture(textureData);\n this.psv.adapter.setTextureOpacity(this.mesh, 1);\n this.setPanoramaPose(textureData.panoData);\n this.setSphereCorrection(options.sphereCorrection);\n\n // actually rotate the camera\n if (positionProvided) {\n this.psv.rotate(options);\n }\n }\n else {\n this.psv.adapter.disposeTexture(textureData);\n }\n\n this.scene.remove(group);\n mesh.geometry.dispose();\n mesh.geometry = null;\n });\n\n return animation;\n }\n\n /**\n * @summary Calls `dispose` on all objects and textures\n * @param {external:THREE.Object3D} object\n * @private\n */\n __cleanTHREEScene(object) {\n object.traverse((item) => {\n if (item.geometry) {\n item.geometry.dispose();\n }\n\n if (item.material) {\n if (Array.isArray(item.material)) {\n item.material.forEach((material) => {\n if (material.map) {\n material.map.dispose();\n }\n\n material.dispose();\n });\n }\n else {\n if (item.material.map) {\n item.material.map.dispose();\n }\n\n item.material.dispose();\n }\n }\n\n if (item.dispose && !(item instanceof THREE.Scene)) {\n item.dispose();\n }\n\n if (item !== object) {\n this.__cleanTHREEScene(item);\n }\n });\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Texture loader\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class TextureLoader extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @summary THREE file loader\n * @type {external:THREE:FileLoader}\n * @private\n */\n this.loader = new THREE.FileLoader();\n this.loader.setResponseType('blob');\n if (this.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.config.requestHeaders && typeof this.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.config.requestHeaders);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n this.abortLoading();\n super.destroy();\n }\n\n /**\n * @summary Loads the panorama texture(s)\n * @param {*} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @package\n * @deprecated\n */\n loadTexture(panorama, newPanoData) {\n return this.psv.adapter.loadTexture(panorama, newPanoData);\n }\n\n /**\n * @summary Cancels current HTTP requests\n * @package\n */\n abortLoading() {\n // noop implementation waiting for https://github.com/mrdoob/three.js/pull/23070\n }\n\n /**\n * @summary Loads a Blob with FileLoader\n * @param {string} url\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n */\n loadFile(url, onProgress) {\n if (this.config.requestHeaders && typeof this.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n let progress = 0;\n onProgress && onProgress(progress);\n\n this.loader.load(\n url,\n (result) => {\n progress = 100;\n onProgress && onProgress(progress);\n resolve(result);\n },\n (e) => {\n if (e.lengthComputable) {\n const newProgress = e.loaded / e.total * 100;\n if (newProgress > progress) {\n progress = newProgress;\n onProgress && onProgress(progress);\n }\n }\n },\n (err) => {\n reject(err);\n }\n );\n });\n }\n\n /**\n * @summary Loads an Image using FileLoader to have progress events\n * @param {string} url\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n */\n loadImage(url, onProgress) {\n return this.loadFile(url, onProgress)\n .then(result => new Promise((resolve, reject) => {\n const img = document.createElementNS('http://www.w3.org/1999/xhtml', 'img');\n img.onload = () => {\n URL.revokeObjectURL(img.src);\n resolve(img);\n };\n img.onerror = reject;\n img.src = URL.createObjectURL(result);\n }));\n }\n\n /**\n * @summary Preload a panorama file without displaying it\n * @param {*} panorama\n * @returns {Promise}\n */\n preloadPanorama(panorama) {\n if (this.psv.adapter.supportsPreload(panorama)) {\n return this.psv.adapter.loadTexture(panorama);\n }\n else {\n return Promise.resolve();\n }\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { addClasses, cleanPosition } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\nconst STATE = { NONE: 0, SHOWING: 1, HIDING: 2, READY: 3 };\n\n/**\n * @typedef {Object} PSV.components.Tooltip.Position\n * @summary Object defining the tooltip position\n * @property {number} top - Position of the tip of the arrow of the tooltip, in pixels\n * @property {number} left - Position of the tip of the arrow of the tooltip, in pixels\n * @property {string|string[]} [position='top center'] - Tooltip position toward it's arrow tip.\n * Accepted values are combinations of `top`, `center`, `bottom` and `left`, `center`, `right`\n * @property {Object} [box] - Used when displaying a tooltip on a marker\n * @property {number} [box.width=0]\n * @property {number} [box.height=0]\n */\n\n/**\n * @typedef {PSV.components.Tooltip.Position} PSV.components.Tooltip.Config\n * @summary Object defining the tooltip configuration\n * @property {string} content - HTML content of the tooltip\n * @property {string} [className] - Additional CSS class added to the tooltip\n * @property {*} [data] - Userdata associated to the tooltip\n */\n\n/**\n * @summary Tooltip component\n * @description Never instanciate tooltips directly use {@link PSV.services.TooltipRenderer} instead\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Tooltip extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n * @param {{arrow: number, offset: number}} size\n */\n constructor(psv, size) {\n super(psv, 'psv-tooltip');\n\n /**\n * @override\n * @property {number} arrow\n * @property {number} offset\n * @property {number} width\n * @property {number} height\n * @property {string} pos\n * @property {string} state\n * @property {*} data\n */\n this.prop = {\n ...this.prop,\n ...size,\n state : STATE.NONE,\n width : 0,\n height: 0,\n pos : '',\n data : null,\n };\n\n /**\n * Tooltip content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-tooltip-content';\n this.container.appendChild(this.content);\n\n /**\n * Tooltip arrow\n * @member {HTMLElement}\n * @readonly\n * @package\n */\n this.arrow = document.createElement('div');\n this.arrow.className = 'psv-tooltip-arrow';\n this.container.appendChild(this.arrow);\n\n this.container.addEventListener('transitionend', this);\n\n this.container.style.top = '-1000px';\n this.container.style.left = '-1000px';\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.arrow;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'transitionend': this.__onTransitionEnd(e); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Tooltip cannot be toggled');\n }\n\n /**\n * @summary Displays the tooltip on the viewer\n * Do not call this method directly, use {@link PSV.services.TooltipRenderer} instead.\n * @param {PSV.components.Tooltip.Config} config\n *\n * @fires PSV.show-tooltip\n * @throws {PSV.PSVError} when the configuration is incorrect\n *\n * @package\n */\n show(config) {\n if (this.prop.state !== STATE.NONE) {\n throw new PSVError('Initialized tooltip cannot be re-initialized');\n }\n\n if (config.className) {\n addClasses(this.container, config.className);\n }\n\n this.content.innerHTML = config.content;\n\n const rect = this.container.getBoundingClientRect();\n this.prop.width = rect.right - rect.left;\n this.prop.height = rect.bottom - rect.top;\n\n this.prop.state = STATE.READY;\n\n this.move(config);\n\n this.prop.data = config.data;\n this.prop.state = STATE.SHOWING;\n\n this.psv.trigger(EVENTS.SHOW_TOOLTIP, this.prop.data, this);\n }\n\n /**\n * @summary Moves the tooltip to a new position\n * @param {PSV.components.Tooltip.Position} config\n *\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n move(config) {\n if (this.prop.state !== STATE.SHOWING && this.prop.state !== STATE.READY) {\n throw new PSVError('Uninitialized tooltip cannot be moved');\n }\n\n const t = this.container;\n const a = this.arrow;\n\n // compute size\n const style = {\n posClass : cleanPosition(config.position, 'top center', false),\n width : this.prop.width,\n height : this.prop.height,\n top : 0,\n left : 0,\n arrowTop : 0,\n arrowLeft: 0,\n };\n\n // set initial position\n this.__computeTooltipPosition(style, config);\n\n // correct position if overflow\n let refresh = false;\n if (style.top < this.prop.offset) {\n style.posClass[0] = 'bottom';\n refresh = true;\n }\n else if (style.top + style.height > this.psv.prop.size.height - this.prop.offset) {\n style.posClass[0] = 'top';\n refresh = true;\n }\n if (style.left < this.prop.offset) {\n style.posClass[1] = 'right';\n refresh = true;\n }\n else if (style.left + style.width > this.psv.prop.size.width - this.prop.offset) {\n style.posClass[1] = 'left';\n refresh = true;\n }\n if (refresh) {\n this.__computeTooltipPosition(style, config);\n }\n\n // apply position\n t.style.top = style.top + 'px';\n t.style.left = style.left + 'px';\n\n a.style.top = style.arrowTop + 'px';\n a.style.left = style.arrowLeft + 'px';\n\n const newPos = style.posClass.join('-');\n if (newPos !== this.prop.pos) {\n t.classList.remove(`psv-tooltip--${this.prop.pos}`);\n\n this.prop.pos = newPos;\n t.classList.add(`psv-tooltip--${this.prop.pos}`);\n }\n }\n\n /**\n * @summary Hides the tooltip\n * @fires PSV.hide-tooltip\n */\n hide() {\n this.container.classList.remove('psv-tooltip--visible');\n this.prop.state = STATE.HIDING;\n\n this.psv.trigger(EVENTS.HIDE_TOOLTIP, this.prop.data);\n }\n\n /**\n * @summary Finalize transition\n * @param {TransitionEvent} e\n * @private\n */\n __onTransitionEnd(e) {\n if (e.propertyName === 'transform') {\n switch (this.prop.state) {\n case STATE.SHOWING:\n this.container.classList.add('psv-tooltip--visible');\n this.prop.state = STATE.READY;\n break;\n\n case STATE.HIDING:\n this.prop.state = STATE.NONE;\n this.destroy();\n break;\n\n default:\n // nothing\n }\n }\n }\n\n /**\n * @summary Computes the position of the tooltip and its arrow\n * @param {Object} style\n * @param {Object} config\n * @private\n */\n __computeTooltipPosition(style, config) {\n let topBottom = false;\n\n if (!config.box) {\n config.box = {\n width : 0,\n height: 0,\n };\n }\n\n switch (style.posClass[0]) {\n case 'bottom':\n style.top = config.top + config.box.height + this.prop.offset + this.prop.arrow;\n style.arrowTop = -this.prop.arrow * 2;\n topBottom = true;\n break;\n\n case 'center':\n style.top = config.top + config.box.height / 2 - style.height / 2;\n style.arrowTop = style.height / 2 - this.prop.arrow;\n break;\n\n case 'top':\n style.top = config.top - style.height - this.prop.offset - this.prop.arrow;\n style.arrowTop = style.height;\n topBottom = true;\n break;\n\n // no default\n }\n\n switch (style.posClass[1]) {\n case 'right':\n if (topBottom) {\n style.left = config.left + config.box.width / 2 - this.prop.offset - this.prop.arrow;\n style.arrowLeft = this.prop.offset;\n }\n else {\n style.left = config.left + config.box.width + this.prop.offset + this.prop.arrow;\n style.arrowLeft = -this.prop.arrow * 2;\n }\n break;\n\n case 'center':\n style.left = config.left + config.box.width / 2 - style.width / 2;\n style.arrowLeft = style.width / 2 - this.prop.arrow;\n break;\n\n case 'left':\n if (topBottom) {\n style.left = config.left - style.width + config.box.width / 2 + this.prop.offset + this.prop.arrow;\n style.arrowLeft = style.width - this.prop.offset - this.prop.arrow * 2;\n }\n else {\n style.left = config.left - style.width - this.prop.offset - this.prop.arrow;\n style.arrowLeft = style.width;\n }\n break;\n\n // no default\n }\n }\n\n}\n","import { Tooltip } from '../components/Tooltip';\nimport { getStyle } from '../utils';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Tooltip renderer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class TooltipRenderer extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n const testTooltip = new Tooltip(this.psv);\n\n /**\n * @summary Computed static sizes\n * @member {Object}\n * @package\n * @property {number} arrowSize\n * @property {number} offset\n */\n this.size = {\n arrow : parseInt(getStyle(testTooltip.arrow, 'borderTopWidth'), 10),\n offset: parseInt(getStyle(testTooltip.container, 'outlineWidth'), 10),\n };\n\n testTooltip.destroy();\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.size;\n\n super.destroy();\n }\n\n /**\n * @summary Displays a tooltip on the viewer\n * @param {PSV.components.Tooltip.Config} config\n * @returns {PSV.components.Tooltip}\n *\n * @fires PSV.show-tooltip\n * @throws {PSV.PSVError} when the configuration is incorrect\n *\n * @example\n * viewer.tooltip.create({ content: 'Hello world', top: 200, left: 450, position: 'center bottom'})\n */\n create(config) {\n const tooltip = new Tooltip(this.psv, this.size);\n tooltip.show(config);\n\n return tooltip;\n }\n\n}\n","import * as THREE from 'three';\nimport { EventEmitter } from 'uevent';\nimport { Loader } from './components/Loader';\nimport { Navbar } from './components/Navbar';\nimport { Notification } from './components/Notification';\nimport { Overlay } from './components/Overlay';\nimport { Panel } from './components/Panel';\nimport { CONFIG_PARSERS, DEFAULTS, DEPRECATED_OPTIONS, getConfig, READONLY_OPTIONS } from './data/config';\nimport { CHANGE_EVENTS, DEFAULT_TRANSITION, EVENTS, IDS, SPHERE_RADIUS, VIEWER_DATA } from './data/constants';\nimport { SYSTEM } from './data/system';\nimport errorIcon from './icons/error.svg';\nimport { AbstractPlugin } from './plugins/AbstractPlugin';\nimport { PSVError } from './PSVError';\nimport { DataHelper } from './services/DataHelper';\nimport { EventsHandler } from './services/EventsHandler';\nimport { Renderer } from './services/Renderer';\nimport { TextureLoader } from './services/TextureLoader';\nimport { TooltipRenderer } from './services/TooltipRenderer';\nimport {\n Animation,\n Dynamic,\n each,\n exitFullscreen,\n getAbortError,\n getAngle,\n getShortestArc,\n isAbortError,\n isExtendedPosition,\n isFullscreenEnabled,\n logWarn,\n MultiDynamic,\n pluginInterop,\n requestFullscreen,\n throttle,\n toggleClass\n} from './utils';\n\nTHREE.Cache.enabled = true;\n\n/**\n * @summary Main class\n * @memberOf PSV\n * @extends {external:uEvent.EventEmitter}\n */\nexport class Viewer extends EventEmitter {\n\n /**\n * @param {PSV.Options} options\n * @fires PSV.ready\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n constructor(options) {\n super();\n\n SYSTEM.load();\n\n // must support WebGL\n if (!SYSTEM.isWebGLSupported) {\n throw new PSVError('WebGL is not supported.');\n }\n\n if (SYSTEM.maxTextureWidth === 0) {\n throw new PSVError('Unable to detect system capabilities');\n }\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} ready - when all components are loaded\n * @property {boolean} uiRefresh - if the UI needs to be renderer\n * @property {boolean} needsUpdate - if the view needs to be renderer\n * @property {boolean} fullscreen - if the viewer is currently fullscreen\n * @property {external:THREE.Vector3} direction - direction of the camera\n * @property {number} vFov - vertical FOV\n * @property {number} hFov - horizontal FOV\n * @property {number} aspect - viewer aspect ratio\n * @property {boolean} autorotateEnabled - automatic rotation is enabled\n * @property {PSV.Animation} animationPromise - promise of the current animation\n * @property {Promise} loadingPromise - promise of the setPanorama method\n * @property startTimeout - timeout id of the automatic rotation delay\n * @property {object} objectsObservers\n * @property {PSV.Size} size - size of the container\n * @property {PSV.PanoData} panoData - panorama metadata, if supported\n */\n this.prop = {\n ready : false,\n uiRefresh : false,\n needsUpdate : false,\n fullscreen : false,\n direction : new THREE.Vector3(0, 0, SPHERE_RADIUS),\n vFov : null,\n hFov : null,\n aspect : null,\n autorotateEnabled: false,\n animationPromise : null,\n loadingPromise : null,\n startTimeout : null,\n objectsObservers : {},\n size : {\n width : 0,\n height: 0,\n },\n panoData : {\n fullWidth : 0,\n fullHeight : 0,\n croppedWidth : 0,\n croppedHeight: 0,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n },\n };\n\n /**\n * @summary Configuration holder\n * @type {PSV.Options}\n * @readonly\n */\n this.config = getConfig(options);\n\n /**\n * @summary Top most parent\n * @member {HTMLElement}\n * @readonly\n */\n this.parent = (typeof options.container === 'string') ? document.getElementById(options.container) : options.container;\n this.parent[VIEWER_DATA] = this;\n\n /**\n * @summary Main container\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.classList.add('psv-container');\n this.parent.appendChild(this.container);\n\n /**\n * @summary Render adapter\n * @type {PSV.adapters.AbstractAdapter}\n * @readonly\n * @package\n */\n this.adapter = new this.config.adapter[0](this, this.config.adapter[1]); // eslint-disable-line new-cap\n\n /**\n * @summary All child components\n * @type {PSV.components.AbstractComponent[]}\n * @readonly\n * @package\n */\n this.children = [];\n\n /**\n * @summary All plugins\n * @type {Object}\n * @readonly\n * @package\n */\n this.plugins = {};\n\n /**\n * @type {PSV.services.Renderer}\n * @readonly\n */\n this.renderer = new Renderer(this);\n\n /**\n * @type {PSV.services.TextureLoader}\n * @readonly\n */\n this.textureLoader = new TextureLoader(this);\n\n /**\n * @type {PSV.services.EventsHandler}\n * @readonly\n */\n this.eventsHandler = new EventsHandler(this);\n\n /**\n * @type {PSV.services.DataHelper}\n * @readonly\n */\n this.dataHelper = new DataHelper(this);\n\n /**\n * @member {PSV.components.Loader}\n * @readonly\n */\n this.loader = new Loader(this);\n\n /**\n * @member {PSV.components.Navbar}\n * @readonly\n */\n this.navbar = new Navbar(this);\n\n /**\n * @member {PSV.components.Panel}\n * @readonly\n */\n this.panel = new Panel(this);\n\n /**\n * @member {PSV.services.TooltipRenderer}\n * @readonly\n */\n this.tooltip = new TooltipRenderer(this);\n\n /**\n * @member {PSV.components.Notification}\n * @readonly\n */\n this.notification = new Notification(this);\n\n /**\n * @member {PSV.components.Overlay}\n * @readonly\n */\n this.overlay = new Overlay(this);\n\n /**\n * @member {Record}\n * @package\n */\n this.dynamics = {\n zoom: new Dynamic((value) => {\n this.prop.vFov = this.dataHelper.zoomLevelToFov(value);\n this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov);\n this.trigger(EVENTS.ZOOM_UPDATED, value);\n }, this.config.defaultZoomLvl, 0, 100),\n\n position: new MultiDynamic({\n longitude: new Dynamic(null, this.config.defaultLong, 0, 2 * Math.PI, true),\n latitude : new Dynamic(null, this.config.defaultLat, -Math.PI / 2, Math.PI / 2),\n }, (position) => {\n this.dataHelper.sphericalCoordsToVector3(position, this.prop.direction);\n this.trigger(EVENTS.POSITION_UPDATED, position);\n }),\n };\n\n this.__updateSpeeds();\n\n this.eventsHandler.init();\n\n this.__resizeRefresh = throttle(() => this.refreshUi('resize'), 500);\n\n // apply container size\n this.resize(this.config.size);\n\n // init plugins\n this.config.plugins.forEach(([plugin, opts]) => {\n this.plugins[plugin.id] = new plugin(this, opts); // eslint-disable-line new-cap\n });\n each(this.plugins, plugin => plugin.init?.());\n\n // init buttons\n this.navbar.setButtons(this.config.navbar);\n\n // load panorama\n if (this.config.panorama) {\n this.setPanorama(this.config.panorama);\n }\n\n toggleClass(this.container, 'psv--is-touch', SYSTEM.isTouchEnabled.initial);\n SYSTEM.isTouchEnabled.promise.then(enabled => toggleClass(this.container, 'psv--is-touch', enabled));\n\n // enable GUI after first render\n this.once(EVENTS.RENDER, () => {\n if (this.config.navbar) {\n this.container.classList.add('psv--has-navbar');\n this.navbar.show();\n }\n\n // Queue autorotate\n if (this.config.autorotateDelay) {\n this.prop.startTimeout = setTimeout(() => this.startAutorotate(), this.config.autorotateDelay);\n }\n\n this.prop.ready = true;\n\n setTimeout(() => {\n this.refreshUi('init');\n\n this.trigger(EVENTS.READY);\n }, 0);\n });\n }\n\n /**\n * @summary Destroys the viewer\n * @description The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible.\n */\n destroy() {\n this.__stopAll();\n this.stopKeyboardControl();\n this.exitFullscreen();\n\n this.eventsHandler.destroy();\n this.renderer.destroy();\n this.textureLoader.destroy();\n this.dataHelper.destroy();\n this.adapter.destroy();\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n each(this.plugins, plugin => plugin.destroy());\n delete this.plugins;\n\n this.parent.removeChild(this.container);\n delete this.parent[VIEWER_DATA];\n\n delete this.parent;\n delete this.container;\n\n delete this.loader;\n delete this.navbar;\n delete this.panel;\n delete this.tooltip;\n delete this.notification;\n delete this.overlay;\n\n delete this.config;\n }\n\n /**\n * @summary Refresh UI\n * @package\n */\n refreshUi(reason) {\n if (!this.prop.ready) {\n return;\n }\n\n if (!this.prop.uiRefresh) {\n // console.log(`PhotoSphereViewer: UI Refresh, ${reason}`);\n\n this.prop.uiRefresh = true;\n\n this.children.every((child) => {\n child.refreshUi();\n return this.prop.uiRefresh === true;\n });\n\n this.prop.uiRefresh = false;\n }\n else if (this.prop.uiRefresh !== 'new') {\n this.prop.uiRefresh = 'new';\n\n // wait for current refresh to cancel\n setTimeout(() => {\n this.prop.uiRefresh = false;\n this.refreshUi(reason);\n });\n }\n }\n\n /**\n * @summary Returns the instance of a plugin if it exists\n * @param {Class|string} pluginId\n * @returns {PSV.plugins.AbstractPlugin}\n */\n getPlugin(pluginId) {\n if (typeof pluginId === 'string') {\n return this.plugins[pluginId];\n }\n else {\n const pluginCtor = pluginInterop(pluginId, AbstractPlugin);\n return pluginCtor ? this.plugins[pluginCtor.id] : undefined;\n }\n }\n\n /**\n * @summary Returns the current position of the camera\n * @returns {PSV.Position}\n */\n getPosition() {\n return this.dataHelper.cleanPosition(this.dynamics.position.current);\n }\n\n /**\n * @summary Returns the current zoom level\n * @returns {number}\n */\n getZoomLevel() {\n return this.dynamics.zoom.current;\n }\n\n /**\n * @summary Returns the current viewer size\n * @returns {PSV.Size}\n */\n getSize() {\n return { ...this.prop.size };\n }\n\n /**\n * @summary Checks if the automatic rotation is enabled\n * @returns {boolean}\n */\n isAutorotateEnabled() {\n return this.prop.autorotateEnabled;\n }\n\n /**\n * @summary Checks if the viewer is in fullscreen\n * @returns {boolean}\n */\n isFullscreenEnabled() {\n if (SYSTEM.fullscreenEvent) {\n return isFullscreenEnabled(this.container);\n }\n else {\n return this.prop.fullscreen;\n }\n }\n\n /**\n * @summary Flags the view has changed for the next render\n */\n needsUpdate() {\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Resizes the canvas when the window is resized\n * @fires PSV.size-updated\n */\n autoSize() {\n if (this.container.clientWidth !== this.prop.size.width || this.container.clientHeight !== this.prop.size.height) {\n this.prop.size.width = Math.round(this.container.clientWidth);\n this.prop.size.height = Math.round(this.container.clientHeight);\n this.prop.aspect = this.prop.size.width / this.prop.size.height;\n this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov);\n\n this.trigger(EVENTS.SIZE_UPDATED, this.getSize());\n this.__resizeRefresh();\n }\n }\n\n /**\n * @summary Loads a new panorama file\n * @description Loads a new panorama file, optionally changing the camera position/zoom and activating the transition animation.
\n * If the \"options\" parameter is not defined, the camera will not move and the ongoing animation will continue.
\n * If another loading is already in progress it will be aborted.\n * @param {*} path - URL of the new panorama file\n * @param {PSV.PanoramaOptions} [options]\n * @returns {Promise} resolves false if the loading was aborted by another call\n */\n setPanorama(path, options = {}) {\n this.textureLoader.abortLoading();\n this.prop.transitionAnimation?.cancel();\n\n // apply default parameters on first load\n if (!this.prop.ready) {\n if (!('sphereCorrection' in options)) {\n options.sphereCorrection = this.config.sphereCorrection;\n }\n if (!('panoData' in options)) {\n options.panoData = this.config.panoData;\n }\n }\n\n if (options.transition === undefined || options.transition === true) {\n options.transition = DEFAULT_TRANSITION;\n }\n if (options.showLoader === undefined) {\n options.showLoader = true;\n }\n if (options.caption === undefined) {\n options.caption = this.config.caption;\n }\n if (options.description === undefined) {\n options.description = this.config.description;\n }\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n if (positionProvided || zoomProvided) {\n this.__stopAll();\n }\n\n this.hideError();\n\n this.config.panorama = path;\n this.config.caption = options.caption;\n this.config.description = options.description;\n\n const done = (err) => {\n this.loader.hide();\n\n this.prop.loadingPromise = null;\n\n if (isAbortError(err)) {\n return false;\n }\n else if (err) {\n this.navbar.setCaption('');\n this.showError(this.config.lang.loadError);\n console.error(err);\n throw err;\n }\n else {\n this.navbar.setCaption(this.config.caption);\n return true;\n }\n };\n\n this.navbar.setCaption(`${this.config.loadingTxt || ''}`);\n if (options.showLoader || !this.prop.ready) {\n this.loader.show();\n }\n\n const loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData)\n .then((textureData) => {\n // check if another panorama was requested\n if (textureData.panorama !== this.config.panorama) {\n this.adapter.disposeTexture(textureData);\n throw getAbortError();\n }\n return textureData;\n });\n\n if (!options.transition || !this.prop.ready || !this.adapter.supportsTransition(this.config.panorama)) {\n this.prop.loadingPromise = loadingPromise\n .then((textureData) => {\n this.renderer.show();\n this.renderer.setTexture(textureData);\n this.renderer.setPanoramaPose(textureData.panoData);\n this.renderer.setSphereCorrection(options.sphereCorrection);\n\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n if (positionProvided) {\n this.rotate(options);\n }\n })\n .then(done, done);\n }\n else {\n this.prop.loadingPromise = loadingPromise\n .then((textureData) => {\n this.loader.hide();\n\n this.prop.transitionAnimation = this.renderer.transition(textureData, options);\n return this.prop.transitionAnimation\n .then((completed) => {\n this.prop.transitionAnimation = null;\n if (!completed) {\n throw getAbortError();\n }\n });\n })\n .then(done, done);\n }\n\n return this.prop.loadingPromise;\n }\n\n /**\n * @summary Update options\n * @param {PSV.Options} options\n * @fires PSV.config-changed\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n setOptions(options) {\n each(options, (value, key) => {\n if (DEPRECATED_OPTIONS[key]) {\n logWarn(DEPRECATED_OPTIONS[key]);\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (READONLY_OPTIONS[key]) {\n throw new PSVError(READONLY_OPTIONS[key]);\n }\n\n if (CONFIG_PARSERS[key]) {\n this.config[key] = CONFIG_PARSERS[key](value, options);\n }\n else {\n this.config[key] = value;\n }\n\n switch (key) {\n case 'caption':\n case 'description':\n this.navbar.setCaption(this.config.caption);\n break;\n\n case 'size':\n this.resize(value);\n break;\n\n case 'sphereCorrection':\n this.renderer.setSphereCorrection(value);\n break;\n\n case 'navbar':\n case 'lang':\n this.navbar.setButtons(this.config.navbar);\n break;\n\n case 'moveSpeed':\n case 'zoomSpeed':\n this.__updateSpeeds();\n break;\n\n case 'minFov':\n case 'maxFov':\n this.dynamics.zoom.setValue(this.dataHelper.fovToZoomLevel(this.prop.vFov));\n this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel());\n break;\n\n case 'canvasBackground':\n this.renderer.canvasContainer.style.background = this.config.canvasBackground;\n break;\n\n default:\n break;\n }\n });\n\n this.needsUpdate();\n this.refreshUi('set options');\n\n this.trigger(EVENTS.CONFIG_CHANGED, Object.keys(options));\n }\n\n /**\n * @summary Update options\n * @param {string} option\n * @param {any} value\n * @fires PSV.config-changed\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n setOption(option, value) {\n this.setOptions({ [option]: value });\n }\n\n /**\n * @summary Starts the automatic rotation\n * @fires PSV.autorotate\n */\n startAutorotate(refresh = false) {\n if (refresh && !this.isAutorotateEnabled()) {\n return;\n }\n\n if (!refresh) {\n this.__stopAll();\n }\n\n this.dynamics.position.roll({\n longitude: this.config.autorotateSpeed < 0,\n }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed));\n\n this.dynamics.position.goto({\n latitude: this.config.autorotateLat,\n }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed));\n\n this.prop.autorotateEnabled = true;\n\n if (!refresh) {\n this.trigger(EVENTS.AUTOROTATE, true);\n }\n }\n\n /**\n * @summary Stops the automatic rotation\n * @fires PSV.autorotate\n */\n stopAutorotate() {\n if (this.prop.startTimeout) {\n clearTimeout(this.prop.startTimeout);\n this.prop.startTimeout = null;\n }\n\n if (this.isAutorotateEnabled()) {\n this.dynamics.position.stop();\n\n this.prop.autorotateEnabled = false;\n\n this.trigger(EVENTS.AUTOROTATE, false);\n }\n }\n\n /**\n * @summary Starts or stops the automatic rotation\n * @fires PSV.autorotate\n */\n toggleAutorotate() {\n if (this.isAutorotateEnabled()) {\n this.stopAutorotate();\n }\n else {\n this.startAutorotate();\n }\n }\n\n /**\n * @summary Displays an error message over the viewer\n * @param {string} message\n */\n showError(message) {\n this.overlay.show({\n id : IDS.ERROR,\n image : errorIcon,\n text : message,\n dissmisable: false,\n });\n }\n\n /**\n * @summary Hides the error message\n */\n hideError() {\n this.overlay.hide(IDS.ERROR);\n }\n\n /**\n * @summary Rotates the view to specific longitude and latitude\n * @param {PSV.ExtendedPosition} position\n * @fires PSV.before-rotate\n * @fires PSV.position-updated\n */\n rotate(position) {\n const e = this.trigger(EVENTS.BEFORE_ROTATE, position);\n if (e.isDefaultPrevented()) {\n return;\n }\n\n const cleanPosition = this.change(CHANGE_EVENTS.GET_ROTATE_POSITION, this.dataHelper.cleanPosition(position));\n this.dynamics.position.setValue(cleanPosition);\n }\n\n /**\n * @summary Rotates and zooms the view with a smooth animation\n * @param {PSV.AnimateOptions} options - position and/or zoom level\n * @returns {PSV.Animation}\n */\n animate(options) {\n this.__stopAll();\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n const animProperties = {};\n let duration;\n\n // clean/filter position and compute duration\n if (positionProvided) {\n const cleanPosition = this.change(CHANGE_EVENTS.GET_ANIMATE_POSITION, this.dataHelper.cleanPosition(options));\n const currentPosition = this.getPosition();\n\n // longitude offset for shortest arc\n const tOffset = getShortestArc(currentPosition.longitude, cleanPosition.longitude);\n\n animProperties.longitude = { start: currentPosition.longitude, end: currentPosition.longitude + tOffset };\n animProperties.latitude = { start: currentPosition.latitude, end: cleanPosition.latitude };\n\n duration = this.dataHelper.speedToDuration(options.speed, getAngle(currentPosition, cleanPosition));\n }\n\n // clean/filter zoom and compute duration\n if (zoomProvided) {\n const dZoom = Math.abs(options.zoom - this.getZoomLevel());\n\n animProperties.zoom = { start: this.getZoomLevel(), end: options.zoom };\n\n if (!duration) {\n // if animating zoom only and a speed is given, use an arbitrary PI/4 to compute the duration\n duration = this.dataHelper.speedToDuration(options.speed, Math.PI / 4 * dZoom / 100);\n }\n }\n\n // if no animation needed\n if (!duration) {\n if (positionProvided) {\n this.rotate(options);\n }\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n\n return new Animation();\n }\n\n this.prop.animationPromise = new Animation({\n properties: animProperties,\n duration : duration,\n easing : 'inOutSine',\n onTick : (properties) => {\n if (positionProvided) {\n this.rotate(properties);\n }\n if (zoomProvided) {\n this.zoom(properties.zoom);\n }\n },\n });\n\n return this.prop.animationPromise;\n }\n\n /**\n * @summary Stops the ongoing animation\n * @description The return value is a Promise because the is no guaranty the animation can be stopped synchronously.\n * @returns {Promise} Resolved when the animation has ben cancelled\n */\n stopAnimation() {\n if (this.prop.animationPromise) {\n return new Promise((resolve) => {\n this.prop.animationPromise.then(resolve);\n this.prop.animationPromise.cancel();\n this.prop.animationPromise = null;\n });\n }\n else {\n return Promise.resolve();\n }\n }\n\n /**\n * @summary Zooms to a specific level between `max_fov` and `min_fov`\n * @param {number} level - new zoom level from 0 to 100\n * @fires PSV.zoom-updated\n */\n zoom(level) {\n this.dynamics.zoom.setValue(level);\n }\n\n /**\n * @summary Increases the zoom level\n * @param {number} [step=1]\n */\n zoomIn(step = 1) {\n this.dynamics.zoom.step(step);\n }\n\n /**\n * @summary Decreases the zoom level\n * @param {number} [step=1]\n */\n zoomOut(step = 1) {\n this.dynamics.zoom.step(-step);\n }\n\n /**\n * @summary Resizes the viewer\n * @param {PSV.CssSize} size\n */\n resize(size) {\n ['width', 'height'].forEach((dim) => {\n if (size && size[dim]) {\n if (/^[0-9.]+$/.test(size[dim])) {\n size[dim] += 'px';\n }\n this.parent.style[dim] = size[dim];\n }\n });\n\n this.autoSize();\n }\n\n /**\n * @summary Enters the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n enterFullscreen() {\n if (SYSTEM.fullscreenEvent) {\n requestFullscreen(this.container);\n }\n else {\n this.container.classList.add('psv-container--fullscreen');\n this.autoSize();\n this.eventsHandler.__fullscreenToggled(true);\n }\n }\n\n /**\n * @summary Exits the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n exitFullscreen() {\n if (this.isFullscreenEnabled()) {\n if (SYSTEM.fullscreenEvent) {\n exitFullscreen();\n }\n else {\n this.container.classList.remove('psv-container--fullscreen');\n this.autoSize();\n this.eventsHandler.__fullscreenToggled(false);\n }\n }\n }\n\n /**\n * @summary Enters or exits the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n toggleFullscreen() {\n if (!this.isFullscreenEnabled()) {\n this.enterFullscreen();\n }\n else {\n this.exitFullscreen();\n }\n }\n\n /**\n * @summary Enables the keyboard controls (done automatically when entering fullscreen)\n */\n startKeyboardControl() {\n this.eventsHandler.enableKeyboard();\n }\n\n /**\n * @summary Disables the keyboard controls (done automatically when exiting fullscreen)\n */\n stopKeyboardControl() {\n this.eventsHandler.disableKeyboard();\n }\n\n /**\n * @summary Subscribes to events on objects in the scene\n * @param {string} userDataKey - only objects with the following `userData` will be emitted\n * @param {EventListener} listener - must implement `handleEvent\n * @return {function} call to stop the subscription\n * @package\n */\n observeObjects(userDataKey, listener) {\n this.prop.objectsObservers[userDataKey] = { listener };\n\n return () => {\n delete this.prop.objectsObservers[userDataKey];\n };\n }\n\n /**\n * @summary Stops all current animations\n * @package\n */\n __stopAll() {\n this.stopAutorotate();\n this.stopAnimation();\n\n this.trigger(EVENTS.STOP_ALL);\n }\n\n /**\n * @summary Recomputes dynamics speeds\n * @private\n */\n __updateSpeeds() {\n this.dynamics.zoom.setSpeed(this.config.zoomSpeed * 50);\n this.dynamics.position.setSpeed(THREE.MathUtils.degToRad(this.config.moveSpeed * 50));\n }\n\n}\n"],"names":["PSVError","message","Error","captureStackTrace","stack","prototype","Object","create","name","constructor","AbstractAdapter","psv","destroy","supportsTransition","panorama","supportsPreload","loadTexture","newPanoData","createMesh","scale","setTexture","mesh","textureData","transition","setTextureOpacity","opacity","disposeTexture","id","supportsDownload","DEFAULT_TRANSITION","MOVE_THRESHOLD","DBLCLICK_DELAY","LONGTOUCH_DELAY","TWOFINGERSOVERLAY_DELAY","CTRLZOOM_TIMEOUT","INERTIA_WINDOW","SPHERE_RADIUS","VIEWER_DATA","MESH_USER_DATA","ACTIONS","ROTATE_LAT_UP","ROTATE_LAT_DOWN","ROTATE_LONG_RIGHT","ROTATE_LONG_LEFT","ZOOM_IN","ZOOM_OUT","TOGGLE_AUTOROTATE","EVENTS","AUTOROTATE","BEFORE_RENDER","BEFORE_ROTATE","CLICK","CLOSE_PANEL","CONFIG_CHANGED","DOUBLE_CLICK","FULLSCREEN_UPDATED","HIDE_NOTIFICATION","HIDE_OVERLAY","HIDE_TOOLTIP","KEY_PRESS","LOAD_PROGRESS","OPEN_PANEL","PANORAMA_LOADED","POSITION_UPDATED","READY","RENDER","SHOW_NOTIFICATION","SHOW_OVERLAY","SHOW_TOOLTIP","SIZE_UPDATED","STOP_ALL","ZOOM_UPDATED","CHANGE_EVENTS","GET_ANIMATE_POSITION","GET_ROTATE_POSITION","OBJECT_EVENTS","ENTER_OBJECT","HOVER_OBJECT","LEAVE_OBJECT","IDS","MENU","TWO_FINGERS","CTRL_ZOOM","ERROR","DESCRIPTION","EASINGS","linear","t","inQuad","outQuad","inOutQuad","inCubic","outCubic","inOutCubic","inQuart","outQuart","inOutQuart","inQuint","outQuint","inOutQuint","inSine","Math","cos","PI","outSine","sin","inOutSine","inExpo","pow","outExpo","inOutExpo","inCirc","sqrt","outCirc","inOutCirc","KEY_CODES","Enter","Control","Escape","Space","PageUp","PageDown","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Delete","Plus","Minus","LOCALSTORAGE_TOUCH_SUPPORT","SYSTEM","loaded","pixelRatio","isWebGLSupported","isTouchEnabled","maxTextureWidth","mouseWheelEvent","fullscreenEvent","load","ctx","getWebGLCtx","window","devicePixelRatio","getMaxTextureWidth","getMouseWheelEvent","getFullscreenEvent","maxCanvasWidth","getMaxCanvasWidth","canvas","document","createElement","names","context","getContext","some","e","initial","navigator","maxTouchPoints","localStorage","promise","Promise","resolve","clear","listenerMouse","listenerTouch","listenerTimeout","removeEventListener","addEventListener","setTimeout","getParameter","MAX_TEXTURE_SIZE","maxWidth","width","height","fillStyle","fillRect","getImageData","data","onmousewheel","undefined","FULLSCREEN_EVT_MAP","exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen","validExits","keys","filter","exit","length","toggleClass","element","className","active","classList","toggle","contains","add","remove","addClasses","split","forEach","removeClasses","hasParent","el","parent","test","parentNode","getClosest","selector","matches","SVGElement","parentElement","getPosition","left","top","offsetLeft","scrollLeft","clientLeft","offsetTop","scrollTop","clientTop","offsetParent","isFullscreenEnabled","elt","fullscreenElement","webkitFullscreenElement","requestFullscreen","webkitRequestFullscreen","call","getStyle","prop","getComputedStyle","normalizeWheel","event","PIXEL_STEP","LINE_HEIGHT","PAGE_HEIGHT","spinX","spinY","pixelX","pixelY","detail","wheelDelta","wheelDeltaY","wheelDeltaX","axis","HORIZONTAL_AXIS","deltaY","deltaX","deltaMode","bound","x","min","max","loop","value","result","isInteger","Number","isFinite","floor","isPowerOfTwo","log","sum","array","reduce","a","b","distance","p1","p2","y","getShortestArc","from","to","tCandidates","candidate","newCandidate","abs","Infinity","getAngle","position1","position2","acos","latitude","longitude","greatArcDistance","λ1","φ1","λ2","φ2","dasherize","str","replace","s","i","toLowerCase","throttle","func","wait","self","args","timeout","previous","later","Date","now","apply","remaining","arguments","clearTimeout","isPlainObject","obj","getPrototypeOf","proto","toString","deepmerge","target","src","first","merge","Array","isArray","key","clone","isEmpty","each","object","callback","isNil","val","firstNonNull","values","pluginInterop","plugin","entries","p","getAbortError","error","isAbortError","err","logWarn","console","warn","isExtendedPosition","key1","key2","getXMPValue","attr","match","parseInt","isNaN","CSS_POSITIONS","bottom","right","center","parsePosition","tokens","toLocaleLowerCase","slice","xFirst","map","token","reverse","parsed","join","parseFloat","LEFT_MAP","TOP_MAP","cleanPosition","defaultValue","allowCenter","tempPos","parseSpeed","speed","speedStr","trim","speedValue","speedUnit","THREE","MathUtils","degToRad","parseAngle","angle","zeroCenter","halfCircle","unit","createTexture","img","texture","Texture","needsUpdate","minFilter","LinearFilter","generateMipmaps","quaternion","Quaternion","applyEulerInverse","vector","euler","setFromEuler","invert","applyQuaternion","Animation","options","__callbacks","easing","__start","delay","__delayTimeout","__animationFrame","requestAnimationFrame","__run","__resolved","timestamp","progress","duration","current","properties","start","end","onTick","__resolve","cb","then","onFulfilled","onRejected","__cancelled","push","cancel","cancelAnimationFrame","catch","finally","onFinally","Dynamic","fn","loopValue","mode","STOP","speedMult","currentSpeed","setSpeed","goto","position","POSITION","step","roll","INFINITE","stop","setValue","update","elapsed","dstStop","targetSpeed","next","MultiDynamic","dynamics","d","positions","steps","rolls","hasUpdates","dynamic","Slider","container","direction","onUpdate","mousedown","mouseover","handleEvent","type","stopPropagation","__onMouseDown","__onMouseEnter","__onMouseLeave","__onTouchStart","__onMouseMove","__onTouchMove","__onMouseUp","__onTouchEnd","evt","__update","changedTouches","moving","boundingClientRect","getBoundingClientRect","cursor","vertical","pos","size","click","VERTICAL","EventEmitter","HORIZONTAL","EquirectangularAdapter","config","resolution","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","reject","useXmpData","textureLoader","loadImage","loader","setProgress","xmpPanoData","__loadXMP","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","__createEquirectangularTexture","onProgress","loadFile","blob","__loadBlobAsString","binary","indexOf","substring","includes","reader","FileReader","onload","onerror","readAsText","ratio","resizedPanoData","buffer","drawImage","geometry","SphereGeometry","material","MeshBasicMaterial","Mesh","dispose","transparent","AbstractComponent","children","visible","appendChild","removeChild","childIdx","splice","child","refreshUi","every","uiRefresh","isVisible","hide","show","style","display","AbstractButton","navbar","collapsable","tabbable","enabled","supported","collapsed","offsetWidth","icon","__setIcon","lang","title","tabIndex","onClick","checkSupported","supportedOrObject","isSupported","toggleActive","iconActive","refresh","disable","enable","collapse","uncollapse","innerHTML","querySelector","groupId","AutorotateButton","on","off","toggleAutorotate","play","playActive","CustomButton","random","substr","content","NavbarCaption","caption","contentWidth","setCaption","html","availableWidth","__refreshButton","getButton","DescriptionButton","MODE_NOTIF","MODE_PANEL","closed","__close","captionHidden","hasDescription","description","__open","notification","panel","info","DownloadButton","link","href","downloadUrl","download","pop","adapter","FullscreenButton","toggleFullscreen","fullscreenIn","fullscreenOut","MenuButton","__hideMenu","__showMenu","MENU_TEMPLATE","BUTTON_DATA","noMargin","clickHandler","li","buttonId","dataset","menuIcon","buttons","dataKey","menu","button","PressHandler","time","down","getTime","up","getOrientedArrow","arrow","AbstractMoveButton","move","handler","__stopAll","MoveDownButton","MoveLeftButton","MoveRightButton","MoveUpButton","AbstractZoomButton","zoom","ZoomInButton","zoomIn","ZoomOutButton","zoomOut","ZoomRangeButton","mediaMinWidth","zoomRange","zoomValue","slider","__onSliderUpdate","ready","__moveZoomValue","getZoomLevel","once","level","AbstractPlugin","init","DEFAULTS","plugins","loadingImg","loadingTxt","fisheye","minFov","maxFov","defaultZoomLvl","defaultLong","defaultLat","sphereCorrection","moveSpeed","zoomSpeed","autorotateDelay","autorotateSpeed","autorotateLat","moveInertia","mousewheel","mousemove","captureCursor","mousewheelCtrlKey","touchmoveTwoFingers","requestHeaders","canvasBackground","withCredentials","autorotate","fullscreen","twoFingers","ctrlZoom","loadError","keyboard","READONLY_OPTIONS","DEPRECATED_OPTIONS","zoomButtonIncrement","mousewheelSpeed","sphereCorrectionReorder","CONFIG_PARSERS","getConfig","tempConfig","hasOwnProperty","AVAILABLE_BUTTONS","AVAILABLE_GROUPS","registerButton","defaultPosition","unshift","Navbar","setButtons","item","cleanedButtons","__cleanButtons","buttonCtor","warnNotFound","totalWidth","visibleButtons","collapsableButtons","Loader","clientWidth","tickness","lastChild","inner","round","maxHeight","clearRect","lineWidth","strokeStyle","beginPath","arc","stroke","trigger","Notification","contentId","Overlay","dissmisable","image","text","subtext","preventDefault","PANEL_MIN_WIDTH","Panel","mouseX","mouseY","keyHandler","resizer","closeBtn","wasVisible","focus","__startResize","__resize","touches","clientX","clientY","AbstractService","vector2","Vector2","vector3","Vector3","eulerZero","Euler","DataHelper","fovToZoomLevel","fov","temp","zoomLevelToFov","vFovToHFov","vFov","radToDeg","atan","tan","aspect","speedToDuration","textureCoordsToSphericalCoords","point","relativeX","relativeY","equals","renderer","rotation","meshContainer","sphericalCoordsToVector3","applyEuler","vector3ToSphericalCoords","sphericalCoordsToTextureCoords","relativeLong","relativeLat","z","phi","theta","atan2","viewerCoordsToVector3","viewerPoint","sphereIntersect","getIntersections","userData","vector3ToViewerCoords","vectorClone","project","camera","sphericalCoordsToViewerCoords","raycaster","setFromCamera","intersectObjects","scene","cleanSphereCorrection","pan","tilt","cleanPanoramaPose","EventsHandler","state","moveThreshold","keyboardEnabled","zooming","startMouseX","startMouseY","mouseHistory","pinchDist","ctrlKeyDown","dblclickData","dblclickTimeout","longtouchTimeout","twofingersTimeout","ctrlZoomTimeout","__onResize","autoSize","__onKeyDown","__onKeyUp","__fullscreenToggled","__onMouseWheel","enableKeyboard","disableKeyboard","overlay","e2","isDefaultPrevented","__startMove","__stopMove","__move","__moveAbsolute","objectsObservers","viewerPos","intersections","dataHelper","emit","observer","listener","CustomEvent","originalEvent","intersection","find","__click","__cancelLongTouch","__cancelTwoFingersOverlay","__startMoveZoom","__stopMoveZoom","gestureIcon","__moveZoom","mousewheelIcon","delta","force","startKeyboardControl","stopKeyboardControl","stopAutorotate","stopAnimation","__logMouseMove","__stopMoveInertia","norm","animationPromise","longtouch","boundingRect","rightclick","viewerX","viewerY","sphereIntersection","psvSphere","sphericalCoords","objects","o","textureCoords","textureX","textureY","NaN","hFov","currentPosition","rotate","containerRect","Renderer","WebGLRenderer","alpha","antialias","setPixelRatio","domElement","Scene","PerspectiveCamera","Group","Raycaster","canvasContainer","background","setAnimationLoop","__cleanTHREEScene","__onSizeUpdated","__onZoomUpdated","__onPositionUpdated","setSize","updateProjectionMatrix","set","lookAt","copy","multiplyScalar","negate","__renderLoop","render","setPanoramaPose","cleanCorrection","setSphereCorrection","positionProvided","zoomProvided","group","verticalAxis","rotateOnWorldAxis","horizontalAxis","cross","getWorldDirection","normalize","animation","completed","traverse","TextureLoader","FileLoader","setResponseType","setWithCredentials","setRequestHeader","abortLoading","url","lengthComputable","newProgress","total","createElementNS","URL","revokeObjectURL","createObjectURL","preloadPanorama","STATE","NONE","SHOWING","HIDING","Tooltip","__onTransitionEnd","rect","posClass","arrowTop","arrowLeft","__computeTooltipPosition","offset","newPos","propertyName","topBottom","box","TooltipRenderer","testTooltip","tooltip","Cache","Viewer","autorotateEnabled","loadingPromise","startTimeout","getElementById","eventsHandler","__updateSpeeds","__resizeRefresh","resize","opts","setPanorama","startAutorotate","reason","getPlugin","pluginId","pluginCtor","getSize","isAutorotateEnabled","clientHeight","path","transitionAnimation","showLoader","hideError","done","showError","setOptions","setOption","option","errorIcon","change","animate","animProperties","tOffset","dZoom","dim","enterFullscreen","observeObjects","userDataKey"],"mappings":";;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA,SAASA,QAAT,CAAkBC,OAAlB,EAA2B;EACzB,OAAKA,OAAL,GAAeA,OAAf,CADyB;;EAIzB,MAAI,uBAAuBC,KAA3B,EAAkC;EAChCA,IAAAA,KAAK,CAACC,iBAAN,CAAwB,IAAxB,EAA8BH,QAA9B;EACD,GAFD,MAGK;EACH,SAAKI,KAAL,GAAc,IAAIF,KAAJ,EAAD,CAAcE,KAA3B;EACD;EACF;;EAEDJ,QA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wBAAeC,WAAf,EAA4B1J,QAA5B,EAAsC;EAAA;;EACpC,SAAKnnB,IAAL,CAAU6mB,gBAAV,CAA2BgK,WAA3B,IAA0C;EAAE1J,MAAAA,QAAQ,EAARA;EAAF,KAA1C;EAEA,WAAO,YAAM;EACX,aAAO,MAAI,CAACnnB,IAAL,CAAU6mB,gBAAV,CAA2BgK,WAA3B,CAAP;EACD,KAFD;EAGD;EAED;EACF;EACA;EACA;EA34BA;;EAAA,SA44BExW,SA54BF,GA44BE,qBAAY;EACV,SAAK+N,cAAL;EACA,SAAKC,aAAL;EAEA,SAAKpI,OAAL,CAAa1rB,MAAM,CAACuB,QAApB;EACD;EAED;EACF;EACA;EACA;EAt5BA;;EAAA,SAu5BEg5B,cAv5BF,GAu5BE,0BAAiB;EACf,SAAK5gB,QAAL,CAAcyM,IAAd,CAAmBxN,QAAnB,CAA4B,KAAKsD,MAAL,CAAYgM,SAAZ,GAAwB,EAApD;EACA,SAAKvO,QAAL,CAAcb,QAAd,CAAuBF,QAAvB,CAAgC9D,KAAK,CAACC,SAAN,CAAgBC,QAAhB,CAAyB,KAAKkH,MAAL,CAAY+L,SAAZ,GAAwB,EAAjD,CAAhC;EACD,GA15BH;;EAAA;EAAA,EAA4BlM,mBAA5B;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"photo-sphere-viewer.js","sources":["../src/PSVError.js","../src/adapters/AbstractAdapter.js","../src/data/constants.js","../src/data/system.js","../src/utils/browser.js","../src/utils/math.js","../src/utils/misc.js","../src/utils/psv.js","../src/utils/Animation.js","../src/utils/Dynamic.js","../src/utils/MultiDynamic.js","../src/utils/Slider.js","../src/utils/index.js","../src/adapters/equirectangular/index.js","../src/components/AbstractComponent.js","../src/buttons/AbstractButton.js","../src/buttons/AutorotateButton.js","../src/buttons/CustomButton.js","../src/buttons/DescriptionButton.js","../src/buttons/DownloadButton.js","../src/buttons/FullscreenButton.js","../src/buttons/MenuButton.js","../src/utils/PressHandler.js","../src/buttons/AbstractMoveButton.js","../src/buttons/MoveDownButton.js","../src/buttons/MoveLeftButton.js","../src/buttons/MoveRightButton.js","../src/buttons/MoveUpButton.js","../src/buttons/AbstractZoomButton.js","../src/buttons/ZoomInButton.js","../src/buttons/ZoomOutButton.js","../src/buttons/ZoomRangeButton.js","../src/plugins/AbstractPlugin.js","../src/data/config.js","../src/components/NavbarCaption.js","../src/components/Navbar.js","../src/components/Loader.js","../src/components/Notification.js","../src/components/Overlay.js","../src/components/Panel.js","../src/services/AbstractService.js","../src/services/DataHelper.js","../src/services/EventsHandler.js","../src/services/Renderer.js","../src/services/TextureLoader.js","../src/components/Tooltip.js","../src/services/TooltipRenderer.js","../src/Viewer.js"],"sourcesContent":["/**\n * @summary Custom error used in the lib\n * @param {string} message\n * @constructor\n * @memberOf PSV\n */\nfunction PSVError(message) {\n this.message = message;\n\n // Use V8's native method if available, otherwise fallback\n if ('captureStackTrace' in Error) {\n Error.captureStackTrace(this, PSVError);\n }\n else {\n this.stack = (new Error()).stack;\n }\n}\n\nPSVError.prototype = Object.create(Error.prototype);\nPSVError.prototype.name = 'PSVError';\nPSVError.prototype.constructor = PSVError;\n\nexport { PSVError };\n","import { PSVError } from '../PSVError';\n\n/**\n * @namespace PSV.adapters\n */\n\n/**\n * @summary Base adapters class\n * @memberof PSV.adapters\n * @abstract\n */\nexport class AbstractAdapter {\n\n /**\n * @summary Unique identifier of the adapter\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @summary Indicates if the adapter supports panorama download natively\n * @type {boolean}\n * @readonly\n * @static\n */\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n }\n\n /**\n * @summary Destroys the adapter\n */\n destroy() {\n delete this.psv;\n }\n\n /**\n * @summary Indicates if the adapter supports transitions between panoramas\n * @param {*} panorama\n * @return {boolean}\n */\n supportsTransition(panorama) { // eslint-disable-line no-unused-vars\n return false;\n }\n\n /**\n * @summary Indicates if the adapter supports preload of a panorama\n * @param {*} panorama\n * @return {boolean}\n */\n supportsPreload(panorama) { // eslint-disable-line no-unused-vars\n return false;\n }\n\n /**\n * @abstract\n * @summary Loads the panorama texture(s)\n * @param {*} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n */\n loadTexture(panorama, newPanoData) { // eslint-disable-line no-unused-vars\n throw new PSVError('loadTexture not implemented');\n }\n\n /**\n * @abstract\n * @summary Creates the cube mesh\n * @param {number} [scale=1]\n * @returns {external:THREE.Mesh}\n */\n createMesh(scale = 1) { // eslint-disable-line no-unused-vars\n throw new PSVError('createMesh not implemented');\n }\n\n /**\n * @abstract\n * @summary Applies the texture to the mesh\n * @param {external:THREE.Mesh} mesh\n * @param {PSV.TextureData} textureData\n * @param {boolean} [transition=false]\n */\n setTexture(mesh, textureData, transition = false) { // eslint-disable-line no-unused-vars\n throw new PSVError('setTexture not implemented');\n }\n\n /**\n * @abstract\n * @summary Changes the opacity of the mesh\n * @param {external:THREE.Mesh} mesh\n * @param {number} opacity\n */\n setTextureOpacity(mesh, opacity) { // eslint-disable-line no-unused-vars\n throw new PSVError('setTextureOpacity not implemented');\n }\n\n /**\n * @abstract\n * @summary Clear a loaded texture from memory\n * @param {PSV.TextureData} textureData\n */\n disposeTexture(textureData) { // eslint-disable-line no-unused-vars\n throw new PSVError('disposeTexture not implemented');\n }\n\n}\n","/**\n * @namespace PSV.constants\n */\n\n/**\n * @summary Default duration of the transition between panoramas\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const DEFAULT_TRANSITION = 1500;\n\n/**\n * @summary Number of pixels bellow which a mouse move will be considered as a click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const MOVE_THRESHOLD = 4;\n\n/**\n * @summary Delay in milliseconds between two clicks to consider a double click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const DBLCLICK_DELAY = 300;\n\n/**\n * @summary Delay in milliseconds to emulate a long touch\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const LONGTOUCH_DELAY = 500;\n\n/**\n * @summary Delay in milliseconds to for the two fingers overlay to appear\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const TWOFINGERSOVERLAY_DELAY = 100;\n\n/**\n * @summary Duration in milliseconds of the \"ctrl zoom\" overlay\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const CTRLZOOM_TIMEOUT = 2000;\n\n/**\n * @summary Time size of the mouse position history used to compute inertia\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const INERTIA_WINDOW = 300;\n\n/**\n * @summary Radius of the THREE.SphereGeometry, Half-length of the THREE.BoxGeometry\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const SPHERE_RADIUS = 10;\n\n/**\n * @summary Property name added to viewer element\n * @memberOf PSV.constants\n * @type {string}\n * @constant\n */\nexport const VIEWER_DATA = 'photoSphereViewer';\n\n/**\n * @summary Property added the the main Mesh object\n * @memberOf PSV.constants\n * @type {string}\n * @constant\n */\nexport const MESH_USER_DATA = 'psvSphere';\n\n/**\n * @summary Available actions\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const ACTIONS = {\n ROTATE_LAT_UP : 'rotateLatitudeUp',\n ROTATE_LAT_DOWN : 'rotateLatitudeDown',\n ROTATE_LONG_RIGHT: 'rotateLongitudeRight',\n ROTATE_LONG_LEFT : 'rotateLongitudeLeft',\n ZOOM_IN : 'zoomIn',\n ZOOM_OUT : 'zoomOut',\n TOGGLE_AUTOROTATE: 'toggleAutorotate',\n};\n\n/**\n * @summary Available events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event autorotate\n * @memberof PSV\n * @summary Triggered when the automatic rotation is enabled/disabled\n * @param {boolean} enabled\n */\n AUTOROTATE : 'autorotate',\n /**\n * @event before-render\n * @memberof PSV\n * @summary Triggered before a render, used to modify the view\n * @param {number} timestamp - time provided by requestAnimationFrame\n * @param {number} elapsed - time elapsed from the previous frame\n */\n BEFORE_RENDER : 'before-render',\n /**\n * @event before-rotate\n * @memberOf PSV\n * @summary Triggered before a rotate operation, can be cancelled\n * @param {PSV.ExtendedPosition}\n */\n BEFORE_ROTATE : 'before-rotate',\n /**\n * @event click\n * @memberof PSV\n * @summary Triggered when the user clicks on the viewer (everywhere excluding the navbar and the side panel)\n * @param {PSV.ClickData} data\n */\n CLICK : 'click',\n /**\n * @event close-panel\n * @memberof PSV\n * @summary Triggered when the panel is closed\n * @param {string} [id]\n */\n CLOSE_PANEL : 'close-panel',\n /**\n * @event config-changed\n * @memberOf PSV\n * @summary Triggered after a call to setOption/setOptions\n * @param {string[]} name of changed options\n */\n CONFIG_CHANGED : 'config-changed',\n /**\n * @event dblclick\n * @memberof PSV\n * @summary Triggered when the user double clicks on the viewer. The simple `click` event is always fired before `dblclick`\n * @param {PSV.ClickData} data\n */\n DOUBLE_CLICK : 'dblclick',\n /**\n * @event fullscreen-updated\n * @memberof PSV\n * @summary Triggered when the fullscreen mode is enabled/disabled\n * @param {boolean} enabled\n */\n FULLSCREEN_UPDATED: 'fullscreen-updated',\n /**\n * @event hide-notification\n * @memberof PSV\n * @summary Triggered when the notification is hidden\n * @param {string} [id]\n */\n HIDE_NOTIFICATION : 'hide-notification',\n /**\n * @event hide-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is hidden\n * @param {string} [id]\n */\n HIDE_OVERLAY : 'hide-overlay',\n /**\n * @event hide-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is hidden\n * @param {*} Data associated to this tooltip\n */\n HIDE_TOOLTIP : 'hide-tooltip',\n /**\n * @event key-press\n * @memberof PSV\n * @summary Triggered when a key is pressed, can be cancelled\n * @param {string} key\n */\n KEY_PRESS : 'key-press',\n /**\n * @event load-progress\n * @memberof PSV\n * @summary Triggered when the loader value changes\n * @param {number} value from 0 to 100\n */\n LOAD_PROGRESS : 'load-progress',\n /**\n * @event open-panel\n * @memberof PSV\n * @summary Triggered when the panel is opened\n * @param {string} [id]\n */\n OPEN_PANEL : 'open-panel',\n /**\n * @event panorama-loaded\n * @memberof PSV\n * @summary Triggered when a panorama image has been loaded\n * @param {PSV.TextureData} textureData\n */\n PANORAMA_LOADED : 'panorama-loaded',\n /**\n * @event position-updated\n * @memberof PSV\n * @summary Triggered when the view longitude and/or latitude changes\n * @param {PSV.Position} position\n */\n POSITION_UPDATED : 'position-updated',\n /**\n * @event ready\n * @memberof PSV\n * @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render\n */\n READY : 'ready',\n /**\n * @event render\n * @memberof PSV\n * @summary Triggered on each viewer render, **this event is triggered very often**\n */\n RENDER : 'render',\n /**\n * @event show-notification\n * @memberof PSV\n * @summary Triggered when the notification is shown\n * @param {string} [id]\n */\n SHOW_NOTIFICATION : 'show-notification',\n /**\n * @event show-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is shown\n * @param {string} [id]\n */\n SHOW_OVERLAY : 'show-overlay',\n /**\n * @event show-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is shown\n * @param {*} Data associated to this tooltip\n * @param {PSV.components.Tooltip} Instance of the tooltip\n */\n SHOW_TOOLTIP : 'show-tooltip',\n /**\n * @event size-updated\n * @memberof PSV\n * @summary Triggered when the viewer size changes\n * @param {PSV.Size} size\n */\n SIZE_UPDATED : 'size-updated',\n /**\n * @event stop-all\n * @memberof PSV\n * @summary Triggered when all current animations are stopped\n */\n STOP_ALL : 'stop-all',\n /**\n * @event zoom-updated\n * @memberof PSV\n * @summary Triggered when the zoom level changes\n * @param {number} zoomLevel\n */\n ZOOM_UPDATED : 'zoom-updated',\n};\n\n/**\n * @summary Available change events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const CHANGE_EVENTS = {\n /**\n * @event get-animate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of an animation\n */\n GET_ANIMATE_POSITION: 'get-animate-position',\n /**\n * @event get-rotate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of a rotation\n */\n GET_ROTATE_POSITION : 'get-rotate-position',\n};\n\n/**\n * @summary Special events emitted to listener using {@link Viewer#observeObjects}\n * @memberOf PSV.constants\n * @constant\n * @package\n */\nexport const OBJECT_EVENTS = {\n ENTER_OBJECT: 'enter-object',\n HOVER_OBJECT: 'hover-object',\n LEAVE_OBJECT: 'leave-object',\n};\n\n/**\n * @summary Internal identifiers for various stuff\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const IDS = {\n MENU : 'menu',\n TWO_FINGERS: 'twoFingers',\n CTRL_ZOOM : 'ctrlZoom',\n ERROR : 'error',\n DESCRIPTION: 'description',\n};\n\n/* eslint-disable */\n// @formatter:off\n/**\n * @summary Collection of easing functions\n * @memberOf PSV.constants\n * @see {@link https://gist.github.com/frederickk/6165768}\n * @type {Object}\n * @constant\n */\nexport const EASINGS = {\n linear : (t) => t,\n\n inQuad : (t) => t*t,\n outQuad : (t) => t*(2-t),\n inOutQuad : (t) => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\n inCubic : (t) => t*t*t,\n outCubic : (t) => (--t)*t*t+1,\n inOutCubic: (t) => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\n inQuart : (t) => t*t*t*t,\n outQuart : (t) => 1-(--t)*t*t*t,\n inOutQuart: (t) => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\n inQuint : (t) => t*t*t*t*t,\n outQuint : (t) => 1+(--t)*t*t*t*t,\n inOutQuint: (t) => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t,\n\n inSine : (t) => 1-Math.cos(t*(Math.PI/2)),\n outSine : (t) => Math.sin(t*(Math.PI/2)),\n inOutSine : (t) => .5-.5*Math.cos(Math.PI*t),\n\n inExpo : (t) => Math.pow(2, 10*(t-1)),\n outExpo : (t) => 1-Math.pow(2, -10*t),\n inOutExpo : (t) => (t=t*2-1)<0 ? .5*Math.pow(2, 10*t) : 1-.5*Math.pow(2, -10*t),\n\n inCirc : (t) => 1-Math.sqrt(1-t*t),\n outCirc : (t) => Math.sqrt(1-(t-1)*(t-1)),\n inOutCirc : (t) => (t*=2)<1 ? .5-.5*Math.sqrt(1-t*t) : .5+.5*Math.sqrt(1-(t-=2)*t)\n};\n// @formatter:on\n/* eslint-enable */\n\n/**\n * @summary Subset of key codes\n * @memberOf PSV.constants\n * @type {Object}\n * @constant\n */\nexport const KEY_CODES = {\n Enter : 'Enter',\n Control : 'Control',\n Escape : 'Escape',\n Space : ' ',\n PageUp : 'PageUp',\n PageDown : 'PageDown',\n ArrowLeft : 'ArrowLeft',\n ArrowUp : 'ArrowUp',\n ArrowRight: 'ArrowRight',\n ArrowDown : 'ArrowDown',\n Delete : 'Delete',\n Plus : '+',\n Minus : '-',\n};\n","import { PSVError } from '../PSVError';\nimport { VIEWER_DATA } from './constants';\n\nconst LOCALSTORAGE_TOUCH_SUPPORT = `${VIEWER_DATA}_touchSupport`;\n\n/**\n * @summary General information about the system\n * @constant\n * @memberOf PSV\n * @property {boolean} loaded - Indicates if the system data has been loaded\n * @property {Function} load - Loads the system if not already loaded\n * @property {number} pixelRatio\n * @property {boolean} isWebGLSupported\n * @property {number} maxCanvasWidth\n * @property {string} mouseWheelEvent\n * @property {string} fullscreenEvent\n * @property {Function} getMaxCanvasWidth - Returns the max width of a canvas allowed by the browser\n * @property {{initial: boolean, promise: Promise}} isTouchEnabled\n */\nexport const SYSTEM = {\n loaded : false,\n pixelRatio : 1,\n isWebGLSupported: false,\n isTouchEnabled : null,\n maxTextureWidth : 0,\n mouseWheelEvent : null,\n fullscreenEvent : null,\n};\n\n/**\n * @summary Loads the system if not already loaded\n */\nSYSTEM.load = () => {\n if (!SYSTEM.loaded) {\n const ctx = getWebGLCtx();\n\n SYSTEM.loaded = true;\n SYSTEM.pixelRatio = window.devicePixelRatio || 1;\n SYSTEM.isWebGLSupported = ctx != null;\n SYSTEM.isTouchEnabled = isTouchEnabled();\n SYSTEM.maxTextureWidth = getMaxTextureWidth(ctx);\n SYSTEM.mouseWheelEvent = getMouseWheelEvent();\n SYSTEM.fullscreenEvent = getFullscreenEvent();\n }\n};\n\nlet maxCanvasWidth = null;\nSYSTEM.getMaxCanvasWidth = () => {\n if (maxCanvasWidth === null) {\n maxCanvasWidth = getMaxCanvasWidth(SYSTEM.maxTextureWidth);\n }\n return maxCanvasWidth;\n};\n\n/**\n * @summary Tries to return a canvas webgl context\n * @returns {WebGLRenderingContext}\n * @private\n */\nfunction getWebGLCtx() {\n const canvas = document.createElement('canvas');\n const names = ['webgl', 'experimental-webgl', 'moz-webgl', 'webkit-3d'];\n let context = null;\n\n if (!canvas.getContext) {\n return null;\n }\n\n if (names.some((name) => {\n try {\n context = canvas.getContext(name);\n return context !== null;\n }\n catch (e) {\n return false;\n }\n })) {\n return context;\n }\n else {\n return null;\n }\n}\n\n/**\n * @summary Detects if the user is using a touch screen\n * @returns {{initial: boolean, promise: Promise}}\n * @private\n */\nfunction isTouchEnabled() {\n let initial = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);\n if (LOCALSTORAGE_TOUCH_SUPPORT in localStorage) {\n initial = localStorage[LOCALSTORAGE_TOUCH_SUPPORT] === 'true';\n }\n\n const promise = new Promise((resolve) => {\n let clear;\n\n const listenerMouse = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = false;\n resolve(false);\n };\n\n const listenerTouch = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = true;\n resolve(true);\n };\n\n const listenerTimeout = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = initial;\n resolve(initial);\n };\n\n clear = () => {\n window.removeEventListener('mousedown', listenerMouse);\n window.removeEventListener('touchstart', listenerTouch);\n };\n\n window.addEventListener('mousedown', listenerMouse, false);\n window.addEventListener('touchstart', listenerTouch, false);\n setTimeout(listenerTimeout, 10000);\n });\n\n return { initial, promise };\n}\n\n/**\n * @summary Gets max texture width in WebGL context\n * @returns {number}\n * @private\n */\nfunction getMaxTextureWidth(ctx) {\n if (ctx !== null) {\n return ctx.getParameter(ctx.MAX_TEXTURE_SIZE);\n }\n else {\n return 0;\n }\n}\n\n/**\n * @summary Gets max canvas width supported by the browser.\n * We only test powers of 2 and height = width / 2 because that's what we need to generate WebGL textures\n * @param maxWidth\n * @return {number}\n * @private\n */\nfunction getMaxCanvasWidth(maxWidth) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = maxWidth;\n canvas.height = maxWidth / 2;\n\n while (canvas.width > 1024) {\n ctx.fillStyle = 'white';\n ctx.fillRect(0, 0, 1, 1);\n\n try {\n if (ctx.getImageData(0, 0, 1, 1).data[0] === 255) {\n return canvas.width;\n }\n }\n catch (e) {\n // continue\n }\n\n canvas.width /= 2;\n canvas.height /= 2;\n }\n\n throw new PSVError('Unable to detect system capabilities');\n}\n\n/**\n * @summary Gets the event name for mouse wheel\n * @returns {string}\n * @private\n */\nfunction getMouseWheelEvent() {\n if ('onwheel' in document.createElement('div')) { // Modern browsers support \"wheel\"\n return 'wheel';\n }\n else if (document.onmousewheel !== undefined) { // Webkit and IE support at least \"mousewheel\"\n return 'mousewheel';\n }\n else { // let's assume that remaining browsers are older Firefox\n return 'DOMMouseScroll';\n }\n}\n\n/**\n * @summary Map between fullsceen method and fullscreen event name\n * @type {Object}\n * @readonly\n * @private\n */\nconst FULLSCREEN_EVT_MAP = {\n exitFullscreen : 'fullscreenchange',\n webkitExitFullscreen: 'webkitfullscreenchange',\n mozCancelFullScreen : 'mozfullscreenchange',\n msExitFullscreen : 'MSFullscreenChange',\n};\n\n\n/**\n * @summary Gets the event name for fullscreen\n * @returns {string}\n * @private\n */\nfunction getFullscreenEvent() {\n const validExits = Object.keys(FULLSCREEN_EVT_MAP).filter(exit => exit in document);\n\n if (validExits.length) {\n return FULLSCREEN_EVT_MAP[validExits[0]];\n }\n else {\n return null;\n }\n}\n","/**\n * @summary Toggles a CSS class\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} element\n * @param {string} className\n * @param {boolean} [active] - forced state\n */\nexport function toggleClass(element, className, active) {\n if (active === undefined) {\n element.classList.toggle(className);\n }\n else if (active && !element.classList.contains(className)) {\n element.classList.add(className);\n }\n else if (!active) {\n element.classList.remove(className);\n }\n}\n\n/**\n * @summary Adds one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function addClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, true);\n });\n }\n}\n\n/**\n * @summary Removes one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function removeClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, false);\n });\n }\n}\n\n/**\n * @summary Searches if an element has a particular parent at any level including itself\n * @memberOf PSV.utils\n * @param {HTMLElement} el\n * @param {HTMLElement} parent\n * @returns {boolean}\n */\nexport function hasParent(el, parent) {\n let test = el;\n\n do {\n if (test === parent) {\n return true;\n }\n test = test.parentNode;\n } while (test);\n\n return false;\n}\n\n/**\n * @summary Gets the closest parent (can by itself)\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} el\n * @param {string} selector\n * @returns {HTMLElement}\n */\nexport function getClosest(el, selector) {\n // When el is document or window, the matches does not exist\n if (!el.matches) {\n return null;\n }\n\n let test = el;\n\n do {\n if (test.matches(selector)) {\n return test;\n }\n test = test instanceof SVGElement ? test.parentNode : test.parentElement;\n } while (test);\n\n return null;\n}\n\n/**\n * @summary Gets the position of an element in the viewer without reflow\n * @description Will gives the same result as getBoundingClientRect() as soon as there are no CSS transforms\n * @memberOf PSV.utils\n * @param {HTMLElement} el\n * @return {{left: number, top: number}}\n */\nexport function getPosition(el) {\n let left = 0;\n let top = 0;\n let test = el;\n\n while (test) {\n left += (test.offsetLeft - test.scrollLeft + test.clientLeft);\n top += (test.offsetTop - test.scrollTop + test.clientTop);\n test = test.offsetParent;\n }\n\n return { left, top };\n}\n\n/**\n * @summary Detects if fullscreen is enabled\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @returns {boolean}\n */\nexport function isFullscreenEnabled(elt) {\n return (document.fullscreenElement || document.webkitFullscreenElement) === elt;\n}\n\n/**\n * @summary Enters fullscreen mode\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n */\nexport function requestFullscreen(elt) {\n (elt.requestFullscreen || elt.webkitRequestFullscreen).call(elt);\n}\n\n/**\n * @summary Exits fullscreen mode\n * @memberOf PSV.utils\n */\nexport function exitFullscreen() {\n (document.exitFullscreen || document.webkitExitFullscreen).call(document);\n}\n\n/**\n * @summary Gets an element style\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @param {string} prop\n * @returns {*}\n */\nexport function getStyle(elt, prop) {\n return window.getComputedStyle(elt, null)[prop];\n}\n\n/**\n * @summary Normalize mousewheel values accross browsers\n * @memberOf PSV.utils\n * @description From Facebook's Fixed Data Table\n * {@link https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js}\n * @copyright Facebook\n * @param {WheelEvent} event\n * @returns {{spinX: number, spinY: number, pixelX: number, pixelY: number}}\n */\nexport function normalizeWheel(event) {\n const PIXEL_STEP = 10;\n const LINE_HEIGHT = 40;\n const PAGE_HEIGHT = 800;\n\n let spinX = 0;\n let spinY = 0;\n let pixelX = 0;\n let pixelY = 0;\n\n // Legacy\n if ('detail' in event) {\n spinY = event.detail;\n }\n if ('wheelDelta' in event) {\n spinY = -event.wheelDelta / 120;\n }\n if ('wheelDeltaY' in event) {\n spinY = -event.wheelDeltaY / 120;\n }\n if ('wheelDeltaX' in event) {\n spinX = -event.wheelDeltaX / 120;\n }\n\n // side scrolling on FF with DOMMouseScroll\n if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {\n spinX = spinY;\n spinY = 0;\n }\n\n pixelX = spinX * PIXEL_STEP;\n pixelY = spinY * PIXEL_STEP;\n\n if ('deltaY' in event) {\n pixelY = event.deltaY;\n }\n if ('deltaX' in event) {\n pixelX = event.deltaX;\n }\n\n if ((pixelX || pixelY) && event.deltaMode) {\n // delta in LINE units\n if (event.deltaMode === 1) {\n pixelX *= LINE_HEIGHT;\n pixelY *= LINE_HEIGHT;\n }\n // delta in PAGE units\n else {\n pixelX *= PAGE_HEIGHT;\n pixelY *= PAGE_HEIGHT;\n }\n }\n\n // Fall-back if spin cannot be determined\n if (pixelX && !spinX) {\n spinX = (pixelX < 1) ? -1 : 1;\n }\n if (pixelY && !spinY) {\n spinY = (pixelY < 1) ? -1 : 1;\n }\n\n return { spinX, spinY, pixelX, pixelY };\n}\n","/**\n * @summary Ensures that a number is in a given interval\n * @memberOf PSV.utils\n * @param {number} x\n * @param {number} min\n * @param {number} max\n * @returns {number}\n */\nexport function bound(x, min, max) {\n return Math.max(min, Math.min(max, x));\n}\n\n/**\n * @summary Ensure a value is within 0 and `max`\n * @param {number} value\n * @param {number} max\n * @return {number}\n */\nexport function loop(value, max) {\n let result = value % max;\n\n if (result < 0) {\n result += max;\n }\n\n return result;\n}\n\n/**\n * @summary Checks if a value is an integer\n * @memberOf PSV.utils\n * @param {*} value\n * @returns {boolean}\n */\nexport function isInteger(value) {\n if (Number.isInteger) {\n return Number.isInteger(value);\n }\n return typeof value === 'number' && Number.isFinite(value) && Math.floor(value) === value;\n}\n\n/**\n * @summary Tests if a number is power of two\n * @memberOf PSV.utils\n * @param {number} x\n * @return {boolean}\n */\nexport function isPowerOfTwo(x) {\n return (Math.log(x) / Math.log(2)) % 1 === 0;\n}\n\n/**\n * @summary Computes the sum of an array\n * @memberOf PSV.utils\n * @param {number[]} array\n * @returns {number}\n */\nexport function sum(array) {\n return array.reduce((a, b) => a + b, 0);\n}\n\n/**\n * @summary Computes the distance between two points\n * @memberOf PSV.utils\n * @param {PSV.Point} p1\n * @param {PSV.Point} p2\n * @returns {number}\n */\nexport function distance(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\n/**\n * @summary Compute the shortest offset between two longitudes\n * @memberOf PSV.utils\n * @param {number} from\n * @param {number} to\n * @returns {number}\n */\nexport function getShortestArc(from, to) {\n const tCandidates = [\n 0, // direct\n Math.PI * 2, // clock-wise cross zero\n -Math.PI * 2, // counter-clock-wise cross zero\n ];\n\n return tCandidates.reduce((value, candidate) => {\n const newCandidate = to - from + candidate;\n return Math.abs(newCandidate) < Math.abs(value) ? newCandidate : value;\n }, Infinity);\n}\n\n/**\n * @summary Computes the angle between the current position and a target position\n * @memberOf PSV.utils\n * @param {PSV.Position} position1\n * @param {PSV.Position} position2\n * @returns {number}\n */\nexport function getAngle(position1, position2) {\n return Math.acos(\n Math.cos(position1.latitude)\n * Math.cos(position2.latitude)\n * Math.cos(position1.longitude - position2.longitude)\n + Math.sin(position1.latitude)\n * Math.sin(position2.latitude)\n );\n}\n\n/**\n * @summary Returns the distance between two points on a sphere of radius one\n * {@link http://www.movable-type.co.uk/scripts/latlong.html}\n * @memberOf PSV.utils\n * @param {number[]} p1\n * @param {number[]} p2\n * @returns {number}\n */\nexport function greatArcDistance(p1, p2) {\n const [λ1, φ1] = p1;\n const [λ2, φ2] = p2;\n\n const x = (λ2 - λ1) * Math.cos((φ1 + φ2) / 2);\n const y = (φ2 - φ1);\n return Math.sqrt(x * x + y * y);\n}\n","/**\n * @summary Transforms a string to dash-case {@link https://github.com/shahata/dasherize}\n * @memberOf PSV.utils\n * @param {string} str\n * @returns {string}\n */\nexport function dasherize(str) {\n return str.replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {\n return (i > 0 ? '-' : '') + s.toLowerCase();\n });\n}\n\n/**\n * @summary Returns a function, that, when invoked, will only be triggered at most once during a given window of time.\n * @memberOf PSV.utils\n * @copyright underscore.js - modified by Clément Prévost {@link http://stackoverflow.com/a/27078401}\n * @param {Function} func\n * @param {number} wait\n * @returns {Function}\n */\nexport function throttle(func, wait) {\n /* eslint-disable */\n let self, args, result;\n let timeout;\n let previous = 0;\n const later = function() {\n previous = Date.now();\n timeout = undefined;\n result = func.apply(self, args);\n if (!timeout) {\n self = args = null;\n }\n };\n return function() {\n const now = Date.now();\n if (!previous) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n self = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n previous = now;\n result = func.apply(self, args);\n if (!timeout) {\n self = args = null;\n }\n }\n else if (!timeout) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n /* eslint-enable */\n}\n\n/**\n * @summary Test if an object is a plain object\n * @memberOf PSV.utils\n * @description Test if an object is a plain object, i.e. is constructed\n * by the built-in Object constructor and inherits directly from Object.prototype\n * or null. Some built-in objects pass the test, e.g. Math which is a plain object\n * and some host or exotic objects may pass also.\n * {@link http://stackoverflow.com/a/5878101/1207670}\n * @param {*} obj\n * @returns {boolean}\n */\nexport function isPlainObject(obj) {\n // Basic check for Type object that's not null\n if (typeof obj === 'object' && obj !== null) {\n // If Object.getPrototypeOf supported, use it\n if (typeof Object.getPrototypeOf === 'function') {\n const proto = Object.getPrototypeOf(obj);\n return proto === Object.prototype || proto === null;\n }\n\n // Otherwise, use internal class\n // This should be reliable as if getPrototypeOf not supported, is pre-ES5\n return Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n // Not an object\n return false;\n}\n\n/**\n * @summary Merges the enumerable attributes of two objects\n * @memberOf PSV.utils\n * @description Replaces arrays and alters the target object.\n * @copyright Nicholas Fisher \n * @param {Object} target\n * @param {Object} src\n * @returns {Object} target\n */\nexport function deepmerge(target, src) {\n /* eslint-disable */\n let first = src;\n\n return (function merge(target, src) {\n if (Array.isArray(src)) {\n if (!target || !Array.isArray(target)) {\n target = [];\n }\n else {\n target.length = 0;\n }\n src.forEach(function(e, i) {\n target[i] = merge(null, e);\n });\n }\n else if (typeof src === 'object') {\n if (!target || Array.isArray(target)) {\n target = {};\n }\n Object.keys(src).forEach(function(key) {\n if (typeof src[key] !== 'object' || !src[key] || !isPlainObject(src[key])) {\n target[key] = src[key];\n }\n else if (src[key] != first) {\n if (!target[key]) {\n target[key] = merge(null, src[key]);\n }\n else {\n merge(target[key], src[key]);\n }\n }\n });\n }\n else {\n target = src;\n }\n\n return target;\n }(target, src));\n /* eslint-enable */\n}\n\n/**\n * @summary Deeply clones an object\n * @memberOf PSV.utils\n * @param {Object} src\n * @returns {Object}\n */\nexport function clone(src) {\n return deepmerge(null, src);\n}\n\n/**\n * @summery Test of an object is empty\n * @memberOf PSV.utils\n * @param {object} obj\n * @returns {boolean}\n */\nexport function isEmpty(obj) {\n return !obj || (Object.keys(obj).length === 0 && obj.constructor === Object);\n}\n\n/**\n * @summary Loops over enumerable properties of an object\n * @memberOf PSV.utils\n * @param {Object} object\n * @param {Function} callback\n */\nexport function each(object, callback) {\n Object.keys(object).forEach((key) => {\n callback(object[key], key);\n });\n}\n\n/**\n * @summary Returns if a valu is null or undefined\n * @memberOf PSV.utils\n * @param {*} val\n * @return {boolean}\n */\nexport function isNil(val) {\n return val === null || val === undefined;\n}\n\n/**\n * @summary Returns the first non null non undefined parameter\n * @memberOf PSV.utils\n * @param {*} values\n * @return {*}\n */\nexport function firstNonNull(...values) {\n for (const val of values) {\n if (!isNil(val)) {\n return val;\n }\n }\n\n return undefined;\n}\n","import * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound, loop } from './math';\n\n/**\n * @summary Returns the plugin constructor from the imported object\n * For retrocompatibility with previous default exports\n * @memberOf PSV.utils\n * @package\n */\nexport function pluginInterop(plugin, target) {\n if (plugin) {\n for (const [, p] of [['_', plugin], ...Object.entries(plugin)]) {\n if (p.prototype instanceof target) {\n return p;\n }\n }\n }\n return null;\n}\n\n/**\n * @summary Builds an Error with name 'AbortError'\n * @memberOf PSV.utils\n * @return {Error}\n */\nexport function getAbortError() {\n const error = new Error('Loading was aborted.');\n error.name = 'AbortError';\n return error;\n}\n\n/**\n * @summary Tests if an Error has name 'AbortError'\n * @memberOf PSV.utils\n * @param {Error} err\n * @return {boolean}\n */\nexport function isAbortError(err) {\n return err?.name === 'AbortError';\n}\n\n/**\n * @summary Displays a warning in the console\n * @memberOf PSV.utils\n * @param {string} message\n */\nexport function logWarn(message) {\n console.warn(`PhotoSphereViewer: ${message}`);\n}\n\n/**\n * @summary Checks if an object is a {PSV.ExtendedPosition}, ie has x/y or longitude/latitude\n * @memberOf PSV.utils\n * @param {object} object\n * @returns {boolean}\n */\nexport function isExtendedPosition(object) {\n return [['x', 'y'], ['longitude', 'latitude']].some(([key1, key2]) => {\n return object[key1] !== undefined && object[key2] !== undefined;\n });\n}\n\n/**\n * @summary Returns the value of a given attribute in the panorama metadata\n * @memberOf PSV.utils\n * @param {string} data\n * @param {string} attr\n * @returns (number)\n */\nexport function getXMPValue(data, attr) {\n // XMP data are stored in children\n let result = data.match('(.*)');\n if (result !== null) {\n const val = parseInt(result[1], 10);\n return isNaN(val) ? null : val;\n }\n\n // XMP data are stored in attributes\n result = data.match('GPano:' + attr + '=\"(.*?)\"');\n if (result !== null) {\n const val = parseInt(result[1], 10);\n return isNaN(val) ? null : val;\n }\n\n return null;\n}\n\n/**\n * @readonly\n * @private\n * @type {{top: string, left: string, bottom: string, center: string, right: string}}\n */\nconst CSS_POSITIONS = {\n top : '0%',\n bottom: '100%',\n left : '0%',\n right : '100%',\n center: '50%',\n};\n\n/**\n * @summary Translate CSS values like \"top center\" or \"10% 50%\" as top and left positions\n * @memberOf PSV.utils\n * @description The implementation is as close as possible to the \"background-position\" specification\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}\n * @param {string|PSV.Point} value\n * @returns {PSV.Point}\n */\nexport function parsePosition(value) {\n if (!value) {\n return { x: 0.5, y: 0.5 };\n }\n\n if (typeof value === 'object') {\n return value;\n }\n\n let tokens = value.toLocaleLowerCase().split(' ').slice(0, 2);\n\n if (tokens.length === 1) {\n if (CSS_POSITIONS[tokens[0]] !== undefined) {\n tokens = [tokens[0], 'center'];\n }\n else {\n tokens = [tokens[0], tokens[0]];\n }\n }\n\n const xFirst = tokens[1] !== 'left' && tokens[1] !== 'right' && tokens[0] !== 'top' && tokens[0] !== 'bottom';\n\n tokens = tokens.map(token => CSS_POSITIONS[token] || token);\n\n if (!xFirst) {\n tokens.reverse();\n }\n\n const parsed = tokens.join(' ').match(/^([0-9.]+)% ([0-9.]+)%$/);\n\n if (parsed) {\n return {\n x: parseFloat(parsed[1]) / 100,\n y: parseFloat(parsed[2]) / 100,\n };\n }\n else {\n return { x: 0.5, y: 0.5 };\n }\n}\n\n/**\n * @readonly\n * @private\n */\nconst LEFT_MAP = { 0: 'left', 0.5: 'center', 1: 'right' };\n/**\n * @readonly\n * @private\n */\nconst TOP_MAP = { 0: 'top', 0.5: 'center', 1: 'bottom' };\n\n/**\n * @summary Parse a CSS-like position into an array of position keywords among top, bottom, left, right and center\n * @memberOf PSV.utils\n * @param {string | string[]} value\n * @param {string} defaultValue\n * @param {boolean} [allowCenter=true]\n * @return {string[]}\n */\nexport function cleanPosition(value, defaultValue, allowCenter = true) {\n if (!value) {\n return defaultValue.split(' ');\n }\n\n if (typeof value === 'string') {\n const tempPos = parsePosition(value);\n\n if (!(tempPos.x in LEFT_MAP) || !(tempPos.y in TOP_MAP)) {\n throw new PSVError(`Unable to parse position \"${value}\"`);\n }\n\n value = [TOP_MAP[tempPos.y], LEFT_MAP[tempPos.x]];\n }\n\n if (!allowCenter && value[0] === 'center' && value[1] === 'center') {\n throw new PSVError('Unable to parse position \"center center\"');\n }\n\n return value;\n}\n\n/**\n * @summary Parses an speed\n * @memberOf PSV.utils\n * @param {string|number} speed - The speed, in radians/degrees/revolutions per second/minute\n * @returns {number} radians per second\n * @throws {PSV.PSVError} when the speed cannot be parsed\n */\nexport function parseSpeed(speed) {\n let parsed;\n\n if (typeof speed === 'string') {\n const speedStr = speed.toString().trim();\n\n // Speed extraction\n let speedValue = parseFloat(speedStr.replace(/^(-?[0-9]+(?:\\.[0-9]*)?).*$/, '$1'));\n const speedUnit = speedStr.replace(/^-?[0-9]+(?:\\.[0-9]*)?(.*)$/, '$1').trim();\n\n // \"per minute\" -> \"per second\"\n if (speedUnit.match(/(pm|per minute)$/)) {\n speedValue /= 60;\n }\n\n // Which unit?\n switch (speedUnit) {\n // Degrees per minute / second\n case 'dpm':\n case 'degrees per minute':\n case 'dps':\n case 'degrees per second':\n parsed = THREE.MathUtils.degToRad(speedValue);\n break;\n\n // Radians per minute / second\n case 'rdpm':\n case 'radians per minute':\n case 'rdps':\n case 'radians per second':\n parsed = speedValue;\n break;\n\n // Revolutions per minute / second\n case 'rpm':\n case 'revolutions per minute':\n case 'rps':\n case 'revolutions per second':\n parsed = speedValue * Math.PI * 2;\n break;\n\n // Unknown unit\n default:\n throw new PSVError('Unknown speed unit \"' + speedUnit + '\"');\n }\n }\n else {\n parsed = speed;\n }\n\n return parsed;\n}\n\n/**\n * @summary Parses an angle value in radians or degrees and returns a normalized value in radians\n * @memberOf PSV.utils\n * @param {string|number} angle - eg: 3.14, 3.14rad, 180deg\n * @param {boolean} [zeroCenter=false] - normalize between -Pi - Pi instead of 0 - 2*Pi\n * @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi/2 - Pi/2 instead of -Pi - Pi\n * @returns {number}\n * @throws {PSV.PSVError} when the angle cannot be parsed\n */\nexport function parseAngle(angle, zeroCenter = false, halfCircle = zeroCenter) {\n let parsed;\n\n if (typeof angle === 'string') {\n const match = angle.toLowerCase().trim().match(/^(-?[0-9]+(?:\\.[0-9]*)?)(.*)$/);\n\n if (!match) {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n const value = parseFloat(match[1]);\n const unit = match[2];\n\n if (unit) {\n switch (unit) {\n case 'deg':\n case 'degs':\n parsed = THREE.MathUtils.degToRad(value);\n break;\n case 'rad':\n case 'rads':\n parsed = value;\n break;\n default:\n throw new PSVError('Unknown angle unit \"' + unit + '\"');\n }\n }\n else {\n parsed = value;\n }\n }\n else if (typeof angle === 'number' && !isNaN(angle)) {\n parsed = angle;\n }\n else {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n parsed = loop(zeroCenter ? parsed + Math.PI : parsed, Math.PI * 2);\n\n return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed;\n}\n\n/**\n * @summary Creates a THREE texture from an image\n * @memberOf PSV.utils\n * @param {HTMLImageElement | HTMLCanvasElement} img\n * @return {external:THREE.Texture}\n */\nexport function createTexture(img) {\n const texture = new THREE.Texture(img);\n texture.needsUpdate = true;\n texture.minFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n return texture;\n}\n\nconst quaternion = new THREE.Quaternion();\n\n/**\n * @summary Applies the inverse of Euler angles to a vector\n * @memberOf PSV.utils\n * @param {external:THREE.Vector3} vector\n * @param {external:THREE.Euler} euler\n */\nexport function applyEulerInverse(vector, euler) {\n quaternion.setFromEuler(euler).invert();\n vector.applyQuaternion(quaternion);\n}\n","import { EASINGS } from '../data/constants';\nimport { each } from './misc';\nimport { logWarn } from './psv';\n\n/**\n * @callback OnTick\n * @summary Function called for each animation frame with computed properties\n * @memberOf PSV.utils.Animation\n * @param {Object.} properties - current values\n * @param {float} progress - 0 to 1\n */\n\n/**\n * @summary Interpolation helper for animations\n * @memberOf PSV.utils\n * @description\n * Implements the Promise API with an additional \"cancel\" method.\n * The promise is resolved with `true` when the animation is completed and `false` if the animation is cancelled.\n * @example\n * const anim = new Animation({\n * properties: {\n * width: {start: 100, end: 200}\n * },\n * duration: 5000,\n * onTick: (properties) => element.style.width = `${properties.width}px`;\n * });\n *\n * anim.then((completed) => ...);\n *\n * anim.cancel()\n */\nexport class Animation {\n\n /**\n * @param {Object} options\n * @param {Object.} options.properties\n * @param {number} options.properties[].start\n * @param {number} options.properties[].end\n * @param {number} options.duration\n * @param {number} [options.delay=0]\n * @param {string} [options.easing='linear']\n * @param {PSV.utils.Animation.OnTick} options.onTick - called on each frame\n */\n constructor(options) {\n this.__callbacks = [];\n\n if (options) {\n if (!options.easing || typeof options.easing === 'string') {\n options.easing = EASINGS[options.easing || 'linear'];\n }\n\n this.__start = null;\n this.options = options;\n\n if (options.delay) {\n this.__delayTimeout = setTimeout(() => {\n this.__delayTimeout = null;\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }, options.delay);\n }\n else {\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }\n }\n else {\n this.__resolved = true;\n }\n }\n\n /**\n * @summary Main loop for the animation\n * @param {number} timestamp\n * @private\n */\n __run(timestamp) {\n // first iteration\n if (this.__start === null) {\n this.__start = timestamp;\n }\n\n // compute progress\n const progress = (timestamp - this.__start) / this.options.duration;\n const current = {};\n\n if (progress < 1.0) {\n // interpolate properties\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.start + (prop.end - prop.start) * this.options.easing(progress);\n }\n });\n this.options.onTick(current, progress);\n\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }\n else {\n // call onTick one last time with final values\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.end;\n }\n });\n this.options.onTick(current, 1.0);\n\n this.__animationFrame = window.requestAnimationFrame(() => {\n this.__resolved = true;\n this.__resolve(true);\n });\n }\n }\n\n /**\n * @private\n */\n __resolve(value) {\n this.__callbacks.forEach(cb => cb(value));\n this.__callbacks.length = 0;\n }\n\n /**\n * @summary Promise chaining\n * @param {Function} [onFulfilled] - Called when the animation is complete (true) or cancelled (false)\n * @param {Function} [onRejected] - deprecated\n * @returns {Promise}\n */\n then(onFulfilled = null, onRejected = null) {\n if (onRejected) {\n logWarn('Animation#then does not accept a rejection handler anymore');\n }\n\n if (this.__resolved || this.__cancelled) {\n return Promise.resolve(this.__resolved)\n .then(onFulfilled);\n }\n\n return new Promise((resolve) => {\n this.__callbacks.push(resolve);\n })\n .then(onFulfilled);\n }\n\n /**\n * @summary Cancels the animation\n */\n cancel() {\n if (!this.__cancelled && !this.__resolved) {\n this.__cancelled = true;\n this.__resolve(false);\n\n if (this.__delayTimeout) {\n window.clearTimeout(this.__delayTimeout);\n this.__delayTimeout = null;\n }\n if (this.__animationFrame) {\n window.cancelAnimationFrame(this.__animationFrame);\n this.__animationFrame = null;\n }\n }\n }\n\n /**\n * @deprecated not supported anymore\n */\n catch() {\n logWarn('Animation#catch is not supported anymore');\n return this.then();\n }\n\n /**\n * @deprecated not supported anymore\n */\n finally(onFinally) {\n logWarn('Animation#finally is not supported anymore');\n return this.then(onFinally);\n }\n\n /**\n * @deprecated not supported anymore\n */\n static resolve() {\n logWarn('Animation.resolve is not supported anymore');\n }\n\n}\n","import { PSVError } from '../PSVError';\nimport { bound, loop } from './math';\n\n/**\n * @summary Represents a variable that can dynamically change with time (using requestAnimationFrame)\n * @memberOf PSV.utils\n */\nexport class Dynamic {\n\n static STOP = 0;\n static INFINITE = 1;\n static POSITION = 2;\n\n /**\n * @param {Function} [fn] Callback function\n * @param {number} [defaultValue] Default position\n * @param {number} [min] Minimum position\n * @param {number} [max] Maximum position\n * @param {boolean} [loopValue] Loop value between min and max\n */\n constructor(fn, defaultValue = 0, min = -Infinity, max = Infinity, loopValue = false) {\n /**\n * @type {Function}\n * @private\n * @readonly\n */\n this.fn = fn;\n\n /**\n * @type {number}\n * @private\n */\n this.mode = Dynamic.STOP;\n\n /**\n * @type {number}\n * @private\n */\n this.speed = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.speedMult = 1;\n\n /**\n * @type {number}\n * @private\n */\n this.currentSpeed = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.target = 0;\n\n /**\n * @type {number}\n * @readonly\n */\n this.current = defaultValue;\n\n /**\n * @type {number}\n * @private\n */\n this.min = min;\n\n /**\n * @type {number}\n * @private\n */\n this.max = max;\n\n /**\n * @type {boolean}\n * @private\n */\n this.loopValue = loopValue;\n\n if (loopValue && min !== 0) {\n throw new PSVError('invalid config');\n }\n\n if (this.fn) {\n this.fn(defaultValue);\n }\n }\n\n /**\n * Changes base speed\n * @param {number} speed\n */\n setSpeed(speed) {\n this.speed = speed;\n }\n\n /**\n * Defines the target position\n * @param {number} position\n * @param {number} [speedMult=1]\n */\n goto(position, speedMult = 1) {\n this.mode = Dynamic.POSITION;\n this.target = this.loopValue ? loop(position, this.max) : bound(position, this.min, this.max);\n this.speedMult = speedMult;\n }\n\n /**\n * Increase/decrease the target position\n * @param {number} step\n * @param {number} [speedMult=1]\n */\n step(step, speedMult = 1) {\n if (this.mode !== Dynamic.POSITION) {\n this.target = this.current;\n }\n this.goto(this.target + step, speedMult);\n }\n\n /**\n * Starts infinite movement\n * @param {boolean} [invert=false]\n * @param {number} [speedMult=1]\n */\n roll(invert = false, speedMult = 1) {\n this.mode = Dynamic.INFINITE;\n this.target = invert ? -Infinity : Infinity;\n this.speedMult = speedMult;\n }\n\n /**\n * Stops movement\n */\n stop() {\n this.mode = Dynamic.STOP;\n }\n\n /**\n * Defines the current position and immediately stops movement\n * @param {number} value\n */\n setValue(value) {\n this.target = this.loopValue ? loop(value, this.max) : bound(value, this.min, this.max);\n this.mode = Dynamic.STOP;\n if (this.target !== this.current) {\n this.current = this.target;\n if (this.fn) {\n this.fn(this.current);\n }\n return true;\n }\n return false;\n }\n\n /**\n * @package\n */\n update(elapsed) {\n // in position mode switch to stop mode when in the decceleration window\n if (this.mode === Dynamic.POSITION) {\n // in loop mode, alter \"current\" to avoid crossing the origin\n if (this.loopValue && Math.abs(this.target - this.current) > this.max / 2) {\n this.current = this.current < this.target ? this.current + this.max : this.current - this.max;\n }\n\n const dstStop = this.currentSpeed * this.currentSpeed / (this.speed * this.speedMult * 4);\n if (Math.abs(this.target - this.current) <= dstStop) {\n this.mode = Dynamic.STOP;\n }\n }\n\n // compute speed\n let targetSpeed = this.mode === Dynamic.STOP ? 0 : this.speed * this.speedMult;\n if (this.target < this.current) {\n targetSpeed = -targetSpeed;\n }\n if (this.currentSpeed < targetSpeed) {\n this.currentSpeed = Math.min(targetSpeed, this.currentSpeed + elapsed / 1000 * this.speed * this.speedMult * 2);\n }\n else if (this.currentSpeed > targetSpeed) {\n this.currentSpeed = Math.max(targetSpeed, this.currentSpeed - elapsed / 1000 * this.speed * this.speedMult * 2);\n }\n\n // compute new position\n let next = null;\n if (this.current > this.target && this.currentSpeed) {\n next = Math.max(this.target, this.current + this.currentSpeed * elapsed / 1000);\n }\n else if (this.current < this.target && this.currentSpeed) {\n next = Math.min(this.target, this.current + this.currentSpeed * elapsed / 1000);\n }\n\n // apply value\n if (next !== null) {\n next = this.loopValue ? loop(next, this.max) : bound(next, this.min, this.max);\n if (next !== this.current) {\n this.current = next;\n if (this.fn) {\n this.fn(this.current);\n }\n return true;\n }\n }\n\n return false;\n }\n\n}\n","import { each } from './misc';\n\n/**\n * @summary Wrapper for multiple {@link PSV.utils.Dynamic} evolving together\n * @memberOf PSV.utils\n */\nexport class MultiDynamic {\n\n /**\n * @type {Object}\n * @readonly\n */\n get current() {\n const values = {};\n each(this.dynamics, (dynamic, name) => {\n values[name] = dynamic.current;\n });\n return values;\n }\n\n /**\n * @param {Record} dynamics\n * @param {Function} [fn] Callback function\n */\n constructor(dynamics, fn) {\n /**\n * @type {Function}\n * @private\n * @readonly\n */\n this.fn = fn;\n\n /**\n * @type {Record}\n * @private\n * @readonly\n */\n this.dynamics = dynamics;\n\n if (this.fn) {\n this.fn(this.current);\n }\n }\n\n /**\n * Changes base speed\n * @param {number} speed\n */\n setSpeed(speed) {\n each(this.dynamics, (d) => {\n d.setSpeed(speed);\n });\n }\n\n /**\n * Defines the target positions\n * @param {Record} positions\n * @param {number} [speedMult=1]\n */\n goto(positions, speedMult = 1) {\n each(positions, (position, name) => {\n this.dynamics[name].goto(position, speedMult);\n });\n }\n\n /**\n * Increase/decrease the target positions\n * @param {Record} steps\n * @param {number} [speedMult=1]\n */\n step(steps, speedMult = 1) {\n each(steps, (step, name) => {\n this.dynamics[name].step(step, speedMult);\n });\n }\n\n /**\n * Starts infinite movements\n * @param {Record} rolls\n * @param {number} [speedMult=1]\n */\n roll(rolls, speedMult = 1) {\n each(rolls, (roll, name) => {\n this.dynamics[name].roll(roll, speedMult);\n });\n }\n\n /**\n * Stops movements\n */\n stop() {\n each(this.dynamics, d => d.stop());\n }\n\n /**\n * Defines the current positions and immediately stops movements\n * @param {Record} values\n */\n setValue(values) {\n let hasUpdates = false;\n each(values, (value, name) => {\n hasUpdates |= this.dynamics[name].setValue(value);\n });\n\n if (hasUpdates && this.fn) {\n this.fn(this.current);\n }\n\n return hasUpdates;\n }\n\n /**\n * @package\n */\n update(elapsed) {\n let hasUpdates = false;\n each(this.dynamics, (dynamic) => {\n hasUpdates |= dynamic.update(elapsed);\n });\n\n if (hasUpdates && this.fn) {\n this.fn(this.current);\n }\n\n return hasUpdates;\n }\n\n}\n","import { EventEmitter } from 'uevent';\n\n/**\n * @summary Helper to make sliders elements\n * @memberOf PSV.utils\n */\nexport class Slider extends EventEmitter {\n\n static VERTICAL = 1;\n static HORIZONTAL = 2;\n\n /**\n * @type {boolean}\n * @readonly\n */\n get vertical() {\n return this.prop.direction === Slider.VERTICAL;\n }\n\n constructor({ psv, container, direction, onUpdate }) {\n super();\n\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = container;\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} mousedown\n * @property {number} mediaMinWidth\n */\n this.prop = {\n onUpdate : onUpdate,\n direction: direction,\n mousedown: false,\n mouseover: false,\n };\n\n this.container.addEventListener('click', this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mouseenter', this);\n this.container.addEventListener('mouseleave', this);\n this.container.addEventListener('touchstart', this);\n this.container.addEventListener('mousemove', this, true);\n this.container.addEventListener('touchmove', this, true);\n window.addEventListener('mouseup', this);\n window.addEventListener('touchend', this);\n }\n\n /**\n * @protected\n */\n destroy() {\n window.removeEventListener('mouseup', this);\n window.removeEventListener('touchend', this);\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'click': e.stopPropagation(); break;\n case 'mousedown': this.__onMouseDown(e); break;\n case 'mouseenter': this.__onMouseEnter(e); break;\n case 'mouseleave': this.__onMouseLeave(e); break;\n case 'touchstart': this.__onTouchStart(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'touchmove': this.__onTouchMove(e); break;\n case 'mouseup': this.__onMouseUp(e); break;\n case 'touchend': this.__onTouchEnd(e); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @private\n */\n __onMouseDown(evt) {\n this.prop.mousedown = true;\n this.__update(evt, true);\n }\n\n /**\n * @private\n */\n __onMouseEnter(evt) {\n this.prop.mouseover = true;\n this.__update(evt, true);\n }\n\n /**\n * @private\n */\n __onTouchStart(evt) {\n this.prop.mouseover = true;\n this.prop.mousedown = true;\n this.__update(evt.changedTouches[0], true);\n }\n\n /**\n * @private\n */\n __onMouseMove(evt) {\n if (this.prop.mousedown || this.prop.mouseover) {\n evt.stopPropagation();\n this.__update(evt, true);\n }\n }\n\n /**\n * @private\n */\n __onTouchMove(evt) {\n if (this.prop.mousedown || this.prop.mouseover) {\n evt.stopPropagation();\n this.__update(evt.changedTouches[0], true);\n }\n }\n\n /**\n * @private\n */\n __onMouseUp(evt) {\n if (this.prop.mousedown) {\n this.prop.mousedown = false;\n this.__update(evt, false);\n }\n }\n\n /**\n * @private\n */\n __onMouseLeave(evt) {\n if (this.prop.mouseover) {\n this.prop.mouseover = false;\n this.__update(evt, true);\n }\n }\n\n /**\n * @private\n */\n __onTouchEnd(evt) {\n if (this.prop.mousedown) {\n this.prop.mouseover = false;\n this.prop.mousedown = false;\n this.__update(evt.changedTouches[0], false);\n }\n }\n\n /**\n * @private\n */\n __update(evt, moving) {\n const boundingClientRect = this.container.getBoundingClientRect();\n const cursor = evt[this.vertical ? 'clientY' : 'clientX'];\n const pos = boundingClientRect[this.vertical ? 'bottom' : 'left'];\n const size = boundingClientRect[this.vertical ? 'height' : 'width'];\n const val = Math.abs((pos - cursor) / size);\n\n this.prop.onUpdate({\n value : val,\n click : !moving,\n mousedown: this.prop.mousedown,\n mouseover: this.prop.mouseover,\n cursor : evt,\n });\n }\n\n}\n","/**\n * @namespace PSV.utils\n */\n\nexport * from './browser';\nexport * from './math';\nexport * from './misc';\nexport * from './psv';\n\nexport * from './Animation';\nexport * from './Dynamic';\nexport * from './MultiDynamic';\nexport * from './Slider';\n","import * as THREE from 'three';\nimport { SPHERE_RADIUS } from '../../data/constants';\nimport { SYSTEM } from '../../data/system';\nimport { PSVError } from '../../PSVError';\nimport { createTexture, firstNonNull, getXMPValue, isPowerOfTwo, logWarn } from '../../utils';\nimport { AbstractAdapter } from '../AbstractAdapter';\n\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n */\n\n\n/**\n * @summary Adapter for equirectangular panoramas\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularAdapter extends AbstractAdapter {\n\n static id = 'equirectangular';\n static supportsDownload = true;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.EquirectangularAdapter.Options}\n * @private\n */\n this.config = {\n resolution: 64,\n ...options,\n };\n\n if (!isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n }\n\n /**\n * @override\n */\n supportsTransition() {\n return true;\n }\n\n /**\n * @override\n */\n supportsPreload() {\n return true;\n }\n\n /**\n * @override\n * @param {string} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n */\n loadTexture(panorama, newPanoData) {\n if (typeof panorama !== 'string') {\n if (Array.isArray(panorama) || typeof panorama === 'object' && !!panorama.left) {\n logWarn('Cubemap support now requires an additional adapter, see https://photo-sphere-viewer.js.org/guide/adapters');\n }\n return Promise.reject(new PSVError('Invalid panorama url, are you using the right adapter?'));\n }\n\n return (\n !this.psv.config.useXmpData\n ? this.psv.textureLoader.loadImage(panorama, p => this.psv.loader.setProgress(p))\n .then(img => ({ img: img, xmpPanoData: null }))\n : this.__loadXMP(panorama, p => this.psv.loader.setProgress(p))\n .then(xmpPanoData => this.psv.textureLoader.loadImage(panorama).then(img => ({ img, xmpPanoData })))\n )\n .then(({ img, xmpPanoData }) => {\n if (typeof newPanoData === 'function') {\n newPanoData = newPanoData(img);\n }\n\n const panoData = {\n fullWidth : firstNonNull(newPanoData?.fullWidth, xmpPanoData?.fullWidth, img.width),\n fullHeight : firstNonNull(newPanoData?.fullHeight, xmpPanoData?.fullHeight, img.height),\n croppedWidth : firstNonNull(newPanoData?.croppedWidth, xmpPanoData?.croppedWidth, img.width),\n croppedHeight: firstNonNull(newPanoData?.croppedHeight, xmpPanoData?.croppedHeight, img.height),\n croppedX : firstNonNull(newPanoData?.croppedX, xmpPanoData?.croppedX, 0),\n croppedY : firstNonNull(newPanoData?.croppedY, xmpPanoData?.croppedY, 0),\n poseHeading : firstNonNull(newPanoData?.poseHeading, xmpPanoData?.poseHeading, 0),\n posePitch : firstNonNull(newPanoData?.posePitch, xmpPanoData?.posePitch, 0),\n poseRoll : firstNonNull(newPanoData?.poseRoll, xmpPanoData?.poseRoll, 0),\n };\n\n if (panoData.croppedWidth !== img.width || panoData.croppedHeight !== img.height) {\n logWarn(`Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image.\n panoData: ${panoData.croppedWidth}x${panoData.croppedHeight}, image: ${img.width}x${img.height}`);\n }\n if ((newPanoData || xmpPanoData) && panoData.fullWidth !== panoData.fullHeight * 2) {\n logWarn('Invalid panoData, fullWidth should be twice fullHeight');\n }\n\n const texture = this.__createEquirectangularTexture(img, panoData);\n\n return { panorama, texture, panoData };\n });\n }\n\n /**\n * @summary Loads the XMP data of an image\n * @param {string} panorama\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @private\n */\n __loadXMP(panorama, onProgress) {\n return this.psv.textureLoader.loadFile(panorama, onProgress)\n .then(blob => this.__loadBlobAsString(blob))\n .then((binary) => {\n const a = binary.indexOf('');\n const data = binary.substring(a, b);\n\n if (a !== -1 && b !== -1 && data.includes('GPano:')) {\n return {\n fullWidth : getXMPValue(data, 'FullPanoWidthPixels'),\n fullHeight : getXMPValue(data, 'FullPanoHeightPixels'),\n croppedWidth : getXMPValue(data, 'CroppedAreaImageWidthPixels'),\n croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'),\n croppedX : getXMPValue(data, 'CroppedAreaLeftPixels'),\n croppedY : getXMPValue(data, 'CroppedAreaTopPixels'),\n poseHeading : getXMPValue(data, 'PoseHeadingDegrees'),\n posePitch : getXMPValue(data, 'PosePitchDegrees'),\n poseRoll : getXMPValue(data, 'PoseRollDegrees'),\n };\n }\n\n return null;\n });\n }\n\n /**\n * @summmary read a Blob as string\n * @param {Blob} blob\n * @returns {Promise}\n * @private\n */\n __loadBlobAsString(blob) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result);\n reader.onerror = reject;\n reader.readAsText(blob);\n });\n }\n\n /**\n * @summary Creates the final texture from image and panorama data\n * @param {Image} img\n * @param {PSV.PanoData} panoData\n * @returns {external:THREE.Texture}\n * @private\n */\n __createEquirectangularTexture(img, panoData) {\n // resize image / fill cropped parts with black\n if (panoData.fullWidth > SYSTEM.maxTextureWidth\n || panoData.croppedWidth !== panoData.fullWidth\n || panoData.croppedHeight !== panoData.fullHeight\n ) {\n const ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth;\n\n const resizedPanoData = { ...panoData };\n if (ratio < 1) {\n resizedPanoData.fullWidth *= ratio;\n resizedPanoData.fullHeight *= ratio;\n resizedPanoData.croppedWidth *= ratio;\n resizedPanoData.croppedHeight *= ratio;\n resizedPanoData.croppedX *= ratio;\n resizedPanoData.croppedY *= ratio;\n }\n\n const buffer = document.createElement('canvas');\n buffer.width = resizedPanoData.fullWidth;\n buffer.height = resizedPanoData.fullHeight;\n\n const ctx = buffer.getContext('2d');\n ctx.drawImage(img,\n resizedPanoData.croppedX, resizedPanoData.croppedY,\n resizedPanoData.croppedWidth, resizedPanoData.croppedHeight);\n\n return createTexture(buffer);\n }\n\n return createTexture(img);\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n // The middle of the panorama is placed at longitude=0\n const geometry = new THREE.SphereGeometry(\n SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1);\n\n const material = new THREE.MeshBasicMaterial();\n\n return new THREE.Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n mesh.material.map?.dispose();\n mesh.material.map = textureData.texture;\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material.opacity = opacity;\n mesh.material.transparent = opacity < 1;\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n textureData.texture?.dispose();\n }\n\n}\n","/**\n * @namespace PSV.components\n */\n\n/**\n * @summary Base component class\n * @memberof PSV.components\n * @abstract\n */\nexport class AbstractComponent {\n\n /**\n * @param {PSV.Viewer | PSV.components.AbstractComponent} parent\n * @param {string} className - CSS class added to the component's container\n */\n constructor(parent, className) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = parent.psv || parent;\n\n /**\n * @member {PSV.Viewer|PSV.components.AbstractComponent}\n * @readonly\n */\n this.parent = parent;\n this.parent.children.push(this);\n\n /**\n * @summary All child components\n * @type {PSV.components.AbstractComponent[]}\n * @readonly\n * @package\n */\n this.children = [];\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} visible - Visibility of the component\n */\n this.prop = {\n visible: true,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.className = className;\n this.parent.container.appendChild(this.container);\n }\n\n /**\n * @summary Destroys the component\n * @protected\n */\n destroy() {\n this.parent.container.removeChild(this.container);\n\n const childIdx = this.parent.children.indexOf(this);\n if (childIdx !== -1) {\n this.parent.children.splice(childIdx, 1);\n }\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n delete this.container;\n delete this.parent;\n delete this.psv;\n delete this.prop;\n }\n\n /**\n * @summary Refresh UI\n * @description Must be be a very lightweight operation\n * @package\n */\n refreshUi() {\n this.children.every((child) => {\n child.refreshUi();\n return this.psv.prop.uiRefresh === true;\n });\n }\n\n /**\n * @summary Displays or hides the component\n */\n toggle() {\n if (this.isVisible()) {\n this.hide();\n }\n else {\n this.show();\n }\n }\n\n /**\n * @summary Hides the component\n */\n hide() {\n this.container.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @summary Displays the component\n */\n show() {\n this.container.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @summary Checks if the component is visible\n * @returns {boolean}\n */\n isVisible() {\n return this.prop.visible;\n }\n\n}\n","import { AbstractComponent } from '../components/AbstractComponent';\nimport { KEY_CODES } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { isPlainObject, toggleClass } from '../utils';\n\n/**\n * @namespace PSV.buttons\n */\n\n/**\n * @summary Base navbar button class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.buttons\n * @abstract\n */\nexport class AbstractButton extends AbstractComponent {\n\n /**\n * @summary Unique identifier of the button\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @summary Identifier to declare a group of buttons\n * @member {string}\n * @readonly\n * @static\n */\n static groupId = null;\n\n /**\n * @summary SVG icon name injected in the button\n * @member {string}\n * @readonly\n * @static\n */\n static icon = null;\n\n /**\n * @summary SVG icon name injected in the button when it is active\n * @member {string}\n * @readonly\n * @static\n */\n static iconActive = null;\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} [className] - Additional CSS classes\n * @param {boolean} [collapsable=false] - `true` if the button can be moved to menu when the navbar is too small\n * @param {boolean} [tabbable=true] - `true` if the button is accessible with the keyboard\n */\n constructor(navbar, className = '', collapsable = false, tabbable = true) {\n super(navbar, 'psv-button ' + className);\n\n /**\n * @override\n * @property {string} id - Unique identifier of the button\n * @property {boolean} enabled\n * @property {boolean} supported\n * @property {boolean} collapsed\n * @property {boolean} active\n * @property {number} width\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable: collapsable,\n enabled : true,\n supported : true,\n collapsed : false,\n active : false,\n width : this.container.offsetWidth,\n };\n\n if (this.constructor.icon) {\n this.__setIcon(this.constructor.icon);\n }\n\n if (this.prop.id && this.psv.config.lang[this.prop.id]) {\n this.container.title = this.psv.config.lang[this.prop.id];\n }\n\n if (tabbable) {\n this.container.tabIndex = 0;\n }\n\n this.container.addEventListener('click', (e) => {\n if (this.prop.enabled) {\n this.onClick();\n }\n e.stopPropagation();\n });\n\n this.container.addEventListener('keydown', (e) => {\n if (e.key === KEY_CODES.Enter && this.prop.enabled) {\n this.onClick();\n e.stopPropagation();\n }\n });\n }\n\n /**\n * @package\n */\n checkSupported() {\n const supportedOrObject = this.isSupported();\n if (isPlainObject(supportedOrObject)) {\n if (supportedOrObject.initial === false) {\n this.hide();\n this.prop.supported = false;\n }\n\n supportedOrObject.promise.then((supported) => {\n if (!this.prop) {\n return; // the component has been destroyed\n }\n this.prop.supported = supported;\n if (!supported) {\n this.hide();\n }\n else {\n this.show();\n }\n });\n }\n else {\n this.prop.supported = supportedOrObject;\n if (!supportedOrObject) {\n this.hide();\n }\n }\n }\n\n /**\n * @summary Checks if the button can be displayed\n * @returns {boolean|{initial: boolean, promise: Promise}}\n */\n isSupported() {\n return true;\n }\n\n /**\n * @summary Changes the active state of the button\n * @param {boolean} [active] - forced state\n */\n toggleActive(active) {\n this.prop.active = active !== undefined ? active : !this.prop.active;\n toggleClass(this.container, 'psv-button--active', this.prop.active);\n\n if (this.constructor.iconActive) {\n this.__setIcon(this.prop.active ? this.constructor.iconActive : this.constructor.icon);\n }\n }\n\n /**\n * @override\n */\n show(refresh = true) {\n if (!this.isVisible()) {\n this.prop.visible = true;\n if (!this.prop.collapsed) {\n this.container.style.display = '';\n }\n if (refresh) {\n this.psv.refreshUi(`show button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @override\n */\n hide(refresh = true) {\n if (this.isVisible()) {\n this.prop.visible = false;\n this.container.style.display = 'none';\n if (refresh) {\n this.psv.refreshUi(`hide button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @summary Disables the button\n */\n disable() {\n this.container.classList.add('psv-button--disabled');\n this.prop.enabled = false;\n }\n\n /**\n * @summary Enables the button\n */\n enable() {\n this.container.classList.remove('psv-button--disabled');\n this.prop.enabled = true;\n }\n\n /**\n * @summary Collapses the button in the navbar menu\n */\n collapse() {\n this.prop.collapsed = true;\n this.container.style.display = 'none';\n }\n\n /**\n * @summary Uncollapses the button from the navbar menu\n */\n uncollapse() {\n this.prop.collapsed = false;\n if (this.prop.visible) {\n this.container.style.display = '';\n }\n }\n\n /**\n * @summary Set the button icon\n * @param {string} icon SVG\n * @param {HTMLElement} [container] - default is the main button container\n * @private\n */\n __setIcon(icon, container = this.container) {\n if (icon) {\n container.innerHTML = icon;\n // className is read-only on SVGElement\n container.querySelector('svg').classList.add('psv-button-svg');\n }\n else {\n container.innerHTML = '';\n }\n }\n\n /**\n * @summary Action when the button is clicked\n * @private\n * @abstract\n */\n onClick() {\n throw new PSVError(`onClick not implemented for button \"${this.prop.id}\".`);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport playActive from '../icons/play-active.svg';\nimport play from '../icons/play.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar autorotate button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AutorotateButton extends AbstractButton {\n\n static id = 'autorotate';\n static icon = play;\n static iconActive = playActive;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-autorotate-button', true);\n\n this.psv.on(EVENTS.AUTOROTATE, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.AUTOROTATE, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.AUTOROTATE: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles autorotate\n */\n onClick() {\n if (this.psv.isAutorotateEnabled()) {\n this.psv.config.autorotateIdle = false;\n this.psv.resetIdleTimer();\n }\n this.psv.toggleAutorotate();\n }\n\n}\n","import { addClasses } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar custom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CustomButton extends AbstractButton {\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {PSV.NavbarCustomButton} config\n */\n constructor(navbar, config) {\n super(navbar, 'psv-custom-button', config.collapsable !== false, config.tabbable !== false);\n\n /**\n * @member {Object}\n * @readonly\n * @private\n */\n this.config = config;\n\n if (this.config.id) {\n this.prop.id = this.config.id;\n }\n else {\n this.prop.id = 'psvButton-' + Math.random().toString(36).substr(2, 9);\n }\n\n if (this.config.className) {\n addClasses(this.container, this.config.className);\n }\n\n if (this.config.title) {\n this.container.title = this.config.title;\n }\n\n if (this.config.content) {\n this.container.innerHTML = this.config.content;\n }\n\n this.prop.width = this.container.offsetWidth;\n\n if (this.config.enabled === false) {\n this.disable();\n }\n\n if (this.config.visible === false) {\n this.hide();\n }\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.config;\n\n super.destroy();\n }\n\n /**\n * @override\n * @description Calls user method\n */\n onClick() {\n if (this.config.onClick) {\n this.config.onClick.apply(this.psv);\n }\n }\n\n}\n","import { EVENTS, IDS } from '../data/constants';\nimport info from '../icons/info.svg';\nimport { AbstractButton } from './AbstractButton';\n\nconst MODE_NOTIF = 1;\nconst MODE_PANEL = 2;\n\n/**\n * @summary Navigation bar description button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class DescriptionButton extends AbstractButton {\n\n static id = 'description';\n static icon = info;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-description-button');\n\n /**\n * @override\n * @property {string} mode - notification or panel\n */\n this.prop = {\n ...this.prop,\n mode: null,\n };\n\n this.psv.on(EVENTS.HIDE_NOTIFICATION, this);\n this.psv.on(EVENTS.SHOW_NOTIFICATION, this);\n this.psv.on(EVENTS.CLOSE_PANEL, this);\n this.psv.on(EVENTS.OPEN_PANEL, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.HIDE_NOTIFICATION, this);\n this.psv.off(EVENTS.SHOW_NOTIFICATION, this);\n this.psv.off(EVENTS.CLOSE_PANEL, this);\n this.psv.off(EVENTS.OPEN_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (!this.prop.mode) {\n return;\n }\n\n let closed = false;\n switch (e.type) {\n case EVENTS.HIDE_NOTIFICATION:\n closed = this.prop.mode === MODE_NOTIF;\n break;\n\n case EVENTS.SHOW_NOTIFICATION:\n closed = this.prop.mode === MODE_NOTIF && e.args[0] !== IDS.DESCRIPTION;\n break;\n\n case EVENTS.CLOSE_PANEL:\n closed = this.prop.mode === MODE_PANEL;\n break;\n\n case EVENTS.OPEN_PANEL:\n closed = this.prop.mode === MODE_PANEL && e.args[0] !== IDS.DESCRIPTION;\n break;\n\n default:\n }\n\n if (closed) {\n this.toggleActive(false);\n this.prop.mode = null;\n }\n }\n\n /**\n * @override\n */\n hide(refresh) {\n super.hide(refresh);\n\n if (this.prop.mode) {\n this.__close();\n }\n }\n\n /**\n * This button can only be refresh from NavbarCaption\n * @override\n */\n refreshUi(refresh = false) {\n if (refresh) {\n const caption = this.psv.navbar.getButton('caption', false);\n const captionHidden = caption && !caption.isVisible();\n const hasDescription = !!this.psv.config.description;\n\n if (captionHidden || hasDescription) {\n this.show(false);\n }\n else {\n this.hide(false);\n }\n }\n }\n\n /**\n * @override\n * @description Toggles caption\n */\n onClick() {\n if (this.prop.mode) {\n this.__close();\n }\n else {\n this.__open();\n }\n }\n\n /**\n * @private\n */\n __close() {\n switch (this.prop.mode) {\n case MODE_NOTIF:\n this.psv.notification.hide(IDS.DESCRIPTION);\n break;\n case MODE_PANEL:\n this.psv.panel.hide(IDS.DESCRIPTION);\n break;\n default:\n }\n }\n\n /**\n * @private\n */\n __open() {\n this.toggleActive(true);\n\n if (this.psv.config.description) {\n this.prop.mode = MODE_PANEL;\n this.psv.panel.show({\n id : IDS.DESCRIPTION,\n content: `${this.psv.config.caption ? `

${this.psv.config.caption}

` : ''}${this.psv.config.description}`,\n });\n }\n else {\n this.prop.mode = MODE_NOTIF;\n this.psv.notification.show({\n id : IDS.DESCRIPTION,\n content: this.psv.config.caption,\n });\n }\n }\n\n}\n","import download from '../icons/download.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar download button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class DownloadButton extends AbstractButton {\n\n static id = 'download';\n static icon = download;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-download-button', true);\n }\n\n /**\n * @override\n * @description Asks the browser to download the panorama source file\n */\n onClick() {\n const link = document.createElement('a');\n link.href = this.psv.config.downloadUrl || this.psv.config.panorama;\n link.download = link.href.split('/').pop();\n this.psv.container.appendChild(link);\n link.click();\n\n setTimeout(() => {\n this.psv.container.removeChild(link);\n }, 100);\n }\n\n /**\n * @override\n */\n refreshUi() {\n const supported = this.psv.adapter.constructor.supportsDownload || this.psv.config.downloadUrl;\n if (supported && !this.prop.visible) {\n this.show();\n }\n else if (!supported && this.prop.visible) {\n this.hide();\n }\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport fullscreenIn from '../icons/fullscreen-in.svg';\nimport fullscreenOut from '../icons/fullscreen-out.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar fullscreen button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class FullscreenButton extends AbstractButton {\n\n static id = 'fullscreen';\n static icon = fullscreenIn;\n static iconActive = fullscreenOut;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-fullscreen-button');\n\n this.psv.on(EVENTS.FULLSCREEN_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.FULLSCREEN_UPDATED, this);\n\n super.destroy();\n }\n\n /**\n * Handle events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.FULLSCREEN_UPDATED: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles fullscreen\n */\n onClick() {\n this.psv.toggleFullscreen();\n }\n\n}\n","import { EVENTS, IDS } from '../data/constants';\nimport menuIcon from '../icons/menu.svg';\nimport { dasherize, getClosest } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar menu button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class MenuButton extends AbstractButton {\n\n static id = 'menu';\n static icon = menuIcon;\n\n /**\n * @summary Property name added to buttons list\n * @type {string}\n * @constant\n */\n static BUTTON_DATA = 'psvButton';\n\n /**\n * @summary Menu template\n * @param {AbstractButton[]} buttons\n * @param {PSV.Viewer} psv\n * @param {string} dataKey\n * @returns {string}\n */\n static MENU_TEMPLATE = (buttons, psv, dataKey) => `\n
\n

${menuIcon} ${psv.config.lang.menu}

\n
    \n ${buttons.map(button => `\n
  • \n ${button.container.innerHTML}\n ${button.container.title}\n
  • \n `).join('')}\n
\n
\n`;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-menu-button');\n\n this.psv.on(EVENTS.OPEN_PANEL, this);\n this.psv.on(EVENTS.CLOSE_PANEL, this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.OPEN_PANEL, this);\n this.psv.off(EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === IDS.MENU); break;\n case EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n hide(refresh) {\n super.hide(refresh);\n this.__hideMenu();\n }\n\n /**\n * @override\n */\n show(refresh) {\n super.show(refresh);\n\n if (this.prop.active) {\n this.__showMenu();\n }\n }\n\n /**\n * @override\n * @description Toggles menu\n */\n onClick() {\n if (this.prop.active) {\n this.__hideMenu();\n }\n else {\n this.__showMenu();\n }\n }\n\n __showMenu() {\n this.psv.panel.show({\n id : IDS.MENU,\n content : MenuButton.MENU_TEMPLATE(this.parent.collapsed, this.psv, dasherize(MenuButton.BUTTON_DATA)),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? getClosest(e.target, 'li') : undefined;\n const buttonId = li ? li.dataset[MenuButton.BUTTON_DATA] : undefined;\n\n if (buttonId) {\n this.parent.getButton(buttonId).onClick();\n this.__hideMenu();\n }\n },\n });\n }\n\n __hideMenu() {\n this.psv.panel.hide(IDS.MENU);\n }\n\n}\n","/**\n * @summary Helper for pressable things (buttons, keyboard)\n * @description When the pressed thing goes up and was not pressed long enough, wait a bit more before execution\n * @private\n */\nexport class PressHandler {\n\n constructor(delay = 200) {\n this.delay = delay;\n this.time = 0;\n this.timeout = null;\n }\n\n down() {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n\n this.time = new Date().getTime();\n }\n\n up(cb) {\n if (!this.time) {\n return;\n }\n\n const elapsed = new Date().getTime() - this.time;\n if (elapsed < this.delay) {\n this.timeout = setTimeout(() => {\n cb();\n this.timeout = null;\n this.time = 0;\n }, this.delay);\n }\n else {\n cb();\n this.time = 0;\n }\n }\n\n}\n","import { KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport arrow from '../icons/arrow.svg';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractButton } from './AbstractButton';\n\nexport function getOrientedArrow(direction) {\n let angle = 0;\n switch (direction) {\n // @formatter:off\n case 'up': angle = 90; break;\n case 'right': angle = 180; break;\n case 'down': angle = -90; break;\n default: angle = 0; break;\n // @formatter:on\n }\n\n return arrow.replace('rotate(0', `rotate(${angle}`);\n}\n\n/**\n * @summary Navigation bar move button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractMoveButton extends AbstractButton {\n\n static groupId = 'move';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-move-button');\n\n this.container.title = this.psv.config.lang.move;\n\n /**\n * @override\n * @property {{longitude: boolean, latitude: boolean}} value\n * @property {PressHandler} handler\n */\n this.prop = {\n ...this.prop,\n value : value,\n handler: new PressHandler(),\n };\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('keydown', this);\n this.container.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.__onMouseUp();\n\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(); break;\n case 'mouseup': this.__onMouseUp(); break;\n case 'touchend': this.__onMouseUp(); break;\n case 'keydown': e.key === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': e.key === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.psv.__stopAll();\n this.psv.dynamics.position.roll(this.prop.value);\n this.prop.handler.down();\n }\n\n /**\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.handler.up(() => {\n this.psv.dynamics.position.stop();\n this.psv.resetIdleTimer();\n });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move down button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveDownButton extends AbstractMoveButton {\n\n static id = 'moveDown';\n static icon = getOrientedArrow('down');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { latitude: true });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move left button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveLeftButton extends AbstractMoveButton {\n\n static id = 'moveLeft';\n static icon = getOrientedArrow('left');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { longitude: true });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move right button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveRightButton extends AbstractMoveButton {\n\n static id = 'moveRight';\n static icon = getOrientedArrow('right');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { longitude: false });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move up button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveUpButton extends AbstractMoveButton {\n\n static id = 'moveUp';\n static icon = getOrientedArrow('up');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { latitude: false });\n }\n\n}\n","import { KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractZoomButton extends AbstractButton {\n\n static groupId = 'zoom';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-zoom-button');\n\n /**\n * @override\n * @property {boolean} value\n * @property {PressHandler} handler\n */\n this.prop = {\n ...this.prop,\n value : value,\n handler: new PressHandler(),\n };\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('keydown', this);\n this.container.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.__onMouseUp();\n\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(); break;\n case 'mouseup': this.__onMouseUp(); break;\n case 'touchend': this.__onMouseUp(); break;\n case 'keydown': e.key === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': e.key === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.psv.dynamics.zoom.roll(this.prop.value);\n this.prop.handler.down();\n }\n\n /**\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.handler.up(() => this.psv.dynamics.zoom.stop());\n }\n\n}\n","import { AbstractZoomButton } from './AbstractZoomButton';\nimport zoomIn from '../icons/zoom-in.svg';\n\n/**\n * @summary Navigation bar zoom-in button class\n * @extends PSV.buttons.AbstractZoomButton\n * @memberof PSV.buttons\n */\nexport class ZoomInButton extends AbstractZoomButton {\n\n static id = 'zoomIn';\n static icon = zoomIn;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, false);\n }\n\n}\n","import { AbstractZoomButton } from './AbstractZoomButton';\nimport zoomOut from '../icons/zoom-out.svg';\n\n/**\n * @summary Navigation bar zoom-out button class\n * @extends PSV.buttons.AbstractZoomButton\n * @memberof PSV.buttons\n */\nexport class ZoomOutButton extends AbstractZoomButton {\n\n static id = 'zoomOut';\n static icon = zoomOut;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, true);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { getStyle, Slider } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class ZoomRangeButton extends AbstractButton {\n\n static id = 'zoomRange';\n static groupId = 'zoom';\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-zoom-range', false, false);\n\n /**\n * @override\n * @property {number} mediaMinWidth\n */\n this.prop = {\n ...this.prop,\n mediaMinWidth: 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomRange = document.createElement('div');\n this.zoomRange.className = 'psv-zoom-range-line';\n this.container.appendChild(this.zoomRange);\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomValue = document.createElement('div');\n this.zoomValue.className = 'psv-zoom-range-handle';\n this.zoomRange.appendChild(this.zoomValue);\n\n /**\n * @member {PSV.Slider}\n * @readonly\n * @private\n */\n this.slider = new Slider({\n container: this.container,\n direction: Slider.HORIZONTAL,\n onUpdate : e => this.__onSliderUpdate(e),\n });\n\n this.prop.mediaMinWidth = parseInt(getStyle(this.container, 'maxWidth'), 10);\n\n this.psv.on(EVENTS.ZOOM_UPDATED, this);\n if (this.psv.prop.ready) {\n this.__moveZoomValue(this.psv.getZoomLevel());\n }\n else {\n this.psv.once(EVENTS.READY, this);\n }\n\n this.refreshUi();\n }\n\n /**\n * @override\n */\n destroy() {\n this.slider.destroy();\n\n delete this.zoomRange;\n delete this.zoomValue;\n\n this.psv.off(EVENTS.ZOOM_UPDATED, this);\n this.psv.off(EVENTS.READY, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.ZOOM_UPDATED: this.__moveZoomValue(e.args[0]); break;\n case EVENTS.READY: this.__moveZoomValue(this.psv.getZoomLevel()); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n refreshUi() {\n if (this.prop.supported) {\n if (this.psv.prop.size.width <= this.prop.mediaMinWidth && this.prop.visible) {\n this.hide();\n }\n else if (this.psv.prop.size.width > this.prop.mediaMinWidth && !this.prop.visible) {\n this.show();\n }\n }\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @summary Moves the zoom cursor\n * @param {number} level\n * @private\n */\n __moveZoomValue(level) {\n this.zoomValue.style.left = (level / 100 * this.zoomRange.offsetWidth - this.zoomValue.offsetWidth / 2) + 'px';\n }\n\n\n /**\n * @summary Zoom change\n * @private\n */\n __onSliderUpdate(e) {\n if (e.mousedown) {\n this.psv.zoom(e.value * 100);\n }\n }\n\n}\n","import { EventEmitter } from 'uevent';\n\n/**\n * @namespace PSV.plugins\n */\n\n/**\n * @summary Base plugins class\n * @memberof PSV.plugins\n * @abstract\n */\nexport class AbstractPlugin extends EventEmitter {\n\n /**\n * @summary Unique identifier of the plugin\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super();\n\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n }\n\n /**\n * @summary Initializes the plugin\n * @package\n */\n init() {\n }\n\n /**\n * @summary Destroys the plugin\n * @package\n */\n destroy() {\n delete this.psv;\n }\n\n}\n","import { AbstractAdapter } from '../adapters/AbstractAdapter';\nimport { EquirectangularAdapter } from '../adapters/equirectangular';\nimport { AbstractPlugin } from '../plugins/AbstractPlugin';\nimport { PSVError } from '../PSVError';\nimport { bound, clone, deepmerge, each, isNil, logWarn, parseAngle, parseSpeed, pluginInterop } from '../utils';\nimport { ACTIONS, KEY_CODES } from './constants';\n\n/**\n * @summary Default options\n * @type {PSV.Options}\n * @memberOf PSV\n * @constant\n */\nexport const DEFAULTS = {\n panorama : null,\n container : null,\n adapter : null,\n plugins : [],\n caption : null,\n description : null,\n downloadUrl : null,\n loadingImg : null,\n loadingTxt : 'Loading...',\n size : null,\n fisheye : false,\n minFov : 30,\n maxFov : 90,\n defaultZoomLvl : 50,\n defaultLong : 0,\n defaultLat : 0,\n sphereCorrection : null,\n moveSpeed : 1,\n zoomSpeed : 1,\n autorotateDelay : null,\n autorotateIdle : false,\n autorotateSpeed : '2rpm',\n autorotateLat : null,\n moveInertia : true,\n mousewheel : true,\n mousemove : true,\n captureCursor : false,\n mousewheelCtrlKey : false,\n touchmoveTwoFingers: false,\n useXmpData : true,\n panoData : null,\n requestHeaders : null,\n canvasBackground : '#000',\n withCredentials : false,\n navbar : [\n 'autorotate',\n 'zoom',\n 'move',\n 'download',\n 'description',\n 'caption',\n 'fullscreen',\n ],\n lang : {\n autorotate: 'Automatic rotation',\n zoom : 'Zoom',\n zoomOut : 'Zoom out',\n zoomIn : 'Zoom in',\n move : 'Move',\n download : 'Download',\n fullscreen: 'Fullscreen',\n menu : 'Menu',\n twoFingers: 'Use two fingers to navigate',\n ctrlZoom : 'Use ctrl + scroll to zoom the image',\n loadError : 'The panorama can\\'t be loaded',\n },\n keyboard : {\n [KEY_CODES.ArrowUp] : ACTIONS.ROTATE_LAT_UP,\n [KEY_CODES.ArrowDown] : ACTIONS.ROTATE_LAT_DOWN,\n [KEY_CODES.ArrowRight]: ACTIONS.ROTATE_LONG_RIGHT,\n [KEY_CODES.ArrowLeft] : ACTIONS.ROTATE_LONG_LEFT,\n [KEY_CODES.PageUp] : ACTIONS.ZOOM_IN,\n [KEY_CODES.PageDown] : ACTIONS.ZOOM_OUT,\n [KEY_CODES.Plus] : ACTIONS.ZOOM_IN,\n [KEY_CODES.Minus] : ACTIONS.ZOOM_OUT,\n [KEY_CODES.Space] : ACTIONS.TOGGLE_AUTOROTATE,\n },\n};\n\n/**\n * @summary List of unmodifiable options and their error messages\n * @private\n */\nexport const READONLY_OPTIONS = {\n panorama : 'Use setPanorama method to change the panorama',\n panoData : 'Use setPanorama method to change the panorama',\n container: 'Cannot change viewer container',\n adapter : 'Cannot change adapter',\n plugins : 'Cannot change plugins',\n};\n\n/**\n * @summary List of deprecated options and their warning messages\n * @private\n */\nexport const DEPRECATED_OPTIONS = {\n zoomButtonIncrement : 'zoomButtonIncrement is deprecated, use zoomSpeed',\n mousewheelSpeed : 'mousewheelSpeed is deprecated, use zoomSpeed',\n sphereCorrectionReorder: 'sphereCorrectionReorder is deprecated',\n};\n\n/**\n * @summary Parsers/validators for each option\n * @private\n */\nexport const CONFIG_PARSERS = {\n container : (container) => {\n if (!container) {\n throw new PSVError('No value given for container.');\n }\n return container;\n },\n adapter : (adapter) => {\n if (!adapter) {\n adapter = [EquirectangularAdapter];\n }\n else if (Array.isArray(adapter)) {\n adapter = [pluginInterop(adapter[0], AbstractAdapter), adapter[1]];\n }\n else {\n adapter = [pluginInterop(adapter, AbstractAdapter)];\n }\n if (!adapter[0]) {\n throw new PSVError('Un undefined value with given for adapter.');\n }\n return adapter;\n },\n defaultLong : (defaultLong) => {\n // defaultLat is between 0 and PI\n return parseAngle(defaultLong);\n },\n defaultLat : (defaultLat) => {\n // defaultLat is between -PI/2 and PI/2\n return parseAngle(defaultLat, true);\n },\n minFov : (minFov, config) => {\n // minFov and maxFov must be ordered\n if (config.maxFov < minFov) {\n logWarn('maxFov cannot be lower than minFov');\n minFov = config.maxFov;\n }\n // minFov between 1 and 179\n return bound(minFov, 1, 179);\n },\n maxFov : (maxFov, config) => {\n // minFov and maxFov must be ordered\n if (maxFov < config.minFov) {\n maxFov = config.minFov;\n }\n // maxFov between 1 and 179\n return bound(maxFov, 1, 179);\n },\n lang : (lang) => {\n if (Array.isArray(lang.twoFingers)) {\n logWarn('lang.twoFingers must not be an array');\n lang.twoFingers = lang.twoFingers[0];\n }\n return {\n ...DEFAULTS.lang,\n ...lang,\n };\n },\n keyboard : (keyboard) => {\n // keyboard=true becomes the default map\n if (keyboard === true) {\n return clone(DEFAULTS.keyboard);\n }\n return keyboard;\n },\n autorotateLat : (autorotateLat, config) => {\n // default autorotateLat is defaultLat\n if (autorotateLat === null) {\n return parseAngle(config.defaultLat, true);\n }\n // autorotateLat is between -PI/2 and PI/2\n else {\n return parseAngle(autorotateLat, true);\n }\n },\n autorotateSpeed: (autorotateSpeed) => {\n return parseSpeed(autorotateSpeed);\n },\n autorotateIdle : (autorotateIdle, config) => {\n if (autorotateIdle && isNil(config.autorotateDelay)) {\n logWarn('autorotateIdle requires a non null autorotateDelay');\n return false;\n }\n return autorotateIdle;\n },\n fisheye : (fisheye) => {\n // translate boolean fisheye to amount\n if (fisheye === true) {\n return 1;\n }\n else if (fisheye === false) {\n return 0;\n }\n return fisheye;\n },\n plugins : (plugins) => {\n return plugins\n .map((plugin) => {\n if (Array.isArray(plugin)) {\n plugin = [pluginInterop(plugin[0], AbstractPlugin), plugin[1]];\n }\n else {\n plugin = [pluginInterop(plugin, AbstractPlugin)];\n }\n if (!plugin[0]) {\n throw new PSVError('Un undefined value was given for plugins.');\n }\n return plugin;\n });\n },\n};\n\n/**\n * @summary Merge user config with default config and performs validation\n * @param {PSV.Options} options\n * @returns {PSV.Options}\n * @memberOf PSV\n * @private\n */\nexport function getConfig(options) {\n const tempConfig = clone(DEFAULTS);\n deepmerge(tempConfig, options);\n\n const config = {};\n\n each(tempConfig, (value, key) => {\n if (DEPRECATED_OPTIONS[key]) {\n logWarn(DEPRECATED_OPTIONS[key]);\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (CONFIG_PARSERS[key]) {\n config[key] = CONFIG_PARSERS[key](value, tempConfig);\n }\n else {\n config[key] = value;\n }\n });\n\n return config;\n}\n","import { DescriptionButton } from '../buttons/DescriptionButton';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Navbar caption class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class NavbarCaption extends AbstractComponent {\n\n static id = 'caption';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} caption\n */\n constructor(navbar, caption) {\n super(navbar, 'psv-caption');\n\n /**\n * @override\n * @property {string} id\n * @property {boolean} collapsable\n * @property {number} width\n * @property {number} contentWidth - width of the caption content\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable : false,\n width : 0,\n contentWidth: 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-caption-content';\n this.container.appendChild(this.content);\n\n this.setCaption(caption);\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n this.show();\n this.content.innerHTML = html;\n this.prop.contentWidth = html ? this.content.offsetWidth : 0;\n this.refreshUi();\n }\n\n /**\n * @summary Toggles content and icon depending on available space\n * @private\n */\n refreshUi() {\n const availableWidth = this.container.offsetWidth;\n if (availableWidth >= this.prop.contentWidth) {\n this.show();\n }\n else if (availableWidth < this.prop.contentWidth) {\n this.hide();\n }\n this.__refreshButton();\n }\n\n /**\n * @override\n */\n hide() {\n this.content.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @override\n */\n show() {\n this.content.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @private\n */\n __refreshButton() {\n this.psv.navbar.getButton(DescriptionButton.id, false)?.refreshUi(true);\n }\n\n}\n","import { AutorotateButton } from '../buttons/AutorotateButton';\nimport { CustomButton } from '../buttons/CustomButton';\nimport { DescriptionButton } from '../buttons/DescriptionButton';\nimport { DownloadButton } from '../buttons/DownloadButton';\nimport { FullscreenButton } from '../buttons/FullscreenButton';\nimport { MenuButton } from '../buttons/MenuButton';\nimport { MoveDownButton } from '../buttons/MoveDownButton';\nimport { MoveLeftButton } from '../buttons/MoveLeftButton';\nimport { MoveRightButton } from '../buttons/MoveRightButton';\nimport { MoveUpButton } from '../buttons/MoveUpButton';\nimport { ZoomInButton } from '../buttons/ZoomInButton';\nimport { ZoomOutButton } from '../buttons/ZoomOutButton';\nimport { ZoomRangeButton } from '../buttons/ZoomRangeButton';\nimport { DEFAULTS } from '../data/config';\nimport { PSVError } from '../PSVError';\nimport { clone, logWarn } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\nimport { NavbarCaption } from './NavbarCaption';\n\n/**\n * @summary List of available buttons\n * @type {Object>}\n * @private\n */\nconst AVAILABLE_BUTTONS = {};\n\n/**\n * @summary List of available buttons\n * @type {Object>>}\n * @private\n */\nconst AVAILABLE_GROUPS = {};\n\n/**\n * @summary Register a new button available for all viewers\n * @param {Class} button\n * @param {'start' | 'end' | '[id]:left' | '[id]:right'} [defaultPosition]\n * If provided the default configuration of the navbar will be modified.\n * @memberOf PSV\n */\nexport function registerButton(button, defaultPosition) {\n if (!button.id) {\n throw new PSVError('Button ID is required');\n }\n\n AVAILABLE_BUTTONS[button.id] = button;\n\n if (button.groupId) {\n AVAILABLE_GROUPS[button.groupId] = AVAILABLE_GROUPS[button.groupId] || [];\n AVAILABLE_GROUPS[button.groupId].push(button);\n }\n\n if (typeof defaultPosition === 'string') {\n switch (defaultPosition) {\n case 'start':\n DEFAULTS.navbar.unshift(button.id);\n break;\n case 'end':\n DEFAULTS.navbar.push(button.id);\n break;\n default:\n const [id, pos] = defaultPosition.split(':');\n DEFAULTS.navbar.splice(DEFAULTS.navbar.indexOf(id) + (pos === 'right' ? 1 : 0), 0, button.id);\n }\n }\n}\n\n[\n AutorotateButton,\n ZoomOutButton,\n ZoomRangeButton,\n ZoomInButton,\n DescriptionButton,\n DownloadButton,\n FullscreenButton,\n MoveLeftButton,\n MoveRightButton,\n MoveUpButton,\n MoveDownButton,\n].forEach(registerButton);\n\n/**\n * @summary Navigation bar component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Navbar extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-navbar');\n\n /**\n * @summary List of buttons of the navbar\n * @member {PSV.buttons.AbstractButton[]}\n * @override\n */\n this.children = [];\n\n /**\n * @summary List of collapsed buttons\n * @member {PSV.buttons.AbstractButton[]}\n * @private\n */\n this.collapsed = [];\n }\n\n /**\n * @summary Change the buttons visible on the navbar\n * @param {string|Array} buttons\n * @throws {PSV.PSVError} when a button is unknown\n */\n setButtons(buttons) {\n this.children.slice().forEach(item => item.destroy());\n this.children.length = 0;\n\n const cleanedButtons = this.__cleanButtons(buttons);\n\n // force description button if caption is present (used on narrow screens)\n if (cleanedButtons.indexOf(NavbarCaption.id) !== -1 && cleanedButtons.indexOf(DescriptionButton.id) === -1) {\n cleanedButtons.splice(cleanedButtons.indexOf(NavbarCaption.id), 0, DescriptionButton.id);\n }\n\n /* eslint-disable no-new */\n cleanedButtons.forEach((button) => {\n if (typeof button === 'object') {\n new CustomButton(this, button);\n }\n else if (AVAILABLE_BUTTONS[button]) {\n new AVAILABLE_BUTTONS[button](this);\n }\n else if (AVAILABLE_GROUPS[button]) {\n AVAILABLE_GROUPS[button].forEach(buttonCtor => new buttonCtor(this)); // eslint-disable-line new-cap\n }\n else if (button === NavbarCaption.id) {\n new NavbarCaption(this, this.psv.config.caption);\n }\n else {\n throw new PSVError('Unknown button ' + button);\n }\n });\n\n new MenuButton(this);\n /* eslint-enable no-new */\n\n this.children.forEach((item) => {\n if (typeof item.checkSupported === 'function') {\n item.checkSupported();\n }\n });\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n const caption = this.getButton(NavbarCaption.id, false);\n caption?.setCaption(html);\n }\n\n /**\n * @summary Returns a button by its identifier\n * @param {string} id\n * @param {boolean} [warnNotFound=true]\n * @returns {PSV.buttons.AbstractButton}\n */\n getButton(id, warnNotFound = true) {\n let button = null;\n\n this.children.some((item) => {\n if (item.prop.id === id) {\n button = item;\n return true;\n }\n else {\n return false;\n }\n });\n\n if (!button && warnNotFound) {\n logWarn(`button \"${id}\" not found in the navbar`);\n }\n\n return button;\n }\n\n /**\n * @summary Shows the navbar\n */\n show() {\n this.container.classList.add('psv-navbar--open');\n this.prop.visible = true;\n }\n\n /**\n * @summary Hides the navbar\n */\n hide() {\n this.container.classList.remove('psv-navbar--open');\n this.prop.visible = false;\n }\n\n /**\n * @override\n */\n refreshUi() {\n super.refreshUi();\n\n if (this.psv.prop.uiRefresh === true) {\n const availableWidth = this.container.offsetWidth;\n\n let totalWidth = 0;\n const visibleButtons = [];\n const collapsableButtons = [];\n\n this.children.forEach((item) => {\n if (item.prop.visible) {\n totalWidth += item.prop.width;\n visibleButtons.push(item);\n if (item.prop.collapsable) {\n collapsableButtons.push(item);\n }\n }\n });\n\n if (!visibleButtons.length) {\n return;\n }\n\n if (availableWidth < totalWidth && collapsableButtons.length > 0) {\n collapsableButtons.forEach(item => item.collapse());\n this.collapsed = collapsableButtons;\n\n this.getButton(MenuButton.id).show(false);\n }\n else if (availableWidth >= totalWidth && this.collapsed.length > 0) {\n this.collapsed.forEach(item => item.uncollapse());\n this.collapsed = [];\n\n this.getButton(MenuButton.id).hide(false);\n }\n\n const caption = this.getButton(NavbarCaption.id, false);\n if (caption) {\n caption.refreshUi();\n }\n }\n }\n\n /**\n * @summary Ensure the buttons configuration is correct\n * @private\n */\n __cleanButtons(buttons) {\n // true becomes the default array\n if (buttons === true) {\n return clone(DEFAULTS.navbar);\n }\n // can be a space or coma separated list\n else if (typeof buttons === 'string') {\n return buttons.split(/[ ,]/);\n }\n else {\n return buttons || [];\n }\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { bound, getStyle } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Loader component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Loader extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-loader-container');\n\n /**\n * @summary Inner container for vertical center\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.loader = document.createElement('div');\n this.loader.className = 'psv-loader';\n this.container.appendChild(this.loader);\n\n /**\n * @summary Animation canvas\n * @member {HTMLCanvasElement}\n * @readonly\n * @private\n */\n this.canvas = document.createElement('canvas');\n this.canvas.className = 'psv-loader-canvas';\n\n this.canvas.width = this.loader.clientWidth * SYSTEM.pixelRatio;\n this.canvas.height = this.loader.clientWidth * SYSTEM.pixelRatio;\n this.loader.appendChild(this.canvas);\n\n /**\n * @override\n * @property {number} thickness\n * @property {string} current\n */\n this.prop = {\n ...this.prop,\n tickness: (this.loader.offsetWidth - this.loader.clientWidth) / 2 * SYSTEM.pixelRatio,\n current : null,\n };\n\n this.refreshUi();\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.loader;\n delete this.canvas;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n refreshUi() {\n if (this.prop.current !== (this.psv.config.loadingImg || this.psv.config.loadingTxt)) {\n if (this.prop.current) {\n this.loader.removeChild(this.loader.lastChild);\n }\n\n let inner;\n if (this.psv.config.loadingImg) {\n inner = document.createElement('img');\n inner.className = 'psv-loader-image';\n inner.src = this.psv.config.loadingImg;\n }\n else if (this.psv.config.loadingTxt) {\n inner = document.createElement('div');\n inner.className = 'psv-loader-text';\n inner.innerHTML = this.psv.config.loadingTxt;\n }\n if (inner) {\n const size = Math.round(Math.sqrt(2 * Math.pow((this.canvas.width / 2 - this.prop.tickness / 2) / SYSTEM.pixelRatio, 2)));\n inner.style.maxWidth = size + 'px';\n inner.style.maxHeight = size + 'px';\n this.loader.appendChild(inner);\n }\n\n this.prop.current = this.psv.config.loadingImg || this.psv.config.loadingTxt;\n }\n }\n\n /**\n * @summary Sets the loader progression\n * @param {number} value - from 0 to 100\n */\n setProgress(value) {\n const context = this.canvas.getContext('2d');\n\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n context.lineWidth = this.prop.tickness;\n context.strokeStyle = getStyle(this.loader, 'color');\n\n context.beginPath();\n context.arc(\n this.canvas.width / 2, this.canvas.height / 2,\n this.canvas.width / 2 - this.prop.tickness / 2,\n -Math.PI / 2, bound(value, 0, 100) / 100 * 2 * Math.PI - Math.PI / 2\n );\n context.stroke();\n\n this.psv.trigger(EVENTS.LOAD_PROGRESS, Math.round(value));\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Notification component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Notification extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-notification');\n\n /**\n * @override\n * @property {*} timeout\n */\n this.prop = {\n ...this.prop,\n visible : false,\n contentId: undefined,\n timeout : null,\n };\n\n /**\n * Notification content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-notification-content';\n this.container.appendChild(this.content);\n\n this.content.addEventListener('click', () => this.hide());\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Notification cannot be toggled');\n }\n\n /**\n * @summary Displays a notification on the viewer\n * @param {Object|string} config\n * @param {string} [config.id] - unique identifier to use with \"hide\"\n * @param {string} config.content\n * @param {number} [config.timeout]\n * @fires PSV.show-notification\n *\n * @example\n * viewer.showNotification({ content: 'Hello world', timeout: 5000 })\n * @example\n * viewer.showNotification('Hello world')\n */\n show(config) {\n if (this.prop.timeout) {\n clearTimeout(this.prop.timeout);\n this.prop.timeout = null;\n }\n\n if (typeof config === 'string') {\n config = { content: config };\n }\n\n this.prop.contentId = config.id;\n this.content.innerHTML = config.content;\n\n this.container.classList.add('psv-notification--visible');\n this.prop.visible = true;\n\n this.psv.trigger(EVENTS.SHOW_NOTIFICATION, config.id);\n\n if (config.timeout) {\n this.prop.timeout = setTimeout(() => this.hide(config.id), config.timeout);\n }\n }\n\n /**\n * @summary Hides the notification\n * @param {string} [id]\n * @fires PSV.hide-notification\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n this.container.classList.remove('psv-notification--visible');\n this.prop.visible = false;\n\n this.prop.contentId = undefined;\n\n this.psv.trigger(EVENTS.HIDE_NOTIFICATION, contentId);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Overlay component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Overlay extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-overlay');\n\n /**\n * @override\n * @property {string} contentId\n * @property {boolean} dissmisable\n */\n this.prop = {\n ...this.prop,\n contentId : undefined,\n dissmisable: true,\n };\n\n /**\n * Image container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.image = document.createElement('div');\n this.image.className = 'psv-overlay-image';\n this.container.appendChild(this.image);\n\n /**\n * Text container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.text = document.createElement('div');\n this.text.className = 'psv-overlay-text';\n this.container.appendChild(this.text);\n\n /**\n * Subtext container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.subtext = document.createElement('div');\n this.subtext.className = 'psv-overlay-subtext';\n this.container.appendChild(this.subtext);\n\n this.psv.on(EVENTS.CLICK, this);\n this.psv.on(EVENTS.KEY_PRESS, this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.CLICK, this);\n this.psv.off(EVENTS.KEY_PRESS, this);\n\n delete this.image;\n delete this.text;\n delete this.subtext;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case EVENTS.CLICK:\n if (this.isVisible() && this.prop.dissmisable) {\n this.hide();\n e.stopPropagation();\n }\n break;\n case EVENTS.KEY_PRESS:\n if (this.isVisible() && this.prop.dissmisable && e.args[0] === KEY_CODES.Escape) {\n this.hide();\n e.preventDefault();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Overlay cannot be toggled');\n }\n\n /**\n * @summary Displays an overlay on the viewer\n * @param {Object|string} config\n * @param {string} [config.id] - unique identifier to use with \"hide\"\n * @param {string} config.image - SVG image/icon displayed above the text\n * @param {string} config.text - main message\n * @param {string} [config.subtext] - secondary message\n * @param {boolean} [config.dissmisable=true] - if the user can hide the overlay by clicking\n * @fires PSV.show-overlay\n */\n show(config) {\n if (typeof config === 'string') {\n config = { text: config };\n }\n\n this.prop.contentId = config.id;\n this.prop.dissmisable = config.dissmisable !== false;\n this.image.innerHTML = config.image || '';\n this.text.innerHTML = config.text || '';\n this.subtext.innerHTML = config.subtext || '';\n\n super.show();\n\n this.psv.trigger(EVENTS.SHOW_OVERLAY, config.id);\n }\n\n /**\n * @summary Hides the overlay\n * @param {string} [id]\n * @fires PSV.hide-overlay\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n super.hide();\n\n this.prop.contentId = undefined;\n\n this.psv.trigger(EVENTS.HIDE_OVERLAY, contentId);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { PSVError } from '../PSVError';\nimport { toggleClass } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Minimum width of the panel\n * @type {number}\n * @constant\n * @private\n */\nconst PANEL_MIN_WIDTH = 200;\n\n/**\n * @summary Panel component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Panel extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-panel');\n\n /**\n * @override\n * @property {string} contentId\n * @property {number} mouseX\n * @property {number} mouseY\n * @property {boolean} mousedown\n * @property {function} clickHandler\n * @property {function} keyHandler\n */\n this.prop = {\n ...this.prop,\n visible : false,\n contentId : undefined,\n mouseX : 0,\n mouseY : 0,\n mousedown : false,\n clickHandler: null,\n keyHandler : null,\n width : {},\n };\n\n const resizer = document.createElement('div');\n resizer.className = 'psv-panel-resizer';\n this.container.appendChild(resizer);\n\n const closeBtn = document.createElement('div');\n closeBtn.className = 'psv-panel-close-button';\n this.container.appendChild(closeBtn);\n\n /**\n * @summary Content container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-panel-content';\n this.container.appendChild(this.content);\n\n // Stop wheel event bubbling from panel\n this.container.addEventListener(SYSTEM.mouseWheelEvent, e => e.stopPropagation());\n\n closeBtn.addEventListener('click', () => this.hide());\n\n // Event for panel resizing + stop bubling\n resizer.addEventListener('mousedown', this);\n resizer.addEventListener('touchstart', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', this);\n\n this.psv.on(EVENTS.KEY_PRESS, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.KEY_PRESS, this);\n\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n delete this.prop;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(e); break;\n case 'touchstart': this.__onTouchStart(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'touchmove': this.__onTouchMove(e); break;\n case 'mouseup': this.__onMouseUp(e); break;\n case 'touchend': this.__onMouseUp(e); break;\n case EVENTS.KEY_PRESS:\n if (this.isVisible() && e.args[0] === KEY_CODES.Escape) {\n this.hide();\n e.preventDefault();\n }\n break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Panel cannot be toggled');\n }\n\n /**\n * @summary Shows the panel\n * @param {string|Object} config\n * @param {string} [config.id] - unique identifier to use with \"hide\" and to store the user desired width\n * @param {string} config.content - HTML content of the panel\n * @param {boolean} [config.noMargin=false] - remove the default margins\n * @param {string} [config.width] - initial width\n * @param {Function} [config.clickHandler] - called when the user clicks inside the panel or presses the Enter key while an element focused\n * @fires PSV.open-panel\n */\n show(config) {\n const wasVisible = this.isVisible(config.id);\n\n if (typeof config === 'string') {\n config = { content: config };\n }\n\n this.prop.contentId = config.id;\n this.prop.visible = true;\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.content.removeEventListener('keydown', this.prop.keyHandler);\n this.prop.clickHandler = null;\n this.prop.keyHandler = null;\n }\n\n if (config.id && this.prop.width[config.id]) {\n this.container.style.width = this.prop.width[config.id];\n }\n else if (config.width) {\n this.container.style.width = config.width;\n }\n else {\n this.container.style.width = null;\n }\n\n this.content.innerHTML = config.content;\n this.content.scrollTop = 0;\n this.container.classList.add('psv-panel--open');\n\n toggleClass(this.content, 'psv-panel-content--no-margin', config.noMargin === true);\n\n if (config.clickHandler) {\n this.prop.clickHandler = config.clickHandler;\n this.prop.keyHandler = (e) => {\n if (e.key === KEY_CODES.Enter) {\n config.clickHandler(e);\n }\n };\n this.content.addEventListener('click', this.prop.clickHandler);\n this.content.addEventListener('keydown', this.prop.keyHandler);\n\n // focus the first element if possible, after animation ends\n if (!wasVisible) {\n setTimeout(() => {\n this.content.querySelector('a,button,[tabindex]')?.focus();\n }, 300);\n }\n }\n\n this.psv.trigger(EVENTS.OPEN_PANEL, config.id);\n }\n\n /**\n * @summary Hides the panel\n * @param {string} [id]\n * @fires PSV.close-panel\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n this.prop.visible = false;\n this.prop.contentId = undefined;\n\n this.content.innerHTML = null;\n this.container.classList.remove('psv-panel--open');\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.prop.clickHandler = null;\n }\n\n this.psv.trigger(EVENTS.CLOSE_PANEL, contentId);\n }\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n evt.stopPropagation();\n this.__startResize(evt);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchStart(evt) {\n evt.stopPropagation();\n this.__startResize(evt.changedTouches[0]);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.prop.mousedown = false;\n this.content.classList.remove('psv-panel-content--no-interaction');\n }\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.__resize(evt);\n }\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchMove(evt) {\n if (this.prop.mousedown) {\n this.__resize(evt.touches[0]);\n }\n }\n\n /**\n * @summary Initializes the panel resize\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startResize(evt) {\n this.prop.mouseX = evt.clientX;\n this.prop.mouseY = evt.clientY;\n this.prop.mousedown = true;\n this.content.classList.add('psv-panel-content--no-interaction');\n }\n\n /**\n * @summary Resizes the panel\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __resize(evt) {\n const x = evt.clientX;\n const y = evt.clientY;\n const width = Math.max(PANEL_MIN_WIDTH, this.container.offsetWidth - (x - this.prop.mouseX)) + 'px';\n\n if (this.prop.contentId) {\n this.prop.width[this.prop.contentId] = width;\n }\n\n this.container.style.width = width;\n\n this.prop.mouseX = x;\n this.prop.mouseY = y;\n }\n\n}\n","/**\n * @namespace PSV.services\n */\n\n/**\n * @summary Base services class\n * @memberof PSV.services\n * @abstract\n */\nexport class AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n\n /**\n * @summary Configuration holder\n * @type {PSV.Options}\n * @readonly\n */\n this.config = psv.config;\n\n /**\n * @summary Properties holder\n * @type {Object}\n * @readonly\n */\n this.prop = psv.prop;\n }\n\n /**\n * @summary Destroys the service\n */\n destroy() {\n delete this.psv;\n delete this.config;\n delete this.prop;\n }\n\n}\n","import * as THREE from 'three';\nimport { MESH_USER_DATA, SPHERE_RADIUS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { applyEulerInverse, parseAngle, parseSpeed } from '../utils';\nimport { AbstractService } from './AbstractService';\n\nconst vector2 = new THREE.Vector2();\nconst vector3 = new THREE.Vector3();\nconst eulerZero = new THREE.Euler(0, 0, 0, 'ZXY');\n\n/**\n * @summary Collections of data converters for the current viewer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class DataHelper extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n }\n\n /**\n * @summary Converts vertical FOV to zoom level\n * @param {number} fov\n * @returns {number}\n */\n fovToZoomLevel(fov) {\n const temp = Math.round((fov - this.config.minFov) / (this.config.maxFov - this.config.minFov) * 100);\n return temp - 2 * (temp - 50);\n }\n\n /**\n * @summary Converts zoom level to vertical FOV\n * @param {number} level\n * @returns {number}\n */\n zoomLevelToFov(level) {\n return this.config.maxFov + (level / 100) * (this.config.minFov - this.config.maxFov);\n }\n\n /**\n * @summary Convert vertical FOV to horizontal FOV\n * @param {number} vFov\n * @returns {number}\n */\n vFovToHFov(vFov) {\n return THREE.MathUtils.radToDeg(2 * Math.atan(Math.tan(THREE.MathUtils.degToRad(vFov) / 2) * this.prop.aspect));\n }\n\n /**\n * @summary Converts a speed into a duration from current position to a new position\n * @param {string|number} value\n * @param {number} angle\n * @returns {number}\n */\n speedToDuration(value, angle) {\n if (!value || typeof value !== 'number') {\n // desired radial speed\n const speed = value ? parseSpeed(value) : this.config.autorotateSpeed;\n // compute duration\n return angle / Math.abs(speed) * 1000;\n }\n else {\n return Math.abs(value);\n }\n }\n\n /**\n * @summary Converts pixel texture coordinates to spherical radians coordinates\n * @param {PSV.Point} point\n * @returns {PSV.Position}\n * @throws {PSV.PSVError} when the current adapter does not support texture coordinates\n */\n textureCoordsToSphericalCoords(point) {\n const panoData = this.prop.panoData;\n if (!panoData) {\n throw new PSVError('Current adapter does not support texture coordinates.');\n }\n\n const relativeX = (point.x + panoData.croppedX) / panoData.fullWidth * Math.PI * 2;\n const relativeY = (point.y + panoData.croppedY) / panoData.fullHeight * Math.PI;\n\n const result = {\n longitude: relativeX >= Math.PI ? relativeX - Math.PI : relativeX + Math.PI,\n latitude : Math.PI / 2 - relativeY,\n };\n\n // Apply panoData pose and sphereCorrection\n if (!eulerZero.equals(this.psv.renderer.mesh.rotation) || !eulerZero.equals(this.psv.renderer.meshContainer.rotation)) {\n this.sphericalCoordsToVector3(result, vector3);\n vector3.applyEuler(this.psv.renderer.mesh.rotation);\n vector3.applyEuler(this.psv.renderer.meshContainer.rotation);\n return this.vector3ToSphericalCoords(vector3);\n }\n else {\n return result;\n }\n }\n\n /**\n * @summary Converts spherical radians coordinates to pixel texture coordinates\n * @param {PSV.Position} position\n * @returns {PSV.Point}\n * @throws {PSV.PSVError} when the current adapter does not support texture coordinates\n */\n sphericalCoordsToTextureCoords(position) {\n const panoData = this.prop.panoData;\n if (!panoData) {\n throw new PSVError('Current adapter does not support texture coordinates.');\n }\n\n // Apply panoData pose and sphereCorrection\n if (!eulerZero.equals(this.psv.renderer.mesh.rotation) || !eulerZero.equals(this.psv.renderer.meshContainer.rotation)) {\n this.sphericalCoordsToVector3(position, vector3);\n applyEulerInverse(vector3, this.psv.renderer.meshContainer.rotation);\n applyEulerInverse(vector3, this.psv.renderer.mesh.rotation);\n position = this.vector3ToSphericalCoords(vector3);\n }\n\n const relativeLong = position.longitude / Math.PI / 2 * panoData.fullWidth;\n const relativeLat = position.latitude / Math.PI * panoData.fullHeight;\n\n return {\n x: Math.round(position.longitude < Math.PI ? relativeLong + panoData.fullWidth / 2 : relativeLong - panoData.fullWidth / 2) - panoData.croppedX,\n y: Math.round(panoData.fullHeight / 2 - relativeLat) - panoData.croppedY,\n };\n }\n\n /**\n * @summary Converts spherical radians coordinates to a THREE.Vector3\n * @param {PSV.Position} position\n * @param {external:THREE.Vector3} [vector]\n * @returns {external:THREE.Vector3}\n */\n sphericalCoordsToVector3(position, vector) {\n if (!vector) {\n vector = new THREE.Vector3();\n }\n vector.x = SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude);\n vector.y = SPHERE_RADIUS * Math.sin(position.latitude);\n vector.z = SPHERE_RADIUS * Math.cos(position.latitude) * Math.cos(position.longitude);\n return vector;\n }\n\n /**\n * @summary Converts a THREE.Vector3 to spherical radians coordinates\n * @param {external:THREE.Vector3} vector\n * @returns {PSV.Position}\n */\n vector3ToSphericalCoords(vector) {\n const phi = Math.acos(vector.y / Math.sqrt(vector.x * vector.x + vector.y * vector.y + vector.z * vector.z));\n const theta = Math.atan2(vector.x, vector.z);\n\n return {\n longitude: theta < 0 ? -theta : Math.PI * 2 - theta,\n latitude : Math.PI / 2 - phi,\n };\n }\n\n /**\n * @summary Converts position on the viewer to a THREE.Vector3\n * @param {PSV.Point} viewerPoint\n * @returns {external:THREE.Vector3}\n */\n viewerCoordsToVector3(viewerPoint) {\n const sphereIntersect = this.getIntersections(viewerPoint).filter(i => i.object.userData[MESH_USER_DATA]);\n\n if (sphereIntersect.length) {\n return sphereIntersect[0].point;\n }\n else {\n return null;\n }\n }\n\n /**\n * @summary Converts a THREE.Vector3 to position on the viewer\n * @param {external:THREE.Vector3} vector\n * @returns {PSV.Point}\n */\n vector3ToViewerCoords(vector) {\n const vectorClone = vector.clone();\n vectorClone.project(this.psv.renderer.camera);\n\n return {\n x: Math.round((vectorClone.x + 1) / 2 * this.prop.size.width),\n y: Math.round((1 - vectorClone.y) / 2 * this.prop.size.height),\n };\n }\n\n /**\n * @summary Converts spherical radians coordinates to position on the viewer\n * @param {PSV.Position} position\n * @returns {PSV.Point}\n */\n sphericalCoordsToViewerCoords(position) {\n return this.vector3ToViewerCoords(this.sphericalCoordsToVector3(position, vector3));\n }\n\n /**\n * @summary Returns intersections with objects in the scene\n * @param {PSV.Point} viewerPoint\n * @return {external:THREE.Intersection[]}\n */\n getIntersections(viewerPoint) {\n vector2.x = 2 * viewerPoint.x / this.prop.size.width - 1;\n vector2.y = -2 * viewerPoint.y / this.prop.size.height + 1;\n\n this.psv.renderer.raycaster.setFromCamera(vector2, this.psv.renderer.camera);\n\n return this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children, true)\n .filter(i => !!i.object.userData);\n }\n\n /**\n * @summary Converts x/y to latitude/longitude if present and ensure boundaries\n * @param {PSV.ExtendedPosition} position\n * @returns {PSV.Position}\n */\n cleanPosition(position) {\n if (position.x !== undefined && position.y !== undefined) {\n return this.textureCoordsToSphericalCoords(position);\n }\n else {\n return {\n longitude: parseAngle(position.longitude),\n latitude : parseAngle(position.latitude, true),\n };\n }\n }\n\n /**\n * @summary Ensure a SphereCorrection object is valid\n * @param {PSV.SphereCorrection} sphereCorrection\n * @returns {PSV.SphereCorrection}\n */\n cleanSphereCorrection(sphereCorrection) {\n return {\n pan : parseAngle(sphereCorrection?.pan || 0),\n tilt: parseAngle(sphereCorrection?.tilt || 0, true),\n roll: parseAngle(sphereCorrection?.roll || 0, true, false),\n };\n }\n\n /**\n * @summary Parse the pose angles of the pano data\n * @param {PSV.PanoData} panoData\n * @returns {PSV.SphereCorrection}\n */\n cleanPanoramaPose(panoData) {\n return {\n pan : THREE.MathUtils.degToRad(panoData?.poseHeading || 0),\n tilt: THREE.MathUtils.degToRad(panoData?.posePitch || 0),\n roll: THREE.MathUtils.degToRad(panoData?.poseRoll || 0),\n };\n }\n\n}\n","import * as THREE from 'three';\nimport {\n ACTIONS,\n CTRLZOOM_TIMEOUT,\n DBLCLICK_DELAY,\n EVENTS,\n IDS,\n INERTIA_WINDOW,\n KEY_CODES,\n LONGTOUCH_DELAY,\n MOVE_THRESHOLD,\n OBJECT_EVENTS,\n TWOFINGERSOVERLAY_DELAY\n} from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport gestureIcon from '../icons/gesture.svg';\nimport mousewheelIcon from '../icons/mousewheel.svg';\nimport { clone, distance, each, getClosest, getPosition, isEmpty, isFullscreenEnabled, normalizeWheel, throttle } from '../utils';\nimport { Animation } from '../utils/Animation';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Events handler\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class EventsHandler extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @property {number} moveThreshold - computed threshold based on device pixel ratio\n * @property {boolean} moving - is the user moving\n * @property {boolean} zooming - is the user zooming\n * @property {number} startMouseX - start x position of the click/touch\n * @property {number} startMouseY - start y position of the click/touch\n * @property {number} mouseX - current x position of the cursor\n * @property {number} mouseY - current y position of the cursor\n * @property {number[][]} mouseHistory - list of latest positions of the cursor, [time, x, y]\n * @property {number} pinchDist - distance between fingers when zooming\n * @property {PressHandler} keyHandler\n * @property {boolean} ctrlKeyDown - when the Ctrl key is pressed\n * @property {PSV.ClickData} dblclickData - temporary storage of click data between two clicks\n * @property {number} dblclickTimeout - timeout id for double click\n * @property {number} twofingersTimeout - timeout id for \"two fingers\" overlay\n * @property {number} ctrlZoomTimeout - timeout id for \"ctrol zoom\" overlay\n * @protected\n */\n this.state = {\n moveThreshold : MOVE_THRESHOLD * SYSTEM.pixelRatio,\n keyboardEnabled : false,\n moving : false,\n zooming : false,\n startMouseX : 0,\n startMouseY : 0,\n mouseX : 0,\n mouseY : 0,\n mouseHistory : [],\n pinchDist : 0,\n keyHandler : new PressHandler(),\n ctrlKeyDown : false,\n dblclickData : null,\n dblclickTimeout : null,\n longtouchTimeout : null,\n twofingersTimeout: null,\n ctrlZoomTimeout : null,\n };\n\n /**\n * @summary Throttled wrapper of {@link PSV.Viewer#autoSize}\n * @type {Function}\n * @private\n */\n this.__onResize = throttle(() => this.psv.autoSize(), 50);\n }\n\n /**\n * @summary Initializes event handlers\n * @protected\n */\n init() {\n window.addEventListener('resize', this);\n window.addEventListener('keydown', this);\n window.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseenter', this);\n this.psv.container.addEventListener('mousedown', this);\n this.psv.container.addEventListener('mouseleave', this);\n this.psv.container.addEventListener('mousemove', this);\n window.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchstart', this);\n this.psv.container.addEventListener('touchmove', this);\n window.addEventListener('touchend', this);\n this.psv.container.addEventListener(SYSTEM.mouseWheelEvent, this);\n\n if (SYSTEM.fullscreenEvent) {\n document.addEventListener(SYSTEM.fullscreenEvent, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n window.removeEventListener('resize', this);\n window.removeEventListener('keydown', this);\n window.removeEventListener('keyup', this);\n this.psv.container.removeEventListener('mouseenter', this);\n this.psv.container.removeEventListener('mousedown', this);\n this.psv.container.removeEventListener('mouseleave', this);\n this.psv.container.removeEventListener('mousemove', this);\n window.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchstart', this);\n this.psv.container.removeEventListener('touchmove', this);\n window.removeEventListener('touchend', this);\n this.psv.container.removeEventListener(SYSTEM.mouseWheelEvent, this);\n\n if (SYSTEM.fullscreenEvent) {\n document.removeEventListener(SYSTEM.fullscreenEvent, this);\n }\n\n clearTimeout(this.state.dblclickTimeout);\n clearTimeout(this.state.longtouchTimeout);\n clearTimeout(this.state.twofingersTimeout);\n clearTimeout(this.state.ctrlZoomTimeout);\n\n delete this.state;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} evt\n * @private\n */\n handleEvent(evt) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'resize': this.__onResize(); break;\n case 'keydown': this.__onKeyDown(evt); break;\n case 'keyup': this.__onKeyUp(); break;\n case 'mouseup': this.__onMouseUp(evt); break;\n case 'touchend': this.__onTouchEnd(evt); break;\n case SYSTEM.fullscreenEvent: this.__fullscreenToggled(); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n if (!getClosest(evt.target, '.psv-navbar') && !getClosest(evt.target, '.psv-panel')) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(evt); break;\n case 'mouseenter': this.__onMouseEnter(evt); break;\n case 'mouseleave': this.__onMouseLeave(evt); break;\n case 'mousemove': this.__onMouseMove(evt); break;\n case 'touchstart': this.__onTouchStart(evt); break;\n case 'touchmove': this.__onTouchMove(evt); break;\n case SYSTEM.mouseWheelEvent: this.__onMouseWheel(evt); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n }\n\n /**\n * @summary Enables the keyboard controls\n * @protected\n */\n enableKeyboard() {\n this.state.keyboardEnabled = true;\n }\n\n /**\n * @summary Disables the keyboard controls\n * @protected\n */\n disableKeyboard() {\n this.state.keyboardEnabled = false;\n }\n\n /**\n * @summary Handles keyboard events\n * @param {KeyboardEvent} e\n * @private\n */\n __onKeyDown(e) {\n if (this.config.mousewheelCtrlKey) {\n this.state.ctrlKeyDown = e.key === KEY_CODES.Control;\n\n if (this.state.ctrlKeyDown) {\n clearTimeout(this.state.ctrlZoomTimeout);\n this.psv.overlay.hide(IDS.CTRL_ZOOM);\n }\n }\n\n const e2 = this.psv.trigger(EVENTS.KEY_PRESS, e.key);\n if (e2.isDefaultPrevented()) {\n return;\n }\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n const action = this.config.keyboard[e.key];\n if (action === ACTIONS.TOGGLE_AUTOROTATE) {\n this.psv.toggleAutorotate();\n }\n else if (action && !this.state.keyHandler.time) {\n if (action !== ACTIONS.ZOOM_IN && action !== ACTIONS.ZOOM_OUT) {\n this.psv.__stopAll();\n }\n\n /* eslint-disable */\n switch (action) {\n // @formatter:off\n case ACTIONS.ROTATE_LAT_UP: this.psv.dynamics.position.roll({latitude: false}); break;\n case ACTIONS.ROTATE_LAT_DOWN: this.psv.dynamics.position.roll({latitude: true}); break;\n case ACTIONS.ROTATE_LONG_RIGHT: this.psv.dynamics.position.roll({longitude: false}); break;\n case ACTIONS.ROTATE_LONG_LEFT: this.psv.dynamics.position.roll({longitude: true}); break;\n case ACTIONS.ZOOM_IN: this.psv.dynamics.zoom.roll(false); break;\n case ACTIONS.ZOOM_OUT: this.psv.dynamics.zoom.roll(true); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n this.state.keyHandler.down();\n }\n }\n\n /**\n * @summary Handles keyboard events\n * @private\n */\n __onKeyUp() {\n this.state.ctrlKeyDown = false;\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n this.state.keyHandler.up(() => {\n this.psv.dynamics.position.stop();\n this.psv.dynamics.zoom.stop();\n this.psv.resetIdleTimer();\n });\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n if (!this.config.mousemove || this.config.captureCursor) {\n return;\n }\n\n this.__startMove(evt);\n }\n\n /**\n * @summary Handles mouse enter events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseEnter(evt) {\n if (!this.config.mousemove || !this.config.captureCursor) {\n return;\n }\n\n this.__startMove(evt);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (!this.config.mousemove || this.config.captureCursor) {\n return;\n }\n\n this.__stopMove(evt);\n }\n\n /**\n * @summary Handles mouse leave events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseLeave(evt) {\n if (!this.config.mousemove || !this.config.captureCursor) {\n return;\n }\n\n this.__stopMove(evt);\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (this.config.mousemove) {\n if (evt.buttons !== 0) {\n evt.preventDefault();\n this.__move(evt);\n }\n else if (this.config.captureCursor) {\n this.__moveAbsolute(evt);\n }\n }\n\n if (!isEmpty(this.prop.objectsObservers)) {\n const viewerPos = getPosition(this.psv.container);\n\n const viewerPoint = {\n x: evt.clientX - viewerPos.left,\n y: evt.clientY - viewerPos.top,\n };\n\n const intersections = this.psv.dataHelper.getIntersections(viewerPoint);\n\n const emit = (observer, key, type) => {\n observer.listener.handleEvent(new CustomEvent(type, {\n detail: {\n originalEvent: evt,\n object : observer.object,\n data : observer.object.userData[key],\n viewerPoint : viewerPoint,\n },\n }));\n };\n\n each(this.prop.objectsObservers, (observer, key) => {\n const intersection = intersections.find(i => i.object.userData[key]);\n\n if (intersection) {\n if (observer.object && intersection.object !== observer.object) {\n emit(observer, key, OBJECT_EVENTS.LEAVE_OBJECT);\n delete observer.object;\n }\n\n if (!observer.object) {\n observer.object = intersection.object;\n emit(observer, key, OBJECT_EVENTS.ENTER_OBJECT);\n }\n else {\n emit(observer, key, OBJECT_EVENTS.HOVER_OBJECT);\n }\n }\n else if (observer.object) {\n emit(observer, key, OBJECT_EVENTS.LEAVE_OBJECT);\n delete observer.object;\n }\n });\n }\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchStart(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n if (evt.touches.length === 1) {\n if (!this.config.touchmoveTwoFingers) {\n this.__startMove(evt.touches[0]);\n evt.preventDefault(); // prevent mouse events emulation\n }\n\n if (!this.prop.longtouchTimeout) {\n this.prop.longtouchTimeout = setTimeout(() => {\n this.__click(evt.touches[0], true);\n this.prop.longtouchTimeout = null;\n }, LONGTOUCH_DELAY);\n }\n }\n else if (evt.touches.length === 2) {\n this.__cancelLongTouch();\n this.__cancelTwoFingersOverlay();\n this.__startMoveZoom(evt);\n evt.preventDefault();\n }\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchEnd(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n this.__cancelLongTouch();\n this.__cancelTwoFingersOverlay();\n\n if (evt.touches.length === 1) {\n this.__stopMoveZoom();\n }\n else if (evt.touches.length === 0) {\n this.__stopMove(evt.changedTouches[0]);\n }\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchMove(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n this.__cancelLongTouch();\n\n if (evt.touches.length === 1) {\n if (this.config.touchmoveTwoFingers) {\n if (!this.prop.twofingersTimeout) {\n this.prop.twofingersTimeout = setTimeout(() => {\n this.psv.overlay.show({\n id : IDS.TWO_FINGERS,\n image: gestureIcon,\n text : this.config.lang.twoFingers,\n });\n }, TWOFINGERSOVERLAY_DELAY);\n }\n }\n else {\n evt.preventDefault();\n this.__move(evt.touches[0]);\n }\n }\n else if (evt.touches.length === 2) {\n evt.preventDefault();\n this.__moveZoom(evt);\n this.__cancelTwoFingersOverlay();\n }\n }\n\n /**\n * @summary Cancel the long touch timer if any\n * @private\n */\n __cancelLongTouch() {\n if (this.prop.longtouchTimeout) {\n clearTimeout(this.prop.longtouchTimeout);\n this.prop.longtouchTimeout = null;\n }\n }\n\n /**\n * @summary Cancel the two fingers overlay timer if any\n * @private\n */\n __cancelTwoFingersOverlay() {\n if (this.prop.twofingersTimeout) {\n clearTimeout(this.prop.twofingersTimeout);\n this.prop.twofingersTimeout = null;\n }\n this.psv.overlay.hide(IDS.TWO_FINGERS);\n }\n\n /**\n * @summary Handles mouse wheel events\n * @param {WheelEvent} evt\n * @private\n */\n __onMouseWheel(evt) {\n if (!this.config.mousewheel) {\n return;\n }\n\n if (this.config.mousewheelCtrlKey && !this.state.ctrlKeyDown) {\n this.psv.overlay.show({\n id : IDS.CTRL_ZOOM,\n image: mousewheelIcon,\n text : this.config.lang.ctrlZoom,\n });\n\n clearTimeout(this.state.ctrlZoomTimeout);\n this.state.ctrlZoomTimeout = setTimeout(() => this.psv.overlay.hide(IDS.CTRL_ZOOM), CTRLZOOM_TIMEOUT);\n\n return;\n }\n\n evt.preventDefault();\n evt.stopPropagation();\n\n const delta = normalizeWheel(evt).spinY * 5 * this.config.zoomSpeed;\n if (delta !== 0) {\n this.psv.dynamics.zoom.step(-delta, 5);\n }\n }\n\n /**\n * @summary Handles fullscreen events\n * @param {boolean} [force] force state\n * @fires PSV.fullscreen-updated\n * @package\n */\n __fullscreenToggled(force) {\n this.prop.fullscreen = force !== undefined ? force : isFullscreenEnabled(this.psv.container);\n\n if (this.config.keyboard) {\n if (this.prop.fullscreen) {\n this.psv.startKeyboardControl();\n }\n else {\n this.psv.stopKeyboardControl();\n }\n }\n\n this.psv.trigger(EVENTS.FULLSCREEN_UPDATED, this.prop.fullscreen);\n }\n\n /**\n * @summary Initializes the movement\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startMove(evt) {\n this.psv.__stopAll()\n .then(() => {\n this.state.mouseX = evt.clientX;\n this.state.mouseY = evt.clientY;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = false;\n\n this.state.mouseHistory.length = 0;\n this.__logMouseMove(evt);\n });\n }\n\n /**\n * @summary Initializes the combines move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __startMoveZoom(evt) {\n this.psv.__stopAll()\n .then(() => {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n this.state.pinchDist = distance(p1, p2);\n this.state.mouseX = (p1.x + p2.x) / 2;\n this.state.mouseY = (p1.y + p2.y) / 2;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = true;\n });\n }\n\n /**\n * @summary Stops the movement\n * @description If the move threshold was not reached a click event is triggered, otherwise an animation is launched to simulate inertia\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMove(evt) {\n this.psv.resetIdleTimer();\n\n if (!getClosest(evt.target, '.psv-container')) {\n this.state.moving = false;\n this.state.mouseHistory.length = 0;\n return;\n }\n\n if (this.state.moving) {\n // move threshold to trigger a click\n if (Math.abs(evt.clientX - this.state.startMouseX) < this.state.moveThreshold\n && Math.abs(evt.clientY - this.state.startMouseY) < this.state.moveThreshold) {\n this.__click(evt);\n this.state.moving = false;\n }\n // inertia animation\n else if (this.config.moveInertia) {\n this.__logMouseMove(evt);\n this.__stopMoveInertia(evt);\n }\n else {\n this.state.moving = false;\n }\n\n this.state.mouseHistory.length = 0;\n }\n }\n\n /**\n * @summary Stops the combined move and zoom\n * @private\n */\n __stopMoveZoom() {\n this.psv.resetIdleTimer();\n this.state.mouseHistory.length = 0;\n this.state.moving = false;\n this.state.zooming = false;\n }\n\n /**\n * @summary Performs an animation to simulate inertia when the movement stops\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMoveInertia(evt) {\n const direction = {\n x: evt.clientX - this.state.mouseHistory[0][1],\n y: evt.clientY - this.state.mouseHistory[0][2],\n };\n\n const norm = Math.sqrt(direction.x * direction.x + direction.y * direction.y);\n\n this.prop.animationPromise = new Animation({\n properties: {\n clientX: { start: evt.clientX, end: evt.clientX + direction.x },\n clientY: { start: evt.clientY, end: evt.clientY + direction.y },\n },\n duration : norm * INERTIA_WINDOW / 100,\n easing : 'outCirc',\n onTick : (properties) => {\n this.__move(properties, false);\n },\n });\n\n this.prop.animationPromise\n .then(() => {\n this.state.moving = false;\n });\n }\n\n /**\n * @summary Triggers an event with all coordinates when a simple click is performed\n * @param {MouseEvent|Touch} evt\n * @param {boolean} [longtouch=false]\n * @fires PSV.click\n * @fires PSV.dblclick\n * @private\n */\n __click(evt, longtouch = false) {\n const boundingRect = this.psv.container.getBoundingClientRect();\n\n /**\n * @type {PSV.ClickData}\n */\n const data = {\n rightclick: longtouch || evt.button === 2,\n target : evt.target,\n clientX : evt.clientX,\n clientY : evt.clientY,\n viewerX : evt.clientX - boundingRect.left,\n viewerY : evt.clientY - boundingRect.top,\n };\n\n const intersections = this.psv.dataHelper.getIntersections({\n x: data.viewerX,\n y: data.viewerY,\n });\n\n const sphereIntersection = intersections.find(i => i.object.userData.psvSphere);\n\n if (sphereIntersection) {\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(sphereIntersection.point);\n data.longitude = sphericalCoords.longitude;\n data.latitude = sphericalCoords.latitude;\n\n data.objects = intersections.map(i => i.object).filter(o => !o.userData.psvSphere);\n\n try {\n const textureCoords = this.psv.dataHelper.sphericalCoordsToTextureCoords(data);\n data.textureX = textureCoords.x;\n data.textureY = textureCoords.y;\n }\n catch (e) {\n data.textureX = NaN;\n data.textureY = NaN;\n }\n\n if (!this.state.dblclickTimeout) {\n this.psv.trigger(EVENTS.CLICK, data);\n\n this.state.dblclickData = clone(data);\n this.state.dblclickTimeout = setTimeout(() => {\n this.state.dblclickTimeout = null;\n this.state.dblclickData = null;\n }, DBLCLICK_DELAY);\n }\n else {\n if (Math.abs(this.state.dblclickData.clientX - data.clientX) < this.state.moveThreshold\n && Math.abs(this.state.dblclickData.clientY - data.clientY) < this.state.moveThreshold) {\n this.psv.trigger(EVENTS.DOUBLE_CLICK, this.state.dblclickData);\n }\n\n clearTimeout(this.state.dblclickTimeout);\n this.state.dblclickTimeout = null;\n this.state.dblclickData = null;\n }\n }\n }\n\n /**\n * @summary Performs movement\n * @param {MouseEvent|Touch} evt\n * @param {boolean} [log=true]\n * @private\n */\n __move(evt, log) {\n if (this.state.moving) {\n const x = evt.clientX;\n const y = evt.clientY;\n\n const rotation = {\n longitude: (x - this.state.mouseX) / this.prop.size.width * this.config.moveSpeed * THREE.MathUtils.degToRad(this.prop.hFov),\n latitude : (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * THREE.MathUtils.degToRad(this.prop.vFov),\n };\n\n const currentPosition = this.psv.getPosition();\n this.psv.rotate({\n longitude: currentPosition.longitude - rotation.longitude,\n latitude : currentPosition.latitude + rotation.latitude,\n });\n\n this.state.mouseX = x;\n this.state.mouseY = y;\n\n if (log !== false) {\n this.__logMouseMove(evt);\n }\n }\n }\n\n /**\n * @summary Performs movement absolute to cursor position in viewer\n * @param {MouseEvent} evt\n * @private\n */\n __moveAbsolute(evt) {\n if (this.state.moving) {\n const containerRect = this.psv.container.getBoundingClientRect();\n this.psv.dynamics.position.goto({\n longitude: ((evt.clientX - containerRect.left) / containerRect.width - 0.5) * Math.PI * 2,\n latitude : -((evt.clientY - containerRect.top) / containerRect.height - 0.5) * Math.PI,\n }, 10);\n }\n }\n\n /**\n * @summary Perfoms combined move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __moveZoom(evt) {\n if (this.state.zooming && this.state.moving) {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n const p = distance(p1, p2);\n const delta = 80 * (p - this.state.pinchDist) / this.prop.size.width * this.config.zoomSpeed;\n\n this.psv.zoom(this.psv.getZoomLevel() + delta);\n\n this.__move({\n clientX: (p1.x + p2.x) / 2,\n clientY: (p1.y + p2.y) / 2,\n });\n\n this.state.pinchDist = p;\n }\n }\n\n /**\n * @summary Stores each mouse position during a mouse move\n * @description Positions older than \"INERTIA_WINDOW\" are removed
\n * Positions before a pause of \"INERTIA_WINDOW\" / 10 are removed\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __logMouseMove(evt) {\n const now = Date.now();\n this.state.mouseHistory.push([now, evt.clientX, evt.clientY]);\n\n let previous = null;\n\n for (let i = 0; i < this.state.mouseHistory.length;) {\n if (this.state.mouseHistory[0][i] < now - INERTIA_WINDOW) {\n this.state.mouseHistory.splice(i, 1);\n }\n else if (previous && this.state.mouseHistory[0][i] - previous > INERTIA_WINDOW / 10) {\n this.state.mouseHistory.splice(0, i);\n i = 0;\n previous = this.state.mouseHistory[0][i];\n }\n else {\n i++;\n previous = this.state.mouseHistory[0][i];\n }\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { Animation } from '../utils/Animation';\nimport { EVENTS, MESH_USER_DATA, SPHERE_RADIUS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { each, isExtendedPosition } from '../utils';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Viewer and renderer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class Renderer extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @member {external:THREE.WebGLRenderer}\n * @readonly\n * @protected\n */\n this.renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });\n this.renderer.setPixelRatio(SYSTEM.pixelRatio);\n this.renderer.domElement.className = 'psv-canvas';\n\n /**\n * @member {external:THREE.Scene}\n * @readonly\n * @protected\n */\n this.scene = new THREE.Scene();\n\n /**\n * @member {external:THREE.PerspectiveCamera}\n * @readonly\n * @protected\n */\n this.camera = new THREE.PerspectiveCamera(50, 16 / 9, 1, 2 * SPHERE_RADIUS);\n\n /**\n * @member {external:THREE.Mesh}\n * @readonly\n * @protected\n */\n this.mesh = this.psv.adapter.createMesh();\n this.mesh.userData = { [MESH_USER_DATA]: true };\n\n /**\n * @member {external:THREE.Group}\n * @readonly\n * @private\n */\n this.meshContainer = new THREE.Group();\n this.meshContainer.add(this.mesh);\n this.scene.add(this.meshContainer);\n\n /**\n * @member {external:THREE.Raycaster}\n * @readonly\n * @protected\n */\n this.raycaster = new THREE.Raycaster();\n\n /**\n * @member {number}\n * @private\n */\n this.timestamp = null;\n\n /**\n * @member {boolean}\n * @private\n */\n this.ready = false;\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @package\n */\n this.canvasContainer = document.createElement('div');\n this.canvasContainer.className = 'psv-canvas-container';\n this.canvasContainer.style.background = this.psv.config.canvasBackground;\n this.canvasContainer.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n this.canvasContainer.appendChild(this.renderer.domElement);\n this.psv.container.appendChild(this.canvasContainer);\n\n psv.on(EVENTS.SIZE_UPDATED, this);\n psv.on(EVENTS.ZOOM_UPDATED, this);\n psv.on(EVENTS.POSITION_UPDATED, this);\n psv.on(EVENTS.CONFIG_CHANGED, this);\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n // cancel render loop\n this.renderer.setAnimationLoop(null);\n\n // destroy ThreeJS view\n this.__cleanTHREEScene(this.scene);\n\n // remove container\n this.psv.container.removeChild(this.canvasContainer);\n\n delete this.canvasContainer;\n delete this.renderer;\n delete this.scene;\n delete this.camera;\n delete this.mesh;\n delete this.meshContainer;\n delete this.raycaster;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} evt\n * @private\n */\n handleEvent(evt) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case EVENTS.SIZE_UPDATED: this.__onSizeUpdated(); break;\n case EVENTS.ZOOM_UPDATED: this.__onZoomUpdated(); break;\n case EVENTS.POSITION_UPDATED: this.__onPositionUpdated(); break;\n case EVENTS.CONFIG_CHANGED:\n if (evt.args[0].includes('fisheye')) {\n this.__onPositionUpdated();\n }\n if (evt.args[0].includes('mousemove')) {\n this.canvasContainer.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n }\n break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Hides the viewer\n */\n hide() {\n this.canvasContainer.style.opacity = 0;\n }\n\n /**\n * @summary Shows the viewer\n */\n show() {\n this.canvasContainer.style.opacity = 1;\n }\n\n /**\n * @summary Updates the size of the renderer and the aspect of the camera\n * @private\n */\n __onSizeUpdated() {\n this.renderer.setSize(this.prop.size.width, this.prop.size.height);\n this.camera.aspect = this.prop.aspect;\n this.camera.updateProjectionMatrix();\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Updates the fov of the camera\n * @private\n */\n __onZoomUpdated() {\n this.camera.fov = this.prop.vFov;\n this.camera.updateProjectionMatrix();\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Updates the position of the camera\n * @private\n */\n __onPositionUpdated() {\n this.camera.position.set(0, 0, 0);\n this.camera.lookAt(this.prop.direction);\n if (this.config.fisheye) {\n this.camera.position.copy(this.prop.direction).multiplyScalar(this.config.fisheye / 2).negate();\n }\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Main event loop, calls {@link render} if `prop.needsUpdate` is true\n * @param {number} timestamp\n * @fires PSV.before-render\n * @private\n */\n __renderLoop(timestamp) {\n const elapsed = this.timestamp !== null ? timestamp - this.timestamp : 0;\n this.timestamp = timestamp;\n\n this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp, elapsed);\n each(this.psv.dynamics, d => d.update(elapsed));\n\n if (this.prop.idleTime > 0 && timestamp - this.prop.idleTime > this.config.autorotateDelay) {\n this.psv.startAutorotate();\n }\n\n if (this.prop.needsUpdate) {\n this.render();\n this.prop.needsUpdate = false;\n }\n }\n\n /**\n * @summary Performs a render\n * @description Do not call this method directly, instead call\n * {@link PSV.Viewer#needsUpdate} on {@link PSV.event:before-render}.\n * @fires PSV.render\n */\n render() {\n this.renderer.render(this.scene, this.camera);\n this.psv.trigger(EVENTS.RENDER);\n }\n\n /**\n * @summary Applies the texture to the scene, creates the scene if needed\n * @param {PSV.TextureData} textureData\n * @fires PSV.panorama-loaded\n * @package\n */\n setTexture(textureData) {\n this.prop.panoData = textureData.panoData;\n\n this.psv.adapter.setTexture(this.mesh, textureData);\n\n if (!this.ready) {\n this.renderer.setAnimationLoop(t => this.__renderLoop(t));\n this.ready = true;\n }\n\n this.psv.needsUpdate();\n\n this.psv.trigger(EVENTS.PANORAMA_LOADED, textureData);\n }\n\n /**\n * @summary Apply a panorama data pose to a Mesh\n * @param {PSV.PanoData} [panoData]\n * @param {external:THREE.Mesh} [mesh=this.mesh]\n * @package\n */\n setPanoramaPose(panoData, mesh = this.mesh) {\n // By Google documentation the angles are applied on the camera in order : heading, pitch, roll\n // here we apply the reverse transformation on the sphere\n const cleanCorrection = this.psv.dataHelper.cleanPanoramaPose(panoData);\n\n mesh.rotation.set(\n -cleanCorrection.tilt,\n -cleanCorrection.pan,\n -cleanCorrection.roll,\n 'ZXY'\n );\n }\n\n /**\n * @summary Apply a SphereCorrection to a Mesh\n * @param {PSV.SphereCorrection} [sphereCorrection]\n * @param {external:THREE.Mesh} [mesh=this.meshContainer]\n * @package\n */\n setSphereCorrection(sphereCorrection, mesh = this.meshContainer) {\n const cleanCorrection = this.psv.dataHelper.cleanSphereCorrection(sphereCorrection);\n\n mesh.rotation.set(\n cleanCorrection.tilt,\n cleanCorrection.pan,\n cleanCorrection.roll,\n 'ZXY'\n );\n }\n\n /**\n * @summary Performs transition between the current and a new texture\n * @param {PSV.TextureData} textureData\n * @param {PSV.PanoramaOptions} options\n * @returns {PSV.Animation}\n * @package\n */\n transition(textureData, options) {\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n // create temp group and new mesh, half size to be in \"front\" of the first one\n const group = new THREE.Group();\n const mesh = this.psv.adapter.createMesh(0.5);\n this.psv.adapter.setTexture(mesh, textureData, true);\n this.psv.adapter.setTextureOpacity(mesh, 0);\n this.setPanoramaPose(textureData.panoData, mesh);\n this.setSphereCorrection(options.sphereCorrection, group);\n\n // rotate the new sphere to make the target position face the camera\n if (positionProvided) {\n const cleanPosition = this.psv.dataHelper.cleanPosition(options);\n const currentPosition = this.psv.getPosition();\n\n // Longitude rotation along the vertical axis\n const verticalAxis = new THREE.Vector3(0, 1, 0);\n group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - currentPosition.longitude);\n\n // Latitude rotation along the camera horizontal axis\n const horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.camera.getWorldDirection(new THREE.Vector3())).normalize();\n group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - currentPosition.latitude);\n }\n\n group.add(mesh);\n this.scene.add(group);\n\n const animation = new Animation({\n properties: {\n opacity: { start: 0.0, end: 1.0 },\n zoom : zoomProvided ? { start: this.psv.getZoomLevel(), end: options.zoom } : undefined,\n },\n duration : options.transition,\n easing : 'outCubic',\n onTick : (properties) => {\n this.psv.adapter.setTextureOpacity(mesh, properties.opacity);\n this.psv.adapter.setTextureOpacity(this.mesh, 1 - properties.opacity);\n\n if (zoomProvided) {\n this.psv.zoom(properties.zoom);\n }\n\n this.psv.needsUpdate();\n },\n });\n\n animation\n .then((completed) => {\n if (completed) {\n // remove temp sphere and transfer the texture to the main mesh\n this.setTexture(textureData);\n this.psv.adapter.setTextureOpacity(this.mesh, 1);\n this.setPanoramaPose(textureData.panoData);\n this.setSphereCorrection(options.sphereCorrection);\n\n // actually rotate the camera\n if (positionProvided) {\n this.psv.rotate(options);\n }\n }\n else {\n this.psv.adapter.disposeTexture(textureData);\n }\n\n this.scene.remove(group);\n mesh.geometry.dispose();\n mesh.geometry = null;\n });\n\n return animation;\n }\n\n /**\n * @summary Calls `dispose` on all objects and textures\n * @param {external:THREE.Object3D} object\n * @private\n */\n __cleanTHREEScene(object) {\n object.traverse((item) => {\n if (item.geometry) {\n item.geometry.dispose();\n }\n\n if (item.material) {\n if (Array.isArray(item.material)) {\n item.material.forEach((material) => {\n if (material.map) {\n material.map.dispose();\n }\n\n material.dispose();\n });\n }\n else {\n if (item.material.map) {\n item.material.map.dispose();\n }\n\n item.material.dispose();\n }\n }\n\n if (item.dispose && !(item instanceof THREE.Scene)) {\n item.dispose();\n }\n\n if (item !== object) {\n this.__cleanTHREEScene(item);\n }\n });\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Texture loader\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class TextureLoader extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @summary THREE file loader\n * @type {external:THREE:FileLoader}\n * @private\n */\n this.loader = new THREE.FileLoader();\n this.loader.setResponseType('blob');\n if (this.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.config.requestHeaders && typeof this.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.config.requestHeaders);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n this.abortLoading();\n super.destroy();\n }\n\n /**\n * @summary Loads the panorama texture(s)\n * @param {*} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @package\n * @deprecated\n */\n loadTexture(panorama, newPanoData) {\n return this.psv.adapter.loadTexture(panorama, newPanoData);\n }\n\n /**\n * @summary Cancels current HTTP requests\n * @package\n */\n abortLoading() {\n // noop implementation waiting for https://github.com/mrdoob/three.js/pull/23070\n }\n\n /**\n * @summary Loads a Blob with FileLoader\n * @param {string} url\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n */\n loadFile(url, onProgress) {\n if (this.config.requestHeaders && typeof this.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n let progress = 0;\n onProgress && onProgress(progress);\n\n this.loader.load(\n url,\n (result) => {\n progress = 100;\n onProgress && onProgress(progress);\n resolve(result);\n },\n (e) => {\n if (e.lengthComputable) {\n const newProgress = e.loaded / e.total * 100;\n if (newProgress > progress) {\n progress = newProgress;\n onProgress && onProgress(progress);\n }\n }\n },\n (err) => {\n reject(err);\n }\n );\n });\n }\n\n /**\n * @summary Loads an Image using FileLoader to have progress events\n * @param {string} url\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n */\n loadImage(url, onProgress) {\n return this.loadFile(url, onProgress)\n .then(result => new Promise((resolve, reject) => {\n const img = document.createElementNS('http://www.w3.org/1999/xhtml', 'img');\n img.onload = () => {\n URL.revokeObjectURL(img.src);\n resolve(img);\n };\n img.onerror = reject;\n img.src = URL.createObjectURL(result);\n }));\n }\n\n /**\n * @summary Preload a panorama file without displaying it\n * @param {*} panorama\n * @returns {Promise}\n */\n preloadPanorama(panorama) {\n if (this.psv.adapter.supportsPreload(panorama)) {\n return this.psv.adapter.loadTexture(panorama);\n }\n else {\n return Promise.resolve();\n }\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { addClasses, cleanPosition } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\nconst STATE = { NONE: 0, SHOWING: 1, HIDING: 2, READY: 3 };\n\n/**\n * @typedef {Object} PSV.components.Tooltip.Position\n * @summary Object defining the tooltip position\n * @property {number} top - Position of the tip of the arrow of the tooltip, in pixels\n * @property {number} left - Position of the tip of the arrow of the tooltip, in pixels\n * @property {string|string[]} [position='top center'] - Tooltip position toward it's arrow tip.\n * Accepted values are combinations of `top`, `center`, `bottom` and `left`, `center`, `right`\n * @property {Object} [box] - Used when displaying a tooltip on a marker\n * @property {number} [box.width=0]\n * @property {number} [box.height=0]\n */\n\n/**\n * @typedef {PSV.components.Tooltip.Position} PSV.components.Tooltip.Config\n * @summary Object defining the tooltip configuration\n * @property {string} content - HTML content of the tooltip\n * @property {string} [className] - Additional CSS class added to the tooltip\n * @property {*} [data] - Userdata associated to the tooltip\n */\n\n/**\n * @summary Tooltip component\n * @description Never instanciate tooltips directly use {@link PSV.services.TooltipRenderer} instead\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Tooltip extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n * @param {{arrow: number, offset: number}} size\n */\n constructor(psv, size) {\n super(psv, 'psv-tooltip');\n\n /**\n * @override\n * @property {number} arrow\n * @property {number} offset\n * @property {number} width\n * @property {number} height\n * @property {string} pos\n * @property {string} state\n * @property {*} data\n */\n this.prop = {\n ...this.prop,\n ...size,\n state : STATE.NONE,\n width : 0,\n height: 0,\n pos : '',\n data : null,\n };\n\n /**\n * Tooltip content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-tooltip-content';\n this.container.appendChild(this.content);\n\n /**\n * Tooltip arrow\n * @member {HTMLElement}\n * @readonly\n * @package\n */\n this.arrow = document.createElement('div');\n this.arrow.className = 'psv-tooltip-arrow';\n this.container.appendChild(this.arrow);\n\n this.container.addEventListener('transitionend', this);\n\n this.container.style.top = '-1000px';\n this.container.style.left = '-1000px';\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.arrow;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'transitionend': this.__onTransitionEnd(e); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Tooltip cannot be toggled');\n }\n\n /**\n * @summary Displays the tooltip on the viewer\n * Do not call this method directly, use {@link PSV.services.TooltipRenderer} instead.\n * @param {PSV.components.Tooltip.Config} config\n *\n * @fires PSV.show-tooltip\n * @throws {PSV.PSVError} when the configuration is incorrect\n *\n * @package\n */\n show(config) {\n if (this.prop.state !== STATE.NONE) {\n throw new PSVError('Initialized tooltip cannot be re-initialized');\n }\n\n if (config.className) {\n addClasses(this.container, config.className);\n }\n\n this.content.innerHTML = config.content;\n\n const rect = this.container.getBoundingClientRect();\n this.prop.width = rect.right - rect.left;\n this.prop.height = rect.bottom - rect.top;\n\n this.prop.state = STATE.READY;\n\n this.move(config);\n\n this.prop.data = config.data;\n this.prop.state = STATE.SHOWING;\n\n this.psv.trigger(EVENTS.SHOW_TOOLTIP, this.prop.data, this);\n }\n\n /**\n * @summary Moves the tooltip to a new position\n * @param {PSV.components.Tooltip.Position} config\n *\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n move(config) {\n if (this.prop.state !== STATE.SHOWING && this.prop.state !== STATE.READY) {\n throw new PSVError('Uninitialized tooltip cannot be moved');\n }\n\n const t = this.container;\n const a = this.arrow;\n\n // compute size\n const style = {\n posClass : cleanPosition(config.position, 'top center', false),\n width : this.prop.width,\n height : this.prop.height,\n top : 0,\n left : 0,\n arrowTop : 0,\n arrowLeft: 0,\n };\n\n // set initial position\n this.__computeTooltipPosition(style, config);\n\n // correct position if overflow\n let refresh = false;\n if (style.top < this.prop.offset) {\n style.posClass[0] = 'bottom';\n refresh = true;\n }\n else if (style.top + style.height > this.psv.prop.size.height - this.prop.offset) {\n style.posClass[0] = 'top';\n refresh = true;\n }\n if (style.left < this.prop.offset) {\n style.posClass[1] = 'right';\n refresh = true;\n }\n else if (style.left + style.width > this.psv.prop.size.width - this.prop.offset) {\n style.posClass[1] = 'left';\n refresh = true;\n }\n if (refresh) {\n this.__computeTooltipPosition(style, config);\n }\n\n // apply position\n t.style.top = style.top + 'px';\n t.style.left = style.left + 'px';\n\n a.style.top = style.arrowTop + 'px';\n a.style.left = style.arrowLeft + 'px';\n\n const newPos = style.posClass.join('-');\n if (newPos !== this.prop.pos) {\n t.classList.remove(`psv-tooltip--${this.prop.pos}`);\n\n this.prop.pos = newPos;\n t.classList.add(`psv-tooltip--${this.prop.pos}`);\n }\n }\n\n /**\n * @summary Hides the tooltip\n * @fires PSV.hide-tooltip\n */\n hide() {\n this.container.classList.remove('psv-tooltip--visible');\n this.prop.state = STATE.HIDING;\n\n this.psv.trigger(EVENTS.HIDE_TOOLTIP, this.prop.data);\n }\n\n /**\n * @summary Finalize transition\n * @param {TransitionEvent} e\n * @private\n */\n __onTransitionEnd(e) {\n if (e.propertyName === 'transform') {\n switch (this.prop.state) {\n case STATE.SHOWING:\n this.container.classList.add('psv-tooltip--visible');\n this.prop.state = STATE.READY;\n break;\n\n case STATE.HIDING:\n this.prop.state = STATE.NONE;\n this.destroy();\n break;\n\n default:\n // nothing\n }\n }\n }\n\n /**\n * @summary Computes the position of the tooltip and its arrow\n * @param {Object} style\n * @param {Object} config\n * @private\n */\n __computeTooltipPosition(style, config) {\n let topBottom = false;\n\n if (!config.box) {\n config.box = {\n width : 0,\n height: 0,\n };\n }\n\n switch (style.posClass[0]) {\n case 'bottom':\n style.top = config.top + config.box.height + this.prop.offset + this.prop.arrow;\n style.arrowTop = -this.prop.arrow * 2;\n topBottom = true;\n break;\n\n case 'center':\n style.top = config.top + config.box.height / 2 - style.height / 2;\n style.arrowTop = style.height / 2 - this.prop.arrow;\n break;\n\n case 'top':\n style.top = config.top - style.height - this.prop.offset - this.prop.arrow;\n style.arrowTop = style.height;\n topBottom = true;\n break;\n\n // no default\n }\n\n switch (style.posClass[1]) {\n case 'right':\n if (topBottom) {\n style.left = config.left + config.box.width / 2 - this.prop.offset - this.prop.arrow;\n style.arrowLeft = this.prop.offset;\n }\n else {\n style.left = config.left + config.box.width + this.prop.offset + this.prop.arrow;\n style.arrowLeft = -this.prop.arrow * 2;\n }\n break;\n\n case 'center':\n style.left = config.left + config.box.width / 2 - style.width / 2;\n style.arrowLeft = style.width / 2 - this.prop.arrow;\n break;\n\n case 'left':\n if (topBottom) {\n style.left = config.left - style.width + config.box.width / 2 + this.prop.offset + this.prop.arrow;\n style.arrowLeft = style.width - this.prop.offset - this.prop.arrow * 2;\n }\n else {\n style.left = config.left - style.width - this.prop.offset - this.prop.arrow;\n style.arrowLeft = style.width;\n }\n break;\n\n // no default\n }\n }\n\n}\n","import { Tooltip } from '../components/Tooltip';\nimport { getStyle } from '../utils';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Tooltip renderer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class TooltipRenderer extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n const testTooltip = new Tooltip(this.psv);\n\n /**\n * @summary Computed static sizes\n * @member {Object}\n * @package\n * @property {number} arrowSize\n * @property {number} offset\n */\n this.size = {\n arrow : parseInt(getStyle(testTooltip.arrow, 'borderTopWidth'), 10),\n offset: parseInt(getStyle(testTooltip.container, 'outlineWidth'), 10),\n };\n\n testTooltip.destroy();\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.size;\n\n super.destroy();\n }\n\n /**\n * @summary Displays a tooltip on the viewer\n * @param {PSV.components.Tooltip.Config} config\n * @returns {PSV.components.Tooltip}\n *\n * @fires PSV.show-tooltip\n * @throws {PSV.PSVError} when the configuration is incorrect\n *\n * @example\n * viewer.tooltip.create({ content: 'Hello world', top: 200, left: 450, position: 'center bottom'})\n */\n create(config) {\n const tooltip = new Tooltip(this.psv, this.size);\n tooltip.show(config);\n\n return tooltip;\n }\n\n}\n","import * as THREE from 'three';\nimport { EventEmitter } from 'uevent';\nimport { Loader } from './components/Loader';\nimport { Navbar } from './components/Navbar';\nimport { Notification } from './components/Notification';\nimport { Overlay } from './components/Overlay';\nimport { Panel } from './components/Panel';\nimport { CONFIG_PARSERS, DEFAULTS, DEPRECATED_OPTIONS, getConfig, READONLY_OPTIONS } from './data/config';\nimport { CHANGE_EVENTS, DEFAULT_TRANSITION, EVENTS, IDS, SPHERE_RADIUS, VIEWER_DATA } from './data/constants';\nimport { SYSTEM } from './data/system';\nimport errorIcon from './icons/error.svg';\nimport { AbstractPlugin } from './plugins/AbstractPlugin';\nimport { PSVError } from './PSVError';\nimport { DataHelper } from './services/DataHelper';\nimport { EventsHandler } from './services/EventsHandler';\nimport { Renderer } from './services/Renderer';\nimport { TextureLoader } from './services/TextureLoader';\nimport { TooltipRenderer } from './services/TooltipRenderer';\nimport {\n Animation,\n Dynamic,\n each,\n exitFullscreen,\n getAbortError,\n getAngle,\n getShortestArc,\n isAbortError,\n isExtendedPosition,\n isFullscreenEnabled,\n isNil,\n logWarn,\n MultiDynamic,\n pluginInterop,\n requestFullscreen,\n throttle,\n toggleClass\n} from './utils';\n\nTHREE.Cache.enabled = true;\n\n/**\n * @summary Main class\n * @memberOf PSV\n * @extends {external:uEvent.EventEmitter}\n */\nexport class Viewer extends EventEmitter {\n\n /**\n * @param {PSV.Options} options\n * @fires PSV.ready\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n constructor(options) {\n super();\n\n SYSTEM.load();\n\n // must support WebGL\n if (!SYSTEM.isWebGLSupported) {\n throw new PSVError('WebGL is not supported.');\n }\n\n if (SYSTEM.maxTextureWidth === 0) {\n throw new PSVError('Unable to detect system capabilities');\n }\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} ready - when all components are loaded\n * @property {boolean} uiRefresh - if the UI needs to be renderer\n * @property {boolean} needsUpdate - if the view needs to be renderer\n * @property {boolean} fullscreen - if the viewer is currently fullscreen\n * @property {external:THREE.Vector3} direction - direction of the camera\n * @property {number} vFov - vertical FOV\n * @property {number} hFov - horizontal FOV\n * @property {number} aspect - viewer aspect ratio\n * @property {boolean} autorotateEnabled - automatic rotation is enabled\n * @property {PSV.Animation} animationPromise - promise of the current animation\n * @property {Promise} loadingPromise - promise of the setPanorama method\n * @property {number} idleTime - time of the last user action\n * @property {object} objectsObservers\n * @property {PSV.Size} size - size of the container\n * @property {PSV.PanoData} panoData - panorama metadata, if supported\n */\n this.prop = {\n ready : false,\n uiRefresh : false,\n needsUpdate : false,\n fullscreen : false,\n direction : new THREE.Vector3(0, 0, SPHERE_RADIUS),\n vFov : null,\n hFov : null,\n aspect : null,\n autorotateEnabled: false,\n animationPromise : null,\n loadingPromise : null,\n idleTime : -1,\n objectsObservers : {},\n size : {\n width : 0,\n height: 0,\n },\n panoData : {\n fullWidth : 0,\n fullHeight : 0,\n croppedWidth : 0,\n croppedHeight: 0,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n },\n };\n\n /**\n * @summary Configuration holder\n * @type {PSV.Options}\n * @readonly\n */\n this.config = getConfig(options);\n\n /**\n * @summary Top most parent\n * @member {HTMLElement}\n * @readonly\n */\n this.parent = (typeof options.container === 'string') ? document.getElementById(options.container) : options.container;\n this.parent[VIEWER_DATA] = this;\n\n /**\n * @summary Main container\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.classList.add('psv-container');\n this.parent.appendChild(this.container);\n\n /**\n * @summary Render adapter\n * @type {PSV.adapters.AbstractAdapter}\n * @readonly\n * @package\n */\n this.adapter = new this.config.adapter[0](this, this.config.adapter[1]); // eslint-disable-line new-cap\n\n /**\n * @summary All child components\n * @type {PSV.components.AbstractComponent[]}\n * @readonly\n * @package\n */\n this.children = [];\n\n /**\n * @summary All plugins\n * @type {Object}\n * @readonly\n * @package\n */\n this.plugins = {};\n\n /**\n * @type {PSV.services.Renderer}\n * @readonly\n */\n this.renderer = new Renderer(this);\n\n /**\n * @type {PSV.services.TextureLoader}\n * @readonly\n */\n this.textureLoader = new TextureLoader(this);\n\n /**\n * @type {PSV.services.EventsHandler}\n * @readonly\n */\n this.eventsHandler = new EventsHandler(this);\n\n /**\n * @type {PSV.services.DataHelper}\n * @readonly\n */\n this.dataHelper = new DataHelper(this);\n\n /**\n * @member {PSV.components.Loader}\n * @readonly\n */\n this.loader = new Loader(this);\n\n /**\n * @member {PSV.components.Navbar}\n * @readonly\n */\n this.navbar = new Navbar(this);\n\n /**\n * @member {PSV.components.Panel}\n * @readonly\n */\n this.panel = new Panel(this);\n\n /**\n * @member {PSV.services.TooltipRenderer}\n * @readonly\n */\n this.tooltip = new TooltipRenderer(this);\n\n /**\n * @member {PSV.components.Notification}\n * @readonly\n */\n this.notification = new Notification(this);\n\n /**\n * @member {PSV.components.Overlay}\n * @readonly\n */\n this.overlay = new Overlay(this);\n\n /**\n * @member {Record}\n * @package\n */\n this.dynamics = {\n zoom: new Dynamic((value) => {\n this.prop.vFov = this.dataHelper.zoomLevelToFov(value);\n this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov);\n this.trigger(EVENTS.ZOOM_UPDATED, value);\n }, this.config.defaultZoomLvl, 0, 100),\n\n position: new MultiDynamic({\n longitude: new Dynamic(null, this.config.defaultLong, 0, 2 * Math.PI, true),\n latitude : new Dynamic(null, this.config.defaultLat, -Math.PI / 2, Math.PI / 2),\n }, (position) => {\n this.dataHelper.sphericalCoordsToVector3(position, this.prop.direction);\n this.trigger(EVENTS.POSITION_UPDATED, position);\n }),\n };\n\n this.__updateSpeeds();\n\n this.eventsHandler.init();\n\n this.__resizeRefresh = throttle(() => this.refreshUi('resize'), 500);\n\n // apply container size\n this.resize(this.config.size);\n\n // init plugins\n this.config.plugins.forEach(([plugin, opts]) => {\n this.plugins[plugin.id] = new plugin(this, opts); // eslint-disable-line new-cap\n });\n each(this.plugins, plugin => plugin.init?.());\n\n // init buttons\n this.navbar.setButtons(this.config.navbar);\n\n // load panorama\n if (this.config.panorama) {\n this.setPanorama(this.config.panorama);\n }\n\n toggleClass(this.container, 'psv--is-touch', SYSTEM.isTouchEnabled.initial);\n SYSTEM.isTouchEnabled.promise.then(enabled => toggleClass(this.container, 'psv--is-touch', enabled));\n\n // enable GUI after first render\n this.once(EVENTS.RENDER, () => {\n if (this.config.navbar) {\n this.container.classList.add('psv--has-navbar');\n this.navbar.show();\n }\n\n // Queue autorotate\n if (!isNil(this.config.autorotateDelay)) {\n this.prop.idleTime = performance.now();\n }\n\n this.prop.ready = true;\n\n setTimeout(() => {\n this.refreshUi('init');\n\n this.trigger(EVENTS.READY);\n }, 0);\n });\n }\n\n /**\n * @summary Destroys the viewer\n * @description The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible.\n */\n destroy() {\n this.__stopAll();\n this.stopKeyboardControl();\n this.exitFullscreen();\n\n this.eventsHandler.destroy();\n this.renderer.destroy();\n this.textureLoader.destroy();\n this.dataHelper.destroy();\n this.adapter.destroy();\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n each(this.plugins, plugin => plugin.destroy());\n delete this.plugins;\n\n this.parent.removeChild(this.container);\n delete this.parent[VIEWER_DATA];\n\n delete this.parent;\n delete this.container;\n\n delete this.loader;\n delete this.navbar;\n delete this.panel;\n delete this.tooltip;\n delete this.notification;\n delete this.overlay;\n\n delete this.config;\n }\n\n /**\n * @summary Refresh UI\n * @package\n */\n refreshUi(reason) {\n if (!this.prop.ready) {\n return;\n }\n\n if (!this.prop.uiRefresh) {\n // console.log(`PhotoSphereViewer: UI Refresh, ${reason}`);\n\n this.prop.uiRefresh = true;\n\n this.children.every((child) => {\n child.refreshUi();\n return this.prop.uiRefresh === true;\n });\n\n this.prop.uiRefresh = false;\n }\n else if (this.prop.uiRefresh !== 'new') {\n this.prop.uiRefresh = 'new';\n\n // wait for current refresh to cancel\n setTimeout(() => {\n this.prop.uiRefresh = false;\n this.refreshUi(reason);\n });\n }\n }\n\n /**\n * @summary Returns the instance of a plugin if it exists\n * @param {Class|string} pluginId\n * @returns {PSV.plugins.AbstractPlugin}\n */\n getPlugin(pluginId) {\n if (typeof pluginId === 'string') {\n return this.plugins[pluginId];\n }\n else {\n const pluginCtor = pluginInterop(pluginId, AbstractPlugin);\n return pluginCtor ? this.plugins[pluginCtor.id] : undefined;\n }\n }\n\n /**\n * @summary Returns the current position of the camera\n * @returns {PSV.Position}\n */\n getPosition() {\n return this.dataHelper.cleanPosition(this.dynamics.position.current);\n }\n\n /**\n * @summary Returns the current zoom level\n * @returns {number}\n */\n getZoomLevel() {\n return this.dynamics.zoom.current;\n }\n\n /**\n * @summary Returns the current viewer size\n * @returns {PSV.Size}\n */\n getSize() {\n return { ...this.prop.size };\n }\n\n /**\n * @summary Checks if the automatic rotation is enabled\n * @returns {boolean}\n */\n isAutorotateEnabled() {\n return this.prop.autorotateEnabled;\n }\n\n /**\n * @summary Checks if the viewer is in fullscreen\n * @returns {boolean}\n */\n isFullscreenEnabled() {\n if (SYSTEM.fullscreenEvent) {\n return isFullscreenEnabled(this.container);\n }\n else {\n return this.prop.fullscreen;\n }\n }\n\n /**\n * @summary Flags the view has changed for the next render\n */\n needsUpdate() {\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Resizes the canvas when the window is resized\n * @fires PSV.size-updated\n */\n autoSize() {\n if (this.container.clientWidth !== this.prop.size.width || this.container.clientHeight !== this.prop.size.height) {\n this.prop.size.width = Math.round(this.container.clientWidth);\n this.prop.size.height = Math.round(this.container.clientHeight);\n this.prop.aspect = this.prop.size.width / this.prop.size.height;\n this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov);\n\n this.trigger(EVENTS.SIZE_UPDATED, this.getSize());\n this.__resizeRefresh();\n }\n }\n\n /**\n * @summary Loads a new panorama file\n * @description Loads a new panorama file, optionally changing the camera position/zoom and activating the transition animation.
\n * If the \"options\" parameter is not defined, the camera will not move and the ongoing animation will continue.
\n * If another loading is already in progress it will be aborted.\n * @param {*} path - URL of the new panorama file\n * @param {PSV.PanoramaOptions} [options]\n * @returns {Promise} resolves false if the loading was aborted by another call\n */\n setPanorama(path, options = {}) {\n this.textureLoader.abortLoading();\n this.prop.transitionAnimation?.cancel();\n\n // apply default parameters on first load\n if (!this.prop.ready) {\n if (!('sphereCorrection' in options)) {\n options.sphereCorrection = this.config.sphereCorrection;\n }\n if (!('panoData' in options)) {\n options.panoData = this.config.panoData;\n }\n }\n\n if (options.transition === undefined || options.transition === true) {\n options.transition = DEFAULT_TRANSITION;\n }\n if (options.showLoader === undefined) {\n options.showLoader = true;\n }\n if (options.caption === undefined) {\n options.caption = this.config.caption;\n }\n if (options.description === undefined) {\n options.description = this.config.description;\n }\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n if (positionProvided || zoomProvided) {\n this.__stopAll();\n }\n\n this.hideError();\n\n this.config.panorama = path;\n this.config.caption = options.caption;\n this.config.description = options.description;\n\n const done = (err) => {\n this.loader.hide();\n\n this.prop.loadingPromise = null;\n\n if (isAbortError(err)) {\n return false;\n }\n else if (err) {\n this.navbar.setCaption('');\n this.showError(this.config.lang.loadError);\n console.error(err);\n throw err;\n }\n else {\n this.resetIdleTimer();\n this.navbar.setCaption(this.config.caption);\n return true;\n }\n };\n\n this.navbar.setCaption(`${this.config.loadingTxt || ''}`);\n if (options.showLoader || !this.prop.ready) {\n this.loader.show();\n }\n\n const loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData)\n .then((textureData) => {\n // check if another panorama was requested\n if (textureData.panorama !== this.config.panorama) {\n this.adapter.disposeTexture(textureData);\n throw getAbortError();\n }\n return textureData;\n });\n\n if (!options.transition || !this.prop.ready || !this.adapter.supportsTransition(this.config.panorama)) {\n this.prop.loadingPromise = loadingPromise\n .then((textureData) => {\n this.renderer.show();\n this.renderer.setTexture(textureData);\n this.renderer.setPanoramaPose(textureData.panoData);\n this.renderer.setSphereCorrection(options.sphereCorrection);\n\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n if (positionProvided) {\n this.rotate(options);\n }\n })\n .then(done, done);\n }\n else {\n this.prop.loadingPromise = loadingPromise\n .then((textureData) => {\n this.loader.hide();\n\n this.prop.transitionAnimation = this.renderer.transition(textureData, options);\n return this.prop.transitionAnimation\n .then((completed) => {\n this.prop.transitionAnimation = null;\n if (!completed) {\n throw getAbortError();\n }\n });\n })\n .then(done, done);\n }\n\n return this.prop.loadingPromise;\n }\n\n /**\n * @summary Update options\n * @param {PSV.Options} options\n * @fires PSV.config-changed\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n setOptions(options) {\n const rawConfig = {\n ...this.config,\n ...options,\n };\n\n each(options, (value, key) => {\n if (DEPRECATED_OPTIONS[key]) {\n logWarn(DEPRECATED_OPTIONS[key]);\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (READONLY_OPTIONS[key]) {\n throw new PSVError(READONLY_OPTIONS[key]);\n }\n\n if (CONFIG_PARSERS[key]) {\n this.config[key] = CONFIG_PARSERS[key](value, rawConfig);\n }\n else {\n this.config[key] = value;\n }\n\n switch (key) {\n case 'caption':\n case 'description':\n this.navbar.setCaption(this.config.caption);\n break;\n\n case 'size':\n this.resize(value);\n break;\n\n case 'sphereCorrection':\n this.renderer.setSphereCorrection(value);\n break;\n\n case 'navbar':\n case 'lang':\n this.navbar.setButtons(this.config.navbar);\n break;\n\n case 'moveSpeed':\n case 'zoomSpeed':\n this.__updateSpeeds();\n break;\n\n case 'minFov':\n case 'maxFov':\n this.dynamics.zoom.setValue(this.dataHelper.fovToZoomLevel(this.prop.vFov));\n this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel());\n break;\n\n case 'canvasBackground':\n this.renderer.canvasContainer.style.background = this.config.canvasBackground;\n break;\n\n case 'autorotateIdle':\n this.resetIdleTimer();\n break;\n\n default:\n break;\n }\n });\n\n this.needsUpdate();\n this.refreshUi('set options');\n\n this.trigger(EVENTS.CONFIG_CHANGED, Object.keys(options));\n }\n\n /**\n * @summary Update options\n * @param {string} option\n * @param {any} value\n * @fires PSV.config-changed\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n setOption(option, value) {\n this.setOptions({ [option]: value });\n }\n\n /**\n * @summary Restarts the idle timer (if `autorotateIdle=true`)\n * @package\n */\n resetIdleTimer() {\n this.prop.idleTime = this.config.autorotateIdle ? performance.now() : -1;\n }\n\n /**\n * @summary Stops the idle timer\n * @package\n */\n disableIdleTimer() {\n this.prop.idleTime = -1;\n }\n\n /**\n * @summary Starts the automatic rotation\n * @fires PSV.autorotate\n */\n startAutorotate(refresh = false) {\n if (refresh && !this.isAutorotateEnabled()) {\n return;\n }\n if (!refresh && this.isAutorotateEnabled()) {\n return;\n }\n\n if (!refresh) {\n this.__stopAll();\n }\n\n this.dynamics.position.roll({\n longitude: this.config.autorotateSpeed < 0,\n }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed));\n\n this.dynamics.position.goto({\n latitude: this.config.autorotateLat,\n }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed));\n\n this.prop.autorotateEnabled = true;\n\n if (!refresh) {\n this.trigger(EVENTS.AUTOROTATE, true);\n }\n }\n\n /**\n * @summary Stops the automatic rotation\n * @fires PSV.autorotate\n */\n stopAutorotate() {\n if (this.isAutorotateEnabled()) {\n this.dynamics.position.stop();\n\n this.prop.autorotateEnabled = false;\n\n this.trigger(EVENTS.AUTOROTATE, false);\n }\n }\n\n /**\n * @summary Starts or stops the automatic rotation\n * @fires PSV.autorotate\n */\n toggleAutorotate() {\n if (this.isAutorotateEnabled()) {\n this.stopAutorotate();\n }\n else {\n this.startAutorotate();\n }\n }\n\n /**\n * @summary Displays an error message over the viewer\n * @param {string} message\n */\n showError(message) {\n this.overlay.show({\n id : IDS.ERROR,\n image : errorIcon,\n text : message,\n dissmisable: false,\n });\n }\n\n /**\n * @summary Hides the error message\n */\n hideError() {\n this.overlay.hide(IDS.ERROR);\n }\n\n /**\n * @summary Rotates the view to specific longitude and latitude\n * @param {PSV.ExtendedPosition} position\n * @fires PSV.before-rotate\n * @fires PSV.position-updated\n */\n rotate(position) {\n const e = this.trigger(EVENTS.BEFORE_ROTATE, position);\n if (e.isDefaultPrevented()) {\n return;\n }\n\n const cleanPosition = this.change(CHANGE_EVENTS.GET_ROTATE_POSITION, this.dataHelper.cleanPosition(position));\n this.dynamics.position.setValue(cleanPosition);\n }\n\n /**\n * @summary Rotates and zooms the view with a smooth animation\n * @param {PSV.AnimateOptions} options - position and/or zoom level\n * @returns {PSV.Animation}\n */\n animate(options) {\n this.__stopAll();\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n const animProperties = {};\n let duration;\n\n // clean/filter position and compute duration\n if (positionProvided) {\n const cleanPosition = this.change(CHANGE_EVENTS.GET_ANIMATE_POSITION, this.dataHelper.cleanPosition(options));\n const currentPosition = this.getPosition();\n\n // longitude offset for shortest arc\n const tOffset = getShortestArc(currentPosition.longitude, cleanPosition.longitude);\n\n animProperties.longitude = { start: currentPosition.longitude, end: currentPosition.longitude + tOffset };\n animProperties.latitude = { start: currentPosition.latitude, end: cleanPosition.latitude };\n\n duration = this.dataHelper.speedToDuration(options.speed, getAngle(currentPosition, cleanPosition));\n }\n\n // clean/filter zoom and compute duration\n if (zoomProvided) {\n const dZoom = Math.abs(options.zoom - this.getZoomLevel());\n\n animProperties.zoom = { start: this.getZoomLevel(), end: options.zoom };\n\n if (!duration) {\n // if animating zoom only and a speed is given, use an arbitrary PI/4 to compute the duration\n duration = this.dataHelper.speedToDuration(options.speed, Math.PI / 4 * dZoom / 100);\n }\n }\n\n // if no animation needed\n if (!duration) {\n if (positionProvided) {\n this.rotate(options);\n }\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n\n return new Animation();\n }\n\n this.prop.animationPromise = new Animation({\n properties: animProperties,\n duration : duration,\n easing : 'inOutSine',\n onTick : (properties) => {\n if (positionProvided) {\n this.rotate(properties);\n }\n if (zoomProvided) {\n this.zoom(properties.zoom);\n }\n },\n });\n\n this.prop.animationPromise.then(() => {\n this.prop.animationPromise = null;\n this.resetIdleTimer();\n });\n\n return this.prop.animationPromise;\n }\n\n /**\n * @summary Stops the ongoing animation\n * @description The return value is a Promise because the is no guaranty the animation can be stopped synchronously.\n * @returns {Promise} Resolved when the animation has ben cancelled\n */\n stopAnimation() {\n if (this.prop.animationPromise) {\n return new Promise((resolve) => {\n this.prop.animationPromise.then(resolve);\n this.prop.animationPromise.cancel();\n this.prop.animationPromise = null;\n });\n }\n else {\n return Promise.resolve();\n }\n }\n\n /**\n * @summary Zooms to a specific level between `max_fov` and `min_fov`\n * @param {number} level - new zoom level from 0 to 100\n * @fires PSV.zoom-updated\n */\n zoom(level) {\n this.dynamics.zoom.setValue(level);\n }\n\n /**\n * @summary Increases the zoom level\n * @param {number} [step=1]\n */\n zoomIn(step = 1) {\n this.dynamics.zoom.step(step);\n }\n\n /**\n * @summary Decreases the zoom level\n * @param {number} [step=1]\n */\n zoomOut(step = 1) {\n this.dynamics.zoom.step(-step);\n }\n\n /**\n * @summary Resizes the viewer\n * @param {PSV.CssSize} size\n */\n resize(size) {\n ['width', 'height'].forEach((dim) => {\n if (size && size[dim]) {\n if (/^[0-9.]+$/.test(size[dim])) {\n size[dim] += 'px';\n }\n this.parent.style[dim] = size[dim];\n }\n });\n\n this.autoSize();\n }\n\n /**\n * @summary Enters the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n enterFullscreen() {\n if (SYSTEM.fullscreenEvent) {\n requestFullscreen(this.container);\n }\n else {\n this.container.classList.add('psv-container--fullscreen');\n this.autoSize();\n this.eventsHandler.__fullscreenToggled(true);\n }\n }\n\n /**\n * @summary Exits the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n exitFullscreen() {\n if (this.isFullscreenEnabled()) {\n if (SYSTEM.fullscreenEvent) {\n exitFullscreen();\n }\n else {\n this.container.classList.remove('psv-container--fullscreen');\n this.autoSize();\n this.eventsHandler.__fullscreenToggled(false);\n }\n }\n }\n\n /**\n * @summary Enters or exits the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n toggleFullscreen() {\n if (!this.isFullscreenEnabled()) {\n this.enterFullscreen();\n }\n else {\n this.exitFullscreen();\n }\n }\n\n /**\n * @summary Enables the keyboard controls (done automatically when entering fullscreen)\n */\n startKeyboardControl() {\n this.eventsHandler.enableKeyboard();\n }\n\n /**\n * @summary Disables the keyboard controls (done automatically when exiting fullscreen)\n */\n stopKeyboardControl() {\n this.eventsHandler.disableKeyboard();\n }\n\n /**\n * @summary Subscribes to events on objects in the scene\n * @param {string} userDataKey - only objects with the following `userData` will be emitted\n * @param {EventListener} listener - must implement `handleEvent\n * @return {function} call to stop the subscription\n * @package\n */\n observeObjects(userDataKey, listener) {\n this.prop.objectsObservers[userDataKey] = { listener };\n\n return () => {\n delete this.prop.objectsObservers[userDataKey];\n };\n }\n\n /**\n * @summary Stops all current animations\n * @returns {Promise}\n * @package\n */\n __stopAll() {\n this.trigger(EVENTS.STOP_ALL);\n\n this.disableIdleTimer();\n this.stopAutorotate();\n return this.stopAnimation();\n }\n\n /**\n * @summary Recomputes dynamics speeds\n * @private\n */\n __updateSpeeds() {\n this.dynamics.zoom.setSpeed(this.config.zoomSpeed * 50);\n this.dynamics.position.setSpeed(THREE.MathUtils.degToRad(this.config.moveSpeed * 50));\n }\n\n}\n"],"names":["PSVError","message","Error","captureStackTrace","stack","prototype","Object","create","name","constructor","AbstractAdapter","psv","destroy","supportsTransition","panorama","supportsPreload","loadTexture","newPanoData","createMesh","scale","setTexture","mesh","textureData","transition","setTextureOpacity","opacity","disposeTexture","id","supportsDownload","DEFAULT_TRANSITION","MOVE_THRESHOLD","DBLCLICK_DELAY","LONGTOUCH_DELAY","TWOFINGERSOVERLAY_DELAY","CTRLZOOM_TIMEOUT","INERTIA_WINDOW","SPHERE_RADIUS","VIEWER_DATA","MESH_USER_DATA","ACTIONS","ROTATE_LAT_UP","ROTATE_LAT_DOWN","ROTATE_LONG_RIGHT","ROTATE_LONG_LEFT","ZOOM_IN","ZOOM_OUT","TOGGLE_AUTOROTATE","EVENTS","AUTOROTATE","BEFORE_RENDER","BEFORE_ROTATE","CLICK","CLOSE_PANEL","CONFIG_CHANGED","DOUBLE_CLICK","FULLSCREEN_UPDATED","HIDE_NOTIFICATION","HIDE_OVERLAY","HIDE_TOOLTIP","KEY_PRESS","LOAD_PROGRESS","OPEN_PANEL","PANORAMA_LOADED","POSITION_UPDATED","READY","RENDER","SHOW_NOTIFICATION","SHOW_OVERLAY","SHOW_TOOLTIP","SIZE_UPDATED","STOP_ALL","ZOOM_UPDATED","CHANGE_EVENTS","GET_ANIMATE_POSITION","GET_ROTATE_POSITION","OBJECT_EVENTS","ENTER_OBJECT","HOVER_OBJECT","LEAVE_OBJECT","IDS","MENU","TWO_FINGERS","CTRL_ZOOM","ERROR","DESCRIPTION","EASINGS","linear","t","inQuad","outQuad","inOutQuad","inCubic","outCubic","inOutCubic","inQuart","outQuart","inOutQuart","inQuint","outQuint","inOutQuint","inSine","Math","cos","PI","outSine","sin","inOutSine","inExpo","pow","outExpo","inOutExpo","inCirc","sqrt","outCirc","inOutCirc","KEY_CODES","Enter","Control","Escape","Space","PageUp","PageDown","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Delete","Plus","Minus","LOCALSTORAGE_TOUCH_SUPPORT","SYSTEM","loaded","pixelRatio","isWebGLSupported","isTouchEnabled","maxTextureWidth","mouseWheelEvent","fullscreenEvent","load","ctx","getWebGLCtx","window","devicePixelRatio","getMaxTextureWidth","getMouseWheelEvent","getFullscreenEvent","maxCanvasWidth","getMaxCanvasWidth","canvas","document","createElement","names","context","getContext","some","e","initial","navigator","maxTouchPoints","localStorage","promise","Promise","resolve","clear","listenerMouse","listenerTouch","listenerTimeout","removeEventListener","addEventListener","setTimeout","getParameter","MAX_TEXTURE_SIZE","maxWidth","width","height","fillStyle","fillRect","getImageData","data","onmousewheel","undefined","FULLSCREEN_EVT_MAP","exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen","validExits","keys","filter","exit","length","toggleClass","element","className","active","classList","toggle","contains","add","remove","addClasses","split","forEach","removeClasses","hasParent","el","parent","test","parentNode","getClosest","selector","matches","SVGElement","parentElement","getPosition","left","top","offsetLeft","scrollLeft","clientLeft","offsetTop","scrollTop","clientTop","offsetParent","isFullscreenEnabled","elt","fullscreenElement","webkitFullscreenElement","requestFullscreen","webkitRequestFullscreen","call","getStyle","prop","getComputedStyle","normalizeWheel","event","PIXEL_STEP","LINE_HEIGHT","PAGE_HEIGHT","spinX","spinY","pixelX","pixelY","detail","wheelDelta","wheelDeltaY","wheelDeltaX","axis","HORIZONTAL_AXIS","deltaY","deltaX","deltaMode","bound","x","min","max","loop","value","result","isInteger","Number","isFinite","floor","isPowerOfTwo","log","sum","array","reduce","a","b","distance","p1","p2","y","getShortestArc","from","to","tCandidates","candidate","newCandidate","abs","Infinity","getAngle","position1","position2","acos","latitude","longitude","greatArcDistance","λ1","φ1","λ2","φ2","dasherize","str","replace","s","i","toLowerCase","throttle","func","wait","self","args","timeout","previous","later","Date","now","apply","remaining","arguments","clearTimeout","isPlainObject","obj","getPrototypeOf","proto","toString","deepmerge","target","src","first","merge","Array","isArray","key","clone","isEmpty","each","object","callback","isNil","val","firstNonNull","values","pluginInterop","plugin","entries","p","getAbortError","error","isAbortError","err","logWarn","console","warn","isExtendedPosition","key1","key2","getXMPValue","attr","match","parseInt","isNaN","CSS_POSITIONS","bottom","right","center","parsePosition","tokens","toLocaleLowerCase","slice","xFirst","map","token","reverse","parsed","join","parseFloat","LEFT_MAP","TOP_MAP","cleanPosition","defaultValue","allowCenter","tempPos","parseSpeed","speed","speedStr","trim","speedValue","speedUnit","THREE","MathUtils","degToRad","parseAngle","angle","zeroCenter","halfCircle","unit","createTexture","img","texture","Texture","needsUpdate","minFilter","LinearFilter","generateMipmaps","quaternion","Quaternion","applyEulerInverse","vector","euler","setFromEuler","invert","applyQuaternion","Animation","options","__callbacks","easing","__start","delay","__delayTimeout","__animationFrame","requestAnimationFrame","__run","__resolved","timestamp","progress","duration","current","properties","start","end","onTick","__resolve","cb","then","onFulfilled","onRejected","__cancelled","push","cancel","cancelAnimationFrame","catch","finally","onFinally","Dynamic","fn","loopValue","mode","STOP","speedMult","currentSpeed","setSpeed","goto","position","POSITION","step","roll","INFINITE","stop","setValue","update","elapsed","dstStop","targetSpeed","next","MultiDynamic","dynamics","d","positions","steps","rolls","hasUpdates","dynamic","Slider","container","direction","onUpdate","mousedown","mouseover","handleEvent","type","stopPropagation","__onMouseDown","__onMouseEnter","__onMouseLeave","__onTouchStart","__onMouseMove","__onTouchMove","__onMouseUp","__onTouchEnd","evt","__update","changedTouches","moving","boundingClientRect","getBoundingClientRect","cursor","vertical","pos","size","click","VERTICAL","EventEmitter","HORIZONTAL","EquirectangularAdapter","config","resolution","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","reject","useXmpData","textureLoader","loadImage","loader","setProgress","xmpPanoData","__loadXMP","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","__createEquirectangularTexture","onProgress","loadFile","blob","__loadBlobAsString","binary","indexOf","substring","includes","reader","FileReader","onload","onerror","readAsText","ratio","resizedPanoData","buffer","drawImage","geometry","SphereGeometry","material","MeshBasicMaterial","Mesh","dispose","transparent","AbstractComponent","children","visible","appendChild","removeChild","childIdx","splice","child","refreshUi","every","uiRefresh","isVisible","hide","show","style","display","AbstractButton","navbar","collapsable","tabbable","enabled","supported","collapsed","offsetWidth","icon","__setIcon","lang","title","tabIndex","onClick","checkSupported","supportedOrObject","isSupported","toggleActive","iconActive","refresh","disable","enable","collapse","uncollapse","innerHTML","querySelector","groupId","AutorotateButton","on","off","isAutorotateEnabled","autorotateIdle","resetIdleTimer","toggleAutorotate","play","playActive","CustomButton","random","substr","content","MODE_NOTIF","MODE_PANEL","DescriptionButton","closed","__close","caption","getButton","captionHidden","hasDescription","description","__open","notification","panel","info","DownloadButton","link","href","downloadUrl","download","pop","adapter","FullscreenButton","toggleFullscreen","fullscreenIn","fullscreenOut","MenuButton","__hideMenu","__showMenu","MENU_TEMPLATE","BUTTON_DATA","noMargin","clickHandler","li","buttonId","dataset","menuIcon","buttons","dataKey","menu","button","PressHandler","time","down","getTime","up","getOrientedArrow","arrow","AbstractMoveButton","move","handler","__stopAll","MoveDownButton","MoveLeftButton","MoveRightButton","MoveUpButton","AbstractZoomButton","zoom","ZoomInButton","zoomIn","ZoomOutButton","zoomOut","ZoomRangeButton","mediaMinWidth","zoomRange","zoomValue","slider","__onSliderUpdate","ready","__moveZoomValue","getZoomLevel","once","level","AbstractPlugin","init","DEFAULTS","plugins","loadingImg","loadingTxt","fisheye","minFov","maxFov","defaultZoomLvl","defaultLong","defaultLat","sphereCorrection","moveSpeed","zoomSpeed","autorotateDelay","autorotateSpeed","autorotateLat","moveInertia","mousewheel","mousemove","captureCursor","mousewheelCtrlKey","touchmoveTwoFingers","requestHeaders","canvasBackground","withCredentials","autorotate","fullscreen","twoFingers","ctrlZoom","loadError","keyboard","READONLY_OPTIONS","DEPRECATED_OPTIONS","zoomButtonIncrement","mousewheelSpeed","sphereCorrectionReorder","CONFIG_PARSERS","getConfig","tempConfig","hasOwnProperty","NavbarCaption","contentWidth","setCaption","html","availableWidth","__refreshButton","AVAILABLE_BUTTONS","AVAILABLE_GROUPS","registerButton","defaultPosition","unshift","Navbar","setButtons","item","cleanedButtons","__cleanButtons","buttonCtor","warnNotFound","totalWidth","visibleButtons","collapsableButtons","Loader","clientWidth","tickness","lastChild","inner","round","maxHeight","clearRect","lineWidth","strokeStyle","beginPath","arc","stroke","trigger","Notification","contentId","Overlay","dissmisable","image","text","subtext","preventDefault","PANEL_MIN_WIDTH","Panel","mouseX","mouseY","keyHandler","resizer","closeBtn","wasVisible","focus","__startResize","__resize","touches","clientX","clientY","AbstractService","vector2","Vector2","vector3","Vector3","eulerZero","Euler","DataHelper","fovToZoomLevel","fov","temp","zoomLevelToFov","vFovToHFov","vFov","radToDeg","atan","tan","aspect","speedToDuration","textureCoordsToSphericalCoords","point","relativeX","relativeY","equals","renderer","rotation","meshContainer","sphericalCoordsToVector3","applyEuler","vector3ToSphericalCoords","sphericalCoordsToTextureCoords","relativeLong","relativeLat","z","phi","theta","atan2","viewerCoordsToVector3","viewerPoint","sphereIntersect","getIntersections","userData","vector3ToViewerCoords","vectorClone","project","camera","sphericalCoordsToViewerCoords","raycaster","setFromCamera","intersectObjects","scene","cleanSphereCorrection","pan","tilt","cleanPanoramaPose","EventsHandler","state","moveThreshold","keyboardEnabled","zooming","startMouseX","startMouseY","mouseHistory","pinchDist","ctrlKeyDown","dblclickData","dblclickTimeout","longtouchTimeout","twofingersTimeout","ctrlZoomTimeout","__onResize","autoSize","__onKeyDown","__onKeyUp","__fullscreenToggled","__onMouseWheel","enableKeyboard","disableKeyboard","overlay","e2","isDefaultPrevented","action","__startMove","__stopMove","__move","__moveAbsolute","objectsObservers","viewerPos","intersections","dataHelper","emit","observer","listener","CustomEvent","originalEvent","intersection","find","__click","__cancelLongTouch","__cancelTwoFingersOverlay","__startMoveZoom","__stopMoveZoom","gestureIcon","__moveZoom","mousewheelIcon","delta","force","startKeyboardControl","stopKeyboardControl","__logMouseMove","__stopMoveInertia","norm","animationPromise","longtouch","boundingRect","rightclick","viewerX","viewerY","sphereIntersection","psvSphere","sphericalCoords","objects","o","textureCoords","textureX","textureY","NaN","hFov","currentPosition","rotate","containerRect","Renderer","WebGLRenderer","alpha","antialias","setPixelRatio","domElement","Scene","PerspectiveCamera","Group","Raycaster","canvasContainer","background","setAnimationLoop","__cleanTHREEScene","__onSizeUpdated","__onZoomUpdated","__onPositionUpdated","setSize","updateProjectionMatrix","set","lookAt","copy","multiplyScalar","negate","__renderLoop","idleTime","startAutorotate","render","setPanoramaPose","cleanCorrection","setSphereCorrection","positionProvided","zoomProvided","group","verticalAxis","rotateOnWorldAxis","horizontalAxis","cross","getWorldDirection","normalize","animation","completed","traverse","TextureLoader","FileLoader","setResponseType","setWithCredentials","setRequestHeader","abortLoading","url","lengthComputable","newProgress","total","createElementNS","URL","revokeObjectURL","createObjectURL","preloadPanorama","STATE","NONE","SHOWING","HIDING","Tooltip","__onTransitionEnd","rect","posClass","arrowTop","arrowLeft","__computeTooltipPosition","offset","newPos","propertyName","topBottom","box","TooltipRenderer","testTooltip","tooltip","Cache","Viewer","autorotateEnabled","loadingPromise","getElementById","eventsHandler","__updateSpeeds","__resizeRefresh","resize","opts","setPanorama","performance","reason","getPlugin","pluginId","pluginCtor","getSize","clientHeight","path","transitionAnimation","showLoader","hideError","done","showError","setOptions","rawConfig","setOption","option","disableIdleTimer","stopAutorotate","errorIcon","change","animate","animProperties","tOffset","dZoom","stopAnimation","dim","enterFullscreen","observeObjects","userDataKey"],"mappings":";;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA,SAASA,QAAT,CAAkBC,OAAlB,EAA2B;EACzB,OAAKA,OAAL,GAAeA,OAAf,CADyB;;EAIzB,MAAI,uBAAuBC,KAA3B,EAAkC;EAChCA,IAAAA,KAAK,CAACC,iBAAN,CAAwB,IAAxB,EAA8BH,QAA9B;EACD,GAFD,MAGK;EACH,SAAKI,KAAL,GAAc,IAAIF,KAAJ,EAAD,CAAcE,KAA3B;EACD;EACF;;EAEDJ,QAAQ,CAACK,SAAT,GAAqBC,MAAM,CAACC,MAAP,CAAcL,KAAK,CAACG,SAApB,CAArB;EACAL,QAAQ,CAACK,SAAT,CAAmBG,IAAnB,GAA0B,UAA1B;EACAR,QAAQ,CAACK,SAAT,CAAmBI,WAAnB,GAAiCT,QAAjC;;EClBA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;MACaU,eAAb;EAEE;EACF;EACA;EACA;EACA;EACA;;EAGE;EACF;EACA;EACA;EACA;EACA;;EAGE;EACF;EACA;EACE,2BAAYC,GAAZ,EAAiB;EACf;EACJ;EACA;EACA;EACA;EACI,SAAKA,GAAL,GAAWA,GAAX;EACD;EAED;EACF;EACA;;;EAhCA;;EAAA,SAiCEC,OAjCF,GAiCE,mBAAU;EACR,WAAO,KAAKD,GAAZ;EACD;EAED;EACF;EACA;EACA;EACA;EAzCA;;EAAA,SA0CEE,kBA1CF,GA0CE,4BAAmBC,QAAnB,EAA6B;EAAE;EAC7B,WAAO,KAAP;EACD;EAED;EACF;EACA;EACA;EACA;EAlDA;;EAAA,SAmDEC,eAnDF,GAmDE,yBAAgBD,QAAhB,EAA0B;EAAE;EAC1B,WA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ACA;EACA;EACEC,EAAAA,kBAAkB,EAAE,oBAzDA;;EA0DpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAG,mBAhEA;;EAiEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cAvEA;;EAwEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cA9EA;;EA+EpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,SAAS,EAAW,WArFA;;EAsFpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAO,eA5FA;;EA6FpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,UAAU,EAAU,YAnGA;;EAoGpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAK,iBA1GA;;EA2GpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,gBAAgB,EAAI,kBAjHA;;EAkHpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAe,OAvHA;;EAwHpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,MAAM,EAAc,QA7HA;;EA8HpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAG,mBApIA;;EAqIpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cA3IA;;EA4IpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cAnJA;;EAoJpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cA1JA;;EA2JpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,QAAQ,EAAY,UAhKA;;EAiKpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ;EAvKA,CAAf;EA0KP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,aAAa,GAAG;EAC3B;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,oBAAoB,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7BE9B,cAt7BF,GAs7BE,0BAAiB;EACf,SAAK/gB,QAAL,CAAcsM,IAAd,CAAmBrN,QAAnB,CAA4B,KAAKsD,MAAL,CAAY6L,SAAZ,GAAwB,EAApD;EACA,SAAKpO,QAAL,CAAcb,QAAd,CAAuBF,QAAvB,CAAgC9D,KAAK,CAACC,SAAN,CAAgBC,QAAhB,CAAyB,KAAKkH,MAAL,CAAY4L,SAAZ,GAAwB,EAAjD,CAAhC;EACD,GAz7BH;;EAAA;EAAA,EAA4B/L,mBAA5B;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/autorotate-keypoints.js b/dist/plugins/autorotate-keypoints.js index bd5bab295..388cb7eec 100644 --- a/dist/plugins/autorotate-keypoints.js +++ b/dist/plugins/autorotate-keypoints.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/compass.css b/dist/plugins/compass.css index ba8cd0902..682108bb7 100644 --- a/dist/plugins/compass.css +++ b/dist/plugins/compass.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.6.3 + * Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/compass.d.ts b/dist/plugins/compass.d.ts index cf8f3d08f..fc4eac862 100644 --- a/dist/plugins/compass.d.ts +++ b/dist/plugins/compass.d.ts @@ -22,6 +22,16 @@ declare class CompassPlugin extends AbstractPlugin { constructor(psv: Viewer, options: CompassPluginOptions); + /** + * @summary Hides the compass + */ + hide(); + + /** + * @summary Shows the compass + */ + show(); + /** * @summary Changes the hotspots on the compass */ diff --git a/dist/plugins/compass.js b/dist/plugins/compass.js index 20c09dbe6..6b992c1fb 100644 --- a/dist/plugins/compass.js +++ b/dist/plugins/compass.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -109,6 +109,7 @@ */ _this.prop = { + visible: true, mouse: null, mouseDown: false, markers: [] @@ -280,6 +281,24 @@ break; } } + /** + * @summary Hides the compass + */ + ; + + _proto.hide = function hide() { + this.container.style.display = 'none'; + this.prop.visible = false; + } + /** + * @summary Shows the compass + */ + ; + + _proto.show = function show() { + this.container.style.display = ''; + this.prop.visible = true; + } /** * @summary Changes the hotspots on the compass * @param {PSV.plugins.CompassPlugin.Hotspot[]} hotspots diff --git a/dist/plugins/compass.js.map b/dist/plugins/compass.js.map index 8c7057ec5..8cd926242 100644 --- a/dist/plugins/compass.js.map +++ b/dist/plugins/compass.js.map @@ -1 +1 @@ -{"version":3,"file":"compass.js","sources":["../../src/plugins/compass/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, SYSTEM, utils } from '../..';\nimport compass from './compass.svg';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.CompassPlugin.Options\n * @property {string} [size='120px'] - size of the compass\n * @property {string} [position='top left'] - position of the compass\n * @property {string} [backgroundSvg] - SVG used as background of the compass\n * @property {string} [coneColor='rgba(255, 255, 255, 0.5)'] - color of the cone of the compass\n * @property {boolean} [navigation=true] - allows to click on the compass to rotate the viewer\n * @property {string} [navigationColor='rgba(255, 0, 0, 0.2)'] - color of the navigation cone\n * @property {PSV.plugins.CompassPlugin.Hotspot[]} [hotspots] - small dots visible on the compass (will contain every marker with the \"compass\" data)\n * @property {string} [hotspotColor='rgba(0, 0, 0, 0.5)'] - default color of hotspots\n */\n\n/**\n * @typedef {PSV.ExtendedPosition} PSV.plugins.CompassPlugin.Hotspot\n * @type {string} [color] - override the global \"hotspotColor\"\n */\n\n\nconst HOTSPOT_SIZE_RATIO = 1 / 40;\n\n\n/**\n * @summary Adds a compass on the viewer\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class CompassPlugin extends AbstractPlugin {\n\n static id = 'compass';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.CompassPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.plugins.CompassPlugin.Options}\n * @private\n */\n this.config = {\n size : '120px',\n position : 'top left',\n backgroundSvg : compass,\n coneColor : 'rgba(255, 255, 255, 0.5)',\n navigation : true,\n navigationColor: 'rgba(255, 0, 0, 0.2)',\n hotspotColor : 'rgba(0, 0, 0, 0.5)',\n ...options,\n };\n this.config.position = utils.cleanPosition(this.config.position, 'top left');\n\n /**\n * @private\n */\n this.prop = {\n mouse : null,\n mouseDown: false,\n markers : [],\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.container = document.createElement('div');\n utils.addClasses(this.container, `psv-compass psv-compass--${this.config.position.join('-')}`);\n this.container.innerHTML = this.config.backgroundSvg;\n\n this.container.style.width = this.config.size;\n this.container.style.height = this.config.size;\n if (this.config.position[0] === 'center') {\n this.container.style.marginTop = `calc(-${this.config.size} / 2)`;\n }\n if (this.config.position[1] === 'center') {\n this.container.style.marginLeft = `calc(-${this.config.size} / 2)`;\n }\n\n /**\n * @member {HTMLCanvasElement}\n * @readonly\n * @private\n */\n this.canvas = document.createElement('canvas');\n\n this.container.appendChild(this.canvas);\n\n if (this.config.navigation) {\n this.container.addEventListener('mouseenter', this);\n this.container.addEventListener('mouseleave', this);\n this.container.addEventListener('mousemove', this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mouseup', this);\n this.container.addEventListener('touchstart', this);\n this.container.addEventListener('touchmove', this);\n this.container.addEventListener('touchend', this);\n }\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n\n this.psv.container.appendChild(this.container);\n\n this.canvas.width = this.container.clientWidth * SYSTEM.pixelRatio;\n this.canvas.height = this.container.clientWidth * SYSTEM.pixelRatio;\n\n this.psv.on(CONSTANTS.EVENTS.RENDER, this);\n\n if (this.markers) {\n this.markers.on('set-markers', this);\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.RENDER, this);\n\n if (this.markers) {\n this.markers.off('set-markers', this);\n }\n\n this.psv.container.removeChild(this.container);\n\n delete this.canvas;\n delete this.container;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.RENDER:\n this.__update();\n break;\n case 'set-markers':\n this.prop.markers = e.args[0].filter(m => m.data?.compass);\n this.__update();\n break;\n case 'mouseenter':\n case 'mousemove':\n case 'touchmove':\n this.prop.mouse = e.changedTouches?.[0] || e;\n if (this.prop.mouseDown) {\n this.__click();\n }\n else {\n this.__update();\n }\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mousedown':\n case 'touchstart':\n this.prop.mouseDown = true;\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mouseup':\n case 'touchend':\n this.prop.mouse = e.changedTouches?.[0] || e;\n this.prop.mouseDown = false;\n this.__click();\n if (e.changedTouches) {\n this.prop.mouse = null;\n this.__update();\n }\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mouseleave':\n this.prop.mouse = null;\n this.prop.mouseDown = false;\n this.__update();\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Changes the hotspots on the compass\n * @param {PSV.plugins.CompassPlugin.Hotspot[]} hotspots\n */\n setHotspots(hotspots) {\n this.config.hotspots = hotspots;\n this.__update();\n }\n\n /**\n * @summary Removes all hotspots\n */\n clearHotspots() {\n this.setHotspots(null);\n }\n\n /**\n * @summary Updates the compass for current zoom and position\n * @private\n */\n __update() {\n const context = this.canvas.getContext('2d');\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n const longitude = this.psv.getPosition().longitude;\n const fov = THREE.MathUtils.degToRad(this.psv.prop.hFov);\n\n this.__drawCone(context, this.config.coneColor, longitude, fov);\n\n const mouseAngle = this.__getMouseAngle();\n if (mouseAngle !== null) {\n this.__drawCone(context, this.config.navigationColor, mouseAngle, fov);\n }\n\n this.prop.markers.forEach((marker) => {\n this.__drawMarker(context, marker);\n });\n this.config.hotspots?.forEach((spot) => {\n if ('longitude' in spot && !('latitude' in spot)) {\n spot.latitude = 0;\n }\n const pos = this.psv.dataHelper.cleanPosition(spot);\n this.__drawPoint(context, spot.color || this.config.hotspotColor, pos.longitude, pos.latitude);\n });\n }\n\n /**\n * @summary Rotates the viewer depending on the position of the mouse on the compass\n * @private\n */\n __click() {\n const mouseAngle = this.__getMouseAngle();\n\n if (mouseAngle !== null) {\n this.psv.rotate({\n longitude: mouseAngle,\n latitude : 0,\n });\n }\n }\n\n /**\n * @summary Draw a cone\n * @param {CanvasRenderingContext2D} context\n * @param {string} color\n * @param {number} longitude - in viewer reference\n * @param {number} fov\n * @private\n */\n __drawCone(context, color, longitude, fov) {\n const a1 = longitude - Math.PI / 2 - fov / 2;\n const a2 = a1 + fov;\n const c = this.canvas.width / 2;\n\n context.beginPath();\n context.moveTo(c, c);\n context.lineTo(c + Math.cos(a1) * c, c + Math.sin(a1) * c);\n context.arc(c, c, c, a1, a2, false);\n context.lineTo(c, c);\n context.fillStyle = color;\n context.fill();\n }\n\n /**\n * @summary Draw a Marker\n * @param {CanvasRenderingContext2D} context\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @private\n */\n __drawMarker(context, marker) {\n let color = this.config.hotspotColor;\n if (typeof marker.data.compass === 'string') {\n color = marker.data.compass;\n }\n\n if (marker.isPoly()) {\n context.beginPath();\n marker.props.def.forEach(([longitude, latitude], i) => {\n const a = longitude - Math.PI / 2;\n const d = (latitude + Math.PI / 2) / Math.PI;\n const c = this.canvas.width / 2;\n\n context[i === 0 ? 'moveTo' : 'lineTo'](c + Math.cos(a) * c * d, c + Math.sin(a) * c * d);\n });\n if (marker.isPolygon()) {\n context.fillStyle = color;\n context.fill();\n }\n else {\n context.strokeStyle = color;\n context.lineWidth = Math.max(1, this.canvas.width * HOTSPOT_SIZE_RATIO / 2);\n context.stroke();\n }\n }\n else {\n const pos = marker.props.position;\n this.__drawPoint(context, color, pos.longitude, pos.latitude);\n }\n }\n\n /**\n * @summary Draw a point\n * @param {CanvasRenderingContext2D} context\n * @param {string} color\n * @param {number} longitude - in viewer reference\n * @param {number} latitude - in viewer reference\n * @private\n */\n __drawPoint(context, color, longitude, latitude) {\n const a = longitude - Math.PI / 2;\n const d = (latitude + Math.PI / 2) / Math.PI;\n const c = this.canvas.width / 2;\n const r = Math.max(2, this.canvas.width * HOTSPOT_SIZE_RATIO);\n\n context.beginPath();\n context.ellipse(\n c + Math.cos(a) * c * d, c + Math.sin(a) * c * d,\n r, r,\n 0, 0, Math.PI * 2\n );\n context.fillStyle = color;\n context.fill();\n }\n\n /**\n * @summary Gets the longitude corresponding to the mouse position on the compass\n * @return {number | null}\n * @private\n */\n __getMouseAngle() {\n if (!this.prop.mouse) {\n return null;\n }\n\n const boundingRect = this.container.getBoundingClientRect();\n const mouseX = this.prop.mouse.clientX - boundingRect.left - boundingRect.width / 2;\n const mouseY = this.prop.mouse.clientY - boundingRect.top - boundingRect.width / 2;\n\n if (Math.sqrt(mouseX * mouseX + mouseY * mouseY) > boundingRect.width / 2) {\n return null;\n }\n\n return Math.atan2(mouseY, mouseX) + Math.PI / 2;\n }\n\n}\n"],"names":["HOTSPOT_SIZE_RATIO","CompassPlugin","psv","options","config","size","position","backgroundSvg","compass","coneColor","navigation","navigationColor","hotspotColor","utils","cleanPosition","prop","mouse","mouseDown","markers","container","document","createElement","addClasses","join","innerHTML","style","width","height","marginTop","marginLeft","canvas","appendChild","addEventListener","init","getPlugin","clientWidth","SYSTEM","pixelRatio","on","CONSTANTS","EVENTS","RENDER","destroy","off","removeChild","handleEvent","e","type","__update","args","filter","m","data","changedTouches","__click","stopPropagation","preventDefault","setHotspots","hotspots","clearHotspots","context","getContext","clearRect","longitude","getPosition","fov","THREE","MathUtils","degToRad","hFov","__drawCone","mouseAngle","__getMouseAngle","forEach","marker","__drawMarker","spot","latitude","pos","dataHelper","__drawPoint","color","rotate","a1","Math","PI","a2","c","beginPath","moveTo","lineTo","cos","sin","arc","fillStyle","fill","isPoly","props","def","i","a","d","isPolygon","strokeStyle","lineWidth","max","stroke","r","ellipse","boundingRect","getBoundingClientRect","mouseX","clientX","left","mouseY","clientY","top","sqrt","atan2","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAGA,IAAMA,kBAAkB,GAAG,IAAI,EAA/B;EAGA;EACA;EACA;EACA;EACA;;MACaC,aAAb;EAAA;;EAIE;EACF;EACA;EACA;EACE,yBAAYC,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA;;EACxB,uCAAMD,GAAN;EAEA;EACJ;EACA;EACA;;EACI,UAAKE,MAAL;EACEC,MAAAA,IAAI,EAAa,OADnB;EAEEC,MAAAA,QAAQ,EAAS,UAFnB;EAGEC,MAAAA,aAAa,EAAIC,OAHnB;EAIEC,MAAAA,SAAS,EAAQ,0BAJnB;EAKEC,MAAAA,UAAU,EAAO,IALnB;EAMEC,MAAAA,eAAe,EAAE,sBANnB;EAOEC,MAAAA,YAAY,EAAK;EAPnB,OAQKT,OARL;EAUA,UAAKC,MAAL,CAAYE,QAAZ,GAAuBO,uBAAK,CAACC,aAAN,CAAoB,MAAKV,MAAL,CAAYE,QAAhC,EAA0C,UAA1C,CAAvB;EAEA;EACJ;EACA;;EACI,UAAKS,IAAL,GAAY;EACVC,MAAAA,KAAK,EAAM,IADD;EAEVC,MAAAA,SAAS,EAAE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MAAM,GAAGA,MAArC,IAA+CL,YAAY,CAACnF,KAAb,GAAqB,CAAxE,EAA2E;EACzE,aAAO,IAAP;EACD;;EAED,WAAO0D,IAAI,CAACkC,KAAL,CAAWJ,MAAX,EAAmBH,MAAnB,IAA6B3B,IAAI,CAACC,EAAL,GAAU,CAA9C;EACD,GA/UH;;EAAA;EAAA,EAAmCkC,gCAAnC;EAAatH,cAEJuH,KAAK;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"compass.js","sources":["../../src/plugins/compass/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, SYSTEM, utils } from '../..';\nimport compass from './compass.svg';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.CompassPlugin.Options\n * @property {string} [size='120px'] - size of the compass\n * @property {string} [position='top left'] - position of the compass\n * @property {string} [backgroundSvg] - SVG used as background of the compass\n * @property {string} [coneColor='rgba(255, 255, 255, 0.5)'] - color of the cone of the compass\n * @property {boolean} [navigation=true] - allows to click on the compass to rotate the viewer\n * @property {string} [navigationColor='rgba(255, 0, 0, 0.2)'] - color of the navigation cone\n * @property {PSV.plugins.CompassPlugin.Hotspot[]} [hotspots] - small dots visible on the compass (will contain every marker with the \"compass\" data)\n * @property {string} [hotspotColor='rgba(0, 0, 0, 0.5)'] - default color of hotspots\n */\n\n/**\n * @typedef {PSV.ExtendedPosition} PSV.plugins.CompassPlugin.Hotspot\n * @type {string} [color] - override the global \"hotspotColor\"\n */\n\n\nconst HOTSPOT_SIZE_RATIO = 1 / 40;\n\n\n/**\n * @summary Adds a compass on the viewer\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class CompassPlugin extends AbstractPlugin {\n\n static id = 'compass';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.CompassPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.plugins.CompassPlugin.Options}\n * @private\n */\n this.config = {\n size : '120px',\n position : 'top left',\n backgroundSvg : compass,\n coneColor : 'rgba(255, 255, 255, 0.5)',\n navigation : true,\n navigationColor: 'rgba(255, 0, 0, 0.2)',\n hotspotColor : 'rgba(0, 0, 0, 0.5)',\n ...options,\n };\n this.config.position = utils.cleanPosition(this.config.position, 'top left');\n\n /**\n * @private\n */\n this.prop = {\n visible : true,\n mouse : null,\n mouseDown: false,\n markers : [],\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.container = document.createElement('div');\n utils.addClasses(this.container, `psv-compass psv-compass--${this.config.position.join('-')}`);\n this.container.innerHTML = this.config.backgroundSvg;\n\n this.container.style.width = this.config.size;\n this.container.style.height = this.config.size;\n if (this.config.position[0] === 'center') {\n this.container.style.marginTop = `calc(-${this.config.size} / 2)`;\n }\n if (this.config.position[1] === 'center') {\n this.container.style.marginLeft = `calc(-${this.config.size} / 2)`;\n }\n\n /**\n * @member {HTMLCanvasElement}\n * @readonly\n * @private\n */\n this.canvas = document.createElement('canvas');\n\n this.container.appendChild(this.canvas);\n\n if (this.config.navigation) {\n this.container.addEventListener('mouseenter', this);\n this.container.addEventListener('mouseleave', this);\n this.container.addEventListener('mousemove', this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mouseup', this);\n this.container.addEventListener('touchstart', this);\n this.container.addEventListener('touchmove', this);\n this.container.addEventListener('touchend', this);\n }\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n\n this.psv.container.appendChild(this.container);\n\n this.canvas.width = this.container.clientWidth * SYSTEM.pixelRatio;\n this.canvas.height = this.container.clientWidth * SYSTEM.pixelRatio;\n\n this.psv.on(CONSTANTS.EVENTS.RENDER, this);\n\n if (this.markers) {\n this.markers.on('set-markers', this);\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.RENDER, this);\n\n if (this.markers) {\n this.markers.off('set-markers', this);\n }\n\n this.psv.container.removeChild(this.container);\n\n delete this.canvas;\n delete this.container;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.RENDER:\n this.__update();\n break;\n case 'set-markers':\n this.prop.markers = e.args[0].filter(m => m.data?.compass);\n this.__update();\n break;\n case 'mouseenter':\n case 'mousemove':\n case 'touchmove':\n this.prop.mouse = e.changedTouches?.[0] || e;\n if (this.prop.mouseDown) {\n this.__click();\n }\n else {\n this.__update();\n }\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mousedown':\n case 'touchstart':\n this.prop.mouseDown = true;\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mouseup':\n case 'touchend':\n this.prop.mouse = e.changedTouches?.[0] || e;\n this.prop.mouseDown = false;\n this.__click();\n if (e.changedTouches) {\n this.prop.mouse = null;\n this.__update();\n }\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mouseleave':\n this.prop.mouse = null;\n this.prop.mouseDown = false;\n this.__update();\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Hides the compass\n */\n hide() {\n this.container.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @summary Shows the compass\n */\n show() {\n this.container.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @summary Changes the hotspots on the compass\n * @param {PSV.plugins.CompassPlugin.Hotspot[]} hotspots\n */\n setHotspots(hotspots) {\n this.config.hotspots = hotspots;\n this.__update();\n }\n\n /**\n * @summary Removes all hotspots\n */\n clearHotspots() {\n this.setHotspots(null);\n }\n\n /**\n * @summary Updates the compass for current zoom and position\n * @private\n */\n __update() {\n const context = this.canvas.getContext('2d');\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n const longitude = this.psv.getPosition().longitude;\n const fov = THREE.MathUtils.degToRad(this.psv.prop.hFov);\n\n this.__drawCone(context, this.config.coneColor, longitude, fov);\n\n const mouseAngle = this.__getMouseAngle();\n if (mouseAngle !== null) {\n this.__drawCone(context, this.config.navigationColor, mouseAngle, fov);\n }\n\n this.prop.markers.forEach((marker) => {\n this.__drawMarker(context, marker);\n });\n this.config.hotspots?.forEach((spot) => {\n if ('longitude' in spot && !('latitude' in spot)) {\n spot.latitude = 0;\n }\n const pos = this.psv.dataHelper.cleanPosition(spot);\n this.__drawPoint(context, spot.color || this.config.hotspotColor, pos.longitude, pos.latitude);\n });\n }\n\n /**\n * @summary Rotates the viewer depending on the position of the mouse on the compass\n * @private\n */\n __click() {\n const mouseAngle = this.__getMouseAngle();\n\n if (mouseAngle !== null) {\n this.psv.rotate({\n longitude: mouseAngle,\n latitude : 0,\n });\n }\n }\n\n /**\n * @summary Draw a cone\n * @param {CanvasRenderingContext2D} context\n * @param {string} color\n * @param {number} longitude - in viewer reference\n * @param {number} fov\n * @private\n */\n __drawCone(context, color, longitude, fov) {\n const a1 = longitude - Math.PI / 2 - fov / 2;\n const a2 = a1 + fov;\n const c = this.canvas.width / 2;\n\n context.beginPath();\n context.moveTo(c, c);\n context.lineTo(c + Math.cos(a1) * c, c + Math.sin(a1) * c);\n context.arc(c, c, c, a1, a2, false);\n context.lineTo(c, c);\n context.fillStyle = color;\n context.fill();\n }\n\n /**\n * @summary Draw a Marker\n * @param {CanvasRenderingContext2D} context\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @private\n */\n __drawMarker(context, marker) {\n let color = this.config.hotspotColor;\n if (typeof marker.data.compass === 'string') {\n color = marker.data.compass;\n }\n\n if (marker.isPoly()) {\n context.beginPath();\n marker.props.def.forEach(([longitude, latitude], i) => {\n const a = longitude - Math.PI / 2;\n const d = (latitude + Math.PI / 2) / Math.PI;\n const c = this.canvas.width / 2;\n\n context[i === 0 ? 'moveTo' : 'lineTo'](c + Math.cos(a) * c * d, c + Math.sin(a) * c * d);\n });\n if (marker.isPolygon()) {\n context.fillStyle = color;\n context.fill();\n }\n else {\n context.strokeStyle = color;\n context.lineWidth = Math.max(1, this.canvas.width * HOTSPOT_SIZE_RATIO / 2);\n context.stroke();\n }\n }\n else {\n const pos = marker.props.position;\n this.__drawPoint(context, color, pos.longitude, pos.latitude);\n }\n }\n\n /**\n * @summary Draw a point\n * @param {CanvasRenderingContext2D} context\n * @param {string} color\n * @param {number} longitude - in viewer reference\n * @param {number} latitude - in viewer reference\n * @private\n */\n __drawPoint(context, color, longitude, latitude) {\n const a = longitude - Math.PI / 2;\n const d = (latitude + Math.PI / 2) / Math.PI;\n const c = this.canvas.width / 2;\n const r = Math.max(2, this.canvas.width * HOTSPOT_SIZE_RATIO);\n\n context.beginPath();\n context.ellipse(\n c + Math.cos(a) * c * d, c + Math.sin(a) * c * d,\n r, r,\n 0, 0, Math.PI * 2\n );\n context.fillStyle = color;\n context.fill();\n }\n\n /**\n * @summary Gets the longitude corresponding to the mouse position on the compass\n * @return {number | null}\n * @private\n */\n __getMouseAngle() {\n if (!this.prop.mouse) {\n return null;\n }\n\n const boundingRect = this.container.getBoundingClientRect();\n const mouseX = this.prop.mouse.clientX - boundingRect.left - boundingRect.width / 2;\n const mouseY = this.prop.mouse.clientY - boundingRect.top - boundingRect.width / 2;\n\n if (Math.sqrt(mouseX * mouseX + mouseY * mouseY) > boundingRect.width / 2) {\n return null;\n }\n\n return Math.atan2(mouseY, mouseX) + Math.PI / 2;\n }\n\n}\n"],"names":["HOTSPOT_SIZE_RATIO","CompassPlugin","psv","options","config","size","position","backgroundSvg","compass","coneColor","navigation","navigationColor","hotspotColor","utils","cleanPosition","prop","visible","mouse","mouseDown","markers","container","document","createElement","addClasses","join","innerHTML","style","width","height","marginTop","marginLeft","canvas","appendChild","addEventListener","init","getPlugin","clientWidth","SYSTEM","pixelRatio","on","CONSTANTS","EVENTS","RENDER","destroy","off","removeChild","handleEvent","e","type","__update","args","filter","m","data","changedTouches","__click","stopPropagation","preventDefault","hide","display","show","setHotspots","hotspots","clearHotspots","context","getContext","clearRect","longitude","getPosition","fov","THREE","MathUtils","degToRad","hFov","__drawCone","mouseAngle","__getMouseAngle","forEach","marker","__drawMarker","spot","latitude","pos","dataHelper","__drawPoint","color","rotate","a1","Math","PI","a2","c","beginPath","moveTo","lineTo","cos","sin","arc","fillStyle","fill","isPoly","props","def","i","a","d","isPolygon","strokeStyle","lineWidth","max","stroke","r","ellipse","boundingRect","getBoundingClientRect","mouseX","clientX","left","mouseY","clientY","top","sqrt","atan2","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAGA,IAAMA,kBAAkB,GAAG,IAAI,EAA/B;EAGA;EACA;EACA;EACA;EACA;;MACaC,aAAb;EAAA;;EAIE;EACF;EACA;EACA;EACE,yBAAYC,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA;;EACxB,uCAAMD,GAAN;EAEA;EACJ;EACA;EACA;;EACI,UAAKE,MAAL;EACEC,MAAAA,IAAI,EAAa,OADnB;EAEEC,MAAAA,QAAQ,EAAS,UAFnB;EAGEC,MAAAA,aAAa,EAAIC,OAHnB;EAIEC,MAAAA,SAAS,EAAQ,0BAJnB;EAKEC,MAAAA,UAAU,EAAO,IALnB;EAMEC,MAAAA,eAAe,EAAE,sBANnB;EAOEC,MAAAA,YAAY,EAAK;EAPnB,OAQKT,OARL;EAUA,UAAKC,MAAL,CAAYE,QAAZ,GAAuBO,uBAAK,CAACC,aAAN,CAAoB,MAAKV,MAAL,CAAYE,QAAhC,EAA0C,UAA1C,CAAvB;EAEA;EACJ;EACA;;EACI,UAAKS,IAAL,GAAY;EACVC,MAAAA,OAAO,EAAI,IADD;EAEVC,MAAAA,KAAK,EAAM,IAFD;EAGVC,MAAAA,SAAS,EAAE,KAHD;EAIVC,MAAAA,OAAO,EAAI;EAJD,KAAZ;EAOA;EACJ;EACA;EACA;;EACI,UAAKA,OAAL,GAAe,IAAf;EAEA;EACJ;EACA;EACA;EACA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B,CAAlF;EACA,QAAM2F,MAAM,GAAG,KAAKvG,IAAL,CAAUE,KAAV,CAAgBsG,OAAhB,GAA0BN,YAAY,CAACO,GAAvC,GAA6CP,YAAY,CAACtF,KAAb,GAAqB,CAAjF;;EAEA,QAAI6D,IAAI,CAACiC,IAAL,CAAUN,MAAM,GAAGA,MAAT,GAAkBG,MAAM,GAAGA,MAArC,IAA+CL,YAAY,CAACtF,KAAb,GAAqB,CAAxE,EAA2E;EACzE,aAAO,IAAP;EACD;;EAED,WAAO6D,IAAI,CAACkC,KAAL,CAAWJ,MAAX,EAAmBH,MAAnB,IAA6B3B,IAAI,CAACC,EAAL,GAAU,CAA9C;EACD,GAhWH;;EAAA;EAAA,EAAmCkC,gCAAnC;EAAa1H,cAEJ2H,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/gyroscope.d.ts b/dist/plugins/gyroscope.d.ts index 877450ef2..f46dc1ed6 100644 --- a/dist/plugins/gyroscope.d.ts +++ b/dist/plugins/gyroscope.d.ts @@ -4,6 +4,7 @@ import { Event } from 'uevent'; type GyroscopePluginOptions = { touchmove?: boolean; absolutePosition?: boolean; + moveMode?:'smooth' | 'fast' }; declare const EVENTS: { diff --git a/dist/plugins/gyroscope.js b/dist/plugins/gyroscope.js index b14bb2a24..f29d5a291 100644 --- a/dist/plugins/gyroscope.js +++ b/dist/plugins/gyroscope.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -263,6 +263,7 @@ * @typedef {Object} PSV.plugins.GyroscopePlugin.Options * @property {boolean} [touchmove=true] - allows to pan horizontally when the gyroscope is enabled (requires global `mousemove=true`) * @property {boolean} [absolutePosition=false] - when true the view will ignore the current direction when enabling gyroscope control + * @property {'smooth' | 'fast'} [moveMode='smooth'] - How the gyroscope data is used to rotate the panorama. */ // add gyroscope button @@ -308,7 +309,8 @@ _this.config = _extends({ touchmove: true, - absolutePosition: false + absolutePosition: false, + moveMode: 'smooth' }, options); /** * @member {DeviceOrientationControls} @@ -437,6 +439,7 @@ this.prop.enabled = false; this.psv.config.moveInertia = this.prop.config_moveInertia; this.trigger(EVENTS.GYROSCOPE_UPDATED, false); + this.psv.resetIdleTimer(); } } /** @@ -485,7 +488,8 @@ latitude: -_sphericalCoords.latitude }; // having a slow speed on smalls movements allows to absorb the device/hand vibrations - this.psv.dynamics.position.goto(target, photoSphereViewer.utils.getAngle(position, target) < 0.01 ? 1 : 3); + var step = this.config.moveMode === 'smooth' ? 3 : 10; + this.psv.dynamics.position.goto(target, photoSphereViewer.utils.getAngle(position, target) < 0.01 ? 1 : step); } } /** diff --git a/dist/plugins/gyroscope.js.map b/dist/plugins/gyroscope.js.map index ec8e2291d..e4e8552c3 100644 --- a/dist/plugins/gyroscope.js.map +++ b/dist/plugins/gyroscope.js.map @@ -1 +1 @@ -{"version":3,"file":"gyroscope.js","sources":["../../src/plugins/gyroscope/constants.js","../../src/plugins/gyroscope/DeviceOrientationControls.js","../../src/plugins/gyroscope/GyroscopeButton.js","../../src/plugins/gyroscope/index.js"],"sourcesContent":["/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.GyroscopePlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event gyroscope-updated\n * @memberof PSV.plugins.GyroscopePlugin\n * @summary Triggered when the gyroscope mode is enabled/disabled\n * @param {boolean} enabled\n */\n GYROSCOPE_UPDATED: 'gyroscope-updated',\n};\n","import {\n Euler,\n MathUtils,\n Quaternion,\n Vector3\n} from 'three';\n\nconst _zee = new Vector3( 0, 0, 1 );\nconst _euler = new Euler();\nconst _q0 = new Quaternion();\nconst _q1 = new Quaternion( - Math.sqrt( 0.5 ), 0, 0, Math.sqrt( 0.5 ) ); // - PI/2 around the x-axis\n\n/**\n * Copied from three.js examples before deletion in r134\n * (deleted because of constructors/OS inconsistencies)\n * @private\n */\nclass DeviceOrientationControls {\n\n constructor( object ) {\n\n if ( window.isSecureContext === false ) {\n\n console.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );\n\n }\n\n const scope = this;\n\n const EPS = 0.000001;\n const lastQuaternion = new Quaternion();\n\n this.object = object;\n this.object.rotation.reorder( 'YXZ' );\n\n this.enabled = true;\n\n this.deviceOrientation = {};\n this.screenOrientation = 0;\n\n this.alphaOffset = 0; // radians\n\n const onDeviceOrientationChangeEvent = function ( event ) {\n\n scope.deviceOrientation = event;\n\n };\n\n const onScreenOrientationChangeEvent = function () {\n\n scope.screenOrientation = window.orientation || 0;\n\n };\n\n // The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''\n\n const setObjectQuaternion = function ( quaternion, alpha, beta, gamma, orient ) {\n\n _euler.set( beta, alpha, - gamma, 'YXZ' ); // 'ZXY' for the device, but 'YXZ' for us\n\n quaternion.setFromEuler( _euler ); // orient the device\n\n quaternion.multiply( _q1 ); // camera looks out the back of the device, not the top\n\n quaternion.multiply( _q0.setFromAxisAngle( _zee, - orient ) ); // adjust for screen orientation\n\n };\n\n this.connect = function () {\n\n onScreenOrientationChangeEvent(); // run once on load\n\n // iOS 13+\n\n if ( window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function' ) {\n\n window.DeviceOrientationEvent.requestPermission().then( function ( response ) {\n\n if ( response == 'granted' ) {\n\n window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n }\n\n } ).catch( function ( error ) {\n\n console.error( 'THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error );\n\n } );\n\n } else {\n\n window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n }\n\n scope.enabled = true;\n\n };\n\n this.disconnect = function () {\n\n window.removeEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.removeEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n scope.enabled = false;\n\n };\n\n this.update = function () {\n\n if ( scope.enabled === false ) return;\n\n const device = scope.deviceOrientation;\n\n if ( device ) {\n\n const alpha = device.alpha ? MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z\n\n const beta = device.beta ? MathUtils.degToRad( device.beta ) : 0; // X'\n\n const gamma = device.gamma ? MathUtils.degToRad( device.gamma ) : 0; // Y''\n\n const orient = scope.screenOrientation ? MathUtils.degToRad( scope.screenOrientation ) : 0; // O\n\n setObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );\n\n if ( 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n lastQuaternion.copy( scope.object.quaternion );\n\n }\n\n }\n\n };\n\n this.dispose = function () {\n\n scope.disconnect();\n\n };\n\n this.connect();\n\n }\n\n}\n\nexport { DeviceOrientationControls };\n","import { AbstractButton } from '../..';\nimport compass from './compass.svg';\nimport { EVENTS } from './constants';\n\n/**\n * @summary Navigation bar gyroscope button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class GyroscopeButton extends AbstractButton {\n\n static id = 'gyroscope';\n static icon = compass;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-gyroscope-button', true);\n\n /**\n * @type {PSV.plugins.GyroscopePlugin}\n * @readonly\n * @private\n */\n this.plugin = this.psv.getPlugin('gyroscope');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.GYROSCOPE_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.GYROSCOPE_UPDATED, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !this.plugin ? false : { initial: false, promise: this.plugin.prop.isSupported };\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === EVENTS.GYROSCOPE_UPDATED) {\n this.toggleActive(e.args[0]);\n }\n }\n\n /**\n * @override\n * @description Toggles gyroscope control\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, registerButton, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { DeviceOrientationControls } from './DeviceOrientationControls';\nimport { GyroscopeButton } from './GyroscopeButton';\n\n\n/**\n * @typedef {Object} PSV.plugins.GyroscopePlugin.Options\n * @property {boolean} [touchmove=true] - allows to pan horizontally when the gyroscope is enabled (requires global `mousemove=true`)\n * @property {boolean} [absolutePosition=false] - when true the view will ignore the current direction when enabling gyroscope control\n */\n\n\n// add gyroscope button\nDEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope';\nregisterButton(GyroscopeButton, 'caption:right');\n\n\nexport { EVENTS } from './constants';\n\n\nconst direction = new THREE.Vector3();\n\n\n/**\n * @summary Adds gyroscope controls on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class GyroscopePlugin extends AbstractPlugin {\n\n static id = 'gyroscope';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.GyroscopePlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @private\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {number} alphaOffset - current alpha offset for gyroscope controls\n * @property {boolean} enabled\n * @property {boolean} config_moveInertia - original config \"moveInertia\"\n */\n this.prop = {\n isSupported : this.__checkSupport(),\n alphaOffset : 0,\n enabled : false,\n config_moveInertia: true,\n };\n\n /**\n * @member {PSV.plugins.GyroscopePlugin.Options}\n * @private\n */\n this.config = {\n touchmove : true,\n absolutePosition: false,\n ...options,\n };\n\n /**\n * @member {DeviceOrientationControls}\n * @private\n */\n this.controls = null;\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_ROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_ROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.stop();\n\n delete this.controls;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.STOP_ALL:\n this.stop();\n break;\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n this.__onBeforeRender();\n break;\n case CONSTANTS.EVENTS.BEFORE_ROTATE:\n this.__onBeforeRotate(e);\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Checks if the gyroscope is enabled\n * @returns {boolean}\n */\n isEnabled() {\n return this.prop.enabled;\n }\n\n /**\n * @summary Enables the gyroscope navigation if available\n * @returns {Promise}\n * @fires PSV.plugins.GyroscopePlugin.gyroscope-updated\n * @throws {PSV.PSVError} if the gyroscope API is not available/granted\n */\n start() {\n return this.prop.isSupported\n .then((supported) => {\n if (supported) {\n return this.__requestPermission();\n }\n else {\n utils.logWarn('gyroscope not available');\n return Promise.reject();\n }\n })\n .then((granted) => {\n if (granted) {\n return Promise.resolve();\n }\n else {\n utils.logWarn('gyroscope not allowed');\n return Promise.reject();\n }\n })\n .then(() => {\n this.psv.__stopAll();\n\n // disable inertia\n this.prop.config_moveInertia = this.psv.config.moveInertia;\n this.psv.config.moveInertia = false;\n\n // enable gyro controls\n if (!this.controls) {\n this.controls = new DeviceOrientationControls(new THREE.Object3D());\n }\n else {\n this.controls.connect();\n }\n\n // force reset\n this.controls.deviceOrientation = null;\n this.controls.screenOrientation = 0;\n this.controls.alphaOffset = 0;\n\n this.prop.alphaOffset = this.config.absolutePosition ? 0 : null;\n this.prop.enabled = true;\n\n this.trigger(EVENTS.GYROSCOPE_UPDATED, true);\n });\n }\n\n /**\n * @summary Disables the gyroscope navigation\n * @fires PSV.plugins.GyroscopePlugin.gyroscope-updated\n */\n stop() {\n if (this.isEnabled()) {\n this.controls.disconnect();\n\n this.prop.enabled = false;\n this.psv.config.moveInertia = this.prop.config_moveInertia;\n\n this.trigger(EVENTS.GYROSCOPE_UPDATED, false);\n }\n }\n\n /**\n * @summary Enables or disables the gyroscope navigation\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Handles gyro movements\n * @private\n */\n __onBeforeRender() {\n if (!this.isEnabled()) {\n return;\n }\n\n if (!this.controls.deviceOrientation) {\n return;\n }\n\n const position = this.psv.getPosition();\n\n // on first run compute the offset depending on the current viewer position and device orientation\n if (this.prop.alphaOffset === null) {\n this.controls.update();\n this.controls.object.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n this.prop.alphaOffset = sphericalCoords.longitude - position.longitude;\n }\n else {\n this.controls.alphaOffset = this.prop.alphaOffset;\n this.controls.update();\n this.controls.object.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n\n const target = {\n longitude: sphericalCoords.longitude,\n latitude : -sphericalCoords.latitude,\n };\n\n // having a slow speed on smalls movements allows to absorb the device/hand vibrations\n this.psv.dynamics.position.goto(target, utils.getAngle(position, target) < 0.01 ? 1 : 3);\n }\n }\n\n /**\n * @summary Intercepts moves and offsets the alpha angle\n * @param {external:uEvent.Event} e\n * @private\n */\n __onBeforeRotate(e) {\n if (this.isEnabled()) {\n e.preventDefault();\n\n if (this.config.touchmove) {\n this.prop.alphaOffset -= e.args[0].longitude - this.psv.getPosition().longitude;\n }\n }\n }\n\n /**\n * @summary Detects if device orientation is supported\n * @returns {Promise}\n * @private\n */\n __checkSupport() {\n if ('DeviceMotionEvent' in window && typeof DeviceMotionEvent.requestPermission === 'function') {\n return Promise.resolve(true);\n }\n else if ('DeviceOrientationEvent' in window) {\n return new Promise((resolve) => {\n const listener = (e) => {\n resolve(e && e.alpha !== null && !isNaN(e.alpha));\n\n window.removeEventListener('deviceorientation', listener);\n };\n\n window.addEventListener('deviceorientation', listener, false);\n setTimeout(listener, 10000);\n });\n }\n else {\n return Promise.resolve(false);\n }\n }\n\n /**\n * @summary Request permission to the motion API\n * @returns {Promise}\n * @private\n */\n __requestPermission() {\n if ('DeviceMotionEvent' in window && typeof DeviceMotionEvent.requestPermission === 'function') {\n return DeviceOrientationEvent.requestPermission()\n .then(response => response === 'granted')\n .catch(() => false);\n }\n else {\n return Promise.resolve(true);\n }\n }\n\n}\n"],"names":["EVENTS","GYROSCOPE_UPDATED","_zee","Vector3","_euler","Euler","_q0","Quaternion","_q1","Math","sqrt","DeviceOrientationControls","object","window","isSecureContext","console","error","scope","EPS","lastQuaternion","rotation","reorder","enabled","deviceOrientation","screenOrientation","alphaOffset","onDeviceOrientationChangeEvent","event","onScreenOrientationChangeEvent","orientation","setObjectQuaternion","quaternion","alpha","beta","gamma","orient","set","setFromEuler","multiply","setFromAxisAngle","connect","DeviceOrientationEvent","undefined","requestPermission","then","response","addEventListener","catch","disconnect","removeEventListener","update","device","MathUtils","degToRad","dot","copy","dispose","GyroscopeButton","navbar","plugin","psv","getPlugin","on","destroy","off","isSupported","initial","promise","prop","handleEvent","e","type","toggleActive","args","onClick","toggle","AbstractButton","id","icon","compass","DEFAULTS","lang","registerButton","direction","THREE","GyroscopePlugin","options","__checkSupport","config_moveInertia","config","touchmove","absolutePosition","controls","init","CONSTANTS","STOP_ALL","BEFORE_ROTATE","BEFORE_RENDER","stop","__onBeforeRender","__onBeforeRotate","isEnabled","start","supported","__requestPermission","utils","logWarn","Promise","reject","granted","resolve","__stopAll","moveInertia","Object3D","trigger","position","getPosition","getWorldDirection","sphericalCoords","dataHelper","vector3ToSphericalCoords","longitude","target","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ope.js","sources":["../../src/plugins/gyroscope/constants.js","../../src/plugins/gyroscope/DeviceOrientationControls.js","../../src/plugins/gyroscope/GyroscopeButton.js","../../src/plugins/gyroscope/index.js"],"sourcesContent":["/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.GyroscopePlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event gyroscope-updated\n * @memberof PSV.plugins.GyroscopePlugin\n * @summary Triggered when the gyroscope mode is enabled/disabled\n * @param {boolean} enabled\n */\n GYROSCOPE_UPDATED: 'gyroscope-updated',\n};\n","import {\n Euler,\n MathUtils,\n Quaternion,\n Vector3\n} from 'three';\n\nconst _zee = new Vector3( 0, 0, 1 );\nconst _euler = new Euler();\nconst _q0 = new Quaternion();\nconst _q1 = new Quaternion( - Math.sqrt( 0.5 ), 0, 0, Math.sqrt( 0.5 ) ); // - PI/2 around the x-axis\n\n/**\n * Copied from three.js examples before deletion in r134\n * (deleted because of constructors/OS inconsistencies)\n * @private\n */\nclass DeviceOrientationControls {\n\n constructor( object ) {\n\n if ( window.isSecureContext === false ) {\n\n console.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );\n\n }\n\n const scope = this;\n\n const EPS = 0.000001;\n const lastQuaternion = new Quaternion();\n\n this.object = object;\n this.object.rotation.reorder( 'YXZ' );\n\n this.enabled = true;\n\n this.deviceOrientation = {};\n this.screenOrientation = 0;\n\n this.alphaOffset = 0; // radians\n\n const onDeviceOrientationChangeEvent = function ( event ) {\n\n scope.deviceOrientation = event;\n\n };\n\n const onScreenOrientationChangeEvent = function () {\n\n scope.screenOrientation = window.orientation || 0;\n\n };\n\n // The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''\n\n const setObjectQuaternion = function ( quaternion, alpha, beta, gamma, orient ) {\n\n _euler.set( beta, alpha, - gamma, 'YXZ' ); // 'ZXY' for the device, but 'YXZ' for us\n\n quaternion.setFromEuler( _euler ); // orient the device\n\n quaternion.multiply( _q1 ); // camera looks out the back of the device, not the top\n\n quaternion.multiply( _q0.setFromAxisAngle( _zee, - orient ) ); // adjust for screen orientation\n\n };\n\n this.connect = function () {\n\n onScreenOrientationChangeEvent(); // run once on load\n\n // iOS 13+\n\n if ( window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function' ) {\n\n window.DeviceOrientationEvent.requestPermission().then( function ( response ) {\n\n if ( response == 'granted' ) {\n\n window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n }\n\n } ).catch( function ( error ) {\n\n console.error( 'THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error );\n\n } );\n\n } else {\n\n window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n }\n\n scope.enabled = true;\n\n };\n\n this.disconnect = function () {\n\n window.removeEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.removeEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n scope.enabled = false;\n\n };\n\n this.update = function () {\n\n if ( scope.enabled === false ) return;\n\n const device = scope.deviceOrientation;\n\n if ( device ) {\n\n const alpha = device.alpha ? MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z\n\n const beta = device.beta ? MathUtils.degToRad( device.beta ) : 0; // X'\n\n const gamma = device.gamma ? MathUtils.degToRad( device.gamma ) : 0; // Y''\n\n const orient = scope.screenOrientation ? MathUtils.degToRad( scope.screenOrientation ) : 0; // O\n\n setObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );\n\n if ( 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n lastQuaternion.copy( scope.object.quaternion );\n\n }\n\n }\n\n };\n\n this.dispose = function () {\n\n scope.disconnect();\n\n };\n\n this.connect();\n\n }\n\n}\n\nexport { DeviceOrientationControls };\n","import { AbstractButton } from '../..';\nimport compass from './compass.svg';\nimport { EVENTS } from './constants';\n\n/**\n * @summary Navigation bar gyroscope button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class GyroscopeButton extends AbstractButton {\n\n static id = 'gyroscope';\n static icon = compass;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-gyroscope-button', true);\n\n /**\n * @type {PSV.plugins.GyroscopePlugin}\n * @readonly\n * @private\n */\n this.plugin = this.psv.getPlugin('gyroscope');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.GYROSCOPE_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.GYROSCOPE_UPDATED, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !this.plugin ? false : { initial: false, promise: this.plugin.prop.isSupported };\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === EVENTS.GYROSCOPE_UPDATED) {\n this.toggleActive(e.args[0]);\n }\n }\n\n /**\n * @override\n * @description Toggles gyroscope control\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, registerButton, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { DeviceOrientationControls } from './DeviceOrientationControls';\nimport { GyroscopeButton } from './GyroscopeButton';\n\n\n/**\n * @typedef {Object} PSV.plugins.GyroscopePlugin.Options\n * @property {boolean} [touchmove=true] - allows to pan horizontally when the gyroscope is enabled (requires global `mousemove=true`)\n * @property {boolean} [absolutePosition=false] - when true the view will ignore the current direction when enabling gyroscope control\n * @property {'smooth' | 'fast'} [moveMode='smooth'] - How the gyroscope data is used to rotate the panorama.\n */\n\n\n// add gyroscope button\nDEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope';\nregisterButton(GyroscopeButton, 'caption:right');\n\n\nexport { EVENTS } from './constants';\n\n\nconst direction = new THREE.Vector3();\n\n\n/**\n * @summary Adds gyroscope controls on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class GyroscopePlugin extends AbstractPlugin {\n\n static id = 'gyroscope';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.GyroscopePlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @private\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {number} alphaOffset - current alpha offset for gyroscope controls\n * @property {boolean} enabled\n * @property {boolean} config_moveInertia - original config \"moveInertia\"\n */\n this.prop = {\n isSupported : this.__checkSupport(),\n alphaOffset : 0,\n enabled : false,\n config_moveInertia: true,\n };\n\n /**\n * @member {PSV.plugins.GyroscopePlugin.Options}\n * @private\n */\n this.config = {\n touchmove : true,\n absolutePosition: false,\n moveMode: 'smooth',\n ...options,\n };\n\n /**\n * @member {DeviceOrientationControls}\n * @private\n */\n this.controls = null;\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_ROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_ROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.stop();\n\n delete this.controls;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.STOP_ALL:\n this.stop();\n break;\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n this.__onBeforeRender();\n break;\n case CONSTANTS.EVENTS.BEFORE_ROTATE:\n this.__onBeforeRotate(e);\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Checks if the gyroscope is enabled\n * @returns {boolean}\n */\n isEnabled() {\n return this.prop.enabled;\n }\n\n /**\n * @summary Enables the gyroscope navigation if available\n * @returns {Promise}\n * @fires PSV.plugins.GyroscopePlugin.gyroscope-updated\n * @throws {PSV.PSVError} if the gyroscope API is not available/granted\n */\n start() {\n return this.prop.isSupported\n .then((supported) => {\n if (supported) {\n return this.__requestPermission();\n }\n else {\n utils.logWarn('gyroscope not available');\n return Promise.reject();\n }\n })\n .then((granted) => {\n if (granted) {\n return Promise.resolve();\n }\n else {\n utils.logWarn('gyroscope not allowed');\n return Promise.reject();\n }\n })\n .then(() => {\n this.psv.__stopAll();\n\n // disable inertia\n this.prop.config_moveInertia = this.psv.config.moveInertia;\n this.psv.config.moveInertia = false;\n\n // enable gyro controls\n if (!this.controls) {\n this.controls = new DeviceOrientationControls(new THREE.Object3D());\n }\n else {\n this.controls.connect();\n }\n\n // force reset\n this.controls.deviceOrientation = null;\n this.controls.screenOrientation = 0;\n this.controls.alphaOffset = 0;\n\n this.prop.alphaOffset = this.config.absolutePosition ? 0 : null;\n this.prop.enabled = true;\n\n this.trigger(EVENTS.GYROSCOPE_UPDATED, true);\n });\n }\n\n /**\n * @summary Disables the gyroscope navigation\n * @fires PSV.plugins.GyroscopePlugin.gyroscope-updated\n */\n stop() {\n if (this.isEnabled()) {\n this.controls.disconnect();\n\n this.prop.enabled = false;\n this.psv.config.moveInertia = this.prop.config_moveInertia;\n\n this.trigger(EVENTS.GYROSCOPE_UPDATED, false);\n\n this.psv.resetIdleTimer();\n }\n }\n\n /**\n * @summary Enables or disables the gyroscope navigation\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Handles gyro movements\n * @private\n */\n __onBeforeRender() {\n if (!this.isEnabled()) {\n return;\n }\n\n if (!this.controls.deviceOrientation) {\n return;\n }\n\n const position = this.psv.getPosition();\n\n // on first run compute the offset depending on the current viewer position and device orientation\n if (this.prop.alphaOffset === null) {\n this.controls.update();\n this.controls.object.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n this.prop.alphaOffset = sphericalCoords.longitude - position.longitude;\n }\n else {\n this.controls.alphaOffset = this.prop.alphaOffset;\n this.controls.update();\n this.controls.object.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n\n const target = {\n longitude: sphericalCoords.longitude,\n latitude : -sphericalCoords.latitude,\n };\n\n // having a slow speed on smalls movements allows to absorb the device/hand vibrations\n const step = this.config.moveMode === 'smooth' ? 3 : 10;\n this.psv.dynamics.position.goto(target, utils.getAngle(position, target) < 0.01 ? 1 : step);\n }\n }\n\n /**\n * @summary Intercepts moves and offsets the alpha angle\n * @param {external:uEvent.Event} e\n * @private\n */\n __onBeforeRotate(e) {\n if (this.isEnabled()) {\n e.preventDefault();\n\n if (this.config.touchmove) {\n this.prop.alphaOffset -= e.args[0].longitude - this.psv.getPosition().longitude;\n }\n }\n }\n\n /**\n * @summary Detects if device orientation is supported\n * @returns {Promise}\n * @private\n */\n __checkSupport() {\n if ('DeviceMotionEvent' in window && typeof DeviceMotionEvent.requestPermission === 'function') {\n return Promise.resolve(true);\n }\n else if ('DeviceOrientationEvent' in window) {\n return new Promise((resolve) => {\n const listener = (e) => {\n resolve(e && e.alpha !== null && !isNaN(e.alpha));\n\n window.removeEventListener('deviceorientation', listener);\n };\n\n window.addEventListener('deviceorientation', listener, false);\n setTimeout(listener, 10000);\n });\n }\n else {\n return Promise.resolve(false);\n }\n }\n\n /**\n * @summary Request permission to the motion API\n * @returns {Promise}\n * @private\n */\n __requestPermission() {\n if ('DeviceMotionEvent' in window && typeof DeviceMotionEvent.requestPermission === 'function') {\n return DeviceOrientationEvent.requestPermission()\n .then(response => response === 'granted')\n .catch(() => false);\n }\n else {\n return Promise.resolve(true);\n }\n }\n\n}\n"],"names":["EVENTS","GYROSCOPE_UPDATED","_zee","Vector3","_euler","Euler","_q0","Quaternion","_q1","Math","sqrt","DeviceOrientationControls","object","window","isSecureContext","console","error","scope","EPS","lastQuaternion","rotation","reorder","enabled","deviceOrientation","screenOrientation","alphaOffset","onDeviceOrientationChangeEvent","event","onScreenOrientationChangeEvent","orientation","setObjectQuaternion","quaternion","alpha","beta","gamma","orient","set","setFromEuler","multiply","setFromAxisAngle","connect","DeviceOrientationEvent","undefined","requestPermission","then","response","addEventListener","catch","disconnect","removeEventListener","update","device","MathUtils","degToRad","dot","copy","dispose","GyroscopeButton","navbar","plugin","psv","getPlugin","on","destroy","off","isSupported","initial","promise","prop","handleEvent","e","type","toggleActive","args","onClick","toggle","AbstractButton","id","icon","compass","DEFAULTS","lang","registerButton","direction","THREE","GyroscopePlugin","options","__checkSupport","config_moveInertia","config","touchmove","absolutePosition","moveMode","controls","init","CONSTANTS","STOP_ALL","BEFORE_ROTATE","BEFORE_RENDER","stop","__onBeforeRender","__onBeforeRotate","isEnabled","start","supported","__requestPermission","utils","logWarn","Promise","reject","granted","resolve","__stopAll","moveInertia","Object3D","trigger","resetIdleTimer","position","getPosition","getWorldDirection","sphericalCoords","dataHelper","vector3ToSphericalCoords","longitude","target","latitude","step","dynamics","goto","getAngle","preventDefault","DeviceMotionEvent","listener","isNaN","setTimeout","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;MACaA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAE;EAPC;;ECCtB,IAAMC,IAAI,GAAG,IAAIC,aAAJ,CAAa,CAAb,EAAgB,CAAhB,EAAmB,CAAnB,CAAb;;EACA,IAAMC,MAAM,GAAG,IAAIC,WAAJ,EAAf;;EACA,IAAMC,GAAG,GAAG,IAAIC,gBAAJ,EAAZ;;EACA,IAAMC,GAAG,GAAG,IAAID,gBAAJ,CAAgB,CAAE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KAAF,KAAY,IAAjB,IAAyB,CAACqG,KAAK,CAAC/D,CAAC,CAACtC,KAAH,CAAhC,CAAP;EAEAnB,UAAAA,MAAM,CAACoC,mBAAP,CAA2B,mBAA3B,EAAgDmF,QAAhD;EACD,SAJD;;EAMAvH,QAAAA,MAAM,CAACiC,gBAAP,CAAwB,mBAAxB,EAA6CsF,QAA7C,EAAuD,KAAvD;EACAE,QAAAA,UAAU,CAACF,QAAD,EAAW,KAAX,CAAV;EACD,OATM,CAAP;EAUD,KAXI,MAYA;EACH,aAAOxB,OAAO,CAACG,OAAR,CAAgB,KAAhB,CAAP;EACD;EACF;EAED;EACF;EACA;EACA;EACA;EA3QA;;EAAA,SA4QEN,mBA5QF,GA4QE,+BAAsB;EACpB,QAAI,uBAAuB5F,MAAvB,IAAiC,OAAOsH,iBAAiB,CAACxF,iBAAzB,KAA+C,UAApF,EAAgG;EAC9F,aAAOF,sBAAsB,CAACE,iBAAvB,GACJC,IADI,CACC,UAAAC,QAAQ;EAAA,eAAIA,QAAQ,KAAK,SAAjB;EAAA,OADT,EAEJE,KAFI,CAEE;EAAA,eAAM,KAAN;EAAA,OAFF,CAAP;EAGD,KAJD,MAKK;EACH,aAAO6D,OAAO,CAACG,OAAR,CAAgB,IAAhB,CAAP;EACD;EACF,GArRH;;EAAA;EAAA,EAAqCwB,gCAArC;EAAalD,gBAEJR,KAAK;EAFDQ,gBAIJrF,SAASA;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/markers.css b/dist/plugins/markers.css index 5117cf6c9..fc6b55dde 100644 --- a/dist/plugins/markers.css +++ b/dist/plugins/markers.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.6.3 + * Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/markers.js b/dist/plugins/markers.js index 54d17a0d9..c9c37366d 100644 --- a/dist/plugins/markers.js +++ b/dist/plugins/markers.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/resolution.js b/dist/plugins/resolution.js index 4e9e433d6..126bd3a3a 100644 --- a/dist/plugins/resolution.js +++ b/dist/plugins/resolution.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/settings.css b/dist/plugins/settings.css index 3972f8535..f2c677bc5 100644 --- a/dist/plugins/settings.css +++ b/dist/plugins/settings.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.6.3 + * Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/settings.js b/dist/plugins/settings.js index 0592e947d..678595514 100644 --- a/dist/plugins/settings.js +++ b/dist/plugins/settings.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/stereo.js b/dist/plugins/stereo.js index c20b2bfb2..f5c8ad885 100644 --- a/dist/plugins/stereo.js +++ b/dist/plugins/stereo.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -224,6 +224,13 @@ */ _this.markers = null; + /** + * @type {PSV.plugins.CompassPlugin} + * @readonly + * @private + */ + + _this.compass = null; /** * @member {Object} * @protected @@ -252,6 +259,7 @@ _AbstractPlugin.prototype.init.call(this); this.markers = this.psv.getPlugin('markers'); + this.compass = this.psv.getPlugin('compass'); this.gyroscope = this.psv.getPlugin('gyroscope'); if (!this.gyroscope) { @@ -271,6 +279,9 @@ this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.STOP_ALL, this); this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.CLICK, this); this.stop(); + delete this.markers; + delete this.compass; + delete this.gyroscope; _AbstractPlugin.prototype.destroy.call(this); } @@ -321,7 +332,7 @@ this.__lockOrientation(); return this.gyroscope.start().then(function () { - var _this2$markers; + var _this2$markers, _this2$compass; // switch renderer _this2.prop.renderer = _this2.psv.renderer.renderer; @@ -330,6 +341,7 @@ _this2.psv.needsUpdate(); (_this2$markers = _this2.markers) == null ? void 0 : _this2$markers.hide(); + (_this2$compass = _this2.compass) == null ? void 0 : _this2$compass.hide(); _this2.psv.navbar.hide(); @@ -357,12 +369,13 @@ _proto.stop = function stop() { if (this.isEnabled()) { - var _this$markers; + var _this$markers, _this$compass; this.psv.renderer.renderer = this.prop.renderer; this.prop.renderer = null; this.psv.needsUpdate(); (_this$markers = this.markers) == null ? void 0 : _this$markers.show(); + (_this$compass = this.compass) == null ? void 0 : _this$compass.show(); this.psv.navbar.show(); this.__unlockOrientation(); diff --git a/dist/plugins/stereo.js.map b/dist/plugins/stereo.js.map index 7361e5fab..74aed4224 100644 --- a/dist/plugins/stereo.js.map +++ b/dist/plugins/stereo.js.map @@ -1 +1 @@ -{"version":3,"file":"stereo.js","sources":["../../src/plugins/stereo/constants.js","../../src/plugins/stereo/StereoButton.js","../../src/plugins/stereo/StereoEffect.js","../../src/plugins/stereo/index.js"],"sourcesContent":["/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.StereoPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event stereo-updated\n * @memberof PSV.plugins.StereoPlugin\n * @summary Triggered when the stereo view is enabled/disabled\n * @param {boolean} enabled\n */\n STEREO_UPDATED: 'stereo-updated',\n};\n\n/**\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_OVERLAY_PLEASE_ROTATE = 'pleaseRotate';\n","import { AbstractButton } from '../..';\nimport { EVENTS } from './constants';\nimport stereo from './stereo.svg';\n\n/**\n * @summary Navigation bar stereo button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class StereoButton extends AbstractButton {\n\n static id = 'stereo';\n static icon = stereo;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-stereo-button', true);\n\n /**\n * @type {PSV.plugins.StereoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('stereo');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.STEREO_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.STEREO_UPDATED, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !this.plugin ? false : { initial: false, promise: this.plugin.prop.isSupported };\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === EVENTS.STEREO_UPDATED) {\n this.toggleActive(e.args[0]);\n }\n }\n\n /**\n * @override\n * @description Toggles stereo control\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import {\n\tStereoCamera,\n\tVector2\n} from 'three';\n\n/**\n * Copied from three.js examples\n * @private\n */\nclass StereoEffect {\n\n\tconstructor( renderer ) {\n\n\t\tconst _stereo = new StereoCamera();\n\t\t_stereo.aspect = 0.5;\n\t\tconst size = new Vector2();\n\n\t\tthis.setEyeSeparation = function ( eyeSep ) {\n\n\t\t\t_stereo.eyeSep = eyeSep;\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height ) {\n\n\t\t\trenderer.setSize( width, height );\n\n\t\t};\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tscene.updateMatrixWorld();\n\n\t\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\t\t_stereo.update( camera );\n\n\t\t\trenderer.getSize( size );\n\n\t\t\tif ( renderer.autoClear ) renderer.clear();\n\t\t\trenderer.setScissorTest( true );\n\n\t\t\trenderer.setScissor( 0, 0, size.width / 2, size.height );\n\t\t\trenderer.setViewport( 0, 0, size.width / 2, size.height );\n\t\t\trenderer.render( scene, _stereo.cameraL );\n\n\t\t\trenderer.setScissor( size.width / 2, 0, size.width / 2, size.height );\n\t\t\trenderer.setViewport( size.width / 2, 0, size.width / 2, size.height );\n\t\t\trenderer.render( scene, _stereo.cameraR );\n\n\t\t\trenderer.setScissorTest( false );\n\n\t\t};\n\n\t}\n\n}\n\nexport { StereoEffect };\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { EVENTS, ID_OVERLAY_PLEASE_ROTATE } from './constants';\nimport mobileRotateIcon from './mobile-rotate.svg';\nimport { StereoButton } from './StereoButton';\nimport { StereoEffect } from './StereoEffect';\n\n\n/**\n * @external NoSleep\n * @description {@link https://github.com/richtr/NoSleep.js}\n */\n\n\n// add stereo button\nDEFAULTS.lang[StereoButton.id] = 'Stereo view';\nregisterButton(StereoButton, 'caption:right');\n\n// other lang strings\nDEFAULTS.lang.stereoNotification = 'Click anywhere to exit stereo view.';\nDEFAULTS.lang.pleaseRotate = ['Please rotate your device', '(or tap to continue)'];\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Adds stereo view on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class StereoPlugin extends AbstractPlugin {\n\n static id = 'stereo';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @type {PSV.plugins.GyroscopePlugin}\n * @readonly\n * @private\n */\n this.gyroscope = null;\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @readonly\n * @private\n */\n this.markers = null;\n\n /**\n * @member {Object}\n * @protected\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {external:THREE.WebGLRenderer} renderer - original renderer\n * @property {external:NoSleep} noSleep\n * @property {WakeLockSentinel} wakeLock\n */\n this.prop = {\n isSupported: false,\n renderer : null,\n noSleep : null,\n wakeLock : null,\n };\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n this.gyroscope = this.psv.getPlugin('gyroscope');\n\n if (!this.gyroscope) {\n throw new PSVError('Stereo plugin requires the Gyroscope plugin');\n }\n\n this.prop.isSupported = this.gyroscope.prop.isSupported;\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.CLICK, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.off(CONSTANTS.EVENTS.CLICK, this);\n\n this.stop();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.STOP_ALL:\n case CONSTANTS.EVENTS.CLICK:\n this.stop();\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Checks if the stereo view is enabled\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.prop.renderer;\n }\n\n /**\n * @summary Enables the stereo view\n * @description\n * - enables NoSleep.js\n * - enables full screen\n * - starts gyroscope controle\n * - hides markers, navbar and panel\n * - instanciate {@link external:THREE.StereoEffect}\n * @returns {Promise}\n * @fires PSV.plugins.StereoPlugin.stereo-updated\n * @throws {PSV.PSVError} if the gyroscope API is not available/granted\n */\n start() {\n // Need to be in the main event queue\n this.psv.enterFullscreen();\n this.__startNoSleep();\n this.__lockOrientation();\n\n return this.gyroscope.start().then(() => {\n // switch renderer\n this.prop.renderer = this.psv.renderer.renderer;\n this.psv.renderer.renderer = new StereoEffect(this.psv.renderer.renderer);\n\n this.psv.needsUpdate();\n\n this.markers?.hide();\n this.psv.navbar.hide();\n this.psv.panel.hide();\n\n this.trigger(EVENTS.STEREO_UPDATED, true);\n\n this.psv.notification.show({\n content: this.psv.config.lang.stereoNotification,\n timeout: 3000,\n });\n }, () => {\n this.__unlockOrientation();\n this.__stopNoSleep();\n this.psv.exitFullscreen();\n });\n }\n\n /**\n * @summary Disables the stereo view\n * @fires PSV.plugins.StereoPlugin.stereo-updated\n */\n stop() {\n if (this.isEnabled()) {\n this.psv.renderer.renderer = this.prop.renderer;\n this.prop.renderer = null;\n\n this.psv.needsUpdate();\n\n this.markers?.show();\n this.psv.navbar.show();\n\n this.__unlockOrientation();\n this.__stopNoSleep();\n this.psv.exitFullscreen();\n this.gyroscope.stop();\n\n this.trigger(EVENTS.STEREO_UPDATED, false);\n }\n }\n\n /**\n * @summary Enables or disables the stereo view\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Enables WakeLock or NoSleep.js\n * @private\n */\n __startNoSleep() {\n if ('wakeLock' in navigator) {\n navigator.wakeLock.request('screen')\n .then((wakeLock) => {\n this.prop.wakeLock = wakeLock;\n })\n .catch(() => utils.logWarn('Cannot acquire WakeLock'));\n }\n else if ('NoSleep' in window) {\n if (!this.prop.noSleep) {\n this.prop.noSleep = new window.NoSleep();\n }\n this.prop.noSleep.enable();\n }\n else {\n utils.logWarn('NoSleep is not available');\n }\n }\n\n /**\n * @summary Disables WakeLock or NoSleep.js\n * @private\n */\n __stopNoSleep() {\n if (this.prop.wakeLock) {\n this.prop.wakeLock.release();\n this.prop.wakeLock = null;\n }\n else if (this.prop.noSleep) {\n this.prop.noSleep.disable();\n }\n }\n\n /**\n * @summary Tries to lock the device in landscape or display a message\n * @private\n */\n __lockOrientation() {\n let displayRotateMessageTimeout;\n\n const displayRotateMessage = () => {\n if (window.innerHeight > window.innerWidth) {\n this.psv.overlay.show({\n id : ID_OVERLAY_PLEASE_ROTATE,\n image : mobileRotateIcon,\n text : this.psv.config.lang.pleaseRotate[0],\n subtext: this.psv.config.lang.pleaseRotate[1],\n });\n }\n\n if (displayRotateMessageTimeout) {\n clearTimeout(displayRotateMessageTimeout);\n displayRotateMessageTimeout = null;\n }\n };\n\n if (window.screen?.orientation) {\n window.screen.orientation.lock('landscape').then(null, () => displayRotateMessage());\n displayRotateMessageTimeout = setTimeout(() => displayRotateMessage(), 500);\n }\n else {\n displayRotateMessage();\n }\n }\n\n /**\n * @summary Unlock the device orientation\n * @private\n */\n __unlockOrientation() {\n if (window.screen?.orientation) {\n window.screen.orientation.unlock();\n }\n else {\n this.psv.overlay.hide(ID_OVERLAY_PLEASE_ROTATE);\n }\n }\n\n}\n"],"names":["EVENTS","STEREO_UPDATED","ID_OVERLAY_PLEASE_ROTATE","StereoButton","navbar","plugin","psv","getPlugin","on","destroy","off","isSupported","initial","promise","prop","handleEvent","e","type","toggleActive","args","onClick","toggle","AbstractButton","id","icon","stereo","StereoEffect","renderer","_stereo","StereoCamera","aspect","size","Vector2","setEyeSeparation","eyeSep","setSize","width","height","render","scene","camera","updateMatrixWorld","parent","update","getSize","autoClear","clear","setScissorTest","setScissor","setViewport","cameraL","cameraR","DEFAULTS","lang","registerButton","stereoNotification","pleaseRotate","StereoPlugin","gyroscope","markers","noSleep","wakeLock","init","PSVError","CONSTANTS","STOP_ALL","CLICK","stop","isEnabled","start","enterFullscreen","__startNoSleep","__lockOrientation","then","needsUpdate","hide","panel","trigger","notification","show","content","config","timeout","__unlockOrientation","__stopNoSleep","exitFullscreen","navigator","request","catch","utils","logWarn","window","NoSleep","enable","release","disable","displayRotateMessageTimeout","displayRotateMessage","innerHeight","innerWidth","overlay","image","mobileRotateIcon","text","subtext","clearTimeout","screen","orientation","lock","setTimeout","unlock","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA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,EAAgC;EAC9BhB,MAAAA,MAAM,CAACe,MAAP,CAAcC,WAAd,CAA0BC,IAA1B,CAA+B,WAA/B,EAA4CnC,IAA5C,CAAiD,IAAjD,EAAuD;EAAA,eAAMwB,oBAAoB,EAA1B;EAAA,OAAvD;EACAD,MAAAA,2BAA2B,GAAGa,UAAU,CAAC;EAAA,eAAMZ,oBAAoB,EAA1B;EAAA,OAAD,EAA+B,GAA/B,CAAxC;EACD,KAHD,MAIK;EACHA,MAAAA,oBAAoB;EACrB;EACF;EAED;EACF;EACA;EACA;EApPA;;EAAA,SAqPEd,mBArPF,GAqPE,+BAAsB;EAAA;;EACpB,2BAAIQ,MAAM,CAACe,MAAX,aAAI,gBAAeC,WAAnB,EAAgC;EAC9BhB,MAAAA,MAAM,CAACe,MAAP,CAAcC,WAAd,CAA0BG,MAA1B;EACD,KAFD,MAGK;EACH,WAAKxG,GAAL,CAAS8F,OAAT,CAAiBzB,IAAjB,CAAsBzE,wBAAtB;EACD;EACF,GA5PH;;EAAA;EAAA,EAAkC6G,gCAAlC;EAAatD,aAEJlC,KAAK;EAFDkC,aAIJzD,SAASA;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"stereo.js","sources":["../../src/plugins/stereo/constants.js","../../src/plugins/stereo/StereoButton.js","../../src/plugins/stereo/StereoEffect.js","../../src/plugins/stereo/index.js"],"sourcesContent":["/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.StereoPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event stereo-updated\n * @memberof PSV.plugins.StereoPlugin\n * @summary Triggered when the stereo view is enabled/disabled\n * @param {boolean} enabled\n */\n STEREO_UPDATED: 'stereo-updated',\n};\n\n/**\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_OVERLAY_PLEASE_ROTATE = 'pleaseRotate';\n","import { AbstractButton } from '../..';\nimport { EVENTS } from './constants';\nimport stereo from './stereo.svg';\n\n/**\n * @summary Navigation bar stereo button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class StereoButton extends AbstractButton {\n\n static id = 'stereo';\n static icon = stereo;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-stereo-button', true);\n\n /**\n * @type {PSV.plugins.StereoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('stereo');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.STEREO_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.STEREO_UPDATED, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !this.plugin ? false : { initial: false, promise: this.plugin.prop.isSupported };\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === EVENTS.STEREO_UPDATED) {\n this.toggleActive(e.args[0]);\n }\n }\n\n /**\n * @override\n * @description Toggles stereo control\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import {\n\tStereoCamera,\n\tVector2\n} from 'three';\n\n/**\n * Copied from three.js examples\n * @private\n */\nclass StereoEffect {\n\n\tconstructor( renderer ) {\n\n\t\tconst _stereo = new StereoCamera();\n\t\t_stereo.aspect = 0.5;\n\t\tconst size = new Vector2();\n\n\t\tthis.setEyeSeparation = function ( eyeSep ) {\n\n\t\t\t_stereo.eyeSep = eyeSep;\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height ) {\n\n\t\t\trenderer.setSize( width, height );\n\n\t\t};\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tscene.updateMatrixWorld();\n\n\t\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\t\t_stereo.update( camera );\n\n\t\t\trenderer.getSize( size );\n\n\t\t\tif ( renderer.autoClear ) renderer.clear();\n\t\t\trenderer.setScissorTest( true );\n\n\t\t\trenderer.setScissor( 0, 0, size.width / 2, size.height );\n\t\t\trenderer.setViewport( 0, 0, size.width / 2, size.height );\n\t\t\trenderer.render( scene, _stereo.cameraL );\n\n\t\t\trenderer.setScissor( size.width / 2, 0, size.width / 2, size.height );\n\t\t\trenderer.setViewport( size.width / 2, 0, size.width / 2, size.height );\n\t\t\trenderer.render( scene, _stereo.cameraR );\n\n\t\t\trenderer.setScissorTest( false );\n\n\t\t};\n\n\t}\n\n}\n\nexport { StereoEffect };\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { EVENTS, ID_OVERLAY_PLEASE_ROTATE } from './constants';\nimport mobileRotateIcon from './mobile-rotate.svg';\nimport { StereoButton } from './StereoButton';\nimport { StereoEffect } from './StereoEffect';\n\n\n/**\n * @external NoSleep\n * @description {@link https://github.com/richtr/NoSleep.js}\n */\n\n\n// add stereo button\nDEFAULTS.lang[StereoButton.id] = 'Stereo view';\nregisterButton(StereoButton, 'caption:right');\n\n// other lang strings\nDEFAULTS.lang.stereoNotification = 'Click anywhere to exit stereo view.';\nDEFAULTS.lang.pleaseRotate = ['Please rotate your device', '(or tap to continue)'];\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Adds stereo view on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class StereoPlugin extends AbstractPlugin {\n\n static id = 'stereo';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @type {PSV.plugins.GyroscopePlugin}\n * @readonly\n * @private\n */\n this.gyroscope = null;\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @readonly\n * @private\n */\n this.markers = null;\n\n /**\n * @type {PSV.plugins.CompassPlugin}\n * @readonly\n * @private\n */\n this.compass = null;\n\n /**\n * @member {Object}\n * @protected\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {external:THREE.WebGLRenderer} renderer - original renderer\n * @property {external:NoSleep} noSleep\n * @property {WakeLockSentinel} wakeLock\n */\n this.prop = {\n isSupported: false,\n renderer : null,\n noSleep : null,\n wakeLock : null,\n };\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n this.compass = this.psv.getPlugin('compass');\n this.gyroscope = this.psv.getPlugin('gyroscope');\n\n if (!this.gyroscope) {\n throw new PSVError('Stereo plugin requires the Gyroscope plugin');\n }\n\n this.prop.isSupported = this.gyroscope.prop.isSupported;\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.CLICK, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.off(CONSTANTS.EVENTS.CLICK, this);\n\n this.stop();\n\n delete this.markers;\n delete this.compass;\n delete this.gyroscope;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.STOP_ALL:\n case CONSTANTS.EVENTS.CLICK:\n this.stop();\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Checks if the stereo view is enabled\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.prop.renderer;\n }\n\n /**\n * @summary Enables the stereo view\n * @description\n * - enables NoSleep.js\n * - enables full screen\n * - starts gyroscope controle\n * - hides markers, navbar and panel\n * - instanciate {@link external:THREE.StereoEffect}\n * @returns {Promise}\n * @fires PSV.plugins.StereoPlugin.stereo-updated\n * @throws {PSV.PSVError} if the gyroscope API is not available/granted\n */\n start() {\n // Need to be in the main event queue\n this.psv.enterFullscreen();\n this.__startNoSleep();\n this.__lockOrientation();\n\n return this.gyroscope.start().then(() => {\n // switch renderer\n this.prop.renderer = this.psv.renderer.renderer;\n this.psv.renderer.renderer = new StereoEffect(this.psv.renderer.renderer);\n\n this.psv.needsUpdate();\n\n this.markers?.hide();\n this.compass?.hide();\n this.psv.navbar.hide();\n this.psv.panel.hide();\n\n this.trigger(EVENTS.STEREO_UPDATED, true);\n\n this.psv.notification.show({\n content: this.psv.config.lang.stereoNotification,\n timeout: 3000,\n });\n }, () => {\n this.__unlockOrientation();\n this.__stopNoSleep();\n this.psv.exitFullscreen();\n });\n }\n\n /**\n * @summary Disables the stereo view\n * @fires PSV.plugins.StereoPlugin.stereo-updated\n */\n stop() {\n if (this.isEnabled()) {\n this.psv.renderer.renderer = this.prop.renderer;\n this.prop.renderer = null;\n\n this.psv.needsUpdate();\n\n this.markers?.show();\n this.compass?.show();\n this.psv.navbar.show();\n\n this.__unlockOrientation();\n this.__stopNoSleep();\n this.psv.exitFullscreen();\n this.gyroscope.stop();\n\n this.trigger(EVENTS.STEREO_UPDATED, false);\n }\n }\n\n /**\n * @summary Enables or disables the stereo view\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Enables WakeLock or NoSleep.js\n * @private\n */\n __startNoSleep() {\n if ('wakeLock' in navigator) {\n navigator.wakeLock.request('screen')\n .then((wakeLock) => {\n this.prop.wakeLock = wakeLock;\n })\n .catch(() => utils.logWarn('Cannot acquire WakeLock'));\n }\n else if ('NoSleep' in window) {\n if (!this.prop.noSleep) {\n this.prop.noSleep = new window.NoSleep();\n }\n this.prop.noSleep.enable();\n }\n else {\n utils.logWarn('NoSleep is not available');\n }\n }\n\n /**\n * @summary Disables WakeLock or NoSleep.js\n * @private\n */\n __stopNoSleep() {\n if (this.prop.wakeLock) {\n this.prop.wakeLock.release();\n this.prop.wakeLock = null;\n }\n else if (this.prop.noSleep) {\n this.prop.noSleep.disable();\n }\n }\n\n /**\n * @summary Tries to lock the device in landscape or display a message\n * @private\n */\n __lockOrientation() {\n let displayRotateMessageTimeout;\n\n const displayRotateMessage = () => {\n if (window.innerHeight > window.innerWidth) {\n this.psv.overlay.show({\n id : ID_OVERLAY_PLEASE_ROTATE,\n image : mobileRotateIcon,\n text : this.psv.config.lang.pleaseRotate[0],\n subtext: this.psv.config.lang.pleaseRotate[1],\n });\n }\n\n if (displayRotateMessageTimeout) {\n clearTimeout(displayRotateMessageTimeout);\n displayRotateMessageTimeout = null;\n }\n };\n\n if (window.screen?.orientation) {\n window.screen.orientation.lock('landscape').then(null, () => displayRotateMessage());\n displayRotateMessageTimeout = setTimeout(() => displayRotateMessage(), 500);\n }\n else {\n displayRotateMessage();\n }\n }\n\n /**\n * @summary Unlock the device orientation\n * @private\n */\n __unlockOrientation() {\n if (window.screen?.orientation) {\n window.screen.orientation.unlock();\n }\n else {\n this.psv.overlay.hide(ID_OVERLAY_PLEASE_ROTATE);\n }\n }\n\n}\n"],"names":["EVENTS","STEREO_UPDATED","ID_OVERLAY_PLEASE_ROTATE","StereoButton","navbar","plugin","psv","getPlugin","on","destroy","off","isSupported","initial","promise","prop","handleEvent","e","type","toggleActive","args","onClick","toggle","AbstractButton","id","icon","stereo","StereoEffect","renderer","_stereo","StereoCamera","aspect","size","Vector2","setEyeSeparation","eyeSep","setSize","width","height","render","scene","camera","updateMatrixWorld","parent","update","getSize","autoClear","clear","setScissorTest","setScissor","setViewport","cameraL","cameraR","DEFAULTS","lang","registerButton","stereoNotification","pleaseRotate","StereoPlugin","gyroscope","markers","compass","noSleep","wakeLock","init","PSVError","CONSTANTS","STOP_ALL","CLICK","stop","isEnabled","start","enterFullscreen","__startNoSleep","__lockOrientation","then","needsUpdate","hide","panel","trigger","notification","show","content","config","timeout","__unlockOrientation","__stopNoSleep","exitFullscreen","navigator","request","catch","utils","logWarn","window","NoSleep","enable","release","disable","displayRotateMessageTimeout","displayRotateMessage","innerHeight","innerWidth","overlay","image","mobileRotateIcon","text","subtext","clearTimeout","screen","orientation","lock","setTimeout","unlock","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;MACaA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,cAAc,EAAE;EAPI;EAUtB;EACA;EACA;EACA;EACA;;EACO,IAA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AIyC,2BAAJ,EAAiC;EAC/BS,QAAAA,YAAY,CAACT,2BAAD,CAAZ;EACAA,QAAAA,2BAA2B,GAAG,IAA9B;EACD;EACF,KAdD;;EAgBA,0BAAIL,MAAM,CAACe,MAAX,aAAI,eAAeC,WAAnB,EAAgC;EAC9BhB,MAAAA,MAAM,CAACe,MAAP,CAAcC,WAAd,CAA0BC,IAA1B,CAA+B,WAA/B,EAA4CnC,IAA5C,CAAiD,IAAjD,EAAuD;EAAA,eAAMwB,oBAAoB,EAA1B;EAAA,OAAvD;EACAD,MAAAA,2BAA2B,GAAGa,UAAU,CAAC;EAAA,eAAMZ,oBAAoB,EAA1B;EAAA,OAAD,EAA+B,GAA/B,CAAxC;EACD,KAHD,MAIK;EACHA,MAAAA,oBAAoB;EACrB;EACF;EAED;EACF;EACA;EACA;EAlQA;;EAAA,SAmQEd,mBAnQF,GAmQE,+BAAsB;EAAA;;EACpB,2BAAIQ,MAAM,CAACe,MAAX,aAAI,gBAAeC,WAAnB,EAAgC;EAC9BhB,MAAAA,MAAM,CAACe,MAAP,CAAcC,WAAd,CAA0BG,MAA1B;EACD,KAFD,MAGK;EACH,WAAKzG,GAAL,CAAS+F,OAAT,CAAiBzB,IAAjB,CAAsB1E,wBAAtB;EACD;EACF,GA1QH;;EAAA;EAAA,EAAkC8G,gCAAlC;EAAavD,aAEJlC,KAAK;EAFDkC,aAIJzD,SAASA;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/video.css b/dist/plugins/video.css index 85e40baad..37917a675 100644 --- a/dist/plugins/video.css +++ b/dist/plugins/video.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.6.3 + * Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/video.js b/dist/plugins/video.js index 8b8658e9a..1c446f0a2 100644 --- a/dist/plugins/video.js +++ b/dist/plugins/video.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/virtual-tour.css b/dist/plugins/virtual-tour.css index b19ccb1d0..8a54996a1 100644 --- a/dist/plugins/virtual-tour.css +++ b/dist/plugins/virtual-tour.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.6.3 + * Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/virtual-tour.js b/dist/plugins/virtual-tour.js index 2973add5b..adf91b00a 100644 --- a/dist/plugins/virtual-tour.js +++ b/dist/plugins/virtual-tour.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/visible-range.js b/dist/plugins/visible-range.js index 19dfe2c67..fd4846188 100644 --- a/dist/plugins/visible-range.js +++ b/dist/plugins/visible-range.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.6.3 +* Photo Sphere Viewer 4.6.4 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/docs/.netlify/functions/package.json b/docs/.netlify/functions/package.json deleted file mode 100644 index 9a8d696ce..000000000 --- a/docs/.netlify/functions/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "psv-netlify-functions", - "version": "1.0.0", - "license": "MIT", - "private": true, - "dependencies": { - "axios": "^0.24.0" - } -} diff --git a/docs/.vuepress/components/Announcements.vue b/docs/.vuepress/components/Announcements.vue index 3a07a4b8e..f655ef72c 100644 --- a/docs/.vuepress/components/Announcements.vue +++ b/docs/.vuepress/components/Announcements.vue @@ -10,7 +10,6 @@